http://stackoverflow.com/a/26597714
has body: append('') appends a element, not simple the the string ''. So the call to append($('#content').data("myDate")) then appends the date after the .visitdate span you just created instead of inside it. You'd be better off to just concatenate the strings building the .visitdate span: var visitStatus = $('#sideBar').find("p[class=visitstatus]"); $(visitStatus).append('Visited on '); $(visitStatus).append('' + $('#content').data("myDate") + '');
accepted answer of: http://stackoverflow.com/q/26597232
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26597232
type: Answer

http://stackoverflow.com/comment/41870580
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26631130
has text: @shinjw Though the choice is largely arbitrary, it makes splitting a string into multiple parts more straightforward: `int startIdx = 0, midIdx = 5, endIdx=10; String first = foo.substring( startIdx, midIdx ); String second = foo.substring( midIdx, endIdx );`

http://stackoverflow.com/comment/62287966
has text: That's a good point, but I had troubles extending Map.Entry like this: `public class FooClassMap extends HashMap<String, FooClass> { interface Entry extends Map.Entry<String, FooClass>{} }`. do you have any suggestions?
type: Comment
comment on: http://stackoverflow.com/a/26666287
score: 0
type: AnswerComment

http://stackoverflow.com/q/26572321
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19588605
answer count: 0
has comment: http://stackoverflow.com/comment/41765725
type: Question
tagged with: animation
has body: I have this ball object that I'm trying to play around with. I created for it a bouncing animation that when the ball hit the surface it get squash (is this the proper word in English?) and bounce back to a round form when it leave the surface. [PROBLEM 1] Because of the different TextureRegions that create the animation, it seems as if the ball increase in size when the TextureRegions of the squash part run. [PROBLEM 2] How should I time it so only when the ball hit the surface the three (TextureRegions) squash parts will run? P.S I thought of dividing the animation to two parts, when the ball hit the surface and leave it, but will it be the right solution? If so, how should I do it to make the full animation look right? Thanks for the help. Please don't direct me to tutorials that don't cover the specifics of what I'm trying to do or to documentations in the length of a phone book that somewhere along the lines I might find the solution (well, at least be sure that it's there...). Edit: I fixed the problem with the animation, now the timing is the only problem. This is the code of the animation and the one I use to make it appear as if the ball bounce: TextureRegion[] ballJumpAnimation = {ballJump, ballJump2, ballJump3, ballJump4, ballump5, ballJump6, ballJump7}; ballJumpAni = new Animation(0.16f, ballJumpAnimation); ballJumpAni.setPlayMode(Animation.PlayMode.LOOP_PINGPONG); // The below code is in the ball's class public void update(float delta) { velocity.add(acceleration.cpy().scl(delta)); if (position.y &gt;= 164) { velocity.y = -70; acceleration.y = 80; } position.add(velocity.cpy().scl(delta)); } The first three TextureRegions are when the ball touching the surface, the other four are when it is in the air. The delta is float that I get from the render method of a class the implement screen. In regards to the calculations, never was good in math and wanted to see if I can make a jumping calculation.
has comment: http://stackoverflow.com/comment/41764074
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41764682
has title: How to switch and time animations in libGDX?
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41767618

jdo
tags question: http://stackoverflow.com/q/26639078
tags question: http://stackoverflow.com/q/26542940
tag name: jdo
type: Tag

http://stackoverflow.com/comment/41735261
type: Comment
score: 1
type: AnswerComment
has text: Better would be to use generics and make the cast irrelevant.
comment on: http://stackoverflow.com/a/26556956

http://stackoverflow.com/comment/41675501
has text: please post you compelete code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26523582
score: 0

http://stackoverflow.com/comment/41802868
type: AnswerComment
comment on: http://stackoverflow.com/a/26592817
score: 0
type: Comment
has text: becouse i'm starting programing and dont know how to do this :x Can i ask You to tell me how move old Jframe? Greeting

http://stackoverflow.com/a/26631889
has comment: http://stackoverflow.com/comment/41873988
has comment: http://stackoverflow.com/comment/41871971
has comment: http://stackoverflow.com/comment/41876813
downvote count: 0
has body: I think in spring-dispatcher-servlet.xml the Bean configuration is wrong. The package for that class is wrong. Use this: <?xml version="1.0" encoding="UTF-8"?> /WEB-INF/ .jsp That should solve the ClassNotFoundException In addition I would add a provided dependency to pom.xml to have the HttpServletRequest around: javax.servlet javax.servlet-api 3.0.1 provided
answers question: http://stackoverflow.com/q/26631524
has comment: http://stackoverflow.com/comment/41886148
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41878398
score: 2

http://stackoverflow.com/q/26537890
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/41795306
upvote count: 7
has comment: http://stackoverflow.com/comment/41703314
has answer: http://stackoverflow.com/a/55172032
has title: Compiler compiler that consumes BNF
type: Question
has comment: http://stackoverflow.com/comment/41703297
has comment: http://stackoverflow.com/comment/41702081
has comment: http://stackoverflow.com/comment/41703254
has answer: http://stackoverflow.com/a/26540129
has comment: http://stackoverflow.com/comment/41703564
downvote count: 0
answer count: 3
linked to: http://stackoverflow.com/q/1888854
has answer: http://stackoverflow.com/a/26541574
has body: Is there any reason why there are no parser generators that consume straight BNF? I'm familiar with JavaCC and Antlr, and recently came across Parse2. It seems that each has its own notation. BNF is really easy to read and the other notations aren't. BNF is unambiguous. Is there some inherent reason why I can't feed BNF to a compiler compiler and get a parse tree out?
favorite count: 0
has comment: http://stackoverflow.com/comment/41703368
linked to: http://stackoverflow.com/q/1317256
has comment: http://stackoverflow.com/comment/41702249
tagged with: parser-generator
has comment: http://stackoverflow.com/comment/41707816
type: UnansweredQuestion
tagged with: compiler-construction
tagged with: bnf
has comment: http://stackoverflow.com/comment/41703583
has comment: http://stackoverflow.com/comment/41701719

http://stackoverflow.com/comment/41719507
score: 0
type: AnswerComment
type: Comment
has text: can you suggest me, what should be the working code..actually i am new to multi threading! so help will be really great. thanks
comment on: http://stackoverflow.com/a/26548400

http://stackoverflow.com/comment/41920060
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26658938
has text: Have you read about for loops? what does google tell you...
score: 3

http://stackoverflow.com/a/26722367
answers question: http://stackoverflow.com/q/26566813
type: Answer
downvote count: 0
score: 1
has body: A few years ago there was a project called compass that was exactly what you need. Here is how it could be used to map object to lucene's index. Unfortunately, today it is no longer under any development because its author founded amazing ElasticSearch. Also, you could take a look at Hibernate Search, that should be pretty powerful too, according to its samples.
upvote count: 1

http://stackoverflow.com/comment/41845108
comment on: http://stackoverflow.com/q/26615426
has text: OK, so for a start, try using the name "button" for both buttons on meeting_Id.jsp, since this is the name you're checking for.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26588591
has comment: http://stackoverflow.com/comment/41864399
score: 0
has comment: http://stackoverflow.com/comment/41864963
has body: You could simply try this solution: public static boolean ghostHunters(String word) { word = word.toLowerCase() + ""; if (word.contains("boo") &amp;&amp; word.length() &gt; 3) { if (word.contains("booo")) return false; else return true; } else return false; } It checks if the string contains more than two o after a b, and that's exactly what you need.
type: Answer
has comment: http://stackoverflow.com/comment/41864829
answers question: http://stackoverflow.com/q/26588315

http://stackoverflow.com/a/26657297
downvote count: 0
has comment: http://stackoverflow.com/comment/41945990
accepted answer of: http://stackoverflow.com/q/26657071
has comment: http://stackoverflow.com/comment/41985034
answers question: http://stackoverflow.com/q/26657071
upvote count: 2
has comment: http://stackoverflow.com/comment/41918190
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41985001
has body: Would you consider using a JPanel and overriding the paintComponent method? Something like this: BufferedImage image = ... //i'll leave this blank since there are several ways to get a bufferedimage. I'll leave an eg: ImageIO.read(new File("/path/to/image")); JPanel pane = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, null); }}; and then adding the panel to your frame. You can do the same with the container in the JFrame. The logic is simillar.
score: 2

http://stackoverflow.com/comment/108890683
comment on: http://stackoverflow.com/a/34769292
type: AnswerComment
score: 0
type: Comment
has text: @Pradeep thanks using your code i am able to open the outlook...but how i will send that email automatically? Please confirm.

http://stackoverflow.com/a/26635750
score: 4
accepted answer of: http://stackoverflow.com/q/26635693
upvote count: 4
answers question: http://stackoverflow.com/q/26635693
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41879736
has comment: http://stackoverflow.com/comment/41879467
type: Answer
has body: is it still necessary to make doSomethingElse synchronized? No. Since the method is private, and the only context in which it could be called is synchronized as well, doSomethingElse does not need to be synchronized. Note that it does not hurt to make doSomethingElse synchronized, for two reasons: In case someone else changes your code to call doSomethingElse from some other place that is not synchronized, you would be safe. Re-entering a lock that the thread already owns is very cheap, so you do not need to worry about performance consequences. When other people read your code, and see you accessing shared resources from doSomethingElse without synchronization, they are not surprised at how you can get away with that. Also note that it is important that both methods are non-static. Had doSomethingElse been static and needed access to mutable static resources, you would need to synchronize it separately from doSomething.

http://stackoverflow.com/a/26659556
downvote count: 0
score: 7
has body: It's because random.nextInt() return a value between -2,147,483,648 and 2,147,483,647. What you want is random.nextInt("abcdefghijklmnopqrstuvwxyz".length()) I would also assign "abcdefghijklmnopqrstuvwxyz" to a constant. private final static String ALPHABET = "abcdefghijklmnopqrstuvwxyz"; Char randomChar = ALPHABET.charAt(random.nextInt(ALPHABET.length()));
answers question: http://stackoverflow.com/q/26659486
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41921337
accepted answer of: http://stackoverflow.com/q/26659486
type: Answer

http://stackoverflow.com/q/26670136
upvote count: 2
possible better answer: http://stackoverflow.com/a/26670317
has comment: http://stackoverflow.com/comment/41941024
linked to: http://stackoverflow.com/q/23145416
has title: Reading data from a text file and storing it in an object
has answer: http://stackoverflow.com/a/26670317
has comment: http://stackoverflow.com/comment/41940975
answer count: 3
has answer: http://stackoverflow.com/a/26670396
favorite count: 0
has body: I have a text file with a number on each line. 0 55 3 15 63 8 0 -8 9 89 504 32 I have a Car which accepts three parameters: the starting odometer reading the final odometer reading the litres The first line in the text file corresponds to the starting odometer reading. The second is the final reading. The third is the litres. The fourth is the starting odometer reading for the second Car, etc. I need to read the text file, create an object, and this the parameters to the car. For car3 (0, -8, 9) there is a negative number, so the entire set is ignored and (89, 504, 32) becomes car3. I have referred to Anubian Noob's answer; and this is my code so far: final String INPUT_FILE = "data.txt"; final String OUTPUT_FILE = "report.txt"; BufferedReader inputFile = new BufferedReader (new FileReader (INPUT_FILE)); BufferedWriter outputFile = new BufferedWriter (new FileWriter (OUTPUT_FILE)); LineNumberReader lineNumber = new LineNumberReader (new FileReader (INPUT_FILE)); lineNumber.skip(Long.MAX_VALUE); int length = lineNumber.getLineNumber(); lineNumber.close(); String line = inputFile.readLine(); Car[] car = new Car[length/3]; while (line != null) { for (int i = 0; i &lt; length/3; i += 3) { int startReading = Integer.parseInt(inputFile.readLine()); int endReading = Integer.parseInt(inputFile.readLine()); int liter = Integer.parseInt(inputFile.readLine()); car[i] = new Car (startKm, endKm, litre); } } inputFile.close(); outputFile.close(); On line int liter = Integer.parseInt(inputFile.readLine()); I get the following error: java.lang.NumberFormatException: null null (in java.lang.Integer) How do I store the three pieces of information into its respective object? *Note: There isn't a set amount of lines in the text file, and we have to use an array.
has comment: http://stackoverflow.com/comment/41941211
accepted answer: http://stackoverflow.com/a/26670340
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26670340
type: Question

http://stackoverflow.com/comment/41788336
has text: You have a component-scan that retrieve all @Repository, indeed the problem is for the bean "numberGeneratorImpl" that you haven't in your spring context. You must exclude it form component scan else you have 2 bean of NumberGeneratorImpl.class
score: 0
comment on: http://stackoverflow.com/q/26586226
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26538804
tagged with: java
type: Question
score: 0
answer count: 1
has body: Maybe I'm overthinking this but I'd like some advice. Customers can place an order inside my GWT application and on a secondary computer I want to monitor those submittals inside th eGWT application and flash an alarm every time an order is submitted, provided the user has OK'd this. I cant figure out the best way to do this. Orders are submitted to a mysql database if that makes any difference. Does anyone have a suggestion on what to do or try?
has answer: http://stackoverflow.com/a/26540141
type: UnansweredQuestion
tagged with: mysql
has title: Monitor database with GWT
tagged with: gwt

http://stackoverflow.com/comment/41723525
type: AnswerComment
score: 0
type: Comment
has text: Ya i am only initializing the fixedvalues with values of inputStr or else it will be null know.
comment on: http://stackoverflow.com/a/26550612

http://stackoverflow.com/comment/41745514
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26562612
has text: I wonder if creating the table with column `purchase_name` with type `text` would help.
type: QuestionComment

http://stackoverflow.com/q/26574534
has comment: http://stackoverflow.com/comment/41790593
has comment: http://stackoverflow.com/comment/41781026
upvote count: 1
tagged with: prepared-statement
has title: Spring JDBC PreparedStatementCreator Invalid Api Usage
has answer: http://stackoverflow.com/a/26588634
downvote count: 0
linked to: http://stackoverflow.com/q/23994196
has body: I´d like to know how to use the PreparedStatementCreatorFactory. As far as i read it goes like the following code, except that in rare examples not only the sql is given to the factory but also an int[] types, but i dont´t want to pass in hundreds of types, as jdbc usually retrieves the types based on the java types if you pass params as object[]. I´m using Spring 3.1.3 RELEASE. public int addEntityAndGetId(String name, String address){ String sql = "INSERT INTO mytable (NAME,ADDRESS) VALUES (?,?)"; Object[] params = new Object[]{name,address}; PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(sql); PreparedStatementCreator psc = factory.newPreparedStatementCreator(params); KeyHolder generatedKeyHolder = new GeneratedKeyHolder(); jdbcTemplate.update(psc, generatedKeyHolder); return generatedKeyHolder.getKey().intValue(); } But all I get is an org.springframework.dao.InvalidDataAccessApiUsageException. Do i really need the types? As on every jdbc update statement you can just pass an object[] and its fine. The purpose of this question is to get around the need to specify any column type and to avoid PreparedStatementSetters on crud queries by letting jdbc determine which column type is appropriate for which object.
has comment: http://stackoverflow.com/comment/41787219
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/26588634
favorite count: 0
type: Question
tagged with: jdbc
tagged with: spring
answer count: 1
has comment: http://stackoverflow.com/comment/41785846
has comment: http://stackoverflow.com/comment/41790236
tagged with: java

http://stackoverflow.com/a/26646559
type: Answer
score: 1
upvote count: 1
has body: Here is the code, import java.io.*; public class test { public static void main(String[] args) { String input="7 to 10";//pass any input here that contains delimeter "to" String[] ans=input.split("to"); for(String result:ans) { System.out.println(result.trim()); } } } Please check and let me know if it works fine for you.
accepted answer of: http://stackoverflow.com/q/26646400
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26646400

http://stackoverflow.com/comment/41696293
comment on: http://stackoverflow.com/q/26531547
score: 0
has text: are you not mixing junit 3 and 4 styles? Maybe the @Test is not picked up as Junit 3 is expecting methods that start with testXxxxx
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41793663
comment on: http://stackoverflow.com/q/26588606
has text: @PareshMayani I've changed the code to: 'Bitmap bmThumbnail = ThumbnailUtils.createVideoThumbnail(f.getAbsolutePath().toString(), MediaStore.Images.Thumbnails.MICRO_KIND);' It does return a thumbnail but it is small.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41903218
has text: did you try to create own SSLContext and pass its SocketFactory to the HttpsUrlConnection ?
score: 0
comment on: http://stackoverflow.com/q/26649389
type: Comment
type: QuestionComment

utf
tag name: utf
tags question: http://stackoverflow.com/q/26663768
tags question: http://stackoverflow.com/q/26519462
type: Tag

http://stackoverflow.com/a/26649343
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26647083
has body: This problem can be solved using Dijkstra's algorithm. But we need to compare both distance and gain amount instead of just distance in the original algorithm. These are some code hints from me, so you only need to change some part of your code. class Entry implements Comparable&lt;Entry&gt;{ int x,y, dist, gain; //Constructor is omitted. public int compareTo(Entry o){ if(dist != o.dist)//Compare distance first return dist - o.dist; return o.gain - gain;//Compare gain value } } //Method signature is omitted PriorityQueue&lt;Entry&gt; q = new PriorityQueue(); q.add(new Entry(0,0,0,gain[0][0]); int[][][]dist = new int[n][m][2];//Assume size of matrix is n x m //Init dist array omitted dist[0][0][0] = 0;//Init distance dist[0][0][1] = gain[0][0];//Init gain amount, assume we have a gain matrix while(!q.isEmpty()){ Entry e = q.poll(); if(dist[e.x][e.y][0] == e.dist &amp;&amp; dist[e.x][e.y][1] == e.gain){ for(all valid next positions (a,b)) if(dist[a][b][0] &gt; e.dist + 1 || (dist[a][b][0] == e.dist + 1 &amp;&amp; dist[a][b][1] &lt; e.gain + gain[a][b]){ //Notice the condition to update the dist array dist[a][b][0] = e.dist + 1; dist[a][b][1] = e.gain + gain[a][b]; q.add(new Entry(a,b,e.dist + 1, e.gain + gain[a][b]); } } } return dist[n-1][m-1][1];

http://stackoverflow.com/comment/41877530
type: AnswerComment
has text: I don't think this plugin will solve Mike's issue, it's more about console enhancing through style and other goodies.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26614327

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/26571590
tags question: http://stackoverflow.com/q/26647352
tags question: http://stackoverflow.com/q/26560198
tags question: http://stackoverflow.com/q/26631699
tags question: http://stackoverflow.com/q/26614285
tags question: http://stackoverflow.com/q/26668552
tags question: http://stackoverflow.com/q/26610517
tag name: jfreechart

send
type: Tag
tags question: http://stackoverflow.com/q/26552053
tag name: send

http://stackoverflow.com/q/26643725
favorite count: 0
has title: Basic Java Gui Error: Why is the JButton causing errors?
has comment: http://stackoverflow.com/comment/41893856
has comment: http://stackoverflow.com/comment/41893824
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26643771
linked to: http://stackoverflow.com/q/320542
tagged with: java
has body: My code compiles and seemingly runs fine until I hit the JButton and then I get a lot of errors. I'm not sure what I'm doing wrong. What the code is supposed to do is have a window come up and randomly display two image of dice when the button is clicked. The images are in the same directory as my program and they are named 1-6. Here's the code: import java.lang.Math; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class DiceSimulator extends JFrame { private JLabel dieOne; private JLabel dieTwo; public DiceSimulator() { setTitle("Dice Simulator"); JLabel dieOne, dieTwo; dieOne = new JLabel(); dieTwo = new JLabel(); JButton button = new JButton("Roll the Dice"); button.addActionListener(new buttonListener()); setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.add(button, BorderLayout.SOUTH); panel.add(dieOne); panel.add(dieTwo); add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } private class buttonListener implements ActionListener { public void actionPerformed(ActionEvent e) { ImageIcon one = new ImageIcon("1.jpg"); ImageIcon two = new ImageIcon("2.jpg"); ImageIcon three = new ImageIcon("3.jpg"); ImageIcon four = new ImageIcon("4.jpg"); ImageIcon five = new ImageIcon("5.jpg"); ImageIcon six = new ImageIcon("6.jpg"); int firstRoll = (int)(Math.random()*6)+1; int secondRoll = (int)(Math.random()*6)+1; switch(firstRoll) { case 1: dieOne.setIcon(one); dieOne.setText(null); break; case 2: dieOne.setIcon(two); dieOne.setText(null); break; case 3: dieOne.setIcon(three); dieOne.setText(null); break; case 4: dieOne.setIcon(four); dieOne.setText(null); break; case 5: dieOne.setIcon(five); dieOne.setText(null); break; case 6: dieOne.setIcon(six); dieOne.setText(null); break; } switch(secondRoll) { case 1: dieTwo.setIcon(one); dieTwo.setText(null); break; case 2: dieTwo.setIcon(two); dieTwo.setText(null); break; case 3: dieTwo.setIcon(three); dieTwo.setText(null); break; case 4: dieTwo.setIcon(four);…
has answer: http://stackoverflow.com/a/26643887
downvote count: 1
accepted answer: http://stackoverflow.com/a/26643887
type: Question
has comment: http://stackoverflow.com/comment/41893866
score: -1
tagged with: logic
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/41893992
answer count: 2
possible better answer: http://stackoverflow.com/a/26643771
upvote count: 0
tagged with: user-interface

http://stackoverflow.com/q/26579671
has comment: http://stackoverflow.com/comment/41776821
has body: I got a couple issues with my code. I know it is not the best looking design/coding but I don't claim to be a good programmer yet. I have to other classes does their work correctly. Dictionary class which contains a word list and HangmanAnimation class which draws the hangman onto console. Now, I want my game to ask to player if he/she wants to play again after the game finished. Actually, it does asking if player wants to play again but exits the game before the player can type anything. I would appreciate any other suggestions aswell. Thanks in advance! You guys really rock! :) public class HangmanGame { public static void main(String[] args) { HangmanUI ui = new HangmanUI(); ui.initialize(); String input = ""; if(ui.newGame(input).equalsIgnoreCase("yes")) main(null); } } public class HangmanUI { private final Dictionary d = new Dictionary(); private final HangmanAnimation ha = new HangmanAnimation(); private String wordInProgress = d.getWordInProgress(); Scanner sc = new Scanner(System.in); private int maxTries = 5; String word; public void initialize() { int easyWords = 1; int hardWords = 2; System.out.println("Welcome to Hangman game."); System.out.println("========================="); System.out.println("Rules: You need to find the given word in 5 tries."); System.out.println("You will continue guessing letters until you can either"); System.out.println("solve the word or all five body parts are on the gallows."); System.out.println("In that case you will lose the game. Try not to enter"); System.out.println("same letter more than once. Those are counts too."); System.out.println(); System.out.println("Choose your game level or Quit:"); System.out.println("1) Easy"); System.out.println("2) Hard"); System.out.println("3) Quit"); try { int playersChoice = sc.nextInt(); switch (playersChoice) { case 1: d.wordList(easyWords); break; case 2: d.wordList(hardWords); break; case 3: System.out.println("Thank you for your time!"); System.exit(0); default: System.out.pri…
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41776829
tagged with: loops
has comment: http://stackoverflow.com/comment/41776481
downvote count: 1
type: Question
has title: Hangman, exits the game without getting the user response (loop)
score: -1
linked to: http://stackoverflow.com/q/22458575
answer count: 1
has answer: http://stackoverflow.com/a/26581902
has comment: http://stackoverflow.com/comment/41776512
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41776505

http://stackoverflow.com/q/26624833
answer count: 2
score: -1
has answer: http://stackoverflow.com/a/26624988
has body: public class stuff { public static void main ( String [] args ) { int n1 = 10; int n2 = 4; int r = n1%n2; System.out.println ( n1 + " " + n2 + " " + r ); if (r&gt;=1) { n2 = n1; n1 = r; System.out.println ( n1 + " " + n2 + " " + r ); } } } Here is what I have so far. I want to replace n1 with n2 and n2 with r. Its giving me this : 10 4 2 2 10 2 For the first part, n1 = 10, n2 = 4 and r = 2. For the second part, n1 = 2, n2 = 10 and r = 2. I want for the second part n1 = 4 &amp; n2 = 2. Got any ideas? Explanations would be greatly appreciated even more than code.
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26624866
has title: How to replace variables that have predetermined values with other values?
tagged with: java
has comment: http://stackoverflow.com/comment/41859488
upvote count: 1
type: Question

http://stackoverflow.com/a/26560941
has body: if I understand you correctly, you can put your login screen and WebView to FrameLayout together and use something like this: // When you logout loginView.bringToFornt(); // When you login webView.bringToFront();
answers question: http://stackoverflow.com/q/26557064
score: 0
accepted answer of: http://stackoverflow.com/q/26557064
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41799032
has text: @sturcotte06 I said that in the first line of my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/26590548
type: Comment
score: 0

java
tags question: http://stackoverflow.com/q/26598794
tags question: http://stackoverflow.com/q/26600486
tags question: http://stackoverflow.com/q/26615752
tags question: http://stackoverflow.com/q/26574680
tags question: http://stackoverflow.com/q/26661776
tags question: http://stackoverflow.com/q/26615396
tags question: http://stackoverflow.com/q/26577554
tags question: http://stackoverflow.com/q/26579942
tags question: http://stackoverflow.com/q/26664696
tags question: http://stackoverflow.com/q/26652712
tags question: http://stackoverflow.com/q/26595455
tags question: http://stackoverflow.com/q/26639378
tags question: http://stackoverflow.com/q/26615348
tags question: http://stackoverflow.com/q/26563172
tags question: http://stackoverflow.com/q/26589524
tags question: http://stackoverflow.com/q/26583408
tags question: http://stackoverflow.com/q/26639808
tags question: http://stackoverflow.com/q/26596839
tags question: http://stackoverflow.com/q/26527539
tags question: http://stackoverflow.com/q/26625898
tags question: http://stackoverflow.com/q/26611424
tags question: http://stackoverflow.com/q/26549338
tags question: http://stackoverflow.com/q/26516765
tags question: http://stackoverflow.com/q/26630871
tags question: http://stackoverflow.com/q/26527196
tags question: http://stackoverflow.com/q/26580729
tags question: http://stackoverflow.com/q/26568750
tags question: http://stackoverflow.com/q/26575805
tags question: http://stackoverflow.com/q/26544266
tags question: http://stackoverflow.com/q/26611027
tags question: http://stackoverflow.com/q/26631093
tags question: http://stackoverflow.com/q/26603943
tags question: http://stackoverflow.com/q/26659854
tags question: http://stackoverflow.com/q/26652310
tags question: http://stackoverflow.com/q/26627387
tags question: http://stackoverflow.com/q/26634003
tags question: http://stackoverflow.com/q/26648469
tags question: http://stackoverflow.com/q/26646400
tags question: http://stackoverflow.com/q/26579391
tags question: http://stackoverflow.com/q/26561025
tags question: http://stackoverflow.com/q/26568757
tags question: http://stackoverflow.com/q/26548028
tags question: http://stackoverflow.com/q/26635728
tags question: http://stackoverflow.com/q/26573886
tags question: http://stackoverflow.com/q/26519639
tags question: http://stackoverflow.com/q/26606962
tags question: http://stackoverflow.com/q/26581946
tags question: http://stackoverflow.com/q/26618863
tags question: http://stackoverflow.com/q/26614932
tags question: http://stackoverflow.com/q/26591521
tags question: http://stackoverflow.com/q/26597504
tags question: http://stackoverflow.com/q/26549868
tags question: http://stackoverflow.com/q/26532338
tags question: http://stackoverflow.com/q/26599891
tags question: http://stackoverflow.com/q/26651638
tags question: http://stackoverflow.com/q/26623108
tags question: http://stackoverflow.com/q/26597169
tags question: http://stackoverflow.com/q/26617694
tags question: http://stackoverflow.com/q/26660261
tags question: http://stackoverflow.com/q/26571817
tags question: http://stackoverflow.com/q/26644351
tags question: http://stackoverflow.com/q/26672674
tags question: http://stackoverflow.com/q/26533562
tags question: http://stackoverflow.com/q/26523177
tags question: http://stackoverflow.com/q/26566290
tags question: http://stackoverflow.com/q/26636288
tags question: http://stackoverflow.com/q/26578991
tags question: http://stackoverflow.com/q/26565270
tags question: http://stackoverflow.com/q/26585584
tags question: http://stackoverflow.com/q/26566567
tags question: http://stackoverflow.com/q/26514350
tags question: http://stackoverflow.com/q/26629205
tags question: http://stackoverflow.com/q/26652800
tags question: http://stackoverflow.com/q/26655324
tags question: http://stackoverflow.com/q/26601305
tags question: http://stackoverflow.com/q/26555187
tags question: http://stackoverflow.com/q/26572604
tags question: http://stackoverflow.com/q/26522401
tags question: http://stackoverflow.com/q/26552001
tags question: http://stackoverflow.com/q/26557715

mapreduce
tags question: http://stackoverflow.com/q/26576985
type: Tag
tags question: http://stackoverflow.com/q/26519376
tags question: http://stackoverflow.com/q/26581946
tags question: http://stackoverflow.com/q/26575142
tag name: mapreduce
tags question: http://stackoverflow.com/q/26657215
tags question: http://stackoverflow.com/q/26556972
tags question: http://stackoverflow.com/q/26538855
tags question: http://stackoverflow.com/q/26603419
tags question: http://stackoverflow.com/q/26560570
tags question: http://stackoverflow.com/q/26623358
tags question: http://stackoverflow.com/q/26590181
tags question: http://stackoverflow.com/q/26587957
tags question: http://stackoverflow.com/q/26559180

http://stackoverflow.com/q/26578033
type: Question
has answer: http://stackoverflow.com/a/26615883
accepted answer: http://stackoverflow.com/a/26615883
tagged with: android-mediaplayer
tagged with: java
has body: I'm streaming a video on a VideoView, for the phone rotation I save the video position and use seekTo to play the video at the same moment but I get some troubles. When I put directly the URI of the video without using my API in NodeJS, seekTo works perfectly: videovvw.setVideoURI(Uri.parse("http://exemple.com/video.mp4")); But When I'm using my API, after 1/2 rotations I get a dark VideoView screen and an error message which tell me "Can't play this video". The weird things is the app does a lot of request for get the video to the API when this error occur. GET /videoStream?idVideo=5433f07e073a384d324bb9cf 200 105ms - 5.26mb GET /videoStream?idVideo=5433f07e073a384d324bb9cf 200 97ms - 5.26mb GET /videoStream?idVideo=5433f07e073a384d324bb9cf 200 98ms - 5.26mb ... This is the android code: package com.stream.Activity; import java.io.UnsupportedEncodingException; import com.stream.R; import android.app.Activity; import android.app.ProgressDialog; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Resources.NotFoundException; import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnSeekCompleteListener; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class VideoActivityNew extends Activity { private VideoView videovvw; private int position = 0; private MediaController mediaControls; private ImageView fullScreenButton = null; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setContentView(R.layout.activity_video_portrait);…
tagged with: android-videoview
score: 0
answer count: 1
has title: Android VideoView seekTo With NodeJS API doesn't work well
tagged with: android
tagged with: node.js
type: AnsweredQuestion

http://stackoverflow.com/a/26610590
has comment: http://stackoverflow.com/comment/59165211
has comment: http://stackoverflow.com/comment/47185133
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/65069260
downvote count: 0
upvote count: 6
has comment: http://stackoverflow.com/comment/60803432
has comment: http://stackoverflow.com/comment/59117625
type: Answer
has comment: http://stackoverflow.com/comment/47180354
has comment: http://stackoverflow.com/comment/65070891
accepted answer of: http://stackoverflow.com/q/26609519
has comment: http://stackoverflow.com/comment/65075434
score: 6
answers question: http://stackoverflow.com/q/26609519
has comment: http://stackoverflow.com/comment/59107685
has comment: http://stackoverflow.com/comment/60798821
has comment: http://stackoverflow.com/comment/47184611
has body: This is a case where a custom android.app.Application class is very useful. The BeaconManager is a singleton so only one is allowed to exist at the same time. Similarly, the Application class has a single instance per active Android application. If you want to do beacon detection in an Activity and a Service simultaneously, use the centralized Application class to do the binding to BeaconManager and then forward the callbacks to both your Activity and your Service. You can see an example of binding to the BeaconManager in an Application class and then passing callbacks to an Activity in the reference application here: https://github.com/AltBeacon/android-beacon-library-reference/blob/master/app/src/main/java/org/altbeacon/beaconreference/BeaconReferenceApplication.java
has comment: http://stackoverflow.com/comment/47169033

http://stackoverflow.com/q/26611780
has comment: http://stackoverflow.com/comment/41835387
has comment: http://stackoverflow.com/comment/41835659
tagged with: java
type: Question
has title: How to play sound order by order?
answer count: 1
has comment: http://stackoverflow.com/comment/41835401
score: 0
tagged with: android
has body: I need to play sound file order by order with MediaPlayer. If I use the setOnCompletionListener, the code is getting longer like this: one.start(); one.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { two.start(); two.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { two.start(); ...three...four... } }); } }); Does it have a more practical way?
has comment: http://stackoverflow.com/comment/41835621
has answer: http://stackoverflow.com/a/26611856
accepted answer: http://stackoverflow.com/a/26611856
tagged with: audio
type: AnsweredQuestion

http://stackoverflow.com/comment/41701723
type: Comment
has text: I did know your first argument, which is why I asked the question. I wanted to see if it was possible to do with lists as well. The second... well, shouldn't it be just to check that the next element is not null?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26533333

http://stackoverflow.com/a/26573564
has body: Try passing the shop object instead of shop id and move the code to ShopService class, And it should be inside a transaction. @Transactional public void deleteShop(Integer id){ Shop shop = shopDAO.findById(id); TypeShop type = shop.getTypeShop(); type.getShops().remove(shop); typeShopDAO.update(type); shopDAO.delete(shop); }
has comment: http://stackoverflow.com/comment/41764851
score: 0
has comment: http://stackoverflow.com/comment/41764914
type: Answer
answers question: http://stackoverflow.com/q/26571807

http://stackoverflow.com/a/41453845
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26576073
has comment: http://stackoverflow.com/comment/70131002
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26576073
type: Answer
has body: According with my research, @PostLoad, @PrePersist and other kinds of these JPA annotations do not work for Hibernate, instead of them, we can use Interceptors. I am using Hibernate-JPA and Spring with xml based configuration. With Spring I get a SessionFactory object, when i set the properties for this object I inject a MyInterceptor instance that extends EmptyInterceptor class, then you can overide several methods like postLoad, onSave, etc. When you implement this code, the overrided methods are executed according the life cycle of the operation. I have not tested the postLoad method because onSave method worked for me. Update Spring Java based configuration @JeffersonTavares: Spring configuration class: @Configuration public class SpringConfig { @Bean public BasicDataSource basicDataSource(){ // org.apache.commons.dbcp2.BasicDataSource Object BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); basicDataSource.setUrl("jdbc:sqlserver://172.125.25.7:1433;databaseName=LIST_FIRMAS;selectMethod=direct;"); basicDataSource.setUsername("user"); basicDataSource.setPassword("password"); return basicDataSource; } @Bean public MyInterceptor myInterceptor(){ // Your interceptor return new MyInterceptor(); } @Bean(name = "sessionFactory") public SessionFactory sessionFactory() throws IOException{ LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean(); localSessionFactoryBean.setDataSource(basicDataSource()); // DataSource localSessionFactoryBean.setAnnotatedClasses( com.isapeg.timbrado.model.SalMinimo.class, com.isapeg.timbrado.model.DeduccionCnom12.class, com.isapeg.timbrado.model.PercepcionCnom12.class); // JPA entity classes .... localSessionFactoryBean.setEntityInterceptor(myInterceptor()); // Setting your Interceptor Properties properties = new Properties(); properties.put("hibernate.dialect", "org.hibernate.dialect.SQLServer2012Dialect"); properties.put("hibe…
score: 2

http://stackoverflow.com/comment/41824616
score: 0
type: Comment
has text: The same item is repeated twice. so, you're facing such issue
type: AnswerComment
comment on: http://stackoverflow.com/a/26605353

windows
tags question: http://stackoverflow.com/q/26628591
tags question: http://stackoverflow.com/q/26542498
tags question: http://stackoverflow.com/q/26547403
tags question: http://stackoverflow.com/q/26656427
tags question: http://stackoverflow.com/q/26562877
tags question: http://stackoverflow.com/q/26652017
tags question: http://stackoverflow.com/q/26568003
tags question: http://stackoverflow.com/q/26558731
tags question: http://stackoverflow.com/q/26664176
tags question: http://stackoverflow.com/q/26606379
tags question: http://stackoverflow.com/q/26644491
tags question: http://stackoverflow.com/q/26533469
tags question: http://stackoverflow.com/q/26571233
tags question: http://stackoverflow.com/q/26561010
tags question: http://stackoverflow.com/q/26521122
tags question: http://stackoverflow.com/q/26671685
tags question: http://stackoverflow.com/q/26552789
tags question: http://stackoverflow.com/q/26664975
type: Tag
tags question: http://stackoverflow.com/q/26626199
tags question: http://stackoverflow.com/q/26654307
tags question: http://stackoverflow.com/q/26620276
tags question: http://stackoverflow.com/q/26563172
tags question: http://stackoverflow.com/q/26567516
tag name: windows
tags question: http://stackoverflow.com/q/26554220
tags question: http://stackoverflow.com/q/26573865
tags question: http://stackoverflow.com/q/26620108
tags question: http://stackoverflow.com/q/26529109
tags question: http://stackoverflow.com/q/26606822
tags question: http://stackoverflow.com/q/26643937

http://stackoverflow.com/q/26524560
has answer: http://stackoverflow.com/a/26524722
has title: Java Dynammic bean / shared between Users
score: 0
accepted answer: http://stackoverflow.com/a/26524722
has body: I have java web application, that is being used by multiple users. By users I mean people that actually connect to application and do stuff with it. Every user can edit a schema, that has it's ID. At the moment, multiple users can edit same schema at the same time. I want to fix that, without using a database/table. What I tried so far: There's an EDIT button, that users click to edit certain schema. When they click it, a method is triggered. protected SessionLockModSchema sessionLockModSchema = new SessionLockModSchema(); protected Model model; //schema model object public void buttonClick(ClickEvent event) { //button logic goes here } I figured I might create a bean with schema ID, when this method is triggered. protected SessionLockModSchema sessionLockModSchema = new SessionLockModSchema(); protected Model model; public void buttonClick(ClickEvent event) { //button logic goes here this.sessionLockModSchema.lockSchema(model); } When I have this bean created, all that I need to do is check if it exists, for the next user. protected Model model; public void buttonClick(ClickEvent event) { if(!this.sessionLockModSchema.isSchemaLocked(model){ //button logic goes here this.sessionLockModSchema.lockSchema(model); } } In theory this sounded good to me, edit button wouldn't trigger if there was a bean created with that schema. But bean is not created (or at least only one user can access it). Here's sessionLockModSchema class: public class SessionLockModSchema{ ApplicationContext context; GenericApplicationContext ctx; public SessionLockModSchema(){ if(ctx == null){ this.ctx = new GenericApplicationContext(); } } public void lockSchema(Model model){ String beanName = "model-"+model.getId(); BeanDefinitionBuilder bDBuilder = BeanDefinitionBuilder .rootBeanDefinition(String.class); bDBuilder.setScope("prototype"); this.ctx.registerBeanDefinition(beanName, bDBuilder.getBeanDefinition()); //appcontext.close(); } public boolean isSchemaLocked(Model model){ String beanName = "…
answer count: 1
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41871561
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26631491
has text: It creating table but it throws error on opening the table in database "Reserved Error(5001). there is no reason for this error"

http://stackoverflow.com/comment/41718432
comment on: http://stackoverflow.com/a/26544891
has text: How should I use Environment... it's an interface? (sorry for being a n00b here) I see PersistenceConfig.dataSource() but not OpenShiftPersistenceConfig.dataSource()... as I'd love to see! :). Thanks ill fix the version issue.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41819718
comment on: http://stackoverflow.com/q/26600003
type: Comment
type: QuestionComment
has text: Seems like something similar to CAPTCHA which is mostly there to avoid automation.
score: 0

http://stackoverflow.com/q/26581850
upvote count: 4
has body: I've been using myBatis 3.2.8 with C3p0 as the data source. Recently I ran into some odd problem. Basically, myBatis is committing my INSERT statement even when auto commit is explicitly passed as FALSE and session.commit() isn't even called. Here's what my code block looks like: SqlSession session = factory.openSession(false); try { mapper.insert(myObject); doStuff(); session.commit(); } catch (Throwable t) { session.rollback(); // log exception } finally { session.close(); } Basically what I observed was, when mapper.insert(myObject) was called, the data was immediately stored to my database, as I was stepping throught this statement in my debugger, and I saw those logs: DEBUG [2014-10-27 05:30:34,730] com.mchange.v2.resourcepool.BasicResourcePool: decremented pending_acquires: 0 DEBUG [2014-10-27 05:30:34,730] org.apache.ibatis.transaction.jdbc.JdbcTransaction: Setting autocommit to false on JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@33dbc40] DEBUG [2014-10-27 05:30:34,773] com.liangzhi.core.api.database.mapper.ProjectMapper.insertProject: ==&gt; Preparing: INSERT INTO projects (ProjectName, ProjectAbstractText, ProjectFairID) VALUES (?, ?, ?); DEBUG [2014-10-27 05:30:34,975] com.liangzhi.core.api.database.mapper.ProjectMapper.insertProject: ==&gt; Parameters: 3568bca0-2bc2-4610-b6f1-a6858752817c(String), 3568bca0-2bc2-4610-b6f1-a6858752817c(String), 1(Integer) DEBUG [2014-10-27 05:30:35,018] com.liangzhi.core.api.database.mapper.ProjectMapper.insertProject: &lt;== Updates: 1 DEBUG [2014-10-27 05:30:35,018] org.apache.ibatis.transaction.jdbc.JdbcTransaction: Committing JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@33dbc40] DEBUG [2014-10-27 05:30:35,168] org.apache.ibatis.transaction.jdbc.JdbcTransaction: Resetting autocommit to true on JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@33dbc40] DEBUG [2014-10-27 05:30:35,170] org.apache.ibatis.transaction.jdbc.JdbcTransaction: Closing JDBC Connection [com.mchange.v2.c3p…
downvote count: 0
tagged with: mybatis
score: 4
favorite count: 0
has title: MyBatis committing a statement even when autocommit is false
has comment: http://stackoverflow.com/comment/42984026
tagged with: jdbc
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41870437
type: AnswerComment
comment on: http://stackoverflow.com/a/26631130
score: 0
type: Comment
has text: Is there a rationale behind it? If done by index, why is the front index inclusive and the end index exclusive?

http://stackoverflow.com/comment/41747524
type: Comment
type: QuestionComment
score: 1
has text: For the close voter, this is a reproducible and is not a "simple" typing error.
comment on: http://stackoverflow.com/q/26563939

http://stackoverflow.com/a/26646917
has comment: http://stackoverflow.com/comment/41902458
has comment: http://stackoverflow.com/comment/41937645
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41940267
has comment: http://stackoverflow.com/comment/41902476
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26607661
has comment: http://stackoverflow.com/comment/41937675
answers question: http://stackoverflow.com/q/26607661
has comment: http://stackoverflow.com/comment/41971457
has comment: http://stackoverflow.com/comment/42010713
has comment: http://stackoverflow.com/comment/41918335
has body: you can use a driver class like Xpp3driver eg. the flow would look something like <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP" path="XmlToObj"/> <mulexml:xml-to-object-transformer doc:name="XML to Object" driverClass="com.thoughtworks.xstream.io.xml.Xpp3Driver"> <mulexml:alias name="Abc" class="a.b.c.Abc" /> </mulexml:xml-to-object-transformer> <component class="Test1" doc:name="Java"/> http request http://localhost:8082/XmlToObj headers Content-Type application/xml post data ggggg hhhhh ABC class package a.b.c.Abc; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "Abc") public class Abc{ private String def; private String ghi; public Abc() { } public String getDef() { return def; } public void setDef(String def) { this.def = def; } public String getGhi() { return ghi; } public void setGhi(String ghi) { this.ghi = ghi; } } Class Test1 (component) public class Test1 { public Object receive(Abc abc) throws Exception { System.out.println(abc); return "Success"; } }

iterable
tags question: http://stackoverflow.com/q/26589279
tags question: http://stackoverflow.com/q/26556074
tags question: http://stackoverflow.com/q/26535128
type: Tag
tag name: iterable

http://stackoverflow.com/q/26592681
type: UnansweredQuestion
type: Question
tagged with: java
score: 0
has title: JDBC Composite Types from metadata
tagged with: sql
has comment: http://stackoverflow.com/comment/41814848
has comment: http://stackoverflow.com/comment/41806946
tagged with: jdbc
has body: How do i know the full Type for a column which is composite e.g. Array (an Array of what?) from the Metadata API without trying to infer from row values?
answer count: 0

http://stackoverflow.com/a/26652999
has comment: http://stackoverflow.com/comment/41911192
has comment: http://stackoverflow.com/comment/41909729
accepted answer of: http://stackoverflow.com/q/26652553
has comment: http://stackoverflow.com/comment/41910987
answers question: http://stackoverflow.com/q/26652553
type: AcceptedAnswer
has body: The css styling applied to a chart is defined in the modena.css file. If you want to modify some properties, look for the style class and change some value. These are the default properties for the first three series (regarding the symbol, line and fill for each series): .chart-area-symbol { -fx-background-color: CHART_COLOR_1, white; -fx-background-insets: 0, 1; -fx-background-radius: 4px; /* makes sure this remains circular */ -fx-padding: 3px; } .default-color0.chart-area-symbol { -fx-background-color: CHART_COLOR_1, white; } .default-color1.chart-area-symbol { -fx-background-color: CHART_COLOR_2, white; } .default-color2.chart-area-symbol { -fx-background-color: CHART_COLOR_3, white; } .chart-series-area-line { -fx-stroke: CHART_COLOR_1; -fx-stroke-width: 1px; } .default-color0.chart-series-area-line { -fx-stroke: CHART_COLOR_1; } .default-color1.chart-series-area-line { -fx-stroke: CHART_COLOR_2; } .default-color2.chart-series-area-line { -fx-stroke: CHART_COLOR_3; } .chart-series-area-fill { -fx-stroke: null; -fx-fill: CHART_COLOR_1_TRANS_20; } .default-color0.chart-series-area-fill { -fx-fill: CHART_COLOR_1_TRANS_20; } .default-color1.chart-series-area-fill { -fx-fill: CHART_COLOR_2_TRANS_20; } .default-color2.chart-series-area-fill { -fx-fill: CHART_COLOR_3_TRANS_20; } So you just need to provide your custom colors.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41909878

http://stackoverflow.com/comment/41868400
score: 0
type: Comment
has text: What exactly is the issue? Your code to enable texture filtering is commented out.
type: QuestionComment
comment on: http://stackoverflow.com/q/26629844

http://stackoverflow.com/q/26630710
tagged with: java
has answer: http://stackoverflow.com/a/26630845
has comment: http://stackoverflow.com/comment/41869745
type: Question
possible better answer: http://stackoverflow.com/a/26630780
has answer: http://stackoverflow.com/a/26630780
tagged with: copy
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41870764
has answer: http://stackoverflow.com/a/26630823
score: 0
answer count: 4
has title: How to create a copy of ArrayList<ArrayList<Arc>> to another ArrayList<ArrayList<Arc>>
has body: I have a Class public class Arc{ ... } and 2 ArrayList ArrayList&lt;ArrayList&lt;Arc&gt;&gt; rotalar1 = new ArrayList&lt;ArrayList&lt;Arc&gt;&gt;(); ArrayList&lt;ArrayList&lt;Arc&gt;&gt; rotalar2 = new ArrayList&lt;ArrayList&lt;Arc&gt;&gt;(); i try to copy rotalar1 to in rotalar2: rotalar2.addAll(rotalar1); but i have a problem. if i make any change in rotalar2 , it has an impact on rotalar1 too. I dont want to make a change in rotalar1 : These rows make problem rotalar2.get(random1).remove(random3); rotalar2.get(random2).remove(random4); Thanks for your time
accepted answer: http://stackoverflow.com/a/26630823
tagged with: effect
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26631150

http://stackoverflow.com/comment/41726917
type: AnswerComment
has text: how to do it for Dialog textfield? showInputDialog();
comment on: http://stackoverflow.com/a/26551638
type: Comment
score: 0

http://stackoverflow.com/comment/41864320
score: 0
type: AnswerComment
has text: I don't need to set the weblogic username and password from within my project. I need to get the already set username/pwd of weblogic within my project at runtime. As I am invoking a secured rest serviced(already deployed on weblogic) from my project, I need to make the call passing the weblogic credentials. So, I need the Java code to get the weblogic username/pwd credentials.
type: Comment
comment on: http://stackoverflow.com/a/26615343

http://stackoverflow.com/comment/41937943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26618471
has text: I would like to say, that in the end this answer helped me a lot, cause I decided to use SAX parser instead of DOM parser and I faced a problem (nullpointer again) and this answer helped me to solve it.
score: 0

http://stackoverflow.com/a/26526117
has comment: http://stackoverflow.com/comment/41680367
has comment: http://stackoverflow.com/comment/41679834
has comment: http://stackoverflow.com/comment/41681480
has body: You can save the data that is used to construct your PendingIntent in a Bundle like shown here So when you open up your app again, you will be able to reconstruct the PendingIntent and cancel the alarm if needed. EDIT: First of all you have to override onSaveInstanceState and save the data that is used to create your PendingIntent object like shown below: @Override public void onSaveInstanceState(Bundle savedInstanceState) { // Save the pending intent id savedInstanceState.putInt(PENDING_INTENT_ID, mPendingIntentId); // Always call the superclass so it can save the view hierarchy state super.onSaveInstanceState(savedInstanceState); } After that, in your onCreate method you will check if the savedInstanceState is not null. If not null, restore the items from the savedInstanceState (Bundle) object like this @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Always call the superclass first // Check whether we're recreating a previously destroyed instance if (savedInstanceState != null) { // Restore value of members from saved state mPendingIntentId = savedInstanceState.getInt(PENDING_INTENT_ID); } else { // Probably initialize members with default values for a new instance mPendingIntentId = YOUR_DEFAULT_INT_VALUE; } mPendingIntent = PendingIntent.getBroadcast(this, mPendingIntentId, YOUR_INTENT, PendindIntent.FLAG_UPDATE_CURRENT); } PendingIntent will be recreated every time you will enter your app, so you will be able to cancel the same alarm that has been triggered in a previous step. EDIT 2 : Another approach in your case would be that since you have only one alarm, and it's id is always the same (which should be used for the PendingIntent's requestId), than you can simply recreate the PendingIntent whenever you want to add or cancel an alarm. A method like the one below would help you out. private PendingIntent getPendingIntent(Context context){ return PendingIntent.getBroadcast(context, 0, new Intent(context, Yo…
type: Answer
answers question: http://stackoverflow.com/q/26525731
score: 0

http://stackoverflow.com/a/26605530
type: Answer
answers question: http://stackoverflow.com/q/26604869
has comment: http://stackoverflow.com/comment/41829111
has comment: http://stackoverflow.com/comment/41826004
has comment: http://stackoverflow.com/comment/41829057
has comment: http://stackoverflow.com/comment/41831908
has comment: http://stackoverflow.com/comment/41824039
score: 3
downvote count: 0
has body: I handle this by registering the target application as a protocol handler, either the target application itself, or a delegate app that's guaranteed to be installed on client machine. then using a link in the form: myapp://someaction/arg0/arg1 then myapp://someaction/arg0/arg1 will be passed to your app as command line argument then you can parse and perform the appropriate action. Here's an MSDN article on how to achieve that: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx So in your case, you can either: Make a script/registry key that would register protocols for the target apps, and have clients download and install it. Then you can add can launch from the web page using e.g. myapp://reader/ Create one application (handler) and have clients install it, the handler then will then take the target application from the url e.g. myapp://reader/document or just myapp://reader to open "Adobe Reader" on client machine. Second approach is especially useful if you want to perform more actions based on args specified in the url.
has comment: http://stackoverflow.com/comment/41826141
upvote count: 3

http://stackoverflow.com/comment/41670978
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26520900
type: Comment
has text: Please don't use chat abbreviation (such as IDK)

http://stackoverflow.com/q/26669703
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26750665
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26671048
type: Question
has answer: http://stackoverflow.com/a/26671048
has answer: http://stackoverflow.com/a/26750665
has title: How to disable or route the debug logs while using restTemplate
answer count: 2
upvote count: 1
favorite count: 0
has body: I am trying to develop a CLI command which returns a list of employees from the server database using rest. I used restTemplate.getObject() method to get the list. This works fine, but in the console , I am getting debug logs like 3:06:58.564 [main] DEBUG o.s.web.client.RestTemplate - Setting request Accept header to [application/xml, text/xml, application/*+xml, application/json] 13:06:58.989 [main] DEBUG o.s.web.client.RestTemplate - GET request for "https://ip:8080/service/employee/list" resulted in 200 (OK) I dont want these debug messages in my console. How to disable these ? Routing these messages to another log file can also be considered.
tagged with: resttemplate

http://stackoverflow.com/q/26648853
linked to: http://stackoverflow.com/q/26652029
has comment: http://stackoverflow.com/comment/41904116
favorite count: 0
has comment: http://stackoverflow.com/comment/41904699
score: 0
accepted answer: http://stackoverflow.com/a/26651441
has comment: http://stackoverflow.com/comment/41906643
has comment: http://stackoverflow.com/comment/41907571
has comment: http://stackoverflow.com/comment/41903304
has answer: http://stackoverflow.com/a/26651441
has comment: http://stackoverflow.com/comment/41906239
has comment: http://stackoverflow.com/comment/41904479
has title: Error while generating pdf from Html file in Java using iText
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41904756
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/41902307
type: Question
has comment: http://stackoverflow.com/comment/41902205
has body: I am converting XML -> HTML -> pdf. The HTML -> pdf step is done with iText v5.5.3, but I get the following error: Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfPTable.addCell(Lcom/itextpdf/text/pdf/PdfPCell;)V at com.itextpdf.tool.xml.html.table.Table.end(Table.java:387) at com.itextpdf.tool.xml.html.AbstractTagProcessor.endElement(AbstractTagProcessor.java:155) at com.itextpdf.tool.xml.pipeline.html.HtmlPipeline.close(HtmlPipeline.java:202) at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:140) at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:387) at com.itextpdf.tool.xml.parser.state.ClosingTagState.process(ClosingTagState.java:70) at com.itextpdf.tool.xml.parser.XMLParser.parseWithReader(XMLParser.java:230) at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:209) at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:166) at ITextEx.createPdf(ITextEx.java:29) at ITextEx.main(ITextEx.java:41) What am I missing?
answer count: 1

http://stackoverflow.com/q/26624418
has comment: http://stackoverflow.com/comment/41858647
has answer: http://stackoverflow.com/a/26624969
has comment: http://stackoverflow.com/comment/41858507
possible better answer: http://stackoverflow.com/a/26624632
has comment: http://stackoverflow.com/comment/41858527
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41858460
has body: I'm working on a practice project, movie store system. How can I display the objects of class Movie? Class Movie has all the movie, movie1, movie2. Also, how can I select a movie, and use only one method? For example, I select movie1, then I will execute the method. movie1.dispMovie(), or should I make the method launch manually? public class movie { private String name; private String desc; private int year; public static int movieNum = 0; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public void dispdesc(){ movieNum = movieNum + 1; System.out.println("Movie #" + movieNum); System.out.println("Title: " + getName()); System.out.println("Description: " + getDesc()); System.out.println("Year: " + getYear()); } } public class orangeBox { public static void main(String[] args) { movie up = new movie(); up.setName("Up"); up.setDesc("To avoid being taken away to a nursing home, an old widower tries to fly his home to Paradise Falls, South America, along with a boy scout who accidently lifted off with him. "); up.setYear(2008); up.dispdesc(); movie wallE = new movie(); wallE.setName("Wall-E"); wallE.setDesc("In the distant future, a small waste collecting robot inadvertently embarks on a space journey that will ultimately decide the fate of mankind."); wallE.setYear(2008); wallE.dispdesc(); } } I need a method that will display all the movie without doing this.dispdesc() in the main class. EDIT public class Store { public static void main(String[] args) { Movie up = new Movie(); up.setName("Up"); up.setDesc("To avoid being taken away..."); up.setYear(2009); System.out.println(up); } }
type: Question
tagged with: object
accepted answer: http://stackoverflow.com/a/26624969
has comment: http://stackoverflow.com/comment/41858498
tagged with: class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41858995
has title: How to display objects of a a class?
favorite count: 0
has answer: http://stackoverflow.com/a/26624632

http://stackoverflow.com/q/26544738
has comment: http://stackoverflow.com/comment/41741910
linked to: http://stackoverflow.com/q/791787
downvote count: 1
linked to: http://stackoverflow.com/q/1106102
has title: Modern day alternatives to Cloneable?
has answer: http://stackoverflow.com/a/26558301
linked to: http://stackoverflow.com/q/2326758
type: AnsweredQuestion
score: 3
tagged with: clone
linked to: http://stackoverflow.com/q/26398951
tagged with: java
type: Question
upvote count: 4
has body: It is well-known that Cloneable is broken beyond repair (see the discussion in this question for more information). Last questions on alternatives and "how do I do it right" are few years old: Are there any alternatives to implementing Clone in Java? How to properly override clone method? Clone() vs Copy constructor- which is recommended in java clone() vs copy constructor vs factory method? Polymorphic copy in Java Proper way to deep copy with copy constructor instead of Object.clone So I'd like to ask again: What are the modern day (2014) alternatives to Cloneable? I am looking for a general-purpose solution. I could imagine the following requirements: Some kind of Copyable interface which the classes will implement: A extends Copyable. Deep copying. If an istance of A references an instance of B, a.copy() should reference a new b.copy(). Copy to the specified target: a.copyTo(a1). Polymorphic copying: if B extends A then a.copyTo(b) should copy all the properties of B from a to b. Of course I can implement all of this by myself, but wouldn't it be reasonable to have standard interfaces for this? Or am I missing something? A bit of the background for my context. I'm working a lot with JAXB and schema-derived classes. It is often extremely useful to have deep copying for these classes. Few years ago I wrote a couple of JAXB schema compiler plugins to generate copyTo methods which implement the requirements above (and more). I had to use my own runtime API. Now I was revisiting the case and decided to ask if there's a standard solution.
tagged with: cloneable
accepted answer: http://stackoverflow.com/a/26558301
linked to: http://stackoverflow.com/q/13408202
favorite count: 0
has answer: http://stackoverflow.com/a/44660960
answer count: 3
linked to: http://stackoverflow.com/q/4199429
possible better answer: http://stackoverflow.com/a/26544788
linked to: http://stackoverflow.com/q/2427883
has answer: http://stackoverflow.com/a/26544788

http://stackoverflow.com/comment/41814607
comment on: http://stackoverflow.com/q/26600191
has text: You should really indicate to us with a comment which line throws an exception.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41914982
score: 0
type: Comment
has text: I don't know anything about WebStart, but often you use the JAVA_HOME variable to control things like this. I'd try setting it to the root of your 32 bit Java install. For example, on mine I've got JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_67
type: QuestionComment
comment on: http://stackoverflow.com/q/26656059

http://stackoverflow.com/q/26551718
tagged with: java
has answer: http://stackoverflow.com/a/26552470
answer count: 2
downvote count: 0
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/26552678
tagged with: cmd
upvote count: 3
tagged with: maven
accepted answer: http://stackoverflow.com/a/26552470
has body: I have jar file with manifest in it Manifest-Version: 1.0 Build-Jdk: 1.7.0_67 Created-By: Apache Maven 3.2.3 Main-Class: com.company.main.Main Archiver-Version: Plexus Archiver And the jar has compile dependency to external library compile 'org.apache.commons:commons-lang3:3.3.2' So I want to execute it comandLine I wrote: java -cp C:\commons-lang3-3.3.2.jar -jar myJar-1.0.0.jar But Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils at ... How to add this file on the class path? PS. If I use the "bad way" and copy-paste commons-lang3-3.3.2.jar in the ...jre7\lib\ext folder. Everything is working.
type: Question
type: AnsweredQuestion
score: 3
has title: How to execute jar file with a external dependency using command line on Windows?
possible better answer: http://stackoverflow.com/a/26552678

http://stackoverflow.com/q/26646031
answer count: 4
has comment: http://stackoverflow.com/comment/41897593
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41897718
accepted answer: http://stackoverflow.com/a/26646236
tagged with: java
has answer: http://stackoverflow.com/a/26647238
has title: isItPrime using a boolean method? So Close
has answer: http://stackoverflow.com/a/26646161
has comment: http://stackoverflow.com/comment/41897621
possible better answer: http://stackoverflow.com/a/26646161
has body: I feel I am so close! The output is just outputting true true true or false false false (depending on the length of the array and the user inputs. I feel this is because of the if/else! For instance, if the number you input first is either true or false it makes all of them that!? This is supposed to print to the console the numbers in the array, the index of the array numbers, and whether they are prime or not, individually. Thanks for the help!! import java.util.Scanner; import java.util.Arrays; public class isItPrime { //main method public static void main (String[] args) { //Scanner Scanner input = new Scanner(System.in); System.out.println("Enter length of array: "); int n = input.nextInt(); int[] numbers = new int[n]; System.out.println("Enter " + n +" integers to fill the array: "); for(int i=0; i&lt;n; i++){ numbers[i] = input.nextInt(); } System.out.println(Arrays.toString(numbers)); for(int j=0; j&lt;n; j++){ System.out.println(numbers[j] + ": " + j + " -- " + isPrime(numbers)); } } public static boolean isPrime(int[] numbers){ boolean Prime = true; //initial boolean value for (int i = 2; i&lt;numbers.length; i++) { for (int j=0; j&lt;numbers.length; j++) { if (numbers[j] == 1 || numbers[j] == 0) { Prime = false; } else if (numbers[j]%i==0){ //function which determines if an int is prime. Prime = false; } else { Prime = true; } } } return Prime; } }
score: 0
has answer: http://stackoverflow.com/a/26646276
has comment: http://stackoverflow.com/comment/41897710
has answer: http://stackoverflow.com/a/26646236
has comment: http://stackoverflow.com/comment/41897772

http://stackoverflow.com/comment/58157924
has text: Did you found any solution ?
comment on: http://stackoverflow.com/q/26595790
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26550993
has body: I have a Mongo database and am building a REST API using the Play Framework in Java. I would like to map my Mongo query results to POJOs using some kind of mapper like MongoJack or PlayJongo or something similar. My problem is that I don't want to have to specify all/new fields in my POJO. What I would like to do is to put all un-mapped fields into a catch all Map as part of the POJO. That way new fields that are added can still be returned in the API response without the Java application having to be aware of them. Here's an example: Mongo Document: { _id: 1234, mappedString: "Foo", mappedInt: 544, unMappedString: "Test", unMappedInt: 12 } Java Class public class Bar { private int _id; private String mappedString; private int mappedInt; private Map&lt;String, Object&gt; unMappedFields; } I would then expect the unMappedFields field to have two entries in it being "unMappedString" and "unMappedInt" with values "Test" and 12 respectively. Is there a way to achieve this with one of the Mongo POJO mappers? I've not been able to find any information on if this is possible or not.
answer count: 1
has title: Mapping Uknown/New MongoDB fields to Map/List - Java
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26585724
tagged with: playframework-2.0
tagged with: java
type: Question
tagged with: mongodb

http://stackoverflow.com/q/26563107
score: 0
answer count: 1
tagged with: maven-plugin
has comment: http://stackoverflow.com/comment/41760465
has answer: http://stackoverflow.com/a/26565373
tagged with: maven
type: AnsweredQuestion
has body: I'm thinking of developing a maven plugin which will cause your maven build to output info messages and above if the build fails. The context is that I'd like to configure maven to work with warn by default and disable all logs of my company (this will be done by logback configuration) and I'd like to have a plugin which talks to another in-memory logback appender to get the entire log to throw to the user in case the build fails since at that point all the data is relevant. My question is if and how I can get that "notification" that the build failed? For those interested my intention, which I still need to validate, is then to programmatically change the consoleAppender back to info and write everything that was accumulated to it. I was asked about my motivations and so there are two. The first is that I think (still crunching data to see if I'm right) that our build logs are so verbose it's effecting our build times. The second is that some of our tests cause exceptions to be thrown as part of them which confuse the logs. I'd still like the entire log in case the build fails so that developers have all the info they need to debug their failure
has comment: http://stackoverflow.com/comment/41750392
tagged with: java
type: Question
has title: Can I know, in a maven plugin, if a build of a module failed?
accepted answer: http://stackoverflow.com/a/26565373
tagged with: logback
tagged with: slf4j
has comment: http://stackoverflow.com/comment/41749457

http://stackoverflow.com/q/26620108
has title: Why does Libgdx's AssetManager use "/" instead of "\"
score: 0
type: Question
has comment: http://stackoverflow.com/comment/41852289
tagged with: libgdx
tagged with: java
has body: According to libgdx's wiki on AssetManager they use "/" as their file separator. https://github.com/libgdx/libgdx/wiki/Managing-your-assets When I tried using java.io.File.separator as the separator the asset manager would throw errors at run-time. Why does libgdx use Unix's file separator when I'm working on windows?
has answer: http://stackoverflow.com/a/47229100
has comment: http://stackoverflow.com/comment/41860613
answer count: 1
type: UnansweredQuestion
tagged with: separator
tagged with: android
tagged with: windows

http://stackoverflow.com/a/26570451
accepted answer of: http://stackoverflow.com/q/26570184
answers question: http://stackoverflow.com/q/26570184
upvote count: 9
type: Answer
downvote count: 0
score: 9
has body: try this public static void main(String[] args) { List&lt;Integer&gt; list=Arrays.asList(2,3,4,5,8,10,11,12,15,16,17,18,19,25); List&lt;List&lt;Integer&gt;&gt;lList=new ArrayList&lt;List&lt;Integer&gt;&gt;(); //list of list of integer System.out.println("list:" + list); int i=0; int start=0; List&lt;Integer&gt; sList=new ArrayList&lt;Integer&gt;(2); for( i = 1; i &lt;list.size();i++){ if( list.get(i - 1) + 1 != list.get(i)){ sList.add(list.get(start)); sList.add(list.get(i-1)); lList.add(sList); sList=new ArrayList&lt;Integer&gt;(2); start=i; } } sList.add(list.get(start)); // for last range sList.add(list.get(list.size()-1)); lList.add(sList); System.out.println("Range :"+lList); } output : list:[2, 3, 4, 5, 8, 10, 11, 12, 15, 16, 17, 18, 19, 25] Range :[[2, 5], [8, 8], [10, 12], [15, 19], [25, 25]]
type: AcceptedAnswer

http://stackoverflow.com/a/26583418
has comment: http://stackoverflow.com/comment/41782943
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26583224
has comment: http://stackoverflow.com/comment/41782938
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26583224
has body: try following code in the fragment class that contains map: public void onDestroyView() { super.onDestroyView(); Fragment fragment = (getSupportFragmentManager().findFragmentById(R.id.map)); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.remove(fragment); ft.commit(); } as i see your comment i think you just initialize your googleMap just for time that it's null, you have something like following code, if (googleMap == null) { // initialize Map } remove if part and initialize your map.
has comment: http://stackoverflow.com/comment/41782765
downvote count: 0
has comment: http://stackoverflow.com/comment/80106898
has comment: http://stackoverflow.com/comment/41782970
score: 4

http://stackoverflow.com/a/26646962
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: use enchance for loop to iterate over parse..Somewhere else in your code you had used wrong index for parse for(String s:parse){ System.out.println(s); }
answers question: http://stackoverflow.com/q/26646736

http://stackoverflow.com/comment/41806786
type: Comment
score: 0
type: AnswerComment
has text: Nop. It still gets hanged
comment on: http://stackoverflow.com/a/26596015

http://stackoverflow.com/a/26660365
accepted answer of: http://stackoverflow.com/q/26660257
type: Answer
answers question: http://stackoverflow.com/q/26660257
downvote count: 0
score: 1
has body: The easiest Way is to use the constructor of the Set http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html along with Arrays.asList() http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html to convert your String[] into a Set&lt;String&gt;: Set&lt;String&gt; mySet = new HashSet&lt;String&gt;(Arrays.asList(s));
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/41940673
type: QuestionComment
comment on: http://stackoverflow.com/q/26667249
score: 0
has text: But localhost will only access the computer that the application is being run on, correct?
type: Comment

http://stackoverflow.com/comment/41779942
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26581402
has text: When you change the location of web.xml then you have to restart the server to reload web.xml.

http://stackoverflow.com/comment/41864854
comment on: http://stackoverflow.com/q/26627719
has text: How can this be a duplicate? Yes there are 100 questions regarding ResultInfo error. I am asking what is the who=null since its not in the onActivityResult() parameters.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41827960
comment on: http://stackoverflow.com/q/26606234
has text: @AnishAntony take a look at my answer....
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41709157
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26542498
has text: Have you navigated(in command prompt) to the folder where your file is?

http://stackoverflow.com/q/26560798
has comment: http://stackoverflow.com/comment/41742509
has body: I'm trying to delete an image from my gallery: file.delete() and the file was not completely deleted - when I check if the file exists: file.exists() It return false but if I get into the gallery I can see that instead the image there is an empty image (like an error). But if I restarting my device the image completely delete! so my question is: How can I refresh the gallery?
score: 0
has comment: http://stackoverflow.com/comment/41742212
tagged with: delete-file
has comment: http://stackoverflow.com/comment/41743369
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41742239
tagged with: gallery
has title: How do i completely delete file (image)
has comment: http://stackoverflow.com/comment/41742279
has comment: http://stackoverflow.com/comment/41742179
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26561194
linked to: http://stackoverflow.com/q/22606080
tagged with: refresh
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41743488
has comment: http://stackoverflow.com/comment/41742216

http://stackoverflow.com/a/26570419
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26570389
upvote count: 1
has body: Everything in Java is pass by value. I think it would be fun and beneficial to read this Parameter passing in Java - by reference or by value?.

http://stackoverflow.com/a/26526540
has body: More efficient method is declaring global Context and initialising it inside onCreate() method. It enable you to use the same context for other methods too such as showing Toast. public class MainActivity extends Activity { private static final String ESTIMOTE_PROXIMITY_UUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D"; private static final Region ALL_ESTIMOTE_BEACONS = new Region("regionId", ESTIMOTE_PROXIMITY_UUID, null, null); public String TAG = "Beacons"; private Context context; private BeaconManager beaconManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = getApplicationContext(); beaconManager = new BeaconManager(context); beaconManager.setRangingListener(new BeaconManager.RangingListener() { @Override public void onBeaconsDiscovered(Region region, List&lt;Beacon&gt; beacons) { Log.d(TAG, "Ranged beacons: " + beacons); } }); }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26526443
upvote count: 1
has comment: http://stackoverflow.com/comment/41680278

http://stackoverflow.com/a/26552888
answers question: http://stackoverflow.com/q/26549833
score: 0
type: Answer
has body: Looks like i have this working just as i need it using this code which also strips out a few extra pieces i didn't require, and adds the name at the start of each line: try { SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); SAXParser saxParser = saxParserFactory.newSAXParser(); DefaultHandler defaultHandler = new DefaultHandler() { String ruleName = null; public void startElement(String uri, String localName, String qname, Attributes attributes) { if (attributes.getLength() &gt; 0) { int items = attributes.getLength(); for (int i = 0; i &lt; items; i++) { if ((qname.toString().equals("Header")) || (qname.toString().equals("Response"))) { //Dont print out the XML headers } else { if (attributes.getQName(i).equals("Name")) { ruleName = attributes.getValue(i); } else { //Don't reset the string; } System.out.println(ruleName+":"+qname + ":" + attributes.getQName(i) + ":" + attributes.getValue(i)); } } } } }; saxParser.parse( "Test.xml", defaultHandler); } catch (Exception e) { e.printStackTrace(); }

http://stackoverflow.com/q/26610663
has comment: http://stackoverflow.com/comment/41846218
answer count: 1
has body: I'm programing an android app that connects to a MySQL server, so far I have it so the user can enter the server ip, database name, user name and password and store it to the phone. I am trying to build a string off the info the user just entered to test the connection prior to saving to the .txt files. I know it's probably right in front of my face but after a day of this I'm stuck, please help!! The problem is located in the 'TestButtonListener' public class AppInfo extends Activity { public static final String DEBUGTAG = "It's Broke"; public static final String DATABASEPASSWORD = "pinfo.txt"; public static final String SERVERIP = "sinfo.txt"; public static final String DATABASEUSER = "ninfo.txt"; public static final String DATABASE = "dinfo.txt"; public static final String FILESAVED = "filesaved"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app_info); addTestButtonListener(); ///Test connection private void addTestButtonListener() { Button test = (Button) findViewById(R.id.testcon); test.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ///need information from the R.id.server, R.id.database, R.id.name, R.id.pword /// and insert it into the string as serverIp, dataBase, name, pword. /// try { /// everything I've tried in here spits out the name of the text file, /// or the memory address, but not the value just typed in. } String serverConnect = new String("jdbc:mysql://" + serverIp + "/" + dataBase + ", " + name + ", " + pword); Toast.makeText(AppInfo.this, serverConnect, Toast.LENGTH_LONG) .show(); } }); }
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26634629
accepted answer: http://stackoverflow.com/a/26634629
tagged with: java
has comment: http://stackoverflow.com/comment/41833171
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41834165
has title: Trying to pass information from 4 fields in an Android app to a String in java for testing connection prior to saving the information
score: 0

http://stackoverflow.com/comment/108565427
type: AnswerComment
comment on: http://stackoverflow.com/a/58061590
has text: One thing you forgot to mention is that the above requires `implementation 'org.springframework.boot:spring-boot-starter-security'` to be declared (or it's Maven equivalent)
type: Comment
score: 1

http://stackoverflow.com/comment/41754774
comment on: http://stackoverflow.com/q/26567815
score: 0
type: QuestionComment
has text: First, if a have a list of `int` and I add `0` what happens in your scenario? Second, what sort of list? Linked? Array backed? What exactly are you asking?
type: Comment

http://stackoverflow.com/a/26580728
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41778550
has body: This is a classic case of integer division. When dividing two integers, the result is an integer. This means that 2/3 is 0. Multiplied by 100, it's still 0. Instead of (i / num) * 100, use i * 100 / num. That way, you divide 200 by 3 instead, getting the 66 you're looking for. Alternatively, you can do the calculation with floating point: return ((double) i / num) * 100; By casting, i becomes a double, which means that i / num is calculated as a double rather than an int.
has comment: http://stackoverflow.com/comment/41778274
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26580684
answers question: http://stackoverflow.com/q/26580684

http://stackoverflow.com/comment/41904397
type: Comment
type: QuestionComment
has text: Yes exceptions due to the fact that variables are not replaced by their value. Same error with @ImportResource.
score: 0
comment on: http://stackoverflow.com/q/26634426

http://stackoverflow.com/q/26577083
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26602909
has comment: http://stackoverflow.com/comment/41772334
score: 2
tagged with: java
tagged with: jaxb
has title: How to use inheritance when reading from XML files using JAXB
type: Question
linked to: http://stackoverflow.com/q/16429717
has comment: http://stackoverflow.com/comment/41772986
tagged with: inheritance
has comment: http://stackoverflow.com/comment/41792314
has body: Hi I have these classes right here: As you can see Faculty and Student inherits name from Persons. And faculty and student all have their unique attributes with that as well public class Persons{ protected String name; public Persons(){ this(null); } public Persons(String name){ this.name = name; } public String getName(){ return this.name; } public String setName(String name){ this.name = name; } } public class Student extends Persons{ private String studentId; public Student(){ this(null,null); } public Student(String name,String studentId){ this.name = name; this.studentId = studentId; } } public class Faculty extends Persons{ private String facultyId; public Faculty(){ this(null,null); } public Faculty(String name,String facultyId){ this.name = name; this.facultyId = facultyId; } } Provided that I have these XML files: Example 1 id Example 1 id and the Faculty XML file: Example 1 id Example 1 id how would I set up the classes for unmarshalling from the xml files. I have done this with normal xml files where there is not inheritance, but I was just wondering how would I do this without writing the same attributes in two classes. Thank You!
downvote count: 0

http://stackoverflow.com/q/26515357
has body: I am using a Timer to regularly schedule a task, which works fine: t = new Timer(); t.schedule(new CheckTask(), 0, Defaults.CHECK_INTERVAL); Now, in the run() of the CheckTask I would like to change the interval once. Is that possible and if yes, how?
tagged with: java
has answer: http://stackoverflow.com/a/26515843
score: 0
answer count: 1
has title: Delaying a single task in a Timer
tagged with: timer
tagged with: android
accepted answer: http://stackoverflow.com/a/26515843
type: AnsweredQuestion
type: Question

http://stackoverflow.com/a/26649594
has body: You have the method Calculate(int a,int b) with 2 parameters but call the method without parameters Calculate(). I suppose you should change the method Calculate(int a,int b) to public static int Calculate(){ int a = input.nextInt(); int b = input.nextInt(); int answer = a * b; return answer; } and as @Visme mentioned, to add static keyword. or you can leave your method as public int Calculate(){ int a = input.nextInt(); int b = input.nextInt(); int answer = a * b; return answer; } In this case in the main function, you should call the method this way: new Tutorialproject2().Calculate();
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41903694
score: 3
answers question: http://stackoverflow.com/q/26649545
has comment: http://stackoverflow.com/comment/41903648
upvote count: 3

http://stackoverflow.com/q/26607586
tagged with: components
has body: I want develop a stand alone application for a medical store with Java Swing. There is a mandatory requirement of printing of a sheet with a small size (219mm to 140mm) with a single click without the print dialog. Intermittently they need to take reports to full A4 pages from a different printer. Is it possible to change printer and paper properties in a Java application with Java SE without bringing the printer dialog ?
tagged with: java
type: Question
answer count: 1
has title: Java printer api
tagged with: awt
score: 0
tagged with: printing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26608039
tagged with: swing

http://stackoverflow.com/q/26621632
type: UnansweredQuestion
has title: How can I update my Java program to only show two decimal places
has answer: http://stackoverflow.com/a/26621664
tagged with: rounding
has answer: http://stackoverflow.com/a/26621688
tagged with: java
type: Question
tagged with: decimal
score: 0
has body: The class assignment is basically to have a dialog box that asks the user for employee name, hourly pay, and hours for the week. It outputs it to a text file. I completed that part and the teacher said he was find that the output had 4 decimal places, ex. 34.5500 I'm here to ask for assistance on how I can only show two decimal spots so its 34.55. Here is the code I complied. package out.put.of.a.file; import javax.swing.JOptionPane; public class OutPutOfAFile { public static void main(String[] args) { OutputFile payFile; payFile = new OutputFile("payroll.txt"); String name; Double pay, hours; String answer; Keyboard k; k = new Keyboard(); do { name = JOptionPane.showInputDialog("Enter the employee's name:"); pay = Double.parseDouble(JOptionPane.showInputDialog("Enter the employee's hourly wage:")); hours = Double.parseDouble(JOptionPane.showInputDialog("Enter the employee's total hours:")); payFile.writeString(name); payFile.writeDouble(pay); payFile.writeDouble(hours); payFile.writeEOL(); answer = JOptionPane.showInputDialog("Do you have another employee to enter? (yes/no)"); } while (answer.equalsIgnoreCase("yes")); payFile.close(); } }
tagged with: keyboard
has answer: http://stackoverflow.com/a/26621657
answer count: 3
tagged with: file-io
has comment: http://stackoverflow.com/comment/41853727

http://stackoverflow.com/comment/41895883
type: QuestionComment
score: 0
has text: I was hoping this was known behaviour that someone with more experience would be able to instantly identify
comment on: http://stackoverflow.com/q/26644649
type: Comment

code39
type: Tag
tag name: code39
tags question: http://stackoverflow.com/q/26561408

http://stackoverflow.com/q/26543411
has title: Cannot add data to table using Swing. What should I do?
tagged with: serialization
has comment: http://stackoverflow.com/comment/41711544
has body: The add() method is supposed to add data from file to table but that does not work. The design is for a phone book using table. The add button adds row to table and write the data to the existing file. package democardlayout; public class panel2 extends javax.swing.JPanel { public ObjectInputStream in; public ObjectOutputStream out; public panel2() { initComponents(); // addRow(1); // add(); } @SuppressWarnings("unchecked") private void initComponents() { jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); PhoneBookTable = new javax.swing.JTable(); NameField = new javax.swing.JTextField(); PhoneField = new javax.swing.JTextField(); EmailField = new javax.swing.JTextField(); AddButton = new javax.swing.JButton(); UpdateButton = new javax.swing.JButton(); DeleteButton = new javax.swing.JButton(); TableData = new javax.swing.JButton(); jLabel1.setBackground(new java.awt.Color(0, 240, 240)); jLabel1.setFont(new java.awt.Font("Arial", 3, 12)); // NOI18N jLabel1.setText("Welcome"); PhoneBookTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "PhoneNumber", "Email" } )); jScrollPane1.setViewportView(PhoneBookTable); AddButton.setText("Add"); AddButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddButtonActionPerformed(evt); } }); UpdateButton.setText("Update"); DeleteButton.setText("Delete"); TableData.setText("ShowTableData"); TableData.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { TableDataActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSeque…
answer count: 0
has comment: http://stackoverflow.com/comment/41711515
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41710738
tagged with: java
has comment: http://stackoverflow.com/comment/41723568
type: Question
has comment: http://stackoverflow.com/comment/41710648
linked to: http://stackoverflow.com/q/3988788
tagged with: jtable
score: 0
tagged with: io

http://stackoverflow.com/comment/41794703
type: Comment
has text: It's set to the the value
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26589706

http://stackoverflow.com/comment/43007456
has text: You got what I am looking for.. and thanks for the relevant link. I am hoping to get a reasonable understanding of the limiting factor in each case. Whether it is CPU cycle or memory or network bytes etc. This has got me started.
comment on: http://stackoverflow.com/a/27263030
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/41700191
comment on: http://stackoverflow.com/q/26537134
type: Comment
type: QuestionComment
has text: In the same time it took you to write the question you could have just tested this yourself...
score: 1

http://stackoverflow.com/q/26569563
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26569573
tagged with: arraylist
type: Question
has title: Else without if?
has body: I was working on my assignment for my Java 1 class and I am getting an error that does not seem like it should be one. Can I get some help? It is saying that I have an else w/out if. here is the if block char placement = scan.next().toUpperCase().charAt(0); if(placement == 'F') { System.out.print("Please Enter The Show To Be Added At The Beginning Of The List: "); String show = scan.next(); TVShows.add(0, show); } else if(placement == 'R'); { System.out.print("Please Enter The Show To Be Added At The End Of The List"); String show = scan.next(); TVShows.add(show); } else { System.out.println("Invalid Choice Please Try Again"); }
answer count: 1
has answer: http://stackoverflow.com/a/26569573
has comment: http://stackoverflow.com/comment/41758169
tagged with: if-statement
score: 0
tagged with: java

http://stackoverflow.com/q/26607354
answer count: 1
has comment: http://stackoverflow.com/comment/41847998
has comment: http://stackoverflow.com/comment/41842478
favorite count: 0
has comment: http://stackoverflow.com/comment/41836699
has comment: http://stackoverflow.com/comment/41848037
type: AnsweredQuestion
has body: I'm trying to cope with android NDK in android studio, I set up a demo app with a jni folder with the required files, it seems to work as expected when I call a function that returns an int or a const char*, but when it comes to doubles it just doesn't behave. I tried to cast the returned value to jdouble, and also tried to declare the functions as returning a long double with same results. The app is running on a nexus 5 and I have no idea what's wrong. As requested, here a few try, on the left the return statement in c, on the right the value got in java return 0 -> 0 return 1 -> 0 return 1.555 -> -1.374389535E9 return 10 -> 0 return 10.555 -> -1.71798692E8 return 2000 -> 0 return 2000.123 -> -2.0615843E8 Ok, it seems like integer values are returned as 0...? EDIT: I added a new function getMyLong as done with other functions long int getMyLong(){ return 0x1122334455667788;} the interesting thing is, if in main.c the bridge function is defined calling the function from func.c it returns just what appears to be a 32bit portion, while if I return the value directly from the bridge function, it works and so it does with doubles JNIEXPORT jlong JNICALL Java_com_lelloman_jni_1test_MainActivity_getMyLong (JNIEnv * env, jobject obj){ return getMyLong(); // this one will return 1432778632 in java //return 0x1122334455667788; this one returns 1234605616436508552 } Edit2: regarding the build configuration and ndk, I barely know what I'm doing but I'll do my best to point out what I know: - in local.properties I added this line ndk.dir=/usr/share/android-studio/data/ndk - in ndk/RELEASE.TXT says r10c (64-bit) - in build.gradle I added this inside defaultConfig (I also tried without cFlags, it's the same) ndk { moduleName "ndkTest" cFlags "-std=c99" } - javah generated a file named com_lelloman_jni_test_MainActivity.h, the only include there is #include &lt;jni.h&gt; - I wrote main.c and the only include is the file generated with javah main.c #include "com_lelloman_jni_test_…
score: 3
has comment: http://stackoverflow.com/comment/41847086
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26624365
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/41847721
has title: android NDK function returning wrong values for 64bits variables (double, long int)
accepted answer: http://stackoverflow.com/a/26624365
tagged with: java-native-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/41846446
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41848388
tagged with: android

http://stackoverflow.com/a/26546973
downvote count: 0
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26546931
has comment: http://stackoverflow.com/comment/41717584
has body: You forgot the break instruction after each of your case block: case 1: url = this.getClass().getResource("/sus.mid"); break; case 2: url = this.getClass().getResource("/sus2.mid"); break; ...
type: Answer

http://stackoverflow.com/comment/41791190
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26579566
has text: i am not able to post the logical sadly because it goes over the characters that are allowed.

http://stackoverflow.com/a/26546684
upvote count: 1
answers question: http://stackoverflow.com/q/26537841
score: -1
has body: Try this Thread.sleep(2000); driver.findElement(By.xpath("//button[@type='submit']"));
type: Answer
downvote count: 2

http://stackoverflow.com/q/26616529
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/41846111
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/13791984
type: Question
tagged with: jbutton
has comment: http://stackoverflow.com/comment/41846035
has title: How can you place a JButton over a Picture in a JFrame
score: 0
has comment: http://stackoverflow.com/comment/41845598
has comment: http://stackoverflow.com/comment/41885237
tagged with: window
has comment: http://stackoverflow.com/comment/41845485
has body: I am creating a small program. The program should consist of the following things: First it opens a window with a picture and text. It also has a Button "Let's Go!" which opens a JOptionPane with some dialog and 4 different Buttons. (It's suposed to be a quiz, so a Question and 4 different answers) When you click the wrong answer it says something like "Wrong answer, try again" If you click the right answer it say: "Right answer, feel free to procede" or something like that and the next Question opens up. So far so good. I am pretty new to Java and this is my first "big" programm and I already got a bit stuck. The Problem I am currently facing is: How can I place a JButton in my JFrame with the Picture and the Text? I created one bit it is either not displayed or below the Picture. Here is my code so far: import java.awt.*; import javax.swing.*; public class HBA extends JFrame { public HBA() { setSize(1100, 720); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout (new FlowLayout(FlowLayout.CENTER)); Icon icon = new ImageIcon("HappyBirthday.jpg"); JLabel label1 = new JLabel("Happy Birthday Anna!", JLabel.CENTER); JLabel label2 = new JLabel("Und viel Erfolg mit diesem Geschenk! ;)", JLabel.CENTER); JLabel label3 = new JLabel(icon); JButton OK = new JButton("Let's Go!"); Font schrift = new Font("ComicSans", Font.BOLD, 24); label1.setFont(schrift); label2.setFont(schrift); label1.setForeground(Color.black); label2.setForeground(Color.black); getContentPane().add(label1); getContentPane().add(label2); getContentPane().add(label3); getContentPane().setBackground(Color.white); getContentPane().add(OK); } public static void main(String[] args) { new HBA().setVisible(true); } } Beside the JButton Problem: Can someone give me an advice how to build up from this and create the JOptionPane windows?
has comment: http://stackoverflow.com/comment/41844813
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41846143

http://stackoverflow.com/comment/41924594
type: Comment
comment on: http://stackoverflow.com/q/26657259
type: QuestionComment
has text: I suggest you to isolate the problem and try doing in groups or 2 or 3.
score: 0

knapsack-problem
type: Tag
tags question: http://stackoverflow.com/q/26563055
tags question: http://stackoverflow.com/q/26624942
tag name: knapsack-problem

http://stackoverflow.com/comment/41940222
type: AnswerComment
comment on: http://stackoverflow.com/a/26669782
type: Comment
has text: Alright so I just found out using `sentence.length()` that `sentence` is 1024 characters long...if I take a substring of it, specifically `sentence.substring(0,4)` the comparison gives me true.
score: 0

http://stackoverflow.com/comment/41672241
comment on: http://stackoverflow.com/a/26521634
type: Comment
has text: they mostly now involve not finding symbols in the other two sections of the code.
score: 0
type: AnswerComment

http://stackoverflow.com/a/57683465
upvote count: 4
has body: https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/blob/master/README.md Short answer here, It's not encrypted, it still BASE64 string, Example, Started by user [8mha:[binary][0madmin Can be split to the following parts, A string: Started by user Preamble: \u001B[8mha: Base64 string: [binary] Postamble: \u001B[0m A string: admin Convert the base64 string to bytes, trim the first 40 bytes (https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/issues/1) and save as .gz file. Now you can extract real content from the .gz file. In this case, the content is type Java serialization data, version 5 following ¬í sr !hudson.console.ModelHyperlinkNote xr hudson.console.HyperlinkNote6=«±=’pÅ I lengthL urlt Ljava/lang/String;xr hudson.console.ConsoleNote xp t /user/admin
accepted answer of: http://stackoverflow.com/q/26635416
downvote count: 0
answers question: http://stackoverflow.com/q/26635416
score: 4
has comment: http://stackoverflow.com/comment/132152319
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/132443261
type: Answer

eclipse
tags question: http://stackoverflow.com/q/26613799
tags question: http://stackoverflow.com/q/26523377
tags question: http://stackoverflow.com/q/26617571
tags question: http://stackoverflow.com/q/26554990
tags question: http://stackoverflow.com/q/26570309
tags question: http://stackoverflow.com/q/26561340
tags question: http://stackoverflow.com/q/26622374
tag name: eclipse
tags question: http://stackoverflow.com/q/26607384
tags question: http://stackoverflow.com/q/26661572
tags question: http://stackoverflow.com/q/26656017
tags question: http://stackoverflow.com/q/26669129
tags question: http://stackoverflow.com/q/26546640
tags question: http://stackoverflow.com/q/26617017
tags question: http://stackoverflow.com/q/26556466
tags question: http://stackoverflow.com/q/26594092
tags question: http://stackoverflow.com/q/26637856
tags question: http://stackoverflow.com/q/26610383
tags question: http://stackoverflow.com/q/26521922
tags question: http://stackoverflow.com/q/26615687
tags question: http://stackoverflow.com/q/26529661
tags question: http://stackoverflow.com/q/26649011
tags question: http://stackoverflow.com/q/26547689
tags question: http://stackoverflow.com/q/26657235
tags question: http://stackoverflow.com/q/26615348
tags question: http://stackoverflow.com/q/26533837
tags question: http://stackoverflow.com/q/26662365
tags question: http://stackoverflow.com/q/26620356
tags question: http://stackoverflow.com/q/26662707
tags question: http://stackoverflow.com/q/26671481
tags question: http://stackoverflow.com/q/26513952
tags question: http://stackoverflow.com/q/26669610
tags question: http://stackoverflow.com/q/26521595
tags question: http://stackoverflow.com/q/26585037
tags question: http://stackoverflow.com/q/26526847
tags question: http://stackoverflow.com/q/26553986
tags question: http://stackoverflow.com/q/26596451
tags question: http://stackoverflow.com/q/26524572
tags question: http://stackoverflow.com/q/26564900
tags question: http://stackoverflow.com/q/26670556
tags question: http://stackoverflow.com/q/26653755
tags question: http://stackoverflow.com/q/26576726
tags question: http://stackoverflow.com/q/26626655
tags question: http://stackoverflow.com/q/26631870
tags question: http://stackoverflow.com/q/26624103
tags question: http://stackoverflow.com/q/26582264
tags question: http://stackoverflow.com/q/26632177
tags question: http://stackoverflow.com/q/26539713
tags question: http://stackoverflow.com/q/26606164
tags question: http://stackoverflow.com/q/26645974
tags question: http://stackoverflow.com/q/26604103
tags question: http://stackoverflow.com/q/26653521
tags question: http://stackoverflow.com/q/26514318
tags question: http://stackoverflow.com/q/26573950
tags question: http://stackoverflow.com/q/26534659
tags question: http://stackoverflow.com/q/26558288
tags question: http://stackoverflow.com/q/26659981
tags question: http://stackoverflow.com/q/26541623
tags question: http://stackoverflow.com/q/26572838
tags question: http://stackoverflow.com/q/26520900
tags question: http://stackoverflow.com/q/26668098
tags question: http://stackoverflow.com/q/26620549
tags question: http://stackoverflow.com/q/26515987
tags question: http://stackoverflow.com/q/26627170
tags question: http://stackoverflow.com/q/26517404
tags question: http://stackoverflow.com/q/26616723
tags question: http://stackoverflow.com/q/26569363
tags question: http://stackoverflow.com/q/26633627
tags question: http://stackoverflow.com/q/26535530
tags question: http://stackoverflow.com/q/26594409
tags question: http://stackoverflow.com/q/26566160
tags question: http://stackoverflow.com/q/26571902
tags question: http://stackoverflow.com/q/26520663
tags question: http://stackoverflow.com/q/26595602
tags question: http://stackoverflow.com/q/26527815
tags question: http://stackoverflow.com/q/26635721
tags question: http://stackoverflow.com/q/26546373
tags question: http://stackoverflow.com/q/26625032
tags question: http://stackoverflow.com/q/26543633
tags question: http://stackoverflow.com/q/26553307

http://stackoverflow.com/q/26660709
tagged with: java
has body: first of all sorry for my english!! :) i am working on trying to convert an ascii file who contains characters and numbers to a binary file!! the problem is: if i have in my ascii file the charactere " B " in hexadecimal it will be 42 and if i have in my ascii file the number 66 in the hexadecimal it will also be 42!! SO how can i know the difference between the value 42 in the hexadecimal does it refer to the letter B or the number 66 ??? PS: am working in JAVA. Any help would be great appreciated! Thx a lot
tagged with: ascii
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26660878
has answer: http://stackoverflow.com/a/26661145
has title: Java convertion between hexadecimal, characters, numbers
type: UnansweredQuestion
tagged with: converters
tagged with: hex
type: Question
has comment: http://stackoverflow.com/comment/41923536

http://stackoverflow.com/comment/41912308
score: 0
type: AnswerComment
has text: yeah this is what i want but then with an OnFocusChangeListener because you never touch the edittext :p
comment on: http://stackoverflow.com/a/26654510
type: Comment

http://stackoverflow.com/a/26666320
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41934347
has body: Note: Having break is going to terminate the outer loop Suggestiones how to solve this 1 . Either use BufferReader or Scanner class. 2 . Have a counter variable set to zero 3. keep reading line and check if it is equal to 3 yet 4. continue reading line, but when the counter is equal 3, save each line in either variable or Array Difference between BufferReader and Scanner 1. BufferedReader has significantly larger buffer memory than Scanner. Use BufferedReader if you want to get long strings from a stream, and use Scanner if you want to parse specific type of token from a stream. 2. Scanner can use tokenize using custom delimiter and parse the stream into primitive types of data, while BufferedReader can only read and store String. 3. BufferedReader is synchronous while Scanner is not. Use BufferedReader if you're working with multiple threads.
has comment: http://stackoverflow.com/comment/41934291
accepted answer of: http://stackoverflow.com/q/26666256
answers question: http://stackoverflow.com/q/26666256
type: AcceptedAnswer

http://stackoverflow.com/q/26546292
score: 2
tagged with: syntax
tagged with: java
has answer: http://stackoverflow.com/a/26546361
accepted answer: http://stackoverflow.com/a/26546361
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26546323
upvote count: 3
tagged with: types
has body: This question is about curiosity, not an actual problem. Can someone explain why the following code results in a compile time error? public class Test { public static void main(String... args) { (Long).parseLong("1"); // won't compile } } The error: Test.java:3: error: illegal start of type (Long).parseLong("1"); ^ 1 error With an instance it is legal to have parenthesis (though unnecessary here also): public class Test { public static void main(String... args) { Long aLong = 1L; (aLong).parseLong("1"); } } This is of course legal also: public class Test { public static void main(String... args) { Long.parseLong("1"); } }
downvote count: 1
has title: Why is it illegal to wrap a type with parenthesis when calling a static method?
has comment: http://stackoverflow.com/comment/41715490
favorite count: 0
has answer: http://stackoverflow.com/a/26546323
has comment: http://stackoverflow.com/comment/41715476
type: AnsweredQuestion

http://stackoverflow.com/a/26522661
has comment: http://stackoverflow.com/comment/41673873
answers question: http://stackoverflow.com/q/26522613
type: AcceptedAnswer
downvote count: 0
has body: You don't need a separate if condition. A single regex will do all for you. String pattern = "^(?=.*?\\d.*\\d)[a-zA-Z0-9]{8,}$";
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26522613
score: 6

http://stackoverflow.com/q/26672030
accepted answer: http://stackoverflow.com/a/26682511
has comment: http://stackoverflow.com/comment/41946835
favorite count: 0
has comment: http://stackoverflow.com/comment/41946044
has title: Apache DateUtils truncate for WEEK
has answer: http://stackoverflow.com/a/26682511
possible better answer: http://stackoverflow.com/a/48017577
has body: I'm using Apache commons-lang3 DateUtils.truncate(Calendar calendar, int field) method to 'cut off' unnecessary fields of a Calendar object. Now when the field parameter gets the value of Calendar.WEEK_OF_MONTH, it throws a java.lang.IllegalArgumentException: The field 4 is not supported The truncate() method's documentation says: /** * Truncates a date, leaving the field specified as the most * significant field. * * For example, if you had the date-time of 28 Mar 2002 * 13:45:01.231, if you passed with HOUR, it would return 28 Mar * 2002 13:00:00.000. If this was passed with MONTH, it would * return 1 Mar 2002 0:00:00.000. * * @param date the date to work with, not null * @param field the field from {@code Calendar} or SEMI_MONTH * @return the different truncated date, not null * @throws IllegalArgumentException if the date is null * @throws ArithmeticException if the year is over 280 million */ So I assume this should work, but it clearly doesn't. Is there a way to truncate dates to the week's first day using DateUtils? UPDATE: I looked up in the source code and found out that the modify() method (tuncate() uses this internally), iterates through a bunch of predefined fields to find the given parameter. Now these fields are: private static final int[][] fields = { {Calendar.MILLISECOND}, {Calendar.SECOND}, {Calendar.MINUTE}, {Calendar.HOUR_OF_DAY, Calendar.HOUR}, {Calendar.DATE, Calendar.DAY_OF_MONTH, Calendar.AM_PM /* Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK, Calendar.DAY_OF_WEEK_IN_MONTH */ }, {Calendar.MONTH, DateUtils.SEMI_MONTH}, {Calendar.YEAR}, {Calendar.ERA}}; As one can see, there is nothing related to Calendar's WEEK-ish fields, so I guess I have to do this manually... Any other thoughts/recommendations are welcome!
type: AnsweredQuestion
tagged with: java
tagged with: apache-commons-dateutils
downvote count: 1
type: Question
score: 5
upvote count: 6
has answer: http://stackoverflow.com/a/48017577
tagged with: apache-commons-lang
answer count: 2
linked to: http://stackoverflow.com/q/9307884

http://stackoverflow.com/a/26538762
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26538738
type: Answer
has body: It appears that minimizeJar in the maven's shade plugin was responsible for this. Removed that option in a last-ditch attempt to fix things and everything works like clockwork.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26538738

http://stackoverflow.com/q/26591267
downvote count: 0
favorite count: 0
tagged with: rules
has comment: http://stackoverflow.com/comment/53031612
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
has title: Using JBoss BRMS to Create My Own Decision Table Application
upvote count: 1
tagged with: jboss
type: Question
tagged with: drools
has comment: http://stackoverflow.com/comment/53034327
has body: I am using the open-source JBoss BRMS application from jboss.org. Hopefully, if you clicked on this post you are familiar with this web application that can be used to develop applications that use Drools rules. I am following along with the tutorial on building an application that uses a Decision Table to create the rules. That tutorial can be found here: http://www.jboss.org//quickstarts/brms/decision-table/index.html. I was able to successfully execute this tutorial after modifying the pom.xml some. My question is how can I create my own similar application? This example application works by importing some Java classes into the BRMS repository and also putting a pre-configured Settings.xml file in the ./m2 Maven repository. There are also some folders at another location on my computer that contain 1) a pom.xml file and 2) a src and test directory which contain other things like java source files, compiled byte-code, and some XML files. How can I do this on my own and build my own JBoss BRMS Decision Table application? I was able to create some classes and a spreadsheet and validated this with JBoss BRMS but I am still confused on how to a) create the pom.xml file, b) create the Settings.xml file, and c) create the folders with the required program files like java source code to use Maven to build and run. I have been reading the Drools documentation and the "proprietary documentation" from Red Hat on the business rules management system (BRMS) that is not too helpful as of yet. It is somewhat helpful but not really. I call it "proprietary documentation" because it is on access.redhat.com which requires a subscription to even download trial software. Jboss.org has completely free versions of similar software. I hope this made sense. Please reply in the comments if it did not make any sense to you. Respectfully, user3870315

multithreading
tags question: http://stackoverflow.com/q/26621929
tags question: http://stackoverflow.com/q/26655268
tags question: http://stackoverflow.com/q/26578037
tags question: http://stackoverflow.com/q/26569813
tags question: http://stackoverflow.com/q/26516372
tags question: http://stackoverflow.com/q/26617649
tags question: http://stackoverflow.com/q/26578692
tags question: http://stackoverflow.com/q/26559481
tags question: http://stackoverflow.com/q/26598815
tags question: http://stackoverflow.com/q/26606164
type: Tag
tags question: http://stackoverflow.com/q/26562363
tags question: http://stackoverflow.com/q/26573839
tags question: http://stackoverflow.com/q/26600031
tags question: http://stackoverflow.com/q/26621907
tags question: http://stackoverflow.com/q/26543498
tags question: http://stackoverflow.com/q/26561678
tags question: http://stackoverflow.com/q/26585044
tags question: http://stackoverflow.com/q/26540036
tags question: http://stackoverflow.com/q/26578368
tags question: http://stackoverflow.com/q/26535842
tags question: http://stackoverflow.com/q/26570338
tags question: http://stackoverflow.com/q/26628098
tags question: http://stackoverflow.com/q/26623928
tags question: http://stackoverflow.com/q/26550669
tags question: http://stackoverflow.com/q/26544241
tags question: http://stackoverflow.com/q/26595952
tags question: http://stackoverflow.com/q/26574666
tags question: http://stackoverflow.com/q/26544880
tags question: http://stackoverflow.com/q/26613177
tags question: http://stackoverflow.com/q/26542741
tags question: http://stackoverflow.com/q/26541511
tags question: http://stackoverflow.com/q/26639378
tags question: http://stackoverflow.com/q/26549338
tags question: http://stackoverflow.com/q/26631093
tags question: http://stackoverflow.com/q/26597169
tags question: http://stackoverflow.com/q/26568825
tags question: http://stackoverflow.com/q/26640500
tags question: http://stackoverflow.com/q/26622721
tags question: http://stackoverflow.com/q/26656682
tags question: http://stackoverflow.com/q/26590651
tags question: http://stackoverflow.com/q/26621292
tags question: http://stackoverflow.com/q/26580984
tags question: http://stackoverflow.com/q/26663499
tags question: http://stackoverflow.com/q/26548469
tags question: http://stackoverflow.com/q/26647097
tags question: http://stackoverflow.com/q/26546397
tags question: http://stackoverflow.com/q/26610791
tags question: http://stackoverflow.com/q/26667803
tags question: http://stackoverflow.com/q/26649429
tags question: http://stackoverflow.com/q/26547467
tags question: http://stackoverflow.com/q/26554991
tags question: http://stackoverflow.com/q/26543064
tags question: http://stackoverflow.com/q/26582517
tags question: http://stackoverflow.com/q/26564345
tags question: http://stackoverflow.com/q/26602011
tags question: http://stackoverflow.com/q/26652826
tags question: http://stackoverflow.com/q/26565854
tags question: http://stackoverflow.com/q/26575623
tags question: http://stackoverflow.com/q/26642696
tags question: http://stackoverflow.com/q/26611042
tags question: http://stackoverflow.com/q/26601860
tags question: http://stackoverflow.com/q/26522937
tags question: http://stackoverflow.com/q/26564335
tags question: http://stackoverflow.com/q/26537627
tags question: http://stackoverflow.com/q/26514995
tags question: http://stackoverflow.com/q/26572929
tags question: http://stackoverflow.com/q/26576260
tags question: http://stackoverflow.com/q/26590542
tags question: http://stackoverflow.com/q/26587270
tags question: http://stackoverflow.com/q/26616712
tags question: http://stackoverflow.com/q/26581057
tags question: http://stackoverflow.com/q/26647840
tags question: http://stackoverflow.com/q/26587099
tags question: http://stackoverflow.com/q/26580196
tags question: http://stackoverflow.com/q/26527717
tags question: http://stackoverflow.com/q/26644061
tags question: http://stackoverflow.com/q/26665995
tags question: http://stackoverflow.com/q/26631514
tags question: http://stackoverflow.com/q/26605172

http://stackoverflow.com/a/26599916
accepted answer of: http://stackoverflow.com/q/26599754
answers question: http://stackoverflow.com/q/26599754
type: Answer
score: 0
has body: I think this will do what you want public static int[] MoveToRightOne(int userArray[] ) { // the new array will have the same length as the input int newArray [] = new int[userArray.length]; // two indexes i for the input and j for the output int i = 0, j = 0; while(j &lt; userArray.length){ // while it's not the end of the output // we insert the element newArray[j] = userArray[i]; if(userArray[i] == 0){ // if the current element is a 0 // we insert an additional 0 j ++; if(j &lt; userArray.length) newArray[j] = 0; } // increment indexes i ++; j ++; } return newArray; }
type: AcceptedAnswer

http://stackoverflow.com/comment/41785951
has text: Hence the note: "this is an oversimplified explanation. In reality, it's a bit more complex than that". The point here is not to explain the service provider mechanism, reflection, and so on. The point is to explain that an inctance of a concrete class implementing Connection is created and returned.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26583958
score: 0

http://stackoverflow.com/comment/41800222
has text: Which version of primefaces extensions are you using?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26592576
score: 0

http://stackoverflow.com/q/26520248
tagged with: hibernate
tagged with: mysql
has body: I have a table in MySQL like this Table Accumulator which have something like this. id-> autoIncrement. year->int(11) key->varchar(255) value(int 11) The behavior of this table is only one value for year and for key something like this. ID YEAR KEY VALUE 1 2014 STOCK 13 2 2014 QUOTE 10 3 2014 INVOICE 20 this values are not allowed. ID YEAR KEY VALUE 1 2014 STOCK 13 2 2014 QUOTE 10 3 2014 STOCK 20 We can't have two records with the same YEAR and KEY I have a DAO method like this. public Accumulator get(final String key,final Integer year) { final Session session = currentSession(); final org.hibernate.Query query= session .getNamedQuery("findAccumulatorByKeyAndYear") .setParameter("key",key) .setParameter("year",year) query.setLockOptions(LockOptions.UPGRADE) .setResultTransformer(transformer(clazz)); return (Acumulator)query.uniqueResult(); } Which is called from a Manager method: all this happens in the same Hibernate Session public int getAccumulator(final String key,final Integer year) { Accumulator accumulator = this.dao.get(key,year); if (accumulator==null)//is not found { final Accumulator newAccumulator = new Accumulator();//create the new Accumulator with key and year newAccumulator.setKey(c01); newAccumulator.setYear(year); newAccumulator.setValue(0); this.save(newAccumulator); return newAccumulator.getValue();//we return the new Value of the record which is 0 in this case } else {//this is working OK. accumulator.setC03(accumulator.getValue()+1);//if exist we add one to value... dao.incrementWithHQL(accumulator);//update in DB. return accumulator.getValue();//return new Value } } This routine is called from semi-low concurrency; the problem arises in this case: Accumulator accumulator = this.dao.get(key,year); if (accumulator==null)//is not found { final Accumulator newAccumulator = new Accumulator();//create the new Accumulator with key and year newAccumulator.setKey(c01); newAccumulator.setYear(year); newAccumulator.setValue(0); this.save(newAccumulator)…
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26520458
tagged with: locking
downvote count: 0
has answer: http://stackoverflow.com/a/26520456
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: Java Hibernate MySQL table locking
score: 1
tagged with: java

http://stackoverflow.com/comment/41781497
comment on: http://stackoverflow.com/q/26582575
has text: Yes.. What is the position of each detail like name, id, age etc.. Show us the input..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41875815
type: QuestionComment
score: 0
has text: Variables should only be initialised/created in their retaliative scope - since they use memory and so it uses more memory than required.
comment on: http://stackoverflow.com/q/26634070
type: Comment

http://stackoverflow.com/comment/41702697
comment on: http://stackoverflow.com/q/26538434
has text: Thanks for the help, but I managed to fix it. I used an URL like you said, which at first didn't work, but all I had to do was simply refresh the project, allowing the png files to show up. THANKS EVERYONE!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26533183
favorite count: 0
has comment: http://stackoverflow.com/comment/41693215
answer count: 0
has comment: http://stackoverflow.com/comment/41711352
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41694646
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/41695914
has comment: http://stackoverflow.com/comment/41694471
linked to: http://stackoverflow.com/q/66540
tagged with: java
has title: Importance of system.gc() in java
duplicate of: http://stackoverflow.com/q/66540
type: Question
has comment: http://stackoverflow.com/comment/41692889
has comment: http://stackoverflow.com/comment/41694398
downvote count: 0
has comment: http://stackoverflow.com/comment/41694558
score: 1
has comment: http://stackoverflow.com/comment/41694191
has body: I am learning Java internals and this can be a naive question. I understood the concept of garbage collection in Java that JVM decides when to perform garbage collection but we can only REQUEST JVM by using System.gc() . So my question is that if System.gc() does not force the garbage collection then what is the importance of the command? What exactly we can achieve by this call? What are the considerations while supporting System.gc() call? Essentially the question is why Java provide System.gc() call?
tagged with: jvm

http://stackoverflow.com/comment/41682292
has text: Post the **exact** error message(s)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26527651

http://stackoverflow.com/comment/41840977
type: QuestionComment
comment on: http://stackoverflow.com/q/26597946
score: 1
type: Comment
has text: Simply create an object holding the `Method` and the desired `Class`. You may think about the right `hashCode` for that object as [`Method.hashCode` uses only the declaring class and the name](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html#hashCode()) which performs poorly in a `HashSet` if you have overloaded methods which differ in the parameter types only…

http://stackoverflow.com/comment/41926099
type: QuestionComment
has text: Log into each machine and run `/usr/bin/date +%Z` and check that they all return the same timezone.
score: 0
comment on: http://stackoverflow.com/q/26661995
type: Comment

http://stackoverflow.com/comment/41856474
comment on: http://stackoverflow.com/a/26622905
type: AnswerComment
score: 0
type: Comment
has text: `matcher.replaceAll("\\$")` returns the same string with no escaping. Any idea what could be going wrong ?

http://stackoverflow.com/q/26592258
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
favorite count: 0
has body: guys i am working on web application in jsp and servlets .. in myjsp.jsp i have a list List<String> sexList = (List<String>)request.getAttribute("sexList"); %> and put it in cumbo box in html tag like this Gender: <%for(String i : sexList) { %> <option value="<%=i%>"><%=i %> <%}%> but now i want to select the selected item from database using JSTL and i want to know how to return or get this selected item .. any help
type: Question
accepted answer: http://stackoverflow.com/a/26593559
upvote count: 2
answer count: 1
tagged with: jakarta-ee
tagged with: java
has title: How to retrive data from DB for a selected dropdown value using only JSTL?
tagged with: servlets
tagged with: jstl
has answer: http://stackoverflow.com/a/26593559
score: 2

http://stackoverflow.com/q/26575805
linked to: http://stackoverflow.com/q/4599618
tagged with: subdirectory
tagged with: import
has body: For my college course I create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle's perimeter and area. It has set and get methods for both length and width. The set methods should verify that length and width are each floating points numbers larger than 0.0 and less than 20.0. Write a program that test class Rectangle. Just when I thought I was on a roll learning java I run into this problem that throws me completely off. I am stumped and lost. The class path is set in the environmental variable in the control panel. I did that already. I don't understand about the directory and sub directories bit. I downloaded JUNIT and put it in the same directory as the java projects in this problem. Rectangle.java compiles but RectangleTest.java does not. I get the infamous error "package com does not exist." I'm basically lost. Can anybody shed some light on this problem for me. Here are both applications: package com.schweidel; public class Rectangle { private double length;//1 - 12 private double width;//1 - 9 private double perimeter;//1 - 217 private double area;//1 - 108 public void setPerimeter(double l, double w, double p, double a)//declaring and inititalizing perimeter method { length =((l &gt; 0.00 &amp;&amp; l &lt; 20.00)? l: 1); width =((w &gt; 0.00 &amp;&amp; w &lt; 20.00)? w: 1); perimeter =((p&gt; 2.0*(length * width) &amp;&amp; p &lt; 217.00)? p: 1); area = ((a&gt; length * width &amp;&amp; a &lt; 108.00)? a: 1); } //end method perimeter public String toString()//defining toString method { return String.format("The measurements are: %.2f: %.2f: %.2f: %.2f",length,width,perimeter,area); } }//end class Rectangle Here is the test application, that does not compile. import com.schweidel;//import com.schweidel public class RectangleTest { public static void main(String[] args) { Rectangle rect = new Rectangle();//calls Rectangle constructor System.out.println(rect.toString()); }//end method …
score: 0
answer count: 1
has title: RectangleTest.java:1: error: package com does not exist
tagged with: package
has answer: http://stackoverflow.com/a/26576004
type: UnansweredQuestion
tagged with: classpath
type: Question
tagged with: java

http://stackoverflow.com/comment/41701456
score: 0
type: Comment
type: QuestionComment
has text: Is your class name `public static void main(String[] args0) { }`? Did you export the `.jar` file correctly?
comment on: http://stackoverflow.com/q/26537894

http://stackoverflow.com/q/26648409
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26656754
has comment: http://stackoverflow.com/comment/41902350
tagged with: java
tagged with: mysql
type: Question
has title: How to manage secret Key in java
has comment: http://stackoverflow.com/comment/41901896
has body: I am developing a Java cryptography application. I want to encrypt a file using symmetric algorithms such as AES or DES and store the secretKey in a database for future decryption of the file. I am wondering how to store the SecretKey object in a database table. Should I serialize the key object? (secretKey is serilaizable.) How to store serialized object in database? what MYSQL data type should I use? Another solution is to get the raw byte[] of key, convert it to base64 and store in database. I can later on decode the base64 key to the original Raw key, but the problem is in converting the raw key to SecretKey object. Any help would be highly appreciated.
has comment: http://stackoverflow.com/comment/41901468
linked to: http://stackoverflow.com/q/2747203
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41901744
favorite count: 0
has comment: http://stackoverflow.com/comment/41904398
tagged with: encryption
has answer: http://stackoverflow.com/a/26656754
score: 6
tagged with: encryption-symmetric
tagged with: cryptography
upvote count: 6
has comment: http://stackoverflow.com/comment/41902149

http://stackoverflow.com/comment/41933165
comment on: http://stackoverflow.com/q/26665662
score: 0
type: Comment
type: QuestionComment
has text: I'm curious what the compilation error is.

http://stackoverflow.com/q/26656653
has answer: http://stackoverflow.com/a/26661934
has comment: http://stackoverflow.com/comment/41937302
type: Question
tagged with: jnienv
upvote count: 1
answer count: 1
tagged with: jniwrapper
favorite count: 0
has title: jni getMethodID returns Null when used to get ID of constructor
has body: I have assigned jvm to global variable in a function using int status = (*jenv)-&gt;GetJavaVM(jenv, &amp;jvm); if(status != 0) { printf(" Fail!\n"); } classNameC is a global variable, and its class has no constructor.Then in other function, i am using it like this: JNIEnv *env; printf("starting function\n"); (*jvm)-&gt;AttachCurrentThread(jvm, (void **)&amp;env, NULL); printf("thread attached\n"); jclass local = (*env)-&gt;FindClass(env,classNameC); if(local!=NULL) { printf("1st class found\n"); } jmethodID constructor=(*env)-&gt;GetMethodID(env,local,"&lt;init&gt;","()V"); if(constructor==NULL) { printf("1st Constructoris NULL\n"); } else { printf("1st Constructor created\n"); } jobject classObject=(*env)-&gt;NewObject(env,local,constructor); if(classObject==NULL) { printf("1st object is NULL\n"); } else { printf("1st object is created\n"); } jclass local1 = (*env)-&gt;FindClass(env,"SWIGTYPE_p_void"); if(local1==NULL) { printf("SWIGTYPE p void class is NULL\n"); } else { printf("SWIGTYPE p void class created\n"); } This constructor has 2 parametrs one is long and next is boolean. This class has 2 constructors other one has no parameters and initializing members with 0. jmethodID constructor1=(*env)-&gt;GetMethodID(env,local1,"&lt;init&gt;","(J;Z;)V"); if(constructor1==NULL) { printf("SWIGTYPE p void constructor is NULL\n"); } else { printf("SWIGTYPE p void constructor is created\n"); } when i run it, it successfully printed upto SWIGTYPE p void class created and SWIGTYPE p void constructor is NULL and then it gave this error: A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007f7ec503fa7b, pid=25307, tid=140182441326336 JRE version: Java(TM) SE Runtime Environment (7.0_65-b17) (build 1.7.0_65-b17) Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops) Problematic frame: V [libjvm.so+0x657a7b] JNI_ArgumentPusherVaArg::JNI_ArgumentPusherVaArg(_jmethodID*, __va_list_tag*)+0x1b Core dump wr…
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26661934
has comment: http://stackoverflow.com/comment/41917257
type: AnsweredQuestion
tagged with: java-native-interface

http://stackoverflow.com/a/26587614
answers question: http://stackoverflow.com/q/26565763
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26565763
score: 4
has body: _BlobInfo_ is not a special name and most likely your app doesn't create entities with this name. In production environment __BlobInfo__ is an internal name for storing information about blobs stored in the Blobstore. Note that there are two underscore characters (_) before and after the word BlobInfo. This entity is only created if your app creates and saves blobs into the Blobstore. Since this is an internal entity, it is excluded from the Datastore Viewer by default. It is also exluded from the Datastore Statistics page, but they appear as BlobInfo under Kind: "All Entities". By using a little trick, you can also show detailed statistics for the __BlobInfo__ entity: choose any entity from the dropdown list, and afte the page has reloaded, in the url modify the parameter kind=XXX to kind=__BlobInfo__ and hit enter. Now the page will reload showing statistics for this even though it is hidden from the dropdown list. However, you can list these entities. For example go to the Datastore Viewer of your admin console, and check "By GQL" so you can enter a GQL to list your entites. Now enter the following GQL query: SELECT * FROM __BlobInfo__ This will list your BlobInfo entities. Note that the Blob Viewer page of your admin console also displays blobs based on the entities stored under the name __BlobInfo__. __BlobInfo__ entities also contain more properties than just the ones displayed on the Blob Viewer page. All the properties are the following: ID/Name content_type creation creation_handle filename md5_hash size upload_id These are also available from your application if you happen to query these entities.
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/41798789

http://stackoverflow.com/comment/41795264
score: 0
comment on: http://stackoverflow.com/a/26589139
type: AnswerComment
type: Comment
has text: Thanks a lot, I will test and respond in few days.

http://stackoverflow.com/q/26670627
has answer: http://stackoverflow.com/a/26671267
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41941764
possible better answer: http://stackoverflow.com/a/26671267
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26671156
has answer: http://stackoverflow.com/a/26670674
has body: This is my code for (String k : word1.keySet()) { System.out.println(k + "\t" + word1.get(k)); //int c+=word1.get(k); } System.out.println(word1.size()); The output of this code is Photos 0.6337632198238539 software 0.20454545454545456 service 0.09090909090909091 applications -0.20391337869173334 The commented line shows error. help me!!!
has comment: http://stackoverflow.com/comment/41941939
favorite count: 0
has answer: http://stackoverflow.com/a/26670682
answer count: 4
has comment: http://stackoverflow.com/comment/41941712
has comment: http://stackoverflow.com/comment/41941793
accepted answer: http://stackoverflow.com/a/26670682
has title: How to find the sum of values in hashmap in a file
downvote count: 1

http://stackoverflow.com/q/26572748
score: 0
linked to: http://stackoverflow.com/q/9554636
answer count: 1
has answer: http://stackoverflow.com/a/26573807
tagged with: jframe
linked to: http://stackoverflow.com/q/9543970
has comment: http://stackoverflow.com/comment/41763397
has title: Display a set of images inside Netbeans JFrame
type: UnansweredQuestion
tagged with: java
tagged with: swing
tagged with: bufferedimage
type: Question
tagged with: jpanel
has body: I know how to display the images in separate JFrames. public static void displayImage(BufferedImage img) { JFrame f = new JFrame(); f.add(new JLabel(new ImageIcon(img))); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); But I want a method to display all the images in a single JFrame(or in a suitable element), So I can shift between the images using two buttons("Next" and "Previous").

http://stackoverflow.com/a/26535890
accepted answer of: http://stackoverflow.com/q/26535842
upvote count: 7
answers question: http://stackoverflow.com/q/26535842
score: 7
has body: Add a hook on JVM start. In the hook, just put : Class.forName("javax.imageio.ImageIO"); This will force the class loader to load the class and do whatever static initialization it needs. I think your problem is the class is being loaded on a thread, and the 2nd thread is trying to use ImageIO, which cause a clash on locks (or lackof locks) obtained on color profiles. Edit: You can add this line to your main too. Make sure it's the first line you call. ImageIO was not the class responsible for ColorSpace initialization. Class.forName("java.awt.color.ICC_ColorSpace"); Class.forName("sun.java2d.cmm.lcms.LCMS"); does the trick tough.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41698755
type: Answer
has comment: http://stackoverflow.com/comment/41698260

http://stackoverflow.com/comment/41670240
score: 0
comment on: http://stackoverflow.com/q/26520142
type: Comment
type: QuestionComment
has text: I'm not sure what symlinks you are referring to, or how you changed them. Leaving all of that stuff set to it's default config, did you try adding a JAVA_HOME variable to your .profile file? It's not clear which version of Java is desired, but for example: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7/Contents/Home

http://stackoverflow.com/q/26633876
tagged with: java
linked to: http://stackoverflow.com/q/5621338
upvote count: 1
tagged with: user-interface
answer count: 1
has body: I want to make a program with a BorderLayout where the center and the east part is graphically separated. I tried the following, but unfortunately the separator is on the left side of the JFrame and not between the centerPanel and the rightPanel. setLayout(new BorderLayout()); JPanel centerPanel = new JPanel(); JPanel rightPanel = new JPanel(); centerPanel.add(new JLabel("center")); rightPanel.add(new JLabel("right")); getContentPane().add(centerPanel, BorderLayout.CENTER); getContentPane().add(rightPanel, BorderLayout.EAST); getContentPane().add(new JSeparator(JSeparator.VERTICAL), BorderLayout.LINE_START); Can someone please help me out?
linked to: http://stackoverflow.com/q/22003802
favorite count: 0
has title: JSeparator between BorderLayout.CENTER and BorderLayout.EAST?
type: AnsweredQuestion
downvote count: 0
tagged with: jframe
tagged with: swing
linked to: http://stackoverflow.com/q/11415813
type: Question
has answer: http://stackoverflow.com/a/26634226
accepted answer: http://stackoverflow.com/a/26634226
score: 1

http://stackoverflow.com/comment/41923511
type: Comment
has text: you will return -1 at the end outside your for loop
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26660466

http://stackoverflow.com/q/26598472
type: AnsweredQuestion
has body: I have a system where the user can register students, subjects, and the student grade in each subject, together with the topic and the date. You can search a particular student grades in a particular subject by entering the code of the student, and by selecting the subject from a combobox. If you search it, those things are displayed in the jTable1. Then, I have a PRINT button. When the user clicks the Print button, the content that is being displayed in the jTable1, goes to a jTable2, the difference between those 2 tables is that the jTable1 displays the name of the student, and the name of the subject, but the jTable2 doesn't. Here is a pic for better understanding: https://i.sstatic.net/37SNh.png So, when the user clicked the button to Print the jTable2, I was using this code right here: MessageFormat header = new MessageFormat("Ficha Pedagógica - "+jComboBox1.getSelectedItem()); MessageFormat footer = new MessageFormat("Página {0,number,integer}"); try{ jTable2.print(JTable.PrintMode.NORMAL, header, null); } catch(java.awt.print.PrinterException e){ System.out.println("error"); } The fact is, that I wanted 2 headlines to be printed, but such thing couldn't be achieved using the built-in print function. So, here in Stack Overflow, I found this topic: How to print multiple header lines with MessageFormat using a JTable After I found this, I tried using the code given there. Since I'm a beginner, even with all the comments in the code, I couldn't fully understand it. So, I tried to implement it, but now, when I click the "Print" button, nothing happens. This is my code of the Print button: private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ Class.forName(driver); con = DriverManager.getConnection(str_conn,usuario,senha); stmt = con.createStatement(); sql = "select topico, nota, datanota from notas where notas.cod_aluno ="+jTextField1.getText()+" and notas.cod_curso ="+jTextField2.getText()+" order by nota…
has answer: http://stackoverflow.com/a/26598867
accepted answer: http://stackoverflow.com/a/26598867
tagged with: java
linked to: http://stackoverflow.com/q/26580954
type: Question
has comment: http://stackoverflow.com/comment/41812080
tagged with: jtable
score: 0
linked to: http://stackoverflow.com/q/11956254
tagged with: printing
has comment: http://stackoverflow.com/comment/41812012
has comment: http://stackoverflow.com/comment/41811362
answer count: 1
has comment: http://stackoverflow.com/comment/41812348
has comment: http://stackoverflow.com/comment/41811378
has comment: http://stackoverflow.com/comment/41811956
has comment: http://stackoverflow.com/comment/41812063
has comment: http://stackoverflow.com/comment/41812018
has title: Printable not working properly
tagged with: swing

http://stackoverflow.com/a/26617563
downvote count: 0
score: 1
has body: Fixed: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_page); doBindService(); Intent music = new Intent(); music.setClass(this, MusicService.class); startService(music); } and @Override protected void onDestroy() { super.onDestroy(); doUnbindService(); }
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26616571
accepted answer of: http://stackoverflow.com/q/26616571
type: Answer

http://stackoverflow.com/comment/41855465
has text: Otherwise install mp3 plugin http://www.oracle.com/technetwork/java/javase/download-137625.html. You can't open mp3 with regular JRE.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26613720

http://stackoverflow.com/q/26578539
answer count: 1
tagged with: apache-fop
score: 0
has title: JAXB generated TableCell class from FOP schema - no way to add Block
has body: I have used XJC to convert the unofficial FOP schema to Java objects http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop.xsd?view=co When writing an XML document that adheres to the schema, I can add an &lt;fo:block/&gt; element inside an &lt;fo:table-cell/&gt; element; but I can't see any way to add a Block to a TableCell programmatically using the generated TableCell class. Am I missing the method that achieves this? http://pastebin.com/raw.php?i=Xs6gjE3T
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26588713
type: Question
accepted answer: http://stackoverflow.com/a/26588713
type: AnsweredQuestion
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/41671838
type: AnswerComment
has text: @user2900314 did you remember to set the array size to 3?
type: Comment
comment on: http://stackoverflow.com/a/26521117
score: 0

http://stackoverflow.com/q/26530012
has comment: http://stackoverflow.com/comment/41687041
has title: Leading zeros not retained while reading ms excel with apache POI
score: 2
tagged with: apache-poi
downvote count: 0
has comment: http://stackoverflow.com/comment/41686467
type: UnansweredQuestion
tagged with: java
tagged with: excel
type: Question
has body: I am trying to read .xlsx file in java (using Apache POI API) whose cell contain values having leading zeros. e.g 0590040100000124 But in output i get something like this 6247241.0 &lt;-> 5.90040100000124E14 &lt;-> 0.0 &lt;-> 5.90020100000125E14 &lt;-> Here is my code public static void main(String[] args) throws FileNotFoundException, IOException { // TODO Auto-generated method stub try{ Workbook workbook = new XSSFWorkbook(new FileInputStream("C://dedup//dedup.xlsx")); String sheetName= workbook.getSheetName(0); System.out.println("Sheet Name:"+sheetName); double cellValues[] = new double[1000]; for (int i = 0; i &lt; workbook.getNumberOfSheets(); i++) { Sheet sheet = workbook.getSheetAt(i); int cellIndex=0; for (Row row : sheet) { for (Cell cell : row) { //if(cell.toString()!=null){ cell.setCellType(Cell.CELL_TYPE_NUMERIC); cellValues[cellIndex]=cell.getNumericCellValue(); cellIndex++; //} } } for(int k=0;k&lt;cellValues.length;k++) System.out.print(cellValues[k]+" &lt;-&gt; "+"\t"); } }catch(Exception e){ System.out.println("JKB Exception Message:"+e.getMessage()); }
has comment: http://stackoverflow.com/comment/41688698
upvote count: 2
tagged with: apache
answer count: 1
has answer: http://stackoverflow.com/a/26531661
favorite count: 0

http://stackoverflow.com/comment/41709497
type: QuestionComment
comment on: http://stackoverflow.com/q/26542498
score: 0
has text: Should I be putting my replies in my question or keep using the comments? I've never used this site so I'm not sure
type: Comment

http://stackoverflow.com/a/26565529
has comment: http://stackoverflow.com/comment/41750262
has body: One solution could be to create a temp array in each of the methods and sort that one so the original goes unchanged. Here's how I picture it. This assumes you want to return the sorted array, but you may not have to if all you want to do is time the sort. public String[] sort1(String[] arr){ String[] temp = Arrays.copyOf(arr, arr.Length); // start counter // sort temp // end counter return temp; } And then somewhere in your main method you could call each of the sort methods with your original array, and it would never be changed. I'm (admittedly) not an efficiency expert, and there may be a more efficient way than creating a copy of each array, but if this is just a small application to test your sorting speeds this should do everything you need it to. EDIT Here's one flow-of-control that came to mind that I think would help keep things most organized for you. // Create array public String[] myArray = {"Blah", "Blah", "Blah"}; // Have one sortArray() method that will take the array to be sorted, as well as the type of sort to be used. public void sortArray(String[] arr, int arrayType){ String[] temp = Arrays.copyOf(arr, arr.Length); // Switch based on sort type switch(arrayType){ case 1: sort1(temp); break; case 2: sort2(temp); break; default: // Maybe raise exception about no available sort. Or just break. break; } } // Your main method can loop through each: public static void Main(String[] args){ int numSorts = 4; // Or whatever for(int i = 1; i &lt;= numSorts; i++){ sortArray(myArray, i); } } I'm sure much syntax will be adjusted to match your existing code, but I would create one sorting method that copies the input array, and in turn calls the necessary sorting method. Then, inside your main, you can loop through each sorting method you have. Inside each specific sorting method (sort1(), sort2()) I would start your timers there. Print to the console or a log, whatever you prefer. Let me know if this doesn't work out.
score: 0
answers question: http://stackoverflow.com/q/26565211
type: Answer
has comment: http://stackoverflow.com/comment/41750312
has comment: http://stackoverflow.com/comment/41750444

http://stackoverflow.com/comment/41809164
score: 0
type: Comment
type: QuestionComment
has text: try adding "/" at the beginning, that will look in the resource folders: <beans:import resource="/application-context.xml"/></beans:beans>`
comment on: http://stackoverflow.com/q/26597415

http://stackoverflow.com/comment/41914229
comment on: http://stackoverflow.com/q/26655769
score: 0
type: Comment
type: QuestionComment
has text: You should read this @Robert Hume, "First of all, threads cannot speed up execution of code." http://programmers.stackexchange.com/questions/97615/what-can-multiple-threads-do-that-a-single-thread-cannot

http://stackoverflow.com/a/26618919
type: Answer
answers question: http://stackoverflow.com/q/26567893
has body: the correct jndi name is in the logs (look for "Jndi("). will likely be java:global//TestBean!Test or something like that
score: 0

http://stackoverflow.com/q/26637740
has comment: http://stackoverflow.com/comment/41884750
score: 0
has answer: http://stackoverflow.com/a/26637957
tagged with: android
has body: I was following this tutorial on how to get adMob on your app Here and In my xml layout file for my activity I am getting a rendering problem: A &lt;fragment&gt; tag allows a layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout. - &lt;fragment xetron.cosmicclicker.MyActivity$AdFragment ...&gt; (Pick Layout...) - &lt;fragment xetron.cosmicclicker.MyActivity$AdFragment ...&gt; (Pick Layout...) Do not warn about &lt;fragment&gt; tags in this session Xml layout file for activity below &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="8dp" android:orientation="vertical" android:paddingBottom="6dp" android:gravity="center|top" android:background="@drawable/background" tools:context=".MyActivity"&gt; &lt;fragment android:name="xetron.cosmicclicker.MyActivity$AdFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/adFragment" /&gt; &lt;fragment android:id="@+id/adFragment" android:name="xetron.cosmicclicker.MyActivity$AdFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /&gt; &lt;/LinearLayout&gt; What have I done wrong and how do i fix this?
accepted answer: http://stackoverflow.com/a/26637957
has title: Rendering problems in xml for admob
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41882935
has comment: http://stackoverflow.com/comment/41883097
type: Question
answer count: 1

http://stackoverflow.com/comment/41814604
has text: hi,i have already can show the blank pdf with the header and else, when i want to implement using print when expression, why it's not working in the detail part of my report?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26586504
type: AnswerComment

http://stackoverflow.com/q/26548138
has body: first post here, hope im doing right. In a project, we have a scenario where we have a single web application with multiple entities. Currently, the login is managed via default JDBC Spring Security provider, working fine. For a new requirement, we need that each entity can have their own login method (currently 2 methods would be available, the JDBC one, which is the current one, and the second method would be authentication via SAML, with each entity defining their own IdP, but this is another story) I need some guidelines on how this can be achieved, I have done some search and I have found providers for different URL's, etc... But not different login methods for the same app and url's depending on the user type or entity. Is a good approach to have a custom single entry point where we can check the entity user and then use the suitable authentication provider? Kind regards, Alex
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: spring-saml
has answer: http://stackoverflow.com/a/26553818
type: Question
downvote count: 0
tagged with: spring-security
has title: Spring Security: Different authentication methods depending on entity
accepted answer: http://stackoverflow.com/a/26553818
answer count: 1
favorite count: 0
tagged with: spring-mvc

http://stackoverflow.com/comment/41860925
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26625077
type: Comment
has text: As the resource resides in the same folder as your calling class, just using `JsonLoader.fromResource("jsonschema.json")` should work for you.

http://stackoverflow.com/a/26647222
score: 0
has comment: http://stackoverflow.com/comment/41900073
answers question: http://stackoverflow.com/q/26646661
type: Answer
has body: You can intercept with expression similar to below @Around("@annotation(someAnnotation) &amp;&amp; execution(* x.y.z.ClassB.*(..))") Apply this to method of ClassA to be intercepted - the magic you are looking forward to lies in the execution condition. Although I haven't tried this but hope it helps!

http://stackoverflow.com/q/26604505
tagged with: distance
accepted answer: http://stackoverflow.com/a/26604826
tagged with: point
answer count: 1
has comment: http://stackoverflow.com/comment/41821887
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/41822067
has comment: http://stackoverflow.com/comment/41822017
has title: making a double/int out of Point.getX() and .getY()
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41822181
has body: i'm trying to calculate the distance between 2 points with Java Point, it works fine till i say for example: double point1x = point1.getX();. cause when i do, i receive a error. can somebody help me find the problem in my code? public class ClickAndCalc extends JFrame implements MouseListener { public ClickAndCalc() throws IOException{ addMouseListener(this); } public static void Window() throws IOException { String path = "kaakfoto.jpg"; //imported image File file = new File(path); BufferedImage image = ImageIO.read(file); int width = image.getWidth(); int height = image.getHeight(); JLabel label = new JLabel(new ImageIcon(image)); //add the image to the JLabel System.out.println("height: " + height); //print out the height and width of the image System.out.println("width: " + width); ClickAndCalc frame = new ClickAndCalc(); //make a new frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(label); frame.setSize(width+3, height+26); //set the size of the frame the same as the size of the image frame.setLocationRelativeTo(null); frame.setVisible(true); } int i=0; Point p1, p2, p3; public void mouseClicked(MouseEvent e) {} public void mousePressed(MouseEvent e) { //when clicked add point for 3 times if(i==0) { p1 = e.getPoint(); System.out.println("coordinates Point1: X=" + p1.getX() + ". Y=" + p1.getY()); } else if(i==1) { p2 = e.getPoint(); System.out.println("coordinates Point2: X=" + p2.getX() + ". Y=" + p2.getY()); } else if(i==2) { p3 = e.getPoint(); System.out.println("coordinates Point3: X=" + p3.getX() + ". Y=" + p3.getY()); } i++; } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} //down here is some mistake i can't find double distanceAB(double x1, double y1, double x2, double y2) { return Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); } double x1 = p1.getX(), //convert getX and getY to doubles y1 = p1.getY(), x2 = p2.getX(), y2 = p2.getY(), distanc…
has answer: http://stackoverflow.com/a/26604826
tagged with: java
has comment: http://stackoverflow.com/comment/41822075

intellij-idea
tags question: http://stackoverflow.com/q/26652784
tags question: http://stackoverflow.com/q/26628981
tags question: http://stackoverflow.com/q/26656315
tags question: http://stackoverflow.com/q/26663785
tags question: http://stackoverflow.com/q/26643652
tags question: http://stackoverflow.com/q/26565860
tags question: http://stackoverflow.com/q/26526238
tags question: http://stackoverflow.com/q/26587291
tags question: http://stackoverflow.com/q/26532422
tags question: http://stackoverflow.com/q/26573072
tags question: http://stackoverflow.com/q/26579259
tags question: http://stackoverflow.com/q/26653543
tags question: http://stackoverflow.com/q/26562869
tags question: http://stackoverflow.com/q/26624103
tags question: http://stackoverflow.com/q/26548975
type: Tag
tags question: http://stackoverflow.com/q/26524010
tags question: http://stackoverflow.com/q/26543804
tags question: http://stackoverflow.com/q/26571902
tags question: http://stackoverflow.com/q/26656314
tag name: intellij-idea
tags question: http://stackoverflow.com/q/26571435
tags question: http://stackoverflow.com/q/26669732
tags question: http://stackoverflow.com/q/26516668
tags question: http://stackoverflow.com/q/26636013
tags question: http://stackoverflow.com/q/26618637
tags question: http://stackoverflow.com/q/26539713
tags question: http://stackoverflow.com/q/26667456
tags question: http://stackoverflow.com/q/26615988
tags question: http://stackoverflow.com/q/26570378
tags question: http://stackoverflow.com/q/26625051
tags question: http://stackoverflow.com/q/26540154
tags question: http://stackoverflow.com/q/26548028
tags question: http://stackoverflow.com/q/26627357
tags question: http://stackoverflow.com/q/26556659
tags question: http://stackoverflow.com/q/26534272
tags question: http://stackoverflow.com/q/26522050
tags question: http://stackoverflow.com/q/26645317
tags question: http://stackoverflow.com/q/26597789
tags question: http://stackoverflow.com/q/26566331
tags question: http://stackoverflow.com/q/26552465
tags question: http://stackoverflow.com/q/26541228

http://stackoverflow.com/comment/41795415
type: QuestionComment
has text: I'm sorry I dont really understand. I don't know english about coding well. Could you show me in code how this works?
comment on: http://stackoverflow.com/q/26590234
score: 0
type: Comment

http://stackoverflow.com/q/26620814
has comment: http://stackoverflow.com/comment/41853301
type: UnansweredQuestion
has body: As my first applet, I'm making a calculator (only adding at the moment), but I am stuck at figuring out how to get numbers from the listeners. So far I have: import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; public class calculator extends JApplet { private JTextField num1; private JTextField num2; private JButton calculate; private JLabel result; private double numOne,numTwo; private double sum = numOne + numTwo; public void init() { num1 = new JTextField("",9); num2 = new JTextField("",9); calculate = new JButton("Calculate"); result = new JLabel("The Answer is: " + sum); num1.addActionListener(new num1Listener()); num2.addActionListener(new num2Listener()); calculate.addActionListener(new doMath()); add(num1); add(num2); add(calculate); setLayout(new FlowLayout()); setSize(200,200); } public void paint(Graphics g) { super.paint(g); g.drawString("The answer is " + sum, 20, 20); } class num1Listener implements ActionListener { public void actionPerformed(ActionEvent e) { String num1input = num1.getText(); numOne = Double.parseDouble(num1input); } } class num2Listener implements ActionListener { public void actionPerformed(ActionEvent e) { String num2input = num2.getText(); numTwo = Double.parseDouble(num2input); } } class doMath implements ActionListener { public void actionPerformed(ActionEvent e) { add(result); } } } How can I get my numOne and numTwo doubles from inside these listeners and into my code? I would like to add them together and store them in the sum variable.
tagged with: java
tagged with: swing
type: Question
has title: Completing Applet Calculator
linked to: http://stackoverflow.com/q/7441625
score: 0
has answer: http://stackoverflow.com/a/26620852
answer count: 1
tagged with: applet

http://stackoverflow.com/a/26517822
type: Answer
has comment: http://stackoverflow.com/comment/41666163
accepted answer of: http://stackoverflow.com/q/26517472
answers question: http://stackoverflow.com/q/26517472
has body: I would suggest you use the Joda time library. In addition to the cool date helpers it provides, you should find here a snipplet with code that does almost what you need.
score: 0
has comment: http://stackoverflow.com/comment/41666196
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41665738

http://stackoverflow.com/comment/41816982
has text: Don't add a component to the `JViewport`, use something more like `scrollPane.setViewportView(tree)`, but since you've already set it via the constructor, there's no need to do that either
score: 0
comment on: http://stackoverflow.com/q/26601623
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26559257
tagged with: lwjgl
has body: I have recently started on developing my own game engines for fun. I implemented a method to load Blender .OBJ models from files, and I am successfully rendering them. However, when doing a stress-test I ran into an unusual predicament with my Delta-time based fps system. While running at 1500FPS, it takes me 4 seconds to look from one end of a wall of models to another. If I cap the FPS at 120FPS, however, it only takes my 0.84 seconds to look from one end of the wall to another. As I explored further it would seem that, in fact, the game-movement speed decreases as FPS increases. Here is my Timer class: class Timer { long lastFrame; int fps; long lastFPS; int delta; int fpsToReturn; public Timer() { lastFPS = getTime(); } public long getTime() { return (Sys.getTime() * 1000) / Sys.getTimerResolution(); } public int getDelta() { long time = getTime(); delta = (int) (time - lastFrame); lastFrame = time; return delta; } public void updateFPS() { if (getTime() - lastFPS &gt; 1000) { fpsToReturn = fps; fps = 0; lastFPS += 1000; } fps++; } public int getFPS() { return fpsToReturn; } } And of course movement is just something along the lines of: camera.rotX += (0.5 * timer.getDelta()); Does anyone have any ideas? Is this how delta-time is supposed to work? When running at 16FPS it returns around 65, at 120FPS Delta is returning around 8-9, while uncapped FPS it always returns 0 or 1 if that makes a difference or helps you spot if something is wrong with the uncapped FPS. I really appreciate any help, thank you guys.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26570330
tagged with: frame-rate
tagged with: java
type: Question
answer count: 1
tagged with: timedelta
score: 0
has answer: http://stackoverflow.com/a/26570330
has title: LWJGL Runs slower at higher FPS? (Delta)

http://stackoverflow.com/comment/41850303
score: 0
comment on: http://stackoverflow.com/q/26619560
type: Comment
type: QuestionComment
has text: When using anonymous implementations for listeners, you later cannot remove them when disposing the object, which will eventually (and you *will* have those situations) cause memory leaks.

selenium
tags question: http://stackoverflow.com/q/26628191
tags question: http://stackoverflow.com/q/26598552
tags question: http://stackoverflow.com/q/26580600
tags question: http://stackoverflow.com/q/26592554
tags question: http://stackoverflow.com/q/26604230
tags question: http://stackoverflow.com/q/26523231
tags question: http://stackoverflow.com/q/26583930
tags question: http://stackoverflow.com/q/26537841
tags question: http://stackoverflow.com/q/26577275
tags question: http://stackoverflow.com/q/26641067
tags question: http://stackoverflow.com/q/26651086
tags question: http://stackoverflow.com/q/26611367
tags question: http://stackoverflow.com/q/26516415
tags question: http://stackoverflow.com/q/26631490
tags question: http://stackoverflow.com/q/26626406
tags question: http://stackoverflow.com/q/26544961
tags question: http://stackoverflow.com/q/26609491
tag name: selenium
tags question: http://stackoverflow.com/q/26578432
tags question: http://stackoverflow.com/q/26632037
tags question: http://stackoverflow.com/q/26522739
tags question: http://stackoverflow.com/q/26539194
tags question: http://stackoverflow.com/q/26636508
tags question: http://stackoverflow.com/q/26659116
tags question: http://stackoverflow.com/q/26600003
tags question: http://stackoverflow.com/q/26634860
tags question: http://stackoverflow.com/q/26611725
tags question: http://stackoverflow.com/q/26538806
tags question: http://stackoverflow.com/q/26665422
tags question: http://stackoverflow.com/q/26662849
tags question: http://stackoverflow.com/q/26514305
type: Tag
tags question: http://stackoverflow.com/q/26623791
tags question: http://stackoverflow.com/q/26654803

http://stackoverflow.com/comment/41840893
type: AnswerComment
has text: Did you take a look here ? http://stackoverflow.com/questions/9892964/managing-assets-between-desktop-and-device-version-in-libgdx
comment on: http://stackoverflow.com/a/26612331
type: Comment
score: 0

http://stackoverflow.com/a/26574616
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26574496
type: Answer
answers question: http://stackoverflow.com/q/26574496
upvote count: 3
has comment: http://stackoverflow.com/comment/41767525
has comment: http://stackoverflow.com/comment/41767265
has comment: http://stackoverflow.com/comment/41767140
has comment: http://stackoverflow.com/comment/41767543
has body: You can't use .add that way on a JScrollPane. A JScrollPane can only scroll a single component, which is set by either passing it to its constructor, or by calling .setViewportView. Instead, create a separate container for the bubbles, such as a vertical Box, and set that as the single component scrolled by the scroll pane: Box box = new Box(BoxLayout.Y_AXIS); JScrollPane jScrollPane1 = new JScrollPane(box); When you add a bubble, add it to the box (and call .revalidate() to lay it out): box.add(leftArrowBubble); box.revalidate(); Edit: Also, your bubbles will not, by default, have any size, unless you give them a size such as by calling setPreferredSize or by overriding getPreferredSize or by putting components inside them.
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/26594046
has comment: http://stackoverflow.com/comment/41802920
has comment: http://stackoverflow.com/comment/41802937
has comment: http://stackoverflow.com/comment/41803188
downvote count: 0
linked to: http://stackoverflow.com/q/26198989
favorite count: 0
tagged with: jdialog
has answer: http://stackoverflow.com/a/26595399
has comment: http://stackoverflow.com/comment/41804165
has title: Using a JDialog as input
has body: I am trying to use a JDialog as input for a String. But the text I get is from before I click the Button. this is my dialog: public class AddMemberDialog extends JDialog { private JTextField name; public AddMemberDialog() { super(new JFrame("Add Member"), "Add Member"); this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); this.setMinimumSize(new Dimension(500, 500)); this.name = new JTextField(); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { close(); } }); this.setLayout(new GridLayout(2, 1, 5, 5)); this.add(name); this.add(add); this.pack(); } private void close(){ this.dispose(); } public String getName(){ return this.name.getText(); } } and here is what I am using to get to String: AddMemberDialog input = new AddMemberDialog(); input.setLocationRelativeTo(this); input.setVisible(true); String txt = input.getName();
has comment: http://stackoverflow.com/comment/41804143
score: 2
has comment: http://stackoverflow.com/comment/41803099
upvote count: 2
possible better answer: http://stackoverflow.com/a/26594711
has answer: http://stackoverflow.com/a/26594711
tagged with: swing
accepted answer: http://stackoverflow.com/a/26595399
has comment: http://stackoverflow.com/comment/41802962
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41803196
answer count: 2

http://stackoverflow.com/comment/41919538
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26658558
has text: That's a lot of code for us to sift through. Where do you think the problem is? We don't want to waste time trying to understand code unrelated to the problem.
type: Comment

http://stackoverflow.com/a/26627473
type: Answer
answers question: http://stackoverflow.com/q/26624561
score: 0
has body: The main problem is that the Date class methods are deprecated (and misleading). The getYear() javadoc writes: the year represented by this date, minus 1900. Furthermore you have to replace &amp;&amp; with || in the while statement expression. My suggestion: public static List&lt;Date&gt; getDatesBetween(final Date date1, final Date date2) { List&lt;Date&gt; dates = new ArrayList&lt;Date&gt;(); Calendar cal1 = new GregorianCalendar(); cal1.setTime(date1); Calendar cal2 = new GregorianCalendar(); cal2.setTime(date2); while (cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR) || cal1.get(Calendar.MONTH) != cal2.get(Calendar.MONTH) || cal1.get(Calendar.DATE) != cal2.get(Calendar.DATE)) { cal1.add(Calendar.DATE, 1); dates.add(cal1.getTime()); } return dates; }

http://stackoverflow.com/q/26569441
linked to: http://stackoverflow.com/q/2699209
type: Question
has body: Will this release my resources after being used? InputStream inputStream; try (InputStream unverifiedStream = connection.getInputStream()){ inputStream = unverifiedStream; } catch (Exception e) { e.printStackTrace(); } //and use stream here to do other stuff with other streams
has answer: http://stackoverflow.com/a/26569450
answer count: 3
upvote count: 1
has title: Will this release my resources after being used?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26569472
has answer: http://stackoverflow.com/a/26569460
tagged with: memory-leaks
accepted answer: http://stackoverflow.com/a/26569460
has comment: http://stackoverflow.com/comment/41757837
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26569450
score: 1
tagged with: java

http://stackoverflow.com/q/26585011
has comment: http://stackoverflow.com/comment/41785795
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41785665
accepted answer: http://stackoverflow.com/a/26585852
has comment: http://stackoverflow.com/comment/41785686
tagged with: android
has comment: http://stackoverflow.com/comment/41786029
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41786040
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41785632
upvote count: 1
has body: I'm currently working on an app that uses the Google Maps API v2. But the MapView only displays a grey background, the Google logo and the zoom-buttons. Here are the error messages: 10-27 10:50:25.309: D/REQUEST(18335): Connection opened to:https://clients4.google.com/glm/mmap/api 10-27 10:50:25.309: D/REQUEST(18335): Open Connection 10-27 10:50:26.239: D/REQUEST(18335): DRD(24): 62|147 10-27 10:50:26.239: D/REQUEST(18335): Close 10-27 10:50:26.239: D/REQUEST(18335): Error processing: com.google.maps.api.android.lib6.b.d@409cf570 not retrying 10-27 10:50:26.239: D/REQUEST(18335): Retrying: com.google.maps.api.android.lib6.c.au@409b25b8 And another: 10-27 10:49:49.309: E/REQUEST(18335): In Error Mode 10-27 10:49:49.319: E/Google Maps Android API(18335): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). My Manifest does contain my API key and various permissions: <?xml version="1.0" encoding="utf-8"?> <permission android:name="de.hobbit.xmltest.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="de.hobbit.xmltest.permission.MAPS_RECEIVE" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="SOMEKEY" /> <action android…
type: Question
tagged with: google-maps
has answer: http://stackoverflow.com/a/26585852
linked to: http://stackoverflow.com/q/17491400
has title: Google Map is only showing a grey background and not the map

http://stackoverflow.com/comment/41758602
type: Comment
has text: See my answer Falcon.
comment on: http://stackoverflow.com/a/26569889
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41841606
score: 0
type: AnswerComment
has text: Go read documentation. It's the best way to learn! http://developer.android.com/reference/android/view/LayoutInflater.html
type: Comment
comment on: http://stackoverflow.com/a/26614680

http://stackoverflow.com/comment/41718104
type: QuestionComment
comment on: http://stackoverflow.com/q/26547467
score: 0
has text: +1 for the question. the first part is technically (not conceptually) and your bottom question is conceptually. Maybe throw an example from different programing language what exactly do you mean.
type: Comment

http://stackoverflow.com/q/26624395
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26633352
tagged with: session
has body: I've an gae application (java, gae 1.9.14, guice 3.0) that makes use of the module pattern. Each module serves a single page application (html &amp; js). One module authenticates the user (email/pwd) and then redirects to another module. The problem that I'm facing is that each time I initially access a different module a new session gets created. Is there actually a way to share session data across modules? If not, how would I implement such a simple use case? Thanks in advance!
answer count: 2
tagged with: guice
has title: google app engine cross module session (java, guice)
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26633352
tagged with: google-app-engine
possible better answer: http://stackoverflow.com/a/26625258
has answer: http://stackoverflow.com/a/26625258

http://stackoverflow.com/comment/41934971
score: 0
has text: It looks like you're having basic connection problems. I'd try the connection first using mysql in the command line, or a tool like MySQL Workbench.
comment on: http://stackoverflow.com/q/26666622
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41817513
type: Comment
comment on: http://stackoverflow.com/q/26601764
score: 0
has text: This might help you to understand update in hibernate http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch11.html
type: QuestionComment

http://stackoverflow.com/comment/41708222
comment on: http://stackoverflow.com/q/26541919
type: Comment
type: QuestionComment
score: 2
has text: Are you only trying to get 5 random numbers? If that is the case, you could set a random bit in a long like this: set the 1st-9th bit, set the 10th-19th bit etc. Long has 64 bits so you could get 6 random numbers from 0-9

http://stackoverflow.com/comment/41725111
score: 0
type: Comment
type: QuestionComment
has text: Is it a `Byte[]` or a `byte[]`?
comment on: http://stackoverflow.com/q/26550781

http://stackoverflow.com/a/26594360
answers question: http://stackoverflow.com/q/26594271
has comment: http://stackoverflow.com/comment/41808670
upvote count: 1
has body: public enum OrderType { One(mActivity.getString(R.string.One)), Two(mActivity.getString(R.string.Two)); private String name; private OrderType(String name) { this.name = name; } public String toString() { return name; } public static String getEnumByString(String code) { for (OrderType e : OrderType.values()) { if (code.equals(e.name)) { return e.name(); } } return null; } } also Here is the link, which I think is best way solve the porblem. This developing for API level 11 currently, however this code should run on higher versions. After a quick review in API 16 I did not see an existing core Android solution to this problem, if you know of one please post below and share.
score: -1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26594271
downvote count: 2
type: Answer

http://stackoverflow.com/a/26614306
has comment: http://stackoverflow.com/comment/41841099
has comment: http://stackoverflow.com/comment/41842111
downvote count: 0
score: 3
has body: I do not know the logic behind your thread in detail but I would make some suggestions on the design of your code. It is not clear why inside a class derived from thread you have another thread t. There is no need to derive from Thread (and I believe it is generally a bad practice). It is common to rather implement Runnable interface and then construct a new thread using it. . class UDPReader implements Runnable { ... } and then instantiate a thread like this: Thread t = new Thread(new UDPReader()); As a rule, if a thread fails, it terminates... It does not look good that a failed thread "recreates" itself. The better solution would be to provide a Thread.UncaughtExceptionHandler and in the code that creates your thread analyze failing conditions and restart you thread if needed. In general, not to mess up, in concurrent programming you have to clearly distinguish the logic of a thread and external logic that manages this thread (its start/interruption/termination). I think, this is what you did not do in your code.
has comment: http://stackoverflow.com/comment/41841596
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41843329
answers question: http://stackoverflow.com/q/26613872
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26613872
type: Answer

http://stackoverflow.com/a/26539952
has body: Can you confirm the Availability Zone from the AWS Console? By default, beanstalker uses us-east-1, but for new AWS Accounts, the default tends to be us-west-1 instead
score: 0
answers question: http://stackoverflow.com/q/26538703
type: Answer
has comment: http://stackoverflow.com/comment/41708240
has comment: http://stackoverflow.com/comment/41713821

http://stackoverflow.com/comment/41764939
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26569619
type: AnswerComment
has text: I've fixed it now. You were right about the problem being the creation of another object on EVERY selection change, but it wasn't the highlighter object that was the problem, it was the TableCellRenderer object.

http://stackoverflow.com/comment/41835437
comment on: http://stackoverflow.com/q/26611238
type: QuestionComment
has text: SAX provides you with data from an XML file on the fly and expects you to do something with it. It just parses a file and issues a callback for any interesting syntax objects it finds, such as start tags, end tags or character data. Since you don't seem to care about structure, this should be perfect for your use case. So your DOM recursion is already implemented in a SAX parser, you just need to react when you find something of interest.
score: 3
type: Comment

http://stackoverflow.com/q/26662868
answer count: 2
has body: In my application I have few types of holder objects, which primary purpose is to store heterogeneous related data. Their lifecycles can be divided into two parts: Collecting data as soon as it becomes available; Providing read-only access to stored data for the rest of a holder's life. It is very tempting to make the holders immutable, but the data is not available at one time to be passed to a constructor. The simplest workaround I see is to make two versions of a holder class, one being mutable, and another being not: public class MutableHolder { public int field1; public String field2; // ... public Object fieldN; } public class Holder { public final int field1; public final String field2; // ... public final Object fieldN; public Holder(MutableHolder mutableHolder) { this.field1 = mutableHolder.field1; this.field2 = mutableHolder.field2; // ... this.fieldN = mutableHolder.fieldN; } } However, I feel that this approach is violating the DRY principle (I must not forget to update both classes' fields as well as the constructor if I want to change anything) and is error prone. So here is my question: are there any existing patterns that I'm not aware of for implementing both mutable and immutable versions of a holder object? Edit I've suddenly found out that the code above is a very barebone version of the Builder pattern (see this or this). This makes me think that in this case DRY violation is considered acceptable.
possible better answer: http://stackoverflow.com/a/26670219
downvote count: 0
has answer: http://stackoverflow.com/a/26670219
has comment: http://stackoverflow.com/comment/41928548
favorite count: 0
has comment: http://stackoverflow.com/comment/41928377
accepted answer: http://stackoverflow.com/a/33057212
has comment: http://stackoverflow.com/comment/41928197
has title: Are there any patterns for implementing mutable and immutable versions of a holder object?
tagged with: immutability
upvote count: 3
tagged with: design-patterns
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41928504
has answer: http://stackoverflow.com/a/33057212
type: Question

http://stackoverflow.com/comment/41834940
type: Comment
score: 1
has text: What is the size of your file? Is it be very big, perhaps?
type: QuestionComment
comment on: http://stackoverflow.com/q/26611424

http://stackoverflow.com/q/26614816
has body: I have built a project (Project A) in Eclipse with my own classes, and I have a different project which is just a checked out folder from SVN (Project B). I want to link Project A to subfolders in Project B. I went to link source from the configure build path in Project A and was able to get all the subfolders from Project B of interest into linked folders in Project A. When I opened these new linked folders, I got an error message on the package address/name (I guess that was the original SVN package address/name, so I deleted the package statement and the errors went away. So now I have no package statement at the top of my linked folders. But when I try to reference classes in the linked folders from the classes I wrote in Project A, it cannot find/import any of the classes from the linked folders. Could anyone explain to me why Eclipse is unable to connect to my linked classes from SVN? Thanks, Christie
has answer: http://stackoverflow.com/a/26615686
type: UnansweredQuestion
has title: Linking source code from SVN project to another project in Eclipse
tagged with: svn
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41845022
answer count: 1
has comment: http://stackoverflow.com/comment/41841336
score: 0

http://stackoverflow.com/comment/41658003
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26514101
has text: Would yield the same result since `Object` cannot be automatically converted to `Integer` either.

http://stackoverflow.com/comment/68224704
type: AnswerComment
type: Comment
has text: Every time I open the Hive prompt to query this table, I must run step 6 again (ADD JAR /usr/local/Hive-JSON-Serde/....). Is there a config I can change to automatically load it every time?
comment on: http://stackoverflow.com/a/33111166
score: 0

http://stackoverflow.com/comment/41881377
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26633068
has text: Note that the popup handler no longer exists in gwt 2.7+, check out the console handlers, etc.

http://stackoverflow.com/comment/41928931
has text: 'Not getting initialized' is not a problem description. What exactly is your objection to putting things into property files or web.xml like everybody else?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26659390

collections
tags question: http://stackoverflow.com/q/26576477
tags question: http://stackoverflow.com/q/26654487
tags question: http://stackoverflow.com/q/26516099
tags question: http://stackoverflow.com/q/26641477
tags question: http://stackoverflow.com/q/26592309
tags question: http://stackoverflow.com/q/26649111
tags question: http://stackoverflow.com/q/26578979
tags question: http://stackoverflow.com/q/26586573
tags question: http://stackoverflow.com/q/26668814
tags question: http://stackoverflow.com/q/26551068
tags question: http://stackoverflow.com/q/26617821
tags question: http://stackoverflow.com/q/26645343
tags question: http://stackoverflow.com/q/26589279
tags question: http://stackoverflow.com/q/26521181
tags question: http://stackoverflow.com/q/26667590
type: Tag
tags question: http://stackoverflow.com/q/26660609
tags question: http://stackoverflow.com/q/26522005
tags question: http://stackoverflow.com/q/26548123
tags question: http://stackoverflow.com/q/26620132
tags question: http://stackoverflow.com/q/26514780
tags question: http://stackoverflow.com/q/26668736
tags question: http://stackoverflow.com/q/26627934
tag name: collections
tags question: http://stackoverflow.com/q/26540772
tags question: http://stackoverflow.com/q/26624973

http://stackoverflow.com/comment/41856170
comment on: http://stackoverflow.com/a/26622991
type: AnswerComment
type: Comment
score: 1
has text: are you sure `missing left parenthesis` ?

http://stackoverflow.com/q/26589524
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/15667125
favorite count: 0
possible better answer: http://stackoverflow.com/a/26590086
has body: I'm trying to use a file selector (which is only allowed to select zips) to give me that File and then I will perform another method on every separate File in the zip. However, I'm struggling with the compiler as it is expected generic Files rather than zipFiles. I'm trying to use this example : the marked answer on this post File zipFile = zfc.getSelectedFile(); ZipInputStream zis; try { zis = new ZipInputStream(new FileInputStream(zipFile)); ZipEntry ze; ze = zis.getNextEntry(); while (ze != null) { InputStream stream = ((ZipFile) zipFile) .getInputStream(ze); //method here that will operate on stream ze = zis.getNextEntry(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Basically how can I read a File from a zip in java or how do I change a zipEntry to a File.
has answer: http://stackoverflow.com/a/26590086
accepted answer: http://stackoverflow.com/a/26589898
tagged with: http://stackoverflow.com/tag/zip
upvote count: 1
type: AnsweredQuestion
has title: Java Converting File to ZipFile
has comment: http://stackoverflow.com/comment/41794707
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26589898

http://stackoverflow.com/q/26663783
tagged with: java
tagged with: grid
type: Question
has answer: http://stackoverflow.com/a/26664024
has comment: http://stackoverflow.com/comment/41929829
score: 0
tagged with: visualization
has title: Simple JAVA package (possibly code) for a grid visualization
answer count: 1
has body: I am going to start a project on Markov Decision Processes and am starting up a basic framework to work in. The first thing I want to set up is a grid of n by n, with cells which are empty or occupied by some class of agents (lets say a monkey, banana and palm tree). I want to be able to visualize this with JAVA. But am actually hoping that I will not have to write the code from scratch, i.e. the visualization part. So, a grid of n by n, with (possible) some word, picture or number in each cell. Any ideas on existing packages?
type: UnansweredQuestion

http://stackoverflow.com/a/26575715
has comment: http://stackoverflow.com/comment/41769065
has comment: http://stackoverflow.com/comment/41769189
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41769117
has comment: http://stackoverflow.com/comment/41769073
has comment: http://stackoverflow.com/comment/41769333
has comment: http://stackoverflow.com/comment/41769126
has body: You forgot to load driver Class.forName("com.mysql.jdbc.Driver"); Before getting connection. Also you are missing port from your url. Also you should be using getConnection(String url, String user, String password) API for better readability rather than providing user/pass in url.
has comment: http://stackoverflow.com/comment/41769093
answers question: http://stackoverflow.com/q/26575669

http://stackoverflow.com/a/26576577
downvote count: 0
has body: Previously, the default value for format was xmlfm, now it's jsonfm. So, to get the old format, add &amp;format=xmlfm to your query. But both formats are meant for humans. If you want to actually use the API from your code, you should use one of the normal formats, like xml or json.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26560370
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26560370
type: Answer
score: 2

http://stackoverflow.com/comment/41723089
score: 0
type: Comment
has text: @kklys is right, there is no need to override the findViewById method. It causes the problem. Remove it and it will work.
type: AnswerComment
comment on: http://stackoverflow.com/a/26549767

http://stackoverflow.com/comment/41860277
comment on: http://stackoverflow.com/a/26624632
has text: ok keep it now. and forget about ui for now. you will first digest these concept then moves further.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41774283
has text: Shouldn't really affect it, it looks like the buttons weren't getting bound. Does the activity definitely implement View.OnClickListener ?
type: Comment
comment on: http://stackoverflow.com/a/26550456
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41709695
type: QuestionComment
comment on: http://stackoverflow.com/q/26542752
has text: the last two numbers are both unique identifers and some lines mix them up
score: 0
type: Comment

http://stackoverflow.com/comment/41739971
has text: `Take` will block indefinitely until it receives an InterruptedException.`take` doesn't have a timeout.
comment on: http://stackoverflow.com/a/26559603
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26628098
tagged with: java
accepted answer: http://stackoverflow.com/a/26628232
has title: changing the value of variable in thread while its running
type: Question
score: 0
answer count: 1
tagged with: android
tagged with: service
has comment: http://stackoverflow.com/comment/41865972
tagged with: tcp
tagged with: multithreading
type: AnsweredQuestion
has body: I am building an android app in which service is running and it has a thread which listens for tcp connections and receive the message and respond back.Actually what I want to do is to give the user the choice to respond with yes or no ,when the thread will accept the connection, My service class is this: public class Receiver extends Service { static String TCP_RECEIVE = "soft.b.peopleassist"; public static String ip; DatagramSocket socket; private WifiManager.WifiLock wifiLock=null; private PowerManager.WakeLock wakeLock=null; volatile public static String outgoingMsg="null"; @SuppressLint("DefaultLocale") public String getIpAddr() { WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); int ip = wifiInfo.getIpAddress(); String ipString = String.format( "%d.%d.%d.%d", (ip &amp; 0xff), (ip &gt;&gt; 8 &amp; 0xff), (ip &gt;&gt; 16 &amp; 0xff), (ip &gt;&gt; 24 &amp; 0xff)); return ipString; } private void listenAndWaitAndThrowIntent(Integer port) throws Exception { ServerSocket ss = null; try { ss = new ServerSocket(port); //ss.setSoTimeout(10000); //accept connections Socket s = ss.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream())); //receive a message String incomingMsg = in.readLine() + System.getProperty("line.separator"); JSONObject jsonObj = new JSONObject(); try { jsonObj = new JSONObject(incomingMsg); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { String trans=(String) jsonObj.get("TranId"); String ide=(String) jsonObj.get("Amount"); String hashs=(String) jsonObj.get("Basket"); incomingMsg=trans+","+ide+","+hashs; } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.i("TcpServer", "received: " + incomingMsg); //send a message // String outgoingMsg = "goodbye from port " + port +…
has answer: http://stackoverflow.com/a/26628232

bresenham
tags question: http://stackoverflow.com/q/26569526
type: Tag
tag name: bresenham

http://stackoverflow.com/comment/41674334
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26522873
type: QuestionComment
has text: Because `sleep` is a static method of `Thread`...

http://stackoverflow.com/comment/41860184
has text: Thanks for your reply. I had read the link you have told me, but I wanted to be sure that there was not a solution.
comment on: http://stackoverflow.com/q/26604012
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41900364
type: Comment
score: 1
has text: The size of an array can't exceed `Integer.MAX_VALUE`, since the language specifies the size of an array as `int` type. The actual limit can be lower, though.
comment on: http://stackoverflow.com/a/26646889
type: AnswerComment

http://stackoverflow.com/a/26653895
answers question: http://stackoverflow.com/q/26653433
score: 0
type: Answer
has body: First port of call would be the Collection.removeAll method. This uses no extra heap space, and its time complexity is dependent on the performance of the contains method on your second collection. If your second collection is a TreeSet then a.removeAll(b) takes O(n . log(m)) time (where n is the size of a and m is the size of b), if b is a HashSet then it takes O(n) time, if b is a sorted ArrayList then it's O(nm), but you can create a new wrapper Collection that uses a binary search to reduce it to O(n . log(m)) for negligible constant memory cost: private static class SortedList&lt;T extends Comparable&lt;? super T&gt;&gt; extends com.google.common.collect.ForwardingList&lt;T&gt; { private List delegate; public SortedList(ArrayList&lt;T&gt; delegate) { this.delegate = delegate; } @Override protected List&lt;T&gt; delegate() { return delegate; } @Override public boolean contains(Object object) { return Collections.binarySearch(delegate, (T) object) &gt;= 0; } } static &lt;E extends Comparable&lt;? super E&gt;&gt; void removeAll(Collection&lt;E&gt; a, ArrayList&lt;E&gt; b) { //assumes that b is sorted a.removeAll(new SortedList&lt;E&gt;(b)); }

http://stackoverflow.com/comment/41708280
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26541733
type: Comment
has text: I mean select to_char(col_timestamp_with_time_zone, 'format') ... Which format do you need?

http://stackoverflow.com/q/26514544
has answer: http://stackoverflow.com/a/26514579
has answer: http://stackoverflow.com/a/26514572
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/41658991
has answer: http://stackoverflow.com/a/26514622
type: Question
has body: I am a beginner in Java and I need to print the DFS of a graph using it's arraylists to store the adjacency list. When I try to compile I am getting the following errors: Type mismatch: cannot convert from Object to Integer The type of the expression must be an array type but it resolved to Stack The type of the expression must be an array type but it resolved to Stack The code is the following: package principal; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String []arg) { ArrayList&lt;List&lt;Integer&gt;&gt;L=new ArrayList&lt;List&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt;l=new ArrayList&lt;Integer&gt;(); int nod; Scanner sc = null; try { sc=new Scanner(new File("Graph.txt")); while (sc.hasNextInt()) { do { nod=sc.nextInt(); if(nod!=0) l.add(nod); }while(nod!=0); L.add((List&lt;Integer&gt;) l.clone()); l.clear(); } Stack stack = new Stack(); Stack viz = new Stack(); System.out.println("Root: "); Integer root = sc.nextInt(); stack.push(root); while (!stack.isEmpty()) { Integer node = stack.pop(); System.out.print(node + " "); viz[node]=1; for (Integer child : L.get(node)) { if(viz[child]!=1) { stack.push(child); } } } } catch (FileNotFoundException e) { e.printStackTrace(); } finally{sc.close();} } } The Graph.txt contains the following 2 3 4 1 3 4 1 2 4 1 2 3
tagged with: arraylist
has title: [Error]The type of the expression must be an array type but it resolved to Stack
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: depth-first-search

http://stackoverflow.com/comment/41683040
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26525906
has text: Thanks a lot @greg-449. It's so strange, the character still persists in the String. I've updated my question to indicate how the text is being manipulated.

http://stackoverflow.com/q/26633379
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41874719
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/26633568
tagged with: java
upvote count: 1
has title: Unreachable Return-Statement?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41874800
has comment: http://stackoverflow.com/comment/41874647
has answer: http://stackoverflow.com/a/26633531
has answer: http://stackoverflow.com/a/26633515
has comment: http://stackoverflow.com/comment/41874501
has body: Just got a question concerning a return statement in Java and the use of a method which should return a value from deep within a xml-statement. public static String searchNode(Node node, Node parent, String nodeResult) { String nodeValue = ""; if (node.hasChildNodes()) { NodeList childrens = node.getChildNodes(); for (int i = 0; i < childrens.getLength(); i++) { searchNode(childrens.item(i), node, nodeResult); } } else { nodeValue = node.getNodeValue().trim(); if (nodeValue.length() > 0) { if (parent.getNodeName().equals(nodeResult)) { System.out.println("YESSA: " + nodeValue); return "2: " + nodeValue; } } } return nodeValue; } And here's my question: Why is the return "2"-Statement never reached? Or let me rather ask: why is nodeValue at the end still empty? I tested it already and the code prints this "System.out.println"-thing, but never reaches the return there?! What do I have to change if I wanted the nodeValue filled in the value from the "else"-statement? EDIT: Ok, I tried out what you proposed but unfortunately I never get the result I wanted to have. Further description: I have a xml-structure which looks like this: <?xml version="1.0" encoding="UTF-8" ?> 2014-03-28T15:28:36.646Z person e1b8948f-321e-78ca-d883-80500aae71b5 anonymized update concept a1ad6ace-c722-ffa9-f58e-b4169acdb4e3 time conceptMap 4b8f69e3-2914-3a1a-454e-f4c157734bd1 my first concept map application http://www.golabz.eu/content/go-lab-concept-mapper c9933ad6-dd4a-6f71-ce84-fb1676ea3aac ut.tools.conceptmapper ils http://graasp.epfl.ch/metawidget/1/b387b6f 10548c30-72bd-0bb3-33d1-9c748266de45 unnamed ils I do the method call as I show you in the following: searchNode(document.getFirstChild(), null, "id") Then, I want to save the id-value of the subnode from in a variable (after that the method should terminate with something like a break;, because I don't want to get all ID's. Just this single ID.

http://stackoverflow.com/a/26589453
has comment: http://stackoverflow.com/comment/41794621
has comment: http://stackoverflow.com/comment/41830983
has comment: http://stackoverflow.com/comment/41818758
has body: Your question is confused enough. Firstly try to explain in a better way how to are doing? If you are trying to add maven nature at your project (like I think) there are something to review. I'm not able to understand when you say: And all classes of it, which were under web-inf\classes, i have copied to ..\src\main\java Usually in web-inf/classes there are the .class files, while in src/main/java there must be the source files. And this is an strange thing Finally fon dependencies copy you have to just configure maven correctly and add all jar like project's dependencies. Then when you try to install you application maven will download the jars file in your folder
has comment: http://stackoverflow.com/comment/41793993
answers question: http://stackoverflow.com/q/26588785
has comment: http://stackoverflow.com/comment/41818794
score: 0
type: Answer

http://stackoverflow.com/a/65661164
type: Answer
has body: I was following along a youtube tutorial and the guy was using a "Banner" at first and switched to "SMART_BANNER". So I thought I could also use the smart banner. Unfortunately this was the mistake, I changed the adsize and it worked. You also might have a different adSize. <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" app:adSize="BANNER" app:adUnitId="ca-app-pub-3940256099942544/6300978111"></com.google.android.gms.ads.AdView> Code used in the Activity: MobileAds.initialize(this) {} var mAdView = findViewById<AdView>(R.id.adView) val adRequest = AdRequest.Builder().build() mAdView.loadAd(adRequest)
answers question: http://stackoverflow.com/q/26610383
score: 0

http://stackoverflow.com/a/26552571
answers question: http://stackoverflow.com/q/26550367
has body: No, it ain't gonna work. Look at the Jsoup description: jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods. jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do. What you are asking for is how to parse CSV file in Java. This question might be helpful for you: Fast CSV parsing
accepted answer of: http://stackoverflow.com/q/26550367
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41708661
type: QuestionComment
has text: @mushroom look at the source code for `LinkedBlockingDequeue`
score: 0
comment on: http://stackoverflow.com/q/26542210
type: Comment

http://stackoverflow.com/a/31053171
has body: If you are using appcompat-v7:22.1.0+ you can use the DrawableCompat to tint your widgets public static void tintWidget(View view, int color) { Drawable wrappedDrawable = DrawableCompat.wrap(view.getBackground()); DrawableCompat.setTint(wrappedDrawable.mutate(), getResources().getColor(color)); view.setBackgroundDrawable(wrappedDrawable); }
answers question: http://stackoverflow.com/q/26574328
downvote count: 0
has comment: http://stackoverflow.com/comment/59078182
upvote count: 29
has comment: http://stackoverflow.com/comment/52066588
type: Answer
score: 29

http://stackoverflow.com/comment/41899006
has text: as mentioned, both client and server are on the same machine. It is one-to-one only. As the content keeps changing within msec, it is necessary to have such refresh duration. Previously I compared the performance between setInterval and setTimeout. setInterval can achieve my requirement. Could I make SuSE remove failed connections?
comment on: http://stackoverflow.com/a/26645007
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41782392
comment on: http://stackoverflow.com/a/26583069
score: 0
type: Comment
has text: @Eran First off, I frankly don't see how the API complies with the Java compiler because a `String` object is also of type `Object` so it seems to me there should be a conflict there, but ultimately it doesn't really matter because the `PrintStream.print(Object o)` method just calls the `toString()` method anyway (or prints `null`). The logic is still no different than when concatenating strings (as I showed in my initial comment).
type: AnswerComment

http://stackoverflow.com/q/26661973
upvote count: 1
has answer: http://stackoverflow.com/a/26662848
type: AnsweredQuestion
has body: My code works fine however I don't know if my code is in procedure Method. I know that you are supposed to have two methods, but I am not sure if I did the method right, though. So, can you please help me? public static void main(String args[]){ vowels(); } public static void vowels(){ Scanner sc = new Scanner(System.in); int countVowel=0; int countVowelA=0; int countVowelE=0; int countVowelI=0; int countVowelO=0; int countVowelU=0; char ch; String str; System.out.println("Please enter the string : "); str = sc.nextLine(); System.out.println(); for(int i = 0; i&lt;str.length(); i ++){ ch = str.charAt(i); if(ch == 'a' || ch =='A'){ countVowelA++; countVowel++; } if(ch == 'e' || ch =='E'){ countVowelE++; countVowel++; } if(ch == 'i' || ch =='I'){ countVowelI++; countVowel++; } if(ch == 'o' || ch =='O'){ countVowelO++; countVowel++; } if(ch == 'u' || ch =='U'){ countVowelU++; countVowel++; } } System.out.println("Occurances of A in given string : " +countVowelA); System.out.println("Occurances of E in given string : " +countVowelE); System.out.println("Occurances of I in given string : " +countVowelI); System.out.println("Occurances of O in given string : " +countVowelO); System.out.println("Occurances of U in given string : " +countVowelU); System.out.println("Number of vowels in strings are : " +countVowel); }
score: 1
possible better answer: http://stackoverflow.com/a/26662848
tagged with: java
has comment: http://stackoverflow.com/comment/41926001
type: Question
has answer: http://stackoverflow.com/a/26662207
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/26491931
accepted answer: http://stackoverflow.com/a/26662207
favorite count: 0
has comment: http://stackoverflow.com/comment/41925968
has title: Procedure Method, counting vowels

http://stackoverflow.com/comment/42326144
has text: Dear Mark, Thing is that I PLC software which runs only on WIN so it is impossible to exchange operation system on Linux ( despite of fact that I have medium experience in administarting this kind of platform). So in this case, changing whole construction of application can not be applied. All the best.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26672555

http://stackoverflow.com/q/26524209
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41676495
tagged with: java
has title: DefaultTreeCellRenderer() execute periodically
has answer: http://stackoverflow.com/a/26532310
type: Question
has comment: http://stackoverflow.com/comment/41676497
tagged with: jtree
tagged with: swingworker
has body: I write some program for monitoring processes on unix server. The main part of my code is looking like this: Class FeedMonitor { //............. private volatile boolean monitor = true; private volatile String feedShRez; private volatile DefaultMutableTreeNode envNode; //............. public void prepareGUI() { //.............. // SwingWorker worker = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { sh = new Shell(env); System.out.println("Swing worker for check feed statuses started..."); while (monitor) { // get running feeds feedShRez = sh.getFeedsStatus(rez); System.out.println(feedShRez); Thread.sleep(15000); System.out.println("Swing worker for check feed statuses is waking up..."); } return null; } @Override protected void done() { System.out.println("Swing worker completed."); super.done(); System.out.println("Set monitor object to false"); feedShRez = ""; } }; worker.execute(); //...... // This action I would like to execute in thread periodically envTree.setCellRenderer(new DefaultTreeCellRenderer() { public Component getTreeCellRendererComponent(JTree pTree, Object pValue, boolean pIsSelected, boolean pIsExpanded, boolean pIsLeaf, int pRow, boolean pHasFocus) { System.out.println("Node is " + pValue.toString()); super.getTreeCellRendererComponent( pTree, pValue, pIsSelected, pIsExpanded, pIsLeaf, pRow, hasFocus); // we are under environment tree if ( envNode !=null &amp;&amp; ((DefaultMutableTreeNode)pValue).getParent() == envNode &amp;&amp; feedShRez != null &amp;&amp; !feedShRez.isEmpty()){ if (feedShRez.contains(pValue.toString())) { System.out.println("Found feed " + pValue.toString() + " in strings"); setForeground(Color.GREEN); } else { setForeground(Color.RED); } } return (this); } }); // In this thread I would like to execute action above // but it works only one or two times SwingWorker worker2 = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { whi…

recursion
type: Tag
tags question: http://stackoverflow.com/q/26641098
tags question: http://stackoverflow.com/q/26638213
tags question: http://stackoverflow.com/q/26541775
tag name: recursion
tags question: http://stackoverflow.com/q/26549708
tags question: http://stackoverflow.com/q/26665782
tags question: http://stackoverflow.com/q/26600163
tags question: http://stackoverflow.com/q/26624942
tags question: http://stackoverflow.com/q/26622162
tags question: http://stackoverflow.com/q/26553921
tags question: http://stackoverflow.com/q/26613864
tags question: http://stackoverflow.com/q/26542741
tags question: http://stackoverflow.com/q/26532871
tags question: http://stackoverflow.com/q/26654096
tags question: http://stackoverflow.com/q/26546246
tags question: http://stackoverflow.com/q/26645310
tags question: http://stackoverflow.com/q/26666547
tags question: http://stackoverflow.com/q/26551072
tags question: http://stackoverflow.com/q/26660660
tags question: http://stackoverflow.com/q/26633379
tags question: http://stackoverflow.com/q/26620908
tags question: http://stackoverflow.com/q/26603914
tags question: http://stackoverflow.com/q/26530386
tags question: http://stackoverflow.com/q/26524741
tags question: http://stackoverflow.com/q/26640546
tags question: http://stackoverflow.com/q/26632879
tags question: http://stackoverflow.com/q/26590672
tags question: http://stackoverflow.com/q/26565201
tags question: http://stackoverflow.com/q/26520268
tags question: http://stackoverflow.com/q/26640906
tags question: http://stackoverflow.com/q/26657888
tags question: http://stackoverflow.com/q/26518407
tags question: http://stackoverflow.com/q/26548835
tags question: http://stackoverflow.com/q/26533333

http://stackoverflow.com/comment/41910593
has text: These are your clues: "Didn't find class "org.cocos2dx.cpp.AppActivity" on path: /data/app/com.mole.game-1.apk" and "could not find libcocos2dx.apk!" Search for possible causes of those particular issues.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26651881
score: 0

http://stackoverflow.com/comment/41871189
has text: I faced this problem one time when my system date in wrong. So try to test this case. But why the same scenario work fine with normal java compilation through console.
comment on: http://stackoverflow.com/a/26631336
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41915138
score: 0
type: Comment
has text: @BibinMathew - I added solution, but it does not work for `<` or `>`, if they stay alone.
type: AnswerComment
comment on: http://stackoverflow.com/a/26655893

http://stackoverflow.com/q/26649675
tagged with: java
has body: I am trying to migrate data from one database to another using Java. All other data-types get migrated successfully except Blob type. Here is how I am checking data-types and migrating them. private String getValue(String value, String type, int i){ StringBuilder columnValue = new StringBuilder(""); if(type.equals("java.lang.String") || type.equals("java.sql.Timestamp") || type.equals("java.lang.Blob")){ if(i== (columnNames.size()-1)) columnValue.append("'"+value+"'"); Note : in type I am getting Blob as [B, I am aware of the fact that Blob is getting passed as Bytes Array so I tried to do check it as array as well , like this type.getBytes().equals("byte[]") I am unable to find out where I am doing wrong.
accepted answer: http://stackoverflow.com/a/26649805
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41903555
has title: How to determine column is Blob while migrating database
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/41903684
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26649805
tagged with: blob
score: 1

http://stackoverflow.com/comment/41679160
has text: By "delete old files" you mean undeploy the previous version of the application using WLS console?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26525685
score: 0

http://stackoverflow.com/q/26525536
has comment: http://stackoverflow.com/comment/44777683
has body: Background: I was writing a filewalker that starts at a specific folder and walks through each subfolder and its contents. Each time a directory or file is visited I compare the path to a PathMatcher containing a glob pattern (directories matched on path, files matched on extension). If it matched the pattern I would add it to a list for later use. This is so that I can build a filtered list based on a GLOB pattern. I wrote this on Unix (mac) and it seemed to work fine. When I tested it on Windows I got 0 results. Filter(String dirPattern, String extensionPattern) { dirMatcher = FileSystems.getDefault().getPathMatcher( "glob:" + dirPattern); extensionMatcher = FileSystems.getDefault().getPathMatcher( "glob:" + extensionPattern); } Problem: Take these GLOB patterns for example Directory pattern: **/{foo/bar,foo/baz/,fizz/buzz/fizzbuzz} Would work fine on UNIX but not on Windows. Now I've read that the JVM shouldn't have trouble interpreting '/' as a valid file seperator for both platforms but nonetheless I tried changing it to a Windows style path. **\{foo\bar,foo\baz\,fizz\buzz\fizzbuzz} Needs some escaping for java: **\\{foo\\bar,foo\\baz\\,fizz\\buzz\\fizzbuzz} But this still wont match anything... I even tried doing an OS check and replacing the '/' with Java File.seperator. if (OSUtil.getCurrentOS() == OS.Windows) { dirPattern = dirPattern.replace("/", File.separator); extensionPattern = extensionPattern .replace("/", File.separator); } It seems like the file seperators between the brackets are interpreted and correct but the first slash needs to be Windows style. At this point I'm not sure what is happening. Is there anyone that can shed some light on this problem? Any help would be appreciated.
favorite count: 0
tagged with: glob
type: UnansweredQuestion
tagged with: unix
downvote count: 0
answer count: 0
tagged with: java
tagged with: design-patterns
type: Question
score: 3
tagged with: nio
upvote count: 3
has title: Java PathMatcher: GLOB patterns are inconsistent on UNIX/Windows

http://stackoverflow.com/comment/41745403
score: 0
type: Comment
type: QuestionComment
has text: Yes it did... but how????
comment on: http://stackoverflow.com/q/26562668

http://stackoverflow.com/comment/41721584
has text: Actually, if you're trying to follow convention, return HTTP 401 Unauthorized, as this indicates you need to login, 403 indicates the resource is unavailible to everyone
comment on: http://stackoverflow.com/q/26533616
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26580399
has comment: http://stackoverflow.com/comment/41777823
has body: The problem is that the substring method requires you to specify a start index and an end index for the chunk that you want to extract, not a start index and a length. So you need to work out what the end index should be. It might be the start index plus the length of a chunk, or the current chunk might go all the way to the end of the string. Lastly, the start index for the next iteration will be the end index of the current iteration. So replace your while loop with this. I don't think anything else needs to change. Good luck. while (start &lt; phrase.length()) { int end = start + chunkNumber; if (end &gt; phrase.length()) { end = phrase.length(); } System.out.println(phrase.substring(start, end)); start = end; }
has comment: http://stackoverflow.com/comment/41777884
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26579911

http://stackoverflow.com/comment/41799447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26592091
has text: I don't understand. Doesn't change.length find the length of the char array that the method is passed? Hence wouldn't that loop only increment x up to one less than the number of characters the char array contains?
score: 0

http://stackoverflow.com/comment/41782886
type: Comment
type: QuestionComment
has text: I updated the case with wsdl file
score: 0
comment on: http://stackoverflow.com/q/26547870

http://stackoverflow.com/q/26589388
tagged with: jpa
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/72149411
favorite count: 0
has title: JPA named query using OR and Null Operator giving empty result
has body: Written named query @NamedQuery(name = PKGruppeBE.FIND_ALL_GROUP_SPECIFIC, query = "SELECT e FROM PKGruppeBE e WHERE (e.tkgroup.id = ?1 OR e.tkgroup IS NULL )") But query is not giving correct result, if there is a match, and tkgroup is null giving only matched results, if there is no match, and tkgroup is null giving empty result. My requirement is I have to get all results where tkgroup is null and if are there any matches those results also.
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26589618
accepted answer: http://stackoverflow.com/a/26589618
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/26631739
type: AnsweredQuestion
has body: Performance wise which one is best in below two cases, for example: Version 1: int value1 = rs.getInt(1); String value2 = rs.getString(2); Version 2: int value1 = rs.getInt("VALUE1"); String value2 = rs.getString("VALUE2"); Which one is best to use? In many places i added the code like Step 1 way. I want to know is it really make sense.
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/41871722
type: Question
has comment: http://stackoverflow.com/comment/41871650
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41871701
linked to: http://stackoverflow.com/q/186799
has answer: http://stackoverflow.com/a/26632149
favorite count: 0
linked to: http://stackoverflow.com/q/17744090
has comment: http://stackoverflow.com/comment/41871695
duplicate of: http://stackoverflow.com/q/186799
has title: Which one is performance for database?
has comment: http://stackoverflow.com/comment/41871601
accepted answer: http://stackoverflow.com/a/26632149
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/26548833
has title: Facing issue in EJB while using two datasources ( DB2 & Oracle )
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41788248
has body: Kindly help us on resolving the below two issues. 1.) Exception while saving data to two different databases (Db2 and oracle) - (EJB Module) WTRN0078E: An attempt by the transaction manager to call start on a transactional resource has resulted in an error. The error code was XAER_PROTO. The exception stack trace follows: oracle.jdbc.xa.OracleXAException at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1034) at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:251) at com.ibm.ejs.cm.CMXAResourceImpl.start(CMXAResourceImpl.java:219) at com.ibm.ws.Transaction.JTA.JTAResourceBase.start(JTAResourceBase.java:145) at com.ibm.ws.Transaction.JTA.RegisteredResources.startRes(RegisteredResources.java:1241) at com.ibm.ws.Transaction.JTA.RegisteredResources.enlistResource(RegisteredResources.java:649) at com.ibm.ws.Transaction.JTA.TransactionImpl.enlistResource(TransactionImpl.java:3296) at com.ibm.ws.Transaction.JTA.TranManagerSet.enlist(TranManagerSet.java:407) at com.ibm.ws.Transaction.JTA.TranManagerSet.enlist(TranManagerSet.java:365) at com.ibm.ws.Transaction.JTA.TranManagerSet.enlist(TranManagerSet.java:379) at com.ibm.ejs.cm.pool.ConnectO.enlist(ConnectO.java:1171) at com.ibm.ejs.cm.pool.ConnectO.enlist(ConnectO.java:775) at com.ibm.ejs.cm.pool.ConnectO.preInvoke(ConnectO.java:2242) at com.ibm.ejs.cm.proxy.Proxy.__preInvoke(Proxy.java:269) at com.ibm.ejs.cm.proxy.Proxy.__preInvoke(Proxy.java:249) at com.ibm.ejs.cm.proxy.OracleConnectionProxy.prepareStatement(OracleConnectionProxy.java:188) at com.marks.ims.integration.jde.dao.AddressBookDAO.copyAddressBookZRecord(AddressBookDAO.java:305) at com.marks.ims.integration.jde.dao.AddressBookDAO.update(AddressBookDAO.java:92) at com.marks.ims.integration.jde.JDEInterfaceGateway.updateAccount(JDEInterfaceGateway.java:88) at com.marks.bizacct.model.ejb.BusinessAccountServicesBean.doInterfaceProcessing(BusinessAccountServicesBean.java:318) CONM6016E: The system is unable to enlist with the trans…
tagged with: java
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/41720589

http://stackoverflow.com/q/26563939
has title: System.out.print(" "); syntax error on token ".", @ expected after this token
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26564019
has answer: http://stackoverflow.com/a/26564010
has answer: http://stackoverflow.com/a/26563970
linked to: http://stackoverflow.com/q/28720949
favorite count: 0
has answer: http://stackoverflow.com/a/26563966
has body: I'm getting this error on this piece of code and I can't figure out what's wrong. public class enc { //The Look-Up Table with the position of all the available characters public static final String LUT="*, .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Scanner sc=new Scanner(System.in); System.out.print("Input the sentence you want to encode."); String s= sc.nextLine(); }
has comment: http://stackoverflow.com/comment/41747524
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26563970
possible better answer: http://stackoverflow.com/a/26563966
upvote count: 2
score: 1
tagged with: java

http://stackoverflow.com/a/26581313
type: Answer
has body: Ruby is a "duck", dynamic typing language, because of it, you can do things like that. But Java has a static, safe and strong typing discipline, so you can't do something like that. However since you have tagged your question under "android" tag, the Parcelable interface could help you, requires a little bit more of code but it's what you're looking for. Also check these links: auto-parcel: "Parcelable generation" library, por of Google AutoValue. android-parcelable-intellij-plugin parceler: another library, haven't used it, but seems to be more popular.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26581060
answers question: http://stackoverflow.com/q/26581060

for-loop
tags question: http://stackoverflow.com/q/26589948
tags question: http://stackoverflow.com/q/26653968
tags question: http://stackoverflow.com/q/26534049
tags question: http://stackoverflow.com/q/26581426
tags question: http://stackoverflow.com/q/26608653
tags question: http://stackoverflow.com/q/26598309
tags question: http://stackoverflow.com/q/26663789
tags question: http://stackoverflow.com/q/26548185
tags question: http://stackoverflow.com/q/26543686
tags question: http://stackoverflow.com/q/26642544
tags question: http://stackoverflow.com/q/26600029
tags question: http://stackoverflow.com/q/26599030
tags question: http://stackoverflow.com/q/26538278
tags question: http://stackoverflow.com/q/26552616
tag name: for-loop
tags question: http://stackoverflow.com/q/26536388
tags question: http://stackoverflow.com/q/26534169
tags question: http://stackoverflow.com/q/26666688
tags question: http://stackoverflow.com/q/26647041
tags question: http://stackoverflow.com/q/26576052
tags question: http://stackoverflow.com/q/26617318
tags question: http://stackoverflow.com/q/26522095
tags question: http://stackoverflow.com/q/26649619
tags question: http://stackoverflow.com/q/26599240
tags question: http://stackoverflow.com/q/26562582
tags question: http://stackoverflow.com/q/26525288
tags question: http://stackoverflow.com/q/26540467
tags question: http://stackoverflow.com/q/26523200
type: Tag
tags question: http://stackoverflow.com/q/26611635
tags question: http://stackoverflow.com/q/26599218
tags question: http://stackoverflow.com/q/26523738
tags question: http://stackoverflow.com/q/26594837
tags question: http://stackoverflow.com/q/26615808
tags question: http://stackoverflow.com/q/26661303
tags question: http://stackoverflow.com/q/26558121
tags question: http://stackoverflow.com/q/26605266
tags question: http://stackoverflow.com/q/26558397
tags question: http://stackoverflow.com/q/26575215
tags question: http://stackoverflow.com/q/26610228
tags question: http://stackoverflow.com/q/26557185
tags question: http://stackoverflow.com/q/26666126

http://stackoverflow.com/a/26616920
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26616796
has body: You have to supply the type somehow. If I have public static &lt;T&gt; T getRandom(List&lt;T&gt; list) { ... } which is a method to return a random element from a list, that type is inferred from the object I pass in: List&lt;String&gt; list = // whatever String randomString = getRandom(list); // &lt;- the type String gets filled in here But, if I have a situation where the type isn't able to be inferred, then it has to be supplied, and that awkward-looking "after the dot" syntax is Java's way of doing it. It looks like builder() is a factory method for making a new ImmutableMap.Builder, but the method doesn't take anything so there's nothing to take the type from.

http://stackoverflow.com/a/26662207
has comment: http://stackoverflow.com/comment/41948591
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41926930
has comment: http://stackoverflow.com/comment/41926978
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41928995
has body: What you have is fine just some improvements. import java.lang.String; import java.util.*; class CountVowels{ static int countVowelA=0,countVowelE=0,countVowelI=0,countVowelO=0,countVowelU=0,countConsonants=0; public static void main(String args[]){ Scanner sc = new Scanner(System.in); String str=""; System.out.println("Please enter the string : "); str = sc.nextLine().trim(); System.out.println(); countVowels(str); printVowelsCount(); } public static void countVowels(String str){ char ch; for(int i = 0; i&lt;str.length(); i ++){ ch = str.charAt(i); if(ch == 'a' || ch =='A') { countVowelA++; } else if(ch == 'e' || ch =='E') { countVowelE++; } else if(ch == 'i' || ch =='I') { countVowelI++; } else if(ch == 'o' || ch =='O') { countVowelO++; } else if(ch == 'u' || ch =='U') { countVowelU++; } else if(Character.isLetter(ch)){ countConsonants++; } } } public static void printVowelsCount(){ System.out.println("Occurances of A in given string : " +countVowelA); System.out.println("Occurances of E in given string : " +countVowelE); System.out.println("Occurances of I in given string : " +countVowelI); System.out.println("Occurances of O in given string : " +countVowelO); System.out.println("Occurances of U in given string : " +countVowelU); System.out.println("Number of vowels in strings are : " +(countVowelA+countVowelE+countVowelI+countVowelO+countVowelU)); System.out.println("Number of Consonants : " +countConsonants); } }
answers question: http://stackoverflow.com/q/26661973
has comment: http://stackoverflow.com/comment/41930839
has comment: http://stackoverflow.com/comment/41926963
accepted answer of: http://stackoverflow.com/q/26661973

http://stackoverflow.com/comment/41858916
type: QuestionComment
score: 0
has text: I don't understand why total sell is 20
type: Comment
comment on: http://stackoverflow.com/q/26624579

http://stackoverflow.com/q/26597153
tagged with: java
has comment: http://stackoverflow.com/comment/41808985
has comment: http://stackoverflow.com/comment/41809728
tagged with: jodatime
answer count: 2
has body: Given a DateTimeZone, I can get the name and ID of the TimeZone like this: DateTimeZone timeZone = new DateTimeZone("America/Chicago"); // Prints "America/Chicago" System.out.println(timeZone.getID()); // Prints "CDT" (Since it is daylight savings time now) System.out.println(timeZone.getNameKey(DateTimeUtils.currentTimeMillis())); // Prints "Central Daylight Time" System.out.println(timeZone.getName(DateTimeUtils.currentTimeMillis())); All are great, but I really would like to get the timezone as a UTC offset. In this case the UTC offset would look like -05:00 How do I do this with Joda-Time?
downvote count: 0
has comment: http://stackoverflow.com/comment/41808858
has title: Convert DateTimeZone to UTC Offset
favorite count: 0
has answer: http://stackoverflow.com/a/26606393
has comment: http://stackoverflow.com/comment/41808992
has answer: http://stackoverflow.com/a/26597299
type: AnsweredQuestion
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/308683
possible better answer: http://stackoverflow.com/a/26597299
type: Question
accepted answer: http://stackoverflow.com/a/26606393

http://stackoverflow.com/comment/41959271
type: QuestionComment
has text: @jack, I have posted a possible solution for you. Sorry it took so long. I was busy with other stuff.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26670318

arraylist
tags question: http://stackoverflow.com/q/26572604
tags question: http://stackoverflow.com/q/26666110
tags question: http://stackoverflow.com/q/26525612
tags question: http://stackoverflow.com/q/26569526
tags question: http://stackoverflow.com/q/26545545
tags question: http://stackoverflow.com/q/26531200
tags question: http://stackoverflow.com/q/26601543
tags question: http://stackoverflow.com/q/26574873
tags question: http://stackoverflow.com/q/26622525
tags question: http://stackoverflow.com/q/26521983
tags question: http://stackoverflow.com/q/26645467
tags question: http://stackoverflow.com/q/26562619
tags question: http://stackoverflow.com/q/26604957
tags question: http://stackoverflow.com/q/26567274
tags question: http://stackoverflow.com/q/26537005
tags question: http://stackoverflow.com/q/26553628
tags question: http://stackoverflow.com/q/26604184
tags question: http://stackoverflow.com/q/26576580
tags question: http://stackoverflow.com/q/26561645
tags question: http://stackoverflow.com/q/26643702
tags question: http://stackoverflow.com/q/26620275
tags question: http://stackoverflow.com/q/26665161
tags question: http://stackoverflow.com/q/26530554
tags question: http://stackoverflow.com/q/26563439
tags question: http://stackoverflow.com/q/26598869
tags question: http://stackoverflow.com/q/26530445
tags question: http://stackoverflow.com/q/26664783
tags question: http://stackoverflow.com/q/26636463
tags question: http://stackoverflow.com/q/26661811
tags question: http://stackoverflow.com/q/26519816
tags question: http://stackoverflow.com/q/26638267
tags question: http://stackoverflow.com/q/26541503
tags question: http://stackoverflow.com/q/26642860
tags question: http://stackoverflow.com/q/26616350
tags question: http://stackoverflow.com/q/26613946
tags question: http://stackoverflow.com/q/26532832
tags question: http://stackoverflow.com/q/26668899
tags question: http://stackoverflow.com/q/26530524
tags question: http://stackoverflow.com/q/26578983
tags question: http://stackoverflow.com/q/26602597
tags question: http://stackoverflow.com/q/26671562
tags question: http://stackoverflow.com/q/26622297
tags question: http://stackoverflow.com/q/26557862
tags question: http://stackoverflow.com/q/26635014
tags question: http://stackoverflow.com/q/26656241
tags question: http://stackoverflow.com/q/26541047
tags question: http://stackoverflow.com/q/26601871
tags question: http://stackoverflow.com/q/26641130
tags question: http://stackoverflow.com/q/26654487
tags question: http://stackoverflow.com/q/26578734
tags question: http://stackoverflow.com/q/26543437
tags question: http://stackoverflow.com/q/26520127
tags question: http://stackoverflow.com/q/26586114
tags question: http://stackoverflow.com/q/26628935
tags question: http://stackoverflow.com/q/26528452
tags question: http://stackoverflow.com/q/26559097
tags question: http://stackoverflow.com/q/26592309
tags question: http://stackoverflow.com/q/26534451
tags question: http://stackoverflow.com/q/26562107
tags question: http://stackoverflow.com/q/26623713
tags question: http://stackoverflow.com/q/26552383
tags question: http://stackoverflow.com/q/26514544
tags question: http://stackoverflow.com/q/26568789
tags question: http://stackoverflow.com/q/26565105
tags question: http://stackoverflow.com/q/26546223
tags question: http://stackoverflow.com/q/26646772
tags question: http://stackoverflow.com/q/26640671
tags question: http://stackoverflow.com/q/26541471
tags question: http://stackoverflow.com/q/26668570
tags question: http://stackoverflow.com/q/26640994
tags question: http://stackoverflow.com/q/26604015
tags question: http://stackoverflow.com/q/26607130
tags question: http://stackoverflow.com/q/26606982
tags question: http://stackoverflow.com/q/26666068
tags question: http://stackoverflow.com/q/26593228
tags question: http://stackoverflow.com/q/26630710
tags question: http://stackoverflow.com/q/26663694
tags question: http://stackoverflow.com/q/26665563
tags question: http://stackoverflow.com/q/26569563
tags question: http://stackoverflow.com/q/26653278

http://stackoverflow.com/a/26590049
type: Answer
accepted answer of: http://stackoverflow.com/q/26589948
has body: Use another "if" (since you prefer using only an if) structure for greater than 10. For a given input it will enter just one of the if structures. (You also have an option to use "else if") public static void main(String args[]) { Scanner sc = new Scanner(System.in); int num; int i = 0; System.out.print("Please enter a number: "); num = sc.nextInt(); if(num &lt; 10) { while(i &lt; 7) { System.out.println("Less than 10"); i++; } } if(num&gt;10) { while(i &lt; 4) { System.out.println("greater than 10"); i++; } } }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41795094
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26589948

http://stackoverflow.com/q/26638264
linked to: http://stackoverflow.com/q/3832592
duplicate of: http://stackoverflow.com/q/2896013
upvote count: 0
answer count: 1
favorite count: 0
tagged with: double
accepted answer: http://stackoverflow.com/a/26638315
has comment: http://stackoverflow.com/comment/41883703
linked to: http://stackoverflow.com/q/2896013
type: AnsweredQuestion
tagged with: java
tagged with: floating-point
has comment: http://stackoverflow.com/comment/41883747
downvote count: 1
has body: I was working through debugging a program of mine where certain doubles and floats were not equal to each other. I have looked for answers previous to posting this on here as to why this would happen but could not find much relevant information. For example: System.out.println(4.4f == 4.4); This prints false while, System.out.println(4.5f == 4.5); Prints true. Could someone shed some light on why this is the case in JAVA?
type: Question
duplicate of: http://stackoverflow.com/q/3832592
has title: Java equality of floats and doubles
score: -1
has answer: http://stackoverflow.com/a/26638315

http://stackoverflow.com/q/26643944
has answer: http://stackoverflow.com/a/26662686
has comment: http://stackoverflow.com/comment/41894892
type: Question
has comment: http://stackoverflow.com/comment/41926746
has body: I was presented with the problem of creating a java program that tallies the votes of each individual candidate. We are supposed to use arrays; however, we were just taught them, and I am not quite following how to solve this. The file we are supposed to read from is this: 4 7 2 10 3 2 3 4 4 5 5 6 7 9 0 12 1 2 3 45 6 9 55 19 -4 11 4 4 3 -21 The left column is the candidate number, and the right is the number of votes. The first column can only be a whole number from 1-10. The second can be any positive value. In the end, the program is supposed to add together the total votes cast for each candidate. I think we need an array that goes something like: int[] cands = new int[10] It specifies the candidate number. However, I do not understand how to organize the values. Sorry if this seems jumbled..I am not sure how to explain this as I am slightly confused. Do I need more than just one array? Here is a snippet of the directions: Each line in this file contains two numbers: the first is the candidate identifier (1-10) and the second is the number of votes that candidate received. Your program will tally the number of votes per candidate using an array where each array entry represents a candidate. Notice that each array entry acts as a accumulator of votes for that candidate. Edit: This is what I have so far.. public static void main(String[] args) throws IOException { File file = new File("Tally.txt"); Scanner input = new Scanner(file); int[] cands = new int[10]; int cnt = 0; while (input.hasNextLine()) { int cand = input.nextInt() - 1; int vote = input.nextInt(); if ((cand &gt;= 0 &amp;&amp; cand &lt; cands.length) &amp;&amp; vote &gt; 0) { cands[cand] += vote; } } System.out.println("Canidate: \t Votes:"); for (int index = 1; index &lt; cands.length + 1; index++) { if (cnt &lt; cands.length) { System.out.println("\t " + index + "\t\t" + cands[cnt]); cnt++; } } input.close(); } } However, once it reaches a negative value or a value higher than 10 in the file it throws…
tagged with: java
has title: Vote Count Tallying
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41894306
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41927285
has comment: http://stackoverflow.com/comment/41894283
has comment: http://stackoverflow.com/comment/41894237

http://stackoverflow.com/a/26599800
downvote count: 0
has body: Put String answer = scan.nextLine(); inside the loop. Try the following: import java.util.Scanner; public class FracCalc { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Welcome to FracCalc"); System.out.println("Type expressions with fractions, and I will evaluate them"); String answer = scan.nextLine(); do { if (answer.equals("Quit")) { System.out.println("Thanks forr running FracCalc!"); break; } else { System.out.println("I can only process 'Quit' for now"); } answer = scan.nextLine(); } while (true); } }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26599772
score: 1
accepted answer of: http://stackoverflow.com/q/26599772
type: AcceptedAnswer

spring
tags question: http://stackoverflow.com/q/26537239
tags question: http://stackoverflow.com/q/26562137
tags question: http://stackoverflow.com/q/26543457
tags question: http://stackoverflow.com/q/26618400
tags question: http://stackoverflow.com/q/26609374
tags question: http://stackoverflow.com/q/26598966
tags question: http://stackoverflow.com/q/26588490
tags question: http://stackoverflow.com/q/26653818
tags question: http://stackoverflow.com/q/26636295
tags question: http://stackoverflow.com/q/26602219
tags question: http://stackoverflow.com/q/26604337
tags question: http://stackoverflow.com/q/26646143
tags question: http://stackoverflow.com/q/26540065
tags question: http://stackoverflow.com/q/26640837
tags question: http://stackoverflow.com/q/26603610
tags question: http://stackoverflow.com/q/26631490
tags question: http://stackoverflow.com/q/26544505
tags question: http://stackoverflow.com/q/26580328
tags question: http://stackoverflow.com/q/26630095
tags question: http://stackoverflow.com/q/26590154
tags question: http://stackoverflow.com/q/26573258
tags question: http://stackoverflow.com/q/26624709
tags question: http://stackoverflow.com/q/26669540
tags question: http://stackoverflow.com/q/26543901
tags question: http://stackoverflow.com/q/26666575
tags question: http://stackoverflow.com/q/26634808
tags question: http://stackoverflow.com/q/26534513
tags question: http://stackoverflow.com/q/26537322
tags question: http://stackoverflow.com/q/26556081
tags question: http://stackoverflow.com/q/26602385
tags question: http://stackoverflow.com/q/26545934
tags question: http://stackoverflow.com/q/26571807
tags question: http://stackoverflow.com/q/26535465
tags question: http://stackoverflow.com/q/26640218
tags question: http://stackoverflow.com/q/26660030
tags question: http://stackoverflow.com/q/26557628
tags question: http://stackoverflow.com/q/26572256
tags question: http://stackoverflow.com/q/26525245
tags question: http://stackoverflow.com/q/26571054
tags question: http://stackoverflow.com/q/26622228
tags question: http://stackoverflow.com/q/26570891
tags question: http://stackoverflow.com/q/26562787
tags question: http://stackoverflow.com/q/26555066
tags question: http://stackoverflow.com/q/26622936
tags question: http://stackoverflow.com/q/26589484
tags question: http://stackoverflow.com/q/26623417
tags question: http://stackoverflow.com/q/26609793
tags question: http://stackoverflow.com/q/26537668
tags question: http://stackoverflow.com/q/26597415
tags question: http://stackoverflow.com/q/26605599
tags question: http://stackoverflow.com/q/26610402
tags question: http://stackoverflow.com/q/26540782
tags question: http://stackoverflow.com/q/26584863
tags question: http://stackoverflow.com/q/26517876
tags question: http://stackoverflow.com/q/26543612
tags question: http://stackoverflow.com/q/26578581
tags question: http://stackoverflow.com/q/26531158
tags question: http://stackoverflow.com/q/26602968
tags question: http://stackoverflow.com/q/26611349
tags question: http://stackoverflow.com/q/26650237
tags question: http://stackoverflow.com/q/26593055
tags question: http://stackoverflow.com/q/26542190
tags question: http://stackoverflow.com/q/26666956
type: Tag
tags question: http://stackoverflow.com/q/26615332
tags question: http://stackoverflow.com/q/26605182
tags question: http://stackoverflow.com/q/26550316
tags question: http://stackoverflow.com/q/26625902
tags question: http://stackoverflow.com/q/26595626
tags question: http://stackoverflow.com/q/26656874
tags question: http://stackoverflow.com/q/26574004
tags question: http://stackoverflow.com/q/26536448
tags question: http://stackoverflow.com/q/26550124
tags question: http://stackoverflow.com/q/26659457
tags question: http://stackoverflow.com/q/26522043
tags question: http://stackoverflow.com/q/26639915
tags question: http://stackoverflow.com/q/26545343
tags question: http://stackoverflow.com/q/26526830
tags question: http://stackoverflow.com/q/26599728
tags question: http://stackoverflow.com/q/26561995

http://stackoverflow.com/q/26642544
has answer: http://stackoverflow.com/a/33518801
has answer: http://stackoverflow.com/a/26642612
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/26642689
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26642587
has comment: http://stackoverflow.com/comment/41891847
tagged with: loops
has body: I'm writing a spellchecker program that will ask the user for a word and will compare it to a list of words in an array that I have made. This program needs to be never ending until the user types quit. So my question is, what would I put while(&gt;&gt; here &lt;&lt;) that would end the program as soon as the user types quit instead of typing another word. The word quit is not in the array. Here is my code for the while loop so far (not done yet, but it bugs me when I test this and the loop doesn't end on quit, so that's what I need done first). String quit = "quit"; //this is only declared as "quit" to get the loop to run for testing while(quit.equals("quit")) { System.out.println("Please every a word or QUIT to exit"); String guess = input.nextLine(); for(int i = 0; i &lt; words.length; i++) { if(guess.equals(words[i])) { System.out.println("That word is spelled correctly."); } else { System.out.println("That word is not spelled correctly."); System.out.println("Would you like to add it to the dictionary? (Y/N)"); } } } If you suggest another way of doing it that's not a while loop, although I appreciate it, it has to be a while loop for school purposes.
type: Question
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/41891856
has title: Quit a While Loop if the user types in QUIT
has answer: http://stackoverflow.com/a/26642762
answer count: 6
has answer: http://stackoverflow.com/a/26642604
tagged with: for-loop

http://stackoverflow.com/q/26670001
tagged with: android
answer count: 1
has title: Weird AudioManager behaviour of setSpeakerphoneOn
favorite count: 0
tagged with: android-audiomanager
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: audio
has answer: http://stackoverflow.com/a/31987589
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/31987589
has body: When I try to play a sound or Text-To-Speech sound through STREAM_RING and my earphone is plugged in, the sound will be played on both speakerphone and earphone. It seems to be a default behaviour for Android framework, but I'd like to have sounds play only on earphone when it plugged in. So I try controlling speakerphone state like this before playing sounds. AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.setSpeakerphoneOn(false); But it's not enough and not working on my Nexus5(Kitkat 4.4.4). After some googling, I found that some solution suggests to use AudioManager#setMode(int). So the code will be like this. AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.setMode(AudioManager.MODE_IN_CALL); am.setSpeakerphoneOn(false); Basically this code will work for my requirement, but the sound is unstable and often intermitted. And it turned out that the code below is totally fine and the sound is not intermitted. AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.setMode(AudioManager.MODE_INVALID); am.setSpeakerphoneOn(false); I have no idea why MODE_IN_CALL causes unstable sound and MODE_INVALID works well. And to begin with, I have no idea why I should call AudioManager#setMode(int) to turn the speakerphone off. Does anyone know about this? Android official reference says nothing about these behaviours so that I cannot understand them clearly. Of course I already declared &lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/&gt;.

http://stackoverflow.com/comment/41658742
has text: We will need to know or see what `destiny()` does. It seems as though it is returning an empty `ArrayList`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26514454

http://stackoverflow.com/comment/41776080
has text: for (int p = D - 1; p >= 0; D--) this looks fishy. Shouldn't it be for (int p = D - 1; p >= 0; p--) ?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26579376

http://stackoverflow.com/q/26620929
type: Question
has answer: http://stackoverflow.com/a/45004281
score: 5
answer count: 3
tagged with: jpa
tagged with: persistence
favorite count: 0
upvote count: 5
linked to: http://stackoverflow.com/q/25283198
has body: Currently I'm mapping new JPA entities to an old database. The column names in the database have column names separated with underscore like 'my_column_name'. The problem is that JPA defaults to using with camel case. // Will be 'myColumnName' in queries and generated databases private String myColumnName; I know it's possible to add @Column(name="..") or @JoinColumn(name="...") on the properties - but that means i have to add it to every single property in all entities. @Column(name = "my_column_name") private String myColumnName; Is it possible to change the default behavior of JPA to use 'my_column_name' instead of 'myColumnName'?
has answer: http://stackoverflow.com/a/26633649
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26621053
has title: How to change the default format of JPA generated column names
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: openjpa

http://stackoverflow.com/a/26666578
type: AcceptedAnswer
type: Answer
has body: Just doing new File("hi"); will not actually create a new physical file. When you do new File("c:\\your\\file\\somewhere") you have to include a path, if the file does not already exist. If you want to create a file, you'd have to do something else, like using a PrintWriter: PrintWriter writer = new PrintWriter("yourfilename.txt", "UTF-8"); writer.println("write something to your file"); writer.close(); // now you can open the file File yourFile = new File("yourfilename.txt"); // to display it's location on the hard drive System.out.println(yourFile.getAbsolutePath());
accepted answer of: http://stackoverflow.com/q/26666495
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26666495
has comment: http://stackoverflow.com/comment/41944953
upvote count: 1

http://stackoverflow.com/comment/41855486
comment on: http://stackoverflow.com/q/26622525
score: 0
type: Comment
type: QuestionComment
has text: Most of the commenting is done for the pleasure of my Professor, but I will definitely keep that in mind going forward :)

http://stackoverflow.com/comment/41709591
has text: Method toString which return the schedule; semester, year, number of credits, number of courses, and the list of all courses as a string.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26531857

http://stackoverflow.com/comment/129249060
comment on: http://stackoverflow.com/a/44159312
score: 0
type: AnswerComment
type: Comment
has text: well. thats a good answer

http://stackoverflow.com/a/26534649
score: 3
has body: You don't have a constuctor without parameters in the student class. Such a constructor is generated by the compiler only if you haven't defined any other constructors, which you have. Just add the constructor : public student() { this.name = null; this.nationalID = null; this.county = null; this.gender = null; }
upvote count: 3
has comment: http://stackoverflow.com/comment/41695577
type: Answer
has comment: http://stackoverflow.com/comment/41695504
downvote count: 0
answers question: http://stackoverflow.com/q/26534601

http://stackoverflow.com/q/26578952
type: UnansweredQuestion
upvote count: 1
has title: Android Open GL ES strange issue
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: android
tagged with: opengl-es
answer count: 0
has body: i m building a game for android and i noticed on tracer a strange issue after trying to optimize my calls to open gl. The game runs perfect , and at most of the time bellow 16 fps , but in some frames exceeds 20 21 millis per frame , so i noticed this on allmost every glUniform1f , glUniform3fv , glUniform1i calls : java.lang.RuntimeException: No such property: PROGRAM_STATE/PROGRAMS/${program}/ACTIVE_UNIFORMS/14/UNIFORM_VALUE Error applying transformations for glUniform3fv(location = 3, count = 1, v = [0.0, 100.0, 0.0]) on frames > 16 millis this calls take more time to execute. Here is a sample of draw calls: GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, this.MyGLTexture); GLES20.glUseProgram(this.Params.Programm); GLES20.glUniform1i(this.Params.uTextureLoc, 0); GLES20.glUniformMatrix4fv(this.Params.uMMatrixHandle, 1, false,this.MMatrixClip, 0); Matrix.multiplyMM(this.MMatrix, 0, GamePlayRenderer.MVPMatrix, 0,this.MMatrix, 0); GLES20.glUniformMatrix4fv(this.Params.uMVPMatrixHandle, 1, false,this.MMatrix, 0); GLES20.glUniform1f(this.Params.uAlphaFactor,this.alphaFactor); GLES20.glUniform1f(this.Params.Fader,fader); GLES20.glUniform3fv(this.Params.uEyePos,1,cameraPos,0); GLES20.glUniform3fv(this.Params.uLightPos,1,lightPos,0); GLES20.glUniform3fv(this.Params.uMatAmbient,this.MatAmbient.length/3,this.MatAmbient,0); GLES20.glUniform3fv(this.Params.uMatDifusse,this.MatDifusse.length/3,this.MatDifusse,0); GLES20.glUniform3fv(this.Params.uMatSpecular,this.MatSpecular.length/3,this.MatSpecular,0); GLES20.glUniform3fv(this.Params.uMatAlpha,this.MatAlpha.length/3,this.MatAlpha,0); GLES20.glEnableVertexAttribArray(this.Params.aPosHandle); GLES20.glEnableVertexAttribArray(this.Params.aTextHandle); GLES20.glEnableVertexAttribArray(this.Params.aNorHandle); GLES20.glEnableVertexAttribArray(this.Params.aMatIdHandle); GLES20.glVertexAttribPointer(this.Params.aPosHandle, 3, GLES20.GL_FLOAT, false, 40, 0); GLES20.glVertexAttribPointer(this.Params.aTextHandle, 2, GLES20.GL_FLOAT, false,…

http://stackoverflow.com/q/26616712
has answer: http://stackoverflow.com/a/26616728
accepted answer: http://stackoverflow.com/a/26616728
answer count: 1
has title: When does this Java Thread stop
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41844621
type: Question
has comment: http://stackoverflow.com/comment/41847740
has body: I am just wondering that when the timer function finishes does the thread stop? or is there anything special I have to do to stop it? public void testing() { Thread thread = new Thread(new Runnable() { public void run() { synchronized(this) { timer(); } } }); thread.start(); } public void timer() { boolean active = true; long start = System.currentTimeMillis() / 1000L; while (active) { long finish = System.currentTimeMillis() / 1000L; if (finish - start &gt;= 20) { System.out.println("Finished"); active = false; } } }
score: 0

http://stackoverflow.com/comment/41826291
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26606542
has text: You are using external packages, please note them in the labels and provide an [MCVE](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/comment/41884198
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26637680
has text: I use the map to put this new DefaultMutableTreeNode... I think it works. =)

http://stackoverflow.com/q/26631041
accepted answer: http://stackoverflow.com/a/26633146
has body: Description of the Question I try to create a JavaFX ComboBox which holds CheckBoxes in the dropdown menu. The ComboBox shall be editable and gets fed by a simple Class lets call it CheckItem. the list of CheckItems shall be checkable - and shall not close the dropdown menu after a selection is made. finally the Text in the ComboBox should be available and a Selection (all checked Items) this is what i already worked out (1) a ComboBox rendering the CheckItem as CheckedBox with correct selection (2) gaining the Text from the ComboBox problems coming up (1) After clicking on one item the dropdown closes &amp; selection state of the item does not change. (2) As far as i noticed its only possible to have one item selected at a time? here is my code for testing the stuff: Test Program public class ComboButtonSample extends Application { @Override public void start(Stage stage) { final ObservableList&lt;CheckItem&gt; items = fetchItems(); ComboBox&lt;CheckItem&gt; combo = createComboBox(items); combo.setPromptText("enter searchstring here"); combo.setEditable(true); // order the components vertically VBox vBox = new VBox(); vBox.getChildren().add(combo); // Button to write out the text and the items of the combobox Button btn = new Button(); btn.setText("combo text to console"); btn.setOnAction((event) -&gt; { System.out.println("Text is: "+combo.getEditor().getText()); System.out.println("Content is: "); for (Iterator&lt;CheckItem&gt; iterator = combo.getItems().iterator(); iterator.hasNext();) { CheckItem ci = (CheckItem) iterator.next(); System.out.println(String.format("[%s] %s -&gt; %s", ci.selected ? "X" : " ",ci.getDisplayName(), ci.getInternalName())); } }); vBox.getChildren().add(btn); // show you do not need any code to change the selection of the box. CheckBox checkBox = new CheckBox(); checkBox.setText("test box"); vBox.getChildren().add(checkBox); stage.setScene(new Scene(vBox)); stage.show(); } private ComboBox&lt;CheckItem&gt; createComboBox(ObservableList…
type: Question
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/52228902
upvote count: 4
has comment: http://stackoverflow.com/comment/41870326
answer count: 2
possible better answer: http://stackoverflow.com/a/52228902
downvote count: 0
has answer: http://stackoverflow.com/a/26633146
has title: JavaFX ComboBox with CheckBoxes
favorite count: 0
has comment: http://stackoverflow.com/comment/41870416
tagged with: checkbox
tagged with: combobox
has comment: http://stackoverflow.com/comment/41872373
score: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/41919234
score: 0
type: AnswerComment
type: Comment
has text: Let me explain you my doubt in this way, String s[]=null; System.out.println(s);//prints null System.out.println(s[0]);//null pointer exception. My 2nd question was the code in my above snippet seems to assign null value to array itself not to the first element of the array i.e one in like the above code. In which way in my previous code str[0] gets the value null? @MC Emperpr
comment on: http://stackoverflow.com/a/26650479

http://stackoverflow.com/comment/41703459
type: QuestionComment
has text: "keep it from repeating": what does this mean?
score: 4
comment on: http://stackoverflow.com/q/26539083
type: Comment

http://stackoverflow.com/q/26592576
has body: I'm using PrimeFaces Extension to export data using its data table's rowExpansion, because native PrimeFaces doesn't support this kind of structure. I don't want to write pure iText code for the sake of practicality. HTML: &lt;p:commandLink id="csv" ajax="false"&gt; &lt;h:outputText value="CSV" /&gt; &lt;f:setPropertyActionListener value="false" target="#{panoramicaMB.customExporter}" /&gt; &lt;pe:exporter type="csv" target="tabela" fileName="panoramicas" facetBackground="#AAFFBB" datasetPadding="4" /&gt; &lt;/p:commandLink&gt; The attribute customExporter is a primitive boolean. I changed from isCustomExporter() to getCustomExporter(). Same result with both names. Partial stack trace: java.lang.IllegalArgumentException: No enum constant org.primefaces.extensions.component.exporter.DefaultExporterFactory.ExporterType.CSV at java.lang.Enum.valueOf(Enum.java:238) at org.primefaces.extensions.component.exporter.DefaultExporterFactory$ExporterType.valueOf(ExporterFactoryProvider.java:57) at org.primefaces.extensions.component.exporter.DefaultExporterFactory.getExporterForType(ExporterFactoryProvider.java:67) at org.primefaces.extensions.component.exporter.DataExporter.processAction(DataExporter.java:174) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813) at javax.faces.component.UICommand.broadcast(UICommand.java:300) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.FilterHandler$F…
tagged with: jsf
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26593043
tagged with: primefaces-extensions
answer count: 1
has comment: http://stackoverflow.com/comment/41800222
tagged with: primefaces
tagged with: export
accepted answer: http://stackoverflow.com/a/26593043
type: AnsweredQuestion
has title: No enum constant org.primefaces.extensions.component.exporter.DefaultExporterFactory.ExporterType.CSV
type: Question

http://stackoverflow.com/q/26640500
tagged with: java
has comment: http://stackoverflow.com/comment/41893942
has comment: http://stackoverflow.com/comment/41931547
has answer: http://stackoverflow.com/a/34596995
tagged with: tomcat8
has comment: http://stackoverflow.com/comment/41922742
score: 0
has answer: http://stackoverflow.com/a/26664341
has body: I have a Java Web App that I am running in Tomcat 8.0. Up to this point I have had no issues with the application but the primary user has asked for several things to be on the main page of the application and I am adding these one at a time for the primary purpose of testing functionality as I go. Here recently I have really bearing down on testing to ensure that the site is going to work properly when it is ready to deploy. After doing several tests back to back I have noticed that the server just seems to lock up. At first I thought it was memory space but I have checked all of the logs and don't seem to be getting any errors except the 29-Oct-2014 16:28:16.520 INFO [main] org.apache.catalina.core.AprLifecycleListener.init The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: The rest seemed pretty normal to me: 29-Oct-2014 16:28:16.658 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-4273"] 29-Oct-2014 16:28:16.682 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 29-Oct-2014 16:28:16.684 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 29-Oct-2014 16:28:16.686 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 29-Oct-2014 16:28:16.686 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 344 ms 29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina 29-Oct-2014 16:28:16.703 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.9 29-Oct-2014 16:28:16.718 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Tomcat 8.0\webapps\SecureAutoData1.war …
has comment: http://stackoverflow.com/comment/41892534
answer count: 4
has answer: http://stackoverflow.com/a/26665065
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41933195
tagged with: web-applications
linked to: http://stackoverflow.com/q/1016286
type: Question
has answer: http://stackoverflow.com/a/26640803
linked to: http://stackoverflow.com/q/22245477
tagged with: server
has title: Why Does My Server Stop Responding and is There A Way To Monitor It?

http://stackoverflow.com/q/26626756
accepted answer: http://stackoverflow.com/a/26626850
has title: (Java) how to draw a single char
has comment: http://stackoverflow.com/comment/41863790
score: 0
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41863077
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26626850
answer count: 1
tagged with: user-interface
tagged with: awt
has body: I have a question. I have this char's declared but I can't find a function that works.... How can I draw a single char in a GUI? :) drawString doens't seem to work, and drawChars expects an array :S import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MyFrame extends JFrame implements ActionListener { private JPanel p; private JTextField tf; private JLabel lb; private JButton b, bstart; private String woord = "woord"; private int x = 0; private int y = 0; private Font f = new Font("Courier", Font.PLAIN,60); private int count; private int y = 60; public MyFrame() { setLayout(new FlowLayout()); p = new JPanel(); p.setPreferredSize(new Dimension(500, 600)); add(p); p.setOpaque(true); p.setBackground(Color.BLUE); bstart = new JButton("start"); add(bstart); bstart.addActionListener(this); lb = new JLabel("Voer uw woord in: "); add(lb); tf = new JTextField(8); add(tf); b = new JButton("Kraken"); add(b); b.addActionListener(this); setSize(150, 150); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public void actionPerformed(ActionEvent event) { Graphics g = p.getGraphics(); if (event.getSource() == bstart) { g.setColor(Color.WHITE); // g.drawRect(25, 25, 500, 500); // g.drawLine(500, 425, 25, 425); // g.drawLine(500, 325, 25, 325); // g.drawLine(500, 225, 25, 225); // g.drawLine(500, 125, 25, 125); for (int i = 0; i &lt; 5; i++) { for (int z = 0; z &lt; 5; z++) { g.drawRect(x,y,100,100); x = x + 100; } x = 0; y = y+100; } g.setFont(f); g.drawString("W", 30, 60); } if(event.getSource() == b){ count++; String gok = tf.getText(); g.setColor(Color.RED); g.fillRect(0,0,100,100); g.setColor(Color.white); g.setFont(f); g.drawString("W", 30, 60); char secondLetter = gok.charAt(1); char thirdLetter = gok.charAt(2); char fourthLetter = gok.charAt(3); char lastLetter = gok.charAt(4); g.drawString(secondLetter,130, y); } String input = tf.getText(); if (input.toLowerCase() == "woord") ; } }

http://stackoverflow.com/comment/41849874
has text: that actually helped me a lot! I will try and play around with this and figure it out. I really didn't want a direct answer so I could figure it out myself. Next time I reply hopefully it will be corrected. Thank you again!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26619433

http://stackoverflow.com/q/26526261
tagged with: java
has comment: http://stackoverflow.com/comment/41680368
type: Question
has comment: http://stackoverflow.com/comment/41680587
tagged with: jndi
has comment: http://stackoverflow.com/comment/41680731
has answer: http://stackoverflow.com/a/26527793
answer count: 2
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/41680109
has body: I am new to JPA and developing a webapp(J2EE) where the webapp is in Tomcat so I can't use @PersistenceContext. I decided to use a Helper class and everything was going fine. Then I decided to implement JNDI for connection pooling and I managed to get Datasource. The Helper Class looks like the following: try { Context initCtx = new InitialContext(); entityManager = //class cast exception (EntityManager)initCtx.lookup( "java:/comp/env/jdbc/LCDS" ); DataSource ds= (DataSource)initCtx.lookup( "java:/comp/env/jdbc/LCDS" ); System.out.println(ds.getConnection()+"Cool"); //jdbc:mysql://localhost:3306/XXXXXXX, UserName=root@localhost, MySQL-AB JDBC DriverCool emf=(EntityManagerFactory) source.getConnection(); //class cast exception emf = Persistence.createEntityManagerFactory("XXXX"); //working version } The error is: ava.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to javax.persistence.EntityManager I don't know where I am getting wrong. I am not able to get EntityManagerFactory or EntityManager via JNDI lookup. I tried @Resource(name="jdbc/LCDS") and @PersistenceUnit(name="jdbc/LCDS").
has answer: http://stackoverflow.com/a/26527663
tagged with: tomcat
favorite count: 0
has title: java.lang.ClassCastException,Getting Entitymanager Via JNDI Lookup
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41690418
has comment: http://stackoverflow.com/comment/41680212
score: 2
has comment: http://stackoverflow.com/comment/41679973
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/52841760
has text: [GIGO](https://en.wikipedia.org/wiki/Garbage_in,_garbage_out)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26565967
score: 0

http://stackoverflow.com/a/26642630
has comment: http://stackoverflow.com/comment/41892176
score: 0
has comment: http://stackoverflow.com/comment/41892201
type: Answer
answers question: http://stackoverflow.com/q/26642279
has comment: http://stackoverflow.com/comment/41891982
has body: You can use a single integer counter. When the right side wins increment it by 1 and when the left side wins decrement it by 1. This way you can easily test with an if statement who has been winning lately and control what happens depending on who wins. If you can't use a list or queue then I would suggest using two separate arrays, one for the left side and one for the right side. You can increment and decrement them according to the overall score counter.

http://stackoverflow.com/a/58657835
has body: use this with intent in order to clear the backtrace activities Java intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Kotlin var intent = Intent(this, [Your_activity]:class.java) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK startActivity(intent)
answers question: http://stackoverflow.com/q/26596445
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26658293
has answer: http://stackoverflow.com/a/26658385
answer count: 3
has answer: http://stackoverflow.com/a/26659018
possible better answer: http://stackoverflow.com/a/26658385
tagged with: memory-management
tagged with: overflow
has comment: http://stackoverflow.com/comment/41918947
linked to: http://stackoverflow.com/q/4123743
accepted answer: http://stackoverflow.com/a/26658359
has title: Can Java's HashMap overflow silently?
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
type: Question
score: 0
has body: In Java, can a java.util.HashMap&lt;Key, Value&gt; overflow silently, so content is deleted without me receiving an exception or some other notification? If yes, how do I make it noticeable? I meant can it exceed the physical hardware memory, not the reserved memory for the HashMap object.
has answer: http://stackoverflow.com/a/26658359

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26571631
tags question: http://stackoverflow.com/q/26648722
tags question: http://stackoverflow.com/q/26551358
tags question: http://stackoverflow.com/q/26658601
tags question: http://stackoverflow.com/q/26568614
tags question: http://stackoverflow.com/q/26557087
type: Tag
tags question: http://stackoverflow.com/q/26540237
tags question: http://stackoverflow.com/q/26623253
tags question: http://stackoverflow.com/q/26527393
tags question: http://stackoverflow.com/q/26521983
tags question: http://stackoverflow.com/q/26569638
tags question: http://stackoverflow.com/q/26642279
tags question: http://stackoverflow.com/q/26553436
tags question: http://stackoverflow.com/q/26557659

http://stackoverflow.com/comment/41781607
type: AnswerComment
type: Comment
score: 0
has text: in a way we are sorting a list of words into a list of distinct words with their respective count, arent we? thanks for the approaches.
comment on: http://stackoverflow.com/a/26582229

http://stackoverflow.com/comment/41885886
type: QuestionComment
has text: Volley does in fact handle its workload in the background. The listeners however, or run by default on the UI thread - which is your responsibilty. If you're skipping frames, it's some sort of long operation that is performed on the UI thread. Try putting informative log prints to find out exactly where that operation is and move it to a background thread.
type: Comment
comment on: http://stackoverflow.com/q/26621588
score: 0

http://stackoverflow.com/a/53969170
has body: Basically just try pass your test device id to adBuilder : /** adRequest Object For test device */ AdRequest adRequest = new AdRequest.Builder().addTestDevice("TEST_DEVICE_ID").build(); /** adRequest Object For Production Device*/ AdRequest adRequest = new AdRequest.Builder().build(); You can find your test divece id in logCat after without test divece id adBuilder request: I/Ads: Use AdRequest.Builder.addTestDevice("TEST_DEVICE_ID") to get test ads on this device.
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26610383

http://stackoverflow.com/q/26576386
has answer: http://stackoverflow.com/a/26599338
has comment: http://stackoverflow.com/comment/41770485
upvote count: 1
tagged with: akka
answer count: 1
has title: Waiting for the response in API servers
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: netty
downvote count: 0
score: 1
tagged with: java
tagged with: concurrency
has body: I have a Netty HTTP server that I use as an API server. The user sends events to the API server and it processes the event on other threads in same server using executor services or a concurrency framework like Akka. I have two options for the response; when I send the event to another thread, either I can wait for the response and write it to the socket or just write acknowledge message back to the socket. When I wait for the response, the latency of the http requests increases and the number of requests the server can handle decreases. On the other hand, there is no control for back-pressure so we don't know when the server will process the event and I can't inform the user that the server processed the event. However, the number of http requests the server can handle increases because the latencies are quite low for almost all requests. public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { executor.submit(new Event(msg)); // do not wait for the response ctx.write(new DefaultFullHttpResponse(HTTP_1_1, OK)); } } public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { Future&lt;Object&gt; future = executor.submit(new Event(msg)); future.after(x -&gt; ctx.write(new DefaultFullHttpResponse(HTTP_1_1, OK))); } } Since it's an API server, I don't have to wait for the response in order to inform the user that the event is processed because it's simply a write request that doesn't return a response. So which way is the most convenient one for http servers and do you think the second option worth for its performance benefit?
type: Question

http://stackoverflow.com/comment/41937393
type: QuestionComment
comment on: http://stackoverflow.com/q/26667988
score: 0
type: Comment
has text: @DavidWallace cannot stop laughing bc of ur comments :D :'( :D

http://stackoverflow.com/q/26602385
has comment: http://stackoverflow.com/comment/41818499
linked to: http://stackoverflow.com/q/6428532
score: 0
has comment: http://stackoverflow.com/comment/41823752
has comment: http://stackoverflow.com/comment/41818150
has comment: http://stackoverflow.com/comment/41818446
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41821314
tagged with: spring
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41820004
has body: I am using Spring Data on top of Hibernate. I have an abstract class A and some implementations, two of which are associated to a large number of records in the database, let's say 200k. I am using a TABLE_PER_CLASS inheritance strategy. Class A has relationship with another class C having two double numbers, d1 and d2. Now, I want to execute a query like findByCD1BetweenAndCD2Between(double minD1, double maxD1, double minD2, double maxD2): @Repository public interface ARepository extends JpaRepository&lt;A, Long&gt;, JpaSpecificationExecutor&lt;A&gt; { findByCD1BetweenAndCD2Between(double minD1, double maxD1, double minD2, double maxD2): } My class C is embedded and an index is defined: @Entity @Configurable @Embeddable @Table(indexes = { @Index(columnList = "d1,d2") }) public class C { private double d1; private double d2: } Class A embeds it: @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Configurable public class C { @Embedded private Coordinates coordinates; /*...*/ } When I do this, the query really takes several minutes. Executing the query directly in SQL does not take that long, as it is a matter of seconds. The number of records matching the condition is in the order of 100. How can I optimize this situation in order to reduce the computation to a few seconds?
tagged with: mysql
has title: Large table and SQL between operator: performance issue with Spring Data
type: Question
has comment: http://stackoverflow.com/comment/41818467
has comment: http://stackoverflow.com/comment/41818332

http://stackoverflow.com/comment/41935024
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26666688
type: QuestionComment
has text: Try initializing returnValue to false, and if you do find what you're looking for, set returnValue to true and break out of the loop.

http://stackoverflow.com/comment/41809647
has text: @markspace Sorry I'm not particularly familiar with java specifics. I was under the impression that this wasn't needed if I left off ^ and $.
comment on: http://stackoverflow.com/a/26577787
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41830312
has text: @haywire - it shows him a simple way to compile and run his program that actually works. It also gives some leads as to why it is not be working for him. How does that NOT help him???
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/26609132

http://stackoverflow.com/comment/41677131
has text: oops, my question is not clear, what I need is to get servlet attribute using jquery or javascript, not sending data from jsp page to servlet
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26524416

http://stackoverflow.com/a/26593399
type: Answer
answers question: http://stackoverflow.com/q/26590542
score: 0
has body: It really looks like you're trying to use synchronized and wait where you shouldn't be. If you really want to wait for the thread to finish, you should be doing something like this In your UpdateThread: class UpdateThread extends Thread{ public AtomicBoolean stopped = new AtomicBoolean(false); public void run() { while (!stopped.get()){ ..... In your creation: updateThread = new UpdateThread(); progressDialog = new ProgressDialog(GroupListActivity.this); updateThread.start(); // no synchronization necessary In your on dismiss: progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { try { updateThread.stopped.set(true); updateThread.join(300); } catch (InterruptedException e) { e.printStackTrace(); } Log.i(TAG,"Thread is stopped"); } }); Note, I added an exit condition to your thread so it will actually stop (as is, your thread will keep going). You'd probably want to make the exit condition private and add a setter for cleanliness. Also, I'm using join to properly wait for your thread to complete.

http://stackoverflow.com/comment/41930124
type: AnswerComment
comment on: http://stackoverflow.com/a/26663850
type: Comment
has text: Yea it would definitely need to incorporate a separate chaining... Idk yea annoying no exact question. Thanks again
score: 0

http://stackoverflow.com/comment/41822181
type: Comment
type: QuestionComment
has text: Are you sure that's where the exception is getting thrown ? I would rather say there is a problem when reading the image in the method `Window`
comment on: http://stackoverflow.com/q/26604505
score: 0

http://stackoverflow.com/a/26524285
has body: You can cancel the previous calls. Have your async methods return com.google.gwt.http.client.Request instead of void, so you can call cancel() on it. This would make sure your previous callback will never be called and you only ever have one ongoing request (from the client's point of view at least; you'll have several being processed on the server because cancelling a request is a client and network thing, and isn't exposed to the servlet server-side)
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26514743
answers question: http://stackoverflow.com/q/26514743
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41903830

http://stackoverflow.com/comment/41946434
score: 0
has text: @PredragMaric, Yes, Transaction is rolled back. What I think is, because of select record is null. Query work when executed directly in the database.
comment on: http://stackoverflow.com/q/26672909
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26597410
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41961350
favorite count: 0
has answer: http://stackoverflow.com/a/26598649
accepted answer: http://stackoverflow.com/a/26598649
has comment: http://stackoverflow.com/comment/41811388
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
tagged with: swing
has body: I am learning JavaFX, and it seems very cool, but pretty nasty too. As far as I got it, the GUI is written in XML, and exported in the exact same form (not being converted or anything), and the XML is being read with FXMLLoader, every time the window opens up. Also, JavaFX has much more features than swing (rotating, 3D, etc). So my question is: Is JavaFX significantly heavier for the performance, comparing to Java Swing? If it is not, then how heavy is it?
type: Question
has title: Is JavaFX GUI heavy for the performance?
tagged with: performance
upvote count: 2

http://stackoverflow.com/comment/41669992
score: 0
type: Comment
type: AnswerComment
has text: Oh... thanks! I was looking at it through a different point of view
comment on: http://stackoverflow.com/a/26520394

http://stackoverflow.com/q/26584748
has answer: http://stackoverflow.com/a/26584847
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/41785237
type: Question
answer count: 2
tagged with: mocking
accepted answer: http://stackoverflow.com/a/26584800
tagged with: mockito
downvote count: 0
has comment: http://stackoverflow.com/comment/41785312
has body: I have mocked a Message class as follows (within a TestNG unit test class): @BeforeMethod protected void setUp() { message = mock(Message.class); } I can assure you that I have declared message of type Message in the Unit test class. Now, the Message class has an instance variable called category which is of type String as follows: public class Message { private String category; public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } } Okay, now the problem: within a small test method, I have to set the category of a mocked message instance and then use that category for another task in the unit test. However, after I set the category for the mocked message, it reverts to null again. This is the code: public void shouldSendMessagesWithCategory() { message.setCategory("F1 Racing"); // SET THE CATEGORY raceResults.addSubscriber("F1 Racing", clientA); System.out.println("Cat" + message.getCategory()); // THE MESSAGE's CATEGORY IS NULL raceResults.send(message); verify(clientA).receive(message); } The console prints out null - so I definitely know it's null. I've been trying to figure this out for two days, but it just seems I'm missing something. So any help would be greatly appreciated.
has title: Unit testing with Mockito resets a mocked class' instance variable to null
favorite count: 0
tagged with: testng
possible better answer: http://stackoverflow.com/a/26584847
has answer: http://stackoverflow.com/a/26584800
upvote count: 1

http://stackoverflow.com/comment/41878775
type: Comment
has text: The only way to reliably check a domain name is by doing a DNS Query. test@hfgsdfsdfsdfs.com looks ok but doesn't exists. narwhal@domaintest.みんな might look strange but is a valid email address.
comment on: http://stackoverflow.com/a/26635112
score: 0
type: AnswerComment

http://stackoverflow.com/q/26578991
upvote count: 0
has answer: http://stackoverflow.com/a/26628924
accepted answer: http://stackoverflow.com/a/26628924
tagged with: treeview
has answer: http://stackoverflow.com/a/26585442
type: Question
tagged with: java
has title: JavaFX TreeView is null why?
has body: I want to load the TreeView defined in my FXML file into a TreeView variable in my java code. But always when I try it the TreeView is NULL. I looked everywhere, Google, so many questions and answers here but nothing worked out. I need the TreeView to add dynamicly TreeItems to it. Here my IconOverview.FXML file located in src/rn.IconTool.view: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.image.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.AnchorPane?> <?import rn.IconTool.model.*?> <?import javafx.scene.control.TreeView?> <TreeView fx:id="treeview" layoutX="-5.0" onMouseClicked="#ShowContextMenu" prefHeight="545.0" prefWidth="218.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /> <ImageView fitHeight="95.0" fitWidth="104.0" layoutX="22.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" /> <ToolBar layoutY="-1.0" prefHeight="30.0" prefWidth="968.0" /> my RootLayout.fxml, located in .view too <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.BorderPane?> <?import rn.IconTool.model.*?> <MenuItem mnemonicParsing="false" text="Close" /> <MenuItem mnemonicParsing="false" onAction="#NewtCategory" text="New Category" /> <MenuItem mnemonicParsing="false" text="Delete" /> <MenuItem mnemonicParsing="false" text="About" /> the CreateNewCategoryScreen.fxml in .view too <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.BorderPane?> <?import rn.IconTool.model.*?> <MenuItem mnemonicParsing="false" text="Close" /> <MenuItem mnemonicParsing="false" onAction="#NewtCategory" text="New Category" /> <MenuItem mnemonicParsing="false" text="Delete" /> <MenuItem mnemonicParsing="false" text="About" /> And my Co…
score: -1
answer count: 2
downvote count: 1
possible better answer: http://stackoverflow.com/a/26585442
favorite count: 0
type: AnsweredQuestion
tagged with: fxml

http://stackoverflow.com/q/26552624
favorite count: 0
has comment: http://stackoverflow.com/comment/41728459
has comment: http://stackoverflow.com/comment/41727935
has comment: http://stackoverflow.com/comment/41727764
tagged with: merge
has comment: http://stackoverflow.com/comment/41728213
has answer: http://stackoverflow.com/a/26554849
has body: I have two related text files shown for example in data1.txt and data2.txt. I want to merge the two files to create result.txt. Any idea how to go about this? data1.txt books, 3 Shelf, 5 groceries,6 books, 1 Shelf, 2 data2.txt books,2 shelf,3 groceries,1 result.txt books, 3, 2 Shelf, 5,3 groceries,6,1 books, 1,2 Shelf, 2, 3
tagged with: text
score: 2
has comment: http://stackoverflow.com/comment/41727271
upvote count: 2
has title: How to merge data from two text file
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41728147
accepted answer: http://stackoverflow.com/a/26554849
has answer: http://stackoverflow.com/a/26552761
has answer: http://stackoverflow.com/a/26553575
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/26552761
has comment: http://stackoverflow.com/comment/41727860

http://stackoverflow.com/comment/41735560
comment on: http://stackoverflow.com/q/26544714
type: Comment
type: QuestionComment
score: 0
has text: @tobias_k *incremental* sieve replaces the contiguous array with a priority queue of primes' multiples, creating a "sliding" sieve (see it simulated [here](http://stackoverflow.com/a/11979874/849891)). But priority queue is a collection too.

http://stackoverflow.com/q/26523335
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/487906
tagged with: java
has title: Java Regex for international phone number
type: Question
duplicate of: http://stackoverflow.com/q/487906
tagged with: validation
tagged with: phone-number
score: 0
has body: Please assist, I need a regex that can validate +27 11 123 4567 . The regex pattern I have currently is : if(phoneNo.matches("\\+d{3}[-\\.\\s]\\d{2}[-\\.\\s]\\d{3}[-\\.\\s]\\d{4}")) return true;
has comment: http://stackoverflow.com/comment/41675311
has comment: http://stackoverflow.com/comment/41675222
tagged with: regex
answer count: 0

http://stackoverflow.com/q/26616891
score: 0
possible better answer: http://stackoverflow.com/a/26617030
upvote count: 1
has answer: http://stackoverflow.com/a/26617030
downvote count: 1
has answer: http://stackoverflow.com/a/26617145
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/26617826
has answer: http://stackoverflow.com/a/26617028
tagged with: arrays
has answer: http://stackoverflow.com/a/26617317
has title: Replacing a char value in a string (Java)
has comment: http://stackoverflow.com/comment/41845171
tagged with: char
type: AnsweredQuestion
has body: In my assignment I need to get this output: Enter a word: house What letter do you want to replace?: e With what letter do you wish to replace it? w The new word is housw. _____________________________________________. I got the program to work with this code, but now I need to set while loops. Here is my current code. String word = ""; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a word: " + word); word = keyboard.nextLine(); String readChar = null; System.out.print("What letter do you want to replace?: "); readChar = keyboard.next(); String changeChar; System.out.print("With what letter do you wish to replace it? "); changeChar = keyboard.next(); keyboard.close(); System.out.println(word.replaceAll(readChar, changeChar)); System.out.println(); I need to now make my program output this: Enter a word: house What letter do you want to replace?: a There is no a in house. What letter do you want to replace?: b There is no a in house. What letter do you want to replace?: e With what letter do you wish to replace it? w The new word is housw. How would my while loop look to portray this output?
accepted answer: http://stackoverflow.com/a/26617826
favorite count: 0
type: Question

http://stackoverflow.com/a/26568557
has comment: http://stackoverflow.com/comment/41756328
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41756391
type: Answer
has comment: http://stackoverflow.com/comment/41756406
answers question: http://stackoverflow.com/q/26568461
has comment: http://stackoverflow.com/comment/41756363
score: 2
has body: For one, your while(noCharsLeft != -1) { will loop once more than you want. It starts at 0, so iterates, reads some chars (noCharsLeft is set to some positive value), and checks while again. It's still not == -1 and so iterates again. This time it reads no characters into the buffer, but writes to the StringBuilder. You need to read once before checking the number of bytes read. Second, cbuf.toString() returns a String starting at the current position in the buffer, which is one more than the last character added. That is, it contains DEFAULT_BUFFER_SIZE - noCharsLeft '\0' characters . Ignoring encoding (which you shouldn't ignore, give a character encoding to your InputStreamReader), you'll want something like while ((noCharsLeft = br.read(cbuf)) != -1) { cbuf.rewind(); bufferedStringInput.append(cbuf, 0, noCharsLeft); cbuf.clear(); } Here, you read the first batch of characters. You then rewind your buffer to set the position at index 0. You then append noCharsLeft characters from the buffer to the StringBuilder.
has comment: http://stackoverflow.com/comment/41756375
accepted answer of: http://stackoverflow.com/q/26568461
type: AcceptedAnswer

http://stackoverflow.com/q/26524382
type: Question
has comment: http://stackoverflow.com/comment/41676738
score: -1
tagged with: comparable
has answer: http://stackoverflow.com/a/26524522
has body: In Java if we want to sort based on second item in PriorityQueue using Comparable interface The Code will be like this: import java.util.*; public class Main{ public static class Pair implements Comparable{ int node; int weight; public Pair(int node,int weight){ this.node = node; this.weight = weight; } @Override public int compareTo(Object o) { return this.weight - ((Pair)o).weight; } } public static void main(String [] args){ PriorityQueue&lt;Pair&gt; pq = new PriorityQueue&lt;Pair&gt;(); pq.add(new Pair(2,3)); pq.add(new Pair(2,3)); } } But, if the weight data type will be long or double how to handle for sorting priorityQueue regarding this case? Need Help! Thanks in advance.
has comment: http://stackoverflow.com/comment/41677006
has title: Sorting in PriorityQueue regaring second item which is long or double data type in Java
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41677105
tagged with: priority-queue
accepted answer: http://stackoverflow.com/a/26524522
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41676782
tagged with: java
downvote count: 1

http://stackoverflow.com/q/26560570
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: file
upvote count: 1
tagged with: mapreduce
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/26567630
tagged with: hadoop
downvote count: 0
accepted answer: http://stackoverflow.com/a/26567630
has body: Note : I have gone through posts with similar problems here already and tried different approaches suggested there, but still unable to fix the problem. I want to add a file which is in HDFS to cache memory of the mappers, so I added it in the driver program as given below : //Driver program public static void main(String[] args) throws Exception { Job job = Job.getInstance(new Configuration(), "QuestionOne"); Configuration conf = job.getConfiguration(); // I am passing my file path(which is in HDFS) as an argument. Eg : /input/users.dat job.addCacheFile(new URI(args[1])); job.setJarByClass(QuestionOne.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); ... System.exit(job.waitForCompletion(true) ? 0 : 1); } Followed by map class to retrieve the file &amp; use it as : public static class Map extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt;{ protected void setup(Context context) throws IOException, InterruptedException { ... URI[] files = context.getCacheFiles(); for(URI p : files) { System.out.println(p.getPath().toString()); // prints "/input/users.dat" // Exception (FileNotFoundException) at this line BufferedReader br = new BufferedReader(new FileReader(new File(p.getPath().toString()))); // Use br br.close(); } } protected void map(LongWritable key, Text value, Context context ) throws IOException, InterruptedException { ... ... } protected void cleanup(Context context) throws IOException, InterruptedException { ... ... } } But I get FileNotFoundException when I run the program as given below : 14/10/25 03:00:29 WARN mapred.LocalJobRunner: job_local30078493_0001 java.lang.Exception: java.io.FileNotFoundException: /input/users.dat (No such file or directory) at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522) Caused by: java.io.FileNotFoundException: /hw1_input/users.dat (No such file or directory) at java.io.FileInputStream.op…
answer count: 1
favorite count: 0
has title: FileNotFoundException while adding file in cache - Hadoop - Mapreduce

http://stackoverflow.com/comment/41909994
type: AnswerComment
comment on: http://stackoverflow.com/a/26653073
type: Comment
score: 0
has text: it wont change until you learn the right way... please read about servlet and jsp

http://stackoverflow.com/a/26653147
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26653006
has body: I would suggest to use hashmap to store name as key and arraylist of integers as value like Map&lt;String, ArrayList&lt;Integer&gt;&gt; volunteerNamesAndHoursMap = new HashMap&lt;String, ArrayList&lt;Integer&gt;&gt;();

http://stackoverflow.com/comment/41690321
type: Comment
comment on: http://stackoverflow.com/a/26531729
has text: What do you mean by low quality?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41749730
has text: Why did someone come in and downvote all the answers all of a sudden? They were +1
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26565105
type: QuestionComment

http://stackoverflow.com/q/26598914
has comment: http://stackoverflow.com/comment/41812314
has comment: http://stackoverflow.com/comment/41812355
favorite count: 0
tagged with: spring
score: 2
type: AnsweredQuestion
downvote count: 0
type: Question
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/41812265
accepted answer: http://stackoverflow.com/a/26598971
tagged with: servlets
upvote count: 2
has title: No WebApplicationContext found: not in a DispatcherServlet request
has body: I have a Spring application. For some reasons, I have a standard servlet and I need that servlet to be able to access to some spring beans (I know that this is not ideal, and I will be looking for something better in the future). in Web.xml mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 true mvc-dispatcher / Tunnel servlet. Tunnel com.something.GuacamoleController Tunnel /path and GuacamoleController public class GuacamoleController extends GuacamoleHTTPTunnelServlet { @Override protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException { WebApplicationContext webApplicationContext = RequestContextUtils.getWebApplicationContext(request); [...] } } But it is throwing this error: java.lang.IllegalStateException: No WebApplicationContext found: not in a DispatcherServlet request? How can I make this case a DispatcherServlet request ? I need the Web Application Context so I can manually access to a instance of a service with getBean method
has comment: http://stackoverflow.com/comment/41812344
answer count: 1
has answer: http://stackoverflow.com/a/26598971

http://stackoverflow.com/q/26619566
type: AnsweredQuestion
has body: I want to save a file before closing my JavaFX application. This is how I'm setting up the handler in Main::start: primaryStage.setOnCloseRequest(event -&gt; { System.out.println("Stage is closing"); // Save file }); And the controller calling Stage::close when a button is pressed: @FXML public void exitApplication(ActionEvent event) { ((Stage)rootPane.getScene().getWindow()).close(); } If I close the window clicking the red X on the window border (the normal way) then I get the output message "Stage is closing", which is the desired behavior. However, when calling Controller::exitApplication the application closes without invoking the handler (there's no output). How can I make the controller use the handler I've added to primaryStage?
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/52234104
type: Question
tagged with: javafx-8
has answer: http://stackoverflow.com/a/52236043
tagged with: handler
downvote count: 0
has answer: http://stackoverflow.com/a/26620713
accepted answer: http://stackoverflow.com/a/26620713
favorite count: 0
has answer: http://stackoverflow.com/a/52234104
has title: JavaFX: Stage close handler
score: 67
answer count: 4
upvote count: 67
has answer: http://stackoverflow.com/a/64870741

http://stackoverflow.com/a/26630299
has body: The problem is that nextInt() leaves behind a new line character which will be gobbled by the nextLine() in the first iteration. So, you feel that the array size is one less. Actually, your first element of the array i.e, 0th index will have a new line character. Your code should be : System.out.println("How many names do you want to enter?"); int num = scan.nextInt(); // leaves behind a new line character System.out.println("Enter " + num + " Names:"); String names[] = new String[num]; scan.nextLine() // to read the new line character left behind by scan.nextInt()
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26630221
downvote count: 0
score: 1

maven
tags question: http://stackoverflow.com/q/26600761
tags question: http://stackoverflow.com/q/26620165
tags question: http://stackoverflow.com/q/26539094
tags question: http://stackoverflow.com/q/26564198
tags question: http://stackoverflow.com/q/26572608
tags question: http://stackoverflow.com/q/26609058
tags question: http://stackoverflow.com/q/26659584
tags question: http://stackoverflow.com/q/26543490
tags question: http://stackoverflow.com/q/26640042
tags question: http://stackoverflow.com/q/26637261
tags question: http://stackoverflow.com/q/26569240
tags question: http://stackoverflow.com/q/26563107
tags question: http://stackoverflow.com/q/26588785
tags question: http://stackoverflow.com/q/26551554
type: Tag
tags question: http://stackoverflow.com/q/26668186
tags question: http://stackoverflow.com/q/26585190
tags question: http://stackoverflow.com/q/26661734
tags question: http://stackoverflow.com/q/26515987
tags question: http://stackoverflow.com/q/26627170
tags question: http://stackoverflow.com/q/26616723
tags question: http://stackoverflow.com/q/26535530
tags question: http://stackoverflow.com/q/26566160
tags question: http://stackoverflow.com/q/26669129
tags question: http://stackoverflow.com/q/26672450
tags question: http://stackoverflow.com/q/26577575
tags question: http://stackoverflow.com/q/26551682
tags question: http://stackoverflow.com/q/26651032
tags question: http://stackoverflow.com/q/26640025
tags question: http://stackoverflow.com/q/26627387
tags question: http://stackoverflow.com/q/26573886
tags question: http://stackoverflow.com/q/26652800
tags question: http://stackoverflow.com/q/26641797
tags question: http://stackoverflow.com/q/26538703
tags question: http://stackoverflow.com/q/26557828
tags question: http://stackoverflow.com/q/26603420
tags question: http://stackoverflow.com/q/26642617
tags question: http://stackoverflow.com/q/26559830
tags question: http://stackoverflow.com/q/26562137
tags question: http://stackoverflow.com/q/26568218
tags question: http://stackoverflow.com/q/26521259
tags question: http://stackoverflow.com/q/26516202
tags question: http://stackoverflow.com/q/26520209
tags question: http://stackoverflow.com/q/26652422
tags question: http://stackoverflow.com/q/26630762
tags question: http://stackoverflow.com/q/26544433
tags question: http://stackoverflow.com/q/26609879
tags question: http://stackoverflow.com/q/26543839
tags question: http://stackoverflow.com/q/26644373
tags question: http://stackoverflow.com/q/26672168
tags question: http://stackoverflow.com/q/26535465
tags question: http://stackoverflow.com/q/26526335
tags question: http://stackoverflow.com/q/26667375
tags question: http://stackoverflow.com/q/26622228
tags question: http://stackoverflow.com/q/26587085
tags question: http://stackoverflow.com/q/26557940
tags question: http://stackoverflow.com/q/26656421
tags question: http://stackoverflow.com/q/26652192
tags question: http://stackoverflow.com/q/26633168
tags question: http://stackoverflow.com/q/26584327
tags question: http://stackoverflow.com/q/26574004
tags question: http://stackoverflow.com/q/26659457
tags question: http://stackoverflow.com/q/26641587
tags question: http://stackoverflow.com/q/26594277
tags question: http://stackoverflow.com/q/26527763
tags question: http://stackoverflow.com/q/26540161
tags question: http://stackoverflow.com/q/26522553
tags question: http://stackoverflow.com/q/26547332
tags question: http://stackoverflow.com/q/26521350
tags question: http://stackoverflow.com/q/26582966
tags question: http://stackoverflow.com/q/26555543
tags question: http://stackoverflow.com/q/26551718
tags question: http://stackoverflow.com/q/26614144
tags question: http://stackoverflow.com/q/26611510
tags question: http://stackoverflow.com/q/26573258
tags question: http://stackoverflow.com/q/26590431
tags question: http://stackoverflow.com/q/26621703
tags question: http://stackoverflow.com/q/26638862
tags question: http://stackoverflow.com/q/26552848
tags question: http://stackoverflow.com/q/26654267

global
type: Tag
tag name: global
tags question: http://stackoverflow.com/q/26620500

http://stackoverflow.com/a/26581263
has comment: http://stackoverflow.com/comment/41779222
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26581134
downvote count: 0
has comment: http://stackoverflow.com/comment/41779413
has body: BETWEEN expects its arguments to have a type that is compatible with the column being tested. Giving it string arguments for a date column won't work. You could add a function to the SQL in order to convert the string to a date (I don't know what database you're using, this example uses Oracle's to_date function): from tableA.time BETWEEN to_date(?, 'yyyy/mm/dd') AND to_date(?, 'yyyy/mm/dd') Alternatively you could leave the SQL alone and use setDate on the PreparedStatement, like: setDate(1, new SimpleDateFormat("yyyy/MM/dd").parse(startDate)); This second way is more usual, it has the advantage of avoiding having to add a date-conversion function (that may be non-standard) to your SQL. But you would have to do the conversion on one side or the other. The database's SQL parser won't convert it for you. If the database took responsibility for the conversion and there was a mistake it could introduce data errors silently, the less error-prone alternative is for the application developer to tell the database how the date string should be converted.
score: 1

http://stackoverflow.com/q/26601057
has comment: http://stackoverflow.com/comment/41816198
tagged with: parsing
has title: Validating a double to be between two values and GUI opens two JFrames
has comment: http://stackoverflow.com/comment/41816087
has body: so I have been writing a program that takes user input for employee data and adds it to an ArrayList for display. The program is working fine except for two points. The first is that I am trying to validate that the user entered an hourly rate between $6 and $160. Here is the code for that: try{ double r = Double.parseDouble(rate.getText()); if (r &gt;= 6 &amp;&amp; r &lt;= 150){ test.setRate(r); } } catch(NumberFormatException e){ JOptionPane.showMessageDialog(null, "Sorry, hourly rate must be between $6 and $150."); return; } It does validate that it is between those values, but if it is not it simply sets it to 0 rather than display the message to the user and return out of the method. My second problem is a little more complex, and to be honest I am completely lost. When I run the program to test or to debug it opens two windows. The primary window is completely blank but controls the EXIT_ON_CLOSE command while the second has everything that I coded into it. I have tried searching for a second JFrame that might have been initialized but cannot find one. I have a larger amount of code and am not sure what might be needed but here is the code that I believe is causing the problem based off of the behavior: face = new JFrame(); face.setSize(300,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GroupLayout design = new GroupLayout(face.getContentPane()); face.setLayout(design); face.setVisible(true); design.setAutoCreateGaps(true); design.setAutoCreateContainerGaps(true); design.setVerticalGroup ( design.createSequentialGroup() .addGroup(design.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fName) .addComponent(first) .addComponent(list)) .addGroup(design.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(lName) .addComponent(last)) .addGroup(design.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(hWork) .addComponent(hours)) .addGroup(design.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(hRate) …
answer count: 2
tagged with: swing
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41816132
has answer: http://stackoverflow.com/a/26601157
linked to: http://stackoverflow.com/q/9554636
type: AnsweredQuestion
tagged with: validation
possible better answer: http://stackoverflow.com/a/26601147
has answer: http://stackoverflow.com/a/26601147
has comment: http://stackoverflow.com/comment/41816231
type: Question
accepted answer: http://stackoverflow.com/a/26601157

http://stackoverflow.com/q/26519867
has comment: http://stackoverflow.com/comment/41673317
answer count: 2
possible better answer: http://stackoverflow.com/a/26539150
has answer: http://stackoverflow.com/a/26539150
favorite count: 0
has answer: http://stackoverflow.com/a/26539985
has comment: http://stackoverflow.com/comment/41705528
tagged with: android
tagged with: datetime
type: AnsweredQuestion
has title: How to convert ISO8601 format into milliseconds?
tagged with: java
accepted answer: http://stackoverflow.com/a/26539985
downvote count: 1
type: Question
score: 9
has comment: http://stackoverflow.com/comment/41705505
has comment: http://stackoverflow.com/comment/41669067
upvote count: 10
has body: I'm pretty surprised that I haven't yet found a really easy way considering how often ISO8601 is used in JSON. Basically, I'm taking a string that looks like this: 2014-10-23T00:35:14.800Z and converting it into something like 50 minutes ago. First, I have to change 2014-10-23T00:35:14.800Zto 2014-10-23'T'00:35:14.800Z, then I need to convert it to milliseconds, then it is easy. My current code: private void setTimestamp(String timeCreated) { int indexOfT = timeCreated.indexOf('T'); String properFormat = new StringBuilder(timeCreated).insert(indexOfT + 1, "'") .insert(indexOfT, "'") .toString(); timeStamp = (String) DateUtils.getRelativeTimeSpanString(Long.parseLong(properFormat), System.currentTimeMillis(), DateUtils.SECONDS_IN_MILLIS); } The culprit is Long.parseLong(properFormat). I need to convert properFormat into milliseconds.
has comment: http://stackoverflow.com/comment/41669135

http://stackoverflow.com/comment/41740777
comment on: http://stackoverflow.com/a/26559772
type: AnswerComment
score: 0
type: Comment
has text: remember, 0b11 is just binary for the decimal value 3. Rather than typing 11111111, try 255 ;-).

http://stackoverflow.com/q/26640632
type: Question
has body: I'm new to java but have a lot of experience with C#. I'm thinking of creating a client side minecraft plugin that will turn the player exactly 90 degrees when a key is pressed. I've only ever seen this done with custom clients like darkbot and never actual plugins. Before I start I'd like to check that this is actually possible? (and relatively simple) Thanks, Joe
tagged with: minecraft-forge
tagged with: minecraft
answer count: 6
has title: Can a minecraft plugin control the player?
has answer: http://stackoverflow.com/a/27009349
accepted answer: http://stackoverflow.com/a/26719248
has answer: http://stackoverflow.com/a/32027894
has comment: http://stackoverflow.com/comment/41889601
has comment: http://stackoverflow.com/comment/41890813
upvote count: 1
possible better answer: http://stackoverflow.com/a/27009349
has answer: http://stackoverflow.com/a/26643963
has answer: http://stackoverflow.com/a/26719248
has comment: http://stackoverflow.com/comment/42028643
has answer: http://stackoverflow.com/a/57751810
has answer: http://stackoverflow.com/a/56288121
score: -3
downvote count: 4
type: AnsweredQuestion
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/41892340
score: 1
has text: Your post does not contain a question at all. Neither did you attach useful, complete method source code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26642860

http://stackoverflow.com/comment/41760948
comment on: http://stackoverflow.com/q/26570738
score: 0
has text: no in the separate thread I just calculate other things,GUI-Stuff is done from the EDT....
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26621440
has comment: http://stackoverflow.com/comment/41853534
downvote count: 0
has comment: http://stackoverflow.com/comment/41853325
has comment: http://stackoverflow.com/comment/41853503
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41853340
has comment: http://stackoverflow.com/comment/41853337
score: 2
answers question: http://stackoverflow.com/q/26621394
has comment: http://stackoverflow.com/comment/41853500
has body: while((usStatus != 'y') || (usStatus != 'Y')) That can only terminate if usStatus is simultaneously equal to both 'y' and 'Y'. It should be: while (usStatus != 'y' &amp;&amp; usStatus != 'Y')

http://stackoverflow.com/q/26563954
downvote count: 1
type: Question
has body: This weeks assignment in programming is to compute Pi in java using this as the basis for the assignment: (for 80% of the marks): USING A WHILE OR A DO-WHILE LOOP write a program to compute PI using the following equation: PI = 3 + 4/(2*3*4) - 4/(4*5*6) + 4/(6*7*8) - 4/(8*9*10) + ... Allow the user to specify the number of terms (5 terms are shown) to use in the computation. Each time around the loop only one extra term should be added to the estimate for PI. (for 20% of the marks): Alter your solution from part one so that the user is allowed to specify the precision required between 1 and 8 digits (i.e. the number of digits which are correct; e.g. to 5 digits PI is 3.14159), rather than the number of terms. The condition on the loop should be altered so that it continues until the required precision is obtained. Note that you need only submit this second version of the program (assuming you have it working). I'm only able to use the above method to compute Pi, as thats what the lecturer wants. Ive got this so far, although the code keeps giving me the same wrong answer for every even number and a different wrong answer for each odd number. Im still on part one as i havent got the right answer yet to be able to progress onto part 2. All help would be great, as the program needs to be submitted by tueday. Thanks in advance! import java.util.Scanner; public class ComputePI { public static void main(String[] args) { System.out.print( "Please enter the amount of decimal " + "digits of PI, you would like to set it too"); Scanner termScan = new Scanner( System.in ); int term = termScan.nextInt(); termScan.close(); double pi = 3.0; int loopCount = 2; int number = 2; while ( loopCount &lt;= term ) { if (loopCount % 2 == 0) { pi = pi + ( 4.0/ ((number) * (number+1) * (number+2)) ); } else { pi = pi - ( 4.0 / ((number) * (number+1) * (number+2)) ); } number = number + 2; loopCount++; } System.out.print( "The Value of Pi in " + term + " terms is equal to " + pi); } }
tagged with: pi
has answer: http://stackoverflow.com/a/26564157
answer count: 2
has comment: http://stackoverflow.com/comment/41747726
has comment: http://stackoverflow.com/comment/123836032
tagged with: variable-assignment
favorite count: 0
accepted answer: http://stackoverflow.com/a/26564157
has answer: http://stackoverflow.com/a/26564127
type: AnsweredQuestion
upvote count: 2
tagged with: scientific-computing
score: 1
tagged with: java
has title: Computing Pi in Java
possible better answer: http://stackoverflow.com/a/26564127
linked to: http://stackoverflow.com/q/52283039
has comment: http://stackoverflow.com/comment/41747613

http://stackoverflow.com/a/26527856
has comment: http://stackoverflow.com/comment/41708239
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41685986
has body: I'd like to suggest the following optimisations which may address your "sick slow" issue. Compute the length once during construction, as this will not change. Flatten the NodeList instances into a primitive array during construction so item() does not have to do as much work. Assumptions Lists are not required to be dynamic, i.e. DOM changes not reflected in lists, this is likely as I don't think results returned by getElementsByTagName() are dynamic anyway Documents are relative small so that extra memory isn't an issue. There are lots of reads later on meaning extra work during construction has a return on investment. Code public static NodeList join(final NodeList... lists) { int count = 0; for (NodeList list : lists) { count += list.getLength(); } final int length = count; Node[] joined = new Node[length]; int outputIndex = 0; for (NodeList list : lists) { for (int i = 0, n = list.getLength(); i &lt; n; i++) { joined[outputIndex++] = list.item(i); } } class JoinedNodeList implements NodeList { public int getLength() { return length; } public Node item(int index) { return joined[index]; } } return new JoinedNodeList(); }
has comment: http://stackoverflow.com/comment/41707848
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26527191
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26527191
has comment: http://stackoverflow.com/comment/41683908
type: Answer

http://stackoverflow.com/a/26570072
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41787548
accepted answer of: http://stackoverflow.com/q/26545530
answers question: http://stackoverflow.com/q/26545530
has body: for anyone interested: i tried what @TerryStorm suggested in a small program with only a button, and each time the button is clicked a box is added private void addCBActionPerformed(java.awt.event.ActionEvent evt) { JCheckBox box=new JCheckBox("add"); box.setVisible(true); jPanel1.add(box); jPanel1.updateUI(); }
has comment: http://stackoverflow.com/comment/41783700
score: 0

http://stackoverflow.com/q/26653355
has body: I'm wrote a method to simulate a coin toss, however, I do not know how to call this method in the main. Tips would really be appreciated! (Here is the method, I didn't post the entire code because there are 8 other methods in this code). public static boolean headsOrTails() { boolean coinState; if (Math.random() &lt; 0.5) {//heads 50% of the time coinState = true; //heads } else { coinState = false; //tails } return coinState; }
has answer: http://stackoverflow.com/a/26653406
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41909794
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/50474040
has title: calling boolean method, heads or tails
score: -1
accepted answer: http://stackoverflow.com/a/26653406
tagged with: boolean
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/26653383
has comment: http://stackoverflow.com/comment/41909842
has answer: http://stackoverflow.com/a/26653383

http://stackoverflow.com/q/26672189
downvote count: 0
score: 1
tagged with: birt
type: Question
has title: BIRT boxes format in BIRT report
tagged with: java
tagged with: javascript
has answer: http://stackoverflow.com/a/26709979
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has body: is there any way to have a word in a boxes format where each character comes in a box for report. I am using 3.7 version. [h][e][l][l][0] I am showing by square brackets. but it should be single field (square boxes) in the report. Usually for account numbers in forms are reported like this. Waiting for your replies.

http://stackoverflow.com/a/26556360
accepted answer of: http://stackoverflow.com/q/26556240
type: Answer
answers question: http://stackoverflow.com/q/26556240
upvote count: 1
score: 1
type: AcceptedAnswer
has body: . My question is how would I update my textarea to reflect this change, as further text has been appended to the textarea so it can not simply be erased. Then you need to keep track of the offset of the "price value" when you add the text. Then when you want to reset the value you can just reset that piece of text. Maybe something like: JTextArea outputText = new JTextArea(totalPrice); int offset = outputText.getDocument.getLength() - 1; ... price++; outputText.replaceRange("" + price, offset, offset + 1); Or another approach is to remove the first line and then add it back into the document. Something like: Document doc = outputText.getDocument(); int start = outputText.getLineStartOffset(); int end = outputText.getLineEndOffset(); doc.remove(start, end - start); doc.insertString(0, "your new text here", null);
downvote count: 0

http://stackoverflow.com/q/26515171
upvote count: 1
tagged with: swing
tagged with: design-patterns
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26515260
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41660276
has body: I often see people write inner classes for listeners take swing for example. button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //some action } }); At my uni there is a lot of emphasis on designs being decoupled using design patterns such as MCV or MVP. When would I want to use an inner class over a decoupled way of doing it? My only guess is when objects don't need to interact? (Or laziness??) (Student)
favorite count: 0
has title: When to use inner classes over decoupled design?
has answer: http://stackoverflow.com/a/26515975
linked to: http://stackoverflow.com/q/26517856
possible better answer: http://stackoverflow.com/a/26515975
has answer: http://stackoverflow.com/a/26515260
has comment: http://stackoverflow.com/comment/41665649

http://stackoverflow.com/comment/41833247
type: Comment
comment on: http://stackoverflow.com/q/26610242
has text: Your examples seem to contradict each other, but what you probably want is a map.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26518712
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26518845
has answer: http://stackoverflow.com/a/26518845
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/26518848
tagged with: event-handling
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41666917
accepted answer: http://stackoverflow.com/a/26518848
has title: JavaFX Eventhandler on several objects
has body: I did a JavaFX Application with a gridpane containing Rectangles: private GridPane addGridPane() { GridPane grid = new GridPane(); grid.setHgap(2); grid.setVgap(2); grid.setPadding(new Insets(0, 0, 10, 0)); int rows = 5; int cols = 5; for(int i=1; i&lt;=rows; i++) { for(int j=1; j&lt;=cols; j++) { r = new Rectangle(70, 70, Color.AQUA); grid.add(r, j, i); } } return grid; } Now I want a Rectangle to be filled red, when the mouse is clicked on that Rectangle. For that I tried to put that into the second for loop: r = new Rectangle(70, 70, Color.AQUA); r.setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent t) { r.setFill(Color.RED); } }); grid.add(r, j, i); It seems, that every Rectangle has it's EventHandler, but only the last Rectangle is filled red. Is there a problem with the Event Target?

http://stackoverflow.com/q/26623129
score: 17
has comment: http://stackoverflow.com/comment/67766605
upvote count: 17
type: Question
tagged with: linkedhashmap
tagged with: hashmap
has body: What are the practical scenario for choosing among the linkedhashmap and hashmap? I have gone through working of each and come to the conclusion that linkedhashmap maintains the order of insertion i.e elements will be retrieved in the same order as that of insertion order while hashmap won't maintain order. So can someone tell in what practical scenarios selection of one of the collection framework and why?
has answer: http://stackoverflow.com/a/26623216
tagged with: data-structures
has answer: http://stackoverflow.com/a/26623217
tagged with: types
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/78498911
favorite count: 0
has title: When to use linkedhashmap over hashmap in java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67563580
has answer: http://stackoverflow.com/a/26623367
has answer: http://stackoverflow.com/a/26623160
linked to: http://stackoverflow.com/q/23772102
has comment: http://stackoverflow.com/comment/72174220
linked to: http://stackoverflow.com/q/2889777
tagged with: java
has answer: http://stackoverflow.com/a/26623263

http://stackoverflow.com/a/26648811
score: 0
answers question: http://stackoverflow.com/q/26648552
type: Answer
has body: There is no way to do this since there is no way to tell Netbeans to attach the debugger to the script from your Java code. But this answer contains a workaround so you can set breakpoints: https://stackoverflow.com/a/23511693/34088

http://stackoverflow.com/q/26549300
has body: I'm trying to create a method that return with all values in the selected column in mysql so can anyone tell me the used method in java this method returns with just the first value in the column :: public ArrayList&lt;String&gt; GetChair(String Class) throws SQLException{ openconnection(); String querychair = "SELECT * FROM hema.flight_usa WHERE free = 1 and class='"+Class+"'"; Statement stm=(Statement) con.createStatement(); ResultSet rs; rs = stm.executeQuery(querychair); if(rs.next()){ arr.add(rs.getString("chair_id")); } return arr; }
has title: How to get all values in one column in mysql
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41721308
possible better answer: http://stackoverflow.com/a/26549400
has answer: http://stackoverflow.com/a/26549401
has answer: http://stackoverflow.com/a/26549400
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26549401
has comment: http://stackoverflow.com/comment/41721551
has comment: http://stackoverflow.com/comment/41721175
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41721501
has comment: http://stackoverflow.com/comment/41721291
tagged with: java

http://stackoverflow.com/q/26582859
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/26583532
tagged with: java
has answer: http://stackoverflow.com/a/26583514
tagged with: memory
has title: Reducing Java heap size
type: Question
accepted answer: http://stackoverflow.com/a/26583514
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26583059
linked to: http://stackoverflow.com/q/4952568
tagged with: heap-memory
answer count: 3
tagged with: profiling
has body: I have an application that uses a lot of memory diff'ing the contents of two potentially huge (100k+) directories. It makes sense to me that such an operation would use a lot of memory, but once my diff'ing operation is done, the heap remains the same size. I basically have code that instantiates a class to store the filename, file size, path, and modification date for each file on the source and target. I save the additions, deletions, and updates in other arrays. I then clear() my source and target arrays (which could be 100k+ each by now), leaving relatively small additions, deletions, and updates arrays left. After I clear() my target and source arrays though, the memory usage (as visible via VirtualVM and Windows Task Manager) doesn't drop. I'm not experienced enough with VirtualVM (or any profiler for that matter) to figure out what is taking up all this memory. VirtualVM's heap dump lists the top few objects with a retained size of a few megabytes. Anything to help point me in the right direction?
has comment: http://stackoverflow.com/comment/41782377
has comment: http://stackoverflow.com/comment/41782617
upvote count: 3
has answer: http://stackoverflow.com/a/26583532

http://stackoverflow.com/comment/41940012
type: Comment
comment on: http://stackoverflow.com/a/26668608
has text: You need to create the appropriate path, but the process is the same
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41923512
type: Comment
comment on: http://stackoverflow.com/a/26660015
has text: For standard UI updation you have to update your UI components at `onResume()` of your Activity if your Activity is in Pause mode and for standard data changes you have to make interface for that.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41725142
has text: So its no longer a maven plugin problem, but Tomcat and AWS :) - There's a quite lengthy discussion on logging on AWS Elastic Beanstalk on the AWS forums, and I suggest you look there. Usual suspects include classpath hell and the way AWS Patches tomcat (hint: look under /var/log/eb-*)
comment on: http://stackoverflow.com/q/26538703
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41786720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26585209
has text: @JoãoMendes Question is about counting class instances, not counting classes! I don't see how a custom classloader would help here?
score: 0

http://stackoverflow.com/q/26620934
accepted answer: http://stackoverflow.com/a/26621000
upvote count: 0
score: -1
tagged with: inheritance
has comment: http://stackoverflow.com/comment/41852625
has answer: http://stackoverflow.com/a/26621074
has title: Inheritance in Java - 2 Classes
favorite count: 0
possible better answer: http://stackoverflow.com/a/26621074
has answer: http://stackoverflow.com/a/26621000
has comment: http://stackoverflow.com/comment/41852483
downvote count: 1
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26622220
tagged with: java
has comment: http://stackoverflow.com/comment/41852500
has answer: http://stackoverflow.com/a/26621117
has comment: http://stackoverflow.com/comment/41852495
has body: So I have 2 classes one called 'planets' and another called 'sun'. The sun class is the parent class and the planets class is the sub-class meaning this class is going to be inheriting elements from sun class. I'm having trouble accessing and changing variables I've initialised in my parent class that I'm trying to copy + modify in sub-class. Sun's variables: size, colour //This is what I've tried: public class Planets extends Sun { public Planets (Sun sunClass) { sunClass.size=10; sunClass.colour="BLUE"; } } //This is what's in Sun class: public class Sun { public double size; public String colour; public Sun(double size, String colour) { this.size = size; this.colour = colour; } } Just assume that there are other classes involved that contain more details but aren't part of the issue I'm having.
has comment: http://stackoverflow.com/comment/41853249
has comment: http://stackoverflow.com/comment/41852711
has comment: http://stackoverflow.com/comment/41852526
type: Question

http://stackoverflow.com/q/26638196
type: Question
tagged with: encoding
has body: I have a server that does create a hash using the following code: base64_encode(md5("some value", true)) What I have to do is to produce the same hash value in Clojure (using Java interop). What I did is to create the following Clojure functions: (defn md5-raw [s] (let [algorithm (java.security.MessageDigest/getInstance "MD5") size (* 2 (.getDigestLength algorithm))] (.digest algorithm (.getBytes s)))) (defn bytes-to-base64-string [bytes] (String. (b64/encode bytes) "UTF-8")) Then I use that code that way: (bytes-to-base64-string (md5-raw "some value") Now, everything works fine with normal strings. However, after processing multiple different examples, I found the the following character is causing issues: ’ This is the UTF-8 character #8217. If I run the following PHP code: base64_encode(md5("’", true)) What is returned is: yOy9/y97p/GfapveLVQAHA== If I run the following Clojure code: (bytes-to-base64-string (md5-raw "’")) I get the following value: aF1ZConzUtEGRN2YXaKpoQ== Why is that? I am suspecting a character encoding issue, but everything appears to be handled as UTF-8 as far as I can see.
has comment: http://stackoverflow.com/comment/41883987
accepted answer: http://stackoverflow.com/a/26638528
answer count: 1
has title: Different results for raw MD5 base64 encoded string between PHP and Clojure (Java) code for some characters
score: 0
has answer: http://stackoverflow.com/a/26638528
tagged with: utf-8
tagged with: clojure
tagged with: php
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41884190

http://stackoverflow.com/q/26527191
has comment: http://stackoverflow.com/comment/41681794
has comment: http://stackoverflow.com/comment/41681836
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/26527856
type: Question
type: AnsweredQuestion
tagged with: java
has body: I want to concatenate two node lists and get a new node list. At the moment my XML documents look like this: First XML: <...> <...> <...> <...> Second XML: <value3> <...> <value4> <...> <value3> <...> <value4> <...> at the moment I am only using one XML with the following: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = null; document = builder.parse(myxml.xml); NodeList values = document.getElementsByTagName("values"); NodeList days = document.getElementsByTagName("days"); and then working on the NodeList with values & days. My program is working fine. Now I create a second list, the same way, so: DocumentBuilderFactory factory2 = DocumentBuilderFactory.newInstance(); DocumentBuilder builder2 = factory2.newDocumentBuilder(); Document document2 = null; document2 = builder2.parse(myxml_second.xml); NodeList values2 = document.getElementsByTagName("values"); NodeList days2 = document.getElementsByTagName("days"); This raises the question: How can I concatenate the two lists, so that I have one list values and one list days? I need a new NodeList (type), cause my whole program works with the NodeList type. I found several threads to that problem, but nothing works or returns another type but not a NodeList. One method worked: public static NodeList join(final NodeList... lists) { class JoinedNodeList implements NodeList { public int getLength() { int len = 0; for (NodeList list : lists) { len += list.getLength(); } return len; } public Node item(int index) { for (NodeList list : lists) { if (list.getLength() > index) { return list.item(index); } else { index -= list.getLength(); } } return null; } } return new JoinedNodeList(); } Then my program works with the concatenated NodeList perfectly but it gets sick slow! I think it comes from the overwriting the two methods, cause I use them a lot in while or for loops. Without the concatenation and only one big list the program…
tagged with: concatenation
has comment: http://stackoverflow.com/comment/41681450
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26527856
has comment: http://stackoverflow.com/comment/41681641
has title: Java: Concatinate two XML NodeList
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/26549663
upvote count: 1
has answer: http://stackoverflow.com/a/26550142
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26550142
has answer: http://stackoverflow.com/a/26550520
type: Question
possible better answer: http://stackoverflow.com/a/26550347
has answer: http://stackoverflow.com/a/26549939
has answer: http://stackoverflow.com/a/26550347
has comment: http://stackoverflow.com/comment/41722261
tagged with: arrays
downvote count: 0
has title: How to get a 14 bit, two's complement value into an Integer or Short and maintain the sign in Java
tagged with: byte
has body: I have a 14 bit, two's complement value being sent to my java application form a bluetooth device in the form of a byte array. I am unable to change the format of the data sent from the bluetooth device. How do I get this value into an Integer or Short and maintain the sign? A few things I have tried are Short x = ByteBuffer.wrap(value).getShort(); Integer x = (short)(value[3] &amp; 0xff) | (short)((value[2] &lt;&lt; 8) &amp; 0xff00); The problem I think I encounter with the above code is when I receive a negative number, for example -8192 (in two's complement 10 0000 0000 0000) Because the receiving data type is 16 bits it expects the bit that negates the value to be 16 along but seen as what it actually receives is 0010 0000 0000 0000 It considers this 8192 and not -8192.
linked to: http://stackoverflow.com/q/17637179
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/41722012

http://stackoverflow.com/a/26605498
type: Answer
answers question: http://stackoverflow.com/q/26604875
has body: Here an attempt using a java.util.Set for storing the generated numbers and using the Scanner constructor, which takes a File as argument. public static void main(String[] args) throws FileNotFoundException { final Set&lt;Integer&gt; lottoResults = new HashSet&lt;&gt;(); final Random rnd = new Random(System.currentTimeMillis()); // generate numbers while (lottoResults.size() &lt; 6) { lottoResults.add(rnd.nextInt(49) + 1); } final Scanner in = new Scanner(new File("path\\to\\yourLottoFile.txt")); for (String s : in.nextLine().split(",")) { final int lottoGuess = Integer.parseInt(s); // maybe some error handling here (invalid / wrong input)? System.out.printf("The guess: %2d is %s\n", lottoGuess, (lottoResults.contains(lottoGuess) ? "correct!!!" : "incorrect")); } } An example output would look like this: The guess: 4 is incorrect The guess: 10 is incorrect The guess: 7 is incorrect The guess: 5 is incorrect The guess: 11 is correct!!! The guess: 19 is incorrect
score: 0

http://stackoverflow.com/q/26539051
has answer: http://stackoverflow.com/a/26539102
favorite count: 0
has comment: http://stackoverflow.com/comment/41703439
has comment: http://stackoverflow.com/comment/41703421
has body: Date,Lat,Lon,Depth,Mag 20000101,34.6920,-116.3550,12.30,1.21 20000101,34.4420,-116.2280,7.32,1.01 20000101,37.4172,-121.7667,5.88,1.14 20000101,-41.1300,174.7600,27.00,1.90 20000101,37.6392,-119.0482,2.40,1.03 20000101,32.1790,-115.0730,6.00,2.44 20000101,59.7753,-152.2192,86.34,1.48 20000101,34.5230,-116.2410,11.63,1.61 20000101,59.5369,-153.1360,100.15,1.62 20000101,44.7357,-110.7932,4.96,2.20 20000101,34.6320,-116.2950,9.00,1.73 I need to sort these data by each criterion I tried Double.parseDouble(array[0].split(",").[1]) but takes too much time using Selection Sort Is there any way to just sort by not using parseDouble?
duplicate of: http://stackoverflow.com/q/26533676
has answer: http://stackoverflow.com/a/26539095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41703428
upvote count: 1
has comment: http://stackoverflow.com/comment/41703418
downvote count: 1
linked to: http://stackoverflow.com/q/26533676
tagged with: java
has comment: http://stackoverflow.com/comment/41703407
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41703386
tagged with: arrays
has title: How to sort String array by its component? Java
tagged with: sorting

string
tags question: http://stackoverflow.com/q/26598923
tags question: http://stackoverflow.com/q/26544079
tags question: http://stackoverflow.com/q/26559098
tags question: http://stackoverflow.com/q/26589831
tags question: http://stackoverflow.com/q/26641809
tags question: http://stackoverflow.com/q/26649536
tags question: http://stackoverflow.com/q/26643666
tags question: http://stackoverflow.com/q/26608174
tags question: http://stackoverflow.com/q/26540742
tags question: http://stackoverflow.com/q/26663222
tags question: http://stackoverflow.com/q/26569409
tags question: http://stackoverflow.com/q/26635647
tags question: http://stackoverflow.com/q/26569261
tags question: http://stackoverflow.com/q/26622157
tags question: http://stackoverflow.com/q/26648773
tags question: http://stackoverflow.com/q/26567312
tags question: http://stackoverflow.com/q/26585709
tags question: http://stackoverflow.com/q/26627893
tags question: http://stackoverflow.com/q/26650138
tags question: http://stackoverflow.com/q/26542752
tags question: http://stackoverflow.com/q/26521282
tags question: http://stackoverflow.com/q/26534451
tags question: http://stackoverflow.com/q/26572218
tags question: http://stackoverflow.com/q/26525295
tags question: http://stackoverflow.com/q/26616756
tags question: http://stackoverflow.com/q/26670288
tags question: http://stackoverflow.com/q/26598273
tags question: http://stackoverflow.com/q/26640671
tags question: http://stackoverflow.com/q/26558741
tags question: http://stackoverflow.com/q/26664561
tags question: http://stackoverflow.com/q/26614809
tags question: http://stackoverflow.com/q/26661889
tags question: http://stackoverflow.com/q/26579300
tags question: http://stackoverflow.com/q/26527369
tags question: http://stackoverflow.com/q/26629924
tags question: http://stackoverflow.com/q/26517051
tags question: http://stackoverflow.com/q/26669419
tags question: http://stackoverflow.com/q/26516111
tags question: http://stackoverflow.com/q/26618677
tags question: http://stackoverflow.com/q/26660306
tags question: http://stackoverflow.com/q/26536182
tags question: http://stackoverflow.com/q/26555346
tags question: http://stackoverflow.com/q/26530121
tags question: http://stackoverflow.com/q/26518345
tags question: http://stackoverflow.com/q/26631078
tags question: http://stackoverflow.com/q/26532847
tags question: http://stackoverflow.com/q/26595499
tags question: http://stackoverflow.com/q/26666068
tags question: http://stackoverflow.com/q/26605151
tags question: http://stackoverflow.com/q/26593228
tags question: http://stackoverflow.com/q/26561433
tag name: string
tags question: http://stackoverflow.com/q/26568461
tags question: http://stackoverflow.com/q/26596463
tags question: http://stackoverflow.com/q/26514387
tags question: http://stackoverflow.com/q/26666827
tags question: http://stackoverflow.com/q/26664809
tags question: http://stackoverflow.com/q/26533347
tags question: http://stackoverflow.com/q/26666633
tags question: http://stackoverflow.com/q/26646944
tags question: http://stackoverflow.com/q/26560483
tags question: http://stackoverflow.com/q/26606977
tags question: http://stackoverflow.com/q/26620891
tags question: http://stackoverflow.com/q/26597152
type: Tag
tags question: http://stackoverflow.com/q/26640581
tags question: http://stackoverflow.com/q/26659486
tags question: http://stackoverflow.com/q/26618188
tags question: http://stackoverflow.com/q/26606259
tags question: http://stackoverflow.com/q/26590301
tags question: http://stackoverflow.com/q/26649327
tags question: http://stackoverflow.com/q/26524607
tags question: http://stackoverflow.com/q/26665241
tags question: http://stackoverflow.com/q/26577554
tags question: http://stackoverflow.com/q/26639808
tags question: http://stackoverflow.com/q/26625898
tags question: http://stackoverflow.com/q/26627978
tags question: http://stackoverflow.com/q/26592009
tags question: http://stackoverflow.com/q/26521840
tags question: http://stackoverflow.com/q/26572507

http://stackoverflow.com/comment/41896661
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26645467
has text: did you override your toString method?

http://stackoverflow.com/comment/41694675
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26534229
has text: @ErnestFriedman-Hill without '<''>' strays i've got `javac: invalid flag: -extdir Usage: javac <options> `

file-io
tags question: http://stackoverflow.com/q/26540358
tags question: http://stackoverflow.com/q/26579475
tags question: http://stackoverflow.com/q/26654730
tags question: http://stackoverflow.com/q/26517458
tags question: http://stackoverflow.com/q/26580692
tags question: http://stackoverflow.com/q/26541370
tags question: http://stackoverflow.com/q/26622081
type: Tag
tags question: http://stackoverflow.com/q/26595605
tags question: http://stackoverflow.com/q/26524607
tags question: http://stackoverflow.com/q/26601517
tags question: http://stackoverflow.com/q/26628497
tags question: http://stackoverflow.com/q/26518185
tags question: http://stackoverflow.com/q/26621632
tags question: http://stackoverflow.com/q/26621568
tags question: http://stackoverflow.com/q/26550664
tags question: http://stackoverflow.com/q/26598226
tags question: http://stackoverflow.com/q/26610242
tag name: file-io
tags question: http://stackoverflow.com/q/26533490
tags question: http://stackoverflow.com/q/26604184
tags question: http://stackoverflow.com/q/26621360

http://stackoverflow.com/a/26616145
type: Answer
accepted answer of: http://stackoverflow.com/q/26616026
answers question: http://stackoverflow.com/q/26616026
score: 1
upvote count: 1
has body: You must refresh the view. Use validate(); after adding the components.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41843553

http://stackoverflow.com/a/35401217
has body: I was absolutely baffled by this problem. I had tried everything in this thread, and in others, but no matter what I did I could not change the color of the underline to anything other than the default blue. I finally figured out what was going on. I was (incorrectly) using android.widget.EditText when making a new instance (but the rest of my components were from the appcompat library). I should have used android.support.v7.widget.AppCompatEditText. I replaced new EditText(this) with new AppCompatEditText(this) and the problem was instantly solved. It turns out, if you are actually using AppCompatEditText, it will just respect the accentColor from your theme (as mentioned in several comments above) and no additional configuration is necessary.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26574328
downvote count: 0
type: Answer

http://stackoverflow.com/a/26673737
type: Answer
answers question: http://stackoverflow.com/q/26671929
score: 0
has body: When using Java 8 you can let the Stream API do the work: Stream#distinct() From the JavaDoc: Returns a stream consisting of the distinct elements (according to Object.equals(Object)) of this stream. How to use: final int[] nums = new int[] {1, 2, 2, 3, 4, 4, 4}; final int sum = IntStream.of(nums) .distinct() .sum(); System.out.println(sum); // prints 10 (1 + 2 + 3 + 4);

http://stackoverflow.com/a/26524402
has comment: http://stackoverflow.com/comment/41689386
has comment: http://stackoverflow.com/comment/41688289
downvote count: 0
has comment: http://stackoverflow.com/comment/41690430
score: 1
has body: "I have tried everything, but nothings give results." In that case you are doomed since there is nothing left for us to try. But lets assume that you didn't try everything. Lets assume that documentation of Jsoup.connect() is actually telling the true, and this method is used only to create Connection to resource which should be parsed, not to parse it. Its get() method job to connect to resource from created Connection, parse it and return it as Document. So this method instead of HTML text of resource, will need information required for connection like URL. So instead of manually creating HttpURLConnection and reading its HTML code, pass string representing URL to Jsoup.connect() and then using get() connect and parse to this resource. So instead of URL url = new URL("http://consulta.muniguate.com/emetra/despliega.php?tplaca="+tplaca+"&amp;nplaca="+nplaca); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader rd = new BufferedReader(new InputStreamReader( conn.getInputStream())); String line = null; String result = ""; while ((line = rd.readLine()) != null) { result += line; } Simply use Document doc = Jsoup.connect("http://consulta.muniguate.com/emetra/despliega.php?tplaca="+tplaca+"&amp;nplaca="+nplaca).get(); Now you should be able to use String title = doc.title(); System.out.println(title);
answers question: http://stackoverflow.com/q/26523377
upvote count: 1
has comment: http://stackoverflow.com/comment/41690334
has comment: http://stackoverflow.com/comment/41690654
has comment: http://stackoverflow.com/comment/41689130
type: Answer
has comment: http://stackoverflow.com/comment/41688438

http://stackoverflow.com/a/26589784
type: Answer
upvote count: 2
has body: Creating an answer from my comment: There is no equivalent for this in java. A member function has always write access to the fields of it's class. If you want to change that behavior, you have to move the function outside the class and hand over a copy to it.
score: 2
accepted answer of: http://stackoverflow.com/q/26589536
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26589536

http://stackoverflow.com/comment/41866257
comment on: http://stackoverflow.com/a/26624969
has text: what's the other way? I'd like to see different ways.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41860509
type: Comment
comment on: http://stackoverflow.com/a/26625175
score: 1
type: AnswerComment
has text: Thanks for your answer.... but using `date` function I have achieved... +1 for the support

http://stackoverflow.com/comment/41699817
type: QuestionComment
type: Comment
score: 2
has text: This is pretty vague, general guidance/tips are and are best for your teacher or professor. Without any code shown and no actual question, this is a bit off-topic. Can you please show your current code, what you've tried so far to solve this specific problem, and ask an objective, answerable question?
comment on: http://stackoverflow.com/q/26536918

http://stackoverflow.com/comment/41848781
comment on: http://stackoverflow.com/a/26618798
has text: Yes, since you never ask for another input again (scanner.next() blocks the main thread from executing if it's run on the main thread). Simply request a new input and you're set. @Alex
score: 0
type: AnswerComment
type: Comment

servlets
tags question: http://stackoverflow.com/q/26614498
tags question: http://stackoverflow.com/q/26528081
tags question: http://stackoverflow.com/q/26592821
tags question: http://stackoverflow.com/q/26548929
tags question: http://stackoverflow.com/q/26574096
tags question: http://stackoverflow.com/q/26657104
tags question: http://stackoverflow.com/q/26594702
tags question: http://stackoverflow.com/q/26530506
tags question: http://stackoverflow.com/q/26606943
tags question: http://stackoverflow.com/q/26586518
tags question: http://stackoverflow.com/q/26592258
tags question: http://stackoverflow.com/q/26569046
tags question: http://stackoverflow.com/q/26590249
tags question: http://stackoverflow.com/q/26658715
tags question: http://stackoverflow.com/q/26670684
tags question: http://stackoverflow.com/q/26592787
tags question: http://stackoverflow.com/q/26564598
tags question: http://stackoverflow.com/q/26637045
tags question: http://stackoverflow.com/q/26534071
tags question: http://stackoverflow.com/q/26564881
tags question: http://stackoverflow.com/q/26576718
tags question: http://stackoverflow.com/q/26554015
tags question: http://stackoverflow.com/q/26590332
tags question: http://stackoverflow.com/q/26598914
tags question: http://stackoverflow.com/q/26547298
tags question: http://stackoverflow.com/q/26617553
tags question: http://stackoverflow.com/q/26541756
tags question: http://stackoverflow.com/q/26604358
tags question: http://stackoverflow.com/q/26633906
tags question: http://stackoverflow.com/q/26623311
tags question: http://stackoverflow.com/q/26637836
tags question: http://stackoverflow.com/q/26531500
tags question: http://stackoverflow.com/q/26611424
tags question: http://stackoverflow.com/q/26561858
tags question: http://stackoverflow.com/q/26590375
tags question: http://stackoverflow.com/q/26518166
tags question: http://stackoverflow.com/q/26555779
tags question: http://stackoverflow.com/q/26618637
tags question: http://stackoverflow.com/q/26630927
tags question: http://stackoverflow.com/q/26534229
tags question: http://stackoverflow.com/q/26554415
tags question: http://stackoverflow.com/q/26616239
tags question: http://stackoverflow.com/q/26515733
tags question: http://stackoverflow.com/q/26626532
tags question: http://stackoverflow.com/q/26659981
tags question: http://stackoverflow.com/q/26524067
tags question: http://stackoverflow.com/q/26539073
tags question: http://stackoverflow.com/q/26651621
tags question: http://stackoverflow.com/q/26528519
tags question: http://stackoverflow.com/q/26661120
tag name: servlets
tags question: http://stackoverflow.com/q/26548028
tags question: http://stackoverflow.com/q/26634346
tags question: http://stackoverflow.com/q/26588667
type: Tag
tags question: http://stackoverflow.com/q/26550472
tags question: http://stackoverflow.com/q/26613259
tags question: http://stackoverflow.com/q/26602095
tags question: http://stackoverflow.com/q/26640098
tags question: http://stackoverflow.com/q/26638691
tags question: http://stackoverflow.com/q/26643916
tags question: http://stackoverflow.com/q/26594346
tags question: http://stackoverflow.com/q/26580328
tags question: http://stackoverflow.com/q/26625777
tags question: http://stackoverflow.com/q/26670748
tags question: http://stackoverflow.com/q/26599657
tags question: http://stackoverflow.com/q/26660991
tags question: http://stackoverflow.com/q/26612925
tags question: http://stackoverflow.com/q/26619938

swing
tags question: http://stackoverflow.com/q/26581729
tags question: http://stackoverflow.com/q/26520487
tags question: http://stackoverflow.com/q/26596839
tags question: http://stackoverflow.com/q/26652310
tags question: http://stackoverflow.com/q/26628033
tags question: http://stackoverflow.com/q/26568974
tags question: http://stackoverflow.com/q/26627083
tags question: http://stackoverflow.com/q/26584786
tags question: http://stackoverflow.com/q/26671319
tags question: http://stackoverflow.com/q/26550559
tags question: http://stackoverflow.com/q/26591112
tags question: http://stackoverflow.com/q/26632819
tags question: http://stackoverflow.com/q/26646320
tags question: http://stackoverflow.com/q/26572105
tags question: http://stackoverflow.com/q/26556240
tags question: http://stackoverflow.com/q/26666369
tags question: http://stackoverflow.com/q/26574593
tags question: http://stackoverflow.com/q/26569682
tags question: http://stackoverflow.com/q/26596093
tags question: http://stackoverflow.com/q/26614135
tags question: http://stackoverflow.com/q/26621929
tags question: http://stackoverflow.com/q/26566484
tags question: http://stackoverflow.com/q/26545536
tags question: http://stackoverflow.com/q/26637258
tags question: http://stackoverflow.com/q/26519141
tags question: http://stackoverflow.com/q/26634819
tags question: http://stackoverflow.com/q/26556068
tags question: http://stackoverflow.com/q/26629876
tags question: http://stackoverflow.com/q/26520564
tags question: http://stackoverflow.com/q/26626048
tags question: http://stackoverflow.com/q/26556225
tags question: http://stackoverflow.com/q/26650106
tags question: http://stackoverflow.com/q/26551910
tags question: http://stackoverflow.com/q/26550488
tags question: http://stackoverflow.com/q/26616072
tags question: http://stackoverflow.com/q/26665538
tags question: http://stackoverflow.com/q/26546139
tags question: http://stackoverflow.com/q/26590456
tags question: http://stackoverflow.com/q/26553543
tags question: http://stackoverflow.com/q/26545725
tags question: http://stackoverflow.com/q/26640382
tags question: http://stackoverflow.com/q/26596270
tags question: http://stackoverflow.com/q/26579885
tags question: http://stackoverflow.com/q/26619951
tags question: http://stackoverflow.com/q/26669498
tags question: http://stackoverflow.com/q/26581332
tags question: http://stackoverflow.com/q/26621830
tags question: http://stackoverflow.com/q/26600901
tags question: http://stackoverflow.com/q/26629763
tags question: http://stackoverflow.com/q/26589225
tags question: http://stackoverflow.com/q/26564381
tags question: http://stackoverflow.com/q/26651047
tags question: http://stackoverflow.com/q/26559444
tags question: http://stackoverflow.com/q/26518671
tags question: http://stackoverflow.com/q/26601057
tags question: http://stackoverflow.com/q/26620662
tags question: http://stackoverflow.com/q/26650238
tags question: http://stackoverflow.com/q/26580954
tags question: http://stackoverflow.com/q/26629679
tags question: http://stackoverflow.com/q/26563856
tags question: http://stackoverflow.com/q/26545906
tags question: http://stackoverflow.com/q/26626756
tags question: http://stackoverflow.com/q/26671535
tags question: http://stackoverflow.com/q/26604717
tags question: http://stackoverflow.com/q/26521718
tags question: http://stackoverflow.com/q/26620853
tags question: http://stackoverflow.com/q/26549832
tags question: http://stackoverflow.com/q/26545014
tags question: http://stackoverflow.com/q/26534515
tags question: http://stackoverflow.com/q/26568411
tags question: http://stackoverflow.com/q/26636463
tags question: http://stackoverflow.com/q/26542123
tags question: http://stackoverflow.com/q/26601443
tags question: http://stackoverflow.com/q/26525341
tags question: http://stackoverflow.com/q/26605981
tags question: http://stackoverflow.com/q/26657958
tags question: http://stackoverflow.com/q/26536687
type: Tag
tags question: http://stackoverflow.com/q/26619263
tags question: http://stackoverflow.com/q/26528850

http://stackoverflow.com/comment/41819968
comment on: http://stackoverflow.com/q/26579458
type: Comment
score: 2
has text: `$v-font-size` is your starting point and next `$v-unit-size`. They both should bring you far. You could also remove all the rants in your question and make clear, if you are concerned about the visual size or the filesystem size of the generated code and i bet this question could be reopened.
type: QuestionComment

onpause
tags question: http://stackoverflow.com/q/26612823
tags question: http://stackoverflow.com/q/26669379
type: Tag
tag name: onpause

http://stackoverflow.com/comment/41752269
has text: Indeed - many new to Java forget that arrays are indexed from 0, esepcially as there are high level languages where they index from 1.
type: Comment
comment on: http://stackoverflow.com/a/26566596
score: 0
type: AnswerComment

http://stackoverflow.com/a/26605834
answers question: http://stackoverflow.com/q/26605599
downvote count: 0
has body: The TRUNCATE command is much faster on large tables because it simply nukes the files at the file system level, whereas DELETE marks each record as free without reducing file size, with any triggers defined on them being run.
type: Answer
has comment: http://stackoverflow.com/comment/41824356
has comment: http://stackoverflow.com/comment/41832653
score: 1
upvote count: 1

http://stackoverflow.com/q/26650778
has answer: http://stackoverflow.com/a/30316200
answer count: 4
tagged with: beagleboneblack
type: AnsweredQuestion
tagged with: uart
tagged with: java
accepted answer: http://stackoverflow.com/a/27952129
type: Question
has title: Access GPIO on beaglebone black using Java ME Embedded 8
possible better answer: http://stackoverflow.com/a/30316200
linked to: http://stackoverflow.com/q/27859419
has answer: http://stackoverflow.com/a/27952129
has comment: http://stackoverflow.com/comment/41905620
score: 0
has comment: http://stackoverflow.com/comment/41905448
tagged with: embedded
has answer: http://stackoverflow.com/a/35405437
has answer: http://stackoverflow.com/a/27838698
has body: I was wondering if it is possible to access the gpio, i2C, uart, etc. on the beaglebone black using Java ME embedded. I know that it is possible with the Java Native Access, but now there is an API Device I/O 1.0 wich is included in the Java ME Embedded 8. Has anyone any experience with this? I'm running debian on my beaglebone black.
tagged with: debian

http://stackoverflow.com/q/26667590
has answer: http://stackoverflow.com/a/26667653
has body: I am trying to sort a map based on word frequency (i.e., based on value). For that I have overridden comparator and passed to TreeMap, but I am getting this weird output. public class WordFrequency { public static String sentence = "one three two two three three four four four"; public static Map&lt;String, Integer&gt; map; public static void main(String[] args) { map = new HashMap&lt;&gt;(); String[] words = sentence.split("\\s"); for (String word : words) { Integer count = map.get(word); if (count == null) { count = 1; } else { ++count; } map.put(word, count); } Comparator&lt;String&gt; myComparator = new Comparator&lt;String&gt;() { @Override public int compare(String s1, String s2) { if (map.get(s1) &lt; map.get(s2)) { return -1; } else if (map.get(s1) &gt; map.get(s2)) { return 1; } else { return 0; } } }; SortedMap&lt;String, Integer&gt; sortedMap = new TreeMap&lt;String, Integer&gt;(myComparator); System.out.println("Before sorting: " + map); sortedMap.putAll(map); System.out.println("After Sorting based on value:" + sortedMap); } } Output: Before sorting: {two=2, one=1, three=3, four=3} After sorting based on value:{one=1, two=2, three=3} Expected Output: {one=1, two=2, four=3,three=3}
linked to: http://stackoverflow.com/q/109383
linked to: http://stackoverflow.com/q/22251787
tagged with: java
has comment: http://stackoverflow.com/comment/41936543
tagged with: treemap
has comment: http://stackoverflow.com/comment/41936516
type: Question
has title: While sorting the map based on value, some values are missing. What causes this weird behaviour?
downvote count: 0
has answer: http://stackoverflow.com/a/26667629
has comment: http://stackoverflow.com/comment/41936529
accepted answer: http://stackoverflow.com/a/26667653
has answer: http://stackoverflow.com/a/26667666
has comment: http://stackoverflow.com/comment/41936555
answer count: 3
possible better answer: http://stackoverflow.com/a/26667629
favorite count: 0
has comment: http://stackoverflow.com/comment/41971507
score: 6
tagged with: dictionary
has comment: http://stackoverflow.com/comment/41936584
tagged with: collections
has comment: http://stackoverflow.com/comment/41936558
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/41887723
score: 0
type: AnswerComment
type: Comment
has text: Thanks! I should really stop coding when im too tired. Something stupid like this had to lie somewhere around.
comment on: http://stackoverflow.com/a/26639775

http://stackoverflow.com/a/26648014
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26644853
has body: Set the scale with the rounding mode you like, and include the values in the format string as strings, using BigDecimal#toString().
has comment: http://stackoverflow.com/comment/41901577

http://stackoverflow.com/comment/41673365
type: QuestionComment
has text: To be honest, I have no idea. Think I picked up somewhere that it had to do that to implement changes to the main class of the app, holding the main view. I started with java yesterday, so a bit new to me
score: 0
comment on: http://stackoverflow.com/q/26522274
type: Comment

http://stackoverflow.com/q/26548505
has answer: http://stackoverflow.com/a/54904108
possible better answer: http://stackoverflow.com/a/29520193
has answer: http://stackoverflow.com/a/50387256
answer count: 40
has answer: http://stackoverflow.com/a/70948107
favorite count: 0
has answer: http://stackoverflow.com/a/60533307
has answer: http://stackoverflow.com/a/26549096
has answer: http://stackoverflow.com/a/70557372
has answer: http://stackoverflow.com/a/51435892
has answer: http://stackoverflow.com/a/29520193
has answer: http://stackoverflow.com/a/40017651
upvote count: 385
has answer: http://stackoverflow.com/a/48171160
has answer: http://stackoverflow.com/a/53917048
has answer: http://stackoverflow.com/a/47658769
has answer: http://stackoverflow.com/a/43768404
has answer: http://stackoverflow.com/a/78349431
has answer: http://stackoverflow.com/a/32416796
has answer: http://stackoverflow.com/a/42307436
has answer: http://stackoverflow.com/a/66234252
has answer: http://stackoverflow.com/a/62516517
has answer: http://stackoverflow.com/a/49058986
tagged with: maven
has answer: http://stackoverflow.com/a/78714516
has answer: http://stackoverflow.com/a/35978966
has answer: http://stackoverflow.com/a/43012087
has answer: http://stackoverflow.com/a/58673555
has answer: http://stackoverflow.com/a/40641504
has answer: http://stackoverflow.com/a/49216346
has answer: http://stackoverflow.com/a/56979386
has answer: http://stackoverflow.com/a/69789018
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/72296481
has answer: http://stackoverflow.com/a/61353589
has answer: http://stackoverflow.com/a/73595196
has body: I am trying run a spring-boot application which uses hibernate via spring-jpa, but i am getting this error: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104) at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:71) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:205) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:336) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) at org.springframework.beans.factory.support.AbstractAutowireCapableB…
accepted answer: http://stackoverflow.com/a/26549096
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/33029567
has answer: http://stackoverflow.com/a/44215481
has answer: http://stackoverflow.com/a/56532729
has answer: http://stackoverflow.com/a/44231657
tagged with: jpa
has answer: http://stackoverflow.com/a/50851312
has answer: http://stackoverflow.com/a/59693641
has comment: http://stackoverflow.com/comment/127747445
has answer: http://stackoverflow.com/a/59135580
has answer: http://stackoverflow.com/a/33597750
has answer: http://stackoverflow.com/a/48844070
linked to: http://stackoverflow.com/q/33323837
score: 384
has answer: http://stackoverflow.com/a/54122970
has answer: http://stackoverflow.com/a/78648978
has title: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

http://stackoverflow.com/q/26586845
answer count: 2
has answer: http://stackoverflow.com/a/26587077
tagged with: repaint
tagged with: java-2d
tagged with: jframe
possible better answer: http://stackoverflow.com/a/26587077
tagged with: swing
has comment: http://stackoverflow.com/comment/41788777
has answer: http://stackoverflow.com/a/26586967
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41810598
has body: What I need to do is to set a variable when I close a JFrame. I have a thread in my project. I want this thread to run only if a static variable in another class is set to true. This is the class in which I would set the variable (sliderActivated): import java.awt.Container; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class ZoomSlider extends JFrame implements ChangeListener{ private static final long serialVersionUID = -9026587156796382276L; private JSlider slider; private static boolean sliderActivated = false; public ZoomSlider(){ //setSliderActivated(true); Container contentPane = getContentPane(); this.setTitle("Zoom"); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); this.setAlwaysOnTop(true); Toolkit mioToolkit = Toolkit.getDefaultToolkit(); Dimension dimensioniSchermo = mioToolkit.getScreenSize(); int larghezzaFrame, altezzaFrame; larghezzaFrame = 80; altezzaFrame = (int)(dimensioniSchermo.getHeight() - 70); this.setSize(larghezzaFrame, altezzaFrame); this.setLocation(0,50); slider = new JSlider(JSlider.VERTICAL, 50, 200, 100); slider.setMajorTickSpacing(50); slider.setMinorTickSpacing(10); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.addChangeListener(this); contentPane.add(slider); this.setVisible(true); } @Override public void stateChanged(ChangeEvent arg0) { //setSliderActivated(true); int value = ((JSlider)arg0.getSource()).getValue(); EarthPanel.SCALE = value/100.0; //setSliderActivated(false); } public static boolean isSliderActivated() { return sliderActivated; } public static void setSliderActivated(boolean sliderActivated) { ZoomSlider.sliderActivated = sliderActivated; } } and this is the run method of the thread which uses the variable: public void run() { while(true){ if(ZoomSlider.isSliderActivated()){ this.setPreferredSize(new Dimension((int)(width * SCALE),(int)(height * SC…
type: Question
linked to: http://stackoverflow.com/q/9554636
has title: Java2d - set a variable when I close a JFrame
accepted answer: http://stackoverflow.com/a/26586967
score: 0

http://stackoverflow.com/q/26617002
type: AnsweredQuestion
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/41847747
type: Question
accepted answer: http://stackoverflow.com/a/26618325
answer count: 2
downvote count: 0
favorite count: 0
has title: libGDX actor draw() not called
has body: Please forgive me for my english. Began to explore libGDX and have a problem. When I add actor on stage, method draw() not called. Tried to apply the method to draw a straight line, texture successfully drawn but it is not an actor, and this method is not correct. Help please. SpiderHunt.java package com.spiderhunt; import com.badlogic.gdx.Game; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.spiderhunt.screens.MainMenu; public class SpiderHunt extends Game{ private SpriteBatch batch; public MainMenu mainMenu; private static SpiderHunt instance = new SpiderHunt(); public SpiderHunt(){ } public static SpiderHunt getInstance() { return instance; } public void create () { //load textures Assets.load(); batch = new SpriteBatch(); mainMenu = new MainMenu(batch); this.setScreen(mainMenu); } public void showMainMenu(){ setScreen(mainMenu); } public void render (float delta) { } public void resize(int width, int height) { } public void pause() { } public void resume() { } public void dispose() { } } MainMenu.java package com.spiderhunt.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.spiderhunt.Assets; import com.spiderhunt.buttons.btnPlay; public class MainMenu implements Screen { public btnPlay playButton; public Stage stage; public SpriteBatch batch; class GoToGameListener extends ClickListener { @Override public void clicked(InputEvent event, float x, float y) { //some code for click or push } } public MainMenu(SpriteBatch batch_1) { batch = batch_1; stage = new Stage(new StretchViewport( Gdx.graphics.getWidth(), Gdx.graphics.getHeight()), batch); Gdx.input.setInputProcessor(stage); p…
tagged with: android
has comment: http://stackoverflow.com/comment/41846953
possible better answer: http://stackoverflow.com/a/26618261
score: 2
has answer: http://stackoverflow.com/a/26618325
has answer: http://stackoverflow.com/a/26618261
upvote count: 2
tagged with: stage
tagged with: actor

http://stackoverflow.com/q/26618334
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I've been struggling with this for about 3 days already and finally I decided to take a risk and ask you guys. The problem is, that I get NullPointerException as you already got from the title. With a debugger I found the source of my problems, so I know exactly what causes that nullpointer: its the variable "doc" of type Document, which you can find in the code below. Sorry for too many words, here is the code This is the code of my class DomXmlParser public class DomXmlParser { Document doc; String urlLink; InputStream is; public DomXmlParser(String url){ this.urlLink = url; } public Document getDoc(){ return doc; } public void parseXML(InputStream is) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(is); } catch (Exception e) { e.printStackTrace(); } } public void getXML(){ Thread thread = new Thread(new Runnable() { @Override public void run() { try{ URL url = new URL(urlLink); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setReadTimeout(15000); conn.setConnectTimeout(15000); conn.setDoInput(true); conn.connect(); is = conn.getInputStream(); Log.d("InputStreamContents", is.toString()); parseXML(is); is.close(); }catch(Exception e){ e.printStackTrace(); } } }); thread.start(); } } So, in MainActivity I call getXml() method and then getDoc(). public void parseDom(){ DomXmlParser parser = new DomXmlParser(xmlUrl); parser.getXML(); doc = parser.getDoc(); NodeList list = doc.getElementsByTagName("item"); for (int i = 0; i &lt; list.getLength(); i++){ Node item = list.item(i); if (item.getNodeType()==Node.ELEMENT_NODE){ Element data = (Element) item; NodeList dataList = data.getChildNodes(); for (int j = 0; j &lt; dataList.getLength(); i++){ Node p = dataList.item(j); if (p.getNodeType()==Node.ELEMENT_NODE){ Element title = (Element) p; Element description = (Element) p; FeedItem fi = new FeedItem(); fi.setN…
has answer: http://stackoverflow.com/a/26668568
answer count: 2
has answer: http://stackoverflow.com/a/26618471
downvote count: 0
possible better answer: http://stackoverflow.com/a/26668568
favorite count: 0
tagged with: android
has title: Getting a NullPointerException while trying to parse XML file using DOM
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/26618471
type: AnsweredQuestion

http://stackoverflow.com/q/26657259
upvote count: 7
has title: Hibernate and JSON - is there a definitive solution to circular dependencies?
has comment: http://stackoverflow.com/comment/123262865
has comment: http://stackoverflow.com/comment/41917625
answer count: 4
has comment: http://stackoverflow.com/comment/41921774
possible better answer: http://stackoverflow.com/a/26713717
downvote count: 0
has body: I'm struggling with Hibernate entities and JSON in these days and, although there is a lot of questions regarding the object, I'm yet not capable to serialize in presence of circular dependencies. I tried with both Gson and jackson but I didn't get a lot of progresses. Here is an excerpt from my objects. This is the "parent" class. @Entity public class User extends RecognizedServerEntities implements java.io.Serializable { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) private Integer id; @OneToMany(fetch = FetchType.LAZY, mappedBy = "user", orphanRemoval = false) @Cascade({CascadeType.SAVE_UPDATE}) private Set&lt;Thread&gt; threads = new HashSet&lt;Thread&gt;(0); //...other attributes, getters and setters } and this is the "children" class @Entity @Table(name = "thread") public class Thread extends RecognizedServerEntities implements java.io.Serializable { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) private Integer id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", nullable = true) private User user; //...other attributes, getters and setters } I've written a simple class to test both gson and jackson features; as said, they both raise an exception. public class MyJsonsTest { private static User u; public static void main(String[] args) { u = new User("mail", "password", "nickname", new Date()); u.setId(1); // Added with EDIT 1 // testGson(); testJackson(); } private static void testJackson() { Thread t = new Thread("Test", u, new Date(), new Date()); t.setId(1); // Added with EDIT 1 u.getThreads().add(t); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); try { mapper.writeValue(new File("result.json"), u); } catch {/[various exceptions catched, but a JsonMappingException was thrown]} } private static void testGson() { Gson gson = new Gson(); System.out.println(u.toString()); System.out.println(gson.toJson(u,…
has answer: http://stackoverflow.com/a/26758388
has comment: http://stackoverflow.com/comment/41916748
has answer: http://stackoverflow.com/a/26749687
linked to: http://stackoverflow.com/q/43592368
has comment: http://stackoverflow.com/comment/41928143
linked to: http://stackoverflow.com/q/26698434
has comment: http://stackoverflow.com/comment/41924594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41924568
has comment: http://stackoverflow.com/comment/41917721
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
score: 7
tagged with: gson
has comment: http://stackoverflow.com/comment/41927400
type: Question
has answer: http://stackoverflow.com/a/26713717
has comment: http://stackoverflow.com/comment/41917221
has comment: http://stackoverflow.com/comment/41927292
has comment: http://stackoverflow.com/comment/41928518
tagged with: jackson
has comment: http://stackoverflow.com/comment/41917556
favorite count: 0
has comment: http://stackoverflow.com/comment/41918145
has answer: http://stackoverflow.com/a/26729795
accepted answer: http://stackoverflow.com/a/26729795

http://stackoverflow.com/a/26668716
type: Answer
has body: Try to use following simply rather than doing it with jstl ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
answers question: http://stackoverflow.com/q/26667646
score: 0
has comment: http://stackoverflow.com/comment/41951027

http://stackoverflow.com/comment/41895678
comment on: http://stackoverflow.com/a/26644770
type: AnswerComment
score: 0
type: Comment
has text: What release of Eclipse are you using? Kepler?

http://stackoverflow.com/q/26588497
tagged with: asset-management
answer count: 1
has answer: http://stackoverflow.com/a/26760512
tagged with: jar
has comment: http://stackoverflow.com/comment/41857872
has comment: http://stackoverflow.com/comment/41853237
has comment: http://stackoverflow.com/comment/41793624
has comment: http://stackoverflow.com/comment/41898079
has comment: http://stackoverflow.com/comment/41876104
tagged with: assets
has comment: http://stackoverflow.com/comment/41817752
has comment: http://stackoverflow.com/comment/41872495
has comment: http://stackoverflow.com/comment/41798407
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26760512
tagged with: java
has comment: http://stackoverflow.com/comment/41871195
has body: The code looks something like this: if (Gdx.app.getType() == ApplicationType.Android) path = "data/images/"; if (Gdx.app.getType() == ApplicationType.Desktop) path = "./bin/data/images"; (if i use "data/images/" for Desktop, i get a crash). assetmanager.load(path + fileName), assetmanager.finishLoading() and later assetmanager.get(path + fileName) works perfectly in Eclipse and also on Android, but when i create a runnable .jar and launch it from console, i get Asset not loaded: ./bin/data/images/image.jpg. So for some reason it cannot access the data folder inside my .jar archive. How do i fix this? Thanks!
type: Question
has comment: http://stackoverflow.com/comment/41873726
tagged with: libgdx
has title: Libgdx AssetManager works in eclipse but not on a runnable jar
has comment: http://stackoverflow.com/comment/41884423
score: 0

http://stackoverflow.com/a/26608860
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26606542
downvote count: 0
has body: For each new document, you can clear the existing text by passing null or an empty string to setText(). Alternatively, append() a visual separator and the name of the document to retain a running history of the documents examined: textArea.append("***** " + pdf.getName() + "\n");

http://stackoverflow.com/q/26640028
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26640362
has title: Java: Observe many objects of same class
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41887299
upvote count: 1
tagged with: observer-pattern
type: Question
accepted answer: http://stackoverflow.com/a/26640362
has body: I'm working on a home assignment and I hope someone can give me a hint or two, because I'm stuck. I have a BlackJack game in Java which uses Model-View-Controller structure and I need to expand this program. I have to implement the observer pattern inside this program. I hava a player class and a dealer class (the dealer extends the player) in the Model. And I have a view class which holds all code that is needed for UI. The Player class is implementing Observerable interface, and the View class is implementing the Observer interface. I also have a controller which is called PlayGame. So the View class is the observer. My problem is: when I run the program, the program shows me only the cards of the dealer... not the player. Or sometimes it's conversely - the program shows the player's card, but not the dealer's cards... So what should I do in order to make my program "see" both the hand of the dealer and the hand of the player? I would be thankful for any help or hint on how to solve this... I know how Observer pattern works, but for some reason I don't know how to make it "observe" two objects of the same class. I need to make it observe two different objects of the Player class (I'm counting the dealer and the player as the same type, because the dealer is extending the player class). Here's the code: The Player class: public class Player implements Observable{ private List&lt;Card&gt; m_hand; private ArrayList&lt;Observer&gt; handOfCards; public Player() { m_hand = new LinkedList&lt;Card&gt;(); handOfCards = new ArrayList&lt;Observer&gt;(); } public void DealCard(Card a_addToHand) { m_hand.add(a_addToHand); notifyObservers(); } public void addObserver(Observer o) { handOfCards.add(o); } public void notifyObservers() { for(Observer o : handOfCards){ o.update(m_hand, this); } } The Dealer Class extends the Player class, and it has some extra methods for hitting, standing, etc. In the view class I have this update method: private List&lt;Card&gt; playerHand = new L…

http://stackoverflow.com/q/26644310
has title: WebSockets, ByteBuffer and PC Architecture
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41894896
tagged with: java
has comment: http://stackoverflow.com/comment/41906429
has body: I am using websockets between a windows machine and a Raspberry Pi. I use the @OnMessage from websocket-api to send some binary data from the windows machine to the raspberry pi machine. The specs are as given below. Windows 7 64 bit JDK 1.8_u05 64 bit Glassfish 4.0 open source edition Raspberry PI 32 bit (debian) JDK 1.8.0 b132 Stand alone websocket Now the problem, WebSocket connection from Windows machine to raspberry PI sends binary data as an all zero byte array if I change the Glassfish server to tomcat I change the jdk version from 1.8.0_u5 to anything other than this I change the glassfish version from 4.0 to 4.1 I am clueless why this is happening. Can these be related? How do I at least find out cause of this? EDIT : I have debugged, used fiddler, wireshark (at windows), logs and have found that the data is going from Windows is proper - Raspberry PI is receiving it as just zeroes (logs only).
type: Question
tagged with: raspberry-pi
has comment: http://stackoverflow.com/comment/41906181
tagged with: glassfish
tagged with: bytebuffer
score: 0
has comment: http://stackoverflow.com/comment/41906499
tagged with: websocket
has comment: http://stackoverflow.com/comment/41906640
has comment: http://stackoverflow.com/comment/41895870

http://stackoverflow.com/a/26640879
has comment: http://stackoverflow.com/comment/41966128
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26640806
has body: Your biggest mistake right now is that you're trying to run non-compilable code -- never do this! Instead find out what problems the compiler tells you about, not the JVM, and then try to fix them. Only try to run your code after it compiles without error. The compiler will then warn you that you're trying to use a non-final local variable, digits, within an anonymous inner class, and this isn't allowed. A solution is to declare digits as a final variable. final JLabel digits = new JLabel (""); You may ask why this strange requirement exists, well inner classes are true classes, even anonymous inner classes (like your ActionListener) and when Java creates one, it makes copies of local variables that are used by the inner class, and passes these copies into the inner class. If the variable is not final, the copy can get out of sync with the original.
type: Answer
has comment: http://stackoverflow.com/comment/41965741
accepted answer of: http://stackoverflow.com/q/26640806
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/41966682

http://stackoverflow.com/comment/41832617
type: Comment
comment on: http://stackoverflow.com/a/26589638
score: 0
type: AnswerComment
has text: Okay you're right that a down-cast to an interface makes no sense in this case. But `bar` is not a new instance, it's the same instance. And since `List` and `List<E>` are the same (raw) type in Java, they're often used interchangeably.

http://stackoverflow.com/q/26519556
has body: 10-23 00:41:00.705: E/AndroidRuntime(3622): FATAL EXCEPTION: AsyncTask #1 10-23 00:41:00.705: E/AndroidRuntime(3622): java.lang.RuntimeException: An error occured while executing doInBackground() 10-23 00:41:00.705: E/AndroidRuntime(3622): at android.os.AsyncTask$3.done(AsyncTask.java:299) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 10-23 00:41:00.705: E/AndroidRuntime(3622): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 10-23 00:41:00.705: E/AndroidRuntime(3622): at java.lang.Thread.run(Thread.java:856) 10-23 00:41:00.705: E/AndroidRuntime(3622): Caused by: java.lang.IllegalStateException: Content has been consumed 10-23 00:41:00.705: E/AndroidRuntime(3622): at org.apache.http.entity.BasicHttpEntity.getContent(BasicHttpEntity.java:84) 10-23 00:41:00.705: E/AndroidRuntime(3622): at org.apache.http.entity.BasicHttpEntity.writeTo(BasicHttpEntity.java:126) 10-23 00:41:00.705: E/AndroidRuntime(3622): at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:101) 10-23 00:41:00.705: E/AndroidRuntime(3622): at org.apache.http.conn.BasicManagedEntity.writeTo(BasicManagedEntity.java:126) 10-23 00:41:00.705: E/AndroidRuntime(3622): at com.firstgroup.webservice.RequestTask.doInBackground(RequestTask.java:51) 10-23 00:41:00.705: E/AndroidRuntime(3622): at com.firstgroup.webservice.RequestTask.doInBackground(RequestTask.java:1) 10-23 00:41:00.705: E/AndroidRuntime(3622): at android.os.AsyncTask$2.call(AsyncTa…
accepted answer: http://stackoverflow.com/a/26520476
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/26520476
upvote count: 2
tagged with: android
has title: how to remove FATAL EXCEPTION: AsyncTask in android
type: AnsweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/comment/41793951
type: Comment
comment on: http://stackoverflow.com/q/26589425
type: QuestionComment
has text: @MarounMaroun Huge thanks to both of you!
score: 0

http://stackoverflow.com/comment/41797383
has text: @SotiriosDelimanolis Where is the `int`? I am trying to convert `c`, not `i`. `System.out.print(Character.toString(c));` -> c is a `char` here
type: QuestionComment
comment on: http://stackoverflow.com/q/26591171
score: 0
type: Comment

http://stackoverflow.com/comment/41671800
has text: if the content type is same you will only need 1.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26521257
type: Comment

http://stackoverflow.com/a/26600956
score: 0
has body: This sums only the second to last digits : sumSecTolastD = (num1/10) % 10 + (num2/10) % 10 + (num3/10) % 10; To sums both second to last and last digits, change it to : sumSecTolastD = num1%10 + (num1/10) % 10 + num2%10 + (num2/10) % 10 + num3%10 + (num3/10) % 10; The same code would work even if any/all of your input numbers have a single digit, since in that case (numi/10) % 10 would be 0, and won't affect the sum.
type: Answer
answers question: http://stackoverflow.com/q/26600891

http://stackoverflow.com/a/26557301
upvote count: 2
score: 2
has body: Yes, all implementations of BlockingQueue are thread safe for put and take and all actions. The link just goes halfway...and is not covering the full details. It is thread safe.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26543807

http://stackoverflow.com/q/26546404
has comment: http://stackoverflow.com/comment/45155757
upvote count: 3
tagged with: java
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/58077061
tagged with: ejb
has comment: http://stackoverflow.com/comment/41715888
has comment: http://stackoverflow.com/comment/58104838
has title: EJB @Lock not working as expected
has comment: http://stackoverflow.com/comment/45064480
has comment: http://stackoverflow.com/comment/58115426
has comment: http://stackoverflow.com/comment/45114794
answer count: 1
downvote count: 0
has body: I have a scheduled EJB which calls a Singleton EJB. For some reason the scheduled method executes twice on every schedule (something to do with it being referenced from a WAR file as well as in the EAR). To counter this I have put the @Lock annotation on the method in the @Singleton bean, but it still get executed twice concurrently: @Stateless public class PaymoTimer { @EJB private IPaymoManagerRemote manager; @Schedule(hour = "10,12,14,16", minute = "41", second = "0", info = "PaymoTimer") public void timer() throws Exception { manager.generateEmailReport(); } } @LocalBean @Singleton public class PaymoManager implements IPaymoManagerRemote { @Override @Lock(LockType.WRITE) public void generateEmailReport() { System.out.println("generateEmailReport"); String text = getDailySummaryForUser(); System.out.println("done"); } } My console prints out the following: 12:42:00,008 INFO [stdout] (EJB default - 10) generateEmailReport 12:42:00,009 INFO [stdout] (EJB default - 9) generateEmailReport 12:42:24,027 INFO [stdout] (EJB default - 10) done 12:42:24,323 INFO [stdout] (EJB default - 9) done Looking at the times and the process ID it is clear that the method is getting called while a previous instance is still running. Am I misunderstanding what the @Lock annotation is meant to do?
has answer: http://stackoverflow.com/a/45892357
favorite count: 0
accepted answer: http://stackoverflow.com/a/45892357
has comment: http://stackoverflow.com/comment/45054733
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41716279

http://stackoverflow.com/a/26602235
score: 3
has comment: http://stackoverflow.com/comment/41817932
upvote count: 3
has body: You have to check if there is two args or not, with a code like this: if(args.length &gt; 2) Also I think it is better to change lines like this : for (int i = 1; i &lt;= M; i++) { for (int j = 1; j &lt;= N; j++) to this: for (int i = 0; i &lt;M; i++) { for (int j = 0; j &lt; N; j++)
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26602209

http://stackoverflow.com/comment/41689939
type: QuestionComment
score: 0
has text: @Bohemian I'm going off of the assumption that OP knows the word is `$Banana`, since the variable is named `stringTofind`.
comment on: http://stackoverflow.com/q/26531502
type: Comment

http://stackoverflow.com/q/26581891
type: Question
has comment: http://stackoverflow.com/comment/43371361
has answer: http://stackoverflow.com/a/26656484
has comment: http://stackoverflow.com/comment/41788434
has comment: http://stackoverflow.com/comment/48193133
upvote count: 2
tagged with: security
has title: Do I need to enable canonicalization when using OWASP ESAPI?
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43381814
favorite count: 0
tagged with: esapi
has body: We are adding ESAPI 2.x (owasp java security library) to an application. The change is easy though quite repetitive. We are adding validations to all input parameters so we make sure all the characters they are composed by are within a whitelist. This is it: Validator instance = ESAPI.validator(); Assert.assertTrue(instance.isValidInput("test", "xxx@gmail.com", "Email", 100, false)); Then Email patterns is set in the validation.properties file like: Validator.Email=^[A-Za-z0-9._%'-]+@[A-Za-z0-9.-]+\\.[a-zA-Z]{2,4}$ Easy! We are not encoding output given that after the input validation, data becomes trusted. I can see in ESAPI that it has a flag to canonicalize the input String. I understand that canonicalization is "de-encoding" so any encoded String is transformed in plain text. The question is. Why do we need to canonicalize? Can anybody show a sample of an attack that will be prevented by using canonicalization?? (in java) thank you!
has comment: http://stackoverflow.com/comment/41912695
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41955262
tagged with: owasp
linked to: http://stackoverflow.com/q/23587519
has answer: http://stackoverflow.com/a/26583208
score: 1
tagged with: java

http://stackoverflow.com/comment/41797918
type: Comment
comment on: http://stackoverflow.com/a/26591296
has text: Compilers can deal with this type of ambiguity so this is still an opinion. (Though it is a reasonable suggestion because the Java language typically steers away from ambiguity.)
score: 0
type: AnswerComment

method-declaration
type: Tag
tag name: method-declaration
tags question: http://stackoverflow.com/q/26610174

http://stackoverflow.com/comment/41802962
type: QuestionComment
score: 1
has text: in your constructor, add "setModal(true);"
comment on: http://stackoverflow.com/q/26594046
type: Comment

http://stackoverflow.com/comment/41670169
has text: @MadProgrammer either that, or only allow 0-9 for each individual char, I feel that would check for even more issues that would come in the future, especially since that is a part of the parameters
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26520487

http://stackoverflow.com/a/26617191
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26617160
has comment: http://stackoverflow.com/comment/41848353
upvote count: 2
answers question: http://stackoverflow.com/q/26617160
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41848505
downvote count: 1
has comment: http://stackoverflow.com/comment/41872357
has body: private class Row { public Integer i; public String s; public LatLng ll; public Row(Integer i, String s, LatLng ll) { this.i = i; this.s = s; this.ll = ll; } } List&lt;Row&gt; rows = new ArrayList&lt;Row&gt;(); This is semi pseudo code but I think you get the idea Adding new Rows to the list can be done with rows.add(new Row(new Integer(1), "a string", new LatLng(51.448495, 5.470877)); Editing a row can be done with rowIndex = 3; Row row = rows.get(rowIndex); row.i = 2; //give a new value //etc Edit: replaced pseude code with real code
has comment: http://stackoverflow.com/comment/41847921
has comment: http://stackoverflow.com/comment/41848393
has comment: http://stackoverflow.com/comment/41848135

http://stackoverflow.com/q/26634070
answer count: 5
linked to: http://stackoverflow.com/q/1568091
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41876057
tagged with: java
has comment: http://stackoverflow.com/comment/41875951
upvote count: 1
has answer: http://stackoverflow.com/a/26634130
type: Question
has comment: http://stackoverflow.com/comment/41876228
has answer: http://stackoverflow.com/a/26634541
has comment: http://stackoverflow.com/comment/41876318
has comment: http://stackoverflow.com/comment/41875840
has body: I am in a Introduction to Java class and I was doing a bit of research on variables. It seems that knowledgeable programers state that it is bad practice to define the variables in public visibility. I see them stating it is bad practice but I can not find a rhyme or reason to their claims. This is how I defined my variables in a application for my course. public class DykhoffWk3Calculator { /* * This class is used to define the variables in a static form so all * classes can access them. */ public static double commissionRate = .03, startSalary = 45000, accelerationFactor = 1.25; public static double annualSales, commissionTotal, totalCompensation, total, count, count2; private static Object input; Object keyboard; public static class UserInput { //Then continue with my other classes I thought this was a logical method of defining them so all classes, not just main, could access them. Can someone explain to me why this is bad practice, and where variables should be defined? Any assistance would be greatly appreciated.
has title: Why is making variables public visibility a bad practice
accepted answer: http://stackoverflow.com/a/26634130
possible better answer: http://stackoverflow.com/a/26634227
has answer: http://stackoverflow.com/a/26634197
has answer: http://stackoverflow.com/a/26634227
has comment: http://stackoverflow.com/comment/41875771
has comment: http://stackoverflow.com/comment/41875908
has answer: http://stackoverflow.com/a/26634329
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41875815
favorite count: 0

http://stackoverflow.com/q/26545439
has comment: http://stackoverflow.com/comment/57558581
has body: I have this web service method: &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.http.accede.sergas.es"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;ws:validarLogin&gt; &lt;login&gt;&lt;/login&gt; &lt;password&gt;&lt;/password&gt; &lt;/ws:validarLogin&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; which I want to mock using SOAPUI. I want to mock it so only user admin/admin should get an OK response and any other combination should bring an error. I tried using Query Match like so: //ws:validarLogin/login which should be admin. I also created condition: //ws:validarLogin/password which should be admin too. But this results in any of those conditions returning OK while I need only for my mock to return true when BOTH of params are "admin". How can I specify this "AND" condition?
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41714140
has answer: http://stackoverflow.com/a/31019309
favorite count: 0
tagged with: soapui
has answer: http://stackoverflow.com/a/39267802
type: Question
tagged with: soap
has answer: http://stackoverflow.com/a/30099721
upvote count: 2
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41714170
type: UnansweredQuestion
has title: SoapUI query Match with multiple conditions
linked to: http://stackoverflow.com/q/13611683

http://stackoverflow.com/a/26526107
has comment: http://stackoverflow.com/comment/41679757
downvote count: 0
type: Answer
upvote count: 1
has body: On the surface, this doesn't appear to be anything to do with Spring MVC or Hibernate. The error message is: Factory method [public org.hibernate.SessionFactory com.crutchsf.config.AppConfig.sessionFactory()] threw exception; nested exception is java.lang.NullPointerException If you have a stacktrace, you'll be able to see exactly what line the null reference occurred on. If not, you'll have to fire up a debugger (or insert println statements) to find out. Either way, it appears that your AppConfig class has a bug in it, or you are not initialising it correctly. Look at the sessionConfig() method to see why it NPEs, and ensure that the appropriate references are not null before calling it.
score: 1
has comment: http://stackoverflow.com/comment/41729383
answers question: http://stackoverflow.com/q/26525858

http://stackoverflow.com/comment/41950676
type: Comment
comment on: http://stackoverflow.com/a/26656912
score: 1
type: AnswerComment
has text: It’s still not clear to me where the desired comparison between a `Method` and that compile-time checked artifact comes into play. But it has grown to an entirely different question anyway. So I suggest opening a new question with a more detailed explanation of what you want to achieve (maybe with code example).

http://stackoverflow.com/q/26533469
has answer: http://stackoverflow.com/a/26533533
has comment: http://stackoverflow.com/comment/41693500
tagged with: windows
answer count: 1
tagged with: cmd
has comment: http://stackoverflow.com/comment/41693240
favorite count: 0
has comment: http://stackoverflow.com/comment/41695964
has body: I would like my program to receive commands like java compiler does: CMD Input java -version CMD Output java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) Client VM (build 25.91-b14, mixed mode, sharing) So this is how I expect my program should work: CMD Input MyProgamName -MyFunction CMD Output Output generated by my program
accepted answer: http://stackoverflow.com/a/26533533
has comment: http://stackoverflow.com/comment/41696354
has comment: http://stackoverflow.com/comment/41693629
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41694004
has comment: http://stackoverflow.com/comment/41693858
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41693744
has title: How to send commands to my program directly from Windwos CMD?
has comment: http://stackoverflow.com/comment/41694444
type: Question
tagged with: c#
downvote count: 0

http://stackoverflow.com/q/26517495
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/26518323
upvote count: 0
tagged with: arrays
answer count: 1
tagged with: wunderground
favorite count: 0
has comment: http://stackoverflow.com/comment/41666560
has title: Parsing JSON data to Java for Android Weather App
has comment: http://stackoverflow.com/comment/41665867
type: UnansweredQuestion
downvote count: 1
type: Question
has body: Alright, so I'm trying to output some data from a JSON file from Weather Underground for an Android app. What I need is the current temperature and conditions for the day, for the next 10 days. The JSON data provided gives a 10 day outlook but I have no idea how to parse out each day separately. And, I'm even having trouble trying to just get the temperature and condition into a single string output. Here is the JSON set: { "response": { "version":"0.1", "termsofService":"http://www.wunderground.com/weather/api/d/terms.html", "features": { "forecast10day": 1 } } , "forecast":{ "txt_forecast": { "date":"1:27 PM CDT", "forecastday": [ { "period":0, "icon":"partlycloudy", "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif", "title":"Wednesday", "fcttext":"A mix of clouds and sun. Slight chance of a rain shower. High around 60F. Winds SSE at 10 to 20 mph.", "fcttext_metric":"Sun and clouds mixed. Slight chance of a rain shower. High near 15C. Winds SSE at 15 to 30 km/h.", "pop":"10" } , { "period":1, "icon":"nt_rain", "icon_url":"http://icons.wxug.com/i/c/k/nt_rain.gif", "title":"Wednesday Night", "fcttext":"Showers and thundershowers this evening will give way to steady rain overnight. Low 51F. Winds S at 10 to 15 mph. Chance of rain 70%.", "fcttext_metric":"Showers and thundershowers this evening, then cloudy with rain likely overnight. Low around 10C. Winds S at 15 to 25 km/h. Chance of rain 70%.", "pop":"70" } , { "period":2, "icon":"partlycloudy", "icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif", "title":"Thursday", "fcttext":"Morning clouds will give way to sunshine for the afternoon. High around 70F. Winds WSW at 5 to 10 mph.", "fcttext_metric":"Morning clouds will give way to sunshine for the afternoon. High 21C. Winds WSW at 10 to 15 km/h.", "pop":"20" } , { "period":3, "icon":"nt_clear", "icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif", "title":"Thursday Night", "fcttext":"A mostly clear sky. Low around 45F. Winds light and variable.", "fct…

http://stackoverflow.com/comment/41744782
type: AnswerComment
has text: By the way the first error you wrote seems to be related to sm-core missing. So you first have to understand how to install it. What Maven version are you using? (try "mvn --version") Note that using mvn 3.0.5, making a "mvn install" on sm-core, then a "mvn compile" on sm-shop, it builds succesfully.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26562274

http://stackoverflow.com/q/26531548
has comment: http://stackoverflow.com/comment/41689422
downvote count: 0
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/26531669
tagged with: interface
score: 5
possible better answer: http://stackoverflow.com/a/26531729
has title: Is there a standard exception to be thrown if object is not instance of something in java?
has answer: http://stackoverflow.com/a/26531729
accepted answer: http://stackoverflow.com/a/26531669
type: AnsweredQuestion
has body: Let's say I have the following: public interface Foo { ... } public class Gin { ... } public class Fizz { ... } public class Buzz { public Foo getAFoo() { ... } public void test() { Foo myfoo = getAFoo(); if (myFoo instanceof Bar) { Bar myBar = (Bar) myFoo; //do something more } else { //throw new something exception } } } Is this reasonable programming? Is there a built-in exception that test() can throw or should I create my own exception class for this?
tagged with: java
has comment: http://stackoverflow.com/comment/41689803
type: Question
has answer: http://stackoverflow.com/a/26531812
upvote count: 5
answer count: 3

http://stackoverflow.com/a/28014973
type: Answer
answers question: http://stackoverflow.com/q/26557940
has comment: http://stackoverflow.com/comment/44497382
has body: You can use modules with the appengine-maven-plugin by creating an Enterprise Archive (EAR) project and putting each module in it's own WAR. A contributor's example project which does this is at [1]. Using Maven with modules has some limitations, like not being able to share the same datastore on the development server. In this case you'd want to set up an Eclipse WTP project as per [2]. The documentation on this is somewhat lacking, and it would be nice if Google provided an archetype for using modules. [1] https://github.com/GoogleCloudPlatform/appengine-modules-sample-java [2] Serving multiple GAE modules from one development server? As far as 'appengine:backends_configure' goes, since backends are still supported for now I assume the goal isn't going away any time soon.
score: 0

http://stackoverflow.com/a/26567985
answers question: http://stackoverflow.com/q/26567663
type: Answer
has body: I ran this code from the terminal, the script ran it 100 times. There is no additional number. If you are working in an IDE, I suggest you press the Clean Project button. If that doesn't work, you can restart the IDE and as a last resort, clear the cache.
score: 0

http://stackoverflow.com/q/26580473
accepted answer: http://stackoverflow.com/a/26580520
has title: How to compile and run project with multiple classes in package?
has body: I just realized I'm about to graduate and I still don't know how to handle this situation: Say I have a java package named mystuff.project1 and inside the package I have Project1.java (which has the main method) and ThingThatDoesStuff.java . Both are public classes, have the package declaration at the top of the file, etc. I can debug this project fine in Eclipse. For maximum simplicity, I move the project to C:\ so the java files are located in c:\mystuff\project1 I navigate into c:\mystuff\project1 and type javac *.java to compile the class files Now how the blazes do I run my application? java Project1 doesn't work java mystuff.project1.Project1 doesn't work java -cp . Project1 doesn't work java -cp . mystuff.project1.Project1 doesn't work All of the above give me "Error: Could not find or load main class" I've been searching SO and elsewhere to try to understand this problem but I'm completely baffled. I've: cleared my CLASSPATH variable triple-checked PATH etc successfully tried compiling and running standalone class files that aren't in a package I understand this is a stupid newbie question but I just can't figure it out. I realized every other time I've run into this problem I similarly couldn't find a solution and put all of the classes into a single file. I'd rather learn how to stop doing that now.
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26580520

http://stackoverflow.com/comment/41745069
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562497
has text: That means you're trying to access something on index `0` that isn't there (this collection is empty). Insert something first, before trying to access it.

http://stackoverflow.com/comment/41939024
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26669050
has text: @DarshanLila in database these arguments are of datetime only
score: 0

http://stackoverflow.com/q/26566082
answer count: 2
has title: Implementation of an nxn matrix using a single record
possible better answer: http://stackoverflow.com/a/26566288
accepted answer: http://stackoverflow.com/a/26614174
has answer: http://stackoverflow.com/a/26566288
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41751597
has body: To start off, I would like to know what exactly is a record in comparison to an array? From what I'm trying to understand from my textbook, "Gilles Dowek, Principles of Programming Languages", it's almost like an array but needs labels and values associated to these labels. The example given is: labels: {latitude, longitude, altitude} record: {latitude = 48.715, longitude = 2.208, altitude = 156} What also confuses me is how one implements this 2-D matrix with a single record (which I assume is a single row vector like the example above). I have only a year experience with programming in general so any sort of readings or sources with a descriptive answer would be greatly appreciated.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26614174
has comment: http://stackoverflow.com/comment/41751596
score: 0

http://stackoverflow.com/a/26600686
upvote count: 21
has comment: http://stackoverflow.com/comment/72948084
has comment: http://stackoverflow.com/comment/41816846
answers question: http://stackoverflow.com/q/26599891
accepted answer of: http://stackoverflow.com/q/26599891
type: AcceptedAnswer
downvote count: 0
has body: It looks like the Observable returned by the myEvent.findMemberships() call is never calling onComplete. Can you show this code? If that is the case, it would explain the behavior you are seeing. The .toList() will not emit the list until all items have been emitted (signaled by onComplete). Your second version without .toList(), would proceed as follows: .findMemberships() emits a single List&lt;Membership&gt; .flatMap() transforms List&lt;Membership&gt; into a single List&lt;User&gt; Observable.from(users) creates an observable that emits each user .subscribe() onNext() is called for each user onCompleted() is never called. Your original version: .findMemberships() emits a single List&lt;Membership&gt; .flatMap() transforms List&lt;Membership&gt; into a single List&lt;User&gt; Observable.from(users) creates an observable that emits each user .toList() buffers each User waiting for onCompleted() to be called onCompleted is never called because the .findMemberships Observable never completes There are several solutions: 1) Make the findMemberShips() Observable call onComplete.This may not be desirable if the Observable returned by findMemberShips() is a Rx Subject (PublishSubject, BehaviorSubject, etc) 2) Use Observable.just() instead of Observable.from(). You already have a List&lt;User&gt; in .flatMap(), just return it. Using Observable.from(users) creates an Observable that emits each user. Observable.just(users) would create an Observable that emits a single List&lt;User&gt;. No need for .toList(). 3) Use .map() instead of .flatMap(). Again, no need for .toList(). Since each List&lt;Membership&gt; gets transformed into a List&lt;User&gt; you only need to use .map(). myEvent .findMemberships() .map(new Func1&lt;List&lt;Membership&gt;, List&lt;User&gt;&gt;() { @Override public List&lt;User&gt; call(List&lt;Membership&gt; memberships) { List&lt;User&gt; users = new ArrayList&lt;User&gt;(); for (Membership membership : memberships) { users.add(membership.getUser());…
type: Answer
score: 21

http://stackoverflow.com/a/26522633
answers question: http://stackoverflow.com/q/26522579
upvote count: 1
score: 1
has body: The string is a mix of a json and some other text. You may try to split the json part and then can use a json parser to retrieve nsid easily.There are various java json parsers available such as GSON.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41910143
has text: As a rule for all software development, you should be more inclined to question your own code than an official, tested library. If you show the XML input and stylesheet, we can try and reproduce your issue.
score: 0
comment on: http://stackoverflow.com/q/26650924
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41987804
score: 0
has text: how can I fix that ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26596612
type: Comment

http://stackoverflow.com/comment/41809667
type: Comment
score: 0
type: AnswerComment
has text: @Rahul Check out "Java Concurrency in Practice". It's the ultimate reference for writing thread-safe code.
comment on: http://stackoverflow.com/a/26558314

http://stackoverflow.com/comment/41740328
type: AnswerComment
has text: @ArCiGo Please ask a new question.
type: Comment
comment on: http://stackoverflow.com/a/26559808
score: 0

http://stackoverflow.com/a/79061548
type: Answer
score: 0
has body: You can simply solve this problem by using- @GeneratedValue(strategy = GenerationType.SEQUENCE)
answers question: http://stackoverflow.com/q/26651754

http://stackoverflow.com/a/26626424
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26626063
has body: Hope it will help File f=new File(n[x]); BufferedReader br = new BufferedReader(new FileReader(f)); String s; while((s=br.readLine())!=null){ String test = s.replace(" ",""); String[] test2 = test.split("JJ"); String test3 = test2[1]; System.out.println(test3); }

http://stackoverflow.com/q/26578037
has body: I am quite new to concurrent programming and I am enjoying it so far :)! However I just realized how tricky concurrent programming. I have multiple threads which perform their own computations. Each thread operates on a certain variable and returns a result, however the result returned is incorrect. This class performs the thread calculations: public class SharedDataThread extends Thread { private SharedData mySharedData; private String myThreadName; private static long testVariable = 0; // Setup the thread SharedDataThread(String name, SharedData sharedstuff) { super(name); mySharedData = sharedstuff; myThreadName = name; } public void run() { System.out.println(myThreadName + " is running"); Thread me = Thread.currentThread(); // get a ref to the current thread if (me.getName() == "myThread1") { try { sleep(2000); mySharedData.acquireLock(); System.out.println(me.getName() + " is performing computations!"); testVariable = testVariable + 20; testVariable = testVariable * 5; testVariable = testVariable / 3; System.out.println(me.getName() + " modified the value to : " + testVariable + "\n"); sleep(2000); mySharedData.releaseLock(); } catch (InterruptedException e) { System.err.println("Failed to get lock when reading:" + e); } } else if (me.getName() == "myThread2") { try { sleep(2000); mySharedData.acquireLock(); System.out.println(myThreadName + " is performing computations!"); testVariable = testVariable - 5; testVariable = testVariable * 10; testVariable = (long) (testVariable / 2.5); System.out.println(me.getName() + " modified the value to : " + testVariable + "\n"); sleep(2000); mySharedData.releaseLock(); } catch (InterruptedException e) { System.err.println("Failed to get lock when reading:" + e); } } else if (me.getName() == "myThread3") { try { sleep(2000); mySharedData.acquireLock(); System.out.println(me.getName() + " is performing computations!"); testVariable = testVariable - 50; testVariable = testVariable / 2; testVariable = testVariable * 33; Syste…
has comment: http://stackoverflow.com/comment/41773602
has comment: http://stackoverflow.com/comment/41773617
has comment: http://stackoverflow.com/comment/41773525
has comment: http://stackoverflow.com/comment/41773569
linked to: http://stackoverflow.com/q/2423622
score: 0
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41773965
has comment: http://stackoverflow.com/comment/41773661
has answer: http://stackoverflow.com/a/26578197
type: Question
has title: Why do these threads return an incorrect calculation?
has comment: http://stackoverflow.com/comment/41774013
has comment: http://stackoverflow.com/comment/41773820
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41773791
answer count: 1
tagged with: distributed-computing
has comment: http://stackoverflow.com/comment/41773556
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41774189
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/41751330
has text: this means only the fact your TCPThread and UDPThread does NOT handle interruptions. try the second approach, it should help.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26566023

http://stackoverflow.com/q/26629376
score: 0
has comment: http://stackoverflow.com/comment/41870696
type: UnansweredQuestion
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/41922645
answer count: 0
tagged with: java
tagged with: vaadin
type: Question
has title: how to call post method from vaadin?
has body: how to call dopost method from vaadin application? BrowserWindowOpener component always call doGet() of servlet. I want to call dopost method so that parameter is not shown at the browser addressbar if I redirect to another url. Will it be ok to use Form Sender add-on??.. If it is ok, then How to use it?... Please reply soon...
tagged with: vaadin-touchkit
tagged with: vaadin6

http://stackoverflow.com/a/26570123
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/41759032
has comment: http://stackoverflow.com/comment/41758976
upvote count: 2
has body: tb1.paint(JTable.PrintMode.FIT_WIDTH, footer, header); isn't tb1.print(JTable.PrintMode.FIT_WIDTH, footer, header);
accepted answer of: http://stackoverflow.com/q/26570074
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26570074
has comment: http://stackoverflow.com/comment/41758930
type: Answer

http://stackoverflow.com/comment/41725388
type: QuestionComment
comment on: http://stackoverflow.com/q/26550959
score: 0
has text: possible duplicate of [org.xml.sax.SAXParseException: Content is not allowed in prolog](http://stackoverflow.com/questions/5138696/org-xml-sax-saxparseexception-content-is-not-allowed-in-prolog)
type: Comment

http://stackoverflow.com/comment/41683080
score: 0
type: Comment
type: QuestionComment
has text: Exception says it all, you can't establish a connection to the database. Make sure the database server is running, and that you connect with the correct url.
comment on: http://stackoverflow.com/q/26527763

http://stackoverflow.com/comment/41710183
score: 0
type: Comment
type: QuestionComment
has text: @getlost I can tell you the exact location of the Class file if that's what you're looking for
comment on: http://stackoverflow.com/q/26542498

http://stackoverflow.com/q/26574387
type: UnansweredQuestion
has title: OSGI bundle possibility
tagged with: osgi-bundle
has answer: http://stackoverflow.com/a/26575515
tagged with: java
tagged with: startup
type: Question
has body: I have two bundles A and B, with start-up for A as 4 and B as 5. There is a library in bundle A, Which is in-need of class in bundle B. Bundle B is dependent of Bundle A, [Bundle B gets started after Bundle A being started] So I cannot make bundle B to be dependent for A, It becomes tightly coupled, So Is there a way I can use the class in bundle B in Bundle A without being added as dependent bundle. Even when I import package of Bundle B in Bundle A, It shows as tightly coupled. Guys give me some solution...
score: 0
answer count: 1
tagged with: dependencies
tagged with: osgi

http://stackoverflow.com/q/26545536
has comment: http://stackoverflow.com/comment/41714390
tagged with: image
has comment: http://stackoverflow.com/comment/41714531
type: Question
has answer: http://stackoverflow.com/a/26545776
has comment: http://stackoverflow.com/comment/41714620
has comment: http://stackoverflow.com/comment/41714318
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41714598
favorite count: 0
has comment: http://stackoverflow.com/comment/41714234
has comment: http://stackoverflow.com/comment/41714604
tagged with: swing
has title: How do you use an image as background and place an image in front of that?
has comment: http://stackoverflow.com/comment/41714213
has comment: http://stackoverflow.com/comment/41714572
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26545776
downvote count: 0
score: 1
has body: I have tried loads of ways, but none of them succeeded. they either didn't show the image, or they made the background image disappear... do you have any suggestions? Here is my code: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame{ int x, y; Image Dak; Image Levels; private Image dbImage; private Graphics dbg; public Main(){ setTitle("Help de Pieten"); setSize(2000, 720); setResizable(true); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { this.setContentPane( new JLabel(new ImageIcon(ImageIO.read(new File("Image1.gif"))))); } catch (IOException e) {} validate(); ImageIcon i = new ImageIcon("Image2.gif"); Levels = i.getImage(); x = 100; y = 100; } public void paint(Graphics g){ dbImage = createImage(getWidth(), getHeight()); dbg = dbImage.getGraphics(); paintComponent(dbg); g.drawImage(dbImage, 0, 0, this); } public void paintComponent(Graphics g){ g.drawImage(Levels, x, y, this); repaint(); } public static void main(String[] args) { Main main = new Main(); } } So how do I get images in front of the background without making the background dissapear?
tagged with: java

http://stackoverflow.com/a/63660474
has comment: http://stackoverflow.com/comment/113513227
has comment: http://stackoverflow.com/comment/112575963
downvote count: 5
answers question: http://stackoverflow.com/q/26530677
has body: When we deploy our application on tomcat, so simple we need to enable the debug level ERROR for org.jboss.modules in standalone.xml file.
upvote count: 0
score: -5
type: Answer

http://stackoverflow.com/comment/41809402
has text: With `term ::= factor*factor | factor`, how will you parse something like `1 * 2 * 3`?
comment on: http://stackoverflow.com/q/26596454
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41784038
comment on: http://stackoverflow.com/a/26584044
has text: When I used System.out.println, I got the output that I want (question is updated). The reason I write it when the operation line starts with #% is to retrieve the output I want. I'll try to fix the logical error that you mentioned. Thanks
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26589425
answer count: 3
has title: Java: make a function return positive integer not negative one
tagged with: integer
has comment: http://stackoverflow.com/comment/41793877
possible better answer: http://stackoverflow.com/a/26589530
has comment: http://stackoverflow.com/comment/41794136
has answer: http://stackoverflow.com/a/26589577
has answer: http://stackoverflow.com/a/26589546
accepted answer: http://stackoverflow.com/a/26589546
type: AnsweredQuestion
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41794055
type: Question
score: 0
has answer: http://stackoverflow.com/a/26589530
upvote count: 1
downvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/41793858
favorite count: 0
has comment: http://stackoverflow.com/comment/41793951
has body: as I was coding this project for fun, I got stuck myself on getting the output that I want: getting the positive element out of the input, 2 and -2. To put it more simply, I want the output to be positive 2 not negative 2. The general idea of this is getting the closest element to Zero. But here, I'm assuming that the positive one is closer to 0. Hope any of you can answer my question. Personally I want to become better at Java so that I can help newbie like myself now, later in the future. Anyways, thank you, in advance. static int getClosestToZero(int[] array) { int num = array[0]; int absNum = Math.abs(num); for(int i = 1; i &lt; array.length; ++i) { int newAbs = Math.abs(array[i]); if(newAbs &lt; absNum) { absNum = newAbs; num = array[i]; } } return num; } public static void main(String[] args) { int[] myArray = {-2, 2}; System.out.println(getClosestToZero(myArray)); }

http://stackoverflow.com/a/26661285
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41924801
has body: when I go to call getText on numA, it crashes The only possible thing is your EditText numA is NULL. Update: Look at Better way to Format Currency Input editText?
upvote count: 1
answers question: http://stackoverflow.com/q/26661250
has comment: http://stackoverflow.com/comment/41924840
downvote count: 0
has comment: http://stackoverflow.com/comment/41924764
has comment: http://stackoverflow.com/comment/41924710

http://stackoverflow.com/comment/41767164
comment on: http://stackoverflow.com/a/26574360
type: Comment
has text: i have validated the code in my machine..it was fine...there should be something wrong while you copy...
score: 0
type: AnswerComment

http://stackoverflow.com/a/26607099
accepted answer of: http://stackoverflow.com/q/26551554
score: 0
answers question: http://stackoverflow.com/q/26551554
type: Answer
has body: As far as I understand you've 2 problem here : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Which in other words means that you can't use an hibernate session factory with JPA TransactionManager, you will have to choose between a simple Spring + hibernate approach (spring transaction management + hibernate session factory, see outdated exemple here) or a Spring + JPAAdapter + JPA (spring JPA transaction management + JPA entityManagerFactory To understand the difference between the 2 approaches see HibernateTransactionManager or JpaTransactionManager The second problem java.net.BindException: Address already in use: bind means the server expected listened http port is already used by another program (use TCPView to know which one)
type: AcceptedAnswer

http://stackoverflow.com/comment/41833576
type: Comment
has text: Your class `ClientRegistrationManager` should depend on a `QueriesFactory`, but should not create it. The keyword here is "dependency injection". The manager's conctructor must be given such a factory. In your program, you create a manager with a `MemberQueriesFactory` that produces real `MemberQueries`. The test can mock the factory, so you have everything in hand.
score: 0
comment on: http://stackoverflow.com/q/26609499
type: QuestionComment

http://stackoverflow.com/q/26607728
tagged with: java
upvote count: 1
answer count: 1
tagged with: spring-boot
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/41831261
has answer: http://stackoverflow.com/a/26648948
has title: Patterns about bean management in Spring Boot
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41829344
favorite count: 0
has comment: http://stackoverflow.com/comment/41829489
has comment: http://stackoverflow.com/comment/41829695
has body: I have a Task and a TaskHandler. The handler access DB through DaoService. The DaoService is managed by Spring Container but the handler is generated by new, and not managed by Spring Container. So I think I can't access the DaoService in handler by Autowired. So I tried to pass the DaoService to the handler.But I don't know How to pass it. In my current implements: 1、I set the DaoService to a Task. public Task generateTask(Param param, DaoService dao) { Task task = new Task(); task.setDao(dao); task.setparam(getTaskParam(param)); return task; } 2、In Task's call(), I set the DaoService to handler. class Task implements Callable&lt;Boolean&gt; { DaoService dao; // getter and setter public boolean call() { TaskHandler handler = TaskHandlerMap.getHandler(); handler.setDaoService(dao); return handler.process(param); } } 3、At last, I my main() I call the generateTask() to get the task. class MainClass() { @Autowired DaoService dao; Param param = new Param(); public static void main(String[] args) { Task task = generateTasks(param, dao); // submit the task to thread pool. } } My problem is: 1、Task should not contain a member called DaoService, Task has nothing to do with DaoService, Task should only concerns about the TaskHandler. 2、DaoService should not be passed to generateTasks(). One Task can be created even there is no DaoService. How to avoid this? Or some good advice? Any help would be greatly appreciated. Updated: According to @AndyWilkinson advice, the code maybe like this: class TaskHandlerMap { @Autowired private static XXXHandler xxxHandler; private static Map&lt;String,AbstractItemHandler&gt; map = Maps.newHashMap(); static { map.put(Constants.XXX_PATH, xxxHandler); } public static AbstractItemHandler get(String key) { return map.get(key); } } But I don't think the static field can be autowired.
type: Question
accepted answer: http://stackoverflow.com/a/26648948
has comment: http://stackoverflow.com/comment/41894084
has comment: http://stackoverflow.com/comment/41827733
tagged with: spring
has comment: http://stackoverflow.com/comment/41893206

http://stackoverflow.com/comment/41897468
comment on: http://stackoverflow.com/q/26645940
type: Comment
type: QuestionComment
has text: what on earth is `sb.toString("final.txt")`
score: 0

http://stackoverflow.com/comment/41866317
type: Comment
has text: thanks siking for ur reply. here i can not use xpath because these fields generate at run time.can u suggest any alternative of xpath
type: AnswerComment
comment on: http://stackoverflow.com/a/26612218
score: 0

http://stackoverflow.com/q/26569504
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26569611
tagged with: spring
tagged with: model-view-controller
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26573176
has body: I am new to spring mvc. I am debugging a mvc code as given below @Controller @RequestMapping("/register") public class RegisterController extends BroadleafRegisterController { @RequestMapping(method=RequestMethod.GET) public String register(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("registrationForm") RegisterCustomerForm registerCustomerForm) { return super.register(registerCustomerForm, request, response, model); } @RequestMapping(method=RequestMethod.POST) public String processRegister(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("registrationForm") RegisterCustomerForm registerCustomerForm, BindingResult errors) throws ServiceException, PricingException { return super.processRegister(registerCustomerForm, errors, request, response, model); } @ModelAttribute("registrationForm") public RegisterCustomerForm initCustomerRegistrationForm() { return super.initCustomerRegistrationForm(); } } above is a spring handler class. for /register request i was thinking regsister() method should called but before this method inintcustomerRegisterationForm() is called i do not know why and how this method is called. I searched this in google but not find any useful information. I think this is like a interceptor method as in struts2. Please tell us how this method is called Thanks
tagged with: aop
has title: how handler mapping works in spring mvc
answer count: 2
downvote count: 0
tagged with: jsp
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/26596587
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26596747
tagged with: validation
answer count: 1
has body: I am working on a Spring Integration project. I have an xml input file that has had a style sheet applied to it. then it goes through a validation based on an xml schema. The validation is failing without telling me anything about why it is failing. The following is the log output with debug turned all the way up across the board. Any ideas how can I find out why it failing? 15:19:27.674 DEBUG [main] [org.springframework.integration.xml.selector.XmlValidatingMessageSelector] Message was rejected due to XML Validation errors 15:19:27.674 DEBUG [main][org.springframework.integration.channel.DirectChannel] preSend on channel 'sils-errors-validation-exception-channel', message: [Payload String content=<?xml version="1.0" encoding="UTF-8"?> <hcit:MessageHeader xmlns:hcit="http://www.co.hennepin.mn.us/Common"> <hcit:MessageSender> <hcit:OrganizationName>HJIP</hcit:OrganizationName> <hcit:ApplicationName>SILS</hcit:ApplicationName> <hcit:ContactName>HJIP Support</hcit:ContactName> <hcit:ContactPhoneNumber>612-348-6662</hcit:ContactPhoneNumber> </hcit:MessageSender> <hcit:MessageSentDateTime>2014-10-15T10:27:28</hcit:MessageSentDateTime> <hcit:ApplicationMessageID>9840306</hcit:ApplicationMessageID> <hcit:MessageTypeText>MODARR</hcit:MessageTypeText> <hcit:CommentText/> </hcit:MessageHeader> <hcit:MessageStatusText xmlns:hcit="http://www.co.hennepin.mn.us/Common">Error</hcit:MessageStatusText> <hcit:MessageText xmlns:hcit="http://www.co.hennepin.mn.us/Common">Booking Document has MNCIS case but no SILS ID - Booking Document thrown away</hcit:MessageText> AddSubjectEntity <CaseTrackingID xmlns:hcit="http://www.co.hennepin.mn.us/Common" hcit:referenceID="2014005849-001"/> <SubjectEntityID xmlns:hcit="http://www.co.hennepin.mn.us/Common" hcit:referenceID="201401400"/> ][Headers= {replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@94b64e, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@94…
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41831075
has title: Why is xml Validation failing?
tagged with: integration
has comment: http://stackoverflow.com/comment/41808710
type: Question
accepted answer: http://stackoverflow.com/a/26596747

http://stackoverflow.com/q/26614414
downvote count: 1
type: Question
tagged with: android-layout
tagged with: java
answer count: 1
has title: Android save and show user preferences using custom DialogPreference
favorite count: 0
score: 0
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26614680
tagged with: dialog-preference
upvote count: 1
has body: I'm trying to print the value of a editText in my preferenceActivity, and for that I'm using a custom DialogPreference so the user can enter the price to filter and when he clicks "ok" it should print the filtered price in the activity. But when I click "ok" it shows me nothing, what am I missing? public class MyDialogShow extends DialogPreference { private View view; private EditText maximo; private EditText minimo; private TextView valores; private Context context; private View v; @Override protected View onCreateDialogView() { // TODO Auto-generated method stub view= super.onCreateDialogView(); LayoutInflater inflater = LayoutInflater.from(getContext()); v = inflater.inflate(R.layout.pref_valor, null); valores = (TextView) v.findViewById(R.id.escolhaValor); minimo = (EditText) view.findViewById(R.id.minimo); minimo.addTextChangedListener(new TextWatcher() { boolean isEdiging; private String current = ""; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (!s.toString().equals(current)) { minimo.removeTextChangedListener(this); String replaceable = String.format("[%s,.\\s]", NumberFormat.getCurrencyInstance().getCurrency().getSymbol()); String cleanString = s.toString().replaceAll(replaceable, ""); double parsed; try { parsed = Double.parseDouble(cleanString); } catch (NumberFormatException e) { parsed = 0.00; } String formatted = NumberFormat.getCurrencyInstance().format((parsed/100)); current = formatted; minimo.setText(formatted); minimo.setSelection(formatted.length()); minimo.addTextChangedListener(this); } } }); maximo = (EditText) view.findViewById(R.id.maximo); maximo.addTextChangedListener(new TextWatcher() { boolean isEdiging; private String current = ""; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void befo…
tagged with: android-preferences

http://stackoverflow.com/q/26607384
accepted answer: http://stackoverflow.com/a/26612293
type: AnsweredQuestion
has title: JBoss OpenCV Unresolved compilation
tagged with: java
type: Question
tagged with: opencv
tagged with: jboss
tagged with: eclipse
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/16173362
has body: Problem Presentation My task is to create a Dynamic Web Project that is scanning Documents, which are coming from a Server, going through my Programm and splitting pictures from text. I need OpenCV Library for that. My code is runnning good in eclipse and it works fine. Now i needed to load the library not in eclipse but in jboss as global modules so that the server always know which libraries need to be loaded. I did all that as this link described: OpenCV as JBoss-as global module The answer of StreakyCobra, which says that the opencv.jar needs to be modified for the library load(Add a Loader.class to the jar). I did modified the opencv.jar, uploaded it, so that i can load the new jar with gradle and is works fine, so that my classes dont error. Im starting the jboss configured server and he is publishing my code and now im getting an error before he even goes through my code. Error 11:57:00,817 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-24) MSC00001: Failed to start service jboss.deployment.unit."OpenCv.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."OpenCv.war".INSTALL: Failed to process phase INSTALL of deployment "OpenCv.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_67] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_67] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_67] Caused by: java.lang.Error: Unresolved compilation problem: Loader cannot be resolved at com.eucon.OpenCv.OpenCvService.&lt;init&gt;(OpenCvService.java…
has answer: http://stackoverflow.com/a/26612293
tagged with: maven

http://stackoverflow.com/a/26607433
upvote count: 9
score: 9
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26579139
accepted answer of: http://stackoverflow.com/q/26579139
type: Answer
has comment: http://stackoverflow.com/comment/57492858
has comment: http://stackoverflow.com/comment/41844308
has body: Starting with Java 9, there is built-in support for this task: public class MyCompletableFuture&lt;T&gt; extends CompletableFuture&lt;T&gt; { public static &lt;T&gt; CompletableFuture&lt;T&gt; supplyAsync(Supplier&lt;T&gt; s, Executor e) { Objects.requireNonNull(s); Objects.requireNonNull(e); return new MyCompletableFuture&lt;T&gt;(e).completeAsync(s); } private final Executor executor; public MyCompletableFuture(Executor executor) { this.executor = executor; } @Override public &lt;U&gt; CompletableFuture&lt;U&gt; newIncompleteFuture() { return new MyCompletableFuture&lt;&gt;(executor); } @Override public Executor defaultExecutor() { return executor; } } By overriding newIncompleteFuture(), we can ensure that all then… and when…, etc. methods will return instances of MyCompletableFuture, without overriding each of them. The defaultExecutor() method specifies the executor to be used by all async methods without Executor parameter. Conveniently, the non-static method completeAsync allows us to get the supplyAsync behavior using an instance of our future implementation. The example above provides a static method supplyAsync which can be used similarly to the original one, i.e. MyCompletableFuture.supplyAsync(supplier, executor) In Java 8, you have to override all methods whose behavior you want to alter, using the decoration pattern, which still doesn’t need to touch any of the CompletableFuture’s inner workings. import java.util.concurrent.*; import java.util.function.*; public class MyCompletableFuture&lt;T&gt; extends CompletableFuture&lt;T&gt; { public static &lt;T&gt; CompletableFuture&lt;T&gt; supplyAsync(Supplier&lt;T&gt; s, Executor e){ return my(CompletableFuture.supplyAsync(s, e), e); } private static &lt;T&gt; CompletableFuture&lt;T&gt; my(CompletableFuture&lt;T&gt; f,Executor e){ MyCompletableFuture&lt;T&gt; my=new MyCompletableFuture&lt;&gt;(f, e); f.whenComplete((v,t)-&gt; { if(t!=null) my.completeExceptionally(t); else my.complete(v); }); return my; } pr…

http://stackoverflow.com/a/26610358
upvote count: 38
type: Answer
has comment: http://stackoverflow.com/comment/123436547
has comment: http://stackoverflow.com/comment/105078755
has comment: http://stackoverflow.com/comment/81399578
has comment: http://stackoverflow.com/comment/105078714
has comment: http://stackoverflow.com/comment/105085301
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26610309
downvote count: 0
has body: Add a modulo array length to your code: // create a newArray before of the same size as array // copy for(int x = 0; x &lt;= array.length-1; x++){ newArray[(x+a) % array.length ] = array[x]; } You should also create a new Array to copy to, so you do not overwrite values, that you'll need later on.
accepted answer of: http://stackoverflow.com/q/26610309
score: 38
has comment: http://stackoverflow.com/comment/81400613

http://stackoverflow.com/a/26564471
upvote count: 1
answers question: http://stackoverflow.com/q/26564302
has comment: http://stackoverflow.com/comment/41748366
type: Answer
downvote count: 0
has body: Changed the onTextChanged as follow: public void onTextChanged(CharSequence s, int start, int before, int count) { String inputs = myTextBox.getText().toString(); if(inputs.isEmpty()) outputTextBox.setText("0"); else{ int i = Integer.parseInt(inputs); i++; outputTextBox.setText(String.valueOf(i)); } } });
score: 1

http://stackoverflow.com/a/26549472
has comment: http://stackoverflow.com/comment/41721520
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26549013
answers question: http://stackoverflow.com/q/26549013
has comment: http://stackoverflow.com/comment/41723488
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41721768
has body: Since you want your textfields to be multilined, use JTextAreas. JTextFields are single lined only. Your components are right next to each other which isn't the same look as your intended outcome. There may be some method that gives your components some breathing room before you would call frame.pack() Look for any method that can make a component fill the total amount of room it's given; especially when you want something to fill a large chunk of space. You can set the number of columns instead of using setSize() for your JTextFields/JTextAreas. Just saying. Reviewing all of Java's Layout Managers would help you get a grasp of the capabilities and use cases for each layout manager
downvote count: 0

http://stackoverflow.com/q/26577809
has answer: http://stackoverflow.com/a/75316322
has comment: http://stackoverflow.com/comment/41773028
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41773064
tagged with: breakpoints
downvote count: 0
answer count: 1
favorite count: 0
has title: Java Eclipse Debug Terminating issue
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: Ive been debugging a project in eclipse. I inserted a breakpoint on a while statement. All was working fine, I was monitoring the variable increments. I tried to change the test class, but forgot I was still running the program, a message popped up and asked a question (I can't remember the exact phrasing) and I clicked terminate. But now when I run the debugger, it runs through the program and gives me the following &lt;terminated, exit value: 0&gt; But it doesn't allow me to step through the program. I tried "skip all breakpoints" but that isn't the answer.. It has something to do with the pop up message I'm pretty sure. Many Thanks for your help
has comment: http://stackoverflow.com/comment/41774984
type: Question
tagged with: debugging

http://stackoverflow.com/comment/41795772
comment on: http://stackoverflow.com/q/26590301
score: 0
type: Comment
type: QuestionComment
has text: @Bohemian Thanks bohemian, that's the thing I was looking for.

http://stackoverflow.com/a/59456039
upvote count: 30
answers question: http://stackoverflow.com/q/26591521
type: Answer
score: 30
has body: Like others who based their answers on HHH-9106 but, because I'm using Spring Boot with Java-based annotation, I had to use the following in application.properties: spring.jpa.properties.hibernate.event.merge.entity_copy_observer=allow
downvote count: 0

http://stackoverflow.com/comment/41871921
comment on: http://stackoverflow.com/q/26631694
score: 1
has text: On another note, why not just use a JTable, as it looks like the field are to create some tabular format. Considering you don't want the gaps, it seams reasonable, Especially because I don't see any labels for the fields. You can set the column width and row height on the table
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41730285
type: Comment
has text: I tried it before: java.lang.IllegalAccessException: Class com.test.jmx can not access a member of class sun.management.RuntimeImpl with modifiers "public"
type: AnswerComment
comment on: http://stackoverflow.com/a/26553466
score: 0

http://stackoverflow.com/comment/41862508
type: QuestionComment
has text: That's exactly my fear.
score: 0
comment on: http://stackoverflow.com/q/26626291
type: Comment

http://stackoverflow.com/comment/41928688
comment on: http://stackoverflow.com/a/26662495
score: 1
type: AnswerComment
type: Comment
has text: @ialarmedalien SO told me about the edit suggestion :)

http://stackoverflow.com/comment/41885156
has text: Thanks. It takes care of the infinite loop when server starts. The problem is when I login on login.jsp, it directly goes to the filter. I get the trace that you put, and it then it goes back to login page again. It never goes to LoginServlet. My LoginServlet forwards the request to list.jsp, that flow is not working now.
comment on: http://stackoverflow.com/a/26638834
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26592458
has title: JAXB complex mapping
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/41799888
accepted answer: http://stackoverflow.com/a/26592857
score: 2
has comment: http://stackoverflow.com/comment/41803672
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
has body: I have the following code: @XmlRootElement(name = "repository") @XmlAccessorType(XmlAccessType.FIELD) public class Repository { @XmlElement (name = "id") private String id; @XmlElement (name = "policy") private String policy; ... } @XmlRootElement(name = "storage") @XmlAccessorType(XmlAccessType.FIELD) public class Storage { @XmlElement (name = "id") private String id; /** * K: repository.id * V: Repository */ @XmlElement (name = "repositories") @XmlJavaTypeAdapter(RepositoryMapAdapter.class) private Map<String, Repository> repositories = new LinkedHashMap<String, Repository>(); ... } public class DataCenter { /** * K: storageId * V: storage */ @XmlElement(name = "storages") @XmlJavaTypeAdapter(StorageMapAdapter.class) //@XStreamAlias(value = "storages") private Map<String, Storage> storages = new LinkedHashMap<String, Storage>(); ... } I have the following two adapters: public class RepositoryMapAdapter extends XmlAdapter<RepositoryMapAdapter.RepositoryMap, Map<String, Repository>> { public static class RepositoryMap { @XmlVariableNode("id") List<RepositoryMapEntry> entries = new ArrayList<RepositoryMapEntry>(); } public static class RepositoryMapEntry { @XmlAttribute public String id; @XmlValue public Repository repository; } @Override public RepositoryMap marshal(Map<String, Repository> map) throws Exception { RepositoryMap repositoryMap = new RepositoryMap(); for (Map.Entry<String, Repository> entry : map.entrySet()) { RepositoryMapEntry repositoryMapEntry = new RepositoryMapEntry(); repositoryMapEntry.id = entry.getKey(); repositoryMapEntry.repository = entry.getValue(); System.out.println("Writing repository " + entry.getValue().getId()); repositoryMap.entries.add(repositoryMapEntry); } return repositoryMap; } @Override public Map<String, Repository> unmarshal(RepositoryMap repositoryMap) throws Exception { List<RepositoryMapEntry> adaptedEntries = repositoryMap.entries; Map<String, Repository> map = new LinkedHashMap<String, Repository>(adaptedEntries.size())…
has comment: http://stackoverflow.com/comment/41799945
has comment: http://stackoverflow.com/comment/41799862
has comment: http://stackoverflow.com/comment/41800600
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26592857
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/41799838

http://stackoverflow.com/a/26652891
score: 1
has comment: http://stackoverflow.com/comment/41909790
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41909694
has comment: http://stackoverflow.com/comment/41911394
upvote count: 1
has body: You can define getter in your ImpexWindow (better) or just use the class' field because the field is public (not recommended way). So in your ExportImportWindow you should keep a reference to the ImpexWindow where the combo box is defined and use the ImpexWindow's field
answers question: http://stackoverflow.com/q/26652310

http://stackoverflow.com/comment/41701932
score: 0
type: Comment
type: QuestionComment
has text: @Tom So what does the comment from Dan mean?
comment on: http://stackoverflow.com/q/26537717

http://stackoverflow.com/q/26599094
type: Question
score: 3
has comment: http://stackoverflow.com/comment/41812617
tagged with: java
has answer: http://stackoverflow.com/a/26599190
has comment: http://stackoverflow.com/comment/41812908
accepted answer: http://stackoverflow.com/a/26599190
has comment: http://stackoverflow.com/comment/41812839
upvote count: 3
has body: I've been trying to run an executable .bat file in Java using the line: Runtime.getRuntime().exec("call " + batFile); But it returns an error Could not start process with commandLine nullCreateProcess: call batfilename here error=2 IOException: Create Process: call batfilename here error=2 I managed to bypass this by replacing the String in the exec() function with "cmd /c start " + batFile but this opens a command prompt which is not allowed. Are there workarounds to this? Thanks!
answer count: 2
has comment: http://stackoverflow.com/comment/41812722
downvote count: 0
has title: Running a .BAT file in JAVA without opening a command prompt
favorite count: 0
has comment: http://stackoverflow.com/comment/41812962
has comment: http://stackoverflow.com/comment/41813191
possible better answer: http://stackoverflow.com/a/48110744
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48110744

http://stackoverflow.com/comment/41912698
type: Comment
comment on: http://stackoverflow.com/a/26654938
has text: *"I did not know you could integrate your own mapping with Jooq and will add that to the backlog."* - That would be very interesting! Thanks for this benchmark
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41809571
comment on: http://stackoverflow.com/a/26597539
has text: Thanks, that did it for me! Can't touch the functionality as my Raspberry is compiling something though!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41924472
score: 0
comment on: http://stackoverflow.com/q/26646747
has text: You haven't got a `run` method, just a `Runnable` class with some statements scattered in it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26615853
upvote count: 1
accepted answer: http://stackoverflow.com/a/26616419
tagged with: timeunit
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
type: Question
has body: The count down does not work. I'm triggering it through a button. public void startCountDown() { timer.schedule(new TimerTask() { @Override public void run() { Platform.runLater(new Runnable() { public void run() { countDown--; countDownText.setText("Time left:" + countDown); if (countDown &lt; 0) timer.cancel(); } }); } }, 1000); //Every 1 second } The countDown variable is set to 60, so the countdown starts at 60 EDIT: The countdown gets stuck at 59 seconds, countDown is an int. No errors. And countDownText is declared as text. @FXML private Text countDownText;
downvote count: 0
answer count: 1
favorite count: 0
has title: JAVAFX, Countdown doesn't work
has comment: http://stackoverflow.com/comment/41843104
has answer: http://stackoverflow.com/a/26616419

http://stackoverflow.com/a/26547524
type: Answer
answers question: http://stackoverflow.com/q/26547308
has body: IndexOutOfBoundsException will occur - if any of the below conditions are met `counterOne` is negative, or `counterTwo` is larger than the length of `answer`, or `counterOne` is larger than `counterTwo`. before you do answer.substring(counterOne, counterTwo) you can do as below if (counterOne &gt;= 0 &amp;&amp; counterTwo &lt; answer.length &amp;&amp; counterOne &lt;= counterTwo)
score: 0

http://stackoverflow.com/q/26544679
has body: I want to get high quality images of my network created in Jung. ExportDialog of the FreeHEP VectorGraphics library gives this option in the form of a dialog box. ExportDialog export = new ExportDialog(); export.showExportDialog(vv, "Export view as ...", vv, "export"); Where vv is the VisualizationViewer that I want to print out. I want to avoid choosing the file type and location everytime and automize the export so that the file is automatically saved to a folder as a pdf file. So I wrote the following code but it does not generate the picture that I want. Properties p = new Properties(); p.setProperty("PageSize","A4"); VectorGraphics g = new PSGraphics2D(new File("Output.pdf"),vv.getSize()); g.setProperties(p); g.startExport(); vv.print(g); g.endExport(); Related links : Exporting JUNG graphs to hi-res images (preferably vector based) and http://java.freehep.org/vectorgraphics/Manual.html
tagged with: java
tagged with: image
answer count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/26558493
has title: Java automization of Export HQ Images to pdf
score: 0
linked to: http://stackoverflow.com/q/8518390
tagged with: jung2
accepted answer: http://stackoverflow.com/a/26558493
type: Question
type: AnsweredQuestion

filereader
tags question: http://stackoverflow.com/q/26664696
tags question: http://stackoverflow.com/q/26570753
tags question: http://stackoverflow.com/q/26644603
tags question: http://stackoverflow.com/q/26558982
tag name: filereader
type: Tag

http://stackoverflow.com/comment/41659661
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26514870
has text: Outstanding, thank you very much. Works like a charm!

http://stackoverflow.com/comment/41894705
score: 0
comment on: http://stackoverflow.com/q/26644135
type: Comment
type: QuestionComment
has text: What are those `two ways` ?

http://stackoverflow.com/q/26557637
favorite count: 0
has answer: http://stackoverflow.com/a/26557724
has comment: http://stackoverflow.com/comment/41736583
tagged with: android-resources
type: Question
tagged with: android
score: 4
answer count: 2
has answer: http://stackoverflow.com/a/26557709
downvote count: 1
has body: This an example from Big Nerd Ranch Guide: package com.example.geoquiz; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class QuizActivity extends ActionBarActivity { private Button mTrueButton; private Button mFalseButton; private Button mNextButton; private TextView mQuestionTextView; private TrueFalse[] mQuestionBank = new TrueFalse[] { new TrueFalse(R.string.question_africa, true), new TrueFalse(R.string.question_americas, false), new TrueFalse(R.string.question_asia, false), new TrueFalse(R.string.question_mideast, true), new TrueFalse(R.string.question_oceans, true) }; private int mCurrentIndex = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); mTrueButton = (Button)findViewById(R.id.true_button); mFalseButton = (Button)findViewById(R.id.false_button); mTrueButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(QuizActivity.this, R.string.incorrect_toast, Toast.LENGTH_SHORT).show(); } }); mFalseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(QuizActivity.this, R.string.correct_toast, Toast.LENGTH_SHORT).show(); } }); mQuestionTextView = (TextView)findViewById(R.id.question_text_view); int question = mQuestionBank[mCurrentIndex].getQuestion(); mQuestionTextView.setText(question); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.quiz, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action b…
upvote count: 5
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26557709
possible better answer: http://stackoverflow.com/a/26557724
tagged with: textview
has title: How does Android TextView.SetText(int resid) work?

http://stackoverflow.com/comment/41786113
has text: @T.J.Crowder Yes, by original form, I mean the one in the input.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26584974

http://stackoverflow.com/a/26664039
answers question: http://stackoverflow.com/q/26663694
has body: When creating Classroom instance studentobject list is created empty and it stays that way so you can't access first (or any) object in it. To populate your list you may add to Classroom method like this: public void addStudent(Student s) { studentobject.add(s); }
score: 0
type: Answer

http://stackoverflow.com/comment/41677909
has text: Is your app multi-threaded?
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/26525162
type: Comment

http://stackoverflow.com/comment/41855496
type: QuestionComment
has text: Did u run your code in debug mode and can you pin point the line where it is throwing the exception, and what exception is it throwing?
score: 0
comment on: http://stackoverflow.com/q/26622525
type: Comment

http://stackoverflow.com/q/26598966
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/26599283
type: Question
has body: I have a standard Spring MVC controller (that services REST calls) like so: @Controller public class SpringRestController { @RequestMapping({"/message"}) @ResponseBody public Message getMessage(@RequestParam(required=false) String username, HttpServletRequest request) { return new Message("Hello " + username); } } My understanding is Spring MVC will invoke HttpServletRequest.getParameter("username") and inject the result into the "username" method parameter. But my original request does not contain a "username" parameter. I lookup another request parameter, construct a "username" value and set it in a HttpServletRequestWrapper implementation (using a custom filter). Like so: public class UserResolvingFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { filternChain.doFilter( new HttpServletRequestWrapper(request) { @Override public String getParameter(String name) { return getParameterMap().get(name); } @Override public Map<String, String[]> getParameterMap() { Map<String, String[]> map = new HashMap(super.getParameterMap()); // Simplified for brevity map.put("username", new String[] {"testUserName"}); return map; } }, response ); } } The Filter is configured in web.xml like so: userResolvingFilter my.package.UserResolvingFilter userResolvingFilter /* The issue: The username parameter in my getMessage controller method is always null. I have confirmed that The filter is successfully invoked. Spring invokes my anonymous implementation of HttpServletRequestWrapper.getParameter(String name) with a couple of other parameter names but never with "username". Spring does not invoke my anonymous implementation of HttpServletRequestWrapper.getParameterMap(). Not sure if it should. The "request" parameter (in getMessage() method) is an instance of HttpServletRequestWrapper. I am wondering what could be going wrong? Note: I have presented only the relevant cod…
tagged with: java
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
has title: @RequestParam fails with HttpServletRequestWrapper
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/41664612
type: QuestionComment
comment on: http://stackoverflow.com/q/26514740
type: Comment
score: 0
has text: @AndroidAddict which language is this coded in you didnt put a tag

http://stackoverflow.com/q/26545887
has comment: http://stackoverflow.com/comment/41715190
favorite count: 0
has body: I want to use this JXDatePicker component in a application that will work on a touch display. Because the default component is small, all the dates and the buttons are hard to click using a bad touch screen I wanted to make them bigger. So far I successfully made the result text field bigger (the one showing the selected date, by changing the font), make the pop-up bigger (the JXMonthView, also by changing its font), change the picture of the JXDatePicker with a bigger image, set the default date to be the current date, set the date format, etc. This is my code: private void touch_screen_datepicker(JXDatePicker date_picker) { Toolkit toolkit = Toolkit.getDefaultToolkit(); JXMonthView monthView = date_picker.getMonthView(); date_picker.setDate(new Date()); date_picker.setFont(new Font(Font.DIALOG, Font.PLAIN, 50)); JButton btn_pick = (JButton) date_picker.getComponent(1); btn_pick.setBackground(new Color(66, 147, 223)); Image image = toolkit.getImage("/home/adrrian/Image/calendar/" + "calendar image 4.png"); //Земање на сликата за мк знаме ImageIcon icon = new ImageIcon(image); //Правење на икона btn_pick.setIcon(icon); //Поставување на иконата SimpleDateFormat longFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat shortFormat = new SimpleDateFormat("yy-MM-dd"); Date startDate = new Date(0);//01.01.1970 shortFormat.set2DigitYearStart(startDate); DatePickerFormatter formatter = new DatePickerFormatter( // invers sequence for parsing to satisfy the year parsing rules new DateFormat[]{shortFormat, longFormat}) { @Override public String valueToString(Object value) throws ParseException { if (value == null) { return null; } return getFormats()[1].format(value); } }; DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); date_picker.getEditor().setFormatterFactory(factory); monthView.setFont(new Font(Font.DIALOG, Font.PLAIN, 50)); monthView.setFirstDayOfWeek(Calendar.MONDAY); } and this is an image of my final work: My main problem is how to m…
has comment: http://stackoverflow.com/comment/41718390
tagged with: datepicker
has comment: http://stackoverflow.com/comment/41719452
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41718301
has answer: http://stackoverflow.com/a/26549227
type: Question
has answer: http://stackoverflow.com/a/41895754
answer count: 2
has title: JXDatePicker make arrows in the JXMonthView bigger
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/comment/41933291
type: Comment
comment on: http://stackoverflow.com/q/26665709
has text: I'll try it, it should work though. Thanks! @MatiCicero
score: 0
type: QuestionComment

http://stackoverflow.com/a/26586701
downvote count: 1
has body: You should work with dynamic structures like java.util.Map. Try with this: import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; public class JsonTest { public static void main(String[] args) { String json = "{\"array\": [{\"object1\": {\"aa\": \"somevalue1\",\"bb\": \"somevalue2\",\"cc\": \"somevalue3\"}},{\"object2\": {\"aa\": \"somevalue4\",\"bb\": \"somevalue5\",\"cc\": \"somevalue6\"}}]}"; System.out.println(json); final MyJson parseJsonSpecification = parseJsonSpecification(json); System.out.println(parseJsonSpecification.array.get(0).get("object1")); System.out.println(parseJsonSpecification); } public static MyJson parseJsonSpecification(String jsonString) { try { if (StringUtils.isBlank(jsonString)) { return new MyJson(); } MyJson ret; ret = new ObjectMapper().readValue(jsonString, new TypeReference&lt;MyJson&gt;() { }); return ret; } catch (Exception ex) { throw new IllegalArgumentException("La expresión '" + jsonString + "' no es un JSON válido", ex); } } } class MyJson { public List&lt;Map&lt;String, Object&gt;&gt; array; }
score: 0
answers question: http://stackoverflow.com/q/26586103
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41711643
type: QuestionComment
comment on: http://stackoverflow.com/q/26543804
has text: Do you use Maven or Gradle?
score: 0
type: Comment

http://stackoverflow.com/comment/41845524
comment on: http://stackoverflow.com/a/26592857
score: 0
type: AnswerComment
has text: My e-mail is my username `@gmail.com`. Drop me a line and I'll share some details. :)
type: Comment

http://stackoverflow.com/q/26543686
has comment: http://stackoverflow.com/comment/41711192
has comment: http://stackoverflow.com/comment/41711244
downvote count: 0
possible better answer: http://stackoverflow.com/a/26543799
has answer: http://stackoverflow.com/a/26543826
has comment: http://stackoverflow.com/comment/41711313
tagged with: android
has comment: http://stackoverflow.com/comment/41711120
has comment: http://stackoverflow.com/comment/41711318
favorite count: 0
has title: Android for loop not working in main thread
has comment: http://stackoverflow.com/comment/41711193
has body: i try to rotate image. i used runnable to rotate image,i wrote for loop and i want to rotate image inside for loop this is a my source public void rotateimages(final View myView) { myHandler = new Handler(); runnable = new Runnable() { @Override public void run() { double k = 30; double speed = Math.PI / k; for (alpa = 0; alpa &lt; (Math.PI * 6 + res * 2 * Math.PI / 5); alpa += speed) { myView.setRotation((float) (myView.getRotation() - alpa)); Log.e("alpa values", String.valueOf(alpa)); k = Math.min(k + 0.2, 240); speed = Math.PI / k; myHandler.postDelayed(this, 100); } // rotateimages(); } }; myHandler.postDelayed(runnable, 180); } when i run my app i can rotate only one time.what is a wrong in my code? if anyone knows solution please help me
has answer: http://stackoverflow.com/a/26543799
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41711084
upvote count: 3
has comment: http://stackoverflow.com/comment/41711272
tagged with: java
has comment: http://stackoverflow.com/comment/41711152
accepted answer: http://stackoverflow.com/a/26543826
type: Question
tagged with: rotation
answer count: 2
tagged with: for-loop

http://stackoverflow.com/q/26556301
downvote count: 0
tagged with: jar
tagged with: url
has comment: http://stackoverflow.com/comment/41734259
favorite count: 0
has comment: http://stackoverflow.com/comment/41793714
has comment: http://stackoverflow.com/comment/41734181
has comment: http://stackoverflow.com/comment/41734553
has comment: http://stackoverflow.com/comment/41734168
has comment: http://stackoverflow.com/comment/41734268
has body: I have this Jar file.. core.jar: META-INF/... com/... config myLog4j.xml schema The class that is trying to read/load is in com/my/company/MyLogging.class The code is this, inside MyLogging class: URL myUrl = MyLogging.class.getResource("/config/myLog4j.xml"); myUrl is null. Its not returning the resource/file. Edit: Included the picture of path. tar output: 0 Fri Oct 24 16:15:10 CDT 2014 META-INF/ 122 Fri Oct 24 16:15:08 CDT 2014 META-INF/MANIFEST.MF 0 Wed Oct 22 16:40:26 CDT 2014 com/ 0 Wed Oct 22 16:40:26 CDT 2014 com/my/company/.. ..... 0 Wed Oct 08 11:20:42 CDT 2014 config/ 0 Wed Oct 08 11:20:42 CDT 2014 config/email/ 0 Wed Oct 08 11:20:44 CDT 2014 schema/ 0 Wed Oct 08 11:20:42 CDT 2014 schema/alliance/ 0 Wed Oct 08 11:20:44 CDT 2014 schema/tibco/ 7972 Fri Oct 24 16:15:08 CDT 2014 com/my/company/MyLogging.class 2045 Wed Oct 08 11:20:42 CDT 2014 config/myLog4j.xml 400 Wed Oct 08 11:20:42 CDT 2014 config/email/bodyDashtemp.st 1583 Wed Oct 08 11:20:42 CDT 2014 schema/Castor-XMLJavaScript.txt 18958 Wed Oct 08 11:20:44 CDT 2014 schema/tibco/TIBCO_EventSchema.xsd Edit: I am running it from command line. JUnit test. Edit: More info... This (core.jar) is a dependency Jar file. It is included in the classpath of the JUnit test class file. This MyLogging.class is used in the class that is being unit tested. And the class I am unit testing is actually a Struts2 action class. Its a unit test and not an integration test. Meaning, this action class is treated as a regular class instead of Action class. Edit: Manifest.mf contents: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.4 Created-By: pwa6460_26sr7ifx-20131203_01 (SR7) (IBM Corporation)
has comment: http://stackoverflow.com/comment/41734510
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41735346
has comment: http://stackoverflow.com/comment/41734556
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/41736560
has comment: http://stackoverflow.com/comment/41734314
has title: Why does URL return null here when trying to get a resource inside Jar?
tagged with: java
has comment: http://stackoverflow.com/comment/41734206
has answer: http://stackoverflow.com/a/26589550
has comment: http://stackoverflow.com/comment/41735485
type: Question
answer count: 1

http://stackoverflow.com/comment/41834551
type: QuestionComment
comment on: http://stackoverflow.com/q/26611230
has text: My application has this factory design pattern in place, hence I am looking for a way to resolve it in the same approach. I understand, injecting the datasource directly in the individual DAO's, which I don't prefer as per design. Also, I am not using `JDBC Template` because I am calling the Stored Procedures from my code
score: 0
type: Comment

http://stackoverflow.com/q/26597658
tagged with: java
has answer: http://stackoverflow.com/a/26598415
tagged with: jtwig
downvote count: 0
answer count: 1
tagged with: template-engine
has body: Recently began using Jtwig and have no idea how to easily obtain session, servletrequest, remote user and so on. In Thymeleaf, for example, it can be done that way: ... Documentation nor Google was not able to answer my question. Probably, this is not implemented (yet?) and i always must put necessary objects manually into the ModelMap?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26598415
tagged with: spring
type: AnsweredQuestion
has title: Jtwig How to obtain HttpSession / HttpServletRequest?
score: 1
upvote count: 1
type: Question
tagged with: session

http://stackoverflow.com/comment/41722546
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26547164
has text: How do you want to rollback something that is already committed?
score: 0

http://stackoverflow.com/q/26654592
score: 1
tagged with: java
has title: JAXB - Change the structure child node
has comment: http://stackoverflow.com/comment/41912496
tagged with: jaxb
has body: I have the structure generatade in jaxb: 000 GO 7784CRM 13 CIRURGIA 14 CIRURGIA GERAL I need this structure 0000 GO 0000CRM 13 CIRURGIA PLASTICA 14 CIRURGIA GERAL The CrmDTO class: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class CrmDTO extends ParentDTO { @XmlElement(name="codigo") private Long CODIGO; @XmlElement(name="uf") private String UF; @XmlElement(name="crm") private String CRM; @XmlElement(name = "Especialidade") private List<EspecialidadeDTO> especialidades; The EspecialidadeDTO class: @XmlType(propOrder= {"CODIGO", "NOME"}) @XmlAccessorType(XmlAccessType.FIELD) public class EspecialidadeDTO extends ParentDTO { @XmlElement(name="codigo") private Long CODIGO; @XmlElement(name="nome") private String NOME; I've tried several ways and can not help the way I want. Put some Annotations I found some tutorials but failed
type: Question
has answer: http://stackoverflow.com/a/26655524
has comment: http://stackoverflow.com/comment/41912289
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26655524
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/41912011
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41912431

http://stackoverflow.com/a/26577647
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26576882
answers question: http://stackoverflow.com/q/26576882
type: Answer
has comment: http://stackoverflow.com/comment/41839526
has comment: http://stackoverflow.com/comment/41778116
has body: I am guessing that what you call a register I call a cell. If you have an excel spreadsheet with thousands of cells, and you want good performance, you can't use an excel spreadsheet. That is because an excel spreadsheet is a tool built for many possible computations, and you are only using one of the possible computations. Since you are using hibernate, I know that you are using Java. I am also going to guess that you are using a relational database, because that is what hibernate is build to do. So, I think you are pulling your data out of a relational database (like Oracle, MySQL, PostGres, or Microsoft SQL Server). If I am wrong, then don't pay too much attention to the next paragraph. If you data is coming from a database, and you are writing it to a spreadsheet, then you need to order the data retrieval from the database so you don't have to load all of the data into memory before writing some of it out to the spreadsheet. This might mean selecting the first thousand cells from the database and writing them, and then the next thousand, and so on. This prevents your program from using too much memory, which can create certain kinds of performance problems. The real key to solving a performance problem is not which tools you use, but identifying which part of the program is using the scarce resource. For some, time is the scarce resource, for others it is memory, and for others it is something else. Good performance is knowing which resources you cannot use more of, and which resources you can use more of. You might trade memory for time, or time for disk space, etc. Once you can identify which part of your program is too slow, there are two techniques: If the slow part is used a lot, use it less. Speed up the slow part. Unfortunately, with the wording of your question, this is probably the best answer you are going to get. Good Luck! PS. Virtualization only helps if the problem is that you don't have enough "real" items, but the real items can be substituted wi…
has comment: http://stackoverflow.com/comment/41773303
score: 0

http://stackoverflow.com/comment/41740106
comment on: http://stackoverflow.com/q/26559666
score: 0
has text: I dont know where to add the direction class
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26548103
answer count: 1
has body: Yesterday we had a weird problem with our tomcat 6 server which is running on Debian: We had second long freezes/outages that increased in length over time. In the frozen periods all our independent web apps were unresponsive. The outages had a very high regularity and over the course of one hour the outage phases became longer than the active phases, until we restarted the server which solved the problem. Now we want to find out what it was or find a solution to find out what it is if it happens again! During each outage phase one of the 24 cores was used 100% by one of the tomcat threads, so we assume whatever that thread was doing was freezing the whole tomcat. Sadly we have no idea what that thread was working on. Today I researched a solution to get the TID of a java thread and I found a wonderful solution: Obtaining the thread ID for Java threads in Linux . Putting it in our extensive log file entries and finding the JVM thread would be easy enough, but what if it's a thread that isn't exactly under our control? And what about the annoyance of having a synced TID / Java-Thread-ID snapshot? This leads to my core question: Is there a way to get the JVM Thread name/id from a known Linux TID? My hopes are small, but maybe there is a cross process call to the JVM or another idea I haven't considered yet. We have the Yourkit profiler running on that server, but during the outage phases it wasn't able to record anything, so we couldn't find the offending thread.
tagged with: tomcat
tagged with: jvm
favorite count: 0
upvote count: 5
linked to: http://stackoverflow.com/q/11224394
has title: How to obtain the JVM thread name/id through the known PID/TID
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26550955
accepted answer: http://stackoverflow.com/a/26550955
downvote count: 0
tagged with: java
type: Question
score: 5

http://stackoverflow.com/q/26518638
answer count: 1
downvote count: 0
tagged with: android-activity
has comment: http://stackoverflow.com/comment/41667276
favorite count: 0
has title: How to getActivity() in a static method?
linked to: http://stackoverflow.com/q/987072
type: UnansweredQuestion
tagged with: fragment
has body: I would like to call method1 from another class, but how can i use getActivity() in a static method? I only found examples for FragmentActivity or other types. I am sorry if this question already got answered somewhere else, but i could not find anything that i could implement in my code. Any help is appreciated. public class Tab1 extends Fragment { public static String readFromFileKurs(Context ctx) { ret = ""; try { InputStream inputStream = ctx.openFileInput("configkurs.txt"); if ( inputStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String receiveString = ""; StringBuilder stringBuilder = new StringBuilder(); while ( (receiveString = bufferedReader.readLine()) != null ) { stringBuilder.append(receiveString); } inputStream.close(); ret = stringBuilder.toString(); } } catch (FileNotFoundException e) { Log.e("login activity", "File not found: " + e.toString()); } catch (IOException e) { Log.e("login activity", "Can not read file: " + e.toString()); } return ret; } public static void method1(){ temp = readFromFile(getActivity()); } }
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26518947

http://stackoverflow.com/a/26618060
accepted answer of: http://stackoverflow.com/q/26577202
downvote count: 0
answers question: http://stackoverflow.com/q/26577202
upvote count: 2
type: AcceptedAnswer
has body: It seems the issue was following. .java file should be placed in "src" directory within the Project folder, rather than straight in the Project folder. So if say "Project" is one's destination folder, then one can: choose from menu: New Project-Java-Java project from existing resources - indicate path to the ...\Project folder the next step is to choose "Source Packages Folders" and here the path should lead to ...\Project\src .If the file .java is correctly placed there, the creator will indicate below that .java file is included to the project If the code is right after finishing the creator and compiling it we get a compiled class Project.class and we can run it :) Not sure if there is some work around to this in NetBeans, as it's not super intuitive, but I might not have found a better option.
type: Answer
score: 2

http://stackoverflow.com/q/26644859
favorite count: 0
has comment: http://stackoverflow.com/comment/41900198
tagged with: karma-runner
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41896087
tagged with: maven
has body: I have installed Maven 3.0.5 on my windows 8 64 bit machine by the following steps: Downloaded apache-maven-3.0.5.bin.zip and the archive is stored in C:\Program Files\Apache Software Foundation. I changed the environment variables as follows: M2_HOME with value C:\Program Files\Apache Software Foundation\apache-maven-3.0.5 M2 with value %M2_HOME%\bin JAVE_HOME with value C:\Program Files\Java\jdk1.8.0_25 PATH with value %M2%;%JAVA_HOME%\bin after this when i type mvn --version i get Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21: 28+0530) Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.0.5 Java version: 1.8.0_25, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_25\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 8", version: "6.2", arch: "amd64", family: "dos" I have downloaded JDK and JRE in the folders under C:\Program Files\Java\jdk1.8.0_25 C:\Program Files\Java\jre1.8.0_25 Now for Karma to install I downloaded the Web-Karma-Master zip and the archive is placed under C:\Program Files\Web-Karma-master\Web-Karma-master Now when I type mvn clean install in this directory I get the following: .. ... ... [INFO] karma-mr .......................................... SKIPPED [INFO] karma-storm ....................................... SKIPPED [INFO] karma-web-services ................................ SKIPPED [INFO] web-services-rdf .................................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.285s [INFO] Finished at: Wed Oct 29 13:21:14 IST 2014 [INFO] Final Memory: 8M/109M [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.codehaus.mojo:exec-maven-plugin:1.1 or one of its dependencie s could not be resolved: Failed to read artifact descriptor for or…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26647722
accepted answer: http://stackoverflow.com/a/26647722
upvote count: 1
has title: problems in installing Karma integration tool for windows 8 64 bit machine
answer count: 1
has comment: http://stackoverflow.com/comment/41899443

http://stackoverflow.com/q/26601849
score: 0
has answer: http://stackoverflow.com/a/26602741
answer count: 2
has title: Dynamic properties in Java from xml
has answer: http://stackoverflow.com/a/26603314
has body: I'm fiddling around with an idea but can't get a grip on it. I have an xml file with 100+ properties defining the runtime environment of a somewhat large program. These are exposed as variables through a class . At the moment, for each option in the xml file, there is a variable in the class plus public getter and private setter. Each time we need a new option, we have to define it in the xml file and create the variable plus methods in the RuntimenEnvironment class. Now, what I would like to do is something like this: I want to rewrite the class in such a way, that it exposes new options from the xml file as vars without having to touch the class. My xml file uses this structure: theName eg int 20 THE_NAME Can I write code in java that dynamically creates the vars at runtime and exposes them through a method without actually writing the method? Is this possible? Thanks in advance, Chris
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26602741
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26603314

http://stackoverflow.com/q/26547277
type: Question
accepted answer: http://stackoverflow.com/a/26547586
tagged with: arrays
tagged with: lucene
score: 0
has answer: http://stackoverflow.com/a/26547586
answer count: 1
has comment: http://stackoverflow.com/comment/41718238
tagged with: full-text-search
has body: i have an large Array of String, say its length is about 30000, and also those string are fairly long (about 10 line of text). now my Question is what is best way to search in this array? someone told me to use FTS3, is it possible to search in arrays? or apache lucene? i want and an advanced search.
has comment: http://stackoverflow.com/comment/41718143
tagged with: android
has comment: http://stackoverflow.com/comment/41717368
has comment: http://stackoverflow.com/comment/41717843
type: AnsweredQuestion
has title: what is the best way to full text search in a large Array of String in android?
has comment: http://stackoverflow.com/comment/41717449
tagged with: java

http://stackoverflow.com/q/26537930
has answer: http://stackoverflow.com/a/26538045
has body: I'm trying to select just names from text like this (Slovak dump of Wikipedia): |Meno = Hans Joachim |Plné meno = Aristoteles (???????????) |Plné meno = Francis Bacon |Plné meno = Sokrates () |Meno = Svätý František z Assisi &lt;br /&gt; ''(Giovanni Battista Bernardone)'' |Meno = Friedrich Ludwig Gottlob Frege |Meno = Adam František Kollár (Kolárik) |meno = John Edgar Hoover |meno = Benedikt XIV. |meno = Milan Rastislav Štefánik |Meno = '''Ján Filc''' |Meno = Jean le Rond d'Alembert Output should be like: Hans Joachim Aristoteles Francis Bacon Sokrates Svätý František z Assisi Friedrich Ludwig Gottlob Frege Adam František Kollár (Kolárik) J. Edgar Hoover|John Edgar Hoover Benedikt XIV. (1740 – 1758)|Benedikt XIV. Milan Rastislav Štefánik|Milan Rastislav Štefánik Ján Filc Jean le Rond d'Alembert When the name is written correctly, this regular expression is working fine: = *(.*?)$ But when there are thing like "(???????????)", HTML tags and something between "{{" and "}}", I cannot select the name without the unwanted substring. I tried a lot of options on this regex tester page (http://regex101.com/r/gS8iQ9/1), but none of them worked. In Java code I'm using Pattern pattern = Pattern.compile("= *(.*?)$"); Matcher matcher = pattern.matcher(line); if (matcher.find()) { String foundSubstring = matcher.group(1); ... Thanks for any help or suggestions on how select text after "=" but without question marks, HTML code and so on.
tagged with: regex
has title: Select row without substring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: wikipedia
accepted answer: http://stackoverflow.com/a/26538045
type: Question
possible better answer: http://stackoverflow.com/a/26538026
has answer: http://stackoverflow.com/a/26538026
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41728753
has text: ok i did this ill post a new example in a moment now it says "class, interface, or enum expected" and my System.out.println still have errors
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26539675
score: 0

http://stackoverflow.com/comment/41743770
type: AnswerComment
has text: i changed the [code] *.spring</url-patter> to / [code] and form action as well as the spring action method to "/Login.htm" also changed the 17th line of controller class @RequestMapping as " [code]@RequestMapping(value="/processCredentials" , method =RequestMethod.POST)"[code] so now the error m getting is HTTP Status 404 - /Login.htm type Status report message /Login.htm description The requested resource is not available. Apache Tomcat/8.0.12
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26560247

http://stackoverflow.com/comment/41693022
comment on: http://stackoverflow.com/a/26532372
has text: I found the chapter in the book online here is it: http://math.hws.edu/eck/cs124/javanotes7/c13/s2.html I think your problem has something to do with the leading property.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26519815
type: AnsweredQuestion
has body: This method has myNumSides equal to 4, myNumSides is a user-inputted. After myAngle being casted as a double it still returns 0.0 instead of 0.5. Why is this? public double getMyAngle() { int n; n = myNumSides; double myAngle = (double) ((n - 2) / n); return myAngle; } Output Please enter number of sides =&gt; 4 Please enter length of each side =&gt; 100 Your polygon has 4 sides. Each side of your polygon has a length of 100.0. The angle of each vertex is 0.0.
tagged with: java
has answer: http://stackoverflow.com/a/26519827
has answer: http://stackoverflow.com/a/26519869
type: Question
has answer: http://stackoverflow.com/a/26519908
has comment: http://stackoverflow.com/comment/41668896
has comment: http://stackoverflow.com/comment/41668957
has comment: http://stackoverflow.com/comment/41668933
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26519856
upvote count: 2
answer count: 5
has title: Java ((4-2) / 4) = 0.0 not 0.5 after casting as double
has answer: http://stackoverflow.com/a/26519887
accepted answer: http://stackoverflow.com/a/26519908
possible better answer: http://stackoverflow.com/a/26519856
score: 2

http://stackoverflow.com/a/26556169
has body: You really don't want to be writing low-level Java code for a problem like this. It's much better done in XSLT or XQuery. Your example output isn't achievable in a completely generic way because you are handling different elements differently, for example with Adjustment/@Type you output the attribute name, but with SimpleValue/@Value you output the element name. Let's suppose that's an oversight. Then this XSLT rule would give you what you want: &lt;xsl:template match="Rule//@*"&gt; &lt;xsl:value-of select="concat(ancestor::Rule/@Name, ' ', name(), ' ', .)"/&gt; &lt;/xsl:template&gt; That has to beat writing reams of Java code.
type: Answer
answers question: http://stackoverflow.com/q/26549833
score: 0

http://stackoverflow.com/q/26548660
tagged with: picasso
favorite count: 0
has answer: http://stackoverflow.com/a/26549375
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/42292033
has answer: http://stackoverflow.com/a/50689094
has answer: http://stackoverflow.com/a/37544047
has body: Is there a way to listen for events from Picasso when using the builder like: Picasso.with(getContext()).load(url).into(imageView); I'm trying to call requestLayout() and invalidate() on the parent GridView so it'll resize properly but I don't know how to set a listener or callback. I see that Picasso has error event reporting, but is there a success event?
has answer: http://stackoverflow.com/a/32839518
has answer: http://stackoverflow.com/a/33938243
type: Question
has title: How to listen for Picasso (Android) load complete events?
upvote count: 97
tagged with: java
possible better answer: http://stackoverflow.com/a/26549375
has answer: http://stackoverflow.com/a/26548894
score: 97
accepted answer: http://stackoverflow.com/a/26548894
downvote count: 0
answer count: 7
tagged with: android

http://stackoverflow.com/a/26519976
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41669355
answers question: http://stackoverflow.com/q/26519943
has body: Hashing does not guarantee that there will be no collisions if the key is unique. In fact, the only thing that's required is that objects that are equal have the same hashcode. The number of collisions determines how efficient retrieval will be (fewer collisions, closer to O(1), more collisions, closer to O(n)). What an object's hashcode will be depends on what type it is. For instance, a string's default hashcode is s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] which necessarily simplifies down the complexity of the string to a single number -- definitely possible to reach the same hashcode with two different strings, though it'll be pretty rare. If two things hash to the same thing, hashmap uses .equals to determine whether a particular key matches. That's why it's so important that you override both hashCode() and equals() together and ensure that things that are equal have the same hash code.
score: 3
accepted answer of: http://stackoverflow.com/q/26519943

http://stackoverflow.com/a/26648446
answers question: http://stackoverflow.com/q/26648107
has comment: http://stackoverflow.com/comment/41901812
has comment: http://stackoverflow.com/comment/41901732
type: Answer
has comment: http://stackoverflow.com/comment/41902805
has body: One thing you can do with java 8 is avoid making a separate method (if that calls to you) and create one right inside your method using the new syntax: BiConsumer&lt;Thing, Thing&gt; check = (actual, recommended) -&gt; { if (actual.getNumber() &lt;= recommended.getNumber()) { actual.setInvalid(); showErrorWindow(); throw new NumberFormatException(); } }; check.accept(downstreamActual, downstreamRecommended); check.accept(upstreamActual, upstreamRecommended); check.accept(biUpstreamActual, biUpstreamRecommended); check.accept(biDownstreamActual, biDownstreamRecommended);
has comment: http://stackoverflow.com/comment/41905232
score: 0

http://stackoverflow.com/comment/41696373
comment on: http://stackoverflow.com/a/26535123
score: 0
type: Comment
type: AnswerComment
has text: 32bytes are more then one int? A int is 4byte

http://stackoverflow.com/a/26639237
score: 2
has body: In java : 10 / 3 + 2 * 4 / 3 - 3 (10 / 3) + (2 * (4 / 3))) - 3 3 + (2 * 1) - 3 3 + 2 - 3 2 Everything is cast to int, that why it's giving this result.
upvote count: 2
has comment: http://stackoverflow.com/comment/41887067
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26639137

http://stackoverflow.com/q/26516492
has comment: http://stackoverflow.com/comment/41677275
has body: I am launching an application from Java using the getRuntime().exec(...) method, everything works perfectly except for one thing: the program (a 3d robot simulator in my case) runs slower compared to when I run it using a terminal window, that is: when running a task the simulator can take 10 more seconds when launched from Java compared to running the same task when launched from a terminal. What could be causing this behaviour? I have tried increasing the memory available to the JVM to 4 GB using -Xmx and -Xms but with the same result, I am using mpj-express to open and manage various simulators at the same time and the code I am using to launch each simulator is: try{ Runtime rt = Runtime.getRuntime(); rt.exec("/home/.../sim.sh"); Thread.sleep(3000); } catch(Exception e) { System.out.println(e.toString()); e.printStackTrace(); } I am running Linux 14.04 64 bits on a four core Intel Core i5 with 8 GB of RAM and my Java version is: java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode) Thanks
tagged with: mpj-express
upvote count: 3
has comment: http://stackoverflow.com/comment/41686535
has comment: http://stackoverflow.com/comment/41680746
favorite count: 0
has comment: http://stackoverflow.com/comment/56546000
has comment: http://stackoverflow.com/comment/56546074
has comment: http://stackoverflow.com/comment/41662927
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41703780
has comment: http://stackoverflow.com/comment/66216443
has comment: http://stackoverflow.com/comment/41662945
score: 3
has title: External program runs slow when launched from java
answer count: 0
downvote count: 0
tagged with: runtime.exec
tagged with: java
type: Question

http://stackoverflow.com/comment/41920442
comment on: http://stackoverflow.com/q/26658903
has text: Have you tried solving the problem?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47085882
type: AnswerComment
comment on: http://stackoverflow.com/a/26564222
type: Comment
has text: https://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html That should be fine
score: 0

http://stackoverflow.com/a/26628420
has body: You will want to add the metrics that you want to appear in your response, e.g &amp;metrics=violations,tests: http://nemo.sonarqube.org/api/resources?resource=org.apache.activemq:activemq-parent&amp;metrics=violations,test
type: Answer
accepted answer of: http://stackoverflow.com/q/26620609
answers question: http://stackoverflow.com/q/26620609
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41881567
type: AcceptedAnswer
downvote count: 0

runtime.exec
tags question: http://stackoverflow.com/q/26516492
type: Tag
tag name: runtime.exec

http://stackoverflow.com/a/26601792
has comment: http://stackoverflow.com/comment/41817260
has comment: http://stackoverflow.com/comment/41817246
answers question: http://stackoverflow.com/q/26601656
upvote count: 3
has comment: http://stackoverflow.com/comment/41817179
has comment: http://stackoverflow.com/comment/41817197
has comment: http://stackoverflow.com/comment/41817301
score: 3
has comment: http://stackoverflow.com/comment/41817347
has comment: http://stackoverflow.com/comment/41817430
has comment: http://stackoverflow.com/comment/41817404
has comment: http://stackoverflow.com/comment/41817269
has comment: http://stackoverflow.com/comment/41817328
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41817288
has body: int index = str1.indexOf(str2); index is set to 0 str1.substring(0, index) This returns nothing (index is zero, endpoint is exclusive (not included) public String substring(int beginIndex, int endIndex) Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex. + str1.substring(index + str2.length()); This returns everything from position 1 return str1; The answer is D
downvote count: 0
has comment: http://stackoverflow.com/comment/41817300
accepted answer of: http://stackoverflow.com/q/26601656
has comment: http://stackoverflow.com/comment/41817287
type: Answer
has comment: http://stackoverflow.com/comment/41817341

http://stackoverflow.com/comment/41704723
has text: If you get a thread dump at the time of the pause, is there anything interesting to see or is it truly waiting in the setAutoCommit() call of the Connection? The other thing is, if you are truly using a transaction manager, try setting auto-commit to ``false`` by default in the connection pool.
score: 0
comment on: http://stackoverflow.com/q/26537970
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26666633
has answer: http://stackoverflow.com/a/26666669
has comment: http://stackoverflow.com/comment/41934841
has comment: http://stackoverflow.com/comment/41934812
tagged with: serversocket
has comment: http://stackoverflow.com/comment/41934860
accepted answer: http://stackoverflow.com/a/26666674
upvote count: 1
has title: Converting String to Char array in JAVA
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26668735
has comment: http://stackoverflow.com/comment/41934783
tagged with: arrays
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26666674
has comment: http://stackoverflow.com/comment/41934825
has body: I am using the toCharArray method to convert a string to an array of type char but every time i try to print the array, it is printing numbers instead of the characters stored in the string. When i print the string the characters are printed just fine. char[] nArray = capitalizedSentence.toCharArray(); for (int i = 0; i &lt; nArray.length; i++) { System.out.println(nArray[i] + '\n'); } EXAMPLE: If my capitalizedSentence string has the value "Saad", when i convert it to a character array and print it, it prints the following: 93 75 75 78 can someone please help me so that it prints the individual characters stored in the capitalizedSentence string?
answer count: 3
possible better answer: http://stackoverflow.com/a/26666669
favorite count: 0

http://stackoverflow.com/comment/41973423
has text: What do you get if instead you call `System.load("/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/libFoo.so")`?
comment on: http://stackoverflow.com/q/26658072
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41781596
score: 0
type: Comment
type: QuestionComment
has text: I could implement some fragmentation mechanism, but I'm asking is there a way to allow passing big data with only changed applet configuration.
comment on: http://stackoverflow.com/q/26542926

http://stackoverflow.com/q/26519991
tagged with: java
upvote count: 1
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41669383
has body: I have made a runnable java file on eclipse on my windows 64 bit computer using jre and jdk 8. The runnable file opens on my windows computer and on my desktop windows computer. When i email the jar file over to my mac, the jar file does not work and it gives the error the java jar file "snoman3.jar" could not be launched. I ran it through the terminal and still gives the same error. I have jre 8 on my mac yet it is still not running. There are many duplicates of this question but i could not find a solution that worked for me, may somebody please tell me possible solutions for this? PS I am running OS X yosemite on my mac. The following is the error I am getting. PS I am using the libGDX graphics library. java -jar snoman3.jar Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/88/wtc6dz2d5tvdr3qnzb3pq69w0000gn/T/libgdxasma/75260a42/liblwjgl.dylib at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1083) at org.lwjgl.Sys$1.run(Sys.java:70) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at org.lwjgl.Sys.loadLibrary(Sys.java:95) at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:112) at org.lwjgl.openal.AL.&lt;clinit&gt;(AL.java:59) at com.badlogic.gdx.backends.openal.OpenALAudio.&lt;init&gt;(OpenALAudio.java:70) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApplication.java:81) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApp…
has answer: http://stackoverflow.com/a/26520096
has comment: http://stackoverflow.com/comment/41669341
tagged with: jar
has comment: http://stackoverflow.com/comment/41671099
score: 0
has title: Jar file not running on mac
tagged with: runnable
answer count: 1
tagged with: macos
favorite count: 0
accepted answer: http://stackoverflow.com/a/26520096
has comment: http://stackoverflow.com/comment/41669274
type: AnsweredQuestion

http://stackoverflow.com/comment/41671493
type: QuestionComment
has text: *"the repaint() method is inside the infinite While loop"* `repaint()` should be triggered by a Swing `Timer`. It seems this code is blocking the EDT. But for better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).
score: 7
comment on: http://stackoverflow.com/q/26521214
type: Comment

http://stackoverflow.com/comment/41709645
comment on: http://stackoverflow.com/a/26542393
has text: An example? You mean like: `System.out.println(String.format("%02d", 1));`?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26531119
has answer: http://stackoverflow.com/a/26531522
has comment: http://stackoverflow.com/comment/41689140
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: protected
tagged with: lucene
type: Question
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/41689191
has comment: http://stackoverflow.com/comment/41689240
has comment: http://stackoverflow.com/comment/41688907
downvote count: 0
accepted answer: http://stackoverflow.com/a/26532173
has comment: http://stackoverflow.com/comment/41689035
possible better answer: http://stackoverflow.com/a/26531522
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/26532173
has body: I am trying to use a protected static method in the Lucene information retrieval api. My understanding of static is that they are accessed from the class definition and my understanding of the protected keyword is that they can only be accessed from instances of that class or the subclass. So how exactly do you access a static protected method? Is my understanding mistaken? I am trying to call a protected static method from a library in an imported jar. How would I do that? In this case I am calling the loadStopwordSet from StopwordAnalyzerBase
has comment: http://stackoverflow.com/comment/41688992
has title: Protected Static Method Access

http://stackoverflow.com/a/26831688
has body: If you have samples, changing the gain is simple, just multiply all the samples: samples[i] = samples[i] * 0.5f; // reduce by -6dB (half) Multiplying the bytes directly, not recommended, unless you happen to have 8-bit PCM signed. You may see my Q&amp;A 'How do I use audio sample data from Java Sound' if you intend to learn how to decode the byte stream yourself. Now, in theory this can also be done with a Control which can be obtained from Line#getControl; however, I've found TargetDataLine does not support this. I did find that SourceDataLine supports MASTER_GAIN so if you are playing the recording back you can use the output. Here is an MCVE demonstrating this with a JSlider. Important: If you run this example, make sure to use headphones because it performs playback of the live recording. If you are using speakers it will feedback. The slider defaults to 0 for safety. import javax.swing.SwingUtilities; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import java.awt.BorderLayout; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.FloatControl; public class LineGain { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame("Gain"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = new JPanel(new BorderLayout()); JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 0); content.add(slider, BorderLayout.CENTER); Recorder rec = null; try { rec = new Recorder(); rec.setGain(slider.getValue()); } catch(Exception e) { panic(e); } slider.addChangeListener(new Listener(rec)); frame.setContentPane(content); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); new Thread(rec).start(); } }); } stat…
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26618446
type: Answer

http://stackoverflow.com/a/26640821
score: 4
has comment: http://stackoverflow.com/comment/41888786
has comment: http://stackoverflow.com/comment/41888842
answers question: http://stackoverflow.com/q/26640736
upvote count: 4
has comment: http://stackoverflow.com/comment/41888641
downvote count: 0
has comment: http://stackoverflow.com/comment/41888686
has comment: http://stackoverflow.com/comment/41888774
has body: If you have a try...finally block, then one of two cases applies: You have a throws clause on the method, and the try block may throw a checked exception. Have a catch block that catches RuntimeExceptions and any checked exceptions: catch (RuntimeException | YourCheckedException e) { // Cleanup throw e; } You don't have a throws clause, and the try block may only throw an unchecked exception. Catch RuntimeException, which doesn't need to be declared in throws. catch (RuntimeException e) { // Cleanup throw e; }
type: Answer
has comment: http://stackoverflow.com/comment/41888819

http://stackoverflow.com/a/26592944
answers question: http://stackoverflow.com/q/26571021
has body: The client library for communicating with Google Cloud Datastore is not currently compatible with the API used by App Engine Datastore. There's an open issue on the Google Cloud Datastore issue tracker to enhance the App Engine Java client library to work on top of Cloud Datastore (this would also enable the use of higher-level libraries like Objectify). You can subscribe to that issue to receive updates.
score: 0
type: Answer

http://stackoverflow.com/comment/41851802
type: AnswerComment
comment on: http://stackoverflow.com/a/26598867
type: Comment
has text: I've updated the last example, but you seriously need to take the time to connect the various parts of the code together, you're just slapping stuff in there without consideration to how it's suppose to work together :{
score: 0

http://stackoverflow.com/comment/41678784
has text: @TomaszW I want to create a bean to all class
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26525245

http://stackoverflow.com/comment/41739382
comment on: http://stackoverflow.com/q/26541450
type: QuestionComment
has text: @Shruti ok..for first time i have changed..have you changed like that..
score: 0
type: Comment

http://stackoverflow.com/q/26598421
has answer: http://stackoverflow.com/a/26618179
has title: How to use Hungarian characters as a key in properties file with ResourceBundle in JAVA?
tagged with: java
tagged with: character-encoding
type: Question
tagged with: resourcebundle
answer count: 1
has comment: http://stackoverflow.com/comment/41811269
accepted answer: http://stackoverflow.com/a/26618179
score: 0
tagged with: utf-8
has comment: http://stackoverflow.com/comment/41811488
tagged with: properties
has body: I have a properties file where i got letters as keys and some integer value. Something like this: a=1 b=2 c=5 ... Everything works but when I use Hungarian letters as keys (for example: "ő" or "ű") I got the following exception: "Can't find resource for bundle java.util.PropertyResourceBundle, key ő." I want something like that: ő=7 I guess my properties file's encoding isn't UTF-8 but how can I change it?
type: AnsweredQuestion

http://stackoverflow.com/q/26650018
has answer: http://stackoverflow.com/a/26819684
upvote count: 4
accepted answer: http://stackoverflow.com/a/26819684
type: AnsweredQuestion
tagged with: android-studio
tagged with: java
has comment: http://stackoverflow.com/comment/41904363
has answer: http://stackoverflow.com/a/26650667
type: Question
has comment: http://stackoverflow.com/comment/41904119
has title: Android studio cannot resolve symbol common, missing from android.gms package
linked to: http://stackoverflow.com/q/32477067
score: 4
has body: I'm making a game where I'm using Google Play Services. I recently switched from eclipse to Android Studio (now running 0.8.14). In android studio I added a "Google Play Services Activity" and had my game class extend that class. I left the services class without modification. The project compiles and runs just fine but the IDE is filled with errors because it "cannot resolve symbol 'common'" and "cannot resolve symbol 'games'" import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.games.Games; Any ideas on why this is and how to fix it? I have attempted to reimport my project after deleting all .iml files and the .idea folder without result. [EDIT] As per request I'm adding a screenshot of the errors: [EDIT 2] I've kept searching for solutions and while I have not found any, I now have a screenshot that may be a bit more helpful. As you can see, the com.google.android.gms package seems to be missing the common and games package. I have tried updated gradle, tried using JDK 1.7 instead of 1.8 and attempted syncing with gradle multiple times. I will keep searching for an answer but if you have experienced this before, please feel free to help me and others out.
tagged with: google-play-services
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26650667
favorite count: 0
has comment: http://stackoverflow.com/comment/41904332
tagged with: android

http://stackoverflow.com/a/26668673
score: 0
has body: It is responsible for the location of the log folder, #log4j.appender.Rolling.File=logs/application.log will generate logs in the application path with a folder logs you can change it to the desired location E:\logs in the above line to generate logs in the E: You will find the default settings of logging, # Logger # ~~~~~ section in application.conf inside your /conf directory of your play app.
type: Answer
has comment: http://stackoverflow.com/comment/41938773
has comment: http://stackoverflow.com/comment/41938654
has comment: http://stackoverflow.com/comment/41938784
has comment: http://stackoverflow.com/comment/41938498
answers question: http://stackoverflow.com/q/26668578
has comment: http://stackoverflow.com/comment/41938464
has comment: http://stackoverflow.com/comment/41943353
has comment: http://stackoverflow.com/comment/41938392
has comment: http://stackoverflow.com/comment/41938423

http://stackoverflow.com/comment/41737933
comment on: http://stackoverflow.com/q/26558465
type: QuestionComment
has text: I think you will get a compiler error if you don't make the "ZZZ" `String` final
score: 1
type: Comment

http://stackoverflow.com/q/26604231
has answer: http://stackoverflow.com/a/26604311
type: Question
accepted answer: http://stackoverflow.com/a/26604311
has title: java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2 in Arraylist?
downvote count: 0
favorite count: 0
has body: I have a listener, when i click on the dates it will search for the arraylist and get the dates of what i click then when i change the month i will removed the dates then add the dates in my current month. public void onSelectDate(Date date, View view) { JSONObject jsonObj = new JSONObject(jsonStr); JsonArray datesIn = jsonObj.getJSONArray(TAG_SCHEDULE); for (int i = 0; i &lt; datesIn.length(); i++) { JSONObject c = datesIn.getJSONObject(i); String dateD = c.getString(TAG_DATED); String statusD = c.getString(TAG_STATUS); HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;(); contact.put("Tag_dated", dateD); contact.put("Tag_status", statusD); contactList.add(contact); Date s = formatter.parse(dateD); ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList= new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();; if(formatter.format(date).equals(contactList.get(0).get(TAG_DATED))){ if(contactList.get(0).get(TAG_STATUS).equals("Occupied")){ Toast.makeText(getApplicationContext(),"S",Toast.LENGTH_SHORT).show(); }else if(contactList.get(0).get(TAG_STATUS).equals("Reserved")) Toast.makeText(getApplicationContext(),"R",Toast.LENGTH_SHORT).show(); }else if(formatter.format(date).equals(contactList.get(1).get(TAG_DATED))){ if(contactList.get(1).get(TAG_STATUS).equals("Occupied")){ Toast.makeText(getApplicationContext(),"S",Toast.LENGTH_SHORT).show(); }else if(contactList.get(1).get(TAG_STATUS).equals("Reserved")){ Toast.makeText(getApplicationContext(),"R",Toast.LENGTH_SHORT).show(); } }else if(formatter.format(date).equals(contactList.get(2).get(TAG_DATED))){ if(contactList.get(2).get(TAG_STATUS).equals("Occupied")){ Toast.makeText(getApplicationContext(),"S",Toast.LENGTH_SHORT).show(); }else if(contactList.get(2).get(TAG_STATUS).equals("Reserved")){ Toast.makeText(getApplicationContext(),"R",Toast.LENGTH_SHORT).show(); } }else if(formatter.format(date).equals(contactList.get(3).get(TAG_DATED))){ if(contactList.get(3).get(TAG_STATUS).equals("Occupied"…
tagged with: android
has comment: http://stackoverflow.com/comment/41821442
possible better answer: http://stackoverflow.com/a/26604306
answer count: 4
has answer: http://stackoverflow.com/a/26604330
has answer: http://stackoverflow.com/a/26604306
has comment: http://stackoverflow.com/comment/41821461
upvote count: 1
has comment: http://stackoverflow.com/comment/41821510
has answer: http://stackoverflow.com/a/26604497
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26647295
possible better answer: http://stackoverflow.com/a/26673161
upvote count: 3
has answer: http://stackoverflow.com/a/26673161
type: Question
tagged with: gwt
score: 3
linked to: http://stackoverflow.com/q/5787620
tagged with: java
answer count: 2
has title: Getting visible columns in SmartGWT ListGrid
tagged with: listgrid
downvote count: 0
tagged with: smartgwt
favorite count: 0
has answer: http://stackoverflow.com/a/26674202
type: AnsweredQuestion
has body: I am trying to get the number of visible columns in ListGrid and came across the same problem in this question :- However this does not work. Here is my code:- ListGridField firstName=new ListGridField("firstName","First Name"); ListGridField lastName=new ListGridField("lastName","Last Name"); ListGridField companyName=new ListGridField("companyName","Company Name"); ListGridField companyNameHidden=new ListGridField("companyNameHidden","Company Name"); firstName.setWidth(200); lastName.setWidth(200); companyName.setWidth(200); companyNameHidden.setWidth(200); companyNameHidden.setHidden(true); listGrid.setFields(firstName,lastName,companyName,companyNameHidden); for(ListGridField fieldName:listGrid.getFields()){ System.out.println(fieldName.getName()+"======="+listGrid.fieldIsVisible(fieldName.getName())); } The output is :- firstName=======true lastName=======true companyName=======true companyNameHidden=======true Shouldn't it be false for last one. The field is clearly hidden. Please suggest how to find number of visible fields, of a ListGrid.
accepted answer: http://stackoverflow.com/a/26674202

http://stackoverflow.com/q/26640280
score: 0
tagged with: java
tagged with: indexoutofboundsexception
has body: I am trying to make an acronym from the three words that is input by the user: import java.util.Scanner; public class Acronym { public static void main(String[] args) { Scanner input = new Scanner(System.in); String phrase; System.out.println("Please, enter the three words here&gt;&gt; "); phrase = input.nextLine(); char first, second, third; int stringLength; int x = 0; char c; stringLength = phrase.length(); first = phrase.charAt(0); second = phrase.charAt(x + 1); third = phrase.charAt(x + 1); for( x = 0; x &lt; stringLength; x++); { int a = 1; c = phrase.charAt(x); if(Character.isWhitespace(c)); if( a &lt;= 1) second = phrase.charAt(x+1); else if(a &lt;= 2) third = phrase.charAt(x++); } System.out.println("The acronym is " + first + second + third); } } But, whenever I try to input StringIndexOutOfBoundExceptions error is showing. For example I tried to input the three words "One Two Three" and this is the result: Please, enter the words/phrases: One Two Three Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 13 at java.lang.String.charAt(String.java:646) at Acronym.main(Acronym.java:23)
type: AnsweredQuestion
has title: StringIndexOutOfBoundExceptions error is showing
has comment: http://stackoverflow.com/comment/41887895
has answer: http://stackoverflow.com/a/26640322
has comment: http://stackoverflow.com/comment/41890671
type: Question
accepted answer: http://stackoverflow.com/a/26640322
answer count: 1

locking
tags question: http://stackoverflow.com/q/26612333
type: Tag
tags question: http://stackoverflow.com/q/26621292
tags question: http://stackoverflow.com/q/26522937
tags question: http://stackoverflow.com/q/26520248
tags question: http://stackoverflow.com/q/26628789
tag name: locking

http://stackoverflow.com/a/26568858
downvote count: 0
has body: From the Javadoc: A BlockingQueue does not intrinsically support any kind of "close" or "shutdown" operation to indicate that no more items will be added. The needs and usage of such features tend to be implementation-dependent. For example, a common tactic is for producers to insert special end-of-stream or poison objects, that are interpreted accordingly when taken by consumers. I suggest queuing the value null to indicate that the stream is over; the reader will need to check whether the value read is null and terminate if it is.
type: Answer
answers question: http://stackoverflow.com/q/26568825
score: 2
has comment: http://stackoverflow.com/comment/41757906
upvote count: 2

http://stackoverflow.com/q/26587631
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/26605671
tagged with: filelock
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26628480
type: AnsweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26588485
tagged with: java
tagged with: concurrency
tagged with: dom
has title: Concurrently write to XML file
type: Question
possible better answer: http://stackoverflow.com/a/26588485
has body: I have multiple processes running on different machines which are required to read/write to a shared XML file, for this I am using DOM with Java and FileLocks (While I know that a database would be a more effective approach, this is not viable due to project constraints) . To make changes to the XML file, the relevant process first creates an exclusively locked channel which is used to read the file, it then attempts to reuse the same channel to write the new version before closing the channel; this way the lock is never down. The issue however is that I am getting a java.nio.channels.ClosedChannelException when attempting to write the result, even though I never explicitly close the channel. I have suspicions that the line of code: doc = dBuilder.parse(Channels.newInputStream(channel)); closes the channel. If so, how could I force the channel to stay open? My code can be seen below: [removed code after update] UPDATE: Placing System.out.println(channel.isOpen()) before and after the suspect line of code confirms that this is where the channel is closed. UPDATE: Having asked a separate question the code below now prevents the channel from closing during the parse operation. The issue now is that instead of replacing the original xml file, the transformer appends the changed document to the original. In the documentation I cannot find any related options for specifying the output of Transformer.transform (I have searched Transformer/Transformer factory/StreamResult). Am I missing something? Do I need to somehow clear the channel before writing? Thanks. UPDATE: Finally solved the append issue by truncating the channel to a size of 0. Thank you @JLRishe for the advice. Have posted the working code as an answer.
accepted answer: http://stackoverflow.com/a/26628480
answer count: 2

feature-detection
type: Tag
tag name: feature-detection
tags question: http://stackoverflow.com/q/26615649

http://stackoverflow.com/q/26651391
type: Question
has title: How to determine whether a given file is an xml valide file
has answer: http://stackoverflow.com/a/26651639
answer count: 2
has comment: http://stackoverflow.com/comment/41906968
has comment: http://stackoverflow.com/comment/41906624
has answer: http://stackoverflow.com/a/26652214
downvote count: 0
linked to: http://stackoverflow.com/q/6362926
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: How to determine whether a given file is an xml valide file in JAVA? for example : bool valide = IsAnXMLFile(new File("file.txt")); Thank's.
has comment: http://stackoverflow.com/comment/41906846
upvote count: 1
linked to: http://stackoverflow.com/q/15732
accepted answer: http://stackoverflow.com/a/26652214
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26651639

http://stackoverflow.com/comment/43549385
type: Comment
score: 0
has text: After looking in to Swagger more deeply I found that the online editor is good (doesn't even send spec content to the server - for those concerned with privacy) and that the html generator is built without the need for a backend. All is great. But then I found that it doesn't support XML Schema, which is a problem in the organization I am about to introduce the solution in.
type: AnswerComment
comment on: http://stackoverflow.com/a/26552985

http://stackoverflow.com/a/31461203
type: Answer
answers question: http://stackoverflow.com/q/26572331
score: 14
downvote count: 0
upvote count: 14
has body: I know this is old but I got the same problem after my machine crashed while I was using Android Studio. The solution is quite simple, head to File &gt; Invalidate Caches &amp; Restart Your IDE will restart and your JAVA environment will be properly functional again.

http://stackoverflow.com/comment/41841252
type: Comment
comment on: http://stackoverflow.com/a/26604079
score: 0
type: AnswerComment
has text: The file gets created if I shutdown Tomcat. In fact, the sessions survive a Tomcat restart just fine. But they do not survive a re-deploy, e.g. if I just `touch myapp.war`. Maybe the difference is that I see an "Undeploying context" message in the latter case but not when I restart Tomcat?

http://stackoverflow.com/q/26553543
tagged with: layout-manager
tagged with: applet
accepted answer: http://stackoverflow.com/a/26554236
has body: I'm having trouble with this JApplet. At the moment I have a CardLayout JPanel which contains two BorderLayout JPanels. Whenever I run it, the components added to each 'card' (a JButton to go back to the other JPanel) don't display unless I use setVisible(true) for each LayoutManager. Furthermore, none of my ActionListeners work. I'm assuming because they only use show() and there's something else I have to do that's alluding me. Must I use setVisible(true)? It seems from other questions that there's a way of doing this without that. Here's the code I'm having trouble with: /* *Java Version: 1.8.0_25 *Author: Peadar Ó Duinnín *Student Number: R00095488 */ package As1; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; public class AUIJApplet extends JApplet implements ActionListener { private final int WIDTH = 600; private final int HEIGHT = 400; private int highScore; private int currentScore; JPanel panelCont = new JPanel(); JPanel startPanel = new JPanel(); JPanel gamePanel = new JPanel(); JButton newGameButton = new JButton("New Game"); JButton endGameButton = new JButton("End Game"); JLabel highScoreLabel; JLabel currentScoreLabel; CardLayout cl = new CardLayout(); BorderLayout bl = new BorderLayout(); public AUIJApplet() { highScore = 0; } @Override public void init() { setSize(WIDTH, HEIGHT); panelCont.setLayout(cl); startPanel.setLayout(bl); gamePanel.setLayout(bl); startPanel.add(newGameButton, BorderLayout.SOUTH); gamePanel.add(endGameButton, BorderLayout.SOUTH); startPanel.setBackground(Color.BLUE); gamePanel.setBackground(Color.GREEN); panelCont.add(startPanel, "Start Applet Screen"); panelCont.add(gamePanel, "New Game Screen"); newGameButton.addActionListener((e) -&gt; { newGame(); }); endGameButton.addActionListener((e) -&gt; { quitGame(); });…
has comment: http://stackoverflow.com/comment/41729472
score: 0
has comment: http://stackoverflow.com/comment/41729219
answer count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26554236
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: cardlayout
has title: Java: How to display card JPanel fully when using CardLayout

http://stackoverflow.com/a/36151927
upvote count: 1
answers question: http://stackoverflow.com/q/26523177
downvote count: 0
type: Answer
has body: you have follow some steps. if you using Spring Java Based configuration then add CORSFilter public class CORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { System.out .println("Filtering on..........................................................."); HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with, Content-Type"); chain.doFilter(req, res); } public void init(FilterConfig filterConfig) { } public void destroy() { } } OR you are using xml based spring configuration then try to add &lt;context:annotation-config/&gt; in your Spring configuration file. It will support your controller annotations. configure @RequestMapping like below example @RequestMapping(value = "/servicetest", method = {RequestMethod.GET}) still not working ?, then remove header from http call, just make simple http call, if this step not working then you can go for next step. still not working then don't try to return actual entity just return proxy object or dummy object, if its working then go ahead.
score: 1

http://stackoverflow.com/q/26652354
downvote count: 1
type: Question
has body: I want to code a program which shows information about your physical network cards. Not virtual or software-based network cards. Now my question is, how can I find the supported IP version of my network card with NetworkInterface? I need some detailed information about the network cards. How can I receive more informations about my network card with NetworkInterface?
tagged with: network-programming
has answer: http://stackoverflow.com/a/29425207
upvote count: 0
score: -1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Getting the supported IP version with NetworkInterface
tagged with: java

http://stackoverflow.com/comment/41901009
type: AnswerComment
comment on: http://stackoverflow.com/a/26648186
type: Comment
has text: But they're asking why, if `method()` is static but `i` is not, why `i` is accessible when `i` is objective.
score: 0

http://stackoverflow.com/comment/41770913
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26564654
has text: I did that and now it works. Thank you. I used to do that in c++ and it would work or maybe I remembered wrong. And reading through other answers here, switch statements are better for these types are programs.

http://stackoverflow.com/q/26530121
tagged with: split
has comment: http://stackoverflow.com/comment/41686954
downvote count: 0
possible better answer: http://stackoverflow.com/a/26530385
tagged with: string
has title: Splitting a string by value between quotation marks in Java
accepted answer: http://stackoverflow.com/a/26531692
upvote count: 6
has comment: http://stackoverflow.com/comment/41686793
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/41687000
has answer: http://stackoverflow.com/a/26530351
has answer: http://stackoverflow.com/a/26531692
score: 6
has answer: http://stackoverflow.com/a/26530385
has body: I'm reading in a file in Java and want to split each line by the value inside quotation marks. For example, a line would be... "100","this, is","a","test" I would like the array to look like.. [0] = 100 [1] = this, is [2] = a [3] = test I normally split by comma, but since some of the fields include a comma (position 1 in the example above) it's not really suitable. Thanks.
has answer: http://stackoverflow.com/a/26530432
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26530389
type: Question

http://stackoverflow.com/comment/41902899
has text: There's `anyMatch(alwaysTrue())`, I think that's the closest to `hasAny`.
type: AnswerComment
comment on: http://stackoverflow.com/a/26649183
score: 9
type: Comment

http://stackoverflow.com/q/26621064
has comment: http://stackoverflow.com/comment/41852723
favorite count: 0
has title: having trouble with a loop
score: -3
upvote count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/41852761
has body: I need to put a loop on this asking if the player would like to play again. If the user says yes restart the game. If they say no end the game. I am having trouble with this all together. Please help! import java.util.Scanner; public class HW4ChrisMuncher { public static void main(String[] args) { Scanner input = new Scanner(System.in); double a; int b; System.out.println("Enter a number"); double userNum = input.nextDouble(); a = userNum; Scanner input2 = new Scanner(System.in); System.out.println("Enter a number (no decimals!)"); int userNum2 = input2.nextInt(); b = userNum2; double c = min(a, b); double d = max(a, b); double e = abs(a); double f = pow(a, b); System.out.println("The minimum value of " + a + " and " + b + " is " + c ); System.out.println("The maximum value of " + a + " and " + b + " is " + d ); System.out.println("The absolute value of "+ a+ " is " + e ); System.out.println(+ a + " to the power of " + b + " is " + f ); } // Returns the minimum of two numbers public static double min(double n1, int n2) { double min; if (n1 &gt; n2) min = n2; else min = n1; return min; } // Return the max between two numbers public static double max(double n1, int n2) { double max; if (n1 &gt; n2) max = n1; else max = n2; return max; } //Returns the absolute value of the two numbers public static double abs(double n1) { if (n1 &lt; 0) return -n1; else return n1; } public static double pow(double n1, int n2) { double f = 1; for (int i =0; i&lt; n2; i++) { f = f * n1; } return f; } }
has comment: http://stackoverflow.com/comment/41852746
has comment: http://stackoverflow.com/comment/41852745
answer count: 1
has comment: http://stackoverflow.com/comment/41852961
has comment: http://stackoverflow.com/comment/41852730
has answer: http://stackoverflow.com/a/26621096

http://stackoverflow.com/a/26639633
accepted answer of: http://stackoverflow.com/q/26588081
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26588081
has comment: http://stackoverflow.com/comment/41901223
has body: Every network request performed by Volley is performed in a background thread. Volley takes care of this behind the scenes. So there is no need to perform a request on a different thread, since that's already happening. The listeners, on the other hand, are called on the UI thread. You basically answered your own question when you wrote that the data is processed on the UI thread. Simply move that data processing that is performed inside your listeners to a background thread / AsyncTask to free your UI thread and prevent the blocking.
type: Answer
score: 29
upvote count: 29
has comment: http://stackoverflow.com/comment/68987145
has comment: http://stackoverflow.com/comment/102665285
has comment: http://stackoverflow.com/comment/68986044
has comment: http://stackoverflow.com/comment/41905349

http://stackoverflow.com/a/26624668
type: Answer
accepted answer of: http://stackoverflow.com/q/26624294
has comment: http://stackoverflow.com/comment/41858928
answers question: http://stackoverflow.com/q/26624294
has comment: http://stackoverflow.com/comment/41858947
upvote count: 1
has body: Move your - to the end of the character class or escape it: "[$&amp;+,:;=?@#|'&lt;&gt;.^*()%!-]" And the (?i) can be dropped, since your pattern doesn't specify any character which has different cases. In your original regex, .-^ is specifying a range of character from . (U+002E) to ^ (U+005E), which contains uppercase A-Z and digits 0-9.
type: AcceptedAnswer
downvote count: 0
score: 1

constraints
type: Tag
tags question: http://stackoverflow.com/q/26544588
tag name: constraints

http://stackoverflow.com/a/26553297
has body: Follow the examples on Blobstore Java API Overview to upload your images. It's much easier than what you are trying to do in your code.
answers question: http://stackoverflow.com/q/26547298
downvote count: 0
type: Answer
score: 1
upvote count: 1

android
tags question: http://stackoverflow.com/q/26519573
tags question: http://stackoverflow.com/q/26518144
tags question: http://stackoverflow.com/q/26583113
tags question: http://stackoverflow.com/q/26640644
tags question: http://stackoverflow.com/q/26574328
tags question: http://stackoverflow.com/q/26544798
tags question: http://stackoverflow.com/q/26579465
tags question: http://stackoverflow.com/q/26658230
tags question: http://stackoverflow.com/q/26551596
tags question: http://stackoverflow.com/q/26652017
tags question: http://stackoverflow.com/q/26513870
tags question: http://stackoverflow.com/q/26627328
tags question: http://stackoverflow.com/q/26605172
tags question: http://stackoverflow.com/q/26659295
tags question: http://stackoverflow.com/q/26528450
tags question: http://stackoverflow.com/q/26568056
tags question: http://stackoverflow.com/q/26533485
tags question: http://stackoverflow.com/q/26532717
tags question: http://stackoverflow.com/q/26620031
tags question: http://stackoverflow.com/q/26561340
tags question: http://stackoverflow.com/q/26584601
tags question: http://stackoverflow.com/q/26530858
tags question: http://stackoverflow.com/q/26549246
tags question: http://stackoverflow.com/q/26573902
tags question: http://stackoverflow.com/q/26581515
tags question: http://stackoverflow.com/q/26661572
tags question: http://stackoverflow.com/q/26650315
tags question: http://stackoverflow.com/q/26655377
tags question: http://stackoverflow.com/q/26561010
tags question: http://stackoverflow.com/q/26553623
tags question: http://stackoverflow.com/q/26668772
tags question: http://stackoverflow.com/q/26541047
tags question: http://stackoverflow.com/q/26653399
tags question: http://stackoverflow.com/q/26645098
tags question: http://stackoverflow.com/q/26522274
tags question: http://stackoverflow.com/q/26567259
tags question: http://stackoverflow.com/q/26532823
tags question: http://stackoverflow.com/q/26669379
tags question: http://stackoverflow.com/q/26653976
tags question: http://stackoverflow.com/q/26649389
tags question: http://stackoverflow.com/q/26556771
tags question: http://stackoverflow.com/q/26588081
tags question: http://stackoverflow.com/q/26569534
tags question: http://stackoverflow.com/q/26533845
tags question: http://stackoverflow.com/q/26543686
tags question: http://stackoverflow.com/q/26625700
tags question: http://stackoverflow.com/q/26532206
tags question: http://stackoverflow.com/q/26525850
tags question: http://stackoverflow.com/q/26575355
tags question: http://stackoverflow.com/q/26612396
tags question: http://stackoverflow.com/q/26570133
tags question: http://stackoverflow.com/q/26622157
tags question: http://stackoverflow.com/q/26649122
tags question: http://stackoverflow.com/q/26593845
tags question: http://stackoverflow.com/q/26592429
tags question: http://stackoverflow.com/q/26526443
tags question: http://stackoverflow.com/q/26609078
tags question: http://stackoverflow.com/q/26521922
tags question: http://stackoverflow.com/q/26573913
tags question: http://stackoverflow.com/q/26557921
tags question: http://stackoverflow.com/q/26634412
tags question: http://stackoverflow.com/q/26566607
tags question: http://stackoverflow.com/q/26591231
tags question: http://stackoverflow.com/q/26534635
tags question: http://stackoverflow.com/q/26599391
tags question: http://stackoverflow.com/q/26559377
tags question: http://stackoverflow.com/q/26562846
tags question: http://stackoverflow.com/q/26616754
tags question: http://stackoverflow.com/q/26576642
tags question: http://stackoverflow.com/q/26565326
tags question: http://stackoverflow.com/q/26546017
tags question: http://stackoverflow.com/q/26571816
tags question: http://stackoverflow.com/q/26638662
tags question: http://stackoverflow.com/q/26580576
tags question: http://stackoverflow.com/q/26618191
tags question: http://stackoverflow.com/q/26541792
tags question: http://stackoverflow.com/q/26516635
tags question: http://stackoverflow.com/q/26644730
tags question: http://stackoverflow.com/q/26531698
tags question: http://stackoverflow.com/q/26520608

http://stackoverflow.com/q/26524072
accepted answer: http://stackoverflow.com/a/26546286
type: Question
has title: Date Calender Count
answer count: 1
tagged with: salesforce
has body: Could you help me with the problem below. I got the error "No access to entity: Calendar in row 1, column 8", but I didn't know exactly the error. Is the following syntax ok? IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year) { Bestandsentwicklung_CY++; } The field Beginn_der_HV__c includes dates. I want to count the Beginn_der_HV__c if the calendar year from this field is like current year, also I need to count the field if the calendar year from this field is like current year - 2. Thanks for your help, peX public class testfor6_c { private Id accId {get; set;} public testfor6_c(ApexPages.StandardController stdcontroller) { accId = stdcontroller.getRecord().Id; Bestandsentwicklung_CY = 0; Bestandsentwicklung_CY_2 = 0; getEZRen(); } public Integer Bestandsentwicklung_CY {get; set;} public Integer Bestandsentwicklung_CY_2 {get; set;} public void getEZRen() { List&lt;Einzelrisiko__c&gt; EZRList = [SELECT Beginn_der_HV__c FROM Einzelrisiko__c WHERE Abgangsdatum__c = Null AND Unternehmens_Id_Long__c = :accId]; FOR (Einzelrisiko__c EZR : EZRList) { IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year) { Bestandsentwicklung_CY++; } IF(Calendar.Year(EZR.Beginn_der_HV__c) = This.Year-2) { Bestandsentwicklung_CY_2++; } } } } EDIT 24.10.2014 Hi, I tried some other syntax for the calendar problem, but I still get errors. ERROR: variable does not exist: Year IF(EZR.Beginn_der_HV__c.year() = This.Year) { Bestandsentwicklung_CY++; } Expression cannot be assigned IF(EZR.Beginn_der_HV__c.year() = Date.today().year()) { Bestandsentwicklung_CY++; } Please help me. Thanks, peX
score: 0
tagged with: calendar
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26546286

google-play-games
tags question: http://stackoverflow.com/q/26645374
tags question: http://stackoverflow.com/q/26538748
tag name: google-play-games
type: Tag

http://stackoverflow.com/comment/41703123
score: 0
has text: You are using Axis? What version of jboss?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26527261

http://stackoverflow.com/a/26634961
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26634926
score: 2
has body: They shouldn't be doing this. It's bad practice. Either the developer is being lazy, or they are showing a very simple example(still bad practice). EDIT: (Given the extra detail in your comments) In that case this is probably done by some automated program. The code the developer is actually working on wouldn't be using these names.

http://stackoverflow.com/comment/41943476
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26671562
has text: `ArrayList` doesn't have an `add` method that doesn't take any parameters.

http://stackoverflow.com/a/26535566
downvote count: 0
has body: Here is what I changed to stop the issue. Inside CreateUser public CreateUser(Context context) { // TODO Auto-generated constructor stub this.mContext = context; callback = (CreateUserInterface) context; } and the NavigationActivity I was using public class NavigationActivity extends ActionBarActivity implements UserREST.CreateUser.CreateUserInterface and its associated methods @Override public void getCreatedUser(User user) { // TODO Auto-generated method stub Log.e("USERNAME", user.getUser_name()); } @Override public void getUserCreateErrorMessage(String error) { // TODO Auto-generated method stub }
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26534717
answers question: http://stackoverflow.com/q/26534717
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26573902
has body: i do have one date picker as i just want to make it only can select today's date and future date, no back date. Need some guidelines on how it can be done, maybe spinner can do that? //start date TableRow r8 = new TableRow(this); TextView tvStartDate = new TextView(this); tvStartDate.setText("Start Date: "); final EditText etStartDate = new EditText(this); etStartDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Calendar dateNow = Calendar.getInstance(); int year = dateNow.get(Calendar.YEAR); int month = dateNow.get(Calendar.MONTH); int day = dateNow.get(Calendar.DAY_OF_MONTH); DatePickerDialog dp; dp = new DatePickerDialog(AddPetActivity.this, new OnDateSetListener() { public void onDateSet(DatePicker datepicker, int selectedyear, int selectedmonth, int selectedday) { // TODO Auto-generated method stub selectedmonth = selectedmonth + 1; etStartDate.setText("" + selectedday + "/" + selectedmonth + "/" + selectedyear); } }, year, month, day); dp.setTitle("Select Date"); dp.show(); } }); r8.addView(tvStartDate); r8.addView(etStartDate); tb.addView(r8);
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26575123
type: Question
tagged with: date
score: 0
accepted answer: http://stackoverflow.com/a/26575123
has title: Android date picker as no backdate can be selected, only today and future date
answer count: 1

http://stackoverflow.com/comment/41924284
comment on: http://stackoverflow.com/a/26660109
type: Comment
score: 2
type: AnswerComment
has text: Dude, you need to express yourself more clearly! If I knew where you were (and if I were meaner) I'd throttle you right now! So you just want to convert from one radix (base 16, base 10, etc) to another radix. That means you're converting from text to text. You just want a different text representation.

http://stackoverflow.com/a/26634686
downvote count: 0
has comment: http://stackoverflow.com/comment/41879407
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/46393644
accepted answer of: http://stackoverflow.com/q/26634463
answers question: http://stackoverflow.com/q/26634463
has body: Think you are looking for something along the lines of InputStream is = ctx.getResources().openRawResource(res_id); Where ctx is a instance of Context
type: AcceptedAnswer

http://stackoverflow.com/q/26635014
answer count: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/9929321
has answer: http://stackoverflow.com/a/26635085
type: UnansweredQuestion
has title: How do ArrayLists and Arrays interact with one another in Java?
has comment: http://stackoverflow.com/comment/41877606
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41879513
type: Question
has body: How can we use Arrays and ArrayLists together (if possible at all)? I want to store some Strings into an ArrayList, pull them out later, parse them up into String arrays, store those arrays in an ArrayList, and be able to retrieve the data from the ArrayLists later... Check out this code, and feel free to take me apart for doing crappy coding; it's been a while since I used Java. public static void parseData() throws IOException { //for reference, nonParsedData is ArrayList&lt;String&gt; // while parsedData is ArrayList&lt;String[]&gt; String line = new String(); String[] tempContainer = new String[7]; Scanner keyboard = new Scanner(System.in); for (int x = 0; x &lt; nonParsedData.size(); x++) { line = nonParsedData.get(x); //filling the temporary container to place into the ArrayList of arrays tempContainer[0] = line.substring(0,1); //Data piece 1 tempContainer[1] = line.substring(1,3); //Data piece 2 tempContainer[2] = line.substring(3,7); //Data piece 3 tempContainer[3] = line.substring(7,8); //Data piece 4 tempContainer[4] = line.substring(8,9); //Data piece 5 tempContainer[5] = line.substring(9,10); //Data piece 6 tempContainer[6] = line.substring(10,(line.length() - 1)); //Data piece 7 parsedData.add(tempContainer); } } So in the previous, I've dumped some external file into nonParsedData. It's a bunch of strings. No big deal. I take those strings, read them, drop them into arrays. Hunky dory. That works fine. Here is the retrieval process, which is making me apoplectic. public static void fetchAndPrint() throws IOException { String[] tempContainer = new String[7]; for(int x = 0; x &lt; parsedData.size(); x++) { tempContainer = parsedData.get(x); //this should be assigning my stored array to //the tempContainer array (I think) //let's try deepToString (that didn't work) //System.out.println((parsedData.get(x)).toString()); //just a debugging check System.out.println(x); System.out.println(tempContainer[0] + " " + tempContainer[1] + " " + tempContainer[2] + " "…
tagged with: arrays
has answer: http://stackoverflow.com/a/26638285
tagged with: arraylist

http://stackoverflow.com/comment/41915560
type: Comment
has text: Yeah. I agree. I tried again my way i was unable to get it. Your method works fine
comment on: http://stackoverflow.com/a/26652384
type: AnswerComment
score: 0

http://stackoverflow.com/a/26656387
has comment: http://stackoverflow.com/comment/41915329
downvote count: 0
has body: modify your while block as do-while block as following do{ System.out.println("Guess a number between 1 and 100:"); guess = input.nextInt (); numberOfTries++; if (guess == numberToGuess) { win = true; } else if (guess &lt; numberToGuess) { System.out.println ("You guessed too low mate!"); } else if (guess &gt; numberToGuess) { System.out.println ("You guessed too high mate!") ; System.out.println("You win!!"); System.out.println("The random number WAS!" + numberToGuess); System.out.println("It took you a wopping" + numberOfTries + "TRIES!"); } }while(win==false);
answers question: http://stackoverflow.com/q/26656160
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26560520
has comment: http://stackoverflow.com/comment/41741582
has body: I have to generate the hash of an XML string in Java and afterwards store this information in a database table field (my DBMS is Postgres). Which is the best hash function to use? Thank you in advance
has comment: http://stackoverflow.com/comment/41741570
has answer: http://stackoverflow.com/a/26563892
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/26563892
has comment: http://stackoverflow.com/comment/41748941
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41741878
tagged with: java
type: Question
has title: Best hash function to hash xml string in Java
answer count: 2
has answer: http://stackoverflow.com/a/26560536
accepted answer: http://stackoverflow.com/a/26560536
has comment: http://stackoverflow.com/comment/41747458
tagged with: string-hashing
tagged with: postgresql
score: 0
linked to: http://stackoverflow.com/q/2624192

http://stackoverflow.com/a/26605492
accepted answer of: http://stackoverflow.com/q/26604261
answers question: http://stackoverflow.com/q/26604261
has body: For your first problem, you should set the progressBar.setStringPainted(true); on your progressbar, to show specific values in the progressbar add the following line: jProgressBar1.setValue(value); jProgressBar1.setString(String.valueOf(value)); // this one For more information check the documentation of the JProgressBar.
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/comment/41810378
has text: @ElliottFrisch My subclass B does not and _cannot_ override the method in A; I will edit the question to reflect this. Say for example, I wanted to store the instance of `B` in the `Map<Class<?>, Object>` by key `Class` and Method `method()` in the `Set<Method>`, as described in my application. This is where the problem lies: Later on, I would attempt to get the class out of `method()` via the `getDeclaringClass()` method, which is now `Class`. I would then proceed to attempt to take the instance out of my map by that class, and get an NPE.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26597946

http://stackoverflow.com/a/26547710
has comment: http://stackoverflow.com/comment/41735686
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: The Sieve is about remembering the primes you found already. As far as I know there is no way to do this without arrays or lists and only with loops. I checked some of the examples at RosettaCode at random and did not find one without an array and only loops. If you add Classes and Methods as options you can come up with a recursive design: public class Sieve { private int current; private int max; private Sieve parent; public Sieve(int current, int max, Sieve parent ) { this.current = current; this.max = max; this.parent = parent; } public static void main(String[] args) { int n = 100; System.out.print("Primes from 1 to " + n + ":\n"); printPrimes(n); } private static void printPrimes(int i) { new Sieve(2,i,null).start(); } private void start() { if(current &lt;2 || max &lt;2) { return; } if(this.current &gt; max) { parent.print(); return; } for(int i = this.current+1;current&lt;=max+1;i++) { if(this.testPrime(i)) { new Sieve(i,this.max,this).start(); return; } } } private boolean testPrime(int i) { if(i%this.current != 0) { if(this.parent == null) { return true; } else { return this.parent.testPrime(i); } } return false; } private void print() { if(this.parent != null) { this.parent.print(); } System.out.print(" "+this.current); } } This removes the array but uses Objects to store the Prime (each Sieve holds one prime)
answers question: http://stackoverflow.com/q/26544714
has comment: http://stackoverflow.com/comment/41735443

http://stackoverflow.com/comment/41728713
type: QuestionComment
comment on: http://stackoverflow.com/q/26535886
score: 0
type: Comment
has text: it's up to you, but you should show a folder's contents. Also post the stacktrace.

http://stackoverflow.com/comment/41977886
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26627742
has text: That error is " column 'img' does not exist" in your database. It has either a different name or you have not added that column to the "create table" statement or you may have to reset the entire app data because old database versions are not removed when you install a new app version

http://stackoverflow.com/comment/41688751
type: QuestionComment
comment on: http://stackoverflow.com/q/26531065
has text: I stand corrected, thank you
score: 0
type: Comment

http://stackoverflow.com/comment/41852357
type: Comment
has text: But ``support`` will have ``project-dependency`` as a dependency. Can I build a jar for ``support`` without including ``project-dependency`` as a jar dependency, and maintaining it as a project dependency only at compile time?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26603823

http://stackoverflow.com/a/26675170
score: 4
has body: As I realized from your question, you need to get/set tag parameters of your wicket components dinamically. So, you have several options to do this: Use AttributeModifier static methods like #append("class", "appendedClass") or #replace("name", "#") (where first param is a tag's attribute, and second is it's value) to set any value you want to tags, but note that you can't get current values of tag with this approach. Also, pay attention not to add this modifiers in "render" methods (such as #onConfigure()), not to create modifiers duplicates in every page's or component's refresh in browser. Override #onComponentTag() method like this. ...new Link ( "link" ) { @Override protected void onComponentTag ( final ComponentTag tag ) { super.onComponentTag ( tag ); // you should always call super. tag.getName (); // get name of the tag: a/div/span.. tag.setName ( "span" ); // set tag's name. tag.getAttribute ( "name" ); // get 'name' attribute's value. tag.put ( "name", "#" ); // set 'name' attribute's value } } Use same approach as above, but trhough the Behavior's onComponentTag method not to override component's one. Read this for some more information, but note that this is fairly old article and something can differ for newer Wicket versions. (for example there is already no need to use AttributeAppender, as it moved to AttributeModifier class methods ). Also, you can see this or this examples. There are many of them in google.
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26672703
type: Answer

http://stackoverflow.com/comment/41811457
score: 3
comment on: http://stackoverflow.com/q/26598531
type: Comment
type: QuestionComment
has text: Would [indexOf()](http://www.tutorialspoint.com/java/java_string_indexof.htm) help?

http://stackoverflow.com/comment/41768297
comment on: http://stackoverflow.com/a/26575262
type: AnswerComment
score: 0
type: Comment
has text: indexData is just a local variable create inside for loop temporary

http://stackoverflow.com/q/26654062
accepted answer: http://stackoverflow.com/a/26679686
type: AnsweredQuestion
has title: rabbitmq-priority-queue plugin install issue
tagged with: java
type: Question
score: 2
tagged with: amqp
has body: I tried to install rabbitmq-priority-queue on my ubuntu 12.04 machine which is running rabbitmq 3.4.0. according to the instructions in http://www.rabbitmq.com/installing-plugins.html, I've copied the downloaded file rabbitmq_priority_queue-3.4.x-3431dc1e.ez to /usr/lib/rabbitmq/lib/rabbitmq_server-3.4.0/plugins and enabled the plugin via command: $ sudo rabbitmq-plugins enable rabbitmq_priority_queue when running the example application in https://github.com/rabbitmq/rabbitmq-priority-queue/blob/master/examples/java/src/com/rabbitmq/examples/PriorityQueue.java I got the following output: Sent message with priority 0 Sent message with priority 5 Sent message with priority 10 Received message with priority 0 Received message with priority 5 Received message with priority 10 although I expect the output to be: Sent message with priority 0 Sent message with priority 5 Sent message with priority 10 Received message with priority 10 Received message with priority 5 Received message with priority 0 which means, consume the highest priority message first. I've tried to do the following (none worked): restarted rabbit disabled-enabled the plugin deleted the queue (so it would be recreated by the app) changed .ez file permissions to -rw-r--r-- (just like all other plugins) I've noticed that when I'm enabling the plugin I get the following output: $ sudo rabbitmq-plugins enable rabbitmq_priority_queue The following plugins have been enabled: rabbitmq_priority_queue Applying plugin configuration to rabbit@&lt;my laptop name&gt;...WARNING: module rabbit_priority_queue not found, so not scanned for boot steps. WARNING: module rabbit_priority_queue not found, so not scanned for boot steps. started 1 plugin. But when running 'sudo rabbitmq-plugins list' I get: $ sudo rabbitmq-plugins list Configured: E = explicitly enabled; e = implicitly enabled | Status: * = running on rabbit@benny-laptop |/ [e*] amqp_client 3.4.0 [ ] cowboy 0.5.0-rmq3.4.0-git4b93c2d [ ] eldap 3.4.0-gite309de4 […
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26679686
tagged with: priority-queue
upvote count: 2
tagged with: rabbitmq

http://stackoverflow.com/a/26527886
downvote count: 0
has comment: http://stackoverflow.com/comment/41682907
upvote count: 6
answers question: http://stackoverflow.com/q/26527771
has body: Assuming Java 8: double[] arr = { 1.0, 2.0 }; double min = DoubleStream.of(arr) .min() .getAsDouble();
type: Answer
score: 6

http://stackoverflow.com/comment/41749166
has text: You forgot lizard and spock.
comment on: http://stackoverflow.com/q/26564846
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/31862710
has body: In SetPeriodicService.java at alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmManager.INTERVAL_DAY, alarmIntent); You need change to alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmMgr.INTERVAL_DAY, alarmIntent);
answers question: http://stackoverflow.com/q/26530135
score: 0
type: Answer

http://stackoverflow.com/comment/41712927
has text: I can't see from your example code, but possibly because you are using statement.executeQuery(). This expects a results set to be returned. If this is the case you could try statement.execute(). This is used when you're executing SQL that isn't expected to return anything (INSERT/UPDATE/DELETE/etc)
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26531654

http://stackoverflow.com/a/26634430
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26632524
type: Answer
has body: Okay so it turns out trying to do it with File.getPath() or File.getAbsolutePath() was the issue. Turns out to make it work in code you need to use File.toURI().toURL(). So the proper method would be: BG = //The CSS String, you need to wrap with a Try/Catch to capture a MalformedURLException, but I'm too lazy to do that here... "-fx-background-position : 50% 50%;\n" + "-fx-background-repeat : no-repeat;\n" + "-fx-background-size : contain;\n" + "-fx-background-image : url(\"" + GS.bgImage.toURI().toURL + "\");\n"; BG += "-fx-border-width : " + GS.borderWidth + ";\n" //For adding the Border + "-fx-border-color : " + GS.borderColor.toString();
accepted answer of: http://stackoverflow.com/q/26632524

http://stackoverflow.com/comment/41743039
has text: Yes the point is clear, because someday if somebody inserts a constructor in the class which has some arguments, the compiler will no longer create its default constructor
comment on: http://stackoverflow.com/a/26561290
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26599223
type: AnsweredQuestion
has title: Need assistance with boolean logic
tagged with: java
accepted answer: http://stackoverflow.com/a/26599325
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41812860
type: Question
has body: I'm taking an AP Computer Science Course at my High School, and for our practice quiz, I get all of the questions right except for this one. Can you explain it to me? In the following statement, a and b are boolean variables: boolean c = (a &amp;&amp; b) || !(a || b); Under what conditions with the value of c be true? A. Only when the value of a is different than the value of b. B. Only when the value of a is the same as the value of b. C. Only when a and b are both true. D. Only when a and b are both false. E. The value of c will be true for all values of a and b.
tagged with: boolean
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26599290
has answer: http://stackoverflow.com/a/26599325
has answer: http://stackoverflow.com/a/26599290
favorite count: 0

http://stackoverflow.com/q/26647814
has comment: http://stackoverflow.com/comment/51242100
type: AnsweredQuestion
score: 3
tagged with: java
has body: I have a Singleton class to test: public class Singleton { private static Singleton instance; private List&lt;String&gt; list; private Singleton() { } public static Singleton getInstance() { if (instance == null) { synchronized (Singleton.class) { instance = new Singleton(); } } return instance; } public boolean methodOne() { if (list == null) { list = new ArrayList&lt;String&gt;(); list = SomeClass.fillListOne(); } return SomeClass.verifyList(list); } public boolean methodTwo() { if (list == null) { list = new ArrayList&lt;String&gt;(); list = SomeClass.fillListTwo(); } return SomeClass.verifyList(list); } } With the following test class: @RunWith(JMockit.class) public class SingletonTest { @Test public void testOne(final @Mocked SomeClass someClass) { Singleton.getInstance().methodOne(); new Verifications() { { SomeClass.fillListOne(); } }; } @Test public void testTwo(final @Mocked SomeClass someClass) { Singleton.getInstance().methodTwo(); new Verifications() { { SomeClass.fillListTwo(); } }; } } If I execute only "testOne" or only "testTwo", the tests pass. If I execute all tests, it passes only the first method executed. How can I set "list" attribute to null, for instance in a @Before method? How to use Deencapsulation with Singleton or private member without setters?
possible better answer: http://stackoverflow.com/a/33856056
type: Question
has comment: http://stackoverflow.com/comment/51140073
downvote count: 0
has answer: http://stackoverflow.com/a/33856056
tagged with: jmockit
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/51139372
tagged with: singleton
tagged with: junit
has title: JMockit: Singleton class, Order of test
has comment: http://stackoverflow.com/comment/51139291
favorite count: 0
tagged with: private-members
has answer: http://stackoverflow.com/a/26648609
accepted answer: http://stackoverflow.com/a/26648609

http://stackoverflow.com/comment/97696309
type: AnswerComment
has text: @Eugene I think, `MethodHandles.Lookup::findStatic` works closer to what the JVM will do internally when executing an `invokestatic` instruction the first time, whereas `Class::getMethod` will trigger the initialization of a `Method[]` array holding all `public` methods of the class, if not already existing, which gets reused for subsequent searches (as well as `Class::getMethods` which will just clone that array).
comment on: http://stackoverflow.com/a/26528180
type: Comment
score: 1

http://stackoverflow.com/q/26544714
has comment: http://stackoverflow.com/comment/41744058
has comment: http://stackoverflow.com/comment/41714717
tagged with: primes
upvote count: 3
linked to: http://stackoverflow.com/q/11966520
tagged with: java
downvote count: 2
tagged with: algorithm
has answer: http://stackoverflow.com/a/45600203
has comment: http://stackoverflow.com/comment/41713515
tagged with: sieve-of-eratosthenes
has comment: http://stackoverflow.com/comment/41714197
has answer: http://stackoverflow.com/a/26547710
has comment: http://stackoverflow.com/comment/41735560
type: AnsweredQuestion
has body: I have to write a java code for the 'sieve of eratosthenes' algorithm to print out primes up to a given max value on the console but I'm not allowed to use arrays. Our professor told us it is possible to do only with the help of loops. So I thought a lot and googled a lot about this topic and couldn't find an answer. I dont think it's possible at all because you have store the information which digits are already crossed out somewhere. my code until now: public static void main(String[] args) { int n = 100; int mark = 2; System.out.print("Primes from 1 to "+n+": 2, "); for (int i = 2; i &lt;= n; i++) { if(i % mark != 0){ System.out.print(i+", "); mark = i; } } } -> So, i'm not allowed to do the "i % mark != 0" command with numbers which are multiples of the numbers i already printed but how am i supposed to make that clear without an array where i can delete numbers on indexes? BUT if there is a solution I would be glad if someone could share it with me! :) The solution can be in other programming languages, i can translate it to java myself if its possible. Thank you in advance and best regards Update: Thank you very much all of you, i really appreciate your help but I don't think it can be done with the basic structures. All the algorithms i have seen yet which print out primes by using basic structures are no sieve of eratosthenes. :(
tagged with: language-agnostic
has title: Sieve of Eratosthenes without arrays?
score: 1
has comment: http://stackoverflow.com/comment/41715321
possible better answer: http://stackoverflow.com/a/26547710
favorite count: 0
has comment: http://stackoverflow.com/comment/41714395
type: Question
has comment: http://stackoverflow.com/comment/41751691
answer count: 2
accepted answer: http://stackoverflow.com/a/45600203

http://stackoverflow.com/comment/41938234
type: Comment
comment on: http://stackoverflow.com/a/26668448
score: 0
type: AnswerComment
has text: numcolumns sorry typo

http://stackoverflow.com/comment/41951918
type: QuestionComment
has text: If you like to the properties file outside you need to set classpath to point to your `executon_folder/config/` folder otherwise you will not be able to access your `user.properties`. So a simple `java -jar file.jar` will not work.
comment on: http://stackoverflow.com/q/26672221
score: 0
type: Comment

http://stackoverflow.com/q/26515917
has comment: http://stackoverflow.com/comment/41661953
possible better answer: http://stackoverflow.com/a/26516063
type: Question
has body: I got 3 classes, A,B and C. Only 1 instance of class A exits at any given time but hundreds of objects of class B and C will exist. Class A calls a method of class B. Class B calls a method of class C. And class C eventually calls a method of the class A object. What would be the best and cleanest way to provide the reference to the class A object in C? Saving it in a private variable and initializing it via the constructor? Creating a static getInstance() method in Class A which returns the object itself? Or passing "this" through parameters from A to B to C? Any C Object will call the method of A multiple time in his lifetime.
has title: Singleton class, private variable or method parameter. Performance
has comment: http://stackoverflow.com/comment/41661716
has comment: http://stackoverflow.com/comment/41661685
has comment: http://stackoverflow.com/comment/41661660
tagged with: performance
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/137975
answer count: 3
has answer: http://stackoverflow.com/a/26516270
has answer: http://stackoverflow.com/a/26516143
accepted answer: http://stackoverflow.com/a/26516270
has comment: http://stackoverflow.com/comment/41661688
has comment: http://stackoverflow.com/comment/41661646
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26516063
has comment: http://stackoverflow.com/comment/41661889

http://stackoverflow.com/a/26545044
has comment: http://stackoverflow.com/comment/41713971
has comment: http://stackoverflow.com/comment/41719304
type: Answer
has comment: http://stackoverflow.com/comment/41714322
upvote count: 2
downvote count: 1
has body: The output is as it is because of the line parent p = c; Imagine this: class Car { public void whatAreYou() { System.out.println("Car"); } } class Cadillac extends Car { public void whatAreYou() { System.out.println("Caddillac"); } } If you now say Cadillac coolCar = new Cadillac(); Car testCar = coolCar; testCar.whatAreYou(); It becomes pretty obvious that the output is, "Cadillac", no? This is how you can look at inheritence: Cadillac objects are allways Cars. Car objects can be Cadillacs Since I explicitly set the Cadillac reference coolCar to point to an object of a Cadillac, and the Car reference testCarto point to the same object, we get the output "Cadillac" To make it even more obvious, you could even say Car coolCar = new Cadillac(); Car testCar = coolCar; testCar.whatAreYou();
score: 1
answers question: http://stackoverflow.com/q/26544952

http://stackoverflow.com/comment/41756937
type: QuestionComment
has text: You are probably getting a `NullPointerException` due to `os` being `null`.
comment on: http://stackoverflow.com/q/26568915
score: 5
type: Comment

http://stackoverflow.com/a/26596502
upvote count: 1
type: Answer
has body: You have declared Rectangle rects[] twice. Just change the line inside the constructor to rects = new Rectangle[2];
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26596408

http://stackoverflow.com/comment/41734304
type: Comment
type: QuestionComment
has text: Accessing the `pom.xml` as ... well ... `XML` is not an option? What is _"the program"_'s intention? Is _the program_ implemented as Maven plugin an option?
comment on: http://stackoverflow.com/q/26551439
score: 0

http://stackoverflow.com/comment/41774255
score: 0
comment on: http://stackoverflow.com/a/26578440
type: Comment
has text: Thanks for your reply, I have tried to make the suggested changes and here is my updated code: http://pastebin.com/FC2hg4H7 - Sorry if there are still mistakes, Im not sure if what I have done is correct :(
type: AnswerComment

http://stackoverflow.com/comment/41779163
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26581222
score: 0
has text: what is value of max in your program?

http://stackoverflow.com/comment/119882740
type: AnswerComment
comment on: http://stackoverflow.com/a/26623367
type: Comment
has text: 2. null Values are allowed in LinkedHashMap. -> HashMap also permit null values
score: 0

while-loop
tags question: http://stackoverflow.com/q/26566773
type: Tag
tags question: http://stackoverflow.com/q/26602998
tags question: http://stackoverflow.com/q/26570406
tags question: http://stackoverflow.com/q/26599772
tags question: http://stackoverflow.com/q/26615834
tags question: http://stackoverflow.com/q/26578613
tags question: http://stackoverflow.com/q/26598511
tags question: http://stackoverflow.com/q/26604875
tags question: http://stackoverflow.com/q/26557185
tags question: http://stackoverflow.com/q/26644800
tags question: http://stackoverflow.com/q/26572562
tags question: http://stackoverflow.com/q/26567974
tags question: http://stackoverflow.com/q/26589948
tags question: http://stackoverflow.com/q/26556048
tags question: http://stackoverflow.com/q/26654214
tags question: http://stackoverflow.com/q/26525346
tags question: http://stackoverflow.com/q/26666566
tags question: http://stackoverflow.com/q/26638092
tags question: http://stackoverflow.com/q/26642544
tags question: http://stackoverflow.com/q/26619146
tags question: http://stackoverflow.com/q/26600029
tags question: http://stackoverflow.com/q/26600652
tags question: http://stackoverflow.com/q/26538433
tags question: http://stackoverflow.com/q/26537366
tags question: http://stackoverflow.com/q/26618649
tags question: http://stackoverflow.com/q/26639285
tag name: while-loop
tags question: http://stackoverflow.com/q/26576968

http://stackoverflow.com/a/26549227
answers question: http://stackoverflow.com/q/26545887
upvote count: 1
has comment: http://stackoverflow.com/comment/41723936
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41724396
type: Answer
has body: I have made some code using nimbus look and feel, i know it is not exact that you want but it is pretty much helpful. Check this code. To perform same you need to find the key of your next and previous buttons key in my case it is Button.margin. Try to use the same key in your code if you are lucky it would work. import javax.swing.*; import java.awt.*; public class Demo { JFrame frame = new JFrame(""); JButton btn = new JButton("Example"); public Demo() { frame.setSize(400, 400); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.add(btn); frame.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); Insets insets = new Insets(50, 20, 50, 20); //change the size of button UIManager.put("Button.margin", insets); } catch(Exception e) { e.printStackTrace(); } Demo d = new Demo(); } } Also keep in mind to use default look and feel or any other look and feel.

http://stackoverflow.com/q/26568411
has comment: http://stackoverflow.com/comment/41756982
tagged with: java
has comment: http://stackoverflow.com/comment/41756129
has comment: http://stackoverflow.com/comment/41756097
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5621338
has body: I have a JDialog that is opened with a button click in a JFrame. Every time I close the JDialog and click and open JDialog again, it moves upwards in the screen (about 30 pixels). I tried fixing the frame location, used setLocationRelativeTo(null) and also tried to fix it with Toolkit.getDefaultToolkit().getScreenSize(); but it doesn't work. It just goes upward until it is on top of screen. Why could that be? // Play Hook Frame hookDialog = new JDialog(frame, "Play Hook", true); hookDialog.setSize(450, 250); hookDialog.setLocation(dim.width / 2 - hookDialog.getSize().width / 2, dim.height / 2 - hookDialog.getSize().height / 2); hookDialog.getContentPane().setBackground(bgColor); hookDialog.setResizable(false); hookDialog.getContentPane().setLayout(null); ... JButton btnPlayHook = new JButton("Play Hook"); customizeButton(btnPlayHook); btnPlayHook.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isHookPressed) { JOptionPane.showMessageDialog(frame, "Please press Find Hook button first", "Error", JOptionPane.ERROR_MESSAGE); } else { for (int i = 0; i &lt; hooks.size(); i++) { int intMin1 = (int) (hooks.get(i).getStartTime() / 60); int intMin2 = (int) (hooks.get(i).getEndTime() / 60); int intSec1 = (int) (hooks.get(i).getStartTime() % 60); int intSec2 = (int) (hooks.get(i).getEndTime() % 60); String min1 = intMin1 + " min"; String min2 = intMin2 + " min"; String sec1 = intSec1 + " sec"; String sec2 = intSec2 + " sec"; String elem = "Hook" + (i + 1) + ": " + min1 + " " + sec1 + " - " + min2 + " " + sec2; if (!listElements.contains(elem)) listElements.addElement(elem); } hookDialog.setVisible(true); } } });
tagged with: jdialog
score: 0
has comment: http://stackoverflow.com/comment/41755990
has title: JDialog moves upwards everytime it is opened
has comment: http://stackoverflow.com/comment/41756114
has comment: http://stackoverflow.com/comment/41756241
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/26568946
has comment: http://stackoverflow.com/comment/41756100
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41756123
has comment: http://stackoverflow.com/comment/41756139
tagged with: swing
has answer: http://stackoverflow.com/a/26568549

http://stackoverflow.com/comment/41836509
type: Comment
comment on: http://stackoverflow.com/q/26612333
type: QuestionComment
has text: lock is obtained on an object, not on method itself
score: 0

http://stackoverflow.com/comment/41811301
comment on: http://stackoverflow.com/a/26598502
has text: Since foo may never equal bar could it possibly be an overflow error? I have never experience a arithmetic sequence result in -1.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26614721
score: 8
upvote count: 8
has title: How can I modify/update a java.net.URI object?
type: AnsweredQuestion
has body: Given a java.net.URI object, I need to either: destructively modify one field on that object (e.g. the path component). However there are no setX methods, so it seems these objects are supposed to be immutable. construct a new URI object that is the same as the original except for a given field ("functional update"). However there are no withX methods, so I would have to write my own logic to deal with this. Do I really have to write my own functions to deal with modification of URI objects?
tagged with: java
has answer: http://stackoverflow.com/a/26614823
accepted answer: http://stackoverflow.com/a/26614823
tagged with: updates
type: Question
tagged with: uri
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26615620
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41842556
has title: NoClassDefFoundError from Bash Script
has comment: http://stackoverflow.com/comment/41842550
favorite count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/41842644
has comment: http://stackoverflow.com/comment/41842599
has comment: http://stackoverflow.com/comment/41843530
has body: I am currently trying to run my application from within a bash script. When I run the java application from the console it works fine. I have compliled the java app and have tried multiple different commands within the script, and cannot figure it out. I am fairly new with scripting so I am guessing it something syntax related. I have also read multiple different posts on here but nothing seems to work. Here is my script and I am running it as sh endpoint.sh #!/bin/bash CLASSPATH=json-simple-1.1.jar:log4j-1.2.17.jar:. result=$(java -cp $CLASSPATH com/api/endpoint/MyApp $INI) echo $result The error I am getting is as follows Exception in thread "Main Thread" java.lang.NoClassDefFoundError: com/api/endpoint/MyApp Caused by: java.lang.ClassNotFoundException: com.api.endpoint.MyApp at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:305) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:246) Could not find the main class: com/api/endpoint/MyApp. Program will exit. The application is in a package of com.api.endpoint and is in that directory. I have a feeling this is something simple that I am overlooking, but I have been struggling with this for a few days now. Any ideas? Full script : #!/bin/bash # Set the search path for the shell to be the standard places. PATH=setting the path here; export PATH # Config file INI=config.ini # Log function function log() { timestamp=`date +"%s"` echo "$timestamp:$1"&gt;&gt;$ERROR_LOG_FILE } # Read config file if [ -f $INI ] then source $INI else exit 1 # terminate the script and return error fi # create error log file echo -n "" &gt; $ERROR_LOG_FILE # prepare the WLST env to execute api list python script source $WLST_SCRIPT # call list.py result=$(java wb.WLST $WLST_PYTHON_SCRIPT) if $result == *Exception* then log "$result" exit 1 # terminate t…
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41842699
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26616315
type: Question

http://stackoverflow.com/comment/41710122
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26543096
has text: Then just put a small time in sleep or use another data structure. I think that there are some structures like BlockingQueue that allow the thread to wait until something is in the queue

http://stackoverflow.com/q/26598467
has body: Which collection would satisfy the following test program: public class TestOrderedList { // The class I'm looking for: MapWithIndex&lt;String,Person&gt; ol = new MapWithIndex&lt;String, Person&gt;(); // class Person left out for brevity public TestOrderedList() { Person benny = new Person("Benny"); Person charles = new Person("Charles"); Person alvin = new Person("Alvin"); Person calvin = new Person("Calvin"); ol.put("Benny", benny); // should return 0 ol.put("Charles", charles); // should return 1 ol.put("Alvin", alvin); // should return 0 ol.put("Calvin", calvin); // should return 2 int index = ol.findIndex("Benny"); // should return 1 Person adam = new Person("Adam"); ol.put("Adam", adam); // should return 0 (new pos) index = ol.findIndex("Benny"); // should return 2 ol.remove("Alvin"); // should return 1 (existing pos) index = ol.findIndex("Benny"); // should return 1 } } The collection does not have to be implementing any particular interface, or be convertible to another collection (however of that is possible it would be nice). It does not have to be thread safe, but if it is.... good! Returning -1 when not found or error situation is OK. The purpose of the collection is that I quickly need to know at which position a newly inserted record was put in. Also I want to look up at what position a record exists. The collection doesn't need to support duplicate keys. --- update ---- I went with the ArrayList solution, where I keep it sorted by doing a binary lookup before inserting (to get the index where it should be inserted). This way the position in the list always correspond to the row number (in the table that that is synced with this list). It's fast and simple. I'm sure there must exists a more robust implementation than mine though?!?!
tagged with: sorting
has answer: http://stackoverflow.com/a/26598619
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41811328
accepted answer: http://stackoverflow.com/a/26598619
has comment: http://stackoverflow.com/comment/41811383
has title: Map with position index
possible better answer: http://stackoverflow.com/a/26598580
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26598580
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41811513
tagged with: java
has answer: http://stackoverflow.com/a/26598944
type: Question

http://stackoverflow.com/q/26624647
has title: Something is killing my script, can't figure out what is doing it in code and outputs STOP_ACTIVITY_HIDE
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: google-maps
answer count: 1
has body: Whenever I run my script that was working yesterday, now it is killed today. My app is written in Java and I want to use Google Maps so when the users click on, say, bookstore or doctor icon in the app, they are taken to the Google location in the city wherever they are in the world. However, what happens is it stops and hides the activity. The app starts from a splash screen and goes to icons splash. When I touch an icon, it gives the coordinates but doesn't output anything. I have changed the key and everything. Any ideas why? LogCat 10-29 02:59:06.260 13409-13409/com.xtreme.cityguide E/GeoData:﹕ Current Location Longitude: -81.06201496 Latitude: 37.39213943 10-29 02:59:06.310 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &gt;&gt;&gt; handling: PAUSE_ACTIVITY 10-29 02:59:06.330 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &lt;&lt;&lt; done: PAUSE_ACTIVITY 10-29 02:59:06.380 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &gt;&gt;&gt; handling: LAUNCH_ACTIVITY 10-29 02:59:06.440 13409-13409/com.xtreme.cityguide W/Query in activity :﹕ book_store 10-29 02:59:06.450 13409-13706/com.xtreme.cityguide W/URL is﹕ https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.39213943,-81.06201496&amp;rankby=distance&amp;types=book_store&amp;sensor=false&amp;key=AIzaSyC6zHflVgVCLKEMWBFMFm5qj0Jis-eoR4U 10-29 02:59:06.450 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &lt;&lt;&lt; done: LAUNCH_ACTIVITY 10-29 02:59:06.620 13409-13706/com.xtreme.cityguide I/System.out﹕ Login form get: HTTP/1.1 200 OK 10-29 02:59:06.620 13409-13706/com.xtreme.cityguide I/System.out﹕ get login cookies: 10-29 02:59:06.620 13409-13706/com.xtreme.cityguide W/status line﹕ HTTP/1.1 200 OK 10-29 02:59:06.630 13409-13706/com.xtreme.cityguide W/Size of City :﹕ 0 10-29 02:59:07.000 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &gt;&gt;&gt; handling: STOP_ACTIVITY_HIDE 10-29 02:59:07.000 13409-13409/com.xtreme.cityguide D/ActivityThread﹕ &lt;&lt;&lt; done: STOP_ACTIVITY_HID…
has answer: http://stackoverflow.com/a/26629332
tagged with: android

http://stackoverflow.com/q/26668488
tagged with: java
linked to: http://stackoverflow.com/q/3145089
answer count: 1
linked to: http://stackoverflow.com/q/21022297
has comment: http://stackoverflow.com/comment/41938973
has comment: http://stackoverflow.com/comment/41938078
has body: I am trying to find the current location in my project.So i found this post: What is the simplest and most robust way to get the user&#39;s current location on Android? I tried using locationclient but was not satisfied with the result.The code that i have used is as follows: The Mylocation.java class: package com.igloo.classes; import java.util.Timer; import java.util.TimerTask; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; public class MyLocation { Timer timer1; LocationManager lm; LocationResult locationResult; boolean gps_enabled=false; boolean network_enabled=false; public boolean getLocation(Context context, LocationResult result) { //I use LocationResult callback class to pass location value from MyLocation to user code. locationResult=result; if(lm==null) lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); //exceptions will be thrown if provider is not permitted. try{gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){} try{network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){} //don't start listeners if no provider is enabled if(!gps_enabled &amp;&amp; !network_enabled) return false; if(gps_enabled) lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps); if(network_enabled) lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListenerNetwork); timer1=new Timer(); timer1.schedule(new GetLastLocation(), 90000); return true; } LocationListener locationListenerGps = new LocationListener() { public void onLocationChanged(Location location) { timer1.cancel(); locationResult.gotLocation(location); lm.removeUpdates(this); lm.removeUpdates(locationListenerNetwork); } public void onProviderDisabled(String provider) {} public void onProviderEnabled(String provider) {} public void onStatusChanged(Strin…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41939087
has comment: http://stackoverflow.com/comment/41938179
has answer: http://stackoverflow.com/a/26668538
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41938051
has title: Getting location in android not working on newer device
linked to: http://stackoverflow.com/q/6496588
has comment: http://stackoverflow.com/comment/41938246
score: 0

http://stackoverflow.com/comment/41882370
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26637596
type: Comment
has text: You were quicker, +1 (you might want to move the enum value above the image field)

http://stackoverflow.com/comment/41809410
score: 0
type: Comment
has text: You'd have to make sure you have your imports in order, too. Import `java.io.File`, `java.io.FileWriter`, and `java.io.IOException`. You'd want to use a path to a real file. I highly suggest making sure you understand what this code is doing in addition to doing a little reading on `java.io`.
comment on: http://stackoverflow.com/a/26597489
type: AnswerComment

http://stackoverflow.com/comment/41893154
type: Comment
comment on: http://stackoverflow.com/a/26643192
score: 0
type: AnswerComment
has text: I bet other drivers even the Javascript shell share the same characters since they are communicated by socket.

http://stackoverflow.com/comment/41899554
score: 0
has text: `Hibernate.initialize(entitity.getX());` will do it for that level, but if you head down that path, it won't be long before you are pulling nearly your entire database into memory
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26647110

http://stackoverflow.com/comment/41837988
type: Comment
has text: Another small clarification. I did not ask additional speed. Specify only applyLinearImpulse.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26597549

http://stackoverflow.com/comment/101236599
type: AnswerComment
comment on: http://stackoverflow.com/a/26669876
type: Comment
has text: This doesn't answer the question, Mark Jernonimus's [answer](https://stackoverflow.com/a/36259806/1399811) is better
score: 0

scriptom
type: Tag
tag name: scriptom
tags question: http://stackoverflow.com/q/26544524

http://stackoverflow.com/comment/41735788
has text: You make a thread sleep when not updating anything by having it be event-driven vs simply sitting in a tight loop.
score: 1
comment on: http://stackoverflow.com/q/26557141
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26618179
has body: Have you tried to use \u0151=7 instead of ő=7in the .properties file? (For other characters please see http://www.utf8-chartable.de/unicode-utf8-table.pl?start=256&amp;unicodeinhtml=hex or some other encoding table). And to answer your encoding question - please try to use Notepad++. You can save/convert various char encodings with it.
answers question: http://stackoverflow.com/q/26598421
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26598421

http://stackoverflow.com/q/26536886
has answer: http://stackoverflow.com/a/26536943
answer count: 3
possible better answer: http://stackoverflow.com/a/53312401
has body: What is the correct way to create a FileSystem object that can be used for reading from/writing to HDFS? In some examples I've found, they do something like this: final Configuration conf = new Configuration(); conf.addResource(new Path("/usr/local/hadoop/etc/hadoop/core-site.xml")); conf.addResource(new Path("/usr/local/hadoop/etc/hadoop/hdfs-site.xml")); final FileSystem fs = FileSystem.get(conf); From looking at the documentation for the Configuration class, it looks like the properties from core-site.xml are automatically loaded when the object is created if that file is on the classpath, so there is no need to set it again. I haven't found anything that says why adding hdfs-site.xml would be required, and it seems to work fine without it. Would it be safe to just put core-site.xml on the classpath and skip hdfs-site.xml, or should I be setting both like I've seen in the examples? In what cases would the properties from hdfs-site.xml be required?
has answer: http://stackoverflow.com/a/26633126
downvote count: 0
has answer: http://stackoverflow.com/a/53312401
tagged with: hdfs
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26633126
score: 1
tagged with: java
upvote count: 1
has title: What is the correct way to get a Hadoop FileSystem object that can be used for reading from/writing to HDFS?
type: Question
tagged with: hadoop

http://stackoverflow.com/comment/41716681
type: Comment
type: QuestionComment
has text: For testing purposes I commented out everything inside the GetDllVersion method body. So practically this function does nothing
comment on: http://stackoverflow.com/q/26546774
score: 0

http://stackoverflow.com/a/26518330
answers question: http://stackoverflow.com/q/26517332
downvote count: 0
has comment: http://stackoverflow.com/comment/41685819
type: Answer
has comment: http://stackoverflow.com/comment/41683249
has body: The token is a piece of state. It belongs in its own actor - not the supervisor, but an actor in its own right - which can also be responsible (or have children responsible) for creating a new token when the current one times out. Other actors can request the token the usual way, by sending a message to the token actor and getting a reply with the token. I would not normally expect a supervisor to be being recreated - a supervisor should be as simple as possible, responsible only for restarting failed actors. Any actual processing should happen in other actors, so that the chances of the supervisor itself failing are minimal. Responding to your update: The actor that's responsible for storing the token string should probably be responsible for using it. If the token is used in a standard way on every request, other actors could send their requests to the token actor, which can then forward them to the actual http actor. If there are a few different ways of using the token, the actor could accept different types of message for these different cases. Put the logic with the state it needs access to. Response to update 2: Mutable statics are a terrible idea - it's global mutable state (also the practical problems of statics in a distributed system e.g. classloader issues). Your code has race conditions - it's possible two requests will update the token at the same time; depending on how the service at the other end responds to this this may break. The whole point of the actor model is to avoid such things. If you're going to do this then why bother using actors at all? (This is not a rhetorical question - maybe your problem doesn't need actors? In which case you could make your code simpler by not using them). But even if you want to use a non-actor approach, I'd recommend using a singleton object (potentially static, but ideally managed by your DI framework or however you're putting together your application) containing a mutable field, rather than just a static field.
upvote count: 4
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/26517332

http://stackoverflow.com/q/26609879
tagged with: maven
has answer: http://stackoverflow.com/a/26610977
tagged with: spring
tagged with: spring-boot
has answer: http://stackoverflow.com/a/29760183
tagged with: java
has comment: http://stackoverflow.com/comment/41832556
has comment: http://stackoverflow.com/comment/41832084
has title: Log4j seems not to work in Spring Boot
has comment: http://stackoverflow.com/comment/41833696
type: Question
downvote count: 0
has body: I tried to add Spring and Maven to one of my existing project, and I find that no matter how I configure, the logging seems to be out of my control. I tried putting the log4j.properties in src/main/java and src/main/resources(Actually I am not sure where to put). But when I use Log4j to log, the log displays in the console only, though I configure it into a file. My log4j.properties is like: log4j.rootLogger=DEBUG, A1 log4j.appender.A1=org.apache.log4j.FileAppender log4j.appender.A1.encoding=utf-8 log4j.appender.A1.File=E:\Programminglog\debug.log log4j.appender.A1.Threshold = DEBUG log4j.appender.A1.Append=true log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n I am not sure if I miss something or Spring overrides some settings, since I am new to Maven and Spring. PS: Before I add dependencies of Log4j in pom.xml,no compile errors though I use org.apache.log4j.Logger This is how my application.java looks like: @Configuration @EnableAutoConfiguration @ComponentScan({"hello","wodinow.weixin.jaskey"}) public class Application extends WebMvcConfigurerAdapter { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); System.out.println("Let's inspect the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); } LogUtil.info("Application Boots!");// here this line does not show in the file } @Bean public CommandService commandService(){ return CommandService.getInstance(); } }
linked to: http://stackoverflow.com/q/4400583
has comment: http://stackoverflow.com/comment/41831843
has answer: http://stackoverflow.com/a/48742159
answer count: 4
tagged with: log4j
score: 8
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/76517193
type: UnansweredQuestion

http://stackoverflow.com/q/26614807
answer count: 1
downvote count: 0
tagged with: jms
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has body: I am getting the following error when trying to post to my queue: Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: http://localhost:8161. Reason: java.io.IOException: Failed to perform GET on: http://localhost:8161 as response was: Not Found at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316) at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:496) at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:568) at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:657) at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:648) at com.spring.tutorials.amq.MessageSender.send(MessageSender.java:14) at com.spring.tutorials.amq.Run.main(Run.java:24) Caused by: javax.jms.JMSException: Could not connect to broker URL: http://localhost:8161. Reason: java.io.IOException: Failed to perform GET on: http://localhost:8161 as response was: Not Found at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:358) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:303) at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:243) at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:483) ... 5 more Caused by: java.io.IOException: Failed to perform GET on: http://localhost:8161 as response was: Not Found at org.apache.activemq.transport.http.HttpClientTransport.doStart(HttpClientTransport.java:279) at org.apac…
tagged with: activemq-classic
tagged with: java
type: Question
score: 5
has title: Spring JMS with ActiveMQ
upvote count: 5
has answer: http://stackoverflow.com/a/26622357
tagged with: spring-jms

http://stackoverflow.com/a/26558523
upvote count: 3
answers question: http://stackoverflow.com/q/26558219
score: 3
downvote count: 0
type: Answer
has body: In addition to @HovercraftFullOfEels great suggestion, if your use case is as simple as set/retrieve an arbitrary value then you can use the very same JButton to "hold" this value by using both putClientProperty(key, value) and getClientProperty(key) methods inherited from JComponent class. Something like this: JButton button = new JButton("Button 1"); button.putClientProperty("ValueKey", "Actual value"); ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); System.out.println(button.getClientProperty("ValueKey")); }; } In this way you don't have to extend neither AbstractAction nor JButton at all. Note this approach can be useful not only for buttons but other components as well. There is a complete example using the very same approach with check boxes in this answer

http://stackoverflow.com/comment/41907591
type: QuestionComment
comment on: http://stackoverflow.com/q/26642176
score: 0
has text: Can you try running the .bat file from within java instead and seeing what happens?
type: Comment

http://stackoverflow.com/a/26866667
has body: Jackson 2 is completely incompatible with Jackson 1, and JsonSerializableWithType (Now deprecated and unusable) is an interface from Jackson 1 which led to the presence of serializeWithType() in Jackson 2. serializeWithType() is called when additional type information is expected to be included, which means that an annotation (JsonTypeInfo) is specifying the class property for deserialization delegation, when polymorphism is used. This method will then be called with the additional type information within a TypeSerializer, which may be written with a type prefix: /* (.., .., TypeSerializer typeSer) */ { typeSer.writeTypePrefixForScalar(.., .., ThisClass.class); } By annotating the class with @JsonTypeInfo, you will be able to specify serializing with the type information: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.WRAPPER_OBJECT, property = "type") @JsonSubTypes({ @Type(name = "typeint", value = MyInt.class), @Type(name = "typefloat", value = MyFloat.class) }) public interface MyNumber {} @JsonTypeName("typeint") public MyInt implements MyNumber {} @JsonTypeName("typefloat") public MyFloat implements MyNumber {} Then the values typeint and typefloat will be set in the property named type. When you deserialize a MyNumber, it will be based on polymorphism. Thomas Maurel's answer demonstrates a straightforward approach to test by serializing the object as string and deseralizing it.
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26672297
downvote count: 0
has comment: http://stackoverflow.com/comment/135378565

http://stackoverflow.com/comment/41925196
score: 0
comment on: http://stackoverflow.com/a/26661488
type: AnswerComment
type: Comment
has text: Probably yeah. But more expensive the lock, the double checking, etc. than Bill Pugh's solution. So why do you want to invent a new way, which (probably) worse than the existing solutions. And no one knows, so no one will be able to understand you code easily.

http://stackoverflow.com/comment/41799650
score: 0
has text: What is your actual problem / question?
type: Comment
comment on: http://stackoverflow.com/q/26592391
type: QuestionComment

http://stackoverflow.com/comment/41841479
type: Comment
has text: The use of the keyword `extends` clearly indicates Java
comment on: http://stackoverflow.com/a/26615014
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41776354
type: QuestionComment
has text: Your code throws a fit if there are **no** duplicates, not if there **are** duplicates. Change `if (!duplicates)` to `if (duplicates)`. Also, move `array[index] = num; index++;` after the exception is thrown, or you will add an element anyway, exception or no.
score: 2
comment on: http://stackoverflow.com/q/26579580
type: Comment

http://stackoverflow.com/a/26627112
answers question: http://stackoverflow.com/q/26626980
type: AcceptedAnswer
has body: In your code you just concatenate number and string. Try String.format(): String msg = String.format(" You have been successfully registered into MYCARE. Your Patient ID is: %d. Please use it to login. ", number);
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41873780
has comment: http://stackoverflow.com/comment/41874216
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26626980
has comment: http://stackoverflow.com/comment/41874733
has comment: http://stackoverflow.com/comment/41874377

http://stackoverflow.com/comment/41992618
type: Comment
comment on: http://stackoverflow.com/q/26517169
type: QuestionComment
has text: post your complete log4j.xml
score: 0

http://stackoverflow.com/comment/41897285
has text: I'm using firebase to retrieve the data and when I set the data I cast it to by doing (List<News>) so then why would it be getting set to a hashmap
comment on: http://stackoverflow.com/a/26645747
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26655628
has title: mouse hover is not working in safari ,selenium web driver
has comment: http://stackoverflow.com/comment/41926926
has comment: http://stackoverflow.com/comment/41925747
has body: I used the Actions to mouse hover in FF and chrome , it is working fine. But the same code is not working in safari. I am using mac OS and selenium webdriver and java. I tried below code. new Actions(driver).moveToElement(element).build().perform(); JS: String mouseOverScript = "if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseover', true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseover');}"; JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript(mouseOverScript, element); It is a show stopper issue. any help is appreciated.
tagged with: mousehover
tagged with: java
score: 4
type: Question
has answer: http://stackoverflow.com/a/26685564
answer count: 1
favorite count: 0
upvote count: 4
tagged with: macos
tagged with: safari
tagged with: selenium-webdriver
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/43729331
type: Answer
has comment: http://stackoverflow.com/comment/82018608
has comment: http://stackoverflow.com/comment/83318602
score: 9
upvote count: 9
downvote count: 0
has body: It's very easy just add android:backgroundTint attribute in your EditText. android:backgroundTint="@color/blue" android:backgroundTint="#ffffff" android:backgroundTint="@color/red" &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:backgroundTint="#ffffff"/&gt;
answers question: http://stackoverflow.com/q/26574328
has comment: http://stackoverflow.com/comment/87042462

http://stackoverflow.com/a/26599283
answers question: http://stackoverflow.com/q/26598966
type: Answer
score: 1
has body: I am surprised the code compiles. From the code presented return getParameterMap().get(name); should be returning a String[] yet the method containing that code is returning a String. I could be missing something though.
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/32371903
type: Answer
has body: Using PlayService publisher client libraries running on Android I experienced the same problem when running the sample. Fixed it with @bhavit-s-sengar's awnser above. Had to also change AndroidPublisherHelper.newTrustedTransport() to this: SSLContext sslcontext = SSLContext.getInstance("TLSv1"); sslcontext.init(null, null, null); // NoSSLv3SocketFactory is @bhavit-s-sengar's http://stackoverflow.com/a/29946540/8524 SSLSocketFactory noSSLv3Factory = new NoSSLv3SocketFactory(sslcontext.getSocketFactory()); NetHttpTransport.Builder netTransportBuilder = new NetHttpTransport.Builder(); netTransportBuilder.setSslSocketFactory(noSSLv3Factory); HTTP_TRANSPORT = netTransportBuilder.build();
score: 0
answers question: http://stackoverflow.com/q/26649389

http://stackoverflow.com/a/26611947
has body: I've just got a reply to be issue that helped me resolve the problem. I'm still not sure if this was my fault or if this is a bug, but here is the solution: IntelliJ has (at least) two locations in the project settings where you can configure the nullness annotations which are: Settings | Inspections | Constant conditions &amp; exceptions | Configure annotations Settings | Inspections | @NotNull/@Nullable problems | Configure annoations When I set up the annotations, added them using 1.) not knowing there is 2.). The issue was cause because in 2.), the annotation checkers.nullness.quals.NonNull was selected in both the Nullable and NonNull sections which is obviously wrong. In 1.) everything was fine. To resolve the issue, I removed checkers.nullness.quals.NonNull from the Nullable section in 2.) and added and selected checkers.nullness.quals.Nullable.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26587291
upvote count: 2
type: Answer

http://stackoverflow.com/a/26570886
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26570412
has body: In your initTables method, when you create an instance of the DefaultTableModel, just create an anonymous class and override the isCellEditable public void initTables() { dtm=new DefaultTableModel(0,0) { @Override public boolean isCellEditable(int row, int col) { return false; // every cell is not editable } }; dtm.addColumn("Name"); dtm.addColumn("Age"); dtm.addColumn("Gender"); }
accepted answer of: http://stackoverflow.com/q/26570412

http://stackoverflow.com/comment/41934914
score: 0
comment on: http://stackoverflow.com/q/26666688
has text: Why not return a `boolean`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26665453
has comment: http://stackoverflow.com/comment/41932828
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41933013
has comment: http://stackoverflow.com/comment/41932963
accepted answer of: http://stackoverflow.com/q/26665241
has comment: http://stackoverflow.com/comment/41932767
upvote count: 1
has body: Unless you're restricted to using for loops, I believe this would do the trick: String sb = ""; for (int i = 0; i &lt; dc.length(); i++) { char c = dc.charAt(i); int count = 1; while (i + 1 &lt; dc.length() &amp;&amp; (dc.charAt(i + 1)) == c) { count++; i++; } if (count &gt; 1) { sb += count; } sb += c; } System.out.println(sb); edit: Changed the example to use regular String instead of StringBuilder. However, I really advise against concatenating strings this way, especially if the string you're trying to compress is long.
answers question: http://stackoverflow.com/q/26665241
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41932722
has comment: http://stackoverflow.com/comment/41932984

http://stackoverflow.com/q/26668186
tagged with: css
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26668808
tagged with: maven
has body: I create a search application in maven springmvc. when run it on terminal is shows the following error: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.0.2:war (default-war) on project search-qc-ui: Could not explode webapp... Unable to open file /usr/local/tomcat/webapps/Myproject/styles/classadmin/sss.css for writing. -> [Help 1] I also referenced it on the below link but I am not able to fix it.Is anyone knows it pleaselet me know as soon as possible. Unable to load CSS in Spring Mavenized project
has title: How to fix unable to load css file in maven build on maven springmvc project
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41938481
has answer: http://stackoverflow.com/a/26668808
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41937538
linked to: http://stackoverflow.com/q/21848126

twitter-oauth
tags question: http://stackoverflow.com/q/26569607
type: Tag
tag name: twitter-oauth

http://stackoverflow.com/comment/41720964
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26548930
type: QuestionComment
has text: when i create a singleton class, I create a synchronized lock on the object. Maybe this would help?

http://stackoverflow.com/a/26522575
upvote count: 1
has body: public class DateTime { public static void main(String[] args) { // Get the value from database, using the steps to connect and get the value java.sql.Date trip_time= //"{Collected value from DB}"; //"2014-10-13 08:30:00"; //Assume u got this value //Now it's time to convert to Sql date time to java data time java.util.Date utilDate = new java.util.Date(trip_time.getTime()); System.out.println("Converted value of java.util.Date : " + utilDate); }
score: 1
answers question: http://stackoverflow.com/q/26522401
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41830689
comment on: http://stackoverflow.com/q/26609152
has text: What do you mean by "without converting the xml file"? Why do you have to use `XmlDecoder`? Is this *actually* the XML format? If so, it would be near-trivial just to hand-code the deserialization.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41811734
type: QuestionComment
has text: @DavidWallace I didn't find anything... I've been at this for about 5 hours. Fixing other problems along the way.. this just happened to pop up under one of the cases.
comment on: http://stackoverflow.com/q/26598561
score: 0
type: Comment

http://stackoverflow.com/q/26647694
tagged with: methodhandle
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26654383
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26654383
upvote count: 1
type: Question
type: AnsweredQuestion
has body: How do I compare two MethodHandle instances? I am expecting the function to return true if the handles point to the same method. It doesn't look like the class overrides equals() or hashcode(). Is it safe to use the equality operator (==)?
tagged with: java
has title: How to compare MethodHandle instances?

http://stackoverflow.com/comment/41724434
has text: I meant creating my very own jar not inserting my classes inside someone else's jar. I'm not a parasite :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26551155
type: AnswerComment

http://stackoverflow.com/comment/41760518
type: QuestionComment
comment on: http://stackoverflow.com/q/26559521
has text: If you got the "out of memory" error, make sure that the stream passed was indeed a JPG and not a PNG.
score: 0
type: Comment

http://stackoverflow.com/a/26731121
accepted answer of: http://stackoverflow.com/q/26605990
type: AcceptedAnswer
score: 0
type: Answer
has body: I've figured out. The reason was that the servlet didn't parse the multipart requests on its own. I had been sending requests with this line in the header (even if it was plain string or integer values): Content-type: multipart/form-data and that was the reason. So, I was expected to use the third-party library in the PictureComposer class. In my case Streaming API from Apache came in handy. Also, this StackOverflow answer helped me a lot in resolving my problem.
answers question: http://stackoverflow.com/q/26605990

http://stackoverflow.com/comment/41842147
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26594731
has text: DWR 2.06, documentation for spring config

http://stackoverflow.com/comment/49407626
type: Comment
comment on: http://stackoverflow.com/a/26643803
has text: @Orubel - Yes, that's very nice rhetoric. Can you please post benchmarks?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26549868
type: UnansweredQuestion
tagged with: jakarta-ee
has title: DeploymentException: WELD-001408: Unsatisfied dependencies for type [] with qualifiers @Default
tagged with: java
has answer: http://stackoverflow.com/a/28460549
type: Question
upvote count: 4
tagged with: ejb
answer count: 1
downvote count: 0
score: 4
favorite count: 0
tagged with: cdi
has body: I have a problem with my first Java EE aplication. I use Wildfly 8.1 server and Netbeans. My application consists of Entity class (SocialUser.java). : package com.mycompany.entity; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "soc_user") public class SocialUser implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String login; public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof SocialUser)) { return false; } SocialUser other = (SocialUser) object; if ((this.id == null &amp;&amp; other.id != null) || (this.id != null &amp;&amp; !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "com.mycompany.entity.NewEntity[ id=" + id + " ]"; } /** * @return the login */ public String getLogin() { return login; } /** * @param login the login to set */ public void setLogin(String login) { this.login = login; } } Contrroller class (UserMB.java): package com.mycompany; import com.mycompany.service.CRUD; import javax.inject.Named; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; @Named @RequestScoped public class UserMB { @Inject private CRUD crud; private String login; public UserMB() { } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public void save(){ crud.businessMethod(); } } and CRUD.java class which do business logic: package com.mycompany.service; import javax.ejb.Stateless; import ja…

http://stackoverflow.com/a/26693402
has body: As Stefan Armbruster and Michael Hunger mentioned in the comments it is fixed in the master branch. I couldn't figure out exactly why the messages are send to the console, since it looks like a proper jcl logger is used, anyway the messages are gone in the 2.1.5-SNAPSHOT version.
accepted answer of: http://stackoverflow.com/q/26578442
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26578442

http://stackoverflow.com/q/26648722
answer count: 1
tagged with: coordinate-transformation
has comment: http://stackoverflow.com/comment/41902915
has comment: http://stackoverflow.com/comment/41920771
has answer: http://stackoverflow.com/a/26648916
has comment: http://stackoverflow.com/comment/41902713
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41902147
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41917962
has comment: http://stackoverflow.com/comment/41903744
type: Question
tagged with: graphics
accepted answer: http://stackoverflow.com/a/26648916
has comment: http://stackoverflow.com/comment/41917664
has body: Here is a code segment in java intended to rotate the vertices with coordinates A(10,10),B(20,10),C(20,20),D(10,20) of a square by an angle about the center point of the square. The side of the square is 10 points. The angle of rotation is 90 degree. Ideally after rotation A must become B, B must become C, C must become D and D becomes A. private Point getRotation(Point start, int side, int rotation){ int x = start.getX(); int y = start.getY(); int pivot_x = x + (side/2); int pivot_y = y + (side/2); float angle = (float)Math.toRadians(rotation); int xR = (int)(pivot_x + (x -pivot_x)*Math.cos(angle) - (y - pivot_y)*Math.sin(angle)); int yR = (int)(pivot_y + (x -pivot_x)*Math.sin(angle) + (y - pivot_y)*Math.cos(angle)); return new Point(xR,yR); } public static void main(String[] args) { Square s = new Square(); Point rotatedPoint1= s.getRotation(new Point(10,10), 10, 90); System.out.println("{"+rotatedPoint1.getX()+","+rotatedPoint1.getY()+"}"); Point rotatedPoint2= s.getRotation(new Point(20,10), 10, 90); System.out.println("{"+rotatedPoint2.getX()+","+rotatedPoint2.getY()+"}"); Point rotatedPoint3= s.getRotation(new Point(20,20), 10, 90); System.out.println("{"+rotatedPoint3.getX()+","+rotatedPoint3.getY()+"}"); Point rotatedPoint4= s.getRotation(new Point(10,20), 10, 90); System.out.println("{"+rotatedPoint4.getX()+","+rotatedPoint4.getY()+"}"); } The result that is achieved are not correct point A(10,10) rotated to (20,10) ---- correct point B(20,10) rotated to (30,10) ---- INCORRECT point C(20,20) rotated to (30,20) ---- INCORRECT point D(10,20) rotated to (20,20) ---- INCORRECT The formula applied is if (h,k) are the points about which the point (x,y) needs to be rotated by an angle THETA, then the Coordinates after rotation (xR, yR) are xR = h + (x-h)cos(THETA) - (y-k)sin(THETA) yR = k + (x-h)sin(THETA) + (y-k)cos(THETA) Where is the problem?
score: 0
has title: Rotating a point around another point Java

http://stackoverflow.com/a/26545836
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26545604
answers question: http://stackoverflow.com/q/26545604
type: AcceptedAnswer
downvote count: 0
has body: After you have gotten the user input, you can see if the input equals "#" like so: input.equals("#"); You can get the user input using Scanner: Scanner scanner = new Scanner(System.in); String input = scanner.nextLine(); You can break from a loop by using break. The while loop would look like this: while (true) { String input = scanner.nextLine(); if (input.equals("#")) { break; } int number = Integer.parseInt(input); // do stuff }
type: Answer
score: 2

http://stackoverflow.com/a/26609932
has body: You can use JPQL constructor expressions, and have something like this "select new my.package.HotelDTO(h) from Hotel h where ..." And you will need a field String propertyDescription and a constructor in HotelDTO public HotelDTO(Hotel hotel) { ... this.propertyDescription = hotel.getPropertyDescription().getPropertyDescription(); ... }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26609724

http://stackoverflow.com/comment/41856024
type: Comment
has text: Yes initHandlerMapping(context) method discovers the all handler mapping and registered them. My question was if I create a custom HandlerMapping (say MyCustomMapping) and specifying the lowest order so that it is tried first then all default mapping BeanNameUrlHandlerMapping or other default mapping registered or not? @dismitrisli
comment on: http://stackoverflow.com/a/26618657
score: 0
type: AnswerComment

http://stackoverflow.com/a/26628232
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26628098
has comment: http://stackoverflow.com/comment/41866070
answers question: http://stackoverflow.com/q/26628098
type: Answer
has comment: http://stackoverflow.com/comment/41865815
has comment: http://stackoverflow.com/comment/41865988
has comment: http://stackoverflow.com/comment/41865705
has body: you can put the waiting action into an loop, which breaks if the value is set. for reasons of visibility you should use an volatile modifier. I'll post an example in a minute. volatile String valueIAmWaitingFor; // Class Variable ... while(valueIAmWaitingFor == null){ Thread.sleep(3000); } //go on The other method can now set valueIAmWaitingFor. volatile: Declaring a volatile Java variable means: The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"; Access to the variable acts as though it is enclosed in a synchronized block, synchronized on itself. This is just one way to do this. There are many more secure solutions (but also more complex than this hotfix) EDIT: of course it has to be valueIAmWaitingFor == null, and not valueIAmWaitingFor != null
has comment: http://stackoverflow.com/comment/41865950
has comment: http://stackoverflow.com/comment/41865858
score: 0

http://stackoverflow.com/comment/41890929
has text: We also want to make it simple for people to build. doing ./gradlew should just work even with apache's limitation on binary.
comment on: http://stackoverflow.com/q/26642077
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/26520171
favorite count: 0
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/26520475
has body: I'm trying to create a simple vertical list of buttons and labels using Libgdx VerticalGroup and adding the buttons to the vertical group. Unfortunately they appear to be stacking in the bottom left corner of the stage and not vertically. Does anyone have an idea of why this might be? I defined my TextButton styles manually so I was thinking maybe the vertical group doesn't know how tall they are for some reason and it just stacks them on top of each other? I really don't want to make a skin because there seems to be no comprehensive way to make one. I've tried in the past and it has never worked easily. All I want to do is make one simple vertical layout with some buttons. Here is the gist of my code (I've tried many different options but this is basically it): vg = new VerticalGroup(); vg.setFillParent(true); resumeButton = new TextButton("Resume", buttonStyle64x16); vg.addActor(resumeButton); // ...add more buttons... stage.addActor(vg); Button Style def: buttonStyle64x16 = new TextButton.TextButtonStyle(); buttonStyle64x16.up = new TextureRegionDrawable(Assets.button64x16); buttonStyle64x16.down = new TextureRegionDrawable(Assets.button64x16_down); buttonStyle64x16.font = Assets.fontMedium;
has title: Trying to create a simple vertical group with Libgdx
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/48784589
has body: First of all, this is probably not an upgrade issue, but a device-specific issue. Maybe (yours truly does not have enough statistical data across the thousands of device models), this kind of behavior of glGetString() is less likely to happen on older models, but such knowledge is not worth to seek, it doesn't help to resolve the problem anyway. The khronos wiki explains that a live rendering GL context is required for all OpenGL functions to work, but it is not a violation for some of these functions to return non-NULL when called without such context. You can find examples of initialization code here and here. Even then, we have encountered some devices that returned NULL for glGetString(GLES20.GL_RENDERER); these have different manufacturers, platform levels, etc. Our Crashlytcis data does not suggest that this behavior is consistent for the same device. Therefore, we had to employ a fallback so that the app does not crash when this function returns null.
downvote count: 0
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26614632
accepted answer of: http://stackoverflow.com/q/26614632
upvote count: 5
type: Answer

class
tags question: http://stackoverflow.com/q/26630934
tags question: http://stackoverflow.com/q/26628643
tags question: http://stackoverflow.com/q/26567233
tags question: http://stackoverflow.com/q/26616897
tags question: http://stackoverflow.com/q/26672046
tags question: http://stackoverflow.com/q/26533615
tags question: http://stackoverflow.com/q/26548987
tags question: http://stackoverflow.com/q/26578722
tags question: http://stackoverflow.com/q/26525232
tags question: http://stackoverflow.com/q/26517713
tags question: http://stackoverflow.com/q/26608973
tags question: http://stackoverflow.com/q/26645094
tags question: http://stackoverflow.com/q/26634166
tags question: http://stackoverflow.com/q/26522615
tags question: http://stackoverflow.com/q/26628981
tags question: http://stackoverflow.com/q/26524862
tags question: http://stackoverflow.com/q/26618582
tags question: http://stackoverflow.com/q/26559676
tags question: http://stackoverflow.com/q/26640509
tags question: http://stackoverflow.com/q/26654616
tags question: http://stackoverflow.com/q/26633111
tags question: http://stackoverflow.com/q/26521810
tags question: http://stackoverflow.com/q/26653278
tags question: http://stackoverflow.com/q/26583319
tags question: http://stackoverflow.com/q/26662887
tags question: http://stackoverflow.com/q/26546178
tags question: http://stackoverflow.com/q/26593002
tags question: http://stackoverflow.com/q/26576726
tags question: http://stackoverflow.com/q/26540467
tags question: http://stackoverflow.com/q/26596042
type: Tag
tags question: http://stackoverflow.com/q/26624795
tags question: http://stackoverflow.com/q/26518411
tags question: http://stackoverflow.com/q/26540089
tags question: http://stackoverflow.com/q/26569295
tags question: http://stackoverflow.com/q/26655607
tags question: http://stackoverflow.com/q/26564923
tag name: class
tags question: http://stackoverflow.com/q/26608574
tags question: http://stackoverflow.com/q/26557421
tags question: http://stackoverflow.com/q/26566950
tags question: http://stackoverflow.com/q/26527393
tags question: http://stackoverflow.com/q/26624418
tags question: http://stackoverflow.com/q/26625607
tags question: http://stackoverflow.com/q/26638092
tags question: http://stackoverflow.com/q/26621824
tags question: http://stackoverflow.com/q/26652175
tags question: http://stackoverflow.com/q/26607818
tags question: http://stackoverflow.com/q/26609356
tags question: http://stackoverflow.com/q/26562159
tags question: http://stackoverflow.com/q/26544274
tags question: http://stackoverflow.com/q/26577662
tags question: http://stackoverflow.com/q/26587592
tags question: http://stackoverflow.com/q/26530524
tags question: http://stackoverflow.com/q/26564144

http://stackoverflow.com/comment/41898657
score: 0
has text: Please add the whole stacktrace.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26646736

http://stackoverflow.com/comment/41838269
score: 2
comment on: http://stackoverflow.com/q/26613324
has text: `UnsupportedAudioFileException: file is not a supported file type` Could this be any more clear? AudioInputStream cannot read mp3 with regular JRE.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26659365
favorite count: 0
has comment: http://stackoverflow.com/comment/41921231
has answer: http://stackoverflow.com/a/26659923
has body: I've been learning Java for a good couple of months but I really don't seem to learn it well. I've been attempting to make REALLY simple programs by myself instead of watching tutorials but a "game" this simple already gives me so much headache. Anyway I'm trying to write a simple console based game. The program generates an integer from 0-100 and you have to guess it, it either says the number is greater or smaller. Simple right? I have two problems: 1) It will only run once, if the scanner value is not correct, it says the random number is greater/smaller and you can input another integer, BUT there's no response for the second input. 2) --> So I thought it's because it will generate new value for "goal" and there's some kind of conflict, so I decided to put "goal" generation in a separate subclass. But no. I just don't understand how to use the "goal" value in the if/else block. Here's the code: import java.util.Scanner; public class NumberGame { public static void main(String[] args){ int num, numIn; int goal = GetMath.goal; // TRIED THIS WITHOUT SEPARATE CLASS TOO: final class GetMath{ int goal = (int) Math.ceil(Math.random()*101); } System.out.println("Enter an integer from 0 to 100"); //numIn = -1; ---- SOMETHING I TRIED Scanner in = new Scanner(System.in); numIn = in.nextInt(); if(numIn&gt;goal){ System.out.println("It's smaller than " + numIn); in.nextInt(); return; }else if(numIn&lt;goal){ System.out.println("It's greater than " + numIn); in.nextInt(); return; } else if(numIn==goal){ System.out.println("Congratulations, you win the game!"); } else { System.out.println("Please, enter an integer from 0 to 100"); in.nextInt(); return; } Now the line int goal = GetMath.goal; gives an error Cannot make a static reference to the non-static field GetMath.goal If I change "int goal" to "static int goal", "int static goal" will give an error and asking to delete word "static" in the said line. I hope someone understands, I not very good at coding jargon :D
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26659621
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41921080
upvote count: 1
type: Question
tagged with: if-statement
has title: Java - Refering to other subclass
has answer: http://stackoverflow.com/a/26659655
accepted answer: http://stackoverflow.com/a/26659655
answer count: 3
has answer: http://stackoverflow.com/a/26659621
downvote count: 0
has comment: http://stackoverflow.com/comment/41921389

http://stackoverflow.com/a/26528354
type: Answer
has comment: http://stackoverflow.com/comment/41689662
downvote count: 0
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26528258
answers question: http://stackoverflow.com/q/26528258
has body: You have a red exclamaition mark on your project. Eclipse is likly to not build your project if build path problems (e.g.) aren't resolved. So go to the Problems tab and try to resolve your errors there. If that is finished Eclipse will build your project and gives more helpful errors Edit and that is why you are running the old version (no new build replaced your old one), in which there is actually a line 35.
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/41683242

http://stackoverflow.com/q/26514290
tagged with: number-formatting
favorite count: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41658719
has comment: http://stackoverflow.com/comment/41658902
has comment: http://stackoverflow.com/comment/41658755
type: AnsweredQuestion
has body: I've just found a very strange NullPointerException. First, I create a NumberFormat like this (note that the default Locale would be Germany, I don't know if that helps): NumberFormat angleFormat = NumberFormat.getNumberInstance(Locale.UK); angleFormat.setMaximumFractionDigits(5); angleFormat.setMinimumFractionDigits(0); Then, I tried to format a double with it. This is done with a new Thread created by a Lambda, while angleFormat is declared at the method containing the Lambda. The code where the Exception is thrown looks like this: con.println("D" + moveId + (state.isEnemyInSightOf(e) ? "+" : "-") + angleFormat.format(e.getAngle()) // line 123 - error is here + (state.isMissileInSightOf(e) ? "+" : "-") + angleFormat.format(e.getSight()) + (e.getLastShot() &gt;= 10 || e.getLastShot() &lt;= -1 ? "+" : "-") + angleFormat.format(e.getLives())); e.getAngle() returns a double, so it can't return null. However, I get this Exception: Exception in thread "Thread-1" java.lang.NullPointerException at java.text.DecimalFormat.fastDoubleFormat(Unknown Source) at java.text.DecimalFormat.fastFormat(Unknown Source) at java.text.NumberFormat.format(Unknown Source) at server.game.Simulator.lambda$0(Simulator.java:123) at server.game.Simulator$$Lambda$3/23162747.run(Unknown Source) at java.lang.Thread.run(Unknown Source) I'm sure that e isn't null because of the Exception's stacktrace, it would a) be thrown one line earlier and b) not at java.text.DecimalFormat.fastDoubleFormat Why is there a NullPointerException beeing thrown sometimes, and sometimes it works without problems? And what does that mean? The error seems to be reproducable, but not very often.
has answer: http://stackoverflow.com/a/26514640
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/41658388
has comment: http://stackoverflow.com/comment/41658465
type: Question
has comment: http://stackoverflow.com/comment/41658416
has comment: http://stackoverflow.com/comment/41658482
has title: Why does NumberFormat.format throw an NullPointerException?
has answer: http://stackoverflow.com/a/26514656
score: 7
has comment: http://stackoverflow.com/comment/41658391
accepted answer: http://stackoverflow.com/a/26514640
answer count: 2
has comment: http://stackoverflow.com/comment/41658534
possible better answer: http://stackoverflow.com/a/26514656
has comment: http://stackoverflow.com/comment/41658653
downvote count: 0

http://stackoverflow.com/q/26589831
tagged with: java
has comment: http://stackoverflow.com/comment/41794544
type: Question
has title: String cannot be converted to int error when trying to return
possible better answer: http://stackoverflow.com/a/26589928
tagged with: int
has answer: http://stackoverflow.com/a/26590065
answer count: 3
tagged with: string
has comment: http://stackoverflow.com/comment/41794581
favorite count: 0
has body: So im trying to write a java program for school. It has to convert US time, for example 3PM into european time, 15 in this case. So this is the part where i tranform 24 into 12AM and return it to previous method for printing if (timeDigit == 0 ){ timeDigit = 12; String suffix = "AM"; return timeDigit; return suffix; But when i try to compile then i get error: String cannot be converted to int Any idea how to solve this?
tagged with: return
score: -4
has answer: http://stackoverflow.com/a/26589928
downvote count: 4
has comment: http://stackoverflow.com/comment/41794547
has answer: http://stackoverflow.com/a/26589901
accepted answer: http://stackoverflow.com/a/26589901
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/26616562
has title: Number picker gets stuck when set at 0
has answer: http://stackoverflow.com/a/26616798
accepted answer: http://stackoverflow.com/a/26616798
type: Question
score: 0
answer count: 1
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: Here's the code I have so far: final ImageView plus_button = (ImageView) view.findViewById(R.id.plus_sign); final ImageView minus_button = (ImageView) view.findViewById(R.id.minus_sign); final int[] counter = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; final TextView num = (TextView) view.findViewById(R.id.num); plus_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (plus_button.isPressed()) { if ((counter[0] &lt;= 9) &amp;&amp; (counter[0] &gt;= 0)) { counter[0]++; num.setText(Integer.toString(counter[0])); } } } }); minus_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (minus_button.isPressed()) { counter[0]--; if ((counter[0] &lt;= 9) &amp;&amp; (counter[0] &gt;= 0)) { num.setText(Integer.toString(counter[0])); } } } }); This displays something like a number picker(?) or number incrementer/decrementer. Like - number + where number is a range from 0 to 10. If you click on "-", the number decrements, and if you click on plus "+" number increments. The above code mostly works but I noticed a few strange things: 1)The picker is blank at first like this: - + with no number set inside. When I click on "plus" I want it to show 0 but instead it shows 1. So I think it's supposed to show 0 at first but instead it shows blank. Not sure why? 2)I can increment all the way to 10 by click on the "plus" sign starting from 1 but when I go down to zero, I can't go back up the number list. I'm not sure why this occurs? edit: This occurs if I click on the minus button twice after I hit 0. 3) How can I get the specific number that the picker is set at from the way I have it coded above? For ex. if the user sets it to 5, how can I know that the user set the picker to 5? Is there a way to find out? EDIT: Here's the newly edited code: final ImageView plus_button = (ImageView) view.findViewById(R.id.plus_sign); final ImageView minus_button = (ImageView) view.findViewById(R.id.minus_sign); final int[] counter = {0…

eclipse-plugin
tags question: http://stackoverflow.com/q/26652141
tags question: http://stackoverflow.com/q/26648158
tags question: http://stackoverflow.com/q/26653891
type: Tag
tags question: http://stackoverflow.com/q/26532151
tags question: http://stackoverflow.com/q/26540874
tags question: http://stackoverflow.com/q/26525321
tags question: http://stackoverflow.com/q/26552314
tags question: http://stackoverflow.com/q/26529054
tags question: http://stackoverflow.com/q/26613890
tags question: http://stackoverflow.com/q/26546640
tags question: http://stackoverflow.com/q/26521595
tags question: http://stackoverflow.com/q/26526847
tags question: http://stackoverflow.com/q/26596451
tags question: http://stackoverflow.com/q/26559805
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/26599658

http://stackoverflow.com/q/26517632
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26517766
has answer: http://stackoverflow.com/a/26517802
answer count: 5
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/26518142
type: Question
has answer: http://stackoverflow.com/a/26518142
has body: I am new to generics and casting issues. I try to sort any type array that is comparable. The error is as the title; and the code is as below: and error is same for integer. What is the problem and why? class Sort{ public static void selectionSort(Comparable&lt;Object&gt;[] input) {/* selection Sort Alg*/} public static void main((String[] args){ int[] intArray = {2,3,5,1}; Sort.selectionSort(intArray); } }
has answer: http://stackoverflow.com/a/26517770
tagged with: comparable
has title: Incompatible types: int[] cannot be converted to Comparable<Object>[]
has answer: http://stackoverflow.com/a/63535032
accepted answer: http://stackoverflow.com/a/26517770
downvote count: 0

http://stackoverflow.com/q/26624031
has title: How to manually specify the derby.system.home property to start a derby server
tagged with: derby
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26642466
type: UnansweredQuestion
score: 1
has body: I want to know a command to both Windows and Unix to start a Derby server at localhost:1527 but with an specific derby.system.home property From here I could only understand to set the locations, the paths Java and Derby installation. And the only thing about derby.system.home I found was this. Basically, I need a command to start the server the same way Netbeans does.
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/26549136
type: Answer
answers question: http://stackoverflow.com/q/26548897
has comment: http://stackoverflow.com/comment/41791608
score: 0
has comment: http://stackoverflow.com/comment/41735540
has body: From the error it seems like the : is causing an issue even though its escaped with \. What version of hibernate are you on? Take a look at https://stackoverflow.com/a/11709475/883679 to see if this is your problem

http://stackoverflow.com/q/26569361
score: 0
tagged with: android-wifi
has body: One connection is connected to a device that I need to download information from and another is connected to the internet. So I want to first connect to the wifi the device is on to download then I want to switch to a wifi with internet to upload. Is there a way to switch between 2 different wifi connections in code in the app?
tagged with: android
has comment: http://stackoverflow.com/comment/41757765
has comment: http://stackoverflow.com/comment/41757791
has comment: http://stackoverflow.com/comment/41775917
has title: Switch between 2 wifi connections in android
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/a/26528064
has body: If you call paintImmediately on the JProgressBar, then you can update it while your code is running on the event dispatch thread. The other solution is to start another thread. If the user is supposed to interact with the GUI while your counting code is running, then starting a worker thread (with or without SwingWorker) is the only solution. If the user must wait anyway, and blocking the GUI is not a problem, then the (much simpler) paintImmediately is fine.
type: Answer
answers question: http://stackoverflow.com/q/26527717
score: 0

http://stackoverflow.com/comment/41734134
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26551714
has text: @camickr: I have tried that, but it does not always work. I am trying to determine what all the cases are that cause this, but an example is a 1-point "polygon", which does not draw in either `drawPolygon()` or `fillPolygon()`.

http://stackoverflow.com/comment/41697560
has text: Thanks for that njzk, do you know if there is a way to do with the fragment though? I know this is somewhat off topic, but in an instance where I create a user, and then utilize the interface to access that user data. What if I wanted to use that User Data in the Fragment, and not the Activity where the interface is now implemented. Would I always have to transfer the data through .addAttributes or intents etc..
score: 0
comment on: http://stackoverflow.com/q/26534717
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26556173
type: Answer
accepted answer of: http://stackoverflow.com/q/26556068
has body: You are comparing strings using == operator, which is wrong. Please us: string1.equals(string2); Relevant example: password.equals("admin");
answers question: http://stackoverflow.com/q/26556068
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26559365
answers question: http://stackoverflow.com/q/26559338
score: 0
type: Answer
has body: Absolutely fine code. Your p is a reference to the family of classes that belong to the family of base class. o. if (r instanceof subclassRobot) { //... } is just fine to check if you are actually pointing to the instance of subclassRobot

http://stackoverflow.com/comment/41897859
score: 0
has text: i am new to swing. Can You provide any related example or link.@MadProgrammer
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26646163

http://stackoverflow.com/q/26670425
has title: Table Field Factory for a Transient variable
score: 0
has comment: http://stackoverflow.com/comment/41942915
has comment: http://stackoverflow.com/comment/41944437
answer count: 1
accepted answer: http://stackoverflow.com/a/26676152
has comment: http://stackoverflow.com/comment/41942269
type: AnsweredQuestion
has body: I'd like to create a custom column for my vaadin table. All items should have a column with a checkbox. In order to have this column, I created a transient variable, which name is "selected". When the table makes its columns, the table.setTableFieldFactory() runs, but "selected" is not presented in the propertyIds' list. table.setTableFieldFactory((container, itemId, propertyId, uiContext) -&gt; { if("selected".equals(propertyId)) { CheckBox checkBox = new CheckBox(); checkBox.addValueChangeListener(event -&gt; selectListener((Boolean)event.getProperty().getValue())); return checkBox; } return null; }); The questions are, how to create a custom field for transient variable? How should I add my transient variable to propertyIds' list? What Am I doing wrong?
tagged with: java
tagged with: vaadin
has answer: http://stackoverflow.com/a/26676152
type: Question

http://stackoverflow.com/a/26553318
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: You need to drop the requirement to use a BorderLayout. The resizing policy for components when using a BorderLayout is stated in the class javadoc The components are laid out according to their preferred sizes and the constraints of the container's size. The NORTH and SOUTH components may be stretched horizontally; the EAST and WEST components may be stretched vertically; the CENTER component may stretch both horizontally and vertically to fill any space left over. By forcing your JFrame to a certain size frame.setResizable(false); frame.setPreferredSize(new Dimension(500,350)); frame.setMaximumSize(new Dimension(500,350)); your center component will take the extra width, as the EAST and WEST component will only stretch vertically. So you need to use another LayoutManager. You can use the Visual guide to layout managers to get a grasp of the available LayoutManagers and their capabilities. That document states that a GridLayout would be a good candidate: GridLayout simply makes a bunch of components equal in size and displays them in the requested number of rows and columns
answers question: http://stackoverflow.com/q/26553164
has comment: http://stackoverflow.com/comment/41728843
type: Answer
accepted answer of: http://stackoverflow.com/q/26553164

http://stackoverflow.com/comment/41706068
comment on: http://stackoverflow.com/q/26540237
score: 1
has text: Right now, I'd say your best move is to separate out the logic from the rendering. Sort out the data structure, algorithms and behaviour of your *model*, and once that's tested and working, only then deal with how to *render* the model. See [MVC](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller). Right now you've hardwired everything together, making it hard to design, debug and understand.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41789348
type: QuestionComment
has text: Yes, it's multi-core.
comment on: http://stackoverflow.com/q/26581057
score: 0
type: Comment

http://stackoverflow.com/q/26542373
has title: JAXB generate schema working in JUNO but not Kepler
tagged with: java
tagged with: jaxb
tagged with: eclipse
downvote count: 1
has body: I'm trying to generate schema from JAXB classes using the new project option. It is working fine in JUNO but when I try the same in Kepler it gives me the error I'm not able to figure out why is Kepler throwing this error: !loading...! ! Not found: cs.clinic.service.dto.PatientDTO! ! generating schema...! Please let me know what to try.
type: Question
upvote count: 0
score: -1
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/26553622
type: UnansweredQuestion

http://stackoverflow.com/comment/41714360
comment on: http://stackoverflow.com/q/26545604
type: Comment
type: QuestionComment
has text: @JackTools.Net why compare a boolean to true?
score: 1

http://stackoverflow.com/comment/41966059
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26664042
has text: i have one more question. another part of the assignment. i need to create a loop that creates all possible 5 character passwords. heres what i have but i dont think its producing all passwords. char c1='0'; char c2='0'; char c3='0'; char c4='0'; char c5='0'; while(responce == null){ for(c1='0';c1<='Z';c1++){ for(c2='0';c2<='Z';c2++){ for(c3='0';c3<='Z';c3++){ for(c4='0';c4<='Z';c4++){ for(c5='0';c5<='Z';c5++){ }}}}} password = ""+c1+c2+c3+c4+c5;

http://stackoverflow.com/comment/41724748
score: 0
type: Comment
type: QuestionComment
has text: Yes, but I cant use that class. In this work is supposed to do all that stuff "by hand" :D Thank you anyway!
comment on: http://stackoverflow.com/q/26549832

http://stackoverflow.com/comment/41793864
score: 0
comment on: http://stackoverflow.com/q/26588307
type: Comment
type: QuestionComment
has text: I think it would be a good idea to post some example code from your `userbean` class.

http://stackoverflow.com/comment/41758492
type: QuestionComment
has text: What is on line # **35** in **PlayState.java** file?
score: 0
comment on: http://stackoverflow.com/q/26569834
type: Comment

http://stackoverflow.com/q/26631605
downvote count: 2
has answer: http://stackoverflow.com/a/26631685
upvote count: 1
has body: so this is the case. I'm doing an excercise where I have to compare each random number with all my static numbers from an external file lotto.dat I have to make a method doCompare() which returns either true or false. My question will appear after my code: public static void drawNumbers()throws Exception{ Random rnd = new Random(); int rndN1 = rnd.nextInt(19)+1; int rndN2 = rnd.nextInt(19)+1; int rndN3 = rnd.nextInt(19)+1; int rndN4 = rnd.nextInt(19)+1; int rndN5 = rnd.nextInt(19)+1; int rndN6 = rnd.nextInt(19)+1; System.out.println(); System.out.println("Winner numbers: " + rndN1 + " " + rndN2 + " " + rndN3 + " " + rndN4 + " " + rndN5 + " " + rndN6); String match = doCompare(rndN1); if(match.equals("true")){ System.out.println("Match on the number: " + rndN1); } } So is it possible somehow loop the "doCompare" with parameters "doCompare(rndN1)" then rndN2, rndN3 and so on or what else should I do to make this work?
tagged with: java
tagged with: loops
tagged with: methods
has title: Is it possible to loop a method with different parameters?
has comment: http://stackoverflow.com/comment/41871407
accepted answer: http://stackoverflow.com/a/26631776
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26631678
possible better answer: http://stackoverflow.com/a/26631672
has answer: http://stackoverflow.com/a/26631672
favorite count: 0
has answer: http://stackoverflow.com/a/26631690
type: Question
tagged with: compare
has answer: http://stackoverflow.com/a/26631674
score: -1
answer count: 6
has comment: http://stackoverflow.com/comment/41871382
has answer: http://stackoverflow.com/a/26631776

http://stackoverflow.com/comment/41938466
type: QuestionComment
has text: "I have tried with subList, but even this operation internally does the iteration which is causing performance issue." - What performance issues are you experiencing? Have you done some test and can you provide the results? Also, have you done some test against alternate list? How did you do the test in general?
comment on: http://stackoverflow.com/q/26668712
score: 0
type: Comment

http://stackoverflow.com/q/26669050
tagged with: java
has answer: http://stackoverflow.com/a/26669154
type: Question
has comment: http://stackoverflow.com/comment/41938968
has comment: http://stackoverflow.com/comment/41939024
score: 0
has body: When I run my jsp page: Exception in Display Bean in getDbTable(String code): com.microsoft.sqlserver.jdbc.SQLServerException: Error converting data type varchar to datetime is displayed. I have a stored procedure which has parameters of datetime type. To make it dynamic I stored the system date and time in a variable and passed it as the argument of stored procedure sql command: clstmt = con.prepareCall("exec vcs_gauge 'vs1_bag','d','currentDate'") ;
tagged with: sql
has comment: http://stackoverflow.com/comment/41939112
answer count: 1
has title: how to match the system date time format with the sql parameters datetime type in java
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/41938999
has comment: http://stackoverflow.com/comment/41938962

http://stackoverflow.com/q/26612823
has title: Android onPause() called after onStop()
tagged with: lockscreen
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41843233
score: 0
tagged with: onpause
answer count: 1
has comment: http://stackoverflow.com/comment/41846291
has answer: http://stackoverflow.com/a/26614478
accepted answer: http://stackoverflow.com/a/26614478
has comment: http://stackoverflow.com/comment/41837315
has comment: http://stackoverflow.com/comment/41846382
has comment: http://stackoverflow.com/comment/41839504
tagged with: android
has body: I'm trying to display an Activity over lockscreen. The Activity is displayed for a few moments and then crashes. This happens only on a particular device (Sony Xperia Z2), the app is running completely fine on a variety of other devices. According to log, onPause() is called after onStop(): 10-28 16:14:03.079: D/AlarmAlert(29630): onCreate CALLED 10-28 16:14:03.099: D/AlarmAlert(29630): onCreate DONE 10-28 16:14:03.099: D/AlarmAlert(29630): onResume 10-28 16:14:03.109: D/AlarmAlert(29630): onPause 10-28 16:14:03.119: D/QSEECOMAPI:(322): Loaded image: APP id = 4 10-28 16:14:03.139: W/SurfaceFlinger(320): couldn't log to binary event log: overflow. 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=106, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=marlin,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=109, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=playready,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=110, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=dtla,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=111, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=marlin_import,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=112, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=ckb,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=113, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=widevine,1, status=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: KEY_TYPE=114, KEY_STATUS=1 10-28 16:14:03.149: E/suntrolkac(396): props_GetStatusForAllKeys :: data=dcp,1, status=1 10-28 16:14:03.149: I/ActivityMa…
type: AnsweredQuestion

http://stackoverflow.com/q/26607077
favorite count: 0
has answer: http://stackoverflow.com/a/26608831
possible better answer: http://stackoverflow.com/a/26608831
tagged with: text
has comment: http://stackoverflow.com/comment/41827442
score: 1
tagged with: java
has body: where: Roteer = Rotate, Links = Left, Rechts = Right.... it seems that if you input "Oliebol",3 into roteerNaarLinks, the output will be 'bololie', which is supposed to happen. But if you input "Oliebol",1 into roteerNaarRechts, the output will be 'lOliebo' but it should become 'llieboo', how can I fix this? :) public class Roteer { public static String roteerNaarLinks(String invoer, int n){ String in = invoer; int aantal = n; for(int i = 0; i&lt; aantal; i++){ char firstLetter = in.charAt(0); in = in.substring(1); in = in + firstLetter; } return in; } public static String roteerNaarRechts(String invoer, int n){ String in = invoer; int aantal = n; for(int y = n; y &gt; aantal; y--){ char lastLetter = in.charAt(in.length()-1); in = in.substring(1); in = lastLetter + in; } return in; } }
upvote count: 1
has answer: http://stackoverflow.com/a/26607653
type: Question
type: AnsweredQuestion
tagged with: rotation
has title: Java-Chars can rotate left but can't rotate to the right?
has comment: http://stackoverflow.com/comment/41827159
answer count: 2
has comment: http://stackoverflow.com/comment/41827266
downvote count: 0
accepted answer: http://stackoverflow.com/a/26607653

points
tag name: points
tags question: http://stackoverflow.com/q/26549302
type: Tag

http://stackoverflow.com/q/26518144
has comment: http://stackoverflow.com/comment/41666153
tagged with: android
has comment: http://stackoverflow.com/comment/41666291
has comment: http://stackoverflow.com/comment/41666387
has comment: http://stackoverflow.com/comment/41923723
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/19465049
has body: I am a totally newbie who just got into Android development. I am going through the "Building your first app" tutorial on the official Android developer webpage. I followed all the instruction but it shows me this error code in Eclipse. The error message is real long and I guess there must be something wrong in my setting, SDK, or environment. Can anybody help me out in resolving this problem? For your information, my target SDK is API19 and I am also compiling it with API19 [2014-10-22 17:13:51 - appcompat_v7] WARNING: unable to write jarlist cache file C:\Users\Cliff\workspace\appcompat_v7\bin\jarlist.cache [2014-10-22 17:13:51 - appcompat_v7] WARNING: unable to write jarlist cache file C:\Users\Cliff\workspace\appcompat_v7\bin\jarlist.cache [2014-10-22 17:13:51 - appcompat_v7] WARNING: unable to write jarlist cache file C:\Users\Cliff\workspace\appcompat_v7\bin\jarlist.cache [2014-10-22 17:13:53 - MyFirstApp] C:\Users\Cliff\workspace\appcompat_v7\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. [2014-10-22 17:13:53 - MyFirstApp] C:\Users\Cliff\workspace\appcompat_v7\res\values-v21\styles_base.xml:79: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. [2014-10-22 17:13:53 - MyFirstApp] C:\Users\Cliff\workspace\appcompat_v7\res\values-v21\styles_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. [2014-10-22 17:13:53 - MyFirstApp] C:\Users\Cliff\workspace\appcompat_v7\res\values-v21\styles_base.xml:25: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. [2014-10-22 17:13:53 - MyFirstApp] C:\Users\Cliff\workspace\appcompat_v7\res\values-v21\styles_base.xml:29: error: Error retrieving parent for it…
has answer: http://stackoverflow.com/a/26669521
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32109180
has answer: http://stackoverflow.com/a/26710353
has answer: http://stackoverflow.com/a/32308070
has comment: http://stackoverflow.com/comment/41666078
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/27185774
has comment: http://stackoverflow.com/comment/41666266
tagged with: eclipse
type: Question
answer count: 8
downvote count: 2
has answer: http://stackoverflow.com/a/26669847
has answer: http://stackoverflow.com/a/26518637
has comment: http://stackoverflow.com/comment/41666023
has answer: http://stackoverflow.com/a/26660796
upvote count: 23
has title: Hello World Android App, Error: workspace\appcompat_v7\res\values-v21\styles_base.xml No resource found that matches the given name

http://stackoverflow.com/comment/41720449
has text: Glad you found it - please accept your answer. Also (in your question) try to avoid horizontal scrollbars - code should be 80 chars wide
type: Comment
comment on: http://stackoverflow.com/a/26532447
score: 0
type: AnswerComment

http://stackoverflow.com/a/26698385
answers question: http://stackoverflow.com/q/26566373
has body: I have no clue what could be your problem, but I've tried the process and everything works, so just a summary of what I've did. Maybe you will figure it out by following it... I don't understand how the posted code could be the entire, I see no class definition. :) So I've modified it to the main method and it works both from the Eclipse and also by running the JAR generated by the FatJar. The modified code of the BTTest class: package test; import java.io.IOException; import javax.bluetooth.BluetoothStateException; import javax.bluetooth.DiscoveryAgent; import javax.bluetooth.LocalDevice; import javax.bluetooth.UUID; import javax.microedition.io.Connector; import javax.microedition.io.StreamConnection; import javax.microedition.io.StreamConnectionNotifier; public class BTTest { public static void main(String[] args) throws Exception{ // retrieve the local Bluetooth device object LocalDevice local = null; StreamConnectionNotifier notifier; StreamConnection connection = null; // setup the server to listen for connection try { local = LocalDevice.getLocalDevice(); local.setDiscoverable(DiscoveryAgent.GIAC); UUID uuid = new UUID("0000110100001000800000805F9B34FB", false); System.out.println(uuid.toString()); String url = "btspp://localhost:" + uuid.toString() + ";name=RemoteBluetooth"; notifier = (StreamConnectionNotifier) Connector.open(url); } catch (BluetoothStateException e) { System.out.println("Bluetooth is not turned on."); e.printStackTrace(); return; } // ... } } To run or produce it, I have just put the bluecove library in the build path and created the fat jar with a simple way: http://oi60.tinypic.com/vg1jpt.jpg Starting the generated jar from command line: D:\testProjects\bttest&gt;java -jar bttest_fat.jar BlueCove version 2.1.0 on winsock 0000110100001000800000805f9b34fb BlueCove stack shutdown completed Can you post a difference to your process?
score: 0
type: Answer

http://stackoverflow.com/comment/41872895
score: 0
type: QuestionComment
type: Comment
has text: @AleksandrM there is no namespace name. Its default, which is "".
comment on: http://stackoverflow.com/q/26616867

http://stackoverflow.com/comment/41736862
has text: Loops, enums, classes. A card (class) consists of a value and a suit. These are pre-defined never changing values (enums). You need 4 of those, one for each suit (loop). This is just one of many solutions.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26557862

http://stackoverflow.com/q/26569363
has title: Jar file does not work after renaming classes?
has comment: http://stackoverflow.com/comment/41757712
tagged with: java
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41757807
has comment: http://stackoverflow.com/comment/41757769
has body: Typing this from my phone as I got off my computer and am about to go to sleep so please ignore typos. Anyway I have a project I was working on that makes a jar file that allows me to config some things and then build a new jar file with what I set. I decided I did not like the class names for the builder and the output file, so I changed them (just changed com.john to com.epix type of thing) and updated all required things. The builder can be built and ran perfectly fine, and the output file can be built from eclipse and ran perfectly fine, however now when I try to build the file using the builder it tells me "main class not found" when I try to run the file. The thing that is really bugging me is if I pack the jar file my self (putting the nessesary files into a zip then renaming it to a jar) it works, which is where I get confused as its packing the same exact files. I assume there to be something wrong in the builder itself but the only thing that changed code-wise were just some imports. Has anyone else encountered this type of problem or know a fix? And yes I set the main class in the manifest and class path. Can't paste any code right now, as previously stated am on phone. Any ideas would be greatly appreciated, I have been scratching my head for the past 4 hours.
has comment: http://stackoverflow.com/comment/41757757
has comment: http://stackoverflow.com/comment/41757799
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26590728
has body: Caused by: java.lang.NullPointerException 02-27 17:30:35.061: E/AndroidRuntime(2997): at android.app.Activity.findViewById(Activity.java:1853) 02-27 17:30:35.061: E/AndroidRuntime(2997): at com.example.mjcet.MainActivity.&lt;init&gt;(MainActivity.java:14) Here is the problem: at com.example.mjcet.MainActivity.&lt;init&gt;(MainActivity.java:14) MainActivity, line 14, null pointer exception Most likely the view is null that you are trying to find(not in the activity's xml or calling findViewById before onCreate is called?).
answers question: http://stackoverflow.com/q/26586958
type: Answer
score: 0

http://stackoverflow.com/a/26609458
score: 0
type: Answer
has body: I tried this way. I don't know how much this helpful in your scenario String oldStr = String.valueOf('"'); String newStr = File.separator.concat(String.valueOf('"')); System.out.println(oldStr.replace(String.valueOf('"'),newStr));
answers question: http://stackoverflow.com/q/26608174

http://stackoverflow.com/comment/41893394
comment on: http://stackoverflow.com/q/26643443
type: Comment
type: QuestionComment
has text: "Perhaps a game, Joshua?"
score: 1

http://stackoverflow.com/a/26570943
downvote count: 1
answers question: http://stackoverflow.com/q/26570846
score: -1
type: Answer
has body: Specify user.dir property (default working directory): run_command('java -Duser.dir=/your_path_here -jar jar\\minecraft.jar'):
upvote count: 0
has comment: http://stackoverflow.com/comment/41857047

http://stackoverflow.com/comment/43540059
score: 0
type: Comment
type: AnswerComment
has text: Note: since this message I've been starting to implement [this](https://github.com/fge/java7-fs-more); a recursive chmod is planned. Contributions welcome!
comment on: http://stackoverflow.com/a/26649877

http://stackoverflow.com/a/26736848
type: Answer
has body: I have worked with Solr/Lucene before and I wouldn't try to write an ORM for Lucene because it's just not great for storing and manipulating data. You just get a single 'table', no real data types, no foreign keys, no unique constraints. You do get excellent search capabilities, but usually just a fraction of my data needs to be searchable. So it's simpler to store all the data in a place that is better suited for such a purpose, for example an RDBMS. Then you can use an existing ORM to manipulate your data, and configure Solr to read its index from that database by specifying appropriate queries in a configuration file. Hibernate Search can do similar things if you don't care about the Solr wrapper for Lucene.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26566813

http://stackoverflow.com/comment/41898148
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26646400
has text: @suganya You can use `substring()` if it is a static string
score: 0

http://stackoverflow.com/comment/41757807
score: 0
has text: No, as I said no errors or warnings from eclipse :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26569363

http://stackoverflow.com/comment/41660850
has text: @neo I added System.out.println("v1: " + v1); and so forth for v1-v4 and then System.out.println("this.getNum: " + this.getNumer()); and so forth for this and a and numer and denom for each at the appropriate places and it showed that v1 != v3 and v2 != v4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26515394
score: 0

http://stackoverflow.com/comment/41879227
score: 0
type: Comment
type: QuestionComment
has text: I tried your example in my simple project, and works fine. :) can you add the version of all your libraries? (output is DtoTest [name=example]) i used only difference `XMLInputFactory xif = XMLInputFactory.newInstance();`
comment on: http://stackoverflow.com/q/26635784

http://stackoverflow.com/comment/41722478
has text: Im not sure exactly what i should set in the setPrices(map PriceMap) method
comment on: http://stackoverflow.com/q/26549927
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26639227
has comment: http://stackoverflow.com/comment/41888418
tagged with: java
type: Question
tagged with: ejb
has answer: http://stackoverflow.com/a/26801549
accepted answer: http://stackoverflow.com/a/26801549
score: 0
has title: StackOverFlowException when entity is sent by EJB bean
tagged with: jpa
has body: I am trying to get a list of entities from EJB bean as a result of query. Actually at most time, I am not getting any exception.But for some entities, I am getting StackOverFlow exceptions.I did not get why it occurs.If my jpa entity model were wrong, I think I would get this exception every time. error: java.lang.StackOverflowError at java.io.ObjectOutputStream$HandleTable.hash(ObjectOutputStream.java:2330) [:1.6.0_30] at java.io.ObjectOutputStream$HandleTable.lookup(ObjectOutputStream.java:2263) [:1.6.0_30] at java.io.ObjectOutputStream$ReplaceTable.lookup(ObjectOutputStream.java:2369) [:1.6.0_30] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1093) [:1.6.0_30] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) [:1.6.0_30] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) [:1.6.0_30] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_30] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_30] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) [:1.6.0_30] at java.util.ArrayList.writeObject(ArrayList.java:570) [:1.6.0_30] at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source) [:1.6.0_30] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_30] at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_30] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) [:1.6.0_30] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) [:1.6.0_30] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_30] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_30] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) [:1.6.0_30] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) [:1.6.0_30] at java.io.ObjectOutputStream…
answer count: 1
has comment: http://stackoverflow.com/comment/41888769
has comment: http://stackoverflow.com/comment/41888474
type: AnsweredQuestion

http://stackoverflow.com/comment/41778440
comment on: http://stackoverflow.com/q/26580600
has text: This element inside an iframe? Whats the source of the page look like higher up?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26578085
score: 0
has body: Okay so I'm given a txt file with a couple objects that possesses the description, cost, and percent depreciated that the constructor asks for. In my tostring() method I just ask to return some values that I inputted. I left out all the methods that were used to calculate things like current value because they don't matter for the question I'm asking. public class InventoryItem { private String description; private double cost, percentDepreciated; public static final double DEPRECIATION_MIN = 0.0, DEPRECIATION_MAX = 1.0; public InventoryItem(String descriptionIn, double costIn, double percentDepreciatedIn) { description = descriptionIn.trim(); cost = costIn; percentDepreciated = percentDepreciatedIn; } public String toString() { DecimalFormat df = new DecimalFormat("#,###.00"); String output; output = "Description: " + description; output += "\nCost: $" + df.format(cost); output += "\tPercent Depreciation: " + (percentDepreciated * 100 + "%"); output += "\nCurrent Value: $" + df.format(currentValue()); if (isEligibleToScrape()) { output += "\n*** Eligible to scape ***"; } if (percentDepreciatedOutOfRange()) { output += "\n*** Percent Depreciated appears to be out of range ***"; } return output; } } So what I'm asking is now that I am given a txt file that has the information above for multiple objects, how would I return the information of each InventoryItem object and have it formatted like the above toString() method. I need to do this in the toString() method below in my Inventory class public class Inventory { private String name; private ArrayList&lt;InventoryItem&gt; inventoryList = new ArrayList&lt;InventoryItem&gt;(); public Inventory(String nameIn, ArrayList&lt;InventoryItem&gt; inventoryListIn) { name = nameIn; inventoryList = inventoryListIn; } public String toString() { } }
has comment: http://stackoverflow.com/comment/41773687
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41775235
has answer: http://stackoverflow.com/a/26578153
has comment: http://stackoverflow.com/comment/41773581
type: Question
has title: Returning data from a .txt file into an arraylist
answer count: 2
has answer: http://stackoverflow.com/a/26578545

http://stackoverflow.com/comment/41935168
type: Comment
comment on: http://stackoverflow.com/a/26666800
has text: What does the colon in "for (int num : nums)" do?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41909793
comment on: http://stackoverflow.com/q/26652990
has text: DTO means? Not understood
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26641278
has comment: http://stackoverflow.com/comment/41889600
accepted answer: http://stackoverflow.com/a/26641397
has body: I'd like to create class World that will have array of Object that will contain various objects. public class World { Object obj[] = new Object[10]; public void World() { this.obj[0] = new Sphere(); this.obj[1] = new Triangle(); ... and so on } } Then in main: World world = new World(); I'd like to use methots that are inclass of specific object. e.g. world.obj[i].methodOfSphere(); How can I achieve that?
downvote count: 2
has answer: http://stackoverflow.com/a/26641397
has title: various objects in Object java
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41889531
tagged with: java
has comment: http://stackoverflow.com/comment/41889527
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41889633
answer count: 1
tagged with: arrays
favorite count: 0

http://stackoverflow.com/q/26515178
tagged with: static
tagged with: sql
has comment: http://stackoverflow.com/comment/41660210
tagged with: jdbc
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has body: Per definition static SQL code is preprocessed and linked to a database-resident module during a bind phase, while dynamic SQL is compiled and checked during runtime. JDBC offers PreparedStatements for parameterized queries. Is SQL code executed via PreparedStatements static SQL or dynamic SQL? Is this database dependent? One the one hand PreparedStatements were intended to have the advantages of static SQL, on the other hand, after (Java) program execution finished, the handle will be lost.
tagged with: java
has comment: http://stackoverflow.com/comment/41660412
tagged with: prepared-statement
type: Question
has title: JDBC: Is SQL code executed via the PreparedStatement static SQL?
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41790033
score: 0
type: QuestionComment
type: Comment
has text: @fge - I just tried `-r 12` and got a 16K file. Good question. :)
comment on: http://stackoverflow.com/q/26569304

http://stackoverflow.com/q/26655480
has comment: http://stackoverflow.com/comment/41913875
has answer: http://stackoverflow.com/a/26656065
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has title: Spring Web App show user headers
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26656124
has comment: http://stackoverflow.com/comment/41914047
score: 0
has answer: http://stackoverflow.com/a/26655845
answer count: 3
has body: I am trying to show users information i browser when they open the web application. I`ve made some basic web app. I suppose that i made a mistake in the controller class and do not print the header in browser. The application works correctle. I package the war file with maven and deploy it to Tomcat where it opens correctly the .jsp file but do not show my headers. I will copy the controller here and hope that someone will help me to fix it. Best regards ! import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class SiteController { @Autowired private HttpServletRequest request; @RequestMapping(value = "/headers", method = RequestMethod.GET) public ModelAndView getDomain() { ModelAndView modelandView = new ModelAndView("Headers"); modelandView.addObject("user-agent", getUserAgent()); modelandView.addObject("headers", getHeadersInfo()); return modelandView; } private String getUserAgent() { return request.getHeader("user-agent"); } public Map&lt;String, String&gt; getHeadersInfo() { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = (String) headerNames.nextElement(); String value = request.getHeader(key); map.put(key, value); } return map; } }
tagged with: user-agent
has comment: http://stackoverflow.com/comment/41913677
tagged with: tomcat

http://stackoverflow.com/a/26635081
upvote count: 1
answers question: http://stackoverflow.com/q/26634926
has body: To minimize the load time for .js files, many developers will "compress" them. Compressing also has an option to obfuscate the code, making it more difficult to steal and change by making it difficult to understand. This happens just as you describe, by changing the variable names and function names to "a", "b", "c", etc. This has the side-effect of making the code smaller, since the names are now shorter. An example of a web tool that does this for you is here: http://www.developerfusion.com/tools/compressjavascript/ The code base that you maintain is certainly NOT the one that has been compressed and/or obfuscated.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26578613
tagged with: while-loop
has answer: http://stackoverflow.com/a/26578754
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41774505
has comment: http://stackoverflow.com/comment/41774721
tagged with: java
has title: while loop, switch statement
has body: I'm having a problem when I enter the "p" case, after it's finished it repeats the top part of my while loop again where at the end the user must put something in for "input" variable. The problem is the user never gets prompted to put anything in for "input" and then it loops again, re-printing all of the information it previously just printed. The second time around it does allow the user to put something in for "input". This only happens after I run the "p" case. Someone please help me! Will be much appreciated! package PayandGoParking; /** * Purpose: Input: * * Processing done: * * Output: * * @author (your name) * @version (a version number or a date) */ import java.util.Scanner; import java.util.*; import java.io.*; import java.text.DecimalFormat; public class Assignment2 { public static void main(String[] args) throws IOException { Calendar now = Calendar.getInstance(); Scanner k = new Scanner(System.in); DecimalFormat dm = new DecimalFormat("00"); String input = " ", cardNumber, x = "x"; double anyKey; double currentTime, currentCharge = 0, securityCode, totalCharge = 0; Calendar paidTill; int min = 0; while (input != x) { System.out.println("Welcome to Pay and Go parking"); System.out.println("+ to add 30 minutes ($1.00 charge)"); System.out.println("p to print the ticket"); System.out.println("r to restart"); System.out.println("x to exit the program"); System.out.print("Please enter your selection: "); input = k.nextLine(); switch (input) { case "+": min += 30; currentCharge += 1; paidTill = (Calendar) now.clone(); paidTill.add(Calendar.MINUTE, min); System.out.println("================================================"); System.out.printf("%s%s%s%s%s%.2s%s%.2s\n", "Current Time: ", now.get(Calendar.MONTH), "-", now.get(Calendar.DAY_OF_MONTH), " ", now.get(Calendar.HOUR_OF_DAY), ":", dm.format(now.get(Calendar.MINUTE))); System.out.printf("%s%s%s%s%s%.2s%s%.2s\n", "Paid Till: ", paidTill.get(Calendar.MONTH), "-", paidTill.get(Calendar.DAY_OF_MONTH), " ", p…
tagged with: switch-statement
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26579117

http://stackoverflow.com/comment/71931892
has text: And what method to use? setBackgroundTintList? It requires API 21.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/36869650

jmonkeyengine
tags question: http://stackoverflow.com/q/26614925
type: Tag
tag name: jmonkeyengine

http://stackoverflow.com/comment/41752427
has text: Im trying to clone the project into my eclipse so i can make a jar out of it but it keeps telling me its empty. I'm not very familiar with adding open source libs. If I use maven to install, will it be a plugin that opens me a new eclipse window at runtime?
type: AnswerComment
comment on: http://stackoverflow.com/a/26555542
score: 0
type: Comment

http://stackoverflow.com/comment/41840686
type: AnswerComment
comment on: http://stackoverflow.com/a/26611687
type: Comment
has text: did that already .. here`s the link [link](http://stackoverflow.com/questions/26613602/hashmap-help-read-from-file-print-to-console-jtextarea?noredirect=1#comment41840325_26613602)
score: 0

http://stackoverflow.com/comment/41892247
has text: You should be able to set a bit on the jvm executable to enable /LARGESPACEAWARE support. See my revision and the SO link.
type: Comment
comment on: http://stackoverflow.com/a/26642827
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41906239
has text: ` ` and ` ` are a bit tricky, because they don't require a closing tag in html (but they do in xhtml). If you can get the xml -> html conversion to generate closed tags (` ` instead of ` `) the html -> pdf conversion should work nicely.
comment on: http://stackoverflow.com/q/26648853
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26555066
has answer: http://stackoverflow.com/a/26594982
tagged with: spring
tagged with: rabbitmq
score: 2
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/41899732
has body: So, detailed description. I'm working on a microservice framework that uses Rabbit as the event bus. Each service runs on it's own dedicated VM inside a Tomcat container (4 cores, 4GB RAM of which 2 are available to Tomcat). Each service both consumes and publishes messages back to Rabbit. When I crank up the consumers, channel settings and prefetch size I can get an individual service to perform well. My problem comes when I try to test scalability, i.e. a 2nd VM instance with the service running on it. Instead of the throughput doubling (or at least increasing), it can actually get slower, and I'm very confused. I've checked for errors and exceptions in the service, used analytics tools (AppDynamics) to check the time spent in the service and the resources used, and everything looks fine, so as far as I can tell it's my Rabbit configuration that's the problem. The specific settings used to achieve high performance for one service are: -Consumers: 20. -Channel cache size: 200 -Prefetch: 500 Using this it seems to work quite well. However when I add the second service the queues aren't being consumed as fast and they start to back up quite quickly, and I'm at a loss to understand why. I've experimented a little with the settings above but can't seem to get anywhere. I don't have any access to the Rabbit cluster to change settings so I can't do anything there, but I have full control over the VM my service runs in (Java settings, Tomcat, Rabbit settings..) The service doesn't do anything explicit with connections or ack policies, so it's possible they may need to be tweaked? A few articles mention that there should be one channel per consumer (or even 1 for consume and 1 for publish), but that makes things slower than the larger figure above.. I'm at a loss, so any help is appreciated, more details can be provided. Java: 7 Spring Core: 3.2.2 Rabbit AMQP: 3.1.2 Spring Rabbit: 1.3.5 Spring AMQP: 1.3.5 EDIT: I'm using a ConnectionFactory in Spring XML config (defaults t…
type: Question
downvote count: 0
favorite count: 0
answer count: 1
has title: RabbitMQ throughput falls off when a second process consumers from a queue
has comment: http://stackoverflow.com/comment/41850751
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26557375
answer count: 3
accepted answer: http://stackoverflow.com/a/26557436
has comment: http://stackoverflow.com/comment/41736096
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26557409
has answer: http://stackoverflow.com/a/26557409
has body: Lets consider this scenario: I am reading a file, and then tweaking each line a bit and then storing the data in a new file. Now, I tried two ways to do it: storing the data in a String and then writing it to the target file at the end like this: InputStream ips = new FileInputStream(file); InputStreamReader ipsr = new InputStreamReader(ips); BufferedReader br = new BufferedReader(ipsr); PrintWriter desFile = new PrintWriter(targetFilePath); String data = ""; while ((line = br.readLine()) != null) { if (line.contains("_Stop_")) continue; String[] s = line.split(";"); String newLine = s[2]; for (int i = 3; i &lt; s.length; i++) { newLine += "," + s[i]; } data+=newLine+"\n"; } desFile.write(data); desFile.close(); br.close(); directly using println() method for PrintWriter as below in the while loop: while ((line = br.readLine()) != null) { if (line.contains("_Stop_")) continue; String[] s = line.split(";"); String newLine = s[2]; for (int i = 3; i &lt; s.length; i++) { newLine += "," + s[i]; } desFile.println(newLine); } desFile.close(); br.close(); The 2nd process is way faster than the 1st one. Now, my question is what is happening so different in these two process that it is differing so much by execution time?
has answer: http://stackoverflow.com/a/26557417
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/47605
score: 1
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/26557436
tagged with: file-writing
upvote count: 1
type: Question
has title: why storing data directly using print() method is faster than storing it in a string and then writing to a file?

http://stackoverflow.com/comment/41820113
comment on: http://stackoverflow.com/q/26603420
score: 0
type: Comment
type: QuestionComment
has text: First how have you exactly called those builds? Do all childs use the same parent as your aggregator?

http://stackoverflow.com/q/26561175
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41742838
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-fragments
score: 1
has comment: http://stackoverflow.com/comment/41742769
tagged with: java
upvote count: 1
has title: Android ViewPager Bug on Swipe
type: Question
has answer: http://stackoverflow.com/a/28232785
tagged with: android-viewpager
has comment: http://stackoverflow.com/comment/41743069
has body: I have this weird issue with the viewPager. When I swipe from one fragment to the next and then swipe back, the layout is correct, but when pressing an element (Listview item for example), the previous java code still did not update with the view. I don't know if I can explain this any better, as it works when I play with the swipe until the fragment works like its supposed to. here is my code: Main.Java: public class Main extends FragmentActivity { SectionsPagerAdapter mAdapter; ViewPager mViewPager; // for alert transitions AlertDialog dialog; // share button private ShareActionProvider mShareActionProvider; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // set up button getActionBar().setDisplayHomeAsUpEnabled(true); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAdapter); mViewPager.setPageTransformer(true, new DepthPageTransformer()); } @Override public void onBackPressed() { if (mViewPager.getCurrentItem() == 0) { // If the user is currently looking at the first step, allow the system to handle the // Back button. This calls finish() on this activity and pops the back stack. super.onBackPressed(); } else { // Otherwise, select the previous step. mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1); } } } SectionsPagerAdapter.java: public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position){ case 0: return new Important(); case 1: return new Propositions(); case 2: return new Information(); } return null; } @Override public int ge…

http://stackoverflow.com/a/26780367
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: I have run into similar issues today. In my case I was building an über jar, where some dependency (I have not found the culprit yet) was bringing in a META-INF/services/org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider with the contents: org.apache.hadoop.mapred.LocalClientProtocolProvider I provided my own in the project (e.g. put it on the classpath) with the following: org.apache.hadoop.mapred.YarnClientProtocolProvider and the correct one is picked up. I suspect you are seeing similar. To fix, please create the file described above, and put it on the classpath. If I find the culprit Jar, I will update the answer.
answers question: http://stackoverflow.com/q/26567223

http://stackoverflow.com/q/26517856
type: Question
accepted answer: http://stackoverflow.com/a/26518274
tagged with: model-view-controller
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41666028
score: 24
has answer: http://stackoverflow.com/a/67102059
has comment: http://stackoverflow.com/comment/41666093
tagged with: user-interface
downvote count: 0
linked to: http://stackoverflow.com/q/20620167
has answer: http://stackoverflow.com/a/26517895
tagged with: awt
has title: Java and GUI - Where do ActionListeners belong according to MVC pattern?
favorite count: 0
has body: I'm currently writing a template Java application and somehow, I'm not sure about where the ActionListeners belong if I wanted to cleanly follow the MVC pattern. The example is Swing based, but it's not about the framework but rather the basic concept of MVC in Java, using any framework to create GUI. I started with an absolutely simple application containing a JFrame and a JButton (to dispose the frame hence close the application). The code trailing this post. Nothing really special, just to clearify what we're talking about. I didn't start with the Model yet as this question was bugging me too much. There has already been more than one similar question(s), like these: MVC pattern with many ActionListeners Java swing - Where should the ActionListener go? But non of them was really satisfying as I'd like to know two things: Is it reasonable to have all ActionListeners in a separate package? I'd like to do so for the sake of readability of View and Controller, esp. if there's a lot of listeners How would I execute a Controller function from within an ActionListener, if the listener is not a sub class inside the Controller? (follow-up question) I hope this is not too general or vague I'm asking here, but it makes me think for a while now. I always used sort of my own way, letting the ActionHandler know about the Controller, but this does not seem right, so I'd finally like to know how this is done properly. Kind regards, jaySon Controller: package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import view.MainView; public class MainController { MainView mainView = new MainView(); public MainController() { this.initViewActionListeners(); } private void initViewActionListeners() { mainView.initButtons(new CloseListener()); } public class CloseListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { mainView.dispose(); } } } View: package view; import java.awt.Dimension; import java.awt.event.Action…
has answer: http://stackoverflow.com/a/26518274
possible better answer: http://stackoverflow.com/a/26517895
has comment: http://stackoverflow.com/comment/41668043
answer count: 4
has answer: http://stackoverflow.com/a/31248051
tagged with: swing
linked to: http://stackoverflow.com/q/14179485
upvote count: 24

http://stackoverflow.com/a/26549879
has comment: http://stackoverflow.com/comment/41722366
has comment: http://stackoverflow.com/comment/41722617
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41722690
accepted answer of: http://stackoverflow.com/q/26549832
type: Answer
has comment: http://stackoverflow.com/comment/41722471
score: 1
has body: First thing, do not use Vector, as your code is running on a single thread. Use ArrayList instead. Then, if you want to find the bounding box, you need to create a rectangle for which the diagonal is defined by the point(smallestX, smallestY) and the point(biggestX, biggestY). Iterate through your shape's point to find minimum and maximums for x and y coordinates.
upvote count: 1
answers question: http://stackoverflow.com/q/26549832
has comment: http://stackoverflow.com/comment/41722277
has comment: http://stackoverflow.com/comment/41722548

http://stackoverflow.com/comment/41662035
comment on: http://stackoverflow.com/q/26516045
has text: -1 indicates the stream has been closed - not that the end of a JSON string has been received. You'll have to detect that yourself.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41807391
score: 4
comment on: http://stackoverflow.com/q/26585220
has text: How is this not a duplicate more than 6 years after Stack Overflow was launched and after 733987 Java questions?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41782631
score: 1
comment on: http://stackoverflow.com/a/26583191
type: Comment
has text: Oh the `setTag()` works if I define the checkbox like this: `final CheckBox checkbox = (CheckBox) view1.findViewById(R.id.checkBox);` So Thanks !
type: AnswerComment

http://stackoverflow.com/q/26540890
score: 0
has title: JScrollPane doesn't show when using with JTextPane
linked to: http://stackoverflow.com/q/6592468
has answer: http://stackoverflow.com/a/26540907
accepted answer: http://stackoverflow.com/a/26540907
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am trying to show a scroll bar next to my text pane but I can't find the reason why it doesn't show. this.setLayout(null); editorPane = new JTextPane(); size = editorPane.getPreferredSize(); editorPane.setBounds(17, 12, 533, size.height * 3); editorPane.setBackground(Color.BLACK); editorPane.setForeground(Color.WHITE); //editorPane.setEditable(false); console = editorPane.getStyledDocument(); scrollConsole = new JScrollPane(editorPane); scrollConsole.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); this.add(editorPane); this.add(scrollConsole);
tagged with: jscrollpane
answer count: 1

http://stackoverflow.com/comment/41700604
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26537134
has text: @Cornstalks: I have tried to explain how a compiler does it.
score: 0

http://stackoverflow.com/a/65847316
downvote count: 0
answers question: http://stackoverflow.com/q/26538980
type: Answer
has body: This is how I solved this problem - I wanted to create a method that creates a diff of two objects. public List&lt;Change&gt; getChanges(Object o1, Object o2); Naturally I wanted both o1 and o2 to be of the same type. I solved this by encapsulating this method inside a parameterised class. public class DiffGenerator&lt;T&gt; { public List&lt;Change&gt; getChanges(T o1, T o2) { //code } } This can be used as: List&lt;Change&gt; changes = new DiffGenerator&lt;MyClass&gt;().getChanges(myClassOld, myClassNew); Worked for me.
score: 1
upvote count: 1

http://stackoverflow.com/a/26671373
downvote count: 0
answers question: http://stackoverflow.com/q/26671319
has body: You can maximize frame like this : setExtendedState(JFrame.MAXIMIZED_BOTH); or you can size frame as per your requirement like setSize(500,500); and you have to add below statement as i cant see this in your code setVisible(true);
accepted answer of: http://stackoverflow.com/q/26671319
type: Answer
has comment: http://stackoverflow.com/comment/41943667
upvote count: 1
has comment: http://stackoverflow.com/comment/41943423
has comment: http://stackoverflow.com/comment/41943461
score: 1
has comment: http://stackoverflow.com/comment/41943362
type: AcceptedAnswer

http://stackoverflow.com/a/26524387
has comment: http://stackoverflow.com/comment/41677027
has comment: http://stackoverflow.com/comment/52362734
has comment: http://stackoverflow.com/comment/41680688
has comment: http://stackoverflow.com/comment/41676724
downvote count: 4
has body: It seems you can define project specific environment variables: In IntelliJ project specific environment variables you can set under Run/Debug configurations --> Defaults --> Application --> Environment variables from: http://emmanuelbernard.com/blog/2012/05/09/setting-global-variables-intellij/#comment-617922540
has comment: http://stackoverflow.com/comment/61010562
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26524010
has comment: http://stackoverflow.com/comment/41679642
has comment: http://stackoverflow.com/comment/76722737
score: -2

http://stackoverflow.com/a/26656912
has body: Well, if you can afford the additional overhead and security implications, you can use a Serializable functional interface and decode the serialized form of the method reference instance to find the target like demonstrated in this answer or brought up again with this question and its answers. However, you should really rethink your software design. “Avoiding endless recursion” shouldn’t be fixed by decoding some kind of parameter object, especially not if your assumption is, that this actual argument value represents the caller of your method. How would you ever enforce this strange relationship? Even a simple code change like referencing a method which delegates to the other method would break your check. Here is a simple example showing the subtle problems with your approach: public class SimpleTest { public static void main(String... arg) { run(SimpleTest::process); } static void run(BiConsumer&lt;Object,Object&gt; c) { c.accept("foo", "bar"); } static void process(Object... arg) { Thread.dumpStack(); } } When running this program it will print something like: java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1329) at SimpleTest.process(SimpleTest.java:16) at SimpleTest.lambda$MR$main$process$a9318f35$1(SimpleTest.java:10) at SimpleTest$$Lambda$1/26852690.accept(Unknown Source) at SimpleTest.run(SimpleTest.java:13) at SimpleTest.main(SimpleTest.java:10) showing that the method reference within the generated instance is not the expected SimpleTest::process but instead SimpleTest::lambda$MR$main$process$a9318f35$1 which will eventually invoke process. The reason is that some operations (here varargs processing) are not performed by the generated interface instance but a synthetic method instead, just like you had written run((a,b)-&gt; SimpleTest.process(a,b)). The only difference is the name of the synthetic method. You shouldn’t design software relying on such fragile introspection. If you want to avoid recursion, a simple ThreadLocal fl…
answers question: http://stackoverflow.com/q/26649412
type: Answer
has comment: http://stackoverflow.com/comment/41950676
has comment: http://stackoverflow.com/comment/41941774
has comment: http://stackoverflow.com/comment/41925942
score: 4
has comment: http://stackoverflow.com/comment/41949737
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/26600076
has body: currently i am using a swing worker and it wont allow the task to be executed more than once. This is not an issue since you would just construct a new SwingWorker and run it within your JButton's ActionListener. As far as I can tell, this is the solution to your question as it is currently written. If you need a more detailed answer, then you'll want to provide more detail in your question. Edit You state: but i have no idea how to reinvent the swingworker everytime the user click the scan button. How do you "reinvent" any object? By creating a new instance, here a new MySwingWorker, and then call execute on it. e.g., import java.awt.*; import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.concurrent.ExecutionException; import javax.swing.*; public class ScanFileFrame { private FileScanAction fileScanAction = new FileScanAction("Scan Files", KeyEvent.VK_S); private JButton btnTicking = new JButton(fileScanAction); private JLabel label1; private MyFileScanWorker worker; ScanFileFrame() { JFrame jframe = new JFrame(); jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jframe.setLayout(new FlowLayout()); label1 = new JLabel(" No File Scanned ", SwingConstants.CENTER); jframe.add(btnTicking); jframe.add(label1); jframe.pack(); jframe.setLocationByPlatform(true); jframe.setVisible(true); } @SuppressWarnings("serial") private class FileScanAction extends AbstractAction { public FileScanAction(String name, int mnemonic) { super(name); putValue(MNEMONIC_KEY, mnemonic); } @Override public void actionPerformed(ActionEvent e) { label1.setText("Scanning Files"); fileScanAction.setEnabled(false); worker = new MyFileScanWorker(); worker.addPropertyChangeListener(new WorkerListener()); worker.execute(); } } private class WorkerListener implements PropertyChangeListener { @Override public void propertyChange(PropertyChangeEvent pcEvt) { if (pcEvt.getNewValue() == SwingWorker.StateValue.DONE) { fileScanActi…
has comment: http://stackoverflow.com/comment/41815087
type: Answer
has comment: http://stackoverflow.com/comment/41815176
has comment: http://stackoverflow.com/comment/41814453
accepted answer of: http://stackoverflow.com/q/26599794
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26599794
has comment: http://stackoverflow.com/comment/41814393

http://stackoverflow.com/comment/41874275
type: Comment
has text: It looks also works for me, but I can't scale the amplitude. Where should I add the *0.3 ?
comment on: http://stackoverflow.com/a/26633067
type: AnswerComment
score: 0

http://stackoverflow.com/q/26667249
has comment: http://stackoverflow.com/comment/41985059
has comment: http://stackoverflow.com/comment/41939440
has comment: http://stackoverflow.com/comment/41963767
has comment: http://stackoverflow.com/comment/41937070
has comment: http://stackoverflow.com/comment/41985808
has comment: http://stackoverflow.com/comment/41986750
has comment: http://stackoverflow.com/comment/41938775
has comment: http://stackoverflow.com/comment/41937873
has comment: http://stackoverflow.com/comment/42002252
has comment: http://stackoverflow.com/comment/41937425
has comment: http://stackoverflow.com/comment/41937607
tagged with: java
tagged with: h2
tagged with: database
has title: How do I share an H2 database over a peer-to-peer network?
has comment: http://stackoverflow.com/comment/41937996
has comment: http://stackoverflow.com/comment/41937887
has comment: http://stackoverflow.com/comment/41937163
has comment: http://stackoverflow.com/comment/41941842
has comment: http://stackoverflow.com/comment/41937290
has comment: http://stackoverflow.com/comment/41936390
upvote count: 3
has comment: http://stackoverflow.com/comment/42004648
has comment: http://stackoverflow.com/comment/41937959
has comment: http://stackoverflow.com/comment/41936837
has comment: http://stackoverflow.com/comment/41937696
has comment: http://stackoverflow.com/comment/42006531
has comment: http://stackoverflow.com/comment/41937546
has comment: http://stackoverflow.com/comment/41938346
has comment: http://stackoverflow.com/comment/42003191
has comment: http://stackoverflow.com/comment/41936896
has comment: http://stackoverflow.com/comment/42002022
has comment: http://stackoverflow.com/comment/42004785
downvote count: 1
has comment: http://stackoverflow.com/comment/41938304
tagged with: url
has comment: http://stackoverflow.com/comment/41937643
has comment: http://stackoverflow.com/comment/41958228
has comment: http://stackoverflow.com/comment/41936051
has comment: http://stackoverflow.com/comment/41936956
has comment: http://stackoverflow.com/comment/41941456
favorite count: 0
has comment: http://stackoverflow.com/comment/42003468
has comment: http://stackoverflow.com/comment/41938741
has comment: http://stackoverflow.com/comment/41937711
has comment: http://stackoverflow.com/comment/41940673
has comment: http://stackoverflow.com/comment/41986469
has comment: http://stackoverflow.com/comment/42000883
has comment: http://stackoverflow.com/comment/42004627
has comment: http://stackoverflow.com/comment/41937137
has comment: http://stackoverflow.com/comment/41936474
has comment: http://stackoverflow.com/comment/41936104
score: 2
has comment: http://stackoverflow.com/comment/41937324
answer count: 0
has comment: http://stackoverflow.com/comment/41980788
has comment: http://stackoverflow.com/comment/41940067
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41938473
has comment: http://stackoverflow.com/comment/41938071
has comment: http://stackoverflow.com/comment/41936134
has comment: http://stackoverflow.com/comment/42007274
has comment: http://stackoverflow.com/comment/42006612
has comment: http://stackoverflow.com/comment/41983124
has comment: http://stackoverflow.com/comment/41940902
has body: I've been working a bit with H2 over the past couple of days, and I am having some trouble. I run the program on one computer and add some data. Then, I try to run the same program on another computer (even through a shared folder over the peer-to-peer network), and it seems as though the database is stored locally, on each computer. Now, I have a database set up with the URL jdbc:h2:C://DatabaseTesting/NewDatabase. I couldn't get it placed in certain other folders, but I figured this one will do. Now, if I try to run this program on multiple computers, I can already see what the issue will be. It will create the database on each computer, locally, instead of only on the "server" computer. How can I get all of the computers to link back to the "server" computer for this application?
type: Question
has comment: http://stackoverflow.com/comment/42004683

http://stackoverflow.com/comment/41895301
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26644605
type: QuestionComment
has text: Yeah, I don't understand, a little more explanation please?

http://stackoverflow.com/q/26610174
tagged with: java
has comment: http://stackoverflow.com/comment/41832602
type: Question
tagged with: javaparser
downvote count: 0
tagged with: method-declaration
has comment: http://stackoverflow.com/comment/41836550
answer count: 1
has answer: http://stackoverflow.com/a/28925716
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Java MethodDeclaration ClassOrInterfaceDeclaration finding class names
score: 2
has body: I'm using the MethodDeclaration for a java parser that reads in source code but I'm having some problems. I can't see any methods which give me the class that this belongs to. Does a method exist for this or do I need to look in the java parser to try and create a way that will attach each MethodDeclaration to it's ClassOrInterfaceDeclaration . I either need a way of detecting if a MethodDeclaration belongs to a class or I need a way of getting all of the methods in a ClassOrInterfaceDeclaration. edit to make this more clear: MethodDeclaration m = oldMethodDeclaration ; //where oldMethodDeclaration is already defined method declaration I need a way to find the class that "m" belongs to. In the following example it will return "ClassName" ie public class ClassName{ public void oldMethodDeclaration (){ } } Alternatively if I have ClassOrInterfaceDeclaration ClassName; is it possible for me to find a list of method names attached to it?

http://stackoverflow.com/q/26596547
tagged with: mysql
has title: Java Insert Or Update in SQL logic
type: Question
has body: I have a table as shown below: mysql&gt; select * from category; +-------------+----------+------+------+------+------+------+------+------+------+------+-----------------+ | category_id | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 | vendor_brand_id | +-------------+----------+------+------+------+------+------+------+------+------+------+-----------------+ | 12 | Popcorn | rgp | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 3000 | I am trying to insert a new Row as Popcorn Bucket so that it looks this way: mysql&gt; select * from category; +-------------+----------+------+------+------+------+------+------+------+------+------+-----------------+ | category_id | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 | vendor_brand_id | +-------------+----------+------+------+------+------+------+------+------+------+------+-----------------+ | 12 | Popcorn | rgp | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 3000 | | 13 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 3000 | But this is updating the existing row. Could anybody please tell me what's wrong? String vendor_brand_id ="3000"; String reqstr ="Popcorn"; String value="Bucket"; sqlselect = "select category_id from category where T1 = ? AND T2!=NULL AND vendor_brand_id = ?"; selectpst = dbConnection.prepareStatement(sqlselect); selectpst.setString(1, valuess[0]); selectpst.setString(2, vendor_brand_id); resultset = selectpst.executeQuery(); if(resultset.next()) { sql= "select category_id from category where T1 = ? AND T2=? AND vendor_brand_id = ?"; selectpst2 = dbConnection.prepareStatement(sql); selectpst2.setString(1, valuess[0]); selectpst2.setString(2, value); selectpst2.setString(3, vendor_brand_id); resultset2 = selectpst2.executeQuery(); if(resultset2.next()) { } else { sql = "Insert into category (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,vendor_brand_id) values ('"+valuess[0]+"','"+value+"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"+vendor_brand_id+") "; updat…
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41807477
tagged with: sql
has comment: http://stackoverflow.com/comment/41807517
has answer: http://stackoverflow.com/a/26596641
has comment: http://stackoverflow.com/comment/41807523
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41807775
accepted answer: http://stackoverflow.com/a/26596641
tagged with: java
has comment: http://stackoverflow.com/comment/41807704

http://stackoverflow.com/a/26579916
has body: This works just fine: Character[] levels = {'0', '1', '2', '3'}; skillLevelCombo = new JComboBox&lt;Character&gt;(levels); e.g., import javax.swing.JComboBox; import javax.swing.JOptionPane; public class ComboFun { private static JComboBox&lt;Character&gt; skillLevelCombo; public static void main(String[] args) { Character[] levels = {'0', '1', '2', '3'}; skillLevelCombo = new JComboBox&lt;Character&gt;(levels); JOptionPane.showMessageDialog(null, skillLevelCombo); } } Please note that Integers work well too: Integer[] levels = {0, 1, 2, 3}; final JComboBox&lt;Integer&gt; skillLevelCombo = new JComboBox&lt;Integer&gt;(levels);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26579885
type: Answer
accepted answer of: http://stackoverflow.com/q/26579885
upvote count: 3
score: 3

http://stackoverflow.com/q/26608966
has body: I have written a scanner utility for parsing a template. Consider the code snippet : String input = FileUtils.readFileToString(new File("input file path")); Scanner scanner = new Scanner(input); scanner.useDelimiter(System.getProperty("line.separator")); System.out.println("Checking"); while(scanner.hasNext()) { System.out.print(scanner.hasNext("\\s*#[^\\n]*")); System.out.println(" : " + scanner.nextLine()); } Input File Contents : # Line 1 ####################### # Check # Matched with spaces # // End of file Note : The end of file line is not present in the input. Output produced : Checking true : # Line 1 true : ####################### true : true : # Check true : # Matched with spaces true : # false : false : My question is why is it for the third line hasNext() returns true even when it does not start with a '#' ? Any help would be appreciated.
type: UnansweredQuestion
tagged with: regex
score: 2
tagged with: java.util.scanner
upvote count: 2
type: Question
tagged with: java
has title: Scanner hasNext(String pattern) falsely returns true
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26609159
favorite count: 0

http://stackoverflow.com/q/26642437
has answer: http://stackoverflow.com/a/26642478
has comment: http://stackoverflow.com/comment/41891642
has comment: http://stackoverflow.com/comment/41891789
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26642478
type: Question
possible better answer: http://stackoverflow.com/a/26642504
has comment: http://stackoverflow.com/comment/41891673
answer count: 2
has body: I have a school problem that I'm stuck on. The problem is that the gross pay keeps coming up as 0.0. Here's the question: Design a Payroll class with the following fields: • name : a String containing the employee's name • idNumber: an int representing the employee's ID number • rate: a double containing the employee's hourly pay rate • hours: an int representing the number of hours this employee has worked The class should also have the following methods : • Constructor : takes the employee's name and ID number as arguments • Accessors: allow access to all of the fields of the Payroll class • Mutators: let the user assign values to the fields of the Payroll class • grossPay: returns the employee's gross pay, which is calculated as the number of hours worked times the hourly pay rate. Write another program that demonstrates the class by creating a Payroll object , then asking the user to enter the data for an employee in the order: name , ID number, rate, hours. The program should then print out a statement in the following format (for example, if you had an employee named Chris Jacobsen with ID number 11111, who works for 5 hours at $10/hr): Chris Jacobsen, employee number 11111, made $50.00 in gross pay. Using text forming so that the gross pay is rounded to two decimal places. Here's what I have so far: import java.util.Scanner; public class Payroll { private String EmployeeName; private int IDnumber; private double HourlyPayRate; private double TotalHoursWorked; private double TotalGrossPay; public Payroll(String Name, int ID, double HourlyRate, double HoursWorked) { EmployeeName = Name; IDnumber = ID; } public String getEmployeeName() { return EmployeeName; } public int getIDnumber() { return IDnumber; } public void setHourlyPayRate(double HourlyRate) { HourlyPayRate = HourlyRate; } public double getHourlyPayRate() { return HourlyPayRate; } public void setTotalHoursWorked(double HoursWorked) { TotalHoursWorked = HoursWorked; } public double getTotalHoursWorked(…
has answer: http://stackoverflow.com/a/26642504
has title: Getting a value form "get and set" in java
score: 0
tagged with: java

http://stackoverflow.com/a/26659232
type: Answer
has body: The datbase url help you define the address of the database you are connecting to So for connecting to a oracle database I use a url like: public static final String DB_URL = "jdbc:oracle:thin:@//localhost:1521/ORCL"; Here is the format of the url for oracle Format:- jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE where jdbc:oracle:thin is static part and the rest is specific to the databse you are connecting to. Following table lists down popular JDBC driver names and database URL. RDBMS JDBC driver name URL format ----- ---------------- ----------------- MySQL com.mysql.jdbc.Driver jdbc:mysql://hostname/ databaseName ORACLE oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@hostname:port Number:databaseName DB2 COM.ibm.db2.jdbc.net.DB2Driver jdbc:db2:hostname:port Number/databaseName Sybase com.sybase.jdbc.SybDriver jdbc:sybase:Tds:hostname: port Number/databaseName All the highlighted part in URL format is static and you need to change only remaining part as per your database setup. Source : Tutorialpoint.com
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26659160
answers question: http://stackoverflow.com/q/26659160

http://stackoverflow.com/a/26646836
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26646719
has body: Why does the head nodes of the lists does not get updated properly? Because you're just changing the values of local variables. That's all you're doing - you're not making any changes to the list objects at all. Changes to local variables have no effect outside the method itself. Note that when I say "changes to local variables" I mean something like: localVariable = someOtherValue; If instead you have: localVariable.someMember = someOtherValue; then that might have an effect outside the method, because that's changing the member of an object. If that object is accessible outside the method, then the change will be visible there too.
answers question: http://stackoverflow.com/q/26646719
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41899012
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41898880
has comment: http://stackoverflow.com/comment/41899267
score: 3

http://stackoverflow.com/comment/41718695
score: 0
comment on: http://stackoverflow.com/q/26540350
type: Comment
type: QuestionComment
has text: Edited the question to provide MCVE and explanation for what I'm trying to accomplish.

http://stackoverflow.com/q/26626795
answer count: 2
has title: HTTPClient and PostMethod
type: UnansweredQuestion
tagged with: apache-commons-httpclient
has body: So I ran into a problem and the service support asked me to support them with the HTML. So I need to get the equivalent HTML that is generated by HttpClient client = new HttpClient(); PostMethod post = new PostMethod( "https://www.url.to/post-to" ); NameValuePair[] params = { new NameValuePair( "NAME", name ), new NameValuePair( "EMAIL", email ), for( NameValuePair param : params ){ post.setParameter(param.getName(), param.getValue()); } Is it possible to get it as HTML or get the request sent as a string, with all the headers etc?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26627074
has answer: http://stackoverflow.com/a/26627287
score: 0

http://stackoverflow.com/a/26641107
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41902159
answers question: http://stackoverflow.com/q/26564360
has body: An ON_DEMAND SQL instance will shutdown after an idle period. When the instance is shut down any new connections must wait for the instance to start up before the connection will be completed. It is possible that this is the delay you are experiencing. You can try changing the activation policy to ALWAYS and see if this reduces the connection overhead. If you do this you should also change the billing plan to "Package" as it will be cheaper considering your instance will be running continuously. This is covered in the Cloud SQL FAQ.

http://stackoverflow.com/q/26656370
tagged with: java
has comment: http://stackoverflow.com/comment/63166311
has comment: http://stackoverflow.com/comment/41996261
has comment: http://stackoverflow.com/comment/42147758
has comment: http://stackoverflow.com/comment/42066174
linked to: http://stackoverflow.com/q/11448082
has comment: http://stackoverflow.com/comment/41996212
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/13346308
has comment: http://stackoverflow.com/comment/41983669
has comment: http://stackoverflow.com/comment/41963289
has body: I've following class hierarchy. class A { String id; @NotEmpty(message="Title can't be empty") String title; String description; String comments; } class B extends A { String manufacturer; } class C extends A { long size; } Now I want an editor which reuses editor of A and also works well with values of B and C. So I went ahead with following: class EditorA extends Composite implements Editor&lt;A&gt; { @uiField TextBox id; @uiField TextBox title; @uiField TextBox description; // .. constructor etc } class EditorB extends Composite implements Editor&lt;B&gt; { @Path(“”) @UiField EditorA editorA; @UiField TextBox manufacturer; public interface Driver extends SimpleBeanEditorDriver&lt;B, EditorB&gt;{} // .. initialization } class EditorC extends Composite implements Editor&lt;C&gt; { @Path(“”) @UiField EditorA editorA; @UiField LongBox size; public interface Driver extends SimpleBeanEditorDriver&lt;C, EditorC&gt;{} // .. initialization } then I choose the editor based on actual type being edited. Driver flushes object correctly. But when I show constraint violations, every violation is duplicated before its sent to widgets e.g. “Title can’t be empty" “Title can’t be empty” Worse, if I include multiple such widgets (with @Path("") annotation) in one form, violations keep increasing. so in the setup below, 3 violations are set. class EditorAFooter extends Composite implements Editor&lt;A&gt; { @UiField TextBox comments; } class EditorB extends Composite implements Editor&lt;B&gt; { @Path(“”) @UiField EditorA editorA; @UiField TextBox manufacturer; @Path(“”) @UiField EditorAFooter editorAFooter; public interface Driver extends SimpleBeanEditorDriver&lt;B, EditorB&gt;{} // .. initialization } Workaround is not to used EditorA inside EditorB, instead copy all widgets of EditorA and paste into EditorB.ui.xml and then only single violations are set (as expected). However, that’s a lot of code duplication as EditorA is pretty complex in reality. What’s wrong with this kind of…
has comment: http://stackoverflow.com/comment/41953514
upvote count: 11
answer count: 0
has title: GWT Editor Framework for polymorphic types
type: UnansweredQuestion
score: 11
type: Question
tagged with: gwt-editors
tagged with: gwt

http://stackoverflow.com/comment/41833464
comment on: http://stackoverflow.com/a/26608662
type: Comment
has text: @TomasRuud Are you sure you don't want to use a server datasource rather than creating connections directly from your code? http://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41862936
score: 0
type: Comment
type: QuestionComment
has text: @nicearma I am not understanding anything. I am using a simple example from the book "Spring In Action", I learned online that I need to add aopalliance.jar to my classpath along with other Spring dependencies but I am getting this error. Other programs related to dependency injection work perfectly. Only problem is with AOP.
comment on: http://stackoverflow.com/q/26540782

http://stackoverflow.com/a/26725309
accepted answer of: http://stackoverflow.com/q/26569240
score: 0
answers question: http://stackoverflow.com/q/26569240
type: AcceptedAnswer
has body: The image for Document 1 describes the source directory whereas the image in Document 2 describes the target directory. The terms source and target pertain to conventional directories in Maven. Since Document 1's instructions for generating a skeletal Google App Engine project do describe how to add Google Modules, the application.xml and appengine-application.xml files have to be placed in the conventional location where Maven would look for them, namely the source directory here: /&lt;module1&gt;/src/main/application/META-INF/application.xml See also the following questions for an example: What is a maven-application.xml file for? Can appengine-application.xml be generated?
type: Answer

http://stackoverflow.com/comment/41669451
score: 1
has text: Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/88/wtc6dz2d5tvdr3qnzb3pq69w0000gn/T/libgdxasma/75260a42/liblwjgl.dylib. Looks like some LibGDX library that the .jar needs is missing.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26520096

http://stackoverflow.com/comment/41715398
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26545776
has text: Good to know, I've always used the second approach and saved the object's state before applying transformations, so I can reset it afterwards. I thought the `create()` method is just for clipping.

http://stackoverflow.com/comment/41854474
type: QuestionComment
comment on: http://stackoverflow.com/q/26622001
score: 0
has text: you can do it using Android API. see this: http://viralpatel.net/blogs/android-speech-to-text-api/
type: Comment

http://stackoverflow.com/a/26620895
answers question: http://stackoverflow.com/q/26600690
accepted answer of: http://stackoverflow.com/q/26600690
type: AcceptedAnswer
has body: The important line in the error log is this: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0 This is most likely due to there already being another service (Apache, an old Tomcat installation, etc) using GlassFish's default port of 8080. The port that GlassFish uses can be changed by following the instructions here. Furthermore, to find out what is already using GlassFish's port so you can stop the service if necessary, use this for Windows and this for Linux.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/47042975
score: 2
downvote count: 0

http://stackoverflow.com/comment/41874501
comment on: http://stackoverflow.com/q/26633379
score: 5
has text: if `System.out.println("YESSA: " + nodeValue);` is executed then `return "2: " + nodeValue;` is also executed...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26647086
has body: I apply two images "+" and "--" for collapse and expand in my expandablelist view .My problem is that when i expand image display "|" it should display like that "--" why it rotate ?here is my code <ExpandableListView android:id="@+id/lvExp" android:layout_height="match_parent" android:layout_width="match_parent" android:cacheColorHint="#00000000" android:groupIndicator="@drawable/test" /> Selector <?xml version="1.0" encoding="utf-8"?> is there any other way to show image on collapsible row and expand row ..Here is my whole code .. Main Activity package info.androidhive.expandablelistview; public class MainActivity extends Activity { ExpandableListAdapter listAdapter; ExpandableListView expListView; List<String> listDataHeader; HashMap<String, List<String>> listDataChild; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get the listview expListView = (ExpandableListView) findViewById(R.id.lvExp); // preparing list data prepareListData(); listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); // Listview Group click listener expListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { // Toast.makeText(getApplicationContext(), // "Group Clicked " + listDataHeader.get(groupPosition), // Toast.LENGTH_SHORT).show(); return false; } }); // Listview Group expanded listener expListView.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { if(listDataHeader.get(groupPosition) != null) Toast.makeText(getApplicationContext(), listDataHeader.get(groupPosition) + " Expanded", Toast.LENGTH_SHORT).show(); } }); // Listview Group collasped listener expListView.setOnGroupCollapseListener(new OnGroupCollapseListener() { @Override public void onGr…
has comment: http://stackoverflow.com/comment/41901033
has comment: http://stackoverflow.com/comment/41899683
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41901152
has comment: http://stackoverflow.com/comment/41903905
has comment: http://stackoverflow.com/comment/41902554
has comment: http://stackoverflow.com/comment/41902754
answer count: 0
has comment: http://stackoverflow.com/comment/41906919
type: Question
has comment: http://stackoverflow.com/comment/41902294
tagged with: java
has title: why image is not display as same as inserted in drawable folder?
has comment: http://stackoverflow.com/comment/41902818
score: 0
has comment: http://stackoverflow.com/comment/41903144

http://stackoverflow.com/comment/41710672
score: 0
comment on: http://stackoverflow.com/a/26533578
type: AnswerComment
has text: I'm already doing this (it was inside {...}), and I'm sure it's not being called. Indeed, on debug mode getView() isn't called.
type: Comment

http://stackoverflow.com/q/26626920
has answer: http://stackoverflow.com/a/38248310
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26627736
score: 7
tagged with: java
tagged with: hibernate
has title: hibernate - how to JoinColumn an EmbeddedId
accepted answer: http://stackoverflow.com/a/26627736
type: Question
answer count: 2
downvote count: 0
has body: Situation: I have a masterDB and a library1DB and library2DB. library1DB and library2DB are two separate database but has the same schema because each library must have their own database. Now we have a masterDB, this is an aggregated version of all the data in all libraries (library1DB and library2DB), still taking note of their respective ids and mapping them to their library id. Here's I want my tables to be structured: book - book_id - library_id - title - shelf_id shelf - shelf_id - library_id - book_id - description I have these models: @Entity public class Book { @EmbeddedId private BookKey bookKey; @ManyToOne(fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn(name = "SHELF_ID", referencedColumnName = "SHELF_ID"), @JoinColumn(name = "LIBRARY_ID", referencedColumnName = "LIBRARY_ID") }) private ObjectA objectA; @ManyToOne(fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn(name = "ANOTHER_ID", referencedColumnName = "ANOTHER_ID"), @JoinColumn(name = "LIBRARY_ID", referencedColumnName = "LIBRARY_ID") }) private ObjectB objectB; @Column private String title; } @Embeddable public class BookKey implements Serializable { @Column(name = "BOOK_ID") private long bookId; @Column(name = "LIBRARY_ID") private long libraryId; } But I get this exception: Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: Book column: library_id (should be mapped with insert="false" update="false") I've tried using @IdClass instead of @Embeddable and @EmbeddedId, and I got this: Caused by: org.hibernate.DuplicateMappingException: Table [book] contains physical column name [libraryId] represented by different logical column names: [libraryId], [LIBRARY_ID] Any help? Thanks!
favorite count: 0
upvote count: 7
possible better answer: http://stackoverflow.com/a/38248310

http://stackoverflow.com/q/26541047
has body: I have 1 object(Goods) have 2 attributes: String and boolean. How to input object Goods to ArrayList&lt;HashMap&lt;String, Object&gt;&gt; ? Because I want input ArrayList&lt;HashMap&lt;String, Object&gt;&gt; to SimpleAdapter public class Goods { private String goodsName; private boolean isCheck = false; public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public boolean isCheck() { return isCheck; } public void setCheck(boolean isCheck) { this.isCheck = isCheck; } }
has answer: http://stackoverflow.com/a/26541296
downvote count: 0
score: 1
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/41706819
tagged with: java
has comment: http://stackoverflow.com/comment/41706949
has answer: http://stackoverflow.com/a/26541180
has comment: http://stackoverflow.com/comment/41706929
has comment: http://stackoverflow.com/comment/41706899
has comment: http://stackoverflow.com/comment/41707058
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41709990
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41706944
has title: How to input the objects to a ArrayList <HashMap<String,Object>>

http://stackoverflow.com/comment/41791272
has text: @RealSkeptic I am logged in with my credentials and I am recognised as an administrator of this host because I can download and do other things with admin login. I am not sure what you mean by how the servlet is served
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26587807

http://stackoverflow.com/a/26664212
downvote count: 0
has body: Your code is actually working: The line System.out.println(launcher); prints my.ioc.Launcher@2b7f535d Just on INFO: Loading XML bean definitions from class path resource [beans-annot.xml] my.ioc.Launcher@2b7f535d &lt;-------- окт 30, 2014 8:52:56 PM ….. The line System.out.println("invoke bean"); prints invoke bean just how is expected.. where? окт 30, 2014 8:52:56 PM ....ClassPathXmlApplicationContext doClose INFO: Closing org.springframework.context.support….root of context hierarchy invoke bean &lt;-------- [INFO] … Your application is so short or fast in be executed, that when it is executed, you are seeing the information or output of your own application together with the Spring starting/closing information. So both are printed together, your app and spring (starting/closing) process, so in this case, therefore, the terminal/console is giving the impression you have described. Try to enclose System.out.println("invoke bean"); within a Thread.sleep(5000) to delay in some way your application. About your XML application For each .xsd remove the version, i.e.: spring-beans-3.0.xsd to spring-beans.xsd. It is a good practice not include the version Remove &lt;context:annotation-config /&gt; is not necessary because you already have &lt;context:component-scan base-package="my.ioc" /&gt; declared, read the following: Difference between &lt;context:annotation-config&gt; vs &lt;context:component-scan&gt; for more details.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26659457
accepted answer of: http://stackoverflow.com/q/26659457
type: AcceptedAnswer

http://stackoverflow.com/q/26520623
score: 0
has answer: http://stackoverflow.com/a/26520674
answer count: 1
has comment: http://stackoverflow.com/comment/41670486
accepted answer: http://stackoverflow.com/a/26520674
type: AnsweredQuestion
tagged with: java
has body: Probably a pretty basic question: But how can I change the value of a boolean method in main? example: class question{ public boolean abc(){ return false; } } How do I go about making this method return true in my main class\or whatever? :D
has comment: http://stackoverflow.com/comment/41670397
tagged with: methods
type: Question
has title: how to change the value of a boolean method in main?
tagged with: boolean

http://stackoverflow.com/comment/42266271
type: Comment
comment on: http://stackoverflow.com/a/26649746
type: AnswerComment
has text: actually my problem is i have to use entity manager ...there i am not allowed to use session object.
score: 0

http://stackoverflow.com/comment/41714253
type: Comment
comment on: http://stackoverflow.com/a/26534250
score: 0
type: AnswerComment
has text: I obviously put too much emphasis on the phrase "where necessary". I figured it was absolutely unnecessary to wrap the line after the = sign, so I didn't even test it. Thanks for enlightening me.

http://stackoverflow.com/comment/106655883
comment on: http://stackoverflow.com/a/53917048
type: Comment
has text: some cases application.properties cannot see the properties changes.And i added properties.put like above and worked fine.Thx for reply.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41790540
type: Comment
type: QuestionComment
has text: Is this task from an assignment or homework? ;)
comment on: http://stackoverflow.com/q/26587550
score: 0

http://stackoverflow.com/comment/41779698
type: Comment
type: QuestionComment
has text: *"seeking in ogg play is not working"* What's it doing? Or not doing? Also `else if (previousStatus == PAUSED) { startPlayback(); pausePlayback(); }`? (I may be ignorant of how your program works but `start` -> immediately `pause` seems suspicious.)
comment on: http://stackoverflow.com/q/26527530
score: 0

http://stackoverflow.com/q/26613267
has title: Parse.com Data not saving to different tables/objects
has body: I'm using Parse.com service for an Android app (using eclipse adt) I'm trying to take student data from the app user and push the same to two different tables/classes (both are respectively created in the parse dashboard). Form is common, but details of the student goes to table named student, and text fields from marks go into 'marks' class/table But, the code doesn't save to the second table. It does however save to the first table. Kindly help. Code part is self explanatory. Here's my code: Java File package com.parse.starter; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.ParseAnalytics; import com.parse.ParseObject; public class ParseStarterProjectActivity extends Activity implements OnClickListener { private EditText et1,et2,et3,et4,et5,et6; private Button button1; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); et1 = (EditText) findViewById(R.id.editText1); et2 = (EditText) findViewById(R.id.editText2); et3 = (EditText) findViewById(R.id.editText3); et4 = (EditText) findViewById(R.id.editText4); et5 = (EditText) findViewById(R.id.editText5); et6 = (EditText) findViewById(R.id.editText6); button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub String name = et1.getText().toString(); String address = et3.getText().toString(); String mobile = et2.getText().toString(); String marks1 = et4.getText().toString(); String marks2 = et5.getText().toString(); String marks3 = et6.getText().toString(); ParseObject studentDetails = new ParseObject("Student"); ParseObject student = new ParseObject("marks"); studentDetails.put("name", name); studentDetails.put("address", addr…
type: AnsweredQuestion
tagged with: java
tagged with: mysql
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/26613337
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26613337
tagged with: android
tagged with: parse-platform

http://stackoverflow.com/q/26559475
type: Question
has body: Print an arrowhead. Let the user input how big the arrow should be by entering the total number of lines to draw. The user entered 9 in the example below. Prompt the user to enter an odd number only. It should model this: * ** *** **** ***** **** *** ** * So far my code looks like this: int i, j, numRows; Scanner reader=new Scanner(System.in); System.out.println("How many rows would you like the triangle to have?"); numRows=reader.nextInt(); //row for(i=1;i&lt;=numRows;i++){ //column for(j=1;j&lt;=i;j++){ System.out.print("*"); } System.out.println(); } } } this is the top half. i can make the bottom half by altering the nested loop. I know that I need to have the nested loop decrease the amount of stars after it reaches the middle column, or (i/2)+1, but I am not sure how to do this. I tried using an if statement with j-- inside of the column loop but either that is not correct or I made a mistake.
has comment: http://stackoverflow.com/comment/41739589
has comment: http://stackoverflow.com/comment/41739578
score: 0
has answer: http://stackoverflow.com/a/26559520
has answer: http://stackoverflow.com/a/26560719
has answer: http://stackoverflow.com/a/26559527
answer count: 4
has title: Printing an arrowhead of stars using nested for loops
has answer: http://stackoverflow.com/a/26559522
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/26581348
has answer: http://stackoverflow.com/a/26581406
has answer: http://stackoverflow.com/a/26581925
score: 0
has comment: http://stackoverflow.com/comment/41779279
tagged with: jsp
tagged with: tomcat
has title: The requested resource is not available. JSP program error
possible better answer: http://stackoverflow.com/a/26581406
has comment: http://stackoverflow.com/comment/41779224
has answer: http://stackoverflow.com/a/26581542
has answer: http://stackoverflow.com/a/26581402
answer count: 4
accepted answer: http://stackoverflow.com/a/26581402
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/11731377
tagged with: java
has body: I am trying my forst jsp login program. It shows the login page correctly, but when I submit it gives the error: HTTP Status 404 - /UserPass/username type Status report message /UserPass/username description The requested resource is not available. Here's my code: username.java package sid; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class username extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); String user=request.getParameter("username"); String pass=request.getParameter("password"); if(user.equals("sid") && pass.equals("hello")) { System.out.println("Welcome"); } else { System.out.println("Invalid username or password"); } } } user.jsp Insert title here Login Page User : Pass : web.xml login sid.username login /username/* My user.jsp code is in WebContect, and my web.xml is in WebContent/WEB-INF/lib. I am using Eclipse Indigo SR2 and Apache Tomcat.
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/11731377

http://stackoverflow.com/a/26614354
type: Answer
upvote count: 1
score: 1
has body: I want to be honest. I do not know why you are getting this error... I've just copied your code and compiled. After removing 2 to 3 braces and adding one, your code compiled without errors. I'm sure you are getting the error, you pasted into your question, from somewhere else. You have to apply some fixes: System.out.println("To what unit would you like to convert? "); int NAME_YOUR_VARS = input.nextInt(); And in a few places you are placing open braces infront of method headers: { public static double fromMeters(int unitNumber){ Or you forgot to close method bodys: public static String toMeters (int unitNumber) { switch(unitNumber) { /* case statements were cut out here*/ } //&lt;- Here you forgot a brace! Keeping track of code blocks and brace placing is very important!
downvote count: 0
answers question: http://stackoverflow.com/q/26614145

http://stackoverflow.com/a/26667666
has body: That's because your implementation is telling TreeMap that map[three] and map[four] are essentially the same element, because they are "equal" to each other according to your comparator. Change "return 0" in Comparator to "return s1.compareTo(s2)", and you'll have Before sorting: {two=2, one=1, three=3, four=3} After Sorting based on value:{one=1, two=2, four=3, three=3} (I believe you can figure out why "four" comes before "three" in this case)
score: 1
answers question: http://stackoverflow.com/q/26667590
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41666547
has text: Are you trying to tell us you want to print the content of the Vehicles array?
comment on: http://stackoverflow.com/q/26518411
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/41708782
has text: @JonSkeet Agreed but since `LinkedBlockingDequeue` extends `AbstractQueue` which is available in Java 5 and implements `BlockingDeque` which OP can introduce of his own there shouldn't be an issue.
score: 0
comment on: http://stackoverflow.com/q/26542210
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26532438
upvote count: 1
downvote count: 0
has body: Your problem is, in the 2nd loop, you still go from j=1 -&gt; k. You can simply do a k -&gt; 1 loop to get a reversed sequence. Also java has printf method, you may want to take a look.. Some example codes: int rows = 8; for (int r = 0; r &lt;= rows; r++) { System.out.print(new String(new char[rows - r]).replace("\0", " ")); int c = 0; for (int i = 0; i &lt;= r; i++) System.out.printf("%s%s", 1&lt;&lt;i, r == 0? "\n" : " "); if (r &gt; 0) for (int i = r-1; i &gt;= 0; i--) System.out.printf("%s%s", 1&lt;&lt;i, i == 0? "\n" : " "); } just adjust the rows to the value you like. I did a test with rows=8, it prints: 1 1 2 1 1 2 4 2 1 1 2 4 8 4 2 1 1 2 4 8 16 8 4 2 1 1 2 4 8 16 32 16 8 4 2 1 1 2 4 8 16 32 64 32 16 8 4 2 1 1 2 4 8 16 32 64 128 64 32 16 8 4 2 1 1 2 4 8 16 32 64 128 256 128 64 32 16 8 4 2 1
has comment: http://stackoverflow.com/comment/41707274
answers question: http://stackoverflow.com/q/26532111
type: Answer
score: 1

http://stackoverflow.com/a/26532960
has body: Deploy your application in your application server (jetty, tomcat, jboss/wildfly or whatever you're using). Then the web application would be accessible to all the PCs in the organization that are connected to the same LAN where the server is connected. Also, the people in the organization won't access to your application through localhost, but using the host name of your server: http://&lt;server_host_name&gt;:&lt;port&gt;/FirstSpringMVCProject/ Note that by deploying your application in an internal server, it is not deployed to the internet world, there are few more steps to achieve that.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26532879
upvote count: 1
answers question: http://stackoverflow.com/q/26532879
has comment: http://stackoverflow.com/comment/41712135

http://stackoverflow.com/comment/41734429
type: QuestionComment
score: 0
has text: @DuZi, I added a short video to see the problem with my app in my post.
comment on: http://stackoverflow.com/q/26554764
type: Comment

http://stackoverflow.com/comment/41770159
type: AnswerComment
comment on: http://stackoverflow.com/a/26575981
score: 0
type: Comment
has text: i think its the return value that's causing the problem. If i return an integer, then for printOneInLine(char[] words, int len) there won't be a value for char[] anymore. check: http://ideone.com/gUJhWR

http://stackoverflow.com/comment/41872840
comment on: http://stackoverflow.com/q/26629622
has text: initialise a variable to 362880 and then in a loop with i going from 9 to 0 print the variable and then divide by i.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41913759
score: 1
comment on: http://stackoverflow.com/q/26655567
type: Comment
type: QuestionComment
has text: You're not adding a new object like you think you are.

http://stackoverflow.com/q/26615064
possible better answer: http://stackoverflow.com/a/26615201
tagged with: java
has answer: http://stackoverflow.com/a/26615201
has body: I'm reading from a text file, like so: while ((line = br.readLine()) != null) { String[] a = line.split("\\: "); key = a[0]; action = a[1]; gameKeys.add(key, action); } where the file would be something like SPACE: FIRE_ACTION E: USE_ACTION This part works, key and action are both what I want. gameKeys is a Map declared like so: private static Map&lt;Keyboard.Key, Action&gt; gameKeys = new HashMap&lt;&gt;(); Keyboard.Key has fields such as SPACE, A, RETURN, etc. Action is an interface, that holds other actions; those actions have a toString() method that returns the action, e.g. new FireAction.toString() returns FIRE_ACTION. Example of an Action: public class FireAction implements Action { @Override public void execute() { System.out.println("Fire key pressed!"); } @Override public String toString() { return "FIRE_ACTION"; } } So, I'm trying to turn the file's components into objects, like if key was "SPACE" and action was "FIRE_ACTION", then, after the add method is performed, gameKeys would have &lt;Keyboard.Key.SPACE, new FireAction()&gt; Is there anyway I can do this?
type: Question
tagged with: object
has title: Comparing a String to an Object's toString() method dynamically
has answer: http://stackoverflow.com/a/26615169
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26615169
has answer: http://stackoverflow.com/a/26615383
tagged with: command
type: AnsweredQuestion

http://stackoverflow.com/comment/41740101
type: Comment
comment on: http://stackoverflow.com/q/26559666
score: 0
type: QuestionComment
has text: ok just tell me the code to type out in place of which line please

http://stackoverflow.com/a/26583808
has comment: http://stackoverflow.com/comment/41783398
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26583729
has body: What about this? .. Like TJ Crowder says, you don't have to convert it into a byte public static void main(String[] args) { int mByte = 67; String s = String.valueOf((char)mByte); System.out.println(s); } O/P : C
downvote count: 0

http://stackoverflow.com/a/26516395
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26516378
answers question: http://stackoverflow.com/q/26516378
has body: Try this: buusun.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { tf.setText(text.getText().substring(0, text.getText().length() - 1)); } }); It uses the string.substring(start, end) method. Note that you might need to adjust the exact variables you are using, as I'm not sure whether you need to get the value from tf or text, but this should provide the gist of what you want.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41725156
score: 1
has text: @sberezin well, parsing a query normally takes some time, e.g. for building an abstract syntaxt tree etc. Since the queries don't seem to change you could do that once and call the parsed queries just with updated parameters.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26551209

http://stackoverflow.com/comment/41827106
score: 0
type: Comment
has text: Thanks. I've considered this, but it leaves me with two problems. The first is that I'd like the user to be able to create an exercise named bench press (not a java create in the sense of new, but by passing in the name "Bench Press". The second is that I'd have a bunch of exercise classes ("BenchPress", "Squat", "DeadLift", etc that would all have the same implementation.
comment on: http://stackoverflow.com/a/26600452
type: AnswerComment

http://stackoverflow.com/comment/41937921
score: 1
has text: The usual way is to create a Name , Value, Code -> table and then a configuration table which links a code to a converter , Int , Long , String but That then makes your domain model troublesome.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26668154

http://stackoverflow.com/a/26574360
has comment: http://stackoverflow.com/comment/41767164
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41766346
answers question: http://stackoverflow.com/q/26574114
downvote count: 0
has body: You could use itertools.combinations as follows: import itertools pattern = "and" print len([''.join(i) for i in itertools.combinations('adnndaend',len(pattern) if ''.join(i) == pattern]) output: 6 idea is Generate all combinations of characters sequence using itertools.combinations and match them against your pattern; resulting list would have only matched items.
has comment: http://stackoverflow.com/comment/41766785
type: Answer

http://stackoverflow.com/a/26596106
has body: Problem solved with another parameter on my method: protected Dao&lt;C, Integer&gt; getDao(Context context, Class&lt;C&gt; clazz) { Dao&lt;C, Integer&gt; dao; try { dao = DatabaseHelper.getInstance(context).getDao(clazz); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
type: Answer
has comment: http://stackoverflow.com/comment/41806708
score: 0
answers question: http://stackoverflow.com/q/26595995

http://stackoverflow.com/comment/41830191
comment on: http://stackoverflow.com/a/26609105
has text: I'm still new to android/java so how would one fix this?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26576073
score: 0
tagged with: events
possible better answer: http://stackoverflow.com/a/58666204
tagged with: loading
has comment: http://stackoverflow.com/comment/70113000
has comment: http://stackoverflow.com/comment/41769790
has comment: http://stackoverflow.com/comment/41769926
has comment: http://stackoverflow.com/comment/70112491
has title: Hibernate Enable PostLoad Event
has comment: http://stackoverflow.com/comment/69938290
has comment: http://stackoverflow.com/comment/41781734
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/70112459
has comment: http://stackoverflow.com/comment/41782017
has comment: http://stackoverflow.com/comment/69996409
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/41453845
accepted answer: http://stackoverflow.com/a/41453845
has comment: http://stackoverflow.com/comment/41781663
has answer: http://stackoverflow.com/a/58666204
has comment: http://stackoverflow.com/comment/70114223
type: Question
answer count: 2
has body: I'm currently trying to use the @PostLoad Annotation for some processing after my model has been loaded from the database. But at the moment it looks like that my method won't get triggered. I don't use the EntityManager so I'm looking for a way to enable this event bahavior. My configuration looks like this: <hibernate-configuration> com.zaxxer.hikari.hibernate.HikariConnectionProvider true com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/testing root 1 org.hibernate.dialect.MySQL5Dialect update true false false thread 25 30000 jdbc:mysql://localhost:3306/testing root true 250 2048 true <mapping class="at.adtime.core.v1.model.User"/> <mapping class="at.adtime.core.v1.model.Test"/> </hibernate-configuration> Update: I have a method called afterUserLoad which looks like this: @PostLoad public void afterUserLoad() { ArrayList<String> computedIds = new ArrayList<String>(); for (Test test : this.Test) { computedIds.add(test.getId()); } this.setTestIds(computedIds); } It should load the Test List and put only the ids in an ArrayList.
has comment: http://stackoverflow.com/comment/41772130

http://stackoverflow.com/a/26599426
has comment: http://stackoverflow.com/comment/41859649
type: Answer
has comment: http://stackoverflow.com/comment/41839979
score: 0
has body: in your for loop you will really get outofbounds String newLine = ""; for (int i = 0; i &lt; line.length(); i++) { //in this line char letter = line.charAt(i+1); if (letter == 's') newLine += 'z'; else if (letter == 'S') newLine += 'Z'; else newLine += letter; } change it to: // minus another 1 index for (int i = 0; i &lt; line.length() - 1; i++) { //in this line char letter = line.charAt(i+1); if (letter == 's') newLine += 'z'; else if (letter == 'S') newLine += 'Z'; else newLine += letter; } and for your "dawg" function change it too: String newLine = " "; //minus 2 index for (int i = 0; i &lt; line.length()-2; i++) { char letter = line.charAt(i); if (line.charAt(i) == 's' &amp;&amp; line.charAt(i+1) == 'i' &amp;&amp; line.charAt(i+2) == 'r') { newLine +="dawg"; } } you are getting out of bounds because you are accessing an index out of the array using those "+1 or +2" in index.
answers question: http://stackoverflow.com/q/26599368

http://stackoverflow.com/q/26564846
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26564947
type: Question
type: AnsweredQuestion
has body: For my assignment I'm supposed make the program rock paper scissors which I figured that out my main problem is I can't get the program to play again right or get the program to calculate the game scores correctly pleas help I'm going crazy trying to figure this out?! //Tayler Dorsey import java.util.Random; import java.util.Scanner; public class PRS { static Scanner keyboard = new Scanner(System. in ); public static void instructions() { System.out.println("This is the popular game of paper, rock, scissors. Enter your\nchoice by typing the word \"paper\", the word \"rock\" or the word\n\"scissors\". The computer will also make a choice from the three\noptions. After you have entered your choice, the winner of the\ngame will be determined according to the following rules:"); System.out.println("Paper wraps rock (paper wins)\nRock breaks scissors (rock wins)\nScissors cuts paper (scissors wins)"); System.out.println("If both you and the computer enter the same choice, then the game is tied."); } public static int playGame() { int ties = 0, wins = 0, losts = 0; String userchoice, computerchoice; System.out.println("Enter your choice: "); userchoice = keyboard.next(); computerchoice = computerChoose(); System.out.println("You entered: " + userchoice); System.out.println("Computer choose: " + computerchoice); if ((userchoice.equals("paper") &amp;&amp; computerchoice.equals("paper")) || (userchoice.equals("rock") &amp;&amp; computerchoice.equals("rock")) || (userchoice.equals("scissors") &amp;&amp; computerchoice.equals("scissors"))) { System.out.println("IT'S A TIE!"); ties++; return 3; } else if ((userchoice.equals("paper") &amp;&amp; computerchoice.equals("rock")) || (userchoice.equals("rock") &amp;&amp; computerchoice.equals("scissors")) || (userchoice.equals("scissors") &amp;&amp; computerchoice.equals("paper"))) { System.out.println("YOU WIN!"); wins++; return 1; } else { System.out.println("YOU LOSE!"); losts++; return 2; } } public static String computerChoose() …
has answer: http://stackoverflow.com/a/26564883
tagged with: java
possible better answer: http://stackoverflow.com/a/26564892
accepted answer: http://stackoverflow.com/a/26564883
has answer: http://stackoverflow.com/a/26564892
favorite count: 0
has comment: http://stackoverflow.com/comment/41749083
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41749166
has comment: http://stackoverflow.com/comment/41749426
has title: Rock paper scissors, play again?
has comment: http://stackoverflow.com/comment/41749092

http://stackoverflow.com/comment/41748155
type: Comment
type: AnswerComment
has text: Thanks for the help, Ive edited the code to your suggestions and the answers are closer to being correct but they are still wrong? Any other suggestions?
score: 0
comment on: http://stackoverflow.com/a/26564157

http://stackoverflow.com/comment/41924338
comment on: http://stackoverflow.com/a/26660938
type: Comment
has text: @stackoverflow1 it's easier for newcomers to the language. But any developer with just a little bit of Java experience understands your original code just fine. Experienced Java developers would probably find the "simplified" code too verbose and introducing useless variables.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41715970
has text: Many logic are there, Actually i not clear in your aim, i gave a solution based on your question. If this answer is useful for you then put a +1 vote
type: Comment
comment on: http://stackoverflow.com/a/26546416
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41934986
score: 0
comment on: http://stackoverflow.com/q/26666688
has text: Can you post your searchForANumber(...) method?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41744231
has text: See also: http://stackoverflow.com/questions/7295096/what-exactly-is-java-ee
score: 2
comment on: http://stackoverflow.com/q/26561995
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26537366
has comment: http://stackoverflow.com/comment/41700857
has title: Looping around, getting no where :(
answer count: 0
tagged with: loops
type: Question
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has body: Well i tried to make a loop within a loop, kinda like that movie Inception. But it messes up some how, the second loop won't stop when i enter "N" for no, and won't go back to the the 1st loop, which is "Continue with another set?", when i enter "Y" for yes. Instead it keeps going back to the "What value to check?" no matter what :( while (true){ // 2. Ask the user for size of arbitrary numbers. System.out.print("Please enter a size for arbitray numbers: "); int size = indata.nextInt(); int [] SortedNumbers = new int [size]; // 3. Process arbitrary numbers and remove all duplicates int numDuplicates = generate_data(SortedNumbers); // 4. Print the numbers and number of duplicates printArray(SortedNumbers, numDuplicates); while (true){ // 5. Ask user for target value System.out.print("\nWhat target value to check? "); int target = indata.nextInt(); // 6. Perform linear and binary search int linearVal = linear_search(SortedNumbers,target); int binaryVal = binary_search(SortedNumbers,target); if (linearVal == -1) System.out.println("Linear search: " + target + " does not exist in the array."); else System.out.println("Linear search: " +target + " is in location " + linearVal); if (binaryVal == -1) System.out.println("Binary search: " + target + " does not exist in the array."); else System.out.println("Binary search: " +target + " is in location " + binaryVal); // 7. Repeat steps 5 and 6 until the user is satisfied. System.out.println("Continue? Y/N"); String answer = indata.next(); if (answer=="Y"){ break; } } // 8. Repeat steps 2-7 until the user is done working with different arbitrary sets of numbers. System.out.println("Continue with another set? Y/N"); String answer2 = indata.next(); if (answer2=="Y"){ break; } } So technically i need it to stop when i enter N, or ask me if i want "a new set" when i enter Y, and then on the second loop go back to "value to check" on N, or start from the beginning for Y.
score: 0
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41700476
has comment: http://stackoverflow.com/comment/41700417
tagged with: while-loop
type: UnansweredQuestion

http://stackoverflow.com/comment/41752196
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26566556
has text: Since you do not provide a sample regex and input, it is unsure what you ask; anyway, note that a `Matcher` can match more than once; so, if you have instantiated a `Matcher`, you can do `while (m.find()) /* do something */`
type: Comment

http://stackoverflow.com/comment/41849411
comment on: http://stackoverflow.com/a/26619133
score: 0
type: AnswerComment
has text: Also, methods in Java begin with a lower case letter by convention.
type: Comment

http://stackoverflow.com/comment/41696221
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26534524
has text: Please provide some quotes, as links come and go in the web

http://stackoverflow.com/q/26632094
downvote count: 3
accepted answer: http://stackoverflow.com/a/26632919
tagged with: swing
type: Question
type: AnsweredQuestion
has body: I want to make a simple layout, something like this: https://i.sstatic.net/7AIvt.png/ I can do this without Layout manager but I need use it. I tried to do it myself however I failed.
answer count: 2
has answer: http://stackoverflow.com/a/26632252
upvote count: 0
tagged with: layout
has comment: http://stackoverflow.com/comment/41872704
has answer: http://stackoverflow.com/a/26632919
favorite count: 0
possible better answer: http://stackoverflow.com/a/26632252
has title: Simple layout - java swing
score: -3
has comment: http://stackoverflow.com/comment/41872311
tagged with: java

http://stackoverflow.com/q/26604413
type: Question
score: -1
has answer: http://stackoverflow.com/a/26604522
has body: I have java code hosted in java 1.5 environment which acts like a client calling another third party restful webservices. Now I want to write unit test case in my application to mock the behavior the third party restful web services. Any thoughts on how to do this ? From the internet, I could see lot of tools available to do that but they require java > 1.6 . For example: rest-assured, restito etc... I have a strict limitation of using java 1.5 as the main classes have dependency on 1.5 version. My compile/runtime versions are 1.5 only Please share your thoughts
tagged with: mocking
has title: Restful web services unit testing/mocking in java 1.5 version
tagged with: mockito
answer count: 1
downvote count: 1
favorite count: 0
tagged with: rest
type: UnansweredQuestion
upvote count: 0
tagged with: java
tagged with: unit-testing

http://stackoverflow.com/comment/41737679
has text: You have an error then in code you're not showing us. Please fix this by showing us the relevant code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26558327
score: 0

http://stackoverflow.com/comment/41909359
type: QuestionComment
has text: Haven't got to OOP yet. Im sure I will be doing that in the next two weeks.
score: 0
comment on: http://stackoverflow.com/q/26653006
type: Comment

http://stackoverflow.com/q/26662161
has comment: http://stackoverflow.com/comment/41942186
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41926676
tagged with: geolocation
has answer: http://stackoverflow.com/a/26662946
has comment: http://stackoverflow.com/comment/41927169
has title: Java - Getting location (latitude, longitude) of a mailing address without communication over internet
has body: I have mailing addresses and need to convert them to coordinates (latitude, longitude) through a java program. The trouble is the program is not allowed to communicate over internet (probably due to privacy issues). I searched, and all I found are programs that make a call to Google map or other services, thus they all use internet. Any body knows anyway to achieve this through some code without internet? Any Java code that may use some libs or frameworks? If nothing is available in Java, then I can be open to other languages. I am reading about postgis now (suggested by a colleague). Not sure if it works, but if you know about this, please give some advice/code, etc. Note based on the commnent: If a DBMS knows how to convert an address to coordinates, then that works too because I can install the DBMS locally. Not sure if PostGis can do this Thanks
tagged with: java
tagged with: coordinates
type: Question
has comment: http://stackoverflow.com/comment/41926447
answer count: 1
tagged with: latitude-longitude
score: 0

http://stackoverflow.com/comment/41870796
has text: I put lazy fetch to both **Userentity** and **RoleUserentity** sides. But still have the problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/26625202
score: 0
type: Comment

http://stackoverflow.com/q/26550866
downvote count: 0
has answer: http://stackoverflow.com/a/38080451
has body: I am using Hibernate 4.2 and build time bytecode instrumentation for solve the lazy issue that appears on a @OneToOne relation and @Lob (https://developer.jboss.org/wiki/SomeExplanationsOnLazyLoadingone-to-one) Do you know what is the difference between : Hibernate bytecode instrumentation : http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch20.html#performance-fetching-lazyproperties Hibernate bytecode enhancement : http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch20.html#bytecode-enhancement Because on the hibernate documentation, it is written : The EnhancementTask is intended as a total replacement for InstrumentTask. Further, it is also incompatible with InstrumentTask, so any existing instrumented classes will need to be built from source again. I can solve my issue by using bytecode instrumentation but it doesn't works by using bytecode enhancement. Do you know why ? Maybe, this new feature is not fully developped ? Thanks for your helps.
favorite count: 0
has title: Hibernate - Difference between bytecode instrumentation and bytecode enhancement?
tagged with: lazy-loading
upvote count: 24
accepted answer: http://stackoverflow.com/a/38080451
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
score: 24
type: Question
answer count: 1

http://stackoverflow.com/a/26646855
has comment: http://stackoverflow.com/comment/41899060
answers question: http://stackoverflow.com/q/26646736
has comment: http://stackoverflow.com/comment/41898805
type: Answer
accepted answer of: http://stackoverflow.com/q/26646736
has comment: http://stackoverflow.com/comment/41905428
has comment: http://stackoverflow.com/comment/41907166
has comment: http://stackoverflow.com/comment/41898777
has body: The maximum length of an string array in Java is Integer.MAX_VALUE - 5. (Checked with my 64-bit OS with this initialization: String[] myStringArray = new String[Integer.MAX_VALUE-5];. Integer.MAX_VALUE-4 or bigger numbers gives me java.lang.OutOfMemoryError error. The limit can be different for you, since it is machine and OS dependent). Even if you go beyond that, you will see java.lang.OutOfMemoryError, not java.lang.ArrayIndexOutOfBoundsException. The problem is definitely with other part of your code.
has comment: http://stackoverflow.com/comment/41898831
score: 4
has comment: http://stackoverflow.com/comment/41899045
upvote count: 4
has comment: http://stackoverflow.com/comment/41898792
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41899078
has comment: http://stackoverflow.com/comment/41898945

http://stackoverflow.com/comment/41933346
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26651667
has text: you don't understand my means:I want dynamic update all my models,like User class, Product class and so on.So can't use the a specific Class ,mybe the Model class is fine;Also I think the key in the set method,I make break point in it and it changes the object's property ,but after this function finished,the data in database not changes

http://stackoverflow.com/comment/41822400
has text: Please always read and try to understand JavaDoc for all methods you are using.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26604590
type: Comment

http://stackoverflow.com/comment/41786865
has text: One big advantage of canonical `Predicate.alwaysTrue()` and `Predicate.alwaysFalse()` instances is, that they could be recognized by combining methods like `Predicate.or`, `Predicate.and`, and `Predicate.negate()`. This would allow to pre-initialize `Predicate` variables with `alwaysTrue()` and add predicates by combining via `and` without overhead. Since lambda expressions have no object identity guaranty, this might fail with `x->true`. By the way, if I have a class `X` with a `static` method `y(){return true;}`, using `X::y` is even shorter than `x->true` but not really recommended…
comment on: http://stackoverflow.com/a/26553481
type: Comment
score: 32
type: AnswerComment

http://stackoverflow.com/comment/41750007
score: 0
has text: The semantics of semaphores are well-defined, and have been since the 1970's.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562363

http://stackoverflow.com/comment/41781632
has text: From a separate class. called the MVAP_DisplaySearchResults class. new MVAP_PlayVideo();
comment on: http://stackoverflow.com/q/26581729
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41767953
score: 1
type: Comment
type: QuestionComment
has text: `PrintWriter` implements `Appendable` so it has `append()` method.
comment on: http://stackoverflow.com/q/26575009

http://stackoverflow.com/comment/41781382
type: QuestionComment
has text: Use a BlockingQueue. You don't need to use wait and notify when using a BlockingQueue. The Queue will wait and notify threads. The consumer simply gets items from the queue, and the queue blocks it until there is an item available. The producer simply puts items in the queue, and is blocked by the queue until there is space left in the queue (if it's bounded).
score: 2
type: Comment
comment on: http://stackoverflow.com/q/26582517

http://stackoverflow.com/a/26640322
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41888549
accepted answer of: http://stackoverflow.com/q/26640280
upvote count: 2
answers question: http://stackoverflow.com/q/26640280
has body: Remove the semi-colon for (x = 0; x &lt; stringLength; x++); ^ which is terminating the for loop. Same for the semi-colon terminating the if statement if (Character.isWhitespace(c)); ^ and please use braces to surround control blocks
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41887651
has comment: http://stackoverflow.com/comment/41888033

http://stackoverflow.com/comment/41729763
type: Comment
comment on: http://stackoverflow.com/q/26553443
has text: We really need to see the rest of the code. Especially the class that mQuestionBank is an array of.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41801097
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26591896
has text: @John but it implies writing a HQL, isn't it? Or is it possible to retrieve an entity based on a unique constraint?
score: 0

http://stackoverflow.com/comment/41739435
type: Comment
comment on: http://stackoverflow.com/a/26559344
has text: it doesn't work, there is a "the" in the text file. " This program will read a text file with 50 random words What word would you like to look up that may be repeated: the No word found in the text file. "
type: AnswerComment
score: 0

http://stackoverflow.com/a/26584242
downvote count: 0
answers question: http://stackoverflow.com/q/26583876
score: 8
upvote count: 8
type: Answer
has body: JDBC is like any driver mechanism - ahead of time the folks and Sun (now Oracle) defined the interface (or contract) that Java would use to interact with a database. It was then the responibility of the database vendors to provide implementations of that interface in order for their particular database to be used with Java. The take away here is that the JDBC API defines the standard interface through which Java will interact with a database, the obvious benefit being that, providing your code only uses the JDBC API, it will be reasonably uniform regardless of the database you use, meaning you can therefore swap one implementation with another (although it's not always that simple in practice). With regards to how implementations of the JDBC API are registered with the java.sql.DriverManager, what used to happen was that your code would need to explicitly load the class(es) implementing java.sql.Driver; the act of loading the class caused it to be registered with the java.sql.DriverManager. This mechanism has now be replaced with the service provider but the end result is still the same: One or more implementations of java.sql.Driver are registered with the java.sql.DriverManager. If you then look at the source code for java.sql.DriverManager.getConnection(String) you will see that it simply loops through the registered drivers until it finds one that accepts the connection url at which point the java.sql.DriverManager calls the java.sql.Driver.connect(String, Properties) method, returning a specific implementation of java.sql.Connection.

http://stackoverflow.com/comment/41838736
type: QuestionComment
comment on: http://stackoverflow.com/q/26613579
has text: This looks like you're looping around, creating a new scanner on each iteration. And yes, closing scanners is a good idea :)
score: 1
type: Comment

http://stackoverflow.com/q/26649133
tagged with: return
possible better answer: http://stackoverflow.com/a/26650645
has answer: http://stackoverflow.com/a/26649643
accepted answer: http://stackoverflow.com/a/26649643
has comment: http://stackoverflow.com/comment/41902761
has title: Java using if statements and kb.hasNextInt/kb.nextLine to find if the user entered a string or a integer
tagged with: java
tagged with: methods
linked to: http://stackoverflow.com/q/7056749
downvote count: 1
tagged with: switch-statement
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41902721
has answer: http://stackoverflow.com/a/26649844
tagged with: if-statement
has answer: http://stackoverflow.com/a/26650645
score: -1
answer count: 3
upvote count: 0
favorite count: 0
has body: I am trying to write a program that will get a date from the user and the user can enter the month as a String ("july") or as a number (7). The code works fine when the user gives an integer for the month but when the user gives the month as a string the program says: Exception in thread "main" java.util.InputMismatchException and then ends. I think theres a syntax error or something in the main method but I am not sure... Sorry I included so much of my code... I don't really know where the problem is. import java.util.*; public class DateHoliday{ public static void main(String[] args) { Scanner kb = new Scanner(System.in); //declare varaiables for month, day and year int monthNumber, day, year; String, monthString, holiday; System.out.print("This program will ask you for a month, day, and year\n"); System.out.print("and will print the corresponding date in two standard date formats.\n"); int repeat = kb.nextInt(); //ask the user how many times to run the code System.out.print("How many times do you want to run the code:"); for (int i = 1; i &lt;= repeat; i++){ //prompt the user to enter the month System.out.print("Please note, you may enter the month as:\nA numeric value (1-12)\n"); System.out.print("an unabbreviated month name (January etc....)\nEnter the month:"); //check to see if the user is entering an integer for the month if(kb.hasNextInt()) { //read the month as an integer monthNumber = kb.nextInt(); //call the method to convert the month to a string getMonthString(monthNumber); } else { //read the month as a String monthString = kb.nextLine(); //call the method to convert it to an integer monthNumber = getMonthNumber(monthString);//I THINK THIS IS THE PROBLEM } //get the day from the userS ; System.out.print("Enter the day:"); day = kb.nextInt(); //get the year from the user; System.out.print("Enter the year:"); year = kb.nextInt(); // call the method to get the holidays assosiated with the given date // display the desired output in the given format holid…

http://stackoverflow.com/a/26616798
has comment: http://stackoverflow.com/comment/41846391
has comment: http://stackoverflow.com/comment/41846499
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41846371
has comment: http://stackoverflow.com/comment/41854938
has comment: http://stackoverflow.com/comment/41845346
has comment: http://stackoverflow.com/comment/41845204
has comment: http://stackoverflow.com/comment/41847765
accepted answer of: http://stackoverflow.com/q/26616562
type: Answer
has body: 1) it starts the way it does because you didn't set anything for it at first. You could do something like num.setText(Integer.toString(counter [0])); right after calling it by its id. Notice that you only set some text to num when you increase or decrease 2) I believe it's related with the fact that you substract no matter what. You should have the subtract operation inside your second if statement. The way you have it right now it allows you to go as far as you want before zero, but it won't show because your if evaluates if it's greater than or equal to zero, and because it's not, it doesn't show 3) Not sure what you mean, but you could do num.getText().toString() and parse it to an integer or keep it like that. That will get you what's on your num textview when you call it
has comment: http://stackoverflow.com/comment/41847048
has comment: http://stackoverflow.com/comment/41846789
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41847689
answers question: http://stackoverflow.com/q/26616562

http://stackoverflow.com/comment/41687928
comment on: http://stackoverflow.com/a/26530128
has text: How many iterations does it have, and what query are you actually running with that named query?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41908171
type: Comment
has text: Note: If you want to read a file from your plugin you don't use `IFile`, there is a separate API for reading plugin files.
score: 1
comment on: http://stackoverflow.com/q/26652141
type: QuestionComment

http://stackoverflow.com/q/26590672
has answer: http://stackoverflow.com/a/26590943
type: Question
answer count: 1
has body: I am working on a school assignment and I have the following question: I am given a number of sticks (with distinct or similar length), and am tasked to find out the minimum number of sticks required to form a longer stick of given length. For instance, Given 6 sticks of length 1,1,1,1,1,3 to form a longer stick of length 5, the output would be 3. NOTE: Sticks cannot be reused. However, if it is impossible to form the given length, output -1. For instance, Given 3 sticks of length 1,2,6, to form a longer stick of length 5, output would be -1. I have the following code, which have passed all public test cases. However, I failed the private test cases which I cannot figure out my mistake. Here's my code: import java.util.*; class Result { static int min = 100000; public static int solve(int pos, int currSum, int len, int numStk) { // implementation for (int i=1; i&lt;=Stick.data.length - pos; i++){ if (currSum &gt; len){ continue; } else if (currSum &lt; len){ if (pos+i &gt;= Stick.data.length){ break; } else{ solve(pos+i,currSum+Stick.data[pos+i], len, numStk+1); } } else if (currSum == len){ if (numStk &lt; min){ min = numStk; } } } return min; } } class Stick { static int[] data; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sticks = sc.nextInt(); data = new int[sticks]; int len = sc.nextInt(); for (int i=0; i&lt;sticks; i++){ data[i] = sc.nextInt(); } for (int i=0; i&lt;sticks; i++){ Result.solve(i,0,len,1); } if (Result.min == 100000){ System.out.println(-1); } else { System.out.println(Result.min-1); } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/41796916
has comment: http://stackoverflow.com/comment/41796332
accepted answer: http://stackoverflow.com/a/26590943
has comment: http://stackoverflow.com/comment/41796715
has comment: http://stackoverflow.com/comment/41796322
downvote count: 2
has comment: http://stackoverflow.com/comment/41796227
upvote count: 1
has comment: http://stackoverflow.com/comment/41796248
type: AnsweredQuestion
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/41796249
has title: Need help to spot flaws in my java code
score: -1

http://stackoverflow.com/comment/41708972
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26542359
type: Comment
has text: @jupiter dont put answer here.

http://stackoverflow.com/q/26614135
type: AnsweredQuestion
score: 2
has title: How to add a table, with one row made of JComboboxes, on top an existing JTable
tagged with: java
has comment: http://stackoverflow.com/comment/41913564
has comment: http://stackoverflow.com/comment/41916187
type: Question
has comment: http://stackoverflow.com/comment/41913654
has answer: http://stackoverflow.com/a/26673891
tagged with: jtable
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41914781
has comment: http://stackoverflow.com/comment/41914523
accepted answer: http://stackoverflow.com/a/26673891
favorite count: 0
has comment: http://stackoverflow.com/comment/41914918
upvote count: 2
tagged with: swing
tagged with: tablecellrenderer
tagged with: jcombobox
has body: I am trying to add a one row JTable on top of an existing JTable which is usually created dynamically and which changes its data model quite often. As you can see the yellow area represents just a row counter and It has been created using this source The yellow column, therefore has been attached to the main table using the following code: JTable rowTable = new RowNumberTable(table); scrollTable.setRowHeaderView(rowTable); The table columns A, B, C, and so on, if clicked, sort the JTable accordingly and this feature should be maintained (I do not want to put the JCombobox in the table header unless there is a clever way of doing both things). My aim is to create a JTable with one row (See red row) which has as many columns as the main JTable EDIT Here there is the SSCCE I would like to put JComboBoxes on top of A,B,C,D..... The class that renders the JComboBoxes is ColumnJComboBoxTable which is called in TableDemo as follow: //Column JCombobox JTable columnTable = new ColumnJComboBoxTable(table); scrollTable.setColumnHeaderView(columnTable); Right now it is not working as I want (Well, It is not working at all) Buttons at the top add and remove columns. Therefore if a column is deleted the respective JComboBox must be deleted too. CODE TableDemo package com.table; import javax.swing.*; import javax.swing.table.*; import java.awt.*; import java.awt.event.*; import javax.swing.AbstractAction; public class TableDemo extends JFrame { private static final long serialVersionUID = 1L; public TableDemo() { super("TableDemo"); Object[][] data = { {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0","1","2","3","4","5","6","7","8","9","10"}, {"0"…

http://stackoverflow.com/comment/41898980
has text: Perhaps that's how the compiler would have been written. By default without braces, the scope is just one line. So what's the point of declaring any variable **for just one line**? Isn't it a smarter strategy to throw a compilation error... hey! you might be wanting to do something else, did you forget the braces ?
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/26646887

http://stackoverflow.com/comment/41757398
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26561079
score: 0
has text: With the Filter example you can simple change the `@Logged` annotation (which is an annotation I created) to `@Foo`. The `LoggingBinder` class is what binds all the methods/classes annotated with `@Logged/@Foo` to the filter. Logging is a common use case for the JAX-RS fitlers

http://stackoverflow.com/comment/41802237
type: QuestionComment
has text: What do you mean by get confirmation from the user? You mean like get a window to pop up asking if the user is sure they want to close?
score: 0
comment on: http://stackoverflow.com/q/26593768
type: Comment

http://stackoverflow.com/comment/41787070
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26585763
has text: 1. for better help sooner post an SSCCE/MCVE short, runnable, compilable, just about described issue, 2. good explained in offical Oracle tutorial Graphics2D
type: Comment

http://stackoverflow.com/a/26602352
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26561350
answers question: http://stackoverflow.com/q/26561350
has body: solved it by doing the factory reset of the micromax A110

http://stackoverflow.com/a/31008840
downvote count: 0
score: 4
type: Answer
has body: In my case I was following an example. Finally I only needed to add this dependency org.glassfish.jersey.containers jersey-container-jdk-http (remember the exception's message "No container provider supports the type interface com.sun.net.httpserver.HttpHandler"): org.glassfish.jersey.containers jersey-container-jdk-http 2.18 You could change the version according your environment.
answers question: http://stackoverflow.com/q/26542268
upvote count: 4

http://stackoverflow.com/q/26640800
has body: I am new to Java. I know the basics and i have 2 questions that if they are answered they will really help me in programming. Here's my code: package RollPack; import java.util.Random; public class RollClass { static int result; public static void main(String[] args){ DerpRandom(); } static void DerpRandom(){ Random rand = new Random(); result = rand.nextInt(7); System.out.println("You rolled a: "+result); DerpResult(result); } static void DerpResult(int result){ if (result &lt; 7){ System.out.println("Yeh, it works.."); } } } My questions: What does DerpRandom(); mean in words? What does DerpResult(result); mean in words? I mean, by writing DerpResult(result), does it mean that it adds result to DerpResult? What does it mean?
answer count: 4
favorite count: 0
downvote count: 2
upvote count: 1
has title: Some basic questions about Java
has answer: http://stackoverflow.com/a/26640892
type: AnsweredQuestion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26640902
type: Question
has answer: http://stackoverflow.com/a/61469339
possible better answer: http://stackoverflow.com/a/26640892
has answer: http://stackoverflow.com/a/26640952
accepted answer: http://stackoverflow.com/a/26640952

http://stackoverflow.com/comment/41715890
type: Comment
score: 0
type: QuestionComment
has text: @VighaneshGursale how can i check if other threads are alive?
comment on: http://stackoverflow.com/q/26546397

http://stackoverflow.com/q/26584426
has comment: http://stackoverflow.com/comment/41784492
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41784628
has answer: http://stackoverflow.com/a/26584449
has answer: http://stackoverflow.com/a/26584691
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41784501
type: Question
answer count: 2
downvote count: 4
has title: Java throwing Error and catching NullPointerException
has body: This is something that doesn't make sense to me. First example: EXAMPLE 1 (GOOD): public static void main(String args[]){ try { Exception e = null; throw e; } catch (Exception e) { } Everything is fine with ths code - exception is thrown and catched. EXAMPLE 2 (BAD): public static void main(String args[]){ try { Exception e = null; throw e; } catch (NullPointerException e) { } } This will not compile because catch block can't catch NullPointerException which is subclass of Exception. It doesn't know what kind of exception will be thrown. java.lang.Object java.lang.Throwable java.lang.Exception --&gt; Thrown java.lang.RuntimeException java.lang.NullPointerException --&gt; Cannot catch like this So let's change exception to NullPointerException: EXAMPLE 3 (GOOD) public static void main(String args[]) { try { NullPointerException e = null; throw e; } catch (NullPointerException e) { } Simple and logical, But here comes something really weird: EXAMPLE 4 (GOOD) - no idea why ?: public static void main(String args[]) { try { Error e = null; throw e; } catch (NullPointerException e) { } If I throw an Error, how can I catch NullPointerException? It makes no sense. There is: Throwable: Error, Exception Both Error and Exception are sub-classes of Throwable, but NullPoinTerException has nothing to with Error, it's an Exception, not Error.
has comment: http://stackoverflow.com/comment/41784858
favorite count: 0
upvote count: 5
tagged with: nullpointerexception
tagged with: exception
has comment: http://stackoverflow.com/comment/41784775
has comment: http://stackoverflow.com/comment/41784522

http://stackoverflow.com/comment/48940564
comment on: http://stackoverflow.com/q/26579254
has text: @GregGiacovelli, [getLastCustomNonConfigurationInstance](http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html#getLastCustomNonConfigurationInstance())
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/26601169
has body: refer this link. I think the below command will run correctly. Make sure all your dependency jar files in the path /home/user1/tnpm/ 0/15 * * * * java -jar /home/user1/tnpm/tnpm_pm_test.jar &amp;&gt; /dev/null or 0/15 * * * * /usr/bin/java -jar /home/user1/tnpm/tnpm_pm_test.jar &amp;&gt; /dev/null
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26600867
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41816542

http://stackoverflow.com/comment/63973570
type: Comment
comment on: http://stackoverflow.com/a/26553481
score: 1
type: AnswerComment
has text: @GarretWilson `Optional` not being `Serializable` was on the other hand a deliberate design decision to keep the compatibility "surface area" of `Optional` to a minimum; having a serial form increases that surface area considerably. That would potentially add risk to the eventual transition of `Optional` to be a value type, work which is still ongoing.

http://stackoverflow.com/q/26569302
upvote count: 1
tagged with: liquibase
has comment: http://stackoverflow.com/comment/41758809
answer count: 1
tagged with: openshift
has comment: http://stackoverflow.com/comment/41757910
tagged with: java
has answer: http://stackoverflow.com/a/26577467
has body: I am trying to run the liquibase update from Openshift machine that I have. It looks like > java -jar ~/.m2/repository/org/liquibase/liquibase-core/3.1.1/liquibase-core-3.1.1.jar --driver=org.postgresql.Driver --classpath=wildfly/standalone/deployments/ROOT.war --changeLogFile=liquibase/changelog.xml --url="jdbc:$OPENSHIFT_POSTGRESQL_DB_URL/mydb" --username=$OPENSHIFT_POSTGRESQL_DB_USERNAME --password=OPENSHIFT_POSTGRESQL_DB_PASSWORD update and I see the following error Liquibase update Failed: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql://admin:29asDVjpFxYl6@127.8.201.2:5432/mydb with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL What is going wrong here? I am using the following postgreSQL dependency postgresql postgresql 9.1-901-1.jdbc4
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41757754
score: 1
has comment: http://stackoverflow.com/comment/41760711
favorite count: 0
tagged with: postgresql
type: Question
accepted answer: http://stackoverflow.com/a/26577467
has title: PostgreSQL + Openshift: Possibly the wrong driver for the given database URL?
tagged with: jdbc

http://stackoverflow.com/q/26547731
answer count: 2
has comment: http://stackoverflow.com/comment/41718528
has body: addItem = new JButton("Add"); gc.gridwidth = GridBagConstraints.RELATIVE; gc.weightx = 1.0; panel.add(addItem, gc); Am I able to make it into something like that: addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler&lt;MouseEvent&gt;() { public void handle(MouseEvent me) { Instead of this I would want that button, but I have no idea what does that addItem do, since it does not let me to add a name there. Is there a way how I can do this without modifying the 4 rows of code given at the beginning of the question?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26547914
has title: How to add MousePressed Eventhandler to addItem new JButton
upvote count: 1
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/26547925
tagged with: jbutton
type: Question
tagged with: java
tagged with: mouseevent
score: 0

http://stackoverflow.com/comment/41866703
score: 0
has text: I don't understand the comment
comment on: http://stackoverflow.com/a/26628180
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26652800
has answer: http://stackoverflow.com/a/26674962
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41948543
accepted answer: http://stackoverflow.com/a/26674962
has comment: http://stackoverflow.com/comment/41910358
tagged with: spring
tagged with: spring-mvc
has body: Having loaded the Consuming REST Quick Start without any apparent problem, I am unable to build the project. Following is the error message from Spring Tool Suite: [INFO] Scanning for projects... [INFO] Downloading: http://repo.spring.io/libs-release/org/springframework/boot/spring-boot-starter-parent/1.1.8.RELEASE/spring-boot-starter-parent-1.1.8.RELEASE.pom [INFO] Downloading: http://central.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.1.8.RELEASE/spring-boot-starter-parent-1.1.8.RELEASE.pom [ERROR] The build could not read 1 project -&gt; [Help 1] [ERROR] [ERROR] The project org.springframework:gs-consuming-rest:0.1.0 (/Users/matthewbrown/Documents/workspace/gs-consuming-rest-initial/pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.1.8.RELEASE from/to spring-releases (http://repo.spring.io/libs-release): connect timed out and 'parent.relativePath' points at wrong local POM @ line 10, column 13 -&gt; [Help 2] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
has title: Unable to build Spring Tool Suite Quick Start
upvote count: 1
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41949054
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/26666019
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26665933
has body: This is a working example: import java.util.Arrays; public class test{ public static int [] concat (int [] nums1, int [] nums2) { int length = nums1.length+nums2.length; int nums3 [] = new int [length]; for (int i=0; i&lt;nums1.length; i++) { nums3[i] = nums1[i]; } // You can start adding to nums3 where you had finished adding // in the previous loop. for (int i=nums1.length; i&lt; nums3.length; i++) { // (i - nums1.length) will give you zero initially and // ends with nums2.length by the time this loop finishes nums3[i]= nums2[i - nums1.length]; } return nums3; } public static void main(String[] args) { int[] temp = {1,2,3,4}; int[] temp2 = {1,2,3,4}; System.out.println(Arrays.toString(concat(temp,temp2))); } } You can also use the method addAll in ArrayUtils to add them together as noted in this thread Arrayutils thread , but if you want to write out the method explicitly then this should work.
answers question: http://stackoverflow.com/q/26665933

http://stackoverflow.com/comment/41660087
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26513888
score: 3
has text: Since port 465 is SMTPS it will expect the SSL handshake immediatly and will not expect a STARTTLS command to upgrade a plain connection. Thus `mail.smtp.starttls.enable` should be false. Also, `mail.smtp.ssl.enable` should be true.

http://stackoverflow.com/comment/41852122
comment on: http://stackoverflow.com/a/26619822
type: AnswerComment
type: Comment
has text: Apple is still supporting Java 6 in a limited way. They did release a new version earlier this year (2014).
score: 0

http://stackoverflow.com/q/26542967
tagged with: java
has body: I'm trying to write android diet planner. after I debug it I find when my first page fade out and activity want to go to the second page then fatal error exception occurs but I cant find where is the problem? can any one help me ? ERRORS 10-24 06:35:46.622: E/AndroidRuntime(1102): FATAL EXCEPTION: main 10-24 06:35:46.622: E/AndroidRuntime(1102): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dietplanneraplication/com.example.dietplanneraplication.FeatureList}: java.lang.NullPointerException 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.app.ActivityThread.access$600(ActivityThread.java:130) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.os.Handler.dispatchMessage(Handler.java:99) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.os.Looper.loop(Looper.java:137) 10-24 06:35:46.622: E/AndroidRuntime(1102): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-24 06:35:46.622: E/AndroidRuntime(1102): at java.lang.reflect.Method.invokeNative(Native Method) 10-24 06:35:46.622: E/AndroidRuntime(1102): at java.lang.reflect.Method.invoke(Method.java:511) 10-24 06:35:46.622: E/AndroidRuntime(1102): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 10-24 06:35:46.622: E/AndroidRuntime(1102): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-24 06:35:46.622: E/AndroidRuntime(1102): at dalvik.system.NativeStart.main(Native Method) 10-24 06:35:46.622: E/AndroidRuntime(1102): Caused by: java.lang.NullPointerException 10-24 06:35:46.622: E/AndroidRuntime(1102): at com.example.dietplanneraplication.FeatureList.onCreate(…
has comment: http://stackoverflow.com/comment/41710240
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41710569
type: Question
has comment: http://stackoverflow.com/comment/41710013
has comment: http://stackoverflow.com/comment/41710375
tagged with: android-layout
has comment: http://stackoverflow.com/comment/41710188
has comment: http://stackoverflow.com/comment/41709863
upvote count: 3
has comment: http://stackoverflow.com/comment/41710130
has title: Fatal error exception in android
accepted answer: http://stackoverflow.com/a/26543412
answer count: 1
has comment: http://stackoverflow.com/comment/41710486
has comment: http://stackoverflow.com/comment/41710343
favorite count: 0
has answer: http://stackoverflow.com/a/26543412
downvote count: 2
has comment: http://stackoverflow.com/comment/41709915
tagged with: android
has comment: http://stackoverflow.com/comment/41709977
tagged with: fatal-error
has comment: http://stackoverflow.com/comment/41710397
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41710066
score: 1
has comment: http://stackoverflow.com/comment/41710419

opennlp
type: Tag
tags question: http://stackoverflow.com/q/26583483
tag name: opennlp

http://stackoverflow.com/comment/41862596
type: QuestionComment
has text: @Mithfindel Of course, sorry, question updated
score: 0
comment on: http://stackoverflow.com/q/26620609
type: Comment

http://stackoverflow.com/comment/41937070
type: Comment
has text: Think about it like this, when you want to browse the internet, do you need to start a web server first? No, they run on some other computer which you can access (via some wire and a protocol). Same concept. You start the database server on a central computer and setup the connection URL to point to that computer...
comment on: http://stackoverflow.com/q/26667249
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41745719
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26542250
has text: Eh, why not just left pad up to 3 digits using zero digits and split on 3 digits each?
type: AnswerComment

http://stackoverflow.com/q/26552279
type: AnsweredQuestion
tagged with: build
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/28928118
tagged with: gradle
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/28928118
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41727136
tagged with: android
answer count: 1
favorite count: 0
has body: I've just updated one of my projects to Android L with the new build-tools 21.0.2 and the new gradle 2.1. Now as soon as i build the project on my system i get the following exception: import com.tundem.aboutlibraries.R; ^ symbol: class R location: package com.tundem.aboutlibraries java.lang.NullPointerException at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:83) at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:44) at com.sun.tools.javadoc.ClassDocImpl.superclassType(ClassDocImpl.java:496) at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:459) 4 warnings at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:497) at com.sun.tools.doclets.internal.toolkit.util.ClassTree.processType(ClassTree.java:194) at com.sun.tools.doclets.internal.toolkit.util.ClassTree.buildTree(ClassTree.java:146) at com.sun.tools.doclets.internal.toolkit.util.ClassTree.&lt;init&gt;(ClassTree.java:91) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:123) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83) at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63) at com.sun.tools.doclets.standard.Standard.start(Standard.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280) at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160) at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397) at com.sun.tools.javadoc.Start.begin(Start.java:167) at com.sun.tools.javadoc.Main.execute(Main.java:59) at com.sun.tools.javadoc.Main.main(Main.java:49) :sample:lintVitalRelease FAILED FAILURE: Build failed with an exception. *…
has title: Gradle Build fails with Javadoc NullPointerException
has comment: http://stackoverflow.com/comment/41727164

http://stackoverflow.com/a/26669891
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41944977
accepted answer of: http://stackoverflow.com/q/26668154
answers question: http://stackoverflow.com/q/26668154
type: Answer
has body: Although @Evan Knowles has a good point with the Composite_pattern from Structural side. Another possible solution can be Factory Method from Creational side. Since it allows you to create an instance of several derived classes. Also defines an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. I think that what is this question all about (maybe I'm wrong) is said here: some kind of design pattern to follow for creating table in database and writing code So If I'm correct, what you need is more ORM-related. But you need to know why you want to add abstraction on top of JDBC. If just derivation is the main problem then you can consider paying more attention to your Model and less to organizing the DB tables. Both ways - this list will be helpful (under Java section).

http://stackoverflow.com/q/26521810
has answer: http://stackoverflow.com/a/26522893
has title: Java ChargeAccount program array
has body: I am new to java. Working in the book titled starting out with java from control structure through objects. My assignment is as followed: create a class method that accepts a charge account number as its argument. The method should determine whether the number is valid by comparing it to the following list of valid charge account numbers: 5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 8080152, 4562555, 5552012, 5050552, 7825877, 1250255, 1005231, 6545231, 3852085, 7576651, 7881200, 4581002\ These numbers should be stored in an array or an ArrayList object. Use a sequential search to locate the number passed as an argument. if the number is in the array, the method should return true, indicating the number is valid. if the number is not in the array, the method should return false, indicating the number is invalid. My question goes along, is the program I have enough, or do I have to create a separate class? the problem i'm having is this chapter seems different from the previous. we just got done with chapter 6 which was classes and that required me to make a main project and a constructor. my question is, are arrays just one program? or am i missing something. the program seems to run okay. if you could clear this up for me that would be awesome. My question is: in chapter 6, I had to create two programs. One the main and second the class for example. One was the constructor, the other was the main in which it spoke to the constructor. Do arrays require two programs or is the program I wrote sufficient enough? the program code is import java.util.Scanner; public class ChargeAccount { static int[] validChargeAccountNumbers = { 5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 8080152, 4562555, 5552012, 5050552, 7825877, 1250255, 1005231, 6545231, 3852085, 7576651, 7881200, 4581002 }; public static void main(String[] args) { Scanner in = new Scanner(System.in); // ask the user for an account number System.out.print("Enter the account number: "); // get the…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26522097
has comment: http://stackoverflow.com/comment/41672670
score: 0
has comment: http://stackoverflow.com/comment/41672624
type: Question
has comment: http://stackoverflow.com/comment/41672699
has comment: http://stackoverflow.com/comment/41672774
has comment: http://stackoverflow.com/comment/41674024
tagged with: java
has comment: http://stackoverflow.com/comment/41674170
tagged with: class
answer count: 2
has comment: http://stackoverflow.com/comment/41672724
has answer: http://stackoverflow.com/a/26522097
has comment: http://stackoverflow.com/comment/41672888
possible better answer: http://stackoverflow.com/a/26522893

jdbc
tags question: http://stackoverflow.com/q/26536448
tags question: http://stackoverflow.com/q/26560556
tags question: http://stackoverflow.com/q/26516204
tags question: http://stackoverflow.com/q/26583876
tags question: http://stackoverflow.com/q/26652352
tags question: http://stackoverflow.com/q/26550465
tags question: http://stackoverflow.com/q/26662605
tags question: http://stackoverflow.com/q/26515487
tags question: http://stackoverflow.com/q/26574534
tags question: http://stackoverflow.com/q/26548783
tags question: http://stackoverflow.com/q/26623857
tags question: http://stackoverflow.com/q/26647622
tags question: http://stackoverflow.com/q/26652594
tags question: http://stackoverflow.com/q/26557900
tags question: http://stackoverflow.com/q/26647179
tags question: http://stackoverflow.com/q/26560733
type: Tag
tags question: http://stackoverflow.com/q/26551648
tags question: http://stackoverflow.com/q/26526261
tags question: http://stackoverflow.com/q/26582722
tags question: http://stackoverflow.com/q/26666622
tags question: http://stackoverflow.com/q/26616916
tags question: http://stackoverflow.com/q/26583840
tags question: http://stackoverflow.com/q/26634776
tags question: http://stackoverflow.com/q/26562268
tags question: http://stackoverflow.com/q/26568866
tags question: http://stackoverflow.com/q/26569302
tags question: http://stackoverflow.com/q/26660991
tags question: http://stackoverflow.com/q/26532112
tags question: http://stackoverflow.com/q/26661854
tags question: http://stackoverflow.com/q/26516028
tags question: http://stackoverflow.com/q/26619867
tags question: http://stackoverflow.com/q/26592681
tags question: http://stackoverflow.com/q/26515700
tags question: http://stackoverflow.com/q/26587393
tags question: http://stackoverflow.com/q/26564200
tags question: http://stackoverflow.com/q/26630469
tags question: http://stackoverflow.com/q/26652612
tags question: http://stackoverflow.com/q/26537665
tags question: http://stackoverflow.com/q/26581134
tags question: http://stackoverflow.com/q/26575669
tags question: http://stackoverflow.com/q/26647557
tags question: http://stackoverflow.com/q/26611669
tags question: http://stackoverflow.com/q/26515178
tags question: http://stackoverflow.com/q/26527054
tags question: http://stackoverflow.com/q/26581850
tags question: http://stackoverflow.com/q/26554235
tags question: http://stackoverflow.com/q/26658715
tags question: http://stackoverflow.com/q/26514740
tags question: http://stackoverflow.com/q/26662021
tag name: jdbc
tags question: http://stackoverflow.com/q/26659160
tags question: http://stackoverflow.com/q/26540839
tags question: http://stackoverflow.com/q/26578442
tags question: http://stackoverflow.com/q/26624000
tags question: http://stackoverflow.com/q/26558976
tags question: http://stackoverflow.com/q/26550598
tags question: http://stackoverflow.com/q/26552272

garbage-collection
tags question: http://stackoverflow.com/q/26545471
tags question: http://stackoverflow.com/q/26608136
tags question: http://stackoverflow.com/q/26538294
tags question: http://stackoverflow.com/q/26672883
tags question: http://stackoverflow.com/q/26642153
tag name: garbage-collection
tags question: http://stackoverflow.com/q/26566918
type: Tag
tags question: http://stackoverflow.com/q/26651408
tags question: http://stackoverflow.com/q/26558955
tags question: http://stackoverflow.com/q/26637084
tags question: http://stackoverflow.com/q/26605723
tags question: http://stackoverflow.com/q/26533183
tags question: http://stackoverflow.com/q/26604015

http://stackoverflow.com/comment/41928584
type: Comment
comment on: http://stackoverflow.com/a/26662405
score: 0
type: AnswerComment
has text: Yes, you're almost right : Enemy bird = new Enemy(EnemyType.Bird); (Take a look [there](http://javarevisited.blogspot.fr/2011/08/enum-in-java-example-tutorial.html) for small intro on enum)

http://stackoverflow.com/comment/41887520
type: Comment
has text: here is the text book question: Write methods called average, each having two arguments, that will return the average of those values. If the arguments are both integers, the value returned should be an int. If either or both values are floating point numbers, the value returned should be a double. As examples, average(10,15) should return 12 average(10.0,5.0) should return 7.5
comment on: http://stackoverflow.com/a/26639556
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41796633
type: AnswerComment
has text: Sounds a bit like a design issue, but I'm glad you made progress.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26567625

http://stackoverflow.com/comment/41858552
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26624320
has text: Then the error doesn't come from this JSP, or the JSP contains code that you haven't shown us.
type: AnswerComment

http-status-code-406
tags question: http://stackoverflow.com/q/26617553
tag name: http-status-code-406
type: Tag

http://stackoverflow.com/a/26551182
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: No, there is no benefit. There even are drawbacks: creating the jar is one more task to do in your build most (all?) of the app servers place the classes directory (or allow placing it) before the jars in the webapp's classpath. So placing your classes and resources there makes sure they are loaded in preference to a similar class or resources located in a jar of WEB-INF/lib.
type: Answer
accepted answer of: http://stackoverflow.com/q/26551088
answers question: http://stackoverflow.com/q/26551088

http://stackoverflow.com/comment/41716173
score: 0
type: QuestionComment
has text: One of the Runtime.exec() variants.
type: Comment
comment on: http://stackoverflow.com/q/26546640

http://stackoverflow.com/comment/41736856
has text: Create a class `Card` and make all your card classes extend it. Now you can have `ArrayList<Card> cards = null`. Initialize it, and add all cards.
comment on: http://stackoverflow.com/q/26557862
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/26589618
has comment: http://stackoverflow.com/comment/41794790
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26589388
answers question: http://stackoverflow.com/q/26589388
type: Answer
has body: Try if this works SELECT e FROM PKGruppeBE e left join e.tkgroup gr WHERE gr.id = ?1 OR gr IS NULL

http://stackoverflow.com/comment/41919168
score: 0
type: AnswerComment
type: Comment
has text: Tests are a bad source of truth, ime. Because they are code they can be buggy. A failing test means some code is wrong. Ime, it is just as often the test; Because test code is written sloppier. In a perfect world you might be right, sadly I live in a world of imperfection.
comment on: http://stackoverflow.com/a/26557997

http://stackoverflow.com/a/26521627
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41675320
has body: Make sure that in each iteration of the while loop, only one nextXXX method gets called. Write System.out.println and print stuff. Step through your code in your IDE (Eclipse) If you're not using an IDE, start using one.
answers question: http://stackoverflow.com/q/26521439
has comment: http://stackoverflow.com/comment/41674597
downvote count: 0
score: 1

http://stackoverflow.com/comment/41770609
has text: I think you'll need to share more details about your code for us to offer a proper answer. However, acquiring a semaphore and releasing another sounds like trouble.
comment on: http://stackoverflow.com/q/26576470
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41741582
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/2624192/good-hash-function-for-strings checkout this question
comment on: http://stackoverflow.com/q/26560520
score: 0

http://stackoverflow.com/a/26626728
type: Answer
has body: Since the question was posted, I didn't stop to think about this, until now: I found the reason of that behaviour. The decisive suggestion is that "the code has been generated with mybatis-generator", and it has been generated in the same subpackage of the application: this means that the *Mapper classes, used for querying the databaes, effectively are in the application package and so their logs are treated as logs of "our.company.basepackage" and not as logs of "org.apache.ibatis". The "org.apache.ibatis" in logs rows was misleading me. After this small insight, I added the following to my log4j.properties: log4j.additivity.our.company.basepackage.persistence.mybatis=false log4j.logger.our.company.basepackage.persistence.mybatis=INFO,libs With these 2 more lines, everything works properly, i.e. no more "org.apache.ibatis" rows in app.log. I hope that this can be useful to someone other using mybatis-generator.
score: 1
accepted answer of: http://stackoverflow.com/q/26615332
upvote count: 1
answers question: http://stackoverflow.com/q/26615332
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26583876
has answer: http://stackoverflow.com/a/26583958
has comment: http://stackoverflow.com/comment/41783612
has title: How JDBC implementation works
has comment: http://stackoverflow.com/comment/41783570
favorite count: 0
upvote count: 5
accepted answer: http://stackoverflow.com/a/26583928
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/26584242
answer count: 4
has answer: http://stackoverflow.com/a/26584242
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26583928
downvote count: 0
has answer: http://stackoverflow.com/a/26584149
tagged with: java
has body: In JDBC, I see that Connection is an interface, which defines methods for interacting with Database. I also know that interface contains only abstract methods, and cannot be instantiated But In JDBC code, how does the following work, Connection connection = DriverManager.getConnection("URL String"); Statement statement=connection.createStatement(); As per my doubt createStatement() should be a abstract method, i..e, without any body But every thing works fine... with this Can anyone explain?
type: Question
score: 5

http://stackoverflow.com/q/26590396
type: Question
has title: Trouble with eclipse.ini
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/26590510
answer count: 1
has body: I hoping I'm not doubling this question, but I did search thoroughly. I have adt-bundle-windows-x86_64-20140702 downloaded and learned that I need 64 bit java which I have installed. However, it's looking for 32 bit java. When I download a 32 bit Eclipse application, it's fine. Because I have the 64 bit adt already updated, I would like to use the 64 bit Eclipse found in that package. After going through the trouble shooting found here, I have noticed that my eclipse.ini isn't looking like all the examples I've seen (showing -vm {path_to_64bit_java}\bin\javaw.exe) https://www.dropbox.com/s/d14hu6hb6dmqdx6/Screenshot%202014-10-27%2021.43.40.png?dl=0 I would like to edit this so that eclipse will use the java 64 bit that I have installed in Program Files. Do I need to add a line here or is there something missing from this screenshot? Any help would be appreciated. I'm using Windows 8.1 and I didn't have this problem the first time I installed Eclipse. This is my .ini when opened in Notepad++ -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.adtproduct -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms512m -Xmx1024m I would need to insert a line after "openFile" ?
type: UnansweredQuestion
tagged with: eclipse-adt
tagged with: java

http://stackoverflow.com/q/26659981
upvote count: 1
type: Question
has body: I am tyring to build dynamic web application using Eclipse Luna and facing one very strange problem. When I build using eclipse there is no "classes" folder generated and hence application is not able to find the classes ie. the servlets. However if I build war file for my project, classes folder is generated and works perfectly fine. I have searched the web on this issue and tried the possible solutions. Here are the screenshots of my project settings and few solutions that people recommended. Looks like I am missing either some important property or else eclipse is playing weird. Thanks,
accepted answer: http://stackoverflow.com/a/26660177
tagged with: eclipse
tagged with: servlets
answer count: 1
downvote count: 0
tagged with: web
favorite count: 0
has title: Eclipse Build Issue in Dynamic Web Project Creation
has answer: http://stackoverflow.com/a/26660177
tagged with: build
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/41724317
has text: @keuleJ Yes.I am using Swing
score: 0
comment on: http://stackoverflow.com/q/26550559
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26633168
type: UnansweredQuestion
tagged with: java-ee-7
tagged with: maven
has answer: http://stackoverflow.com/a/26651421
score: 0
tagged with: java
type: Question
answer count: 1
tagged with: netbeans-8
has title: Java EE first cup maven error
has body: I'm trying to learn Java EE 7 with the updated version (7.0.5) of First cup example. I tried installing the archetype but I get the following error when building firstcup-war: WARNING: Error injecting: org.apache.maven.shared.filtering.DefaultMavenFileFilter java.lang.NoClassDefFoundError: org codehaus/plexus/interpolation/ValueSource at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) at java.lang.Class.getDeclaredConstructors(Class.java:2007) at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245) at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:98) at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629) at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:831) at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:758) at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:255) at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:204) at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:954) at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:987) at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:950) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000) at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45) at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84) at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52) at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100) …

http://stackoverflow.com/comment/41774358
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26578401
has text: I think OPs intention was to not use Collections, but only Arrays...
score: 0

http://stackoverflow.com/q/26631093
has title: No active contexts for scope type javax.enterprise.context.RequestScoped when invoking a bean from a thread
tagged with: weld-se
accepted answer: http://stackoverflow.com/a/26632111
favorite count: 0
has body: While using Weld-SE 2.1.2.Final to obtain a bean and to invoke it from a thread, I encounter the following exception: Exception in thread "main" org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped My bean is annotated with @RequestScooped. If I annotate @ApplicationScoped then it works fine, but I need to keep @RequestScooped. Here is a reproducer : public static void main(String[] args) throws Exception { Weld weld = new Weld(); WeldContainer container = weld.initialize(); final MyPojo pojo = container.instance().select(MyPojo.class).get(); Thread t = new Thread() { public void run() { System.out.println(pojo.ping()); // This call fails } }; t.start(); t.join(); System.out.println(pojo.ping()); // This call succeed weld.shutdown(); } @RequestScoped public class MyPojo { public String ping() { return "pong"; } } Did you encounter this behavior? Any idea to make this work please?
tagged with: multithreading
score: 16
upvote count: 16
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26632111
answer count: 1
downvote count: 0
tagged with: cdi

http://stackoverflow.com/q/26549005
possible better answer: http://stackoverflow.com/a/26643848
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26643792
has body: I have a class of which only static methods are to be accessed via @path annotations and which does not have a public constructor. My simpilified program is: @Path("") static class MyStaticClass { private MyStaticClass() {...} @Get @Path("time") static public String time() { return Instant.now().toString(); } } Running and calling "time" gives me the following error: WARNUNG: The following warnings have been detected: WARNING: HK2 service reification failed for [...] with an exception: MultiException stack 1 of 2 java.lang.NoSuchMethodException: Could not find a suitable constructor in [...] class.
has comment: http://stackoverflow.com/comment/41863318
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26643792
has answer: http://stackoverflow.com/a/26643848
tagged with: jersey
score: 4
has comment: http://stackoverflow.com/comment/41862808
upvote count: 4
answer count: 2
has title: How to register a static class in Jersey?
downvote count: 0
has comment: http://stackoverflow.com/comment/41842511
favorite count: 0
linked to: http://stackoverflow.com/q/7486012

http://stackoverflow.com/q/26563606
tagged with: java
tagged with: hibernate
type: Question
tagged with: bean-validation
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26565012
favorite count: 0
tagged with: hibernate-validator
has title: Validation Group inheritance
accepted answer: http://stackoverflow.com/a/26565012
has comment: http://stackoverflow.com/comment/41748944
upvote count: 2
has body: Given the following classes and interfaces class Person { @NotNull(groups=Both.class) private String name; } Validate groups: interface One {} interface Two {} interface Both extends One, Two {} When calling Person person = new Person(); validator.validate(person, One.class) or validator.validate(person, Two.class) I would expect that it should be invalid since name is null but it does not. It turns out the group Both.class is only useful when used in validator.validate(..., Both.class) method.
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41748154

http://stackoverflow.com/q/26657191
has comment: http://stackoverflow.com/comment/41925922
favorite count: 0
tagged with: interface
score: 6
accepted answer: http://stackoverflow.com/a/26657495
has body: ImmutableSet implements the Set interface. The functions that don't make sense to an ImmutableSet are now called "Optional Operations" for Set. I assume for situations like this. So ImmutableSet now throws an UnsupportedOperationException for many Optional Operations. This seems backwards to me. I was taught that an Interface was a contract so that you could use impose functionality across different implementations. The approach of Optional Operations seem to fundamentally change(contradict?) what Interfaces are meant to do. Implementing this today I would have the Set Interface broken into two interfaces: one for one for immutable operations and a second extending those operations for mutators. (Very quick, off the cuff solution) I understand that technology changes. I'm not saying It should be done one way or another. My question is, does this change reflect a change in some underlying philosophy for Java? Is it just more of a bandaid to make things backwards compatible? Did I have an incomplete understanding of Interfaces?
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
has title: Why did they decide to make interfaces have "Optional Operations"
downvote count: 0
has answer: http://stackoverflow.com/a/26657495
answer count: 1

http://stackoverflow.com/comment/41931169
score: 0
type: AnswerComment
has text: did you use split function?
type: Comment
comment on: http://stackoverflow.com/a/26664617

http://stackoverflow.com/q/26666415
has body: Is it a valid design to extend an generic class without specifying a type parameter. I don't really care about the type parameter and want to discontinue the generics under my class's hierarchy. E.g.,: if there is a class A&lt;T,U&gt; where T and U are type parameters. class B extends A { ... } Also, is it possible to specify one parameter and skip the other? What will be the syntax? Following did not work: class C&lt;U&gt; extends A&lt;?,U&gt; { ... }
has title: non-generic type extending a generic type without specifying type parameter(s)
score: 0
linked to: http://stackoverflow.com/q/2770321
tagged with: generics
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41934462
tagged with: java
has answer: http://stackoverflow.com/a/26666590
type: Question
has comment: http://stackoverflow.com/comment/41934402
answer count: 1

http://stackoverflow.com/a/26661723
type: Answer
has body: You have this: ArrayList&lt;Customer&gt; route = null; and then this: route.add(c); If you try and invoke a method on a null reference, you get a NullPointerException.
answers question: http://stackoverflow.com/q/26661648
score: 0

http://stackoverflow.com/q/26520849
possible better answer: http://stackoverflow.com/a/26521140
has answer: http://stackoverflow.com/a/26521048
accepted answer: http://stackoverflow.com/a/26521048
tagged with: java
has title: Repetition Structures, Procedure Method
tagged with: bluej
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41670877
type: Question
has body: public static void main (String args[]) { String c = "Message"; int width; int height; char character; Scanner sc = new Scanner(System.in); System.out.println("Enter the character : "); character = sc.next().charAt(0); System.out.println("Enter your width: "); width=sc.nextInt(); System.out.println("Enter your height: "); height=sc.nextInt(); System.out.println(); for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; width; j++) { if (i == 0 || i == height-1) { System.out.print(character); } else if (j ==width-1) { String middle = character + " " + c + " " + character; System.out.print(middle); } } System.out.println(); } } } I am trying to make the MESSAGE display in the rectangle. Also, is there a way i can move my rectangle in the center of the screen too?
score: 0
has answer: http://stackoverflow.com/a/26521140
answer count: 2

http://stackoverflow.com/comment/41771491
has text: possible duplicate of [Is the Contains Method in java.lang.String Case-sensitive?](http://stackoverflow.com/questions/86780/is-the-contains-method-in-java-lang-string-case-sensitive)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26576580

http://stackoverflow.com/a/26537225
has body: The issue you are running into is that next() method of Scanner only gets the next token, not the whole line. You want the nextLine() method. I don't know if you have gotten to this in your class yet, but usually you want to use Scanner with a try-with-resources block. This will ensure that no matter what, your Scanner objects are closed (it's syntactic sugar for closing them in a finally block). You also don't need a separate scanner for each input, although because you are going to need both readLine() and nextInt(), you do need two of them (Scanner has issues if you try to readLine() after using nextInt()). You also are doing things the hard way by not using loops. When you use a for loop, the code is much simpler and shorter. Your teacher is asking you to use arrays and for loops without explaining to you how to use them? Isn't there a textbook or some class notes you can reference? import java.util.Scanner; public class MovieTester { public static void main(String [] args){ Movie[] movies = new Movie[3]; try (Scanner string_input = new Scanner(System.in); Scanner int_input = new Scanner(System.in);) // Try with resources { for (int i = 0; i &lt; 3; i++) { Movie movie = new Movie(); // Enter Details For Movie System.out.println("Please Enter The Title Of Movie: "); movie.setTitle(string_input.nextLine()); System.out.println("Please Enter The Genre Of Movie: "); movie.setGenre(string_input.nextLine()); System.out.println("Please Enter The Rating Of Movie: "); movie.setRating(int_input.nextInt()); System.out.println(); movies[i] = movie; } // Play Movies for (int i = 0; i &lt; movies.length; i++) { Movie movie = movies[i]; System.out.println("Title: " + movie.getTitle()); System.out.println("Genre: " + movie.getGenre()); System.out.println("Rating: " + movie.getRating()); movies[i].playIt(); System.out.println(); } } }//end main method }//end class
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26536388
answers question: http://stackoverflow.com/q/26536388

http://stackoverflow.com/a/26577665
type: Answer
answers question: http://stackoverflow.com/q/26577366
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41772827
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26577366
type: AcceptedAnswer
has body: "By default, a layered pane has no layout manager." — How to Use Layered Panes Set bounds for your label and it will appear. For example: label1.setBounds(20, 20, 200, 100); Keep in mind that you are doing this for assignment purposes, and that in practice you probably wouldn't set component's bounds, unless you are using absolute layout on purpose. Edit: As MadProgrammer pointed out, you can also set the layout manager for the layered pane, in which case you needn't set the label bounds. For example: mainScreen.setLayout(new BorderLayout());

http://stackoverflow.com/q/26582629
type: UnansweredQuestion
tagged with: shutdown-hook
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/10855559
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/41801345
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26593719
has title: Why doesn't Java's .addShutdownHook work for Ctrl-C on BeagleBone Black? Is there a workaround?
has body: Problem I have run the following Clojure code on both my Ubuntu development machine and the BeagleBone Black, and can confirm that it works on the former but not the latter. (defn setup-shutdown-hook! [f] (.addShutdownHook (Runtime/getRuntime) (Thread. f))) (setup-shutdown-hook! (fn [] (println "I am no more"))) (defn -main [] (doseq [i (range)] (Thread/sleep 1000) (println "Staying alive"))) On the BBB, the shutdown hook does work appropriately in the case of "natural" shutdowns, but not on Ctrl-C. On the Ubuntu machine, it seems to always work. Is there some explanation for this different behavior? Java versions? System level differences? Is there a workaround for getting the desired behavior? System details Ubuntu: java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) Beaglebone (running Angstrom; connected via SSH): &gt; java -version java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode) &gt; uname -a Linux beaglebone 3.8.13 #1 SMP Wed Sep 4 09:09:32 CEST 2013 armv7l GNU/Linux P.S. For those of you familiar with Java but not Clojure, the Clojure code above just hooks into the Java methods through it's interop. Hopefully you can test the trans
has comment: http://stackoverflow.com/comment/41782225
tagged with: clojure
tagged with: beagleboneblack

http://stackoverflow.com/comment/101747088
type: AnswerComment
comment on: http://stackoverflow.com/a/51334653
type: Comment
has text: @Ben Leggiero take a look at this question https://stackoverflow.com/questions/10287700/difference-between-jvms-lookupswitch-and-tableswitch
score: 1

http://stackoverflow.com/comment/41774567
score: 0
has text: Ah i see now, i was actually trying to work it out using a while loop i was just making it overly complicated :p thanks!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26578635

http://stackoverflow.com/a/26614191
answers question: http://stackoverflow.com/q/26613799
has body: I think Aaron Digullas answer was the closest one, it looks like the Database already has access to the standard java classes. Actually, I'm sorry, I think I have made a mistake with importing java. I can access the Database with SQL Developer and directly enter my source code there to insert a new java class in my database, everything works then. It looks like I have either made an error when compiling the class or when using the "loadjava" command to insert the java class in the database.
score: 0
type: Answer

http://stackoverflow.com/comment/41914163
has text: Okay thanks for pointing that out, I'll look further into the JPA then, at least I know where the problem is. Although I have a method that displays People and works, and when I copied that method to the buggy one, I still got the same old QueryException message
comment on: http://stackoverflow.com/q/26652601
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26610326
has comment: http://stackoverflow.com/comment/99086746
upvote count: 86
answers question: http://stackoverflow.com/q/26609922
accepted answer of: http://stackoverflow.com/q/26609922
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/62061490
downvote count: 0
has body: I've personally never found it useful to set M2_HOME. What counts is your $PATH environment. Hijacking part of the answer from Danix, all you need is: export PATH=/Users/xxx/sdk/apache-maven-3.0.5/bin:$PATH The mvn script computes M2_HOME for you anyway for what it's worth.
type: Answer
score: 86

http://stackoverflow.com/comment/41815997
type: QuestionComment
comment on: http://stackoverflow.com/q/26598531
has text: @DennisMeng I think it's impossible to achieve what he is asking. Unless he means not using any of the built-in string functions.
score: 0
type: Comment

http://stackoverflow.com/comment/41891827
type: Comment
has text: @MarsAtomic Good that my question made you laugh.Thank you for your explanation.But How would I know being new to Java that " Java Universe " is a florid prose term?. I did find technical definitions being asked in stack overflow( not only programming).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26642310

http://stackoverflow.com/comment/41772080
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26576852
has text: amazing thanks so much @Edwin. It makes such a perfect sense now.
score: 0

http://stackoverflow.com/q/26596285
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/41807541
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41807989
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/24464727
type: Question
has comment: http://stackoverflow.com/comment/41807233
score: 2
has answer: http://stackoverflow.com/a/26596435
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41807559
has comment: http://stackoverflow.com/comment/41808045
favorite count: 0
accepted answer: http://stackoverflow.com/a/26596435
has body: I use "Android Action Bar Style Generator" website to generate styles for my actionBar. I want to change the text color of my action bar to white , I tried to do it with #FFF in manifest but It didn't work. can any one help me ? I also test this way but it didn't answer. I used appcompat in this project. this style generator give me values,drawable folder and some other folder. this is the style generator gives me <resources> I add this two line to this style but still not working.
has title: Android Action Bar Style Generator : Change text color of action bar
tagged with: android

http://stackoverflow.com/comment/41798563
type: QuestionComment
comment on: http://stackoverflow.com/q/26591451
has text: sActiveTop = 0 there? getChildAt(0).getTop() == 0. Try sActiveTop = sActiveItem.getTop();
score: 0
type: Comment

http://stackoverflow.com/comment/41795916
score: 0
type: Comment
has text: This is a reasonable answer to explain why the OP is getting ArrayIndexOutOfBounds. why is the downvote?
comment on: http://stackoverflow.com/a/26590526
type: AnswerComment

http://stackoverflow.com/comment/41759613
comment on: http://stackoverflow.com/q/26570353
score: 0
type: Comment
type: QuestionComment
has text: I am using ActionBarActivity, and Theme.AppCompat. getActionBarIconView() shouldn't be returning null.

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/26639906
type: Tag
tags question: http://stackoverflow.com/q/26657777

http://stackoverflow.com/q/26613719
upvote count: 1
has comment: http://stackoverflow.com/comment/41839084
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41838961
has body: I'm working on a code to for the game bulls and cows (http://en.wikipedia.org/wiki/Bulls_and_cows) My code compiles but when I try and run it in Terminal I get a null pointer exception error for howManyBylls, playOneTurn, and playGame. I can't find where this error originates from. Also this version of the game that differs from other games of bulls and cows in that users can input a four digit number with repeating digits. I think in most other codes they are supposed to input four digit number with unique digits. public int howManyBulls(String guess) { input = guess; bulls = 0; for (int i = 0; i&lt;4; i++) { int k = Integer.parseInt(pattern.substring(i, i+1)); int l = Integer.parseInt(input.substring(i, i+1)); if (k == l) // checking for same value at same location { bulls++; // add one to bull if there is a match } } return bulls; } public class Game{ private int turns; private Oracle computer; private Scanner input; public String userInput; public int bulls; public int cows; public Game(){ // creates new data type Oracle computer = new Oracle(); turns = 0; input = new Scanner(System.in); } public void playGame(){ // your code for the Game playGame method goes here System.out.print("Please enter a 4 digit number: "); userInput=input.next(); playOneTurn(); } // plays a turn public void playOneTurn(){ turns++; // passes userInput into methods of howManyBulls() and howManyCows() bulls = computer.howManyBulls(userInput); cows = computer.howManyCows(userInput); System.out.println(bulls+ " bulls"); System.out.println(cows+ " cows"); // checks if game is over if (bulls &lt; 4) // if bulls less than four then continue playing game // if bulls = 4 then the number is correct { playGame(); } else { // done with game and print out number of turns System.out.print("It took" + turns + " turns to guess " + "the correct number"); } } public void setPattern(String solution){ computer.setPattern(solution); } public String getPattern(){ return computer.getPattern(); } }
has title: Bulls and Cows game program Java. Null pointer exception error when running the program
score: 0
has comment: http://stackoverflow.com/comment/41839223
has answer: http://stackoverflow.com/a/26613943
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41838933

http://stackoverflow.com/a/26641162
upvote count: 1
has comment: http://stackoverflow.com/comment/41889405
answers question: http://stackoverflow.com/q/26641098
downvote count: 1
has comment: http://stackoverflow.com/comment/41889749
has comment: http://stackoverflow.com/comment/41889577
has comment: http://stackoverflow.com/comment/41889397
has comment: http://stackoverflow.com/comment/41889521
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26641098
score: 0
has comment: http://stackoverflow.com/comment/41889843
type: Answer
has comment: http://stackoverflow.com/comment/41889396
has body: next will never be null, because listIterator will always return an Iterator. What you have to check is if the Iterator itself has a next element. So change : if(next == null) to if (!next.hasNext())
has comment: http://stackoverflow.com/comment/41889779

http://stackoverflow.com/comment/41853427
has text: Does it have to be macro?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26621499

http://stackoverflow.com/q/26643189
has answer: http://stackoverflow.com/a/26643283
score: 4
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/26643346
tagged with: char
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26643450
favorite count: 0
possible better answer: http://stackoverflow.com/a/26643278
has body: I want to convert String lotto int an integer array. String lotto is composed of a certain amount of numbers between 1 and 99 and is only composed of 1 and 2 digit numbers. (Example: String lotto might look like "1 34 5 23 7 89 32 4 10 3 6 5".) I am trying to solve the problem by converting the String to char[] and then the char[] to an int[]. My logical behind converting it to the char[] is make it possible to format the numbers for the int[]. Here is what I have so far: public static int[] conversion(String lotto) { char[] c = lotto.toCharArray(); int[] a = new int[c.length]; for(int i = 0, j = 0; i &lt; c.length; i++) { if(c[i] != ' ' &amp;&amp; c[i+1] != ' ') { a[j] = c[i] + c[i+1]; i+=2; j++; } else if(c[i] != ' ' &amp;&amp; c[i+1] == ' ') { a[j] = c[i]; i++; j++; } } return a; }//end of conversion method I am still working on the rest of the program but I know that c[i] + c[i+1] with return an ASCII value or a different int rather than combining the two chars together (Example of what I want: '3' + '4' = 34.) How do I fix this problem?
has answer: http://stackoverflow.com/a/26643278
has answer: http://stackoverflow.com/a/26643823
has answer: http://stackoverflow.com/a/26643317
has title: Converting a String with spaces and numbers to an int array with just numbers
type: AnsweredQuestion
tagged with: data-conversion
has answer: http://stackoverflow.com/a/26643346
tagged with: java
answer count: 6

http://stackoverflow.com/comment/41858239
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26623806
has text: for the moment, just to find the problem, a e.printStackTrace(); in the catch-block will do. For permanent logging there are several logging frameworks. Besides the built in to Java (java.util.logging) the most popular are Log4J, SLF4J and Apache commons logging.

http://stackoverflow.com/comment/41761875
has text: after 30 seconds elapsed, start activity i, and kill the current one
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26571816

http://stackoverflow.com/q/26570342
has answer: http://stackoverflow.com/a/26570368
has comment: http://stackoverflow.com/comment/41759379
has title: Address of String object in JAVA
has answer: http://stackoverflow.com/a/26570387
score: 1
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/4930781
has body: I have a question about address of object in JAVA. the following is my code. public class StringCompare { public static void main(String[] args) { String s1 = "apple"; String s2 = "apple"; String s3 = new String("apple"); boolean b1 = (s1 == s2); boolean b2 = (s1 == s3); boolean b3 = s1.equals(s2); System.out.println(b1); // true System.out.println(b2); // false System.out.println(b3); // true System.out.println(""); System.out.println("Address of s1 = " + Integer.toHexString(s1.hashCode())); // 58b835a System.out.println("Address of s2 = " + Integer.toHexString(s2.hashCode())); // 58b835a System.out.println("Address of s3 = " + Integer.toHexString(s3.hashCode())); // 58b835a } } I think address of object(s1 and s2) is same. I think Address of object(s3) is not equal to s1, s2. but.. result is address of object(s1, s2, s3) is same. I don't know why s1, s2, s3 address is same.. Please give me some advice. Thanks.
has answer: http://stackoverflow.com/a/26570351
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41759282
has answer: http://stackoverflow.com/a/79187750
answer count: 4

http://stackoverflow.com/comment/41727946
type: Comment
type: QuestionComment
has text: @Durandal: That is true. My issue is that I have not yet found an explanation as to how this approach works. If I can learn the rhyme and reason to explain why sometimes it generates the same results and other times it does not, I will be able to make progress. So far, I have not found this explanation.
comment on: http://stackoverflow.com/q/26551714
score: 0

http://stackoverflow.com/q/26545383
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26548593
type: Question
has comment: http://stackoverflow.com/comment/41718328
has comment: http://stackoverflow.com/comment/41718422
accepted answer: http://stackoverflow.com/a/26548593
tagged with: javascript
tagged with: grails
score: 0
tagged with: groovy
has body: I will divide my question into two parts the first one being my actual problem and the second is the title question. FIRST: I have a table showing a list of data and I am trying to define a filter method to search value from the table and render results, search by name is working but by date is not. I have the following code: the view: <g:form class="input-group custom-search-form" id="searchsession"> <g:submitToRemote class="btn btn-default submitBtn" action="filter" update="listTable" value="Filter" onLoading="showLoading('listTable')" onLoaded="dismissLoading('listTable')"/> </g:form> The controller method: class SessionController extends BaseController { public static Date format(String val){ SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm a") return sdf.parse(val) } def filter(Integer max){ println params params.max = Math.min(max ?:DEFAULT_MAX_PER_PAGE, 100) def result = Session.createCriteria().list(max: params.max, offset: params.offset) { if (params.searchValue && params.searchValue != 'null') { createAlias("imsi","I") createAlias("imsi.subscriber","S") or { ilike("I.imsi", params.searchValue.toLowerCase() + "%") ilike("S.name", params.searchValue.toLowerCase() + "%") } } if (params.seachDateFrom && params.searchDateFrom != 'null' && params.searchDateTo && params.searchDateTo != 'null'){ createAlias("imsi.subscriber","S") and{ ge("S.connectTime",format(params.searchDateFrom)) le("S.disconnectTime",format(params.searchDateTo)) } } order("imsi", "asc") } render(template: 'listTable', model: [sessionList: result, sessionListTotal: result.totalCount, fromDate:params.searchDateFrom, toDate: params.searchDateTo, searchValue: params.searchValue, max: params.max, offset: params.offset]) } } EDIT: involved domain classes are: class Session { String id Imsi imsi Date connectTime Date disconnectTime } class Imsi { String id String imsi Subscriber subscriber } The second part is how can I get the type of the parameters to know if am getting a date type or…
has title: Get parameter type using groovy/grails
answer count: 1
has comment: http://stackoverflow.com/comment/41718339
has comment: http://stackoverflow.com/comment/41715506
has comment: http://stackoverflow.com/comment/41715590

http://stackoverflow.com/q/26554015
tagged with: http://stackoverflow.com/tag/html
tagged with: model-view-controller
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41730016
type: Question
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/41739801
has comment: http://stackoverflow.com/comment/41740345
has title: Cannot resolve JSP specific tags while receiving from ModelAndView object
tagged with: jsp
type: UnansweredQuestion
has body: From the controller, I can send an attribute back to a JSP page through a ModelAndView object and receive it through an EL tag in JSP, i.e ${message}. HTML tags are resolved and displayed in the JSP page without a sweat, but JSP specific scriptlets and tags are not getting resolved. My issue is this: From the controller, all responses must be directed to two pages, a success page, and a failure page. The content displayed on each page is determined by the attribute being sent through a ModelAndView object, and this attribute is to contain a message describing something, and a JSP directive or action to include another JSP page. In the controller servlet: public ModelAndView request(){ String message = "This is the text returned by the servlet! &lt;br&gt;&lt;hr&gt; " + "&lt;jsp:include page='WEB-INF/views/anotherpage.jsp'&gt;&lt;/jsp:include&gt; "; return new ModelAndView("blank","message",message); } In the JSP page 'blank.jsp', is an EL tag: ${message} The HTML tags &lt;br&gt; and &lt;hr&gt; are resolved correctly, and the text is being displayed. But nothing is being displayed for &lt;jsp:include /&gt; nor is it including the mentioned file. How do i invoke JSP directives and actions from the servlet page ?

http://stackoverflow.com/q/26587376
has comment: http://stackoverflow.com/comment/41792861
score: 0
type: UnansweredQuestion
has title: While debugging in eclipse, eclipse hides some variables
has body: I am debugging my program in eclipse and facing some strange problem. I have a list fileList1, which is a list of objects files, which has 2 properties: fileName versionList Please have a look on this picture, you will understand my problem. While debugging, I noticed that when I add object files in fileList1 using a for loop, it works fine and the object files is added. But when I extract the FileList1, it doesn't shows all nodes information, for example, here you can see: When I extracted FileList1[0], only filename is shown. The next filed, which should show versionList is blank. Again, When I extracted FileList1[2],nothing is shown, neither filename or versionList. If I mistakenly doesn't add anything in a particular file, then atleast the variable name , like fileName and versionList should be shown with null properties. But its not the case here. Also, sometimes, the fileName variable in debugger variables view shown one value and if I click on it to extract, it shows another value. I think the problem is with debugger. Its not updating properly. My output is also coming weird. It seems new entries are replacing old entries, although I did not used any replace function for list, just used fileList1.add(file). I am not understanding, whats the problem here. I already checked internet and stackoverflow for a solution. But did not found similar topic. Your help will be highly appreciated.
answer count: 0
has comment: http://stackoverflow.com/comment/41792284
tagged with: java
has comment: http://stackoverflow.com/comment/41791479
has comment: http://stackoverflow.com/comment/41790071
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/41793046
tagged with: eclipse

http://stackoverflow.com/comment/41901069
score: 0
has text: @fxm I think it's a valid question. Many of the Java 8 questions in SO ask how to convert working Java 7 code to Java 8 code using lambda expressions, Streams, etc... This question is just lacking some details about the types involved.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26648107

http://stackoverflow.com/comment/41687173
has text: yes the issue was in fact I had a wrong package listed. didn't notice it cause of similar naming. Thanks a lot. Feel free to post an answer. Though as such, the above question samples work already
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26529912

http://stackoverflow.com/q/26571082
tagged with: multipartform-data
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/26572216
score: 0
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41765012
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41761221
has body: I have an Android application that records an audio file and uploads it to an API for fingerprinting. The app works well when it uploads for the first time and gets the right response. However, on trying to upload again the request from the app seems to reach the server without the uploaded file. Strangely, when I close the app completely and open it again, it works well. However, I want it to be able to do the uploads continuously without having to close it after every attempt. Here is my code: public class MainActivity extends Activity { class UploadFileTask extends AsyncTask&lt;Void, Void, String&gt; { @Override protected String doInBackground(Void... voids) { String responseString = ""; HttpResponse response = null; try { //below is the API url String url = "http://1**.**.**.**:8000/api/tag/"; File track = new File(Environment.getExternalStorageDirectory(), "mezzo.mp3"); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create(); reqEntity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); FileBody fb = new FileBody(track); //InputStream inputStream = new ; //reqEntity.addPart("track", fb); reqEntity.addBinaryBody("track", track); final HttpEntity myEntity = reqEntity.build(); httppost.setEntity(myEntity); Log.i("request", String.valueOf(myEntity)); response = httpclient.execute(httppost); //process response responseString = new BasicResponseHandler().handleResponse(response); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (null!=response) { try { HttpEntity httpEntity = response.getEntity(); if (null != httpEntity) { httpEntity.consumeContent(); } } catch (IOException e) { e.printStackTrace(); } } } return responseString; } protected void onPostExecute(final String responseString) { runOnUiThread(new Thread() { public void run() { Toast.makeT…
has title: I have to close app and open again for android file upload to work

http://stackoverflow.com/comment/41818793
type: QuestionComment
has text: "trying to avoid specific communication protocols" - so, um... vague protocols, then?
comment on: http://stackoverflow.com/q/26602520
score: 0
type: Comment

http://stackoverflow.com/a/26643728
type: Answer
has comment: http://stackoverflow.com/comment/41894111
has comment: http://stackoverflow.com/comment/41894076
has comment: http://stackoverflow.com/comment/41893833
has comment: http://stackoverflow.com/comment/41894059
has body: While you could build a List&lt;String&gt; of words it looks like you just want to concatenate each new word to your String words like, if (words.length() &gt; 0) words += " "; // &lt;-- add a space. words += console.next(); // &lt;-- += not = Then change your loop test to something like, while (!words.trim().toLowerCase().endsWith("quit")); And it should work something like you would expect.
has comment: http://stackoverflow.com/comment/41893903
has comment: http://stackoverflow.com/comment/41893844
answers question: http://stackoverflow.com/q/26643666
score: 0

http://stackoverflow.com/comment/41838682
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26613212
has text: This login screen is the first activity that appears when the application is run, so I don't know what I would have to close with that code.
type: AnswerComment

http://stackoverflow.com/q/26551036
accepted answer: http://stackoverflow.com/a/26576010
type: Question
tagged with: illegalargumentexception
answer count: 1
has body: I am making a two-player for Android using Parse.com. I'm determining which two players are in the game by introducing a Game table on Parse.com, with an Array of the userIds of the players of the game. I need to query Parse.com for a list of all the games shared by two given players. I thought something like this would do the trick. String[] userIds = new String[] {player1, player2}; ParseQuery&lt;ParseObject&gt; query = new ParseQuery&lt;ParseObject&gt;("Game"); query.whereEqualTo("players", userIds); The problem is, I don't know the order of the Array of players. So about half of the time, the order will be wrong I won't get the correct result from this query. I'll get that no game exists between the two players. So my idea to solve this was to also query for a reversed array, then OR the two queries together. String[] reversedUserIds = new String[] {player2, player1}; ParseQuery&lt;ParseObject&gt; query2 = new ParseQuery&lt;ParseObject&gt;("Game"); query2.whereEqualTo("players", reverseUserIds); List&lt;ParseQuery&lt;ParseObject&gt;&gt; queryList = new ArrayList&lt;ParseQuery&lt;ParseObject&gt;&gt;(); queryList.add(query); queryList.add(query2); ParseQuery&lt;ParseObject&gt; mainQuery = ParseQuery.or(queryList); However, when I run mainQuery.find(), I get an error that looks like this: java.lang.IllegalArgumentException: invalid type for ParseObject: class [Ljava.lang.String; Instead of simply returning a list of all the games that both players are playing with each other.
has answer: http://stackoverflow.com/a/26576010
tagged with: parse-platform
tagged with: android
has title: Use Parse.com and Android, how can I get a list of Games that a pair of Players share?
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/26522656
favorite count: 0
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/26624723
has title: Android Media Recorder Stop Exception
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: file
type: Question
has body: I am recording both video and audio from the android media recorder... I am checking the clip length, if less then 2 sec, delete it... But the problem is if i check the duration of file from file path, MediaRecorder throws exception everytime after once exception is thrown, even when i record audio of 10 seconds? But when i comment the code to check the duration of video created, it worsk fine... Following is my code if (prMediaRecorder != null) { try { prMediaRecorder.stop(); timer.cancel(); PathNameArray.add(prRecordedFile.getPath()); Log.e("No Exception", "File Added and Saved"); ////////////// Check Length and Delete File if (prRecordedFile != null) { if (MediaPlayer.create(getApplicationContext(), Uri.fromFile(new File( prRecordedFile.getPath()))).getDuration() &lt;= 2000) { File file = new File(prRecordedFile.getPath()); boolean deleted = file.delete(); Toast.makeText(getApplicationContext(), "Video Clip Length Too Short, Clip Not Added", Toast.LENGTH_SHORT).show(); PathNameArray.remove(PathNameArray.size() - 1); } } } catch (RuntimeException e) { Toast.makeText(getApplicationContext(), "Corrupt Clip, Clip Not Added", Toast.LENGTH_SHORT).show(); File file = new File(prRecordedFile.getPath()); boolean deleted = file.delete(); timer.cancel(); Log.e("Exception Caught", "File Not Added"); } finally { try { prCamera.reconnect(); } catch (IOException e) { e.printStackTrace(); } } } prMediaRecorder = new MediaRecorder(); MarkerName = null; Please Help me out, something wrong with my code or what ?
tagged with: android-mediarecorder
accepted answer: http://stackoverflow.com/a/26624723
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41771832
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26577122
score: 4
has text: Or at least some crash log.

http://stackoverflow.com/comment/41809953
comment on: http://stackoverflow.com/q/26597642
type: QuestionComment
type: Comment
score: 0
has text: "this import java.mail". It doesn't say that. Look again.

c#
tags question: http://stackoverflow.com/q/26622422
tag name: c#
tags question: http://stackoverflow.com/q/26656427
tags question: http://stackoverflow.com/q/26590492
tags question: http://stackoverflow.com/q/26517658
tags question: http://stackoverflow.com/q/26521282
tags question: http://stackoverflow.com/q/26591831
tags question: http://stackoverflow.com/q/26618796
tags question: http://stackoverflow.com/q/26531216
tags question: http://stackoverflow.com/q/26544946
tags question: http://stackoverflow.com/q/26604836
tags question: http://stackoverflow.com/q/26532847
tags question: http://stackoverflow.com/q/26533469
tags question: http://stackoverflow.com/q/26558084
type: Tag
tags question: http://stackoverflow.com/q/26655443
tags question: http://stackoverflow.com/q/26605826

http://stackoverflow.com/comment/48411242
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26656398
has text: Hi Thunder, Could you please show your baseLayout.jsp page? I also face this error today and able to resolved it. You need to specify your meta, navbar, body and footer in the baseLayout.jsp in the following ways, <tiles:insertAttribute name="ATTRIBUTE_NAME" />. If you want to make some tile optional then you need to write <tiles:insertAttribute name="ATTRIBUTE_NAME" ignore="true"/>

http://stackoverflow.com/q/26523377
has answer: http://stackoverflow.com/a/26523478
favorite count: 0
has answer: http://stackoverflow.com/a/26524402
has body: I'm trying to parse an html document in a webservice. According to google, jsoup seem to be the faster and easier html parser, so I included in my project but I get the exception "Exception: java.lang.reflect.InvocationTargetException Message: java.lang.reflect.InvocationTargetException" I have tried everything, but nothings give results. Please help I add jsoup.jar in my project's libray classpath. I am using Eclipse Luna on Windows XP Java 1.7 apache tomcat 7.0 this is my code: try { url = new URL("http://consulta.muniguate.com/emetra/despliega.php?tplaca="+tplaca+"&amp;nplaca="+nplaca); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = rd.readLine()) != null) { result += line; } Document doc = Jsoup.connect(result).get(); String title= doc.title(); System.out.println(title); rd.close(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } This is the full code: package clases; import java.io.BufferedReader; import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import org.jsoup.Connection.Method; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; @WebService(serviceName = "Transito") public class Transito { @WebMethod(operationName = "consultar_saldo") public String consultar_saldo(String tplaca, int nplaca) throws InvocationTargetException { String result = ""; try { Document doc= Jsoup.connect("http://www.muniguate.com/utilities/remisiones.htm?tplaca="+tplaca+"&amp;nplaca="+nplaca).userAgent("Mozilla").get(); String result = doc.title(); System.out.println(result); } catch (Excepti…
has comment: http://stackoverflow.com/comment/41675200
upvote count: 0
has comment: http://stackoverflow.com/comment/41691175
type: UnansweredQuestion
tagged with: java
type: Question
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41690476
answer count: 2
tagged with: jsoup
has title: java.lang.reflect.InvocationTargetException while using jsoup
downvote count: 1

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/26561175
tags question: http://stackoverflow.com/q/26632219
type: Tag

http://stackoverflow.com/comment/76510467
type: Comment
comment on: http://stackoverflow.com/a/44720416
score: 1
has text: Having to restart Mysql is basically a nonstarter in almost all production use cases. It's becomes even more of a problem when replications are involved.
type: AnswerComment

http://stackoverflow.com/a/26604907
has body: It's simple :) List&lt;Integer&gt; a = new ArrayList&lt;&gt;(Arrays.asList(21, 41, 96, 02)); List&lt;Integer&gt; b = new ArrayList&lt;&gt;(Arrays.asList(21, 96, 32, 952, 1835)); b.removeAll(a) // now list b contains (32, 952, 1835) a.addAll(b); // now list a contains (21, 41, 96, 02, 32, 952, 1835)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41822766
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26604549
has comment: http://stackoverflow.com/comment/41822677
answers question: http://stackoverflow.com/q/26604549

http://stackoverflow.com/comment/41865973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26628497
has text: `JFileChooser` is not used for reading files. `FileReader` and all subtypes are used for reading files.
score: 0

http://stackoverflow.com/comment/41669675
has text: Ok, so get the jar and put it in /WEB-INF/lib.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26519342
type: Comment

http://stackoverflow.com/a/26555232
accepted answer of: http://stackoverflow.com/q/26555199
has comment: http://stackoverflow.com/comment/41732565
answers question: http://stackoverflow.com/q/26555199
has comment: http://stackoverflow.com/comment/41732308
type: Answer
has body: 63 is the codepoint for ?. The decoder will return a ? for every byte that is not valid in that encoding. For US-ASCII, that includes every byte above 127. For UTF-8, that includes every byte above 127 which does not follow proper UTF8 rules.
has comment: http://stackoverflow.com/comment/41732250
upvote count: 3
has comment: http://stackoverflow.com/comment/41732301
has comment: http://stackoverflow.com/comment/41732218
score: 3
has comment: http://stackoverflow.com/comment/41732679
has comment: http://stackoverflow.com/comment/41732435
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26657969
score: 0
type: Question
has answer: http://stackoverflow.com/a/26658018
tagged with: java
has body: I'm making a game in java where I use quite a few "delicate tools" like filewriters, Gl, Al, ect. In my exit method in my game I close all that has to be closed, but if something unpredicted happens and if an exception is thrown I get warnings in the console about these unclosed things, which I have a hunch might not be too good. I know I can configure all my trys', catch and finally blocks, but that would be a pain and make my code ugly, so I wonder if there another way. Basically I want to tell the JVM that "when an exception is thrown, don't do System.exit() do THIS first.... THIS = close this, close that.
answer count: 1
has title: Make Exceptions do things by default
accepted answer: http://stackoverflow.com/a/26658018
linked to: http://stackoverflow.com/q/588634
tagged with: exception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41918311

http://stackoverflow.com/q/26592811
has comment: http://stackoverflow.com/comment/41800546
has comment: http://stackoverflow.com/comment/41810693
has title: JTextPane .getText() not preserving whitespace for HTML?
has comment: http://stackoverflow.com/comment/41810530
has comment: http://stackoverflow.com/comment/41800804
score: 0
has body: If I have an editable JTextPane with content type set to text/html I don't see whitespace preserved. I.E.: if I run the following: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.html.*; public class HtmlPasteTest extends JFrame implements ActionListener { JTextPane PANE; public static void main(String[] args) { new HtmlPasteTest(); } public HtmlPasteTest() { HTMLEditorKit KIT = new HTMLEditorKit(); HTMLDocument DOC = (HTMLDocument)(KIT.createDefaultDocument()); PANE = new JTextPane(); PANE.setContentType("text/html"); PANE.setEditorKit(KIT); PANE.setDocument(DOC); JButton dump = new JButton("DUMP"); dump.addActionListener(this); getContentPane().setLayout(new BorderLayout()); getContentPane().add(dump, BorderLayout.NORTH); getContentPane().add(PANE, BorderLayout.CENTER); setSize(600, 600); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e) { System.out.println(PANE.getText()); } } ... then type "a &nbsp; &nbsp; b" &amp; click the DUMP button I'd expect to see something like the following: a &amp;nbsp; &amp;nbsp; b ... however instead I see the following: a b ... am I missing some sort of setting here ?
has comment: http://stackoverflow.com/comment/41801969
answer count: 1
has answer: http://stackoverflow.com/a/26594256
has comment: http://stackoverflow.com/comment/41800629
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41802754
has comment: http://stackoverflow.com/comment/41803393
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41802727
tagged with: whitespace
tagged with: jtextpane
tagged with: swing
accepted answer: http://stackoverflow.com/a/26594256
type: Question

http://stackoverflow.com/comment/103373834
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26543490
has text: Maven is just not really suited for this. Build tools like Bazel are. You can build and run tests only on affected parts and you're able to determine the granularity yourself.
type: Comment

http://stackoverflow.com/q/26587551
score: 0
tagged with: java
tagged with: eclipse
type: Question
tagged with: jar
accepted answer: http://stackoverflow.com/a/26589640
has body: I have an application that is working for over a year, All my classes were sitting in the default_package, Since it got bigger (over 30 classes), I've decided to separate it to different packages. I refactored everything, made the changes and handled all errors. now it works perfect when I run it through eclipse, but when I export it to a runnable jar, it is not working. I tried both export methods: Extract required Libraries.... and Package required Libraries doesn't work on either... when I run it from command prompt I get the following error: E:\Request Server 3.0&gt;java -jar RequestSrvV3DB1111.jar Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at dudug.RequestServer.ServerInfoPanel.&lt;init&gt;(ServerInfoPanel.java:110) at dudug.RequestServer.RequestServerDB$1.run(RequestServerDB.java:56) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Please HELP !!!
has title: java application is not running on jar after sorting in packages
answer count: 1
tagged with: exception
tagged with: package
has answer: http://stackoverflow.com/a/26589640
has comment: http://stackoverflow.com/comment/41793888
has comment: http://stackoverflow.com/comment/41790093
type: AnsweredQuestion

http://stackoverflow.com/q/26524260
tagged with: helios
type: Question
upvote count: 2
tagged with: xuggler
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/39695319
has answer: http://stackoverflow.com/a/26780762
has title: Xuggler Video To Audio conversion
type: UnansweredQuestion
has body: I am converting video to audio using Xuggler library in Java. There are no errors or exceptions arising in the program but the audio file generated is 0 Kb. Could someone fix the problem? Environment: Eclipse Helios, OS: Windows 7 External JAR libraries added to project: (1)slf4j-api-1.7.7.jar (2)slf4j-simple-1.7.7.jar (3)xuggle-xuggler-5.4.jar Code snippet for video to audio conversion. import com.xuggle.mediatool.IMediaReader; import com.xuggle.mediatool.IMediaWriter; import com.xuggle.mediatool.ToolFactory; import com.xuggle.xuggler.ICodec; public class VideoToAudio{ public void convertVideoToAudio(){ IMediaReader reader = ToolFactory.makeReader("D://vid.mp4"); IMediaWriter writer = ToolFactory.makeWriter("D://a.mp3",reader); int sampleRate = 44100; int channels = 1; writer.addAudioStream(0, 0, ICodec.ID.CODEC_ID_MP3, channels, sampleRate); while (reader.readPacket() == null); } public static void main(String [] args){ VideoToAudio vta = new VideoToAudio(); try{ vta.convertVideoToAudio(); } catch(Exception e){ System.out.println("Could not open video file"); } } }
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/41791564
has text: Ok! thanks for your help! I am doing this like your way
type: AnswerComment
comment on: http://stackoverflow.com/a/26588272
score: 0
type: Comment

http://stackoverflow.com/q/26544412
type: Question
has comment: http://stackoverflow.com/comment/41713143
has comment: http://stackoverflow.com/comment/41713119
has comment: http://stackoverflow.com/comment/41712531
has comment: http://stackoverflow.com/comment/41714247
has comment: http://stackoverflow.com/comment/41712493
has comment: http://stackoverflow.com/comment/41712658
has comment: http://stackoverflow.com/comment/41713345
score: 0
has comment: http://stackoverflow.com/comment/41713232
has title: Finding use of == or != for a specific class in huge Java code
has comment: http://stackoverflow.com/comment/41713624
has comment: http://stackoverflow.com/comment/41712613
has comment: http://stackoverflow.com/comment/41713197
has body: I need to replace every use of == and != for one class by the proper call to equals method, but this class is very often used and spending hours to track every single reference of the class to check if it is compared somewhere in each peace of code seems a daunting task. Is there a way to find all use of == and != with this specific class as it would be possible to find all calls to a method of this class ? I'm currently using eclipse but if some other tool does the job I'll use it ! I found nothing about such a problem. Am I missing something here that makes it irrelevant ? (please spare us the "you should have used equals in the first place", it's not my code nor my did. I'm looking for solutions)
tagged with: equals
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41712559
has comment: http://stackoverflow.com/comment/41713884
has comment: http://stackoverflow.com/comment/41712850
has comment: http://stackoverflow.com/comment/41712753
tagged with: java
tagged with: comparison

http://stackoverflow.com/comment/41821860
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26604057
has text: but then can I say System.gc() postponed the error? and if it has can you expalin how did it manage to postpone it

http://stackoverflow.com/comment/41842120
comment on: http://stackoverflow.com/a/26615339
type: AnswerComment
has text: Yes I totally agree, that's the way I would be doing it, although it's clearly specified that I should use 2 constructors and not 1.
score: 0
type: Comment

http://stackoverflow.com/a/26523797
has body: It's just like you said, you can't override a private method, make it protected
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26523720

http://stackoverflow.com/q/26586489
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
type: Question
tagged with: performance
has body: My professor tends to do the following to get a number from the user: Scanner scanner = new Scanner(System.in); Integer.parseInt(scanner.nextLine()); What are the benefits as opposed to simply doing scanner.nextInt() ? java.util.Scanner.java has the following in it: public int nextInt() { return nextInt(defaultRadix); } public int nextInt(int radix) { // Check cached result if ((typeCache != null) &amp;&amp; (typeCache instanceof Integer) &amp;&amp; this.radix == radix) { int val = ((Integer)typeCache).intValue(); useTypeCache(); return val; } setRadix(radix); clearCaches(); // Search for next int try { String s = next(integerPattern()); if (matcher.group(SIMPLE_GROUP_INDEX) == null) s = processIntegerToken(s); return Integer.parseInt(s, radix); } catch (NumberFormatException nfe) { position = matcher.start(); // don't skip bad token throw new InputMismatchException(nfe.getMessage()); } } As I see it, Scanner calls Integer.parseInt() itself as well, on top of additional hocus pocus. Are there significant performance gains in doing simply Integer.parseInt(scanner.nextLine()) ? Are there on the other hand any drawbacks? How about when scanning through a file with significant amount of data, and not a user input?
has answer: http://stackoverflow.com/a/26586629
has answer: http://stackoverflow.com/a/74939978
downvote count: 0
has answer: http://stackoverflow.com/a/44418075
favorite count: 0
has title: Integer.parseInt(scanner.nextLine()) vs scanner.nextInt()
possible better answer: http://stackoverflow.com/a/26586689
score: 11
accepted answer: http://stackoverflow.com/a/26586629
answer count: 4
upvote count: 11
has answer: http://stackoverflow.com/a/26586689
tagged with: user-input
tagged with: integer

http://stackoverflow.com/a/26665077
has comment: http://stackoverflow.com/comment/41933984
has comment: http://stackoverflow.com/comment/41931886
downvote count: 1
has body: You could do this, using and to shorten your code: // We set the valid ones if (a &gt; b) { em.setAlpha(); } else { //throw error that prevents em.persist } if (c &gt; d) { em.setBeta(); } else { //throw error that prevents em.persist } if (e &gt; f) { em.setOmega(); } else { //throw error that prevents em.persist } public boolean validate() { if ((a &gt; b) &amp;&amp; (c &gt; d) &amp;&amp; (e &gt; f)) { return true; } else { return false; } } if (validate()) { database.persist(em); } After that you can call if validate() to check conditions more quickly as well.
score: -1
has comment: http://stackoverflow.com/comment/41931929
answers question: http://stackoverflow.com/q/26665005
has comment: http://stackoverflow.com/comment/41934073
upvote count: 0
has comment: http://stackoverflow.com/comment/41931851
type: Answer
has comment: http://stackoverflow.com/comment/41931867

http://stackoverflow.com/q/26537627
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/41702389
tagged with: thread-sleep
has body: Completely new to Java, however I have to, somehow, make this work. I hope You guys can get me on the right path. The program has to create N threads and an array of N elements. The first thread should write a random number into the array (here - resultArray), call (or create) the next thread (which will do the same) and sleep until the last thread notifies all other sleeping threads. So, am I doing this correctly so far? How can I make the run() access demo's resultArray and write in the thread's random number? Also, how can run() reach other threads (of the threadList) to notify them? Thank You. public class gijos extends Thread { private int length; private int position; public gijos(int arrPos) { position = arrPos; } public int getPosition(){ return position; } public void run() { Random rand = new Random(); int n = rand.nextInt(51) + 1; } public class demo { public static void main (String[] args) { System.out.println("Array length / thread count:"); Scanner s = new Scanner(System.in); int N = s.nextInt(); int[] resultArray = new int[N]; gijos[] threadList = new gijos[N]; for(int i = 0; i &lt; N; i++){ threadList[i] = new gijos(i); } } }
has comment: http://stackoverflow.com/comment/41701439
accepted answer: http://stackoverflow.com/a/26539742
has comment: http://stackoverflow.com/comment/41701051
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41701297
has comment: http://stackoverflow.com/comment/41702536
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41701625
has comment: http://stackoverflow.com/comment/41702272
tagged with: java
has comment: http://stackoverflow.com/comment/41701248
tagged with: notify
has answer: http://stackoverflow.com/a/26539742
score: 0
has title: Java threads starting other threads, each writing into array
has comment: http://stackoverflow.com/comment/41701465

http://stackoverflow.com/comment/41765879
comment on: http://stackoverflow.com/a/26573919
has text: Great answer! Removing the get method did it for me. I didn't know that the get was making the request synchronous so this explained a lot. The addition of the get method to AsyncTask is indeed strange.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41749296
has text: Yes, it does. Here is a full code of BSTtree class - http://pastebin.com/zDxJKUBV, and Pair class - http://pastebin.com/hNCQYpge
type: Comment
comment on: http://stackoverflow.com/a/26564105
score: 0
type: AnswerComment

http://stackoverflow.com/comment/44748814
score: 0
type: AnswerComment
type: Comment
has text: sometimes you don't have time to answer completely you just give the way to think.
comment on: http://stackoverflow.com/a/26526915

http://stackoverflow.com/q/26525180
score: 1
tagged with: java
tagged with: javascript
has answer: http://stackoverflow.com/a/26525279
has comment: http://stackoverflow.com/comment/41679996
answer count: 2
has answer: http://stackoverflow.com/a/26525517
has comment: http://stackoverflow.com/comment/41678047
has title: node.js and Java
downvote count: 0
has comment: http://stackoverflow.com/comment/41678787
favorite count: 0
has comment: http://stackoverflow.com/comment/41690624
type: UnansweredQuestion
has body: I am working on a research project, which was described here: Searching Google Images from Java . I have the basic GUI working, minus the content that consists of the two pictures and the question, that was required there. I showed the guy who gave me the research position, and he wants to now make sure that I can up it to anywhere between those two pictures and six pictures, per panel. I figured out how to search Google programmatically, from Java, and decided to do it in Java, because it was the best language that I knew of to create GUI's in, as most of my GUI-creating experience is in Java. This is what I have so far However, the research project guy is wanting to move this to his server, and wanting me to use Node.js to make the GUI, as well as HTML/JavaScript/CSS. Is there anyway to have layouts in those client-side languages that are similar to Java's Layouts? /* If I could stay in Java, I could just use two JPanels: a picturePanel, which would have a GridLayout, and a questionPanel, which would have only the JLabel with the question in it. Also, he told me that Node.js works really well with Java. Could someone tell me how would it work, and how to determine the contents of the panels programmatically, using Node.js? (Would the latter work in a way that is similar to writing PHP code, in the sense that you can have it live alongside HTML code?)
tagged with: node.js
has comment: http://stackoverflow.com/comment/41758358
linked to: http://stackoverflow.com/q/26393873
upvote count: 1
type: Question

http://stackoverflow.com/comment/41962181
type: Comment
comment on: http://stackoverflow.com/q/26632799
score: 0
has text: @NathanCooper - Have a look at what? If you want to go to all the trouble to force a JITC to generate code, capture the code, and then try to make heads or tails of it, be my guest.
type: QuestionComment

http://stackoverflow.com/a/26530351
type: Answer
has body: Here's one simple way: String example = "\"test1, test2\",\"test3\""; int quote1, quote2 = -1; while((quote2 != example.length() - 1) &amp;&amp; quote1 = example.indexOf("\"", quote2 + 1) != -1) { quote2 = example.indexOf("\"", quote1 + 1); String sub = example.substring(quote1 + 1, quote2); // will be the text in your quotes }
score: 2
answers question: http://stackoverflow.com/q/26530121
has comment: http://stackoverflow.com/comment/41687091
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41718814
has text: Good time to learn Inheritance and Instantiation with a parent.
score: 2
comment on: http://stackoverflow.com/q/26547980
type: Comment
type: QuestionComment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/26640572
tags question: http://stackoverflow.com/q/26552459
tags question: http://stackoverflow.com/q/26531191
tags question: http://stackoverflow.com/q/26651261
tags question: http://stackoverflow.com/q/26519866
tags question: http://stackoverflow.com/q/26559521
type: Tag
tags question: http://stackoverflow.com/q/26585529

http://stackoverflow.com/q/26584836
has comment: http://stackoverflow.com/comment/41785521
tagged with: javascript
linked to: http://stackoverflow.com/q/201323
score: 0
has comment: http://stackoverflow.com/comment/41785358
possible better answer: http://stackoverflow.com/a/26585096
tagged with: regex
favorite count: 0
has title: Regex validation in java and java scipt for email address
downvote count: 2
type: AnsweredQuestion
has body: We are using below regular expression to validate email address in java ^[\\w!#\\$'\\*\\+=\\?\\^\\/_~-]+(\\.[\\w!#\\$'\\*\\+=\\?\\^\\/_~-]+)*@([a-zA-Z0-9\\-]+\\.)+[A-Z]{2,4}$ and it worked fine with invalid email address raju.rathi@gmail.com&amp;^(*&amp;^(*^2 but when I use the same regular expression in javascript , it doesn't work and failes with even valid email addresses . Please suggest what could be root cause of this mismatch? for e.g. in javascript , I'm getting false value with below test conditional - /^[\w!#\$'\*\+=\?\^\/~-]+(\.[\w!#\$'\*\+=\?\^\/~-]+)*@([a-zA-Z0-9\-]+\.)+ [A-Z]{2,4}$/.test("raju.rathi@gmail.com")
has answer: http://stackoverflow.com/a/26585096
tagged with: java
has answer: http://stackoverflow.com/a/26584876
accepted answer: http://stackoverflow.com/a/26584876
tagged with: email-validation
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41785618

http://stackoverflow.com/comment/41714605
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26545733
has text: Show us some relevant code please, like the top level try catch

http://stackoverflow.com/q/26598527
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26598542
favorite count: 0
has comment: http://stackoverflow.com/comment/41811400
has title: How come when i read an in from System.in I get a completely different value than I read in?
tagged with: input
has comment: http://stackoverflow.com/comment/41811345
has body: Here's the code: public static void main(String args[]) throws IOException { int i = System.in.read(); System.out.println(i); } When I input 13 for example it prints out 49..? why is that? And how do I fix that?
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41811423
upvote count: 1
tagged with: java
tagged with: system.in
has comment: http://stackoverflow.com/comment/41811358
type: Question
has comment: http://stackoverflow.com/comment/41811387

http://stackoverflow.com/comment/41887537
type: Comment
comment on: http://stackoverflow.com/a/26639232
has text: That's not right. You have to deal with context in JSP or Servlets. This is not the same as a console Java program.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41839154
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26613588
has text: @nomoa, What I'm asking specifically is, how do I pass those two missing parameters to getMethod
score: 0

http://stackoverflow.com/q/26519095
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41669925
type: AnsweredQuestion
has title: hereNow() with state=true is not working
tagged with: pubnub
has comment: http://stackoverflow.com/comment/41673061
score: 1
has body: I started working with PubNub for an Android app. But there is one issue I struggle with - I would like to retrieve the state information out of the hereNow() function. Given the API reference this should be possible with the Constructor hereNow(java.lang.String channel, boolean state, boolean uuids, Callback callback) (see the javadoc here) But it seems to me that this is just not working, as my app crashes when I use this constructor but works just fine when using hereNow(java.lang.String channel, Callback callback) The callback is very simple for testing: Callback hereNowCallBack = new Callback(){ @Override public void successCallback(String channel, Object message) { Log.d("PUBNUB","here now: " + message.toString()); } }; I use the JAR version 3.6.3 if that matters. This feature would be of incredible value to me as I would not need to get the state for each UUID after I found out which UUIDs are active in the channel. By the way - what is the maximum size such a "state" can have?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26522284
accepted answer: http://stackoverflow.com/a/26522284
upvote count: 1
has comment: http://stackoverflow.com/comment/41677615
answer count: 1

http://stackoverflow.com/a/26541652
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41707765
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26541471
score: 3
has body: public class Test { public static void main(String[] args) throws Exception { Scanner keyboard = new Scanner(System.in); System.out.println("What is your number?"); int n = keyboard.nextInt(); ArrayList&lt;Integer&gt; result = getHailstonSequence(n); System.out.println(result); } public static ArrayList&lt;Integer&gt; getHailstonSequence(int n) { ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); numbers.add(n); while (n != 1) { if (n % 2 == 0) { System.out.print(n + " is even so I take half "); n = n / 2; System.out.println(n); } else { System.out.print(n + " is odd so I make 3n+1 "); n = (n * 3) + 1; System.out.println(n); } numbers.add(n); } return numbers; } }
answers question: http://stackoverflow.com/q/26541471

http://stackoverflow.com/comment/41884248
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26635649
has text: @ChrisStratton Point taken, vote retracted. It was based on (incorrectly scanning) the stack trace btw. ;-)

http://stackoverflow.com/a/26553904
has body: Asking an instance of Apple whether it is equal to a particular instance of Orange should not cause it any trouble. It should simply observe that because it does not consider itself equal to any objects which are not of type Apple, and because it was given a reference to something that isn't of type Apple, it does not consider itself equal to the passed in object. Further, certain interfaces have contracts which require implementations them to consider themselves equal to any other implementations meeting certain criteria. It would thus be possible for two objects which are of unrelated types to both implement an interface which requires that the two objects report each other as equal. Even if the types of the references have no interface in common, unless at least one is sealed it would be possible for instances of types derived from them to share an interface which would compel a reciprocal equality relationship. Consequently, while there are certainly cases where static analysis could reveal that the objects identified by references of two different classes cannot possibly consider themselves equal, the level of static analysis required would be far beyond anything the generic type system could possibly encapsulate [among other things, it would require examination of the code in the different types' equals methods]. I would suggest that while it might in theory be nice if the compiler could identify cases where code tried to compare things that couldn't possibly be equal, the way that rules about equals are defined (including the fact that it's permissible--and in some cases required--for instances of unrelated classes to compare themselves equal to each other) means that in general what you seek isn't possible. If it's possible to ask an instance of Apple whether it's equal to any particular Fruit, then it must be possible to ask it whether it's equal to any particular instance of any type derived from Fruit. The Apple shouldn't care if the question is silly; it…
score: 5
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26551339
has comment: http://stackoverflow.com/comment/41729740

http://stackoverflow.com/a/26572965
has body: You need to create an instance of each Field Try the following: List fields = new ArrayList(); for(int i = 1; i &lt;= 40; i++){ fields.add(new Field("Field"+i, i)); }
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26572604

http://stackoverflow.com/comment/41821736
type: Comment
has text: You can call function before submitting form like, and in this function you can actually getEelementById and iterate through values
comment on: http://stackoverflow.com/a/26604362
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41899580
score: 0
type: AnswerComment
has text: Hm... There may not be a nice way to do that. Perhaps set a system property and use the ${sys:mypath} lookup syntax in your log4j2.xml path name? (http://logging.apache.org/log4j/2.x/manual/lookups.html )
type: Comment
comment on: http://stackoverflow.com/a/26557602

http://stackoverflow.com/comment/41877179
type: AnswerComment
score: 0
type: Comment
has text: so the x is set to 0 (which means the line wont be printed) if awk finds a line starting with a date, but without ERROR in it? cool XD
comment on: http://stackoverflow.com/a/26611927

jpa
tags question: http://stackoverflow.com/q/26655854
tags question: http://stackoverflow.com/q/26529090
tags question: http://stackoverflow.com/q/26654267
tags question: http://stackoverflow.com/q/26537668
tags question: http://stackoverflow.com/q/26548505
tags question: http://stackoverflow.com/q/26589388
tags question: http://stackoverflow.com/q/26593716
tags question: http://stackoverflow.com/q/26599436
tags question: http://stackoverflow.com/q/26626428
tags question: http://stackoverflow.com/q/26609724
tags question: http://stackoverflow.com/q/26657431
tags question: http://stackoverflow.com/q/26639227
tags question: http://stackoverflow.com/q/26655846
tags question: http://stackoverflow.com/q/26534841
tags question: http://stackoverflow.com/q/26603884
tags question: http://stackoverflow.com/q/26666496
tags question: http://stackoverflow.com/q/26598207
tags question: http://stackoverflow.com/q/26672322
tags question: http://stackoverflow.com/q/26672909
tags question: http://stackoverflow.com/q/26524403
tags question: http://stackoverflow.com/q/26625793
tags question: http://stackoverflow.com/q/26624036
tags question: http://stackoverflow.com/q/26583324
tags question: http://stackoverflow.com/q/26611387
tags question: http://stackoverflow.com/q/26585064
tags question: http://stackoverflow.com/q/26618138
tags question: http://stackoverflow.com/q/26598110
tags question: http://stackoverflow.com/q/26611402
tags question: http://stackoverflow.com/q/26661063
tags question: http://stackoverflow.com/q/26623314
tags question: http://stackoverflow.com/q/26535614
tags question: http://stackoverflow.com/q/26657682
tags question: http://stackoverflow.com/q/26594328
tags question: http://stackoverflow.com/q/26556989
type: Tag
tags question: http://stackoverflow.com/q/26522403
tags question: http://stackoverflow.com/q/26526261
tags question: http://stackoverflow.com/q/26601032
tags question: http://stackoverflow.com/q/26535896
tags question: http://stackoverflow.com/q/26663114
tags question: http://stackoverflow.com/q/26616723
tags question: http://stackoverflow.com/q/26656632
tags question: http://stackoverflow.com/q/26631827
tags question: http://stackoverflow.com/q/26656302
tags question: http://stackoverflow.com/q/26528193
tags question: http://stackoverflow.com/q/26671600
tags question: http://stackoverflow.com/q/26548771
tags question: http://stackoverflow.com/q/26647399
tags question: http://stackoverflow.com/q/26640025
tags question: http://stackoverflow.com/q/26591521
tags question: http://stackoverflow.com/q/26605185
tags question: http://stackoverflow.com/q/26615851
tags question: http://stackoverflow.com/q/26550660
tags question: http://stackoverflow.com/q/26641623
tags question: http://stackoverflow.com/q/26529995
tags question: http://stackoverflow.com/q/26566743
tags question: http://stackoverflow.com/q/26652601
tags question: http://stackoverflow.com/q/26611181
tags question: http://stackoverflow.com/q/26593245
tags question: http://stackoverflow.com/q/26550074
tags question: http://stackoverflow.com/q/26636295
tags question: http://stackoverflow.com/q/26650948
tags question: http://stackoverflow.com/q/26526202
tags question: http://stackoverflow.com/q/26596501
tags question: http://stackoverflow.com/q/26652591
tags question: http://stackoverflow.com/q/26639478
tags question: http://stackoverflow.com/q/26628425
tags question: http://stackoverflow.com/q/26514219
tags question: http://stackoverflow.com/q/26543901
tags question: http://stackoverflow.com/q/26557017
tags question: http://stackoverflow.com/q/26527602
tag name: jpa
tags question: http://stackoverflow.com/q/26555279
tags question: http://stackoverflow.com/q/26552555
tags question: http://stackoverflow.com/q/26617551
tags question: http://stackoverflow.com/q/26620498
tags question: http://stackoverflow.com/q/26605599
tags question: http://stackoverflow.com/q/26566331
tags question: http://stackoverflow.com/q/26560999
tags question: http://stackoverflow.com/q/26620929

http://stackoverflow.com/q/26657260
tagged with: reflection
tagged with: java
type: Question
answer count: 1
tagged with: junit
accepted answer: http://stackoverflow.com/a/26657596
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26657596
favorite count: 0
has body: I would like to know what would be the impact if a unit testing framework (for Java specifically) does not use any of the Reflection facilities. For example, if junit doesn't use Reflection at all to invoke tests, what will be the impact on its usage or features that it currently supports. Are there any alternatives to match the flexibility of Reflection APIs?
has title: is it possible to write a junit kind of unit testing framework without using any reflection facilities?
type: AnsweredQuestion

http://stackoverflow.com/comment/41752578
score: 0
has text: Doh, too much php for me... I used **foreach** but actually the right one is **for**, update the post.
type: AnswerComment
comment on: http://stackoverflow.com/a/26566133
type: Comment

http://stackoverflow.com/comment/41762061
score: 0
type: AnswerComment
has text: Think about what you're doing. You are using `.` operator. You need a valid lvalue to use `.` operator. Simply using `Long` ain't gonna cut it. In java `long` is prim type, `Long` is custom type of `long`. In IDEs like Eclipse/NetBeans, you'll see as soon as you type `Long` it becomes highlighted/bold texted or somth. different that usual code. Read about Java Prim Types - 8 of 'em - [here](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html). Also, you need to understand why they did `String`,'Long`,`Int`, etc. additional types on top of prims
type: Comment
comment on: http://stackoverflow.com/a/26546323

http://stackoverflow.com/q/26607818
tagged with: java
linked to: http://stackoverflow.com/q/10653919
type: Question
has answer: http://stackoverflow.com/a/26619964
tagged with: access-modifiers
tagged with: class
has comment: http://stackoverflow.com/comment/54032673
score: 0
has answer: http://stackoverflow.com/a/26607904
answer count: 3
tagged with: jar
has answer: http://stackoverflow.com/a/26607911
type: UnansweredQuestion
tagged with: package
has title: How can classes be made to be accessible from different package but not accessible from different library/ jar in java?
has comment: http://stackoverflow.com/comment/59211768
has body: I want my library/ jar in java to keep only its behavior (exposed interfaces) public and want rest of the stuff non-public for outside world. To keep the code modularized I also want to use different packages. How can I made classes accessible to each other from different packages within the same jar, but not accessible from any client outside of the jar?

http://stackoverflow.com/comment/41796259
type: Comment
has text: `run()` -> `start()`. You just ran the `Thread` instance as a `Runnable` in the current thread.
type: QuestionComment
comment on: http://stackoverflow.com/q/26590651
score: 4

http://stackoverflow.com/q/26593845
has title: Unreachable statement from the Decompiler output
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41803800
has comment: http://stackoverflow.com/comment/42028689
accepted answer: http://stackoverflow.com/a/26593949
type: Question
answer count: 1
tagged with: decompiling
favorite count: 0
has comment: http://stackoverflow.com/comment/41907756
tagged with: android
tagged with: dex2jar
has answer: http://stackoverflow.com/a/26593949
has body: I decompiled an APK file, then tried to compile it and received an "Unreachable statement" compiler error, I want to know is it a obfuscator trick, or decompiler failure? How is it possible? Used dex2jar and Java Decompiler And here is the decompiled method public void onSensorChanged(SensorEvent paramSensorEvent) { float[] arrayOfFloat = paramSensorEvent.values; switch (paramSensorEvent.sensor.getType()) { } do { return; } while (this.aDegree == arrayOfFloat[0]); this.aDegree = arrayOfFloat[0]; invalidate(); }
has comment: http://stackoverflow.com/comment/41807932
upvote count: 1
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/26614593
tags question: http://stackoverflow.com/q/26526200
tags question: http://stackoverflow.com/q/26627400
tags question: http://stackoverflow.com/q/26541733
tags question: http://stackoverflow.com/q/26637485
tags question: http://stackoverflow.com/q/26515019
tags question: http://stackoverflow.com/q/26608672
tags question: http://stackoverflow.com/q/26595887
tags question: http://stackoverflow.com/q/26669742
tags question: http://stackoverflow.com/q/26647001
tags question: http://stackoverflow.com/q/26514173
tags question: http://stackoverflow.com/q/26660609
tags question: http://stackoverflow.com/q/26648287
tags question: http://stackoverflow.com/q/26656140
tags question: http://stackoverflow.com/q/26595787
tags question: http://stackoverflow.com/q/26607054
tags question: http://stackoverflow.com/q/26515552
tags question: http://stackoverflow.com/q/26656439
tags question: http://stackoverflow.com/q/26541801
tags question: http://stackoverflow.com/q/26660874
tags question: http://stackoverflow.com/q/26561645
tags question: http://stackoverflow.com/q/26614220
tags question: http://stackoverflow.com/q/26669649
tags question: http://stackoverflow.com/q/26629086
tags question: http://stackoverflow.com/q/26660030
tags question: http://stackoverflow.com/q/26557309
tags question: http://stackoverflow.com/q/26564952
tags question: http://stackoverflow.com/q/26625142
tags question: http://stackoverflow.com/q/26614845
tags question: http://stackoverflow.com/q/26570131
tags question: http://stackoverflow.com/q/26545081
tags question: http://stackoverflow.com/q/26561025
tags question: http://stackoverflow.com/q/26644351
tags question: http://stackoverflow.com/q/26529289
type: Tag
tags question: http://stackoverflow.com/q/26644556
tags question: http://stackoverflow.com/q/26601920
tags question: http://stackoverflow.com/q/26599763
tags question: http://stackoverflow.com/q/26583844
tags question: http://stackoverflow.com/q/26570752
tags question: http://stackoverflow.com/q/26669391
tags question: http://stackoverflow.com/q/26556861
tags question: http://stackoverflow.com/q/26594717
tags question: http://stackoverflow.com/q/26548399
tags question: http://stackoverflow.com/q/26657259
tags question: http://stackoverflow.com/q/26605763
tags question: http://stackoverflow.com/q/26569465
tags question: http://stackoverflow.com/q/26637340
tags question: http://stackoverflow.com/q/26663681
tags question: http://stackoverflow.com/q/26529646
tags question: http://stackoverflow.com/q/26560332
tags question: http://stackoverflow.com/q/26526064
tags question: http://stackoverflow.com/q/26590946
tag name: json
tags question: http://stackoverflow.com/q/26631267
tags question: http://stackoverflow.com/q/26564873
tags question: http://stackoverflow.com/q/26565468
tags question: http://stackoverflow.com/q/26572245
tags question: http://stackoverflow.com/q/26606225
tags question: http://stackoverflow.com/q/26588034
tags question: http://stackoverflow.com/q/26514921
tags question: http://stackoverflow.com/q/26547950
tags question: http://stackoverflow.com/q/26579966
tags question: http://stackoverflow.com/q/26612659
tags question: http://stackoverflow.com/q/26649018
tags question: http://stackoverflow.com/q/26624807
tags question: http://stackoverflow.com/q/26653698
tags question: http://stackoverflow.com/q/26574600
tags question: http://stackoverflow.com/q/26569907
tags question: http://stackoverflow.com/q/26649150
tags question: http://stackoverflow.com/q/26600598
tags question: http://stackoverflow.com/q/26575435
tags question: http://stackoverflow.com/q/26516045
tags question: http://stackoverflow.com/q/26517495
tags question: http://stackoverflow.com/q/26667705
tags question: http://stackoverflow.com/q/26624116
tags question: http://stackoverflow.com/q/26605332
tags question: http://stackoverflow.com/q/26592803
tags question: http://stackoverflow.com/q/26552275
tags question: http://stackoverflow.com/q/26525295

http://stackoverflow.com/q/26551554
linked to: http://stackoverflow.com/q/12337504
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26551868
tagged with: mysql
type: Question
answer count: 3
has title: How to add mysql datasource to applicationContext.xml
score: 0
has answer: http://stackoverflow.com/a/45926706
has answer: http://stackoverflow.com/a/26607099
accepted answer: http://stackoverflow.com/a/26607099
tagged with: maven
has body: I am making a dynamic web application. In my application I use Spring and Hibernate. Here is my pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 rasika.gayan.nought mit-site-temp 0.0.1-SNAPSHOT war <org.springframework.version>4.1.1.RELEASE</org.springframework.version> org.springframework spring-core ${org.springframework.version} org.springframework spring-expression ${org.springframework.version} org.springframework spring-beans ${org.springframework.version} org.springframework spring-aop ${org.springframework.version} org.springframework spring-context ${org.springframework.version} org.springframework spring-context-support ${org.springframework.version} org.springframework spring-tx ${org.springframework.version} org.springframework spring-jdbc ${org.springframework.version} org.springframework spring-orm ${org.springframework.version} org.springframework spring-oxm ${org.springframework.version} org.springframework spring-web ${org.springframework.version} org.springframework spring-webmvc ${org.springframework.version} org.springframework spring-webmvc-portlet ${org.springframework.version} org.springframework spring-test ${org.springframework.version} test javax.servlet javax.servlet-api 3.0.1 provided javax.servlet.jsp javax.servlet.jsp-api 2.2.1 provided org.hibernate hibernate-entitymanager 4.3.6.Final org.springframework.data spring-data-jpa 1.7.0.RELEASE mysql mysql-connector-java 5.1.6 commons-dbcp commons-dbcp 1.4 javax.persistence persistence-api 1.0 org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final org.slf4j slf4j-log4j12 1.7.7 org.eclipse.jetty jetty-maven-plugin 9.2.3.v20140905 org.apache.maven.plugins maven-compiler-plugin 3.2 1.6 1.6 in my pom.xml I include org.hibernate.javax.persistence and javax.persistence . Is that correct???? Then here is my applicationCo…
tagged with: spring
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26551868

http://stackoverflow.com/comment/41697755
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26535660
has text: Please do a smidgen of research before crying out for help, googling the statement "how to make a transparent buffered image" yields about 100,000 results... try something before giving up.
type: Comment

http://stackoverflow.com/a/26516243
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26516045
answers question: http://stackoverflow.com/q/26516045
upvote count: 2
has body: A ImputStream.read() call on a TCP stream doesn't return -1 once the message ends, instead it is waiting for a new byte (in fact, such a stream only returns -1 if it is closed). In order to achieve the functionality you want, you could use a string termination character in the end (\0) if you don't use it somewhere else in your message or you could send the size of the JSON-message before you send it itself and read in that size.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41662997
type: Answer
has comment: http://stackoverflow.com/comment/41662397
has comment: http://stackoverflow.com/comment/41663581
has comment: http://stackoverflow.com/comment/41662552

http://stackoverflow.com/a/26640046
accepted answer of: http://stackoverflow.com/q/26639651
type: Answer
answers question: http://stackoverflow.com/q/26639651
downvote count: 0
has comment: http://stackoverflow.com/comment/41887305
has body: Combine all the certificates together. Your server.crt will look like this -----BEGIN CERTIFICATE----- 1 Certificate for my site -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- 1st Intermediate Certificate -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- 2nd Intermediate Certificate -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- 1 Root Certificate -----END CERTIFICATE----- Use commands: openssl pkcs12 -export -clcerts -in server.crt -inkey server-private-key.pem -out keystore.pkcs12 keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype pkcs12 -destkeystore keystore.jks -deststoretype jks
has comment: http://stackoverflow.com/comment/41887123
score: 3
has comment: http://stackoverflow.com/comment/41887197
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/26547859
answer count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/26548265
tagged with: android-alertdialog
has title: How to add a 'Click for more details' expandable field to AlertDialog in android
has comment: http://stackoverflow.com/comment/41718587
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41719675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41718588
has body: I have a AlertDialog that is shown when there is an error and it prints 'Error, could not be added/whatever", I also have the result of the exception that I'd like to parse but not shown to all users, only to those that want to click on 'details' and read the exception. AlertDialog.Builder dialogo1 = new AlertDialog.Builder(activity); dialogo1.setTitle("Error"); dialogo1.setMessage("Could not update movie: " + result); dialogo1.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogo1, int id) { activity.finish(); } }); dialogo1.show(); There is my code, pretty simple, right? I haven't been able to find this answer anyway and I'm starting to think it is just not possible
possible better answer: http://stackoverflow.com/a/26549450
has answer: http://stackoverflow.com/a/26548265
type: Question
has answer: http://stackoverflow.com/a/26549450

http://stackoverflow.com/q/26579669
upvote count: 0
score: -2
answer count: 1
favorite count: 0
has title: Read text file and return double array
tagged with: input
accepted answer: http://stackoverflow.com/a/26579846
has comment: http://stackoverflow.com/comment/41776577
downvote count: 2
has body: I need to write a method that reads the supplied filename and returns an array of doubles read from the file. It can be assumed that the file only contains numbers in a single column, one number per line. If the file cannot be read or is not in the proper format it is OK to just return null. How would one go about attempting this? This is my attempt: public static double[] fileRead(String filename) { double[] array = new double(); // get some sort of reader here return array; } I dont know how to go on from here
has comment: http://stackoverflow.com/comment/41776485
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26579846

http://stackoverflow.com/a/26567972
answers question: http://stackoverflow.com/q/26567891
has body: You overrided the button's default border. You should set a compound border using the existing one and a new red one. Border innerBorder = button.getBorder(); Border outerBorder = new LineBorder(Color.RED, 1); button.setBorder(new CompoundBorder(outerBorder, innerBorder)); Here is a one liner combined with using the BorderFactory :-) button.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.RED, 1), button.getBorder())); Using BorderFactory - http://docs.oracle.com/javase/tutorial/uiswing/components/border.html#createapi
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26567891
downvote count: 0

http://stackoverflow.com/a/26535681
score: 3
type: Answer
answers question: http://stackoverflow.com/q/26535441
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26535441
has body: This is because getClass() is an method of the Object base class. That method returns a value of type "Class &lt;?&gt; ". So you cannot assign it to Class&lt;T&gt; without a type cast.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26564873
answer count: 0
tagged with: scala
type: UnansweredQuestion
type: Question
tagged with: lift-json
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: lift
has title: Java 7 to Java 8 breaks our Lift JSON parser 2.6-RC1
score: 0
has comment: http://stackoverflow.com/comment/41749313
has body: I have a weird Scala runtime error running Lift JSON parser 2.6-RC1 and Java8. The code for the error is at https://github.com/listatree/lift-json-java8 The stacktrace error is at: https://github.com/listatree/lift-json-java8/blob/master/stacktrace.txt The error states a ScapaSigParserError validating the class coming from the Lift JSON parser. I know that the Lift JSON parser does extreme things with reflection and/or the AST tree, but so far was working. NOTE: If I tested with java 8 on a Mac OS X it works, if I tested with java 8 on a Linux machine it breaks (sometimes). With java 7 works all the time
has comment: http://stackoverflow.com/comment/41754558

http://stackoverflow.com/q/26598693
has title: "Simple" Spring unit tests
has comment: http://stackoverflow.com/comment/41811866
tagged with: autowired
tagged with: unit-testing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26618137
tagged with: java
has body: I'm trying to configure unit testing for an inherited Spring-based project. I've tried a few things, but basically I get stuck trying to @Autowired stuff into my test cases. Here's my setup: A controller class that looks like this: @Controller("serverService") @RequestMapping("/rest/server") @Api(value = "server") public class ServerServiceImpl extends AbstractServiceImpl implements ServerService { @Override @RequestMapping(value = "/getTime", method = RequestMethod.GET) public @ResponseBody GatewayResponse&lt;TimeData&gt; getTime() {...} ServerService is just an interface that enables interoperation with GWT. I'm not too worried about unit testing from GWT right now. AbstractServiceImpl's main purpose is to wrap a SOAP based web service that this server is essentially proxying and making mobile friendly. The web service is auto-generated by Apache CXF. AbstractServiceImpl is (roughly) as follows: public class AbstractServiceImpl { @Autowired private WebServices webServices; public WebServices getWebServices() { return webServices; } In my test class I have: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:**/applicationContext.xml", "classpath:**/applicationContext-Services.xml"}) @WebAppConfiguration public class LoginTest { @Autowired private ServerServiceImpl svc; public LoginTest() { } @Test public void validate() { assertNotNull(svc); } } I have no interest in trying to create mock calls to my web service with mock JSON and such. I just want to write unit tests that create un-mocked ServerServiceImpl with un-mocked WebServices objects and make calls to a live server. My tests are currently failing because @Autowired is unable to create ServerServiceImpl. I've also tried refactoring my code to use @Autowired for the WebServices and use pass it to the constructor of ServerServiceImpl, but that also fails due to @Autowired.
has comment: http://stackoverflow.com/comment/41812197
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41811887
accepted answer: http://stackoverflow.com/a/26618137
tagged with: spring
has comment: http://stackoverflow.com/comment/41812332

http://stackoverflow.com/q/26653125
has answer: http://stackoverflow.com/a/26677456
upvote count: 1
answer count: 1
tagged with: phaselistener
has comment: http://stackoverflow.com/comment/41931025
tagged with: java
has comment: http://stackoverflow.com/comment/41948559
accepted answer: http://stackoverflow.com/a/26677456
has body: we are getting this exception: TimeoutException: JBAS010213: Cannot acquire lock default-host/... We are using this PhaseListener in our web application to capture session timeout on ajax requests and redirect to index (we are suspecting this could be related, but we dont know): public class SessionExpirationPhaseListener implements PhaseListener { @Override public PhaseId getPhaseId() { return PhaseId.RESTORE_VIEW; } @Override public void beforePhase(PhaseEvent event) { } @Override public void afterPhase(PhaseEvent event) { FacesContext context = FacesContext.getCurrentInstance(); HttpServletRequest httpRequest = (HttpServletRequest) context.getExternalContext().getRequest(); if (httpRequest.getRequestedSessionId() != null &amp;&amp; !httpRequest.isRequestedSessionIdValid()) { String facesRequestHeader = httpRequest.getHeader("Faces-Request"); boolean isAjaxRequest = facesRequestHeader != null &amp;&amp; facesRequestHeader.equals("partial/ajax"); // navigate to home page only for ajax requests if (isAjaxRequest) { ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) context.getApplication().getNavigationHandler(); handler.performNavigation("home"); } } } } We are running over a JBoss cluster with 2 nodes (mod_cluster + apache) and have SSO enabled. Do you guys know what could be wrong? Or at least point us to the right direction? Thanks, Regards.
tagged with: jsf-2
type: AnsweredQuestion
downvote count: 0
tagged with: jboss7.x
score: 1
favorite count: 0
type: Question
tagged with: session-timeout
has title: JSF - SessionExpirationPhaseListener on a JBoss Cluster

http://stackoverflow.com/comment/41883096
score: 0
type: Comment
has text: I'm getting upvoted but reading the comments, I also have the feeling that the OP wants to do this in Javascript. I'm not an expert in JS but you could also do the same kind of thing.
comment on: http://stackoverflow.com/a/26637933
type: AnswerComment

http://stackoverflow.com/q/26556456
accepted answer: http://stackoverflow.com/a/26556513
tagged with: jsp
has body: I have jsp page which contains tab control. Each tab has category name as a caption and contains a table with information about groups of selected category. Clicking on the tab should make a query in the DB and populate the table in the tab with a list of category groups. So I have a method in controller public List&lt;Group&gt; getGroups(int idCategory) { return groupService.getList(idCategory); } How can I call this method in jsp? The only way I see is to put a Map in the ModelMap where a key is a category Id and a value is a list of Groups. But I don't like this idea because we need to make all queries to fill the map, but we may not need some of them if we don't click all the tabs.
possible better answer: http://stackoverflow.com/a/26556510
has title: Spring MVC. Controller and JSP collaboration
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26556513
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26556510

http://stackoverflow.com/comment/41771713
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26577022
type: Comment
has text: Tabs may (admittedly) not be the best way. @WeatherVane linked to a good one in the comments of your question, that might help too.

http://stackoverflow.com/a/26590614
answers question: http://stackoverflow.com/q/26590301
downvote count: 0
has body: use this regex String s="987234.42"; if(Pattern.matches("^\\d+(\\.\\d{2})$", s)){ // string must start with digit followed by .(dot) then exactly two digit. .... }
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/41934022
score: 0
has text: Why are you trying to extend `Map.Entry`? Just make a `FooClass` and override `hashCode()` if you need to.
comment on: http://stackoverflow.com/q/26666161
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26625818
score: 0
type: Answer
has body: I'm preferring to make it as a singleton Class and Have a thread that updates it periodically .. The thread will maintain the state of the cache .. this thread will be started when you get the fist instance of the cache public class CacheSingleton { private static CacheSingleton instance = null; private HashMap&lt;String,Role&gt; authMap; protected CacheSingleton() { // Exists only to defeat instantiation. // Start the thread to maintain Your map } public static CacheSingleton getInstance() { if(instance == null) { instance = new CacheSingleton(); } return instance; } // Add your cache logic here // Like getRole,checkURL() ... etc } wherever in your code you can get the cached data CacheSingleton.getInstance().yourMethod();
answers question: http://stackoverflow.com/q/26625096

http://stackoverflow.com/a/26593707
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41862801
upvote count: 3
answers question: http://stackoverflow.com/q/26565081
score: 3
has body: I suggest you to take a look at the TouchDelegate, if I got your question right it should be exactly what you need. Once you have the tolerance from the settings, you can compute the proper amount of pixels to properly size the delegate. There is some more information and sample code at http://developer.android.com/training/gestures/viewgroup.html#delegate happy coding!
has comment: http://stackoverflow.com/comment/41836823

http://stackoverflow.com/q/26516789
has answer: http://stackoverflow.com/a/26517047
accepted answer: http://stackoverflow.com/a/26517047
type: AnsweredQuestion
score: 3
tagged with: stack
tagged with: java
has title: Using Stack to check balance for multiple lines of code
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26517080
has answer: http://stackoverflow.com/a/26517080
upvote count: 3
has body: I am trying to write code that checks balance for {}, () and [] in any file(with multiple lines). If the file is not balanced report the place(line and character number) where the error occured Here's my code. import java.io.*; import java.util.Stack; public class CppJavaParser { public static class Symbol{ public char symbol; public int lineFound; public int colFound; public Symbol( char symb, int line, int charIndex){ symbol = symb; lineFound = line; colFound = charIndex; } } public static Stack&lt;Symbol&gt; symbolStack = new Stack&lt;Symbol&gt;(); public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream("HelloWorld.java")))); String line; int lineNum = 1; while( (line = br.readLine()) != null){ balanceChecker(line, lineNum); lineNum++; } br.close(); if (symbolStack.isEmpty()) { System.out.println("Success"); } else { System.out.println("Failure"); } } public static void balanceChecker(String line, int lineNum){ int charNum = 1; Symbol top; for(char chr : line.toCharArray()){ switch(chr) { case '{': case '(': case '[': symbolStack.push(new Symbol(chr, lineNum, charNum)); break; case ']': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.peek(); if (top.symbol != '[') { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); }else{ symbolStack.pop(); } } break; case ')': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.peek(); if (top.symbol != '(') { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); }else{ symbolStack.pop(); } } break; case '}': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.peek(); if ((top.symbol != '{')) { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); }else{ symbolStack.pop(); } } break; } charNum++; } }…
favorite count: 0
downvote count: 0

http://stackoverflow.com/q/26513888
has body: I want to send an email from Java using the Java Mail API (javax.mail.*). I can access the SMTP-server via Thunderbird with the following settings: Server: math.uni-freiburg.de Port: 465 Username: MY_USERNAME Authentification: password, normal Security: SSL/TLS I know nothing else about the SMTP server. With my code I always get the error: Could not connect to SMTP host: math.uni-freiburg.de, port: 465, response: -1 String SMTP_HOST = "math.uni-freiburg.de" String SMTP_USER = "MY_USERNAME@math.uni-freiburg.de"; String SMTP_PASSWORD = "MY_PASSWORD"; String SMTP_PORT = "465"; final Properties props = new Properties(); props.put("mail.smtp.host", SMTP_HOST); props.put("mail.smtp.port", SMTP_PORT); props.put("mail.transport.protocol","smtp"); props.put("mail.smtp.auth", "true"); //props.put("mail.ssl.enable", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.tls", "true"); props.put("mail.smtp.ssl.checkserveridentity", "true"); final javax.mail.Authenticator auth = new javax.mail.Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(SMTP_USER, SMTP_PASSWORD); } }; Session session = Session.getInstance(props, auth); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("MY_USERNAME@math.uni-freiburg.de", "MY NAME")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("asdfasdf@gmail.com", "asdf asdf")); msg.setSubject("SUBJECT"); msg.setText("THE MESSAGE"); msg.saveChanges(); Transport.send(msg); I already tried to change some of the properties but since I don't really know what they do this wasn't very successfull. Any ideas what I could change?
answer count: 0
has comment: http://stackoverflow.com/comment/41659328
downvote count: 0
tagged with: ssl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41660087
tagged with: smtp
tagged with: jakarta-mail
type: Question
tagged with: email
score: 1
has comment: http://stackoverflow.com/comment/41660445
has comment: http://stackoverflow.com/comment/41664996
favorite count: 0
has comment: http://stackoverflow.com/comment/41657971
has comment: http://stackoverflow.com/comment/41657902
upvote count: 1
has title: Can't connect to SMTP server with Java
tagged with: java
has comment: http://stackoverflow.com/comment/41657871
has comment: http://stackoverflow.com/comment/41657834

http://stackoverflow.com/comment/41706734
type: AnswerComment
score: 0
type: Comment
has text: It's still returning 0 for some reason.
comment on: http://stackoverflow.com/a/26540932

http://stackoverflow.com/comment/41901747
comment on: http://stackoverflow.com/a/26648106
score: 0
type: AnswerComment
has text: Thank's for answer, but in this case i must update the version in every version increment :(
type: Comment

http://stackoverflow.com/comment/50574976
comment on: http://stackoverflow.com/a/26654736
type: AnswerComment
has text: I would like to inform you that iText Software has claimed ownership of com.lowagie on Maven Central, and that an iText 4.2.2 pom was uploaded, which has a redirection to iText 5.x.x. So set your version fixed to 2.1.7 in your pom.xml (or to 4.2.1, or whatever version you are currently using). It would be a maven best practice anyway to have fixed version in your pom.xml.
type: Comment
score: 1

http://stackoverflow.com/comment/42203698
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26549608
has text: yes @fonkap but the `ElementPolicy` does not permit to handle most of my usecases :( https://code.google.com/p/owasp-java-html-sanitizer/
type: Comment

http://stackoverflow.com/comment/41905313
type: QuestionComment
has text: Forget about cpanel. Look after documentation on how to make MySQL listen on other addresses/interfaces than localhost. You might also need to allow incoming connections through the firewall on the machine running MySQL.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26650651

http://stackoverflow.com/q/26592777
tagged with: semantics
answer count: 4
has answer: http://stackoverflow.com/a/26592902
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26592902
has comment: http://stackoverflow.com/comment/41800458
has answer: http://stackoverflow.com/a/26592917
downvote count: 0
has title: In what context are statements in Java interface definitions executed?
favorite count: 0
has answer: http://stackoverflow.com/a/26592924
possible better answer: http://stackoverflow.com/a/26592882
has body: I'm looking at the definition of org.apache.maven.plugin.Mojo: public interface Mojo { String ROLE = Mojo.class.getName(); [...] } I'm lost. To my knowledge, Java interfaces are a set of method signatures. So what's this line which looks like a statement doing here? What are the semantics? For example: When does that line get "executed"? In the context in which that line runs, what does Mojo refer to? What is its type? In the context in which that line runs, what does Mojo.class refer to? I assume its type is java.lang.Class? In what context can I read that ROLE variable? What is the syntax for doing so? What will the variable contain? Can I write to that ROLE variable?
tagged with: interface
has answer: http://stackoverflow.com/a/26592882

http://stackoverflow.com/comment/41862014
has text: HCSP to JSON? HCSP is a dynamic web page (HTML + Idoc Script code)!!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26625934

keystroke
type: Tag
tags question: http://stackoverflow.com/q/26563856
tag name: keystroke

http://stackoverflow.com/q/26583973
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26584296
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/49689756
has body: when I ran my application I got the above error, i have libusb-1.0.dll file in C:/windows/System32/ folder. but even though my application didn't find the path for libusb-1.0.dll. I don't know about native library. Please any one help me about this. where should I place this dll file?
accepted answer: http://stackoverflow.com/a/26584296
tagged with: libusb
downvote count: 0
possible better answer: http://stackoverflow.com/a/49689756
has title: Caused by: org.usb4java.LoaderException: Native library not found in classpath: /org/usb4java/windows-x86/libusb-1.0.dll
favorite count: 0

http://stackoverflow.com/a/26594438
downvote count: 0
has body: It does not work, because spring's getBeansWithAnnotation(Entity.class); will only return spring beans, but usual entities are not Spring beans, therefore this does now work. Maybe there is a way in JPA/Hibernate to obtain all Mapped classes (classes not entity instances!!). An other ways to find all classes by some annotations are discussed here: Scanning Java annotations at runtime, in one of the answers, a lib called "Google reflections" (later moved to https://github.com/ronmamo/reflections) is mentioned. I used this tool some times ago and it worked well.
accepted answer of: http://stackoverflow.com/q/26593055
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26593055
type: AcceptedAnswer

http://stackoverflow.com/comment/41682146
score: 1
has text: what is `In` and what is `Out` ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26527651

http://stackoverflow.com/a/29128206
answers question: http://stackoverflow.com/q/26516028
score: 5
type: AcceptedAnswer
downvote count: 0
has body: The hibernate.jdbc.batch_size parameter determines how many statements are sent to the database in one call. Having too many statements (a higher number) could result in either an OutOfMemoryException or a timeout on the transaction, when doing multiple statements in a transaction. With webrequests, you usually have less statements in a transaction. This setting shouldn't influence these transactions. Depending on which part of the documentation you read, anywhere between 10 and 50 Hibernate 3.3 chapter 13 or 5 and 30 Hibernate 3.3 chapter 3 is reasonable / recommended.
type: Answer
accepted answer of: http://stackoverflow.com/q/26516028
upvote count: 5

http://stackoverflow.com/comment/41901757
type: AnswerComment
comment on: http://stackoverflow.com/a/26647421
score: 0
type: Comment
has text: int newNumber = numbersArrayList[randomIndex]; might give arrayIndexOutOfBound exception.

http://stackoverflow.com/comment/41915206
has text: See this answer: http://stackoverflow.com/a/14897467/822870 Although your question is not very clear. What does for example `board[1,2,3]` mean?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26656391
score: 0

http://stackoverflow.com/a/26544878
type: Answer
score: 0
has body: From the Java Scanner documentation: public String next() Finds and returns the next complete token from this scanner. A complete token is preceded and followed by input that matches the delimiter pattern. This literally answers your question. However, I am not sure about next's behaviour at the start and end becuase it has to be "preceded and followed" by the delimiter. Maybe someone can fill in on this? You could add extra characters to your delimiter, like \netc.
answers question: http://stackoverflow.com/q/26544691

listview
tags question: http://stackoverflow.com/q/26526764
tags question: http://stackoverflow.com/q/26601543
tags question: http://stackoverflow.com/q/26573720
tags question: http://stackoverflow.com/q/26598054
tags question: http://stackoverflow.com/q/26626296
tags question: http://stackoverflow.com/q/26573950
tags question: http://stackoverflow.com/q/26594742
tag name: listview
tags question: http://stackoverflow.com/q/26541951
tags question: http://stackoverflow.com/q/26564226
tags question: http://stackoverflow.com/q/26531115
tags question: http://stackoverflow.com/q/26519573
tags question: http://stackoverflow.com/q/26583224
tags question: http://stackoverflow.com/q/26665197
tags question: http://stackoverflow.com/q/26551416
tags question: http://stackoverflow.com/q/26593131
tags question: http://stackoverflow.com/q/26558267
tags question: http://stackoverflow.com/q/26579465
tags question: http://stackoverflow.com/q/26544321
tags question: http://stackoverflow.com/q/26580978
tags question: http://stackoverflow.com/q/26522776
tags question: http://stackoverflow.com/q/26611999
tags question: http://stackoverflow.com/q/26602867
type: Tag
tags question: http://stackoverflow.com/q/26666809
tags question: http://stackoverflow.com/q/26644410
tags question: http://stackoverflow.com/q/26659853

http://stackoverflow.com/a/26549808
has body: You would either have to write a heart beat code to check for the time and let your application run forever. Or you code take advantage of a Framework like Spring and use the Spring Scheduler feature which does what you need. The 3rd option is to run your program on a server and use the server's scheduler feature.
score: 0
answers question: http://stackoverflow.com/q/26549702
type: Answer

http://stackoverflow.com/comment/41887787
comment on: http://stackoverflow.com/a/26600095
score: 0
has text: I had encountered the null user problem when the method was "post" on the annotation and the client called using '"get". Once I sync'd the two, the user on dev machine is passed with id 0 as stated in the doc.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41938852
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26668899
score: 0
has text: @RC.I have no prior experience in Guava, so can't comment on this. Plus, we don't use Guava in our office yet. I am just wondering if this is a miss in vanilla Java version?

http://stackoverflow.com/q/26597549
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/26704349
has comment: http://stackoverflow.com/comment/41821206
score: 0
has body: I have an object that uses the same physics as in billiards. Here's the full code: BodyDef bddDef = new BodyDef(); bddDef.type = BodyType.DynamicBody; bddDef.position.x = Position.x; bddDef.position.y = Position.y; bddDef.linearDamping = .03f; bddDef.angularDamping = .09f; bddDef.gravityScale = 10F; bdBox = wWorld.createBody(bddDef); CircleShape csCircle = new CircleShape(); csCircle.setRadius(this.SIZE_RADIUS); csCircle.getPosition().x = bddDef.position.x; csCircle.getPosition().y = bddDef.position.y; FixtureDef fxtDef = new FixtureDef(); fxtDef.density = 20.00f; fxtDef.friction = 0f; fxtDef.restitution = 0.3f; fxtDef.shape = csCircle; bdBox.setBullet(true); bdBox.resetMassData(); this.fxtSensorFixture = bdBox.createFixture(fxtDef); csCircle.dispose(); Set applyLinearImpulse like this public void update(float x, float y){ if(distance(x,y)&lt;=SIZE_RADIUS) return; Vector2 vec = new Vector2(x,y); getBody().applyLinearImpulse(this.localToStageCoordinates(vec), getBody().getPosition(), true); } but the object is not moving or is moving at a very slow rate. What am I doing wrong?
answer count: 1
has comment: http://stackoverflow.com/comment/42001181
has comment: http://stackoverflow.com/comment/41837988
has title: applyLinearImpulse not working (Box2d)
has comment: http://stackoverflow.com/comment/41825701
has comment: http://stackoverflow.com/comment/41818917
tagged with: android
accepted answer: http://stackoverflow.com/a/26704349
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41821343
tagged with: java
tagged with: box2d

x509certificate
tags question: http://stackoverflow.com/q/26573713
type: Tag
tag name: x509certificate
tags question: http://stackoverflow.com/q/26585874

http://stackoverflow.com/comment/69025898
score: 8
type: AnswerComment
has text: It should be `conversationView.smoothScrollToPosition(conversationView.getAdapter().getItemCount() **-1**);` as positions in lists are zero-based.
comment on: http://stackoverflow.com/a/37719465
type: Comment

http://stackoverflow.com/comment/41935638
type: QuestionComment
has text: Sorry, my coffee is not working correctly so I need a bit of clarification. Your exact problem is: _"Comparison of numbers from a file is not working if the numbers are newly generated?"_ Am I right?
comment on: http://stackoverflow.com/q/26665952
score: 1
type: Comment

http://stackoverflow.com/q/26572218
has body: I am searching about the memory leak that was caused by subString() method in java. I have read few articles in the internet and got some knowledge but I was ended up with a little confusion. One article has mentioned "substring method inside String class, calls String (int offset, int count, char value []) constructor to create new String object. What is interesting here is, value[], which is the same character array used to represent original string". This is clear to me. It also mentioned "If the original string is very long, and has array of size 1GB, no matter how small a substring is, it will hold 1GB array. This will also stop original string to be garbage collected, in case if doesn't have any live reference". The link to the article is here {http://javarevisited.blogspot.sg/2011/10/how-substring-in-java-works.html} I cannot understand this. Please anybody explain me how does it stop the original string to be garbage collected if it does't have any live reference? According to my little understanding, in java any object which doesn't have direct or indirect reference will be eligible for garbage collector to collect. If subString method uses the same character array used to represent original string how can the original String stay without being garbage collected ? Likewise I want to know does the memory leak is caused due to use the same character array used to represent original string because the new string {String returned by subString method} would be very little compared with the original String or since the original string is still staying without being garbage collected? Please anybody help me to clarify this
possible better answer: http://stackoverflow.com/a/26572259
has answer: http://stackoverflow.com/a/45401124
score: 0
has answer: http://stackoverflow.com/a/26572287
answer count: 3
tagged with: string
accepted answer: http://stackoverflow.com/a/26572287
has title: Memory leak of the substring method in java
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26572259

http://stackoverflow.com/comment/106023973
has text: Alternatively you can just create a `Person` mock as you normally would (e.g. `mock(Person.class)`) and stub its `getId()` method to return `null` as follows: `when(person.getId()).thenReturn(null)`.
type: Comment
comment on: http://stackoverflow.com/a/31830348
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41756100
has text: @Java42 I have added the relevant parts.
comment on: http://stackoverflow.com/q/26568411
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/47658769
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26548505
has body: This happened to me because I hadn't added the conf.configure(); before beginning the session: Configuration conf = new Configuration(); conf.configure();

http://stackoverflow.com/comment/41667163
has text: That helped me get it running but now I get this error when I attempt to access Composer through my RestController:
comment on: http://stackoverflow.com/a/26518837
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/26524572
type: Question
has answer: http://stackoverflow.com/a/26525031
tagged with: android-layout
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26525031
favorite count: 0
tagged with: android
upvote count: 1
has body: im new in android i made an app for sniffing wifi access points and i have the following errors in logcat my manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> MainActivity.java package com.example.weedow2; import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity { WifiManager mainWifiObj; WifiScanReceiver wifiReciever; ListView list; String wifis[]; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = (ListView)findViewById(R.id.listView1); mainWifiObj = (WifiManager) getSystemService(Context.WIFI_SERVICE); wifiReciever = new WifiScanReceiver(); mainWifiObj.startScan(); } protected void onPause() { unregisterReceiver(wifiReciever); super.onPause(); } protected void onResume() { registerReceiver(wifiReciever, new IntentFilter( WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); super.onResume(); } class WifiScanReceiver extends BroadcastReceiver { @SuppressLint("UseValueOf") public void onReceive(Context c, Intent intent) { List<ScanResult> wifiScanList = mainWifiObj.getScanResults(); wifis = new String[wifiScanList.size()]; for(int i = 0; i < wifiScanList.size(); i++){ wifis[i] = ((wifiScanList.get(i)).toString()); } list.setAdapter(new ArrayAdapter<String>(getApplicationContext(), android.R.…
tagged with: android-intent
type: AnsweredQuestion
score: 1
tagged with: java
has title: android eclipse error binary xml file error inflating class android.widget.relativelayout
tagged with: eclipse

http://stackoverflow.com/a/26631803
has comment: http://stackoverflow.com/comment/42001370
has body: Try to reduce RAM size of an emulator In Eclipse Window -> Android Virtual Device Manager Select your device and click Edit button in right part of window Then in Memory Options secton find RAM parameter and set it to 512 for example. Click OK for saving. Now try to re-debug your app
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26620765
upvote count: 47
has comment: http://stackoverflow.com/comment/53683950
score: 46

http://stackoverflow.com/comment/41769217
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26574326
score: 0
has text: I don't understand how your calculation is intended to work. (Were you just guessing at how to unpack the audio?) What is the AudioFormat of the TargetDataLine?

http://stackoverflow.com/a/26560706
type: Answer
has body: String alpha = "abcdefghijklmnopqrstuvwxyzabcd"; // alphabet int N = alpha.length(); int lag = 3; // shift value String s = "cde"; // input StringBuilder sb = new StringBuilder(); for (int i = 0, index; i &lt; s.length(); i++) { index = s.charAt(i) - 'a'; sb.append(alpha.charAt((index + lag) % N)); } String op = sb.toString(); // output
score: 0
answers question: http://stackoverflow.com/q/26560483

http://stackoverflow.com/comment/41760081
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26570738
score: 0
has text: See [this](http://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html).

http://stackoverflow.com/comment/41831817
has text: That is where my code stopped working! The string gets printed. Like I said at the beginning of my post, the 6 that gets printed is my string. But the parsing isn't happening.
comment on: http://stackoverflow.com/q/26609613
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26539083
has title: Randomize the letters in the middle of the word, while keeping the first and last letters unchanged
has answer: http://stackoverflow.com/a/26539257
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26539223
has answer: http://stackoverflow.com/a/26539244
has comment: http://stackoverflow.com/comment/41703518
has body: import java.util.Scanner; /** * * @author Cutuk */ public class JavaApplication3 { /** * @param args the command line arguments */ public static void main(String[] args) { String a; Scanner in = new Scanner (System.in); a = in.nextLine(); char first = a.charAt(0); System.out.print(first); int v= a.length()-1; char last = a.charAt(v); int k= a.length(); int random=0; char x='\u0000'; char middle= '\u0000' ; for (int i=1; i&lt;a.length()-1;i++){ random= (int )(Math.random() * (k-2) + 1); middle=a.charAt(random); x=middle; System.out.print(x); } System.out.print(last); } } I am supposed to take a word, shuffle the letters inside, but keep the first and the last letter unchanged. I managed to randomize, but I cannot keep it from repeating.
tagged with: java
has answer: http://stackoverflow.com/a/26539184
has answer: http://stackoverflow.com/a/26539304
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41703459
answer count: 5

http://stackoverflow.com/a/26652126
has comment: http://stackoverflow.com/comment/41907720
answers question: http://stackoverflow.com/q/26652079
downvote count: 0
has body: Change this: &lt;TextView android:id="@+id/HeightInput1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/HeightInput" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/WeightInput1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/WeightInput" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; Via &lt;EditText android:id="@+id/HeightInput1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/HeightInput" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/WeightInput1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/WeightInput" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; OR heightIn = (EditText) findViewById (R.id.HeightInput1); weightIn = (EditText) findViewById (R.id.WeightInput1); via heightIn = (TextView) findViewById (R.id.HeightInput1); weightIn = (TextView) findViewById (R.id.WeightInput1);
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/26596065
accepted answer of: http://stackoverflow.com/q/26595051
has comment: http://stackoverflow.com/comment/41810462
type: AcceptedAnswer
downvote count: 0
has body: I think you are trying to show/hide the textviews based on whether the related json data is available. As for your current code: infoHolder.yelp = (TextView) convertView.findViewById(R.id.theYelp); if(infoHolder.yelp != null){ ... } The if statement you declared is just checking whether the textview is null, it will never be null since its assigned a textview in the beginning. You should first determine whether the json data exists before deciding whether to show/hide the textview. For example: JSONObject jsonObject = this.dataArray.getJSONObject(position); String yelpStr = jsonObject.optString("yelp"); if(yelpStr != null){ infoHolder.yelp.setText(yelpStr); infoHolder.yelp.setVisibility(View.VISIBLE); Toast.makeText(activity, "Yelp Here", Toast.LENGTH_LONG).show(); }else{ infoHolder.yelp.setVisibility(View.GONE); Toast.makeText(activity, "Yelp Gone", Toast.LENGTH_LONG).show(); } Also, I believe you misplaced a right curly brace, it should be right after infoHolder is retrieved using the tag: if(convertView == null){ ... }else{ infoHolder = (allTheDealershipInfo) convertView.getTag(); } Make sure u end the if/else statement for assigning infoHolder properly so the textviews will be used in the rest of the code as intended.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26595051
has comment: http://stackoverflow.com/comment/41809235

http://stackoverflow.com/comment/41818161
type: Comment
comment on: http://stackoverflow.com/a/26602330
has text: That's ok. please ignore the comment. @suganya
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41888972
comment on: http://stackoverflow.com/q/26640564
has text: Thank you for the new information. Now your question is answerable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41904345
type: Comment
type: QuestionComment
score: 1
has text: events dont "return". Events are TRIGGERED by your framework.
comment on: http://stackoverflow.com/q/26650106

http://stackoverflow.com/comment/41703660
comment on: http://stackoverflow.com/a/26520296
score: 0
type: AnswerComment
type: Comment
has text: Build path was messed up . Thanks. More so the classpath in eclipse .

http://stackoverflow.com/q/26515687
has body: i want to get from another app on device an activity icon with the highest possible resolution, but cant figure out how to do it...... In my app i can select one activity from a list of all activities available on the device and the correspondig intent will return to onActivityResult. There i can get the activities icon like this: Drawable icon = null; ComponentName componentName = intent.getComponent(); String packageName = componentName.getPackageName(); PackageManager pm = this.getPackageManager(); icon = pm.getActivityIcon(intent); i can then get the app-icon with the highest resolution like this: PackageInfo pi = pm.getPackageInfo(packageName, 0); Context otherAppCtx = this.createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY); int displayMetrics[] = { DisplayMetrics.DENSITY_TV, DisplayMetrics.DENSITY_HIGH, DisplayMetrics.DENSITY_XHIGH, DisplayMetrics.DENSITY_XXXHIGH }; for (int displayMetric : displayMetrics) { try { Drawable d = otherAppCtx.getResources().getDrawableForDensity(pi.applicationInfo.icon, displayMetric); if (d != null) { icon = d; } } catch (Resources.NotFoundException e) { continue; } } Thats nice but i want to get the activity icon and not the app icon with the highest resolution. Does anyone know how to do this? thx in advance!
tagged with: android
has answer: http://stackoverflow.com/a/26518340
accepted answer: http://stackoverflow.com/a/26518340
tagged with: android-activity
type: AnsweredQuestion
score: 1
has title: how to get high-dpi activity-icons from another app for my launcher-app?
upvote count: 1
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/41661810
tagged with: java
has comment: http://stackoverflow.com/comment/41661373
tagged with: icons
has comment: http://stackoverflow.com/comment/41661439
has comment: http://stackoverflow.com/comment/41661300
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41661265
has comment: http://stackoverflow.com/comment/41661942
favorite count: 0

http://stackoverflow.com/a/45608268
has comment: http://stackoverflow.com/comment/78217462
upvote count: 3
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/78212528
has comment: http://stackoverflow.com/comment/78175891
has body: What you've tried won't work because T is ambiguous and the compiler will try to make the code compile (by interpreting it to be Object). You need to force it a little bit by explicitly setting the type you want to check. Makoto's answer is very good for that. And, if you can cope with using another object, you can also use the following : public class EqualsHelper&lt;T&gt; { public boolean areEquals(T one, T another){ if(one == null){ return another == null; } return one.equals(another); } } public static void main(String[] args) { EqualsHelper&lt;String&gt; stringHelper = new EqualsHelper&lt;&gt;(); stringHelper.areEquals("hello","world"); // compile stringHelper.areEquals("hello",1); // doesn't }
answers question: http://stackoverflow.com/q/26551339
type: Answer

http://stackoverflow.com/a/42718337
has body: before i same ploblem in my case, i use, Option on a right-click menu of a program icon that, when selected, allows the program to run with full administrator privileges. after working my os windows 10
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26534272
upvote count: 1

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/26518024
tags question: http://stackoverflow.com/q/26629763
type: Tag
tags question: http://stackoverflow.com/q/26518712

http://stackoverflow.com/q/26525887
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/26526002
has comment: http://stackoverflow.com/comment/41679384
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26526002
type: AnsweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/41679315
has title: Graphing Library for Java
type: Question
has body: I am working on a program which gathers data and stores it in a file. I need to be able to write a program which reads from the created file and plots a scatter/bar/pie graph from it. Does anyone know any Graphing Libraries which I can use to do this? I've seen suggestions for libraries which can graph nodes, vertices etc. but none for common graphs. Help would be appreciated. Thanks
tagged with: graph
has comment: http://stackoverflow.com/comment/41679373

http://stackoverflow.com/a/26574380
type: Answer
has body: The problem is here: while(verify=false); Change it to: while(!verify);
has comment: http://stackoverflow.com/comment/41766659
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26574291
has comment: http://stackoverflow.com/comment/41766718
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26574291

http://stackoverflow.com/comment/41755309
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26568146
has text: @DreadHeadedDeveloper I know how to do it with an `ArrayList`, but wow a `Map` is just so clean.
type: AnswerComment

http://stackoverflow.com/q/26624103
type: UnansweredQuestion
tagged with: eclipse
has title: How to handle Java method calls from XSLT while debugging XSL files?
tagged with: intellij-idea
has body: I am trying to debug an XSLT in Eclipse using Xalan 2.7.1 processor. But whenever it comes to a point where there is a call made to any Java method, it terminates with the exception saying could not find perticular method. I have searched this forum thoroughly but didn't find any question/answer which addresses this type of issue. Is there any other way we can debug XSLT with java calls , can we use intellj-xslt debugger here ?
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/42010325
tagged with: xslt
tagged with: debugging
tagged with: java

http://stackoverflow.com/comment/41773820
type: QuestionComment
comment on: http://stackoverflow.com/q/26578037
has text: Yes that is correct, there is no order for those operations and that is intended. But the calculations performed on testVariable returns a wrong number which I mentioned above with myThread 3 running first and setting testVariable to -1 instead of -825 if it is run first.
score: 0
type: Comment

http://stackoverflow.com/q/26623594
has body: So I just downloaded Spring Tool Suite, created a new Maven project, and am confused as to how to get Log4j integrated into my project. Here is my project structure and the class I'm trying to create a logger in. Please note that none of these imports listed under LoggerFactory work - every time I select one it says LoggerFactory.getLogger cannot be resolved to a type. And here is my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.test demo 0.0.1-SNAPSHOT jar demo Demo project for Spring Boot org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE <relativePath/> org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework spring-context 4.1.1.RELEASE runtime org.springframework spring-core 4.1.1.RELEASE org.apache.logging.log4j log4j-api 2.1 org.apache.logging.log4j log4j-core 2.1 log4j log4j 1.2.17 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> demo.Application <java.version>1.7</java.version> org.springframework.boot spring-boot-maven-plugin How do I solve this problem?
tagged with: java
has comment: http://stackoverflow.com/comment/41857111
type: Question
has answer: http://stackoverflow.com/a/26623706
has title: How to integrate log4j 2 into my Spring project?
tagged with: eclipse
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26623706
tagged with: maven
tagged with: spring
tagged with: logging
has comment: http://stackoverflow.com/comment/41857187
type: AnsweredQuestion

http://stackoverflow.com/comment/69938290
type: QuestionComment
has text: @DominikAngerer, did you solve this issue? I am in the same scenario.
comment on: http://stackoverflow.com/q/26576073
score: 0
type: Comment

http://stackoverflow.com/a/26617771
upvote count: 3
answers question: http://stackoverflow.com/q/26617733
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: if (row = 1 || row = squareSize) = is an assignment operator, not a equality/relational operator. I think you want ==: if (row == 1 || row == squareSize)
accepted answer of: http://stackoverflow.com/q/26617733

http://stackoverflow.com/q/26665241
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: compression
tagged with: loops
type: Question
has title: Compress string longer than 2 - loops
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26665453
tagged with: string
has answer: http://stackoverflow.com/a/44578895
possible better answer: http://stackoverflow.com/a/26665359
has answer: http://stackoverflow.com/a/26665359
has answer: http://stackoverflow.com/a/26665595
favorite count: 0
has body: Method to compress a string using java and loops. For example, if dc = "aabbbccaaaaba, then c = "aab3cca4ba" Here is what I have so far. Please help/guide. Thanks. int cnt = 1; String ans = ""; for (int i = 0; i &lt; dc.length(); i++) { if ((i &lt; dc.length()) &amp;&amp; (dc.charAt(i) == dc.charAt(i++)) &amp;&amp; (dc.charAt(i) == dc.charAt(i+=2))){ cnt++; ans = ans + dc.charAt(i) + cnt; } else ans = ans + dc.charAt(i); setC(ans);
upvote count: 2
accepted answer: http://stackoverflow.com/a/26665453

http://stackoverflow.com/comment/41849229
score: 1
has text: That is ... clever. I've never thought of that. I think it might be too clever, but I'm not sure. But I do know that if you have tools that are complaining that you don't have absolute 100% code coverage, those tools need to be adjusted. 100% coverage isn't a valid goal. And if they're complaining about an empty block with no comment in it, you could ... put a comment in it. Or throw an AssertionError as afsantos suggests.
comment on: http://stackoverflow.com/q/26618890
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41810302
type: QuestionComment
has text: @PeterLawrey Yea I tried that and it worked fine. My issue was just the licensing. Maybe the Open JDK implementation will be fine.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26597128

parse-platform
tags question: http://stackoverflow.com/q/26613267
type: Tag
tags question: http://stackoverflow.com/q/26520617
tags question: http://stackoverflow.com/q/26551036
tags question: http://stackoverflow.com/q/26571598
tags question: http://stackoverflow.com/q/26599950
tags question: http://stackoverflow.com/q/26654550
tags question: http://stackoverflow.com/q/26672122
tags question: http://stackoverflow.com/q/26613826
tags question: http://stackoverflow.com/q/26668766
tag name: parse-platform
tags question: http://stackoverflow.com/q/26637730

http://stackoverflow.com/q/26604999
has title: How to save programmatically made radiobuttons, so they don't disappear when scrolling?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26605353
has body: I'm having trouble saving the radiobuttons locally on your mobile when they're checked. Every time I scroll through my listview the checked radiobutton disappears, I've checked the internet but 9 times out of 10 the radiobuttons are made in XML files unlike mine. public class Bouw_onderdeel extends Activity { public String[] naam = {"Bouw onderdeel", "Kapconstructie","Kapconstructieve bevesiging","Doorbuiging","Vochtinwerking","Dakconstructie","Constructieve bevesiging","Doorbuiging","Vochtinwerking","Waterkerende lagen","Waterdichtheid (folie)laag","Lekwaterafvoerend vermogen","Detaillering aan dakvoet","Thermischeisolatie","Bevestiging","Aansluitdetails","Isolerend vermogen","Dakpannen en vorsten","Conditie dakpannen en vorsten","Breukschade","Vorstschade","Afschilfering","Aangroei algen en mos"}; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bouwonderdeel_layout); getActionBar().setDisplayHomeAsUpEnabled(true); //RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.layoutBouwonderdeel); ListView list = new ListView(this); list.setAdapter(new MyAdapter(this, naam)); setContentView(list); } private class MyAdapter extends ArrayAdapter&lt;String&gt; { public MyAdapter(Context context, String[] strings) { super(context, -1, -1, strings); } @Override public View getView(int position, View convertView, ViewGroup parent) { //Making the listview. LinearLayout listLayout = new LinearLayout(Bouw_onderdeel.this); listLayout.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT)); listLayout.setId(5000); //Making the radiogroup RadioGroup rbg = new RadioGroup(Bouw_onderdeel.this); rbg.setId(3927); rbg.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT) ); rbg.setOrientation(LinearLayout.HORIZONTAL); //Add the textviews inside the listview TextView listText …
type: Question
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/q/26630837
type: UnansweredQuestion
has body: I want to add scroll bar to a cell in JTable which has HTML contents that needs to be rendered. Tried creating a custom cell renderer with following code snap. Scroll bar appears in the cell however I am unable to scroll. public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { theLabel.setText((String)value); JScrollPane thePane = new JScrollPane(theLabel); return thePane; } Any clues will be appreciated
tagged with: swing
tagged with: tablecellrenderer
has comment: http://stackoverflow.com/comment/41871193
tagged with: java
has comment: http://stackoverflow.com/comment/41879067
type: Question
has answer: http://stackoverflow.com/a/26671549
answer count: 1
tagged with: jtable
score: 0
has title: Adding Scrollbar to JTable cell with HTML rendering
has comment: http://stackoverflow.com/comment/41871537

http://stackoverflow.com/q/26628038
has comment: http://stackoverflow.com/comment/41865380
score: 0
tagged with: android
tagged with: google-cloud-messaging
has comment: http://stackoverflow.com/comment/41865161
has body: I am learning Android-GCM concept. I was trying one sample from internet. I am getting the error, when I try to send a message to GCM server. So i got null exception. My Error log put here. This is the error code regId: nulljava.lang.IllegalArgumentException: argument cannot be null at com.google.android.gcm.server.Sender.nonNull(Sender.java:550) at com.google.android.gcm.server.Sender.newBody(Sender.java:500) at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:150) at com.google.android.gcm.server.Sender.send(Sender.java:121) at com.javapapers.java.gcm.GCMNotification.doPost(GCMNotification.java:66) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) This is server Code for push to GCM server: I am using jsp for server page. also change the server key. But i didn't get re…
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has title: IllegalArgumentException in GCM

http://stackoverflow.com/comment/41689744
type: Comment
type: QuestionComment
has text: Couldn't you put that (e.g., the code in the link) into a function?
comment on: http://stackoverflow.com/q/26531408
score: 0

http://stackoverflow.com/q/26575215
tagged with: for-loop
answer count: 3
accepted answer: http://stackoverflow.com/a/26575262
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26575292
has body: When going through a collection using a using a for loop using (element:collection) the changes I've made to data only remains the same during the loop. Here is my code: String[] names = {"bob", "fred", "marcus", "robert", "jack", "steve", "nathan", "tom", "freddy", "sam"}; for(String indexData : names) { indexData = indexData.toUpperCase(); System.out.println(indexData); } System.out.println("this is word 5 in the array: " + names[4]); Output: BOB FRED MARCUS ROBERT JACK STEVE NATHAN TOM FREDDY SAM this is word 5 in the array: jack My question is using this type of loop how do I make permanent changes?
has comment: http://stackoverflow.com/comment/41768115
possible better answer: http://stackoverflow.com/a/26575292
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/26575966
type: Question
has title: For loop (element:collection) not making permanent change
tagged with: java
has answer: http://stackoverflow.com/a/26575262

http://stackoverflow.com/q/26611214
answer count: 2
accepted answer: http://stackoverflow.com/a/26860456
tagged with: code-signing
has body: In my app I have a relatively long chain of libs that call each other and starting with Yosemite part of it's functionality is broken due to code signing problems. This all worked nicely on Maverics. My cocoa app uses Java to run a separate code part, which is necessary to access a java library (hbci4java.jar). This library then uses jni to call a wrapper dylib I provide to access the PCSC.framework of the system (smartcard). Since Yosemite this doesn't work anymore, probably because of this: 28.10.14 15:29:17,096 com.apple.ctkpcscd[40978]: Refusing sandboxed PCSC.framework client without com.apple.security.smartcard entitlement So far so easy. I added this smartcard entitlement to the apps entitlements as well as those I have for java (there's a separate java.entitlements file) - to no avail. I'm now kinda stuck without knowning how to proceed. The smartcard entitlement is nowhere mentioned, so I don't know what to set actually (I used a bool and YES), nor where eactly that must be set. Is it possible to add an entitlement to a 3rd party library? I would like to try adding it to the wrapper dylib (which is signed by me) to see if it can then access the PCSC.framework properly?
tagged with: xcode
downvote count: 0
tagged with: osx-yosemite
has title: Code signing issue with 3rd party lib
favorite count: 0
has answer: http://stackoverflow.com/a/26860456
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/26811209
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26811209
type: Question

http://stackoverflow.com/q/26584582
type: Question
has answer: http://stackoverflow.com/a/26584720
score: 0
has answer: http://stackoverflow.com/a/26584735
tagged with: oracle-database
has title: Hibernate java.sql.Date field return only date for Oracle
has body: I am using oracle database for retrieving date and time but it is returning only date when I am using java.sql.Date . I have tried with java.sql.Timestamp but its gave exception as wrong column type. I tried with V8Compatible configuration. But it is also not working. I cannot change anything in the DB side. In DB that column is of type DATE. Please Give a suggestion
answer count: 4
linked to: http://stackoverflow.com/q/2188768
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26584963
has answer: http://stackoverflow.com/a/26584744
tagged with: timestamp
tagged with: java
tagged with: hibernate
tagged with: date

http://stackoverflow.com/comment/41843977
score: 0
comment on: http://stackoverflow.com/q/26616239
type: Comment
type: QuestionComment
has text: what i need to send or write in out.println() , which i can pick from $.get success method

http://stackoverflow.com/comment/75322550
comment on: http://stackoverflow.com/a/32466614
has text: Does it support Apache HttpClient
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26598936
has title: there is no exception in the log cat but my code going to exception portion
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has body: lvchartid.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;&gt; parent, View view, int position,long id) { final String item = ((TextView)view).getText().toString(); new Thread(new Runnable() { @Override public void run() { try { WebConnectionHelper con = new WebConnectionHelper("PatientChartGynologicalHistroySelect"); con.Addparameter("accountno", "10011065"); con.Addparameter("chartid", item); con.intiateConnection(Checkcharts.this); result = con.GetOutPut(); if (result == null) { Log.e("Search result", "null"); } else Log.e("Search result", result.toString()); } catch (Exception e) { e.printStackTrace(); Log.e("Error search", e.toString()); } if (result == null) { return; } try{ SoapObject tempobj = (SoapObject)result.getProperty(0); result = (SoapObject) tempobj.getProperty(1); chartspatient = new ArrayList&lt;getset_chartspatient&gt;(); SoapObject property = (SoapObject) result.getProperty(0); for (int i = 0; i &lt; property.getPropertyCount(); i++) { SoapObject category_list = (SoapObject) property.getProperty(i); Log.e("Result", category_list.toString()); getset_patientsinglechart chartssingle = new getset_patientsinglechart(); chartssingle.setPATIENT_GYNECOLOGIC_HISTORY_ID(category_list.getPropertySafelyAsString("PATIENT_GYNECOLOGIC_HISTORY_ID","").toString()); chartssingle.setCURRENTLY_SEXUALLY_ACTIVE(category_list.getPropertySafelyAsString("CURRENTLY_SEXUALLY_ACTIVE","").toString()); chartssingle.setAGE_FIRST_SEXUAL_INTERCOURSE(category_list.getPropertySafelyAsString("AGE_FIRST_SEXUAL_INTERCOURSE","").toString()); chartssingle.setSEXUAL_PROBLEMS(category_list.getPropertySafelyAsString("SEXUAL_PROBLEMS","").toString()); chartssingle.setCONTRACEPTION(category_list.getPropertySafelyAsString("CONTRACEPTION","").toString()); chartssingle.setMENOPAUSE(category_list.getPropertySafelyAsString("MENOPAUSE","").toString()); chartssingle.setFIRST_MENARCHE_AGE(category_list.getPropertySafelyAsString("FIRST_MENARCHE_AGE…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26599068
score: 0

http://stackoverflow.com/comment/41662654
type: Comment
has text: try adding `max` and `progress` attributes to the `ProgressBar` tag
score: 0
comment on: http://stackoverflow.com/q/26516327
type: QuestionComment

http://stackoverflow.com/comment/41744430
score: 1
has text: I think using `ArrayList` for matrices is a bad idea in the first place. You are going to have a lot of memory overhead because an `ArrayList` is always bigger than the data it contains. Matrices are a low-level component and should be implemented with low-level data structures.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562107

http://stackoverflow.com/q/26546846
has title: Is it required to explicitly stop an Akka actor from supervisor?
upvote count: 2
tagged with: java
type: Question
has body: In my supervisor actor a message is sent by child actor to indicate its completed. I then stop this actor within the onReceive method : @Override public void onReceive(Object msg) { if (msg == Messages.SUCCESS) { getContext().stop(getSender()); } } But this results in following message being printed : [INFO] [10/24/2014 12:12:43.102] [Main-akka.actor.default-dispatcher-6] [akka://Main/user/app/$l] Message [akka.dispatch.sysmsg.Terminate] from Actor[akka://Main/user/app/$l#1444168887] to Actor[akka://Main/user/app/$l#1444168887] was not delivered. [6] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. Is this expected behaviour ? Can these messages be ignored ? Is it required to explicitly stop the actor or will it just stop once its run to completion and become eligible for garbage collection? Update : it is required to explicitly stop an actor as it will not be stopped by akka framework : Akka: Cleanup of dynamically created actors necessary when they have finished?
has answer: http://stackoverflow.com/a/26597060
tagged with: akka
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26597060
linked to: http://stackoverflow.com/q/9569682
tagged with: scala
has comment: http://stackoverflow.com/comment/41719242
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/41757195
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26568888
score: 0
has text: @fge It's a `double` `double a = (n1 * 4) - 60; Double b = (a * -1) / 6; cp_nota2.setText(b + "");`

http://stackoverflow.com/a/26536298
score: 1
has comment: http://stackoverflow.com/comment/41699164
has comment: http://stackoverflow.com/comment/41698959
answers question: http://stackoverflow.com/q/26536182
has comment: http://stackoverflow.com/comment/41698746
has comment: http://stackoverflow.com/comment/41699130
upvote count: 1
type: Answer
has body: I am guessing you are using Java based on toUpperCase(). What I would suggest you do, is use charAt() to get the first letter, and substring to get the rest. You can try something like this: String firstLetter = userInput.substring(0, 1); // Get first element. If you don't understand substring, let me know. string remainingString = userInput.substring(1); // Grab chars from index 1 to the end. firstLetter.toUpperCase(); // Capitalize string remainingString.toLowerCase(); // Lowercase rest of string String finalString = firstLetter + remainingString; Hope this helps.
downvote count: 0

http://stackoverflow.com/q/26644502
has title: Compare Vectors of different types in Java
has comment: http://stackoverflow.com/comment/41895079
has comment: http://stackoverflow.com/comment/41895103
score: 0
has answer: http://stackoverflow.com/a/26644613
has body: I have two Java vectors initialized like these: Integer intArr[] = {100, 200, 300}; Double doubleArr[] = {100.0, 200.0, 300.0}; Vector&lt;Integer&gt; vInt = new Vector&lt;Integer&gt;(Arrays.asList(intArr)); Vector&lt;Double&gt; vDouble = new Vector&lt;Double&gt;(Arrays.asList(doubleArr)); The comparision that I do is like this boolean equal = vInt.equals(vDouble); //equal = false How can I compare the two vectors and get true as result considering that, despite the different types, the vectors have the same values? TIA,
accepted answer: http://stackoverflow.com/a/26644631
has answer: http://stackoverflow.com/a/26644624
answer count: 4
possible better answer: http://stackoverflow.com/a/26644624
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26644631
type: Question
has answer: http://stackoverflow.com/a/26644676
tagged with: vector
tagged with: arrays

http://stackoverflow.com/comment/41796953
comment on: http://stackoverflow.com/a/26588634
score: 0
type: AnswerComment
type: Comment
has text: OK got it, as of now it is possible to pass an object[] to the jdbctemplate and jdbc does the mapping itself without any specifying the column types. do you know if this is also possible by using the creatorfactory?

http://stackoverflow.com/q/26640536
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26640982
type: Question
tagged with: jndi
tagged with: websphere
accepted answer: http://stackoverflow.com/a/26640982
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
has title: jndi-name property override - JUnit - Spring - Struts Integration test
has body: I am trying to write integration test that uses JUnit, Struts2, Spring, JPA/Hibernate. The application is working fine in WebSphere. The Integration tests are run outside of WebSphere. struts2-junit-plugin and spring-struts plugin both are used. My test class extends StrutsSpringTestCase. This is the sample code in the test method: ActionProxy proxy = getActionProxy("custSearch"); assertNotNull(proxy); It loads struts.xml, applicationContext.xml and jpaContext.xml. In the jpaContext.xml I have the following entry. &lt;bean id="dsSQLServer" class="org.springframework.jndi.JndiObjectFactoryBean" p:jndi-name="${sql.jndi.name}"/&gt; sql.jndi.name comes from the properties file and is setup in WebSphere. I went TO properties file and replaced the local jndi url with full jndi url that I got from executing dumpNamespaces.bat of Websphere. which is something like MycomnameNode01Cell/nodes/C1A-mYNode/servers/mYSrv/jdbc/sql_src However, when I run the JUnit test case from eclipse I get the following exception. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceSQLServer' defined in URL [file:/C:/workspace/context/jpaContext.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at …
upvote count: 2
score: 2

http://stackoverflow.com/comment/41685120
comment on: http://stackoverflow.com/q/26529118
type: Comment
type: QuestionComment
score: 1
has text: No, your html is incomplete, for example element button is not closed.

http://stackoverflow.com/q/26581730
tagged with: handler
tagged with: android
has answer: http://stackoverflow.com/a/26582266
score: 0
has comment: http://stackoverflow.com/comment/41780124
has title: how to use handler in android to work in main thread?
has answer: http://stackoverflow.com/a/26581981
has answer: http://stackoverflow.com/a/26581787
type: AnsweredQuestion
tagged with: java
has body: I am able to update UI using runOnUiThread(new Runnable() { . I think there is another way to update UI using Handler. Could you please tell me how I will update UI using handler. I used like that @Override public void getWebserviceResponse(final String result) { // TODO Auto-generated method stub runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub refreshUi(result); } }); } same thing how I will achieve with handler ? Update private Handler messageHandler = new Handler() { public void handleMessage(Message msg) { final int what = msg.what; switch(what) { case DO_UPDATE_TEXT: doUpdate(); break; } } }; @Override public void getWebserviceResponse(final String result) { messageHandler.sendEmptyMessage(DO_UPDATE_TEXT); } I need to send String result with DO_UPDATE_TEXT
accepted answer: http://stackoverflow.com/a/26582266
possible better answer: http://stackoverflow.com/a/26581787
type: Question
has comment: http://stackoverflow.com/comment/41779890
linked to: http://stackoverflow.com/q/15685752
answer count: 3

multicore
tags question: http://stackoverflow.com/q/26574666
type: Tag
tag name: multicore

http://stackoverflow.com/a/26621553
upvote count: 4
answers question: http://stackoverflow.com/q/26621360
type: AcceptedAnswer
downvote count: 0
has body: I didnt go into detail on how to read/write files, since you can look that up. However, to achieve what you want: you will need a method to convert a word to binary then you will need another method to convert from binary to words below is the code: import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class HelloWorld{ public static void main(String []args) throws FileNotFoundException { File file = new File("input.txt"); Scanner sc = new Scanner(file); String word=sc.nextLine(); String receivedBinary=stringToBinary(word); System.out.println(); String receivedWord=BinaryToString(receivedBinary); } public static String stringToBinary(String text) { String bString=""; String temp=""; for(int i=0;i&lt;text.length();i++) { temp=Integer.toBinaryString(text.charAt(i)); for(int j=temp.length();j&lt;8;j++) { temp="0"+temp; } bString+=temp+" "; } System.out.println(bString); return bString; } public static String BinaryToString(String binaryCode) { String[] code = binaryCode.split(" "); String word=""; for(int i=0;i&lt;code.length;i++) { word+= (char)Integer.parseInt(code[i],2); } System.out.println(word); return word; } }
score: 4
has comment: http://stackoverflow.com/comment/41853790
type: Answer
accepted answer of: http://stackoverflow.com/q/26621360
has comment: http://stackoverflow.com/comment/41854169

http://stackoverflow.com/a/26633575
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26632037
has body: You can simple create a new class and put both (Object[][] and Object) datastructure together like this: public class DataProviderContainer { private Object[][] auth; private Object browser; public DataProviderContainer(Object[][] auth, Object browser){ this.auth= auth; this.browser = browser; } public DataProviderContainer(Object[][] auth){ this.auth= auth; } public DataProviderContainer(Object browser){ this.browser = browser; } public Object[][] getAuth(){ return this.auth; } public Object getBrowser(){ return this.browser; } public void setAuth(Object[][] auth){ this.auth= auth; } public void setBrowser(Object browser){ this.browser = browser; } } You can there also include your exceptions.

http://stackoverflow.com/q/26637790
has comment: http://stackoverflow.com/comment/41882907
score: -1
has comment: http://stackoverflow.com/comment/41882929
upvote count: 2
has body: what is wrong with this code? I keep getting the error Exception in thread "Thread-2" java.lang.NullPointerException at GUI.render(GUI.java:68) at GUI.run(GUI.java:51) please help import graphics.*; import javax.swing.*; import java.awt.*; import java.awt.Canvas; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; public class GUI extends Canvas implements Runnable { private static final long serialVersionUID = 1L; final static String LABEL_TEXT = "Game"; public static final int Width = 1020; public static final int Height = 680; private Thread thread; private Screen screen; private Render render; private BufferedImage img; private boolean running = false; private int[] pixels; public void display() { screen = new Screen(Height, Width); vimg = new BufferedImage(Width, Height, BufferedImage.TYPE_INT_RGB); pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); } private void start() { if(running) return; running = true; thread = new Thread(this); thread.start(); } private void stop() { if(!running) return; running = false; try { thread.join(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } } public void run() { while (running){ tick(); render(); } } public void tick() { } private void render() { BufferStrategy bs = this.getBufferStrategy();; if(bs == null) { createBufferStrategy(3); return; } screen.render(); for (int i = 0; i &lt;Width*Height; i++){ pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, Width, Height, null); g.dispose(); bs.show(); } /** * Create and show the GUI. */ public static void main(String[] args) { /*Create Canvas*/ GUI game = new GUI(); /*Create and set up the frame*/ JFrame frame = new JFrame("GUI"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /*Add content pane to frame*/ frame.add(game); /*Size and then display the frame.*/ frame.setSize(Width, Height); frame.setVisible(true); frame.setLocationRelativeTo(…
tagged with: java
downvote count: 3
type: Question
has title: NullPointerException - I don't understand
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26637921
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26637921
has comment: http://stackoverflow.com/comment/41885114
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41882919

http://stackoverflow.com/comment/41898786
type: QuestionComment
comment on: http://stackoverflow.com/q/26646795
score: 1
has text: Create an ArrayList containing all the meals of all the courses of the menu, and base your AbstractTableModel on this ArrayList.
type: Comment

http://stackoverflow.com/comment/41919737
comment on: http://stackoverflow.com/q/26658261
score: 0
type: Comment
has text: this pseudo code might be helpful: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Implementation
type: QuestionComment

http://stackoverflow.com/a/32484498
downvote count: 0
answers question: http://stackoverflow.com/q/26604828
type: Answer
score: 2
upvote count: 2
has body: In our case we have been getting same exception. But for both java1.6 and 1.7 Our environment was as follows: jbossAS5.1 with deployed web application and one applet in that web application apache web server2.2.1 requiring client certificate(self signed) on client side mozilla and explorer with imported client certificate, jre with imported client certificate In jre control panel we disabled SSL2 client hello format and also disabled SSL3 and TLS1.2 We left enabled only TLS1.0 and TLS1.1 and everything worked fine since that time.

http://stackoverflow.com/q/26523544
answer count: 2
tagged with: playframework
downvote count: 0
tagged with: callback
has title: Obtain the JsonNode from a Promise[JsonNode] in Java and return that value
favorite count: 0
has body: I'm writing a Play 2.3.2 application in Java. In my application I make a call to a method of an other module, written in Scala. This method returns a Json response and I try to obtain that using WS. This is my method implementation: public static JsonNode getCorrelationData() { WSRequestHolder holder = WS.url(ConfigFactory.load().getString("host") + "/recommendation/correlation"); Promise&lt;JsonNode&gt; jsonPromise = holder.get().map( new Function&lt;WSResponse, JsonNode&gt;() { public JsonNode apply(WSResponse response) { if (response.getStatus() != 200) { Logger.error("Error on get correlation data"); Logger.error("Response status code: " + response.getStatus()); Logger.error("Response status text: " + response.getStatusText()); } return response.asJson(); } }); //here I want to obtain the JsonNode inside the jsonPromise object, and return it. } But the problem is that the callback returns a Promise, and my method need to return a JsonNode. How can I obtain the JsonNode inside the Promise?? I can'f find any solution to my problem. In Scala I know that I can use the flatMap on a Future[T].
tagged with: promise
has answer: http://stackoverflow.com/a/26524037
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26524107
upvote count: 2
type: Question
possible better answer: http://stackoverflow.com/a/26524107
accepted answer: http://stackoverflow.com/a/26524037
tagged with: java

http://stackoverflow.com/comment/41812225
has text: My code does not handle signed numbers. This is only a problem if you need to handle signed numbers.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26597775

http://stackoverflow.com/comment/41733819
has text: Don't compare Strings using `==`. Use the `equals(...)` or the `equalsIgnoreCase(...)` method instead. Understand that `==` checks if the two *objects* are the same which is not what you're interested in. The methods on the other hand check if the two Strings have the same characters in the same order, and that's what matters here.
score: 2
comment on: http://stackoverflow.com/q/26556068
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26636178
has comment: http://stackoverflow.com/comment/41880191
tagged with: guava
tagged with: java
tagged with: concurrency
has body: A common pattern I am encountering is a need to refresh a collection like a List or a HashMap from a database but don't want values added or removed from it in between refreshes. I recently discovered the ImmutableList and ImmutableMap in Google's Guava library which I like a lot. But I cannot do a "clearAll()" on these types nor repopulate them. But I like that they are immutable beyond that. So if I wanted to enforce this pattern of "only make mutable on a database refresh", I guess I would have to use a volatile variable each time? Or is there a better pattern? This can be in a multithreaded environment too, and I would ensure there's no race conditions on the refresh(); public class MarketManager { private volatile ImmutableList&lt;Market&gt; markets = null; private MarketManager() { } public void refresh() { marketList = //build a new immutable market list } public static MarketManager getInstance() { MarketManager marketManager = new MarketManager(); marketManager.refresh(); return marketManager; } }
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41879891
accepted answer: http://stackoverflow.com/a/26636977
has comment: http://stackoverflow.com/comment/41879996
score: 4
has title: Immutable-but-refreshable collections?
has answer: http://stackoverflow.com/a/26636977
upvote count: 4
has comment: http://stackoverflow.com/comment/41879842
has comment: http://stackoverflow.com/comment/41880317
favorite count: 0
downvote count: 0
possible better answer: http://stackoverflow.com/a/26637146
tagged with: multithreading
has answer: http://stackoverflow.com/a/26637146
type: AnsweredQuestion

http://stackoverflow.com/q/26652326
tagged with: native-sql
tagged with: sql
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
has body: I want to calculate the average of the time difference of two timestamp fields of an entity, such that; entity has start_date and finish_date attibutes. In SQL, it is like the following: SELECT SUM(FINISH_TIME - START_TIME) / COUNT(*) FROM PROCESS_EXECUTION_LOG WHERE FINISH_TIME IS NOT NULL When I try to run this as native sql in hibernate: Session session = sessionFactory.openSession(); SQLQuery sqlQuery = session .createSQLQuery("SELECT SUM(FINISH_TIME - START_TIME) / COUNT(*) FROM PROCESS_EXECUTION_LOG WHERE FINISH_TIME IS NOT NULL"); sqlQuery.list(); it has thrown an exeption: org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111 at org.hibernate.dialect.TypeNames.get(TypeNames.java:76) at org.hibernate.dialect.TypeNames.get(TypeNames.java:99) at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:579) at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:696) at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:600) at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:616) at org.hibernate.loader.Loader.getResultSet(Loader.java:2039) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1832) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811) at org.hibernate.loader.Loader.doQuery(Loader.java:899) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341) at org.hibernate.loader.Loader.doList(Loader.java:2516) at org.hibernate.loader.Loader.doList(Loader.java:2502) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332) at org.hibernate.loader.Loader.list(Loader.java:2327) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338) at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1783) at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:231) at org.hibernate.internal.SQLQueryImpl.list(SQLQue…
downvote count: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26652505
type: Question
has title: Get average of two timestamp difference with hibernate
upvote count: 2

http://stackoverflow.com/comment/41815614
has text: 1) this method returns a two-dimensional matrix that represents the transpose of matrixA. 2)this methods returns the sum of the values stores in the diagonal that starts in the upper-left corner of the matrix and ends in the lower-right corner of the matrix 3)this methods returns the sum of the values stores in the diagonal that starts in the upper-right corner of the matrix and ends in the lower-left corner of the matrix.
type: QuestionComment
comment on: http://stackoverflow.com/q/26600778
score: 0
type: Comment

business-logic
tags question: http://stackoverflow.com/q/26566949
type: Tag
tag name: business-logic

http://stackoverflow.com/comment/41718032
comment on: http://stackoverflow.com/a/26544891
type: Comment
has text: Just using the wrong dataSource. When I'm testing locally I expect an exception to be thrown... but it's simply using the wrong dataSource. And same goes when testing remotely.
score: 0
type: AnswerComment

obfuscation
tags question: http://stackoverflow.com/q/26532346
type: Tag
tag name: obfuscation
tags question: http://stackoverflow.com/q/26617365
tags question: http://stackoverflow.com/q/26557090

http://stackoverflow.com/comment/41662036
comment on: http://stackoverflow.com/q/26516025
score: 1
type: QuestionComment
has text: Which line throws the exception? Which object is `null`? Making something "fool proof" is going to involve some debugging at some point.
type: Comment

http://stackoverflow.com/q/26599600
has comment: http://stackoverflow.com/comment/41813741
has comment: http://stackoverflow.com/comment/41813717
has title: Dragging-and-dropping to move a JTextArea around on JPanel
type: Question
has comment: http://stackoverflow.com/comment/41813702
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/41813749
has comment: http://stackoverflow.com/comment/41813716
score: 0
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/41813689
has answer: http://stackoverflow.com/a/26600026
answer count: 1
has comment: http://stackoverflow.com/comment/41813796
has comment: http://stackoverflow.com/comment/41813576
accepted answer: http://stackoverflow.com/a/26600026
has comment: http://stackoverflow.com/comment/41813591
tagged with: mouselistener
tagged with: swing
has body: I want to be able to click on a JTextArea and drag it around my JPanel. I'm not sure the method on doing so. What I'm trying to do is change the x,y coordinates of the JTextArea as it is dragged, I'm not dragging a JTextArea above or below another. Just around on the screen, similar to moving Text Boxes in a program like Microsoft PowerPoint The only method I can think of is using a MouseListener but I'm wondering if there is an easier way to implement it other than detecting a hover/press/drag on the JTextArea. Any ideas on how I can start? import java.awt.Color; import java.awt.Cursor; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JTextArea; public class UMLEditor { public static void main(String[] args) { JFrame frame = new UMLWindow(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(30, 30, 1000, 700); frame.getContentPane().setBackground(Color.white); frame.setVisible(true); frame.setLocationRelativeTo(null); frame.setVisible(true); } } class UMLWindow extends JFrame { Canvas canvas = new Canvas(); private static final long serialVersionUID = 1L; public UMLWindow() { addMenus(); } public void addMenus() { getContentPane().add(canvas); JMenuBar menubar = new JMenuBar(); JMenuItem newTextBox = new JMenuItem("New Text Box"); newTextBox.setMnemonic(KeyEvent.VK_E); newTextBox.setToolTipText("Exit application"); newTextBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { canvas.addTextBox(); } }); menubar.add(newTextBox); setJMenuBar(menubar); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); } } class Canvas extends JPanel { JTextArea commentTextArea = new JTextArea(10, 10)…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41813816
has comment: http://stackoverflow.com/comment/41813626
tagged with: java

http://stackoverflow.com/q/26540509
type: Question
answer count: 2
upvote count: 2
score: 0
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/41706480
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/26540550
type: UnansweredQuestion
has title: Java asking for semicolon when there is already one
has comment: http://stackoverflow.com/comment/41705928
has answer: http://stackoverflow.com/a/26540519
tagged with: java
has body: I'm getting a very odd error where Java is asking me to add a semi-colon to the code even though there's one already. I'm clueless as to what to do. program.java:141: error: &lt;identifier&gt; expected final button.setIcon(new ImageIcon(program.class.getResource("/files/image.jpg"))); ^ program.java:141: error: ';' expected final button.setIcon(new ImageIcon(program.class.getResource("/files/image.jpg"))); ^ Thanks! -- Edit -- private void initialize() { JButton button = new JButton("a button!"); button.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { viewFilmFrame(); } }); button.setBounds(471, 115, 146, 209); frame.getContentPane().add(button); button.setIcon(new ImageIcon(program.class.getResource("/files/image.jpg"))); }

http://stackoverflow.com/a/26576548
has comment: http://stackoverflow.com/comment/137716129
has comment: http://stackoverflow.com/comment/71012757
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/70999335
type: Answer
has comment: http://stackoverflow.com/comment/70944764
has comment: http://stackoverflow.com/comment/71004389
has body: Principally the problem seems to be that you are reading the audio data incorrectly. Specifically I'm not really sure what this excerpt is supposed to mean: if (tempBuffer[j] &gt; tempBuffer[j+1]) ... tempBuffer[j] - tempBuffer[j+1]; else ... tempBuffer[j + 1] - tempBuffer[j]; But anyhow since you are recording 16-bit data the bytes in the byte array aren't meaningful on their own. Each byte only represents 1/2 of the bits in each sample. You need to 'unpack' them to int, float, whatever, before you can do anything with them. For raw LPCM, concatenating the bytes is done by shifting them and ORing them together. Here is an MCVE to demonstrate a rudimentary level meter (both RMS and simple peak hold) in Java. import javax.swing.SwingUtilities; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JComponent; import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.Color; import java.awt.Dimension; import javax.swing.border.EmptyBorder; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.LineUnavailableException; public class LevelMeter extends JComponent { private int meterWidth = 10; private float amp = 0f; private float peak = 0f; public void setAmplitude(float amp) { this.amp = Math.abs(amp); repaint(); } public void setPeak(float peak) { this.peak = Math.abs(peak); repaint(); } public void setMeterWidth(int meterWidth) { this.meterWidth = meterWidth; } @Override protected void paintComponent(Graphics g) { int w = Math.min(meterWidth, getWidth()); int h = getHeight(); int x = getWidth() / 2 - w / 2; int y = 0; g.setColor(Color.LIGHT_GRAY); g.fillRect(x, y, w, h); g.setColor(Color.BLACK); g.drawRect(x, y, w - 1, h - 1); int a = Math.round(amp * (h - 2)); g.setColor(Color.GREEN); g.fillRect(x + 1, y + h - 1 - a, w - 2, a); int p = Math.round(peak * (h - 2)); g.setColor(Color.RED); g.drawLine(x + 1, y + h - 1 - p, x + w - 1, y + h - 1 - …
has comment: http://stackoverflow.com/comment/110354060
accepted answer of: http://stackoverflow.com/q/26574326
has comment: http://stackoverflow.com/comment/70992868
answers question: http://stackoverflow.com/q/26574326
score: 27
has comment: http://stackoverflow.com/comment/71009300
upvote count: 27
has comment: http://stackoverflow.com/comment/138299121

http://stackoverflow.com/comment/41944035
comment on: http://stackoverflow.com/a/26670820
type: AnswerComment
has text: yes you can, or change : private CountDownTimer countDownTimer ot private MyCountDownTimer countDownTimer;
score: 0
type: Comment

http://stackoverflow.com/q/26644550
score: 1
tagged with: java
has body: I've been trying to get net beans to find my main class which I'm thinking is the part where I have it output all 3 areas. According to the school I've correctly coded it but net beans and eclipse refuse to run it if anyone can point out my error and show me how to fix it I'd love it thanks. package shape public class Shape { class circle { int r; int r1; double pi; double FindArea(int a, int b, double c) { r = a; r1 = b; pi = c; return r * r1 * pi; } class rectangle { int height; int width; int RFindArea(int d, int e) { height = d; width = e; return width * height; } } class square { int s; int SFindArea(int f) { s = f; return s ^ 2; } } class result { public void main(String[] args) { circle objCircle = new circle(); System.out.println(objCircle.FindArea(10, 10, 3.14)); rectangle objRec = new rectangle(); System.out.println(objRec.RFindArea(20, 15)); square objS = new square(); System.out.println(objS.SFindArea(5)); } } } } }
type: Question
has answer: http://stackoverflow.com/a/26644569
has comment: http://stackoverflow.com/comment/41895443
has comment: http://stackoverflow.com/comment/41895169
has comment: http://stackoverflow.com/comment/41895483
has comment: http://stackoverflow.com/comment/41895729
has title: Why wont NetBeans find my main class?
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41895406
tagged with: netbeans
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/q/26552149
favorite count: 0
has body: How can i set an x-api-key with the apikey in the header of a HTTP get request. I have tried something but it seems it doesnt work. Here is my code: private static String download(String theUrl) { try { URL url = new URL(theUrl); URLConnection ucon = url.openConnection(); ucon.addRequestProperty("x-api-key", apiKey); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current; while ((current = bis.read()) != -1) { baf.append((byte) current); } return new String (baf.toByteArray()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return ""; } EDIT: Changed the code with the answer below but still getting an error message: it couldn't instantiate the type HttpURLConnection(url). I have changed it but now i have to override 3 methods (below) private static String download(String theUrl) { try { URL url = new URL(theUrl); URLConnection ucon = new HttpURLConnection(url) { @Override public void connect() throws IOException { // TODO Auto-generated method stub } @Override public boolean usingProxy() { // TODO Auto-generated method stub return false; } @Override public void disconnect() { // TODO Auto-generated method stub } }; ucon.addRequestProperty("x-api-key", apiKey); ucon.connect(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); int current; while ((current = bis.read()) != -1) { baf.append((byte) current); } return new String (baf.toByteArray()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return ""; }
possible better answer: http://stackoverflow.com/a/34250489
tagged with: android
has answer: http://stackoverflow.com/a/26552466
upvote count: 14
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: http-headers
accepted answer: http://stackoverflow.com/a/26552466
tagged with: get
answer count: 2
score: 14
has title: How to set X-Api-Key in the header of HTTP get request
downvote count: 0
has answer: http://stackoverflow.com/a/34250489

http://stackoverflow.com/a/26514842
answers question: http://stackoverflow.com/q/26514659
has comment: http://stackoverflow.com/comment/41660494
has body: For array of length = n; you will end up adding (n - 1) + (n - 2) + ... + 2 + 1 + 0 zeros for i = 0, 1, ... n-2, n-1 respectively. Therefore, number of zeros to append (z) = n * (n-1) / 2 So the answer is sum * (10 ^ z) [EDIT] The above can be used to find the answer after N iteration. (I miss read the question) int n = array.length; long sum = 20; long pow = Math.pow(10, n-1); // for i = 0 for (int i = 0; i &lt; n; i++) { System.out.println(sum*pow); pow /= 10; }
score: 0
type: Answer

http://stackoverflow.com/q/26555817
answer count: 2
accepted answer: http://stackoverflow.com/a/26613358
possible better answer: http://stackoverflow.com/a/44955143
has body: I have been messing around with the class loader and other reflection methods, and it seems I have run into a weird bug. I used to have a file, lets say "ClassA.java" in one package, lets say "com.a". However, I had to the need to move it to package "com.b". Now when I use this code to grab all classes in both packages, ClassLoader[] classLoaders = new ClassLoader[] { ClasspathHelper.contextClassLoader(), ClasspathHelper.staticClassLoader() }; String[] packagePrefixes = {"com.a", "com.b"}; FilterBuilder filterBuilder = new FilterBuilder(); for (String packagePrefix : packagePrefixes) filterBuilder.includePackage(packagePrefix); ConfigurationBuilder configurationBuiler = new ConfigurationBuilder() .setScanners(new SubTypesScanner(false), new ResourcesScanner()) .setUrls(ClasspathHelper.forClassLoader(classLoaders)) .filterInputsBy(filterBuilder); Set&lt;Class&lt;?&gt;&gt; allClasses = new Reflections(configurationBuiler).getSubTypesOf(Object.class); The "ClassA.java" class appears twice in the allClasses set (Because the classes are ultimately different due to their different packages) I tried cleaning and deleting/remaking the packages and files, but it seems to believe the file exists in both packages. When I dragged the file into "com.b", eclipse gave me the normal pop-up and I did not check the "update fully qualified names in non-Java files". I have a maven project. Any Ideas? Thanks!
tagged with: package
type: AnsweredQuestion
tagged with: refactoring
tagged with: maven
has answer: http://stackoverflow.com/a/26613358
type: Question
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/44955143
has title: Java reflection - classloader detecting moved class in old and new package
score: 0

http://stackoverflow.com/q/26589567
type: UnansweredQuestion
tagged with: java
has title: Mongojack possible to persist id as string
type: Question
tagged with: mongodb
answer count: 1
has body: Is is possible to store the id field of type String in a POJO as a String in a mongo collection? I've tried to annotate the POJO as described in the official documentation, but the _id collection property is always persisted as an ObjectId. Here's my very simple POJO public class Sticker { @Id @JsonProperty("_id") private String id; private String name; public String getId() { return id; } public void setId( String id ) { this.id = id; } public String getName() { return name; } public void setName( String name) { this.name= name; } }
score: 0
tagged with: mongojack
has answer: http://stackoverflow.com/a/32638458

http://stackoverflow.com/a/26661665
has body: I sometimes had more luck using the exec() method that takes a String-array as parameters, instead of a single String. The String-array allows one to better specify what the different arguments are, which is in my experience more stable, especially if one has spaces within arguments as you have. So try the following: String[] cmd = new String[]{"ssh", "-t", "user1@192.168.2.125", "sudo reboot"}; Runtime.getRuntime.exec(cmd);
answers question: http://stackoverflow.com/q/26661100
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/41713624
has text: Of course an override of `equals()` should not check for reference equality. Otherwise, it would be useless, since Object.equals() does that by default. The point is: it's almost always a bug to compare references. In 99.99% of the cases, when you compare objects, you want to test if they're functionally equal. Not if they are the exact same object. That's why I asked you to give me a reasonable use case where you would want to compare by reference instead of comparing using equals().
score: 0
comment on: http://stackoverflow.com/q/26544412
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26599986
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/26599946
type: Answer
has comment: http://stackoverflow.com/comment/41814438
has comment: http://stackoverflow.com/comment/41836261
score: 1
has body: Have you tried JodaTime? It is a fantastic library to do date manipulation easily. In fact, a lot of Java 8 date handling are derived from JodaTime. For your needs, you could do something like: DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy"); DateTime dt = formatter.parseDateTime(expiredDate); DateTime dayBefore = dt.minusDays(1);

http://stackoverflow.com/a/26616801
has comment: http://stackoverflow.com/comment/41846175
type: Answer
has comment: http://stackoverflow.com/comment/41902508
score: 1
answers question: http://stackoverflow.com/q/26616060
upvote count: 1
has comment: http://stackoverflow.com/comment/41881424
has comment: http://stackoverflow.com/comment/41848239
has comment: http://stackoverflow.com/comment/41883885
has comment: http://stackoverflow.com/comment/41889072
has comment: http://stackoverflow.com/comment/41901032
has comment: http://stackoverflow.com/comment/41888383
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41898598
downvote count: 0
has comment: http://stackoverflow.com/comment/41885085
accepted answer of: http://stackoverflow.com/q/26616060
has comment: http://stackoverflow.com/comment/41846370
has body: Its an alternative by creating bitmap from file and setting it. I also include conversion from content uri to actual uri(as to post file, you need actual uri) and image sampling to avoid OOM: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_IMAGE_CAPTURE) { final boolean isCamera; if (data == null) { isCamera = true; } else { final String action = data.getAction(); if (action == null) { isCamera = false; } else { isCamera = action .equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } Uri selectedImageUri; if (isCamera) { selectedImageUri = outputFileUri; } else { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = activity.getContentResolver().query( selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); selectedImageUri = cursor.getString(columnIndex); cursor.close(); } ImageButton pic1 = (ImageButton) findViewById(R.id.ibPic1); Toast.makeText(this, "Image saved to:\n" + selectedImageUri, Toast.LENGTH_LONG).show(); //.setImageURI(selectedImageUri); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(selectedImageUri, options); options.inSampleSize = calculateInSampleSize(options, dpToPx(100), dpToPx(100)); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; Bitmap bMapRotate = BitmapFactory.decodeFile(filePath, options); int width = bMapRotate.getWidth(); int height = bMapRotate.getHeight(); if (width &gt; height) para = height; else para = width; if (bMapRotate != null) { pic1.setImageBitmap(bMapRotate); } } } private int dpToPx(int dp) { float density = activity.getResources().getDisplayMetrics().density; return Math.round((float) dp * density); } public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int r…

http://stackoverflow.com/a/31342307
downvote count: 0
has body: It seems that you are mixing different (incompatible) versions of Spring components. Check your classpath. If you are using a project management tool like Maven or Gradle, ensure that the dependencies of your project do not contain Spring artifacts, otherwise they will be picked up by the transitive dependency mechanism. If using an IDE like Eclipse and Maven, you can open your pom.xml with the POM Editor and check in the Dependency Hierarchy tab the resolved dependencies. You can then exclude the offending (often older) dependency.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26666028

http://stackoverflow.com/a/26909184
answers question: http://stackoverflow.com/q/26657682
type: AcceptedAnswer
type: Answer
has body: I found it. Maybe others they encounter this problem. I wanted to share the solution. The problem caused from Hibernate and "@PersistenceContext" annotation. I change to Hibernate version to 4.3.5 and problem solved. Hibernate 4.3.6 and 4.3.7 has same problem. It's caused by different classloaders. Ejb Classloader and web app Classloader is different.
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26657682
score: 4

http://stackoverflow.com/a/26609159
has comment: http://stackoverflow.com/comment/41836585
has comment: http://stackoverflow.com/comment/41857733
has comment: http://stackoverflow.com/comment/41838380
has body: Because hasNext: Returns true if the next token matches the pattern constructed from the specified string. The blank line contains no tokens so it is finding the next token from line 4.
answers question: http://stackoverflow.com/q/26608966
has comment: http://stackoverflow.com/comment/41831050
downvote count: 0
has comment: http://stackoverflow.com/comment/41832293
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41832500
has comment: http://stackoverflow.com/comment/41835598
upvote count: 1

http://stackoverflow.com/a/26576876
downvote count: 0
has body: Add a getter in your Sword class. // Returns the sword x location public int getLocX() { return this.x; } There's many ways you can go about this, i.e. using a Vector instead. The implementation is up to you. On a side note, I would highly recommend you use Box2D for collision detection in libgdx.
has comment: http://stackoverflow.com/comment/41771448
has comment: http://stackoverflow.com/comment/41772605
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41771603
accepted answer of: http://stackoverflow.com/q/26576848
answers question: http://stackoverflow.com/q/26576848
type: Answer

http://stackoverflow.com/q/26656625
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/26656887
upvote count: 1
has comment: http://stackoverflow.com/comment/41915716
downvote count: 5
has answer: http://stackoverflow.com/a/26656729
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26656804
score: -4
has body: What im trying to do: Write a java program that accepts some integers as a command line argument and; - display the number of integers passed - display smallest and largest number - display all the prime no in the list* import java.util.*; class commandLine { public static void main(String [] args) { int a[] = new int[args.length]; int count = 0; for (int i = 0; i&lt;a.length;i++) { a[i] = Integer.parseInt(args[i]); count++; } System.out.println("Number of digits: " +count ); int large = a[0]; int small = a[0]; int num = 0; for (int j = 0; j&lt;a.length; j++) { num = a[j] ; if(num&gt;large) { large=num; } if(num&lt;small) { small=num; } } System.out.println("the largest is:" + large); System.out.println("Smallest no is : " + small); boolean isPrime = true; for (int i = 2; i&lt;a.length;i++){ for (int j=2; j&lt;i; j++) { if((i % j)== 0) { isPrime=false; break; } } if(isPrime) { System.out.println(i + " is Prime"); } isPrime = true; } } }
favorite count: 0
type: Question
has title: I can;t get all my prime numbers listed out. What's wrong? :S
possible better answer: http://stackoverflow.com/a/26656804
accepted answer: http://stackoverflow.com/a/26656729

http://stackoverflow.com/q/26556861
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26559834
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/4407532
type: Question
tagged with: jersey
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26559834
favorite count: 0
tagged with: rest
has title: Java Jersey REST Request Parameter Sanitation
tagged with: esapi
upvote count: 3
has body: I'm trying to make sure my Jersey request parameters are sanitized. When processing a Jersey GET request, do I need to filter non String types? For example, if the parameter submitted is an integer are both option 1 (getIntData) and option 2 (getStringData) hacker safe? What about a JSON PUT request, is my ESAPI implementation enough, or do I need to validate each data parameter after it is mapped? Could it be validated before it is mapped? Jersey Rest Example Class: public class RestExample { //Option 1 Submit data as an Integer //Jersey throws an internal server error if the type is not Integer //Is that a valid way to validate the data? //Integer Data, not filtered @Path("/data/int/{data}/") @GET @Produces(MediaType.TEXT_HTML) public Response getIntData(@PathParam("data") Integer data){ return Response.ok("You entered:" + data).build(); } //Option 2 Submit data as a String, then validate it and cast it to an Integer //String Data, filtered @Path("/data/string/{data}/") @GET @Produces(MediaType.TEXT_HTML) public Response getStringData(@PathParam("data") String data) { data = ESAPI.encoder().canonicalize(data); if (ESAPI.validator().isValidInteger("data", data, 0, 999999, false)) { int intData = Integer.parseInt(data); return Response.ok("You entered:" + intData).build(); } return Response.status(404).entity("404 Not Found").build(); } //JSON data, HTML encoded @Path("/post/{requestid}") @POST @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON}) @Produces(MediaType.TEXT_HTML) public Response postData(String json) { json = ESAPI.encoder().canonicalize(json); json = ESAPI.encoder().encodeForHTML(json); //Is there a way to iterate through each JSON KeyValue and filter here? ObjectMapper mapper = new ObjectMapper(); DataMap dm = new DataMap(); try { dm = mapper.readValue(json, DataMap.class); } catch (Exception e) { e.printStackTrace(); } //Do we need to validate each DataMap object value and is there a dynamic way to do it? if (ESAPI.validato…

http://stackoverflow.com/comment/41677772
type: Comment
comment on: http://stackoverflow.com/q/26524961
score: 0
has text: then there can be multiple value for same id ryt?
type: QuestionComment

http://stackoverflow.com/comment/41737881
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26558314
has text: What can cause improper synchronization? Also, to my knowledge, each time the server is writing the packet, it's a new packet, so it shouldn't be modifying another one (I don't think). I'm thinking there's an error related to size, but I haven't found it yet. If that were the case, shouldn't it have this problem at every login, considering the same packets are sent each time? Instead it only happens maybe 40-60% of the time.
score: 0

http://stackoverflow.com/comment/42258332
comment on: http://stackoverflow.com/a/26610259
has text: You're welcome. Please mark the question as correct, as that will help others who might have similar questions find the correct answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26565163
has body: Please review steps 1 &amp; 2 if approch is correct. Also, suggest how to code step 2. Problem Statement: 1. Start a ongoing thread to capture status of the application. Thread thread = new Thread() { public void run() { while (true) { try { checkStaus(); Thread.sleep(TIMER); // 1 mins } catch (InterruptedException e) { Log.e("MyService", "local Thread error", e); } } } }; thread.start(); 2. When 10 mins has been passed, send the captured logs to server. Pseudo: a. Maintain counter until it reaches 600000 milliseconds (10 mins) b. Start an async task to send captured logs to server. c. After successful sending of file, reset counter; empty log file and continue capturing logs. Thanks
tagged with: android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26565865
upvote count: 2
accepted answer: http://stackoverflow.com/a/26565205
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26565205
linked to: http://stackoverflow.com/q/15524280
has title: Suggest better thread handling approach
answer count: 2
possible better answer: http://stackoverflow.com/a/26565865
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26595917
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26593245
upvote count: 1
score: 1
has body: Here is what I am doing. But appreciate if get a better solution. @Entity public class Region { // ... some codes here @OneToMany(fetch = FetchType.LAZY) private List&lt;Product&gt; ProductEntities; @Transient private HashMap&lt;Long, List&lt;Product&gt;&gt; productsMap; public HashMap&lt;Long, List&lt;Product&gt;&gt; getProductsMap() { if (ProductEntities!= null) { for (Product product : ProductEntities) { List&lt;Product&gt; productList = productsMap.get(product.getProductTypeEntity().getId()); if (productList == null) { productList= new ArrayList&lt;Product&gt;(); } productList.add(product); productsMap.put(product.getProductTypeEntity().getId(), productList); } } return productsMap; } // ... rest of codes }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26593245

http://stackoverflow.com/q/26554386
has title: How to know when two threads are finished in Swing
score: 1
accepted answer: http://stackoverflow.com/a/26555011
has comment: http://stackoverflow.com/comment/41730707
has comment: http://stackoverflow.com/comment/41731235
favorite count: 0
has comment: http://stackoverflow.com/comment/41730844
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41731574
has comment: http://stackoverflow.com/comment/41730563
upvote count: 1
tagged with: swing
answer count: 4
possible better answer: http://stackoverflow.com/a/26554517
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26554517
tagged with: java
has answer: http://stackoverflow.com/a/26554811
has answer: http://stackoverflow.com/a/26555011
type: Question
has answer: http://stackoverflow.com/a/26554580
has comment: http://stackoverflow.com/comment/41731090
downvote count: 0
has comment: http://stackoverflow.com/comment/41730922
has body: I have to perform two tasks. I like two threads perform each task simultaneously. The tasks don't share data. Before the tasks start, is shown a dialog with a info "Wait, processing...". Here the codes: final JDialog dialog = new JDialog(this, true); SwingWorker&lt;Void, Void&gt; worker = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { // Do the job return null; } @Override protected void done() { // Must close dialog? The other finished? } }; SwingWorker&lt;Void, Void&gt; worker2 = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { // Do the job return null; } @Override protected void done() { // Must close dialog? The other finished? } }; worker.execute(); worker2.execute(); dialog.setVisible(true); // Must close dialog? I would like to close the dialog only when the two threads ended. How to know when they ended? Who and when should close the dialog? Update: the threads must run simultaneously, not in sequential mode.

http://stackoverflow.com/a/26562889
downvote count: 0
has comment: http://stackoverflow.com/comment/42062497
type: Answer
has body: Marco, what if you solve it differently. Instead of uploading manually the dependencies to the test nexus, why don't you configure the test nexus with a remote repository pointing to the main nexus. Then Jenkins should manage it well pointing to test nexus, transparently
upvote count: 3
answers question: http://stackoverflow.com/q/26551682
score: 3
accepted answer of: http://stackoverflow.com/q/26551682
type: AcceptedAnswer

http://stackoverflow.com/comment/41869721
type: Comment
has text: If you use list you can use the indexOf method to get the index.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26598944

http://stackoverflow.com/comment/41826005
has text: Worked when i added root.add(bird);
comment on: http://stackoverflow.com/a/26606488
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41872050
type: QuestionComment
has text: @BobEzuba Thanks for your reply, could you help me add the get methods as I have had lots of trouble before with doing this correctly :(
comment on: http://stackoverflow.com/q/26631555
score: 0
type: Comment

spring-mvc
tags question: http://stackoverflow.com/q/26543457
tags question: http://stackoverflow.com/q/26602219
tags question: http://stackoverflow.com/q/26646143
tags question: http://stackoverflow.com/q/26640837
tags question: http://stackoverflow.com/q/26589229
tags question: http://stackoverflow.com/q/26575676
tags question: http://stackoverflow.com/q/26590154
tags question: http://stackoverflow.com/q/26599657
tags question: http://stackoverflow.com/q/26669540
tags question: http://stackoverflow.com/q/26634808
tags question: http://stackoverflow.com/q/26667266
tags question: http://stackoverflow.com/q/26534513
tags question: http://stackoverflow.com/q/26571994
tags question: http://stackoverflow.com/q/26545934
tags question: http://stackoverflow.com/q/26548399
tags question: http://stackoverflow.com/q/26660030
tags question: http://stackoverflow.com/q/26570891
tags question: http://stackoverflow.com/q/26638162
tags question: http://stackoverflow.com/q/26623417
tags question: http://stackoverflow.com/q/26609793
tags question: http://stackoverflow.com/q/26586226
tags question: http://stackoverflow.com/q/26597415
tags question: http://stackoverflow.com/q/26587641
tags question: http://stackoverflow.com/q/26586518
tags question: http://stackoverflow.com/q/26542190
tags question: http://stackoverflow.com/q/26640298
tags question: http://stackoverflow.com/q/26605182
tags question: http://stackoverflow.com/q/26671281
tags question: http://stackoverflow.com/q/26527763
tags question: http://stackoverflow.com/q/26639915
tags question: http://stackoverflow.com/q/26544588
tags question: http://stackoverflow.com/q/26599728
tags question: http://stackoverflow.com/q/26561995
tags question: http://stackoverflow.com/q/26632529
tags question: http://stackoverflow.com/q/26616121
tags question: http://stackoverflow.com/q/26671438
tags question: http://stackoverflow.com/q/26640192
tags question: http://stackoverflow.com/q/26534879
tags question: http://stackoverflow.com/q/26543909
tags question: http://stackoverflow.com/q/26608383
tags question: http://stackoverflow.com/q/26534071
tags question: http://stackoverflow.com/q/26624481
tags question: http://stackoverflow.com/q/26559589
tags question: http://stackoverflow.com/q/26574600
tag name: spring-mvc
tags question: http://stackoverflow.com/q/26564751
tags question: http://stackoverflow.com/q/26563332
tags question: http://stackoverflow.com/q/26529646
tags question: http://stackoverflow.com/q/26612404
tags question: http://stackoverflow.com/q/26633601
tags question: http://stackoverflow.com/q/26564138
tags question: http://stackoverflow.com/q/26562190
tags question: http://stackoverflow.com/q/26573424
tags question: http://stackoverflow.com/q/26532870
type: Tag
tags question: http://stackoverflow.com/q/26668186
tags question: http://stackoverflow.com/q/26525073
tags question: http://stackoverflow.com/q/26598914
tags question: http://stackoverflow.com/q/26590669
tags question: http://stackoverflow.com/q/26604841
tags question: http://stackoverflow.com/q/26617553
tags question: http://stackoverflow.com/q/26655071
tags question: http://stackoverflow.com/q/26571510
tags question: http://stackoverflow.com/q/26597004
tags question: http://stackoverflow.com/q/26556456
tags question: http://stackoverflow.com/q/26606234
tags question: http://stackoverflow.com/q/26672909
tags question: http://stackoverflow.com/q/26656398
tags question: http://stackoverflow.com/q/26521105
tags question: http://stackoverflow.com/q/26611027
tags question: http://stackoverflow.com/q/26573886
tags question: http://stackoverflow.com/q/26666615
tags question: http://stackoverflow.com/q/26558427
tags question: http://stackoverflow.com/q/26642493
tags question: http://stackoverflow.com/q/26552275
tags question: http://stackoverflow.com/q/26560174
tags question: http://stackoverflow.com/q/26537239
tags question: http://stackoverflow.com/q/26598966
tags question: http://stackoverflow.com/q/26572863
tags question: http://stackoverflow.com/q/26543014

http://stackoverflow.com/comment/41733643
type: Comment
has text: @jesseZhuang Of course you are correct and I did not say that at all. I just said that an iterative solution can loop forever because it's not allocating extra space per iteration (looped solution) as opposed to a recursive implementation that does allocate per iteraton and cannot loop forever.
type: AnswerComment
comment on: http://stackoverflow.com/a/26521223
score: 0

http://stackoverflow.com/a/65477553
has body: In my task, I shoud only get a month from integer, so this code works perfectly for me: int month=5;//for example Month.of(month).getDisplayName(TextStyle.FULL_STANDALONE, new Locale("ru"));
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26642720

http://stackoverflow.com/comment/41780798
has text: ..but extracting this code into a new java application, it works. Thanks for the heads up!
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26548991

http://stackoverflow.com/comment/41700808
has text: `onActivityResult` should always be called with `REQUEST_CODE_MAIL` if the email intent was finished (with email sent or not). You can perform any action in there (if I understand you correctly).
type: AnswerComment
comment on: http://stackoverflow.com/a/26536575
score: 0
type: Comment

http://stackoverflow.com/a/26556156
has comment: http://stackoverflow.com/comment/41782021
score: 0
has comment: http://stackoverflow.com/comment/41747346
type: AcceptedAnswer
type: Answer
has body: ProgramStore is marked @hide, and thus is not a public API (nor has it ever been public). RenderScriptGL is deprecated (as you mentioned), but it still works.
accepted answer of: http://stackoverflow.com/q/26544591
answers question: http://stackoverflow.com/q/26544591
has comment: http://stackoverflow.com/comment/41778947

http://stackoverflow.com/q/26606234
has comment: http://stackoverflow.com/comment/41834785
tagged with: javascript
has title: AngularJS - File Download through AJAX
has comment: http://stackoverflow.com/comment/41827960
upvote count: 4
has comment: http://stackoverflow.com/comment/41825820
answer count: 2
downvote count: 0
tagged with: url
favorite count: 0
tagged with: angularjs
accepted answer: http://stackoverflow.com/a/26607466
has comment: http://stackoverflow.com/comment/41826099
has body: I created an angular js program for downloading a file from the server here follows the code HTML Code EXPORT AS CSV AngularJS Controller $scope.exportCSVBulk=function(){ var page = "../importExportService/exportBulkCSV/"+batchExec.id; $http.get(page).success(function(response) { $scope.fullListUrl = 'data:text/csv;charset=utf-8,' + escape(response); }); } Here what i am doing is when a user click on the EXPORT AS CSV link the function exportCSVBulk fires and from that function the url value (fullListUrl) sets. But this is an ajax request, so when a user click on the link the url, the response time become little bit long which results the url will not redirected properly. Is it possible to fix this problem? or is there is any alternative way to fix this?
has comment: http://stackoverflow.com/comment/41826076
has comment: http://stackoverflow.com/comment/41825334
tagged with: spring-mvc
type: AnsweredQuestion
score: 4
tagged with: java
possible better answer: http://stackoverflow.com/a/37288180
type: Question
has answer: http://stackoverflow.com/a/37288180
has answer: http://stackoverflow.com/a/26607466

http://stackoverflow.com/comment/41883902
comment on: http://stackoverflow.com/a/26598867
has text: Curious thing: the header isn't printing anymore, just noticed this.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41921360
type: Comment
comment on: http://stackoverflow.com/a/26655914
has text: that's the question - how do I make them show on the result page of successful page?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26554445
score: 3
answers question: http://stackoverflow.com/q/26553072
accepted answer of: http://stackoverflow.com/q/26553072
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has body: Yes, consumers on queues always compete for messages. topics on the other hand are publish/subscribe (all consumers get them). If a consumer blows up and the message is redelivered; there is no guarantee the message will go to the same consumer.

http://stackoverflow.com/comment/41800592
comment on: http://stackoverflow.com/a/26590548
has text: To hard to tell without the code. Close this question and open a new one with the code you wrote. I will have a look.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41669688
type: AnswerComment
has text: -1 for suggesting the field and the method to be static.
comment on: http://stackoverflow.com/a/26520148
type: Comment
score: 1

http://stackoverflow.com/comment/41779466
score: 0
type: Comment
has text: Consider Kumar's suggestion also and clean your project and diploy it
comment on: http://stackoverflow.com/a/26581406
type: AnswerComment

http://stackoverflow.com/q/26652588
tagged with: java
has comment: http://stackoverflow.com/comment/41908735
tagged with: javadoc
has title: Javadoc for constructor calling on an interface
type: Question
has answer: http://stackoverflow.com/a/26652817
answer count: 1
score: 0
tagged with: interface
tagged with: constructor
has comment: http://stackoverflow.com/comment/41908859
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41908595
has body: I have interface called PlayerDatabase and A class called DatabaseUI. Im having problem to write the javadoc, I really don't know how to define what im doing. public class DatabaseUI { private final PlayerDatabase database; /** * This constructor calls on the database so that the * UI can work with it. * * @param database contains {@code Player}'s */ public DatabaseUI(PlayerDatabase database) { this.database = database; } } Is this fine javadoc, is this what I am actually doing?
has comment: http://stackoverflow.com/comment/41908700

http://stackoverflow.com/a/26585840
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26585694
answers question: http://stackoverflow.com/q/26585694
type: Answer
has body: Without any further knowledge of Android development this leaves two possibilities: Dependency "javax.*" not available in your compiled version (.apk) Dependency "javax.*" not supported. A quick webresearch implies the second one: https://github.com/kshoji/USB-MIDI-Driver/wiki/javax.sound.midi-porting-for-Android
has comment: http://stackoverflow.com/comment/41790357
has comment: http://stackoverflow.com/comment/41789838
upvote count: 1
has comment: http://stackoverflow.com/comment/42511433
score: 1

http://stackoverflow.com/comment/41881584
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26633068
score: 0
has text: Thanks I did not know about GWT 2.7

http://stackoverflow.com/comment/41738787
comment on: http://stackoverflow.com/q/26558976
type: QuestionComment
has text: I don't think you have created any pool. You have just specified two sets of pool configuration (that you would later use to create two pools). Can you show the code where you use these `poolProperties`?
score: 0
type: Comment

http://stackoverflow.com/q/26571262
has comment: http://stackoverflow.com/comment/41762226
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41764244
favorite count: 0
type: Question
upvote count: 2
tagged with: spring
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/41791406
has title: Spring bean get instantiated twice
has comment: http://stackoverflow.com/comment/41780855
score: 2
has body: I have an issue of duplicate instantiate of a Spring Bean. Normally I wouldn't mind, but the problem is that is is a scheduled bean, so we get our tasks beaing scheduled twice. We use Spring 3.2.2.RELEASE in our pom file. We have context.xml. We use XML configuration and not annotation. During my tries, I moved all the bean declarations under one context file, which being declared in the web.xml. Here's the servlet.xml. it's empty: <?xml version="1.0" encoding="UTF-8"?> Here's the web.xml part: <?xml version="1.0" encoding="UTF-8"?> The App org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener contextConfigLocation META-INF/application-ctx.xml,WEB-INF/security-context.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* ... Other filters and servlets And here is the context: The lower part of it used to be in the servlet.context <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> <import resource="classpath:META-INF/management-application-ctx.xml"/> <import resource="classpath:META-INF/lucene-application-ctx.xml"/> <import resource="classpath:META-INF/serving-application-ctx.xml" /> <import resource="classpath:META-INF/tracking-application-ctx.xml" /> <import resource="scheduling-ctx.xml"/> config.xml config.xsd ... other beans <mvc:annotation-driven /> <context:component-scan base-package="p…

http://stackoverflow.com/comment/41876796
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26634533
has text: You may have to close the out stream before reading from that file.

http://stackoverflow.com/a/26571974
type: AcceptedAnswer
has body: In your Game class, you should initialize the newState before setting it as the currentState! public void setCurrentState(State newState) { System.gc(); currentState = newState; newState.init(); inputHandler.setCurrentState(currentState); } Should be: public void setCurrentState(State newState){ System.gc(); newState.init(); currentState = newState; inputHandler.setCurrentState(currentState); } If you have any other issues, please let me know on the book's forum. jamescho7.com/forum
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26569834
accepted answer of: http://stackoverflow.com/q/26569834
upvote count: 1

http://stackoverflow.com/a/26592902
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41801750
type: Answer
has comment: http://stackoverflow.com/comment/41801282
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41801162
has body: All the fields of an interface are implicitely public, static and final. So this is the same as writing public static final String ROLE = Mojo.class.getName(); It defines a constant, that all the users of the interface can use, as any other constant: Mojo.ROLE. This line is executed when the Mojo interface is initialized by the ClassLoader. Mojo.class is the Mojo class, indeed of type java.lang.Class&lt;Mojo&gt;. Since the package of the class is org.apache.maven.plugin, the value of the constant will be "org.apache.maven.plugin.Mojo". Look here for the relevant section of the Java language specification.
answers question: http://stackoverflow.com/q/26592777
accepted answer of: http://stackoverflow.com/q/26592777

http://stackoverflow.com/comment/41784677
score: 1
has text: @RichardK You are not throwing an Error. Your attempt to throw an Error fails, and instead `NullPointerException` is thrown.
type: Comment
comment on: http://stackoverflow.com/a/26584449
type: AnswerComment

http://stackoverflow.com/comment/41789029
score: 0
type: AnswerComment
type: Comment
has text: If the answer worked for you please accept it for future users @SusanSummers I will also give you an example for what you requested if you still need it.
comment on: http://stackoverflow.com/a/26574503

http://stackoverflow.com/comment/41727572
comment on: http://stackoverflow.com/a/26551890
type: AnswerComment
type: Comment
has text: Excellent. So then you can use the HttpClient class to get, post, etc. Here is an example. http://android-developers.blogspot.com/2011/09/androids-http-clients.html
score: 1

http://stackoverflow.com/a/26526812
has body: You have: public Rectangle(int upper1, int upper2,int lower1,int lower2) throws Exception { ^^^^^^^^^^^^^^^^^ That is saying that your Rectangle constructor can throw any kind of exception. That means any code that calls the constructor has to deal with any kind of exception (either by catching it or also declaring it as thrown). It looks like your constructor is actually only throwing IllegalArgumentException, which is unchecked (doesn't need to be declared in a throws clause). So if you take off the throws, it should work. public Rectangle(int upper1, int upper2,int lower1,int lower2) { ...
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41681284
accepted answer of: http://stackoverflow.com/q/26526733
answers question: http://stackoverflow.com/q/26526733
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26665839
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/26665901
tagged with: android-studio
tagged with: java
has title: Error using AsyncTask on Android Login Activity
has body: I'm trying to code an Android login Activity using AsyncTask and PHP/MySQL. I'm getting this logcat: 10-30 17:27:28.708 17111-17111/com.android.fer.prototipo I/SELinux﹕ Function: selinux_android_load_priority [0], There is no sepolicy file. 10-30 17:27:28.708 17111-17111/com.android.fer.prototipo I/SELinux﹕ Function: selinux_android_load_priority , loading version is VE=SEPF_SGH-I337M_4.4.2_0017 10-30 17:27:28.708 17111-17111/com.android.fer.prototipo I/SELinux﹕ selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts 10-30 17:27:28.718 17111-17111/com.android.fer.prototipo D/dalvikvm﹕ Late-enabling CheckJNI 10-30 17:27:29.178 17111-17111/com.android.fer.prototipo W/ApplicationPackageManager﹕ getCSCPackageItemText() 10-30 17:27:29.278 17111-17111/com.android.fer.prototipo I/Adreno-EGL﹕ &lt;qeglDrvAPI_eglInitialize:381&gt;: EGL 1.4 QUALCOMM build: (CL3869936) OpenGL ES Shader Compiler Version: 17.01.11.SPL Build Date: 01/17/14 Fri Local Branch: Remote Branch: Local Patches: Reconstruct Branch: 10-30 17:27:29.338 17111-17111/com.android.fer.prototipo D/OpenGLRenderer﹕ Enabling debug mode 0 10-30 17:27:45.104 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: left = 0 10-30 17:27:45.104 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: top = 0 10-30 17:27:45.104 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: right = 144 10-30 17:27:45.104 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: bottom = 144 10-30 17:27:45.864 17111-17444/com.android.fer.prototipo W/dalvikvm﹕ threadid=14: thread exiting with uncaught exception (group=0x4192eda0) 10-30 17:27:45.884 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: left = 0 10-30 17:27:45.884 17111-17111/com.android.fer.prototipo D/ProgressBar﹕ updateDrawableBounds: top = 0 10-30 17:27:45.884 17111-17444/com.android.fer.prototipo E/AndroidRuntime﹕ FATAL…
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41933570
has answer: http://stackoverflow.com/a/26668972
favorite count: 0

http://stackoverflow.com/comment/41669735
comment on: http://stackoverflow.com/q/26520263
has text: I recommend spending a little time in the Android API, if I recall, there are some methods that can do virtually all that easily and predefined http://developer.android.com/reference/packages.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26586791
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26572491
answers question: http://stackoverflow.com/q/26572491
has body: That's because AdMob is not supported on Froyo Google Play Services. The Admob Guide states the following prerequisites: Running Android Studio 0.8 or higher Developing for Android level 9 or higher Froyo is API level 8, so it is not supported. I think you will have to use to old AdMob Ads SDK when working with Google Play Services for Froyo - see this document.
downvote count: 0
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/41663528
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26516440
has text: The more object-oriented solution is to make your List a private field of Item class. In the Item constructor you instantiate the list (new ArrayList) then you create a method void addRandomName(String random){ randomNames.add(random); } and a method List<String> getRandomNames(){ return randomNames; }

http://stackoverflow.com/q/26536122
has answer: http://stackoverflow.com/a/26536557
accepted answer: http://stackoverflow.com/a/26536557
type: Question
has comment: http://stackoverflow.com/comment/41698207
answer count: 2
linked to: http://stackoverflow.com/q/15688019
score: 0
has answer: http://stackoverflow.com/a/26536311
has comment: http://stackoverflow.com/comment/41698611
has comment: http://stackoverflow.com/comment/41698586
has body: I need to obtain all combinations of a String of length k from given elements. For example, for char[] elements = {'a', 'b', 'c'} k = 4 the output should be: aaaa, aaab, ..., cccc. Now I have the following code which gives proper results BUT isn't fast enough. What can I improve in my code? public static ArrayList&lt;String&gt; printAllKLength(char[] elements, int nrElements, int patternLength) { ArrayList&lt;String&gt; patternVariations = new ArrayList&lt;String&gt;(); patternVariations = printAllKLengthRec(elements, "", nrElements, patternLength, patternVariations); return patternVariations; } public static ArrayList&lt;String&gt; printAllKLengthRec(char[] elements, String prefix, int nrElements, int patternLength, ArrayList&lt;String&gt; patternVariations) { if (patternLength == 0) { patternVariations.add(prefix); //System.out.println(prefix); return patternVariations; } for (int i = 0; i &lt; nrElements; ++i) { String newPrefix = prefix + elements[i]; printAllKLengthRec(elements, newPrefix, nrElements, patternLength - 1, patternVariations); } return patternVariations; } Thank you!
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26536311
has title: Optimizing String combinations in Java
has comment: http://stackoverflow.com/comment/41698759
tagged with: java
has comment: http://stackoverflow.com/comment/41698135

http://stackoverflow.com/a/26573150
upvote count: 1
answers question: http://stackoverflow.com/q/26570023
has body: first of all, view scope is correct, but; getVendorContactsList() should just initialize the list if needed, and return it. public List&lt;VendorContactDetails&gt; getVendorContactsList(){ if (vendorConList == null) { vendorConList = new ArrayList&lt;VendorContactDetails&gt;(); } return vendorConList; } then, there should be a separate method to add an item to the list. public void addVendorContactToList(){ getVendorContactsList().add(new VendorContactDetails()); } and at last, the button adding a new item should not be in a table column. it's not an operation related to an existing item/row. &lt;p:commandButton value="Add New" process="@this" update="dt" action="#{globalMaster.addVendorContactToList}"/&gt; if you are planning to update or delete an item in list, then those buttons will be in table columns.
accepted answer of: http://stackoverflow.com/q/26570023
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41734387
comment on: http://stackoverflow.com/q/26556399
score: 0
type: Comment
type: QuestionComment
has text: Ah ok, I didn't know there was a difference. Thanks! By the way, if you put your comment as an answer I can select it as the answer because now I can't.

http://stackoverflow.com/a/26618140
answers question: http://stackoverflow.com/q/26618057
has comment: http://stackoverflow.com/comment/41847423
score: 1
has body: It's the same as executing in Windows: &lt;path to bin folder for the specific JRE&gt;/java -jar Executable.jar Make sure you can ls to the directory with the same path.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/87042462
has text: `app:backgroundTint="@color/blue"` works on all api levels.. although for whatever reason it is still turning to a different color when selected XD
type: AnswerComment
comment on: http://stackoverflow.com/a/43729331
type: Comment
score: 1

http://stackoverflow.com/comment/41869929
type: Comment
has text: Session class only acts after login is successful for maintain active the user token... When user logout the session is deleted
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26630107

http://stackoverflow.com/q/26542940
tagged with: google-app-engine
has title: while retrieving entity occurs an error
score: 0
has body: When I retrieve the object from datastore, I am getting this error: com.google.appengine.datanucleus.query.StreamingQueryResult cannot be cast to com.relationship.Student` This is my code: javax.jdo.Query q=pm.newQuery(Student.class); //String fname="karthi"; q.setFilter("name == 'karthi'"); @SuppressWarnings("unchecked") List&lt;Employee&gt; results = (List&lt;Employee&gt;) q.execute("karthi@gmail.com"); Student e = (Student) results; resp.getWriter().println(e.getName()); The datastore has those properties and values: ID/Name college name karthi@gmail.com AMS karthi
tagged with: jdo
answer count: 1
tagged with: java
tagged with: database
type: UnansweredQuestion
tagged with: google-cloud-datastore
has answer: http://stackoverflow.com/a/27972551
type: Question

http://stackoverflow.com/comment/119920557
comment on: http://stackoverflow.com/a/26645534
type: Comment
has text: There's a possibility that the compiler has changed the `void loop()` method into a static method since it does not reference any instance variable or method. If you have a refrence to the `FinalizeThis` object in `void loop()`, it won't be GCed.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41812722
comment on: http://stackoverflow.com/q/26599094
score: 0
type: Comment
has text: @JasonC Works fine for me...
type: QuestionComment

http://stackoverflow.com/q/26514064
tagged with: guice
has title: Guice doesn't initialize property
has body: I'm newly with Guice. I want to use Guice for initializing object without writing new directly. Here is my main(): public class VelocityParserTest { public static void main(String[] args) throws IOException { try { PoenaRequestService poenaService = new PoenaRequestService(); System.out.println(poenaService.sendRequest("kbkCode")); } catch (PoenaServiceException e) { e.printStackTrace(); } } } PoenaRequestService: public class PoenaRequestService { private static final String TEMPLATE_PATH = "resources/xml_messages/bp12/message01.xml"; public static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PoenaRequestService.class); @Inject @Named("poena_service") private HttpService poenaService; public String sendRequest(/*TaxPayer taxPayer,*/ String kbk) throws PoenaServiceException { LOG.info(String.format("Generating poena message request for string: %s", kbk)); Map&lt;String, String&gt; replaceValues = new HashMap&lt;&gt;(); replaceValues.put("guid", "guid"); replaceValues.put("iinbin", "iinbin"); replaceValues.put("rnn", "rnn"); replaceValues.put("taxOrgCode", "taxOrgCode"); replaceValues.put("kbk", "kbk"); replaceValues.put("dateMessage", "dateMessage"); replaceValues.put("applyDate", "applyDate"); ServiceResponseMessage result; try { String template = IOUtils.readFileIntoString(TEMPLATE_PATH); Document rq = XmlUtil.parseDocument(StringUtils.replaceValues(template, replaceValues)); result = poenaService.execute(HttpMethod.POST, null, rq); } catch (IOException e) { throw new PoenaServiceException("Unable to read template file: " + TEMPLATE_PATH, e); } catch (SAXException e) { throw new PoenaServiceException("Unable to parse result document, please check template file: " + TEMPLATE_PATH, e); } catch (HttpServiceException e) { throw new PoenaServiceException(e); } if (result.isSuccess()) { return (String) result.getResult(); } throw new PoenaServiceException("HTTP service error code '" + result.getStatusCode() + "', message: " + result.getStatusMes…
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41658292
has answer: http://stackoverflow.com/a/26515795
answer count: 1
favorite count: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41659731
has comment: http://stackoverflow.com/comment/41659145
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26515795
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41659473

http://stackoverflow.com/comment/41833260
has text: @KishorePaparthi You would have to refresh the page each time which is not something you want to do. If all you are trying to do is display current date and time then you should use the code above. If you are trying to accomplish something else then maybe I can help you do it in javascript but passing variables from java to javascript/html usually requires page refresh which isn't very efficient.
comment on: http://stackoverflow.com/a/26610463
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26565373
type: Answer
has body: First i don't understand your intention why not using a continious integration solution which records the whole output and can be stored for a period of time. If you need to analyze you can take a look into it. Apart from that i don't understand your need to do something what you described and what the advantage would be... Furthermore a maven plugin will simply not work for your intention cause a maven plugin is bound to the life cycle. If you really need something outside the mave life cycle you could take a look into the EventSpy which could be used in the way you described, but its an extension which must be put into lib/ext folder of your maven installation. Best is to use the AbstractEventSpy as parent for your own implementation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26563107
score: 0
answers question: http://stackoverflow.com/q/26563107

http://stackoverflow.com/q/26644792
has comment: http://stackoverflow.com/comment/41895595
tagged with: java
type: Question
has title: Error in request sent to appengine backend devserver
has comment: http://stackoverflow.com/comment/41895661
has comment: http://stackoverflow.com/comment/42009414
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has body: I have a bunch of code which would run on backend but when testing locally I am getting memcache related error INFO : { AppEngineUserRealm isUserInRole } - Checking if principal test@example.com is in role admin SEVERE : { ShardedMemcacheUtil get } - Error encountered while getting [ configuration ] from memcache. java.lang.ClassCastException: com.google.appengine.tools.appstats.StatsProtos$RequestStatProto$Builder cannot be cast to com.google.appengine.tools.appstats.StatsProtos$RequestStatProto$Builder at com.google.appengine.tools.appstats.MemcacheWriter.write(MemcacheWriter.java:210) at com.google.appengine.tools.appstats.Recorder.processRecordingFuture(Recorder.java:456) at com.google.appengine.tools.appstats.Recorder.processAsyncRpc(Recorder.java:404) at com.google.appengine.tools.appstats.RecordingFuture.maybeRecordStats(RecordingFuture.java:140) at com.google.appengine.tools.appstats.RecordingFuture.get(RecordingFuture.java:110) at com.google.appengine.tools.appstats.RecordingFuture.get(RecordingFuture.java:20) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88) at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:26) at com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:49) The request was sent to the following URL so that the code is executed in backend. http://localhost:52843/ The above request runs fine when sent to http://localhost:8888/ Which is actually devserver. Any clue what's wrong with it when run inside backend ? Also why there are two ports opened for backend 58251 and 58252 INFO : { JettyLogger info } - Started SelectChannelConnector@127.0.0.1:8888 INFO : { AbstractModule startup } - Module instance default is running at http://localhost:8888/ INFO : { AbstractModule startup } - The admin console is running at http://localhost:8888/_ah/admin INFO : { JettyLogger info } - jetty-6.1.x INFO : { ApiProxyLocalImpl log } - javax.servlet.ServletContext log: I…

http://stackoverflow.com/a/26535006
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26533982
has body: If speed is the current speed of the block, you can simply invert it on each tap so then the block would move in the opposite direction: if (Gdx.input.justTouched()){ hasBeenTapped = true; speed = - speed; } If you want to invert the direction also when reaching the borders: if (getX()&lt;0 || getX()&gt;864){ speed = - speed; } Also you need the left bound check: if (getX()&lt;0) { setX(0); } You should also consider the width of the block when checking the left or the right bound otherwise you would have that a part of the block is going after the bound.

http://stackoverflow.com/q/26568218
has body: I am trying to generate WADL using maven-wadl-plugin by this tutorial WADL Generation Tool. But i always get error below. Can someone tell me where problem is because i cant see it. Added pom.xml just for sure. Here is following error. [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building AMS Airlines 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-wadl-plugin:1.18.1:generate (default-cli) @ ams-airlines --- [INFO] Loading wadlGenerator com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc [INFO] Loading wadlGenerator com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport Říj 26, 2014 12:55:59 DOP. com.sun.xml.internal.bind.v2.util.XmlFactory createParserFactory SEVERE: null org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source) at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source) at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source) at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:114) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:139) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:189) at com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc.init(WadlGeneratorApplicationDoc.j…
tagged with: wadl
tagged with: maven
linked to: http://stackoverflow.com/q/9486835
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30996776
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/30996776
downvote count: 1
has answer: http://stackoverflow.com/a/26571086
type: Question
tagged with: jersey
linked to: http://stackoverflow.com/q/25644023
answer count: 2
score: 2
has title: Error wher generating wadl by maven-wadl-plugin
accepted answer: http://stackoverflow.com/a/26571086
favorite count: 0

http://stackoverflow.com/a/26521500
downvote count: 0
answers question: http://stackoverflow.com/q/26521469
has body: With the code SimpleDateFormat sParse = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss"); you're telling the parser to expect the date to be formatted like 23-10-2014 (separated by -) so obviously it won't parse '23/10/2014' For that you need to specify the format string as dd/MM/yyyy
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41778737
has comment: http://stackoverflow.com/comment/41672071
has comment: http://stackoverflow.com/comment/41672095

http://stackoverflow.com/q/26550472
answer count: 1
has body: I have a small survey in a HTML form which is submitted to a Java servlet using AJAX. The user submits information about their gender, age, and which of 8 genres of computer game they like (at least one) and the datetime of form submission. Here is the MySql table: This is the MySQL query: String query = "INSERT INTO vote (sex, age, genre1, genre2, genre3, genre4, genre5, genre6, genre7, genre8, date) VALUES (?,?,?,?,?,?,?,?,?,?,NOW())"; Here are the genre HTML input fields: First Person Shooter Sports Action/Adventure Educational Puzzle Real Time Strategy Beat em up Survival Horror In the servlet I am trying to check which of the checkboxes have been checked and match them against their corresponding database column, setting the value of that column to one if it matches the checkbox value?! I'm not sure if I'm using the right approach, but here is my attempt which gives me an SQLException: java.sql.SQLException: No value specified for parameter 3. This is my attempt: String[] checkboxes = request.getParameterValues("genre"); int sex = Integer.parseInt(request.getParameter("sex")); int age = Integer.parseInt(request.getParameter("age")); try(Connection con = ds.getConnection()){ String query = "INSERT INTO vote (sex, age, genre1, genre2, genre3, genre4, genre5, genre6, genre7, genre8, date) " + "VALUES (?,?,?,?,?,?,?,?,?,?,NOW())"; PreparedStatement ps = con.prepareStatement(query); ps.setInt(1, sex); ps.setInt(2, age); int column = 3; for(int x = 1; x < checkboxes.length; x++){ if(x == Integer.parseInt(checkboxes[x])){ ps.setInt(column, 1); column++; }else{ ps.setInt(column, 0); column++; } } ps.executeUpdate(); ps.close(); out.print("yes"); }catch(SQLException e){ out.print(e); } So in my query "if checkbox 1 has been checked then set column 3 to 1, if checkbox 2 has been checked then set column 4 to 1". etc.
tagged with: jsp
score: 0
type: UnansweredQuestion
tagged with: checkbox
has answer: http://stackoverflow.com/a/26553766
tagged with: java
tagged with: mysql
tagged with: servlets
type: Question
has title: Attempting to effect database columns depending on form checkboxes that are checked

http://stackoverflow.com/q/26576883
type: Question
linked to: http://stackoverflow.com/q/22489398
answer count: 2
has answer: http://stackoverflow.com/a/27653197
has comment: http://stackoverflow.com/comment/41771500
favorite count: 0
has answer: http://stackoverflow.com/a/27653277
has comment: http://stackoverflow.com/comment/41771831
has comment: http://stackoverflow.com/comment/41803548
linked to: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/41772329
duplicate of: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/41771753
has body: running fedora 20 and using gedit as my editor. when i compile my program and then try to run it using terminal, this happens: Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) ABRT problem creation: 'success' i have tried the simple google search but all i can find out is that the program is being compiled using a later version of java and being run with another. however, all the solutions i came across are based on eclipse and i am not using this. please help!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41772432
has comment: http://stackoverflow.com/comment/41772588
has title: Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method)
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41771611
has comment: http://stackoverflow.com/comment/41772052
has comment: http://stackoverflow.com/comment/41797970
has comment: http://stackoverflow.com/comment/41772801
has comment: http://stackoverflow.com/comment/41771908
score: 0
tagged with: java

http://stackoverflow.com/comment/41861861
comment on: http://stackoverflow.com/a/26612677
has text: I used the gesture detection system. I made own class for the gesture detection but my attempt stopped when my main class says: "The constructor GestureDetector(GestureListenerC) is undefined" (GestureListenerC is the name of the Gesture detection class EDIT: I got it to work! I just made local variables to the main class. Do you have any idea how to add a friction so it would scroll little bit after I release my finger?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41888094
score: 0
has text: Join by `""` (empty string).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26640581

http://stackoverflow.com/q/26598552
has title: Selenium WebDriver Java - can't get dynamic text from span tag
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26598725
downvote count: 1
has comment: http://stackoverflow.com/comment/41851813
has answer: http://stackoverflow.com/a/26598725
has comment: http://stackoverflow.com/comment/41842342
has comment: http://stackoverflow.com/comment/41811927
has comment: http://stackoverflow.com/comment/41811545
favorite count: 0
has body: Trying to get numeric dynamic text value from span element. My test is data driven so for each run it needs to get text (dollar amount) from web page and then compare it to expected value in excel. For some reason my code doesn't work. Please help to solve. My HTML: $ 445.87 My Locator: By PRICE = By.xpath("//div[@class='price ng-binding'][@ng-hide='calc.isCalculating']/text()"); My Code: WebDriverWait wait = new WebDriverWait(driver, 15); wait.until(ExpectedConditions.presenceOfElementLocated(PRICE)); WebElement actualPriceElm = driver.findElement(PRICE); actualPriceElm.getText(); Assert.assertEquals(actualPriceElm, strExpectedPrice); My Error: Timed out after 15 seconds waiting for presence of element located by: By.xpath: //div[@class='price ng-binding'][@ng-hide='calc.isCalculating']/text() When I use my xpath without "/text()" like this //div[@class='price ng-binding'][@ng-hide='calc.isCalculating'] then I get following error: Exception in thread "main" java.lang.AssertionError: expected [445.87] but found [[[FirefoxDriver: firefox on WINDOWS (f26e0c00-823f-4d45-8285-014303527524)] -> xpath: //div[@class='price ng-binding'][@ng-hide='calc.isCalculating']]]
has comment: http://stackoverflow.com/comment/41812059
has answer: http://stackoverflow.com/a/26769165
accepted answer: http://stackoverflow.com/a/26769165
tagged with: xpath
type: AnsweredQuestion
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/26624684
has comment: http://stackoverflow.com/comment/41819918
has comment: http://stackoverflow.com/comment/41811835
has comment: http://stackoverflow.com/comment/41811429
has comment: http://stackoverflow.com/comment/41811540
score: 0

http://stackoverflow.com/comment/41812547
type: Comment
comment on: http://stackoverflow.com/a/26598702
has text: Ok, well actually I was more interested in setting the location and therefore won't need to resize it. But, I am planning on using this for click-and-dragging of the JTextArea around the JPanel so I will need to know where the JTextArea is and where it will have to move to
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41893864
comment on: http://stackoverflow.com/a/26643583
type: AnswerComment
has text: @Shvalb Is there a type variable T in an enclosing class? Is this method in some class Foo<T>? If so, that's your problem -- just rename the inner type variable T.
type: Comment
score: 1

http://stackoverflow.com/comment/41661444
type: QuestionComment
comment on: http://stackoverflow.com/q/26515760
score: 0
has text: you could use Glassfish. For simplicity I'd use Tomcat.
type: Comment

http://stackoverflow.com/a/27395652
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26556659
has comment: http://stackoverflow.com/comment/45690933
has comment: http://stackoverflow.com/comment/45693611
has body: If I understood right you cannot modify getters/setters in idea now. Issue on youtrack P.S. Ok, now Fix version is 14.1, from this version of idea you can create and choose getter/setter template directly in Alt-Insert menu.

http://stackoverflow.com/q/26590007
score: 0
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/26591415
has title: Create new file type, add checksum and data from compressed file?
tagged with: checksum
type: Question
has comment: http://stackoverflow.com/comment/41797202
has comment: http://stackoverflow.com/comment/41797343
has comment: http://stackoverflow.com/comment/41797694
has comment: http://stackoverflow.com/comment/41795079
answer count: 1
has comment: http://stackoverflow.com/comment/41797473
tagged with: file-type
has answer: http://stackoverflow.com/a/26591415
has body: I have a txt file which i compressed with an algorithm, and have calculated a MD5 checksum for the original txt file. Now i have to create a new file type (new extension) and add the compressed data and the checksum. After decompressing the new file type i need to check if the checksum matches with the original file. My question is: What is the best way to create the new file type and add the data and checksum? I was thinking about the following method: Write the checksum first into the new file (as plain txt) and then write the compressed data after that. When reading the file i read checksum first, dont close the InputStream and continue with reading the compressed data. Is this a good way to do it? Any links or solution are welcome. Thanks in advance. NOTE: New file type can be simple and only 1 file will be compressed at a time
has comment: http://stackoverflow.com/comment/41795260
has comment: http://stackoverflow.com/comment/41797355
type: AnsweredQuestion

http://stackoverflow.com/comment/41690613
score: 0
type: Comment
type: QuestionComment
has text: If you are using i.e. `Apache DBCP`, you could use `testOnBorrow` to validate your connections. Also, you would have to set `validationQuery` to `SELECT 1`.
comment on: http://stackoverflow.com/q/26531835

http://stackoverflow.com/a/26545845
has comment: http://stackoverflow.com/comment/41714740
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26545725
has body: Your createLogoPanel takes a JFrame type argument. But I don't see you passing an argument when you are actually invoking the method. Do something along the lines of : JFrame frame = MainFrame.createFrame(); LogoPanel.createLogoPanel(frame); This error seem to suggest a lack of understanding about basic Java syntax and concepts. If you are able to accumulate knowledge in this area it will benefit you greatly in the future.
downvote count: 0
answers question: http://stackoverflow.com/q/26545725

http://stackoverflow.com/a/26657553
downvote count: 0
type: Answer
has body: You need to understand that Java properties files are just lists of key/value pairs. How you interpret those values is up to you. So you should expect that properties.getProperty("file1") will give you the string "./File1"... but you can use that as a relative filename very easily: File rootDirectory = ...; // However you get this String relativePath = properties.getProperty("file1"); File file = new File(rootDirectory, relativePath);
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26657476

http://stackoverflow.com/q/26548987
accepted answer: http://stackoverflow.com/a/26962739
answer count: 1
downvote count: 0
favorite count: 0
tagged with: class
tagged with: hsqldb
has title: Hibernate in Eclipse null pointer exception
has answer: http://stackoverflow.com/a/26962739
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has body: I'l working with a Java project that uses HSQLDB (2.3.2) and Hibernate (4.3.6) via Eclipse (Luna) using Java JDK 64 bits 1.8.0.25, I prepared a very small and simple test class that queries the Database. As far as I run the application as a standard java application (that is from command line) everything works fine but when I try to debug or run the application from Eclipse I get an error during the Registry builder initialization (see asterisks): Configuration c1= new Configuration(); c1.configure("/hibernate.cfg.xml"); **serviceRegistry = new StandardServiceRegistryBuilder().applySettings( c1.getProperties()).build();** return c1.buildSessionFactory(serviceRegistry ); The error is: ott 24, 2014 3:29:39 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt; INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} ott 24, 2014 3:29:39 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.6.Final} ott 24, 2014 3:29:39 PM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false} ott 24, 2014 3:29:39 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist ott 24, 2014 3:29:40 PM org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml ott 24, 2014 3:29:40 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml ott 24, 2014 3:29:41 PM org.hibernate.cfg.Configuration addResource INFO: HHH000221: Reading mappings from resource: test/db/generated/MainConfParams.hbm.xml ott 24, 2014 3:29:42 PM org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null Initial SessionFactory creation failed.java.lang.NullPointerException Exception in thread "main" java.lang.ExceptionInInitializerError at test.db.HibernateUtil.bui…
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/43219657
type: AnswerComment
comment on: http://stackoverflow.com/a/26602260
type: Comment
has text: Yes because it was specified in the question: "I need to make sure that it only contains letters A-Z".
score: 0

http://stackoverflow.com/q/26636018
has comment: http://stackoverflow.com/comment/41879605
accepted answer: http://stackoverflow.com/a/26636161
favorite count: 0
has body: I'm new to java and I'm trying to see if the method public String toString() is representing correctly the polynomial function. I don't know how to give the coefficients from main so that the class Func receives them. package ro.utcluj.poo.lab04; import java.util.Scanner; class Func { public double[] coef; //the coefficients public int nrCoef; //coefficients number public Func(double[] input) { nrCoef = input.length; this.coef = new double[nrCoef]; for (int counter = 0; counter &lt; input.length; counter++) coef[counter] = input[counter]; } public double getFuncValue(double x) { double exponent = nrCoef; double y = 0; double sum = 0; for(int i = nrCoef; i &gt;= 0; i--) { y = coef[i]*Math.pow(x, exponent-1); //n grade polynomial function exponent--; sum += y; //the sume for each member } return sum; } public double getDerivValue(double x) { double deriv = 0; double rezDeriv = 0; for(int i = 0; i &lt; nrCoef - 1; i++) { deriv = coef[i]*(nrCoef - i)*Math.pow(x, nrCoef - i -1); rezDeriv += deriv; } return rezDeriv; } public String toString() { String s = new String(" "); int exp = nrCoef-1; for(int i = 0; i &lt; nrCoef; i++) { if(exp == 0 &amp;&amp; coef[i] &gt; 0) s +="+" + coef[i]; else if(exp == 0 &amp;&amp; coef[i] &lt; 0) s +=coef[i]; else if(exp == 1 &amp;&amp; coef[i] &gt; 0 &amp;&amp; i == 0) s +="+" + coef[i] + "x"; else if(exp == 1 &amp;&amp; coef[i] &gt;0) s +="+" + coef[i]; else if(exp == 1 &amp;&amp; coef[i] &lt; 0) s+=coef[i]; else if(coef[i] == 0) s += ""; else if(coef[i] &gt; 0 &amp;&amp; i!=0) s +="+" + coef[i]+"x^" + exp; else s +=coef[i] + "x^" + exp; exp--; System.out.println(s); } return s; } } . public class Main04 { public static void main(String[] args) { double[] v = new double[]{3,5,4}; Func f = new Func(v); } }
answer count: 4
has comment: http://stackoverflow.com/comment/41879701
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41879617
has title: java toString representation
tagged with: java
possible better answer: http://stackoverflow.com/a/26636506
has comment: http://stackoverflow.com/comment/41879492
type: Question
has answer: http://stackoverflow.com/a/26636606
has answer: http://stackoverflow.com/a/26637777
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/26636506
has answer: http://stackoverflow.com/a/26636161

http://stackoverflow.com/comment/41840564
score: 1
has text: i don't know, what tool this is, but it _looks_ like your code works with columns there (or you have some var name abuse going on) and the question is about whole rows. doesn't this boils down to `delete from target; insert into target select * from source` within an transaction?
comment on: http://stackoverflow.com/q/26614446
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41794792
comment on: http://stackoverflow.com/q/26589948
type: Comment
type: QuestionComment
has text: @user56029283888 You don't need to reset `i` because it wont iterate `i` unless `num` is less than 10
score: 0

http://stackoverflow.com/a/26636340
answers question: http://stackoverflow.com/q/26636019
accepted answer of: http://stackoverflow.com/q/26636019
score: 0
type: AcceptedAnswer
has body: As An Sample, suppose x = new int[3][4], x[0], x[1], and x[2] are one-dimensional arrays and each contains four elements, as shown in the figure x.length is 3, and x[0].length, x[1].length, and x[2].length are 4 As you see you need two for loops to go through the array. 1. for traversing the row one by one 2. when you are in each row traversing each column one by one for example:
type: Answer

http://stackoverflow.com/q/26665941
has comment: http://stackoverflow.com/comment/41933856
tagged with: java
has title: Android activity crashes on button click
type: Question
has comment: http://stackoverflow.com/comment/41934040
has comment: http://stackoverflow.com/comment/41933953
answer count: 3
has comment: http://stackoverflow.com/comment/41933756
has answer: http://stackoverflow.com/a/26666149
tagged with: android
has comment: http://stackoverflow.com/comment/41933927
has answer: http://stackoverflow.com/a/26666139
possible better answer: http://stackoverflow.com/a/26666096
has comment: http://stackoverflow.com/comment/41933923
has body: When I click the button to go to the next activity, my app crashes. I don't know if it's an issue with my Game class, Menu class, the game layout or the Manifest. I assume it's the manifest though. I've tried tons of different ways to solve the problem. I changed the name of the intent in the manifest, I changed the way I call the activity in the java class...but nothing worked. Can someone please help? I think there's an issue with the way I'm declaring the activities in the manifest but I am not sure. Here is the code: Menu.java: package com.example.hello_world; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class Menu extends Activity implements OnClickListener { Button clickToStart; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu_activity); clickToStart = (Button) findViewById(R.id.click); clickToStart.setOnClickListener(this); } @Override public void onClick(View v) { Intent openGame = new Intent(getApplicationContext(), Game.class); startActivity(openGame); } } Game.java: package com.example.hello_world; import android.app.Activity; import android.os.Bundle; public class Game extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game_activity); } } Android Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.hello_world" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.example.hello_world.GAME" /> <category android:name="android.intent.category.DEFAULT" /> game …
score: 0
has answer: http://stackoverflow.com/a/26666096
tagged with: android-intent
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26666149

http://stackoverflow.com/q/26631267
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am learning to build android applications and I need some help whit getting data from MySQL. I followed this tutorial to do it but I get this error: Error org.json.JSONEXception: Value of type java.lang.String cannot be converted to JSONObject On my MainActivity I have one button which when is clicked open second activity. The second activity must get and show data from DB. This is the code of second activity Restaurant.java public class Restaurants extends Activity { private String jsonResult; private String url = "http://10.0.2.2/app1/GetRestaurants.php"; private ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.restaurants); listView = (ListView) findViewById(R.id.listView1); accessWebService(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } // Async Task to access the web private class JsonReadTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(params[0]); try { HttpResponse response = httpclient.execute(httppost); jsonResult = inputStreamToString( response.getEntity().getContent()).toString(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } private StringBuilder inputStreamToString(InputStream is) { String rLine = ""; StringBuilder answer = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((rLine = rd.readLine()) != null) { answer.append(rLine); } } catch (IOException e) { // e.printStackTrace(); Toast.makeText(getApplicationContext(), "Error..." + e.toString(), Toast.LENGTH_LONG).show(); } return answer; } @Override protected void onPostExecute(String result…
tagged with: mysql
has answer: http://stackoverflow.com/a/26631424
type: Question
has comment: http://stackoverflow.com/comment/41870755
has title: Error on fetching data from Mysql DB with JSON and PHP
accepted answer: http://stackoverflow.com/a/26631424
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/22709757

http://stackoverflow.com/q/26667803
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26667817
accepted answer: http://stackoverflow.com/a/26667817
has title: Java threads: Running a simple java thread program output confusion
score: 1
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41936957
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41936924
possible better answer: http://stackoverflow.com/a/46695195
has body: class Runner extends Thread{ public void run(){ for(int i=0;i&lt;5;i++) { System.out.println("Counting "+i); } } } public class App { public static void main(String args[]) { Runner runner1=new Runner(); runner1.start(); Runner runner2=new Runner(); runner2.start(); } } I was just going through the basics of threads in java. The expected output is : Counting 0 Counting 0 Counting 1 Counting 1 Counting 2 Counting 2 Counting 3 Counting 3 Counting 4 Counting 4 But am getting an output like this cant seem to reason this out: Counting 0 Counting 1 Counting 2 Counting 3 Counting 4 Counting 0 Counting 1 Counting 2 Counting 3 Counting 4
has comment: http://stackoverflow.com/comment/41937186
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/46695195

http://stackoverflow.com/q/26630451
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41869392
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26630652
accepted answer: http://stackoverflow.com/a/26687076
tagged with: multipartform-data
has answer: http://stackoverflow.com/a/26630652
has answer: http://stackoverflow.com/a/26687076
tagged with: httpurlconnection
favorite count: 0
upvote count: 2
tagged with: android
has title: Android to Php server communicaton using HttpURLConnection
linked to: http://stackoverflow.com/q/26686806
tagged with: php
has body: My project is to upload the image, audio files with some parameter(like description and date). Though Google announced to use HttpURLConnection instead of httpclient. I am using HttpURLConnection. I have an code which upload the image and audio in server folder. But the description which I send is not received in the server. Like this question many in Stackover flow. But I did not get exact solution. My android code is: FileInputStream fileInputStream = new FileInputStream(sourceFile_image); URL url = new URL(upLoadServerUri); conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("Content-Type","multipart/form-data;boundary=" + boundary); conn.setRequestProperty("uploaded_file", fileName); dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(twoHyphens + boundary + lineEnd); //adding parameter String description = ""+"Desceiption about the image"; // Send parameter #name dos.writeBytes("Content-Disposition: form-data; name=\"description\"" + lineEnd); dos.writeBytes("Content-Type: text/plain; charset=UTF-8" + lineEnd); dos.writeBytes("Content-Length: " + description.length() + lineEnd); dos.writeBytes(lineEnd); dos.writeBytes(description + lineEnd); dos.writeBytes(twoHyphens + boundary + lineEnd); // Send #image dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""+ fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); // create a buffer of maximum size bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // read file and write it into form... bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead &gt; 0) { dos.write(buffer, 0, bufferSize)…

http://stackoverflow.com/comment/127264070
type: Comment
has text: android studio does support NDK nowadays, do you mean it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31861738

http://stackoverflow.com/comment/41680923
comment on: http://stackoverflow.com/a/26526853
has text: how can I use this ?!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41837110
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26611302
has text: I think it can be used to influence the score stored in the Lucene document: "Changing Similarity is an easy way to influence scoring, this is done at index-time with IndexWriterConfig.setSimilarity(Similarity)" (from http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/package-summary.html#scoring)
type: AnswerComment

http://stackoverflow.com/a/26576309
type: Answer
upvote count: 1
has body: Your question is too broad . you should narrow down your approach. Split it into modules. Create a servlet to retrieve the userid and the password . Write the Java class to generate the random passwords with the email id you retrieve or you may follow other approaches also to generate random numbers. Send the mail using Java mail (you can configure the mail servers or you could use the existing ones too). Store the random generared values to the database. Once the mail is received at users end .prompt them to enter the code and validate from database .allow the activation process. Hope this helps!!
answers question: http://stackoverflow.com/q/26576225
downvote count: 0
score: 1

http://stackoverflow.com/a/26619862
type: Answer
has comment: http://stackoverflow.com/comment/41850608
has comment: http://stackoverflow.com/comment/41850570
has body: You could do some experiments and graph the amount of input vs the time spent executing the function. Then you could compare it to the well known curves associated with Big-O or try to estimate the equation.
answers question: http://stackoverflow.com/q/26619808
score: 0
has comment: http://stackoverflow.com/comment/41850599

http://stackoverflow.com/q/26565849
has title: App Crashes when replacing Android Fragments, android studio
score: 0
answer count: 1
tagged with: android-studio
has comment: http://stackoverflow.com/comment/41751791
type: UnansweredQuestion
tagged with: android
has body: I am new to android programming and I am trying to write a simple application that switches between two Fragments. I started a new project with a blank activity template that already included a Fragment. I think this could be where I am going wrong, but I am lost. Every time I launch and click the button the app crashes. It throws a must implement OnFragmentInteractionListener error from MyFragment2's onAttach method. If I comment that method out it add's the new Fragment on top of the old one. I have been through just about every tutorial I can find. I do not see where my code is going wrong. I'm sure it is something easy and I am going to feel pretty stupid when I finally figure it out. Any help would be appreciated. Thanks in advance. My main activity: package com.example.misanthropic.fragments; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // matically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } retu…
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/41750953
type: Question
has comment: http://stackoverflow.com/comment/41752610
has answer: http://stackoverflow.com/a/26597256

http://stackoverflow.com/comment/41681745
comment on: http://stackoverflow.com/q/26527369
has text: Because "Hel" and "lo" are constants, so `"Hel" + "lo"` is evaluated *at compile time*, and hence, is *exactly the same* as "Hello"
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41868113
type: QuestionComment
has text: Don't perform query to db at AWT thread. Use SwingWorker for it.
comment on: http://stackoverflow.com/q/26629679
score: 0
type: Comment

http://stackoverflow.com/q/26553623
has answer: http://stackoverflow.com/a/26554036
has answer: http://stackoverflow.com/a/26554034
type: AnsweredQuestion
tagged with: image-gallery
linked to: http://stackoverflow.com/q/21743634
tagged with: java
has title: Pick an random image from photo gallery
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26554034
score: 0
tagged with: random
linked to: http://stackoverflow.com/q/3020478
tagged with: android
has body: I need to randomly select an image from a user's photo gallery. I don't mean starting an intent as in: Intent gallery = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(gallery, GALLERY_PHOTO_REQUEST_CODE);
possible better answer: http://stackoverflow.com/a/26554036

http://stackoverflow.com/q/26558219
tagged with: actionlistener
answer count: 2
possible better answer: http://stackoverflow.com/a/26558523
downvote count: 0
has answer: http://stackoverflow.com/a/26558523
has answer: http://stackoverflow.com/a/26558249
favorite count: 0
has comment: http://stackoverflow.com/comment/41737533
has body: I have read that ActionEvents return the reference of the event object. I want to know how to extract a piece of information out of that reference. I'm sure the answer is out there, I just wasn't sure how to word my question to get it. I have created a new class that extends JButton. I want each button I create to store an integer value for math operations. import javax.swing.JButton; public class NewButton extends JButton { int value; public NewButton(String writing, int value) { this.setText(writing); this.value = value; } public int getValue() { return value; } } I want to use an ActionListener to check for a click then I want to display the int value in the console. Here is my GUI: import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JPanel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class MyGui { public static void main(String[] args) { JFrame frame = new JFrame("GUI"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.add(panel); NewButton button = new NewButton("ten", 10); panel.add(button); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { if(e.getSource() == button) { System.out.println(button.getValue()); } } }; button.addActionListener(listener); frame.setVisible(true); frame.setSize(100,100); } } So this works fine for one button. Now we get to my problem (finally). I want to make another NewButton,button2 . I thought I would change my ActionListener section. I figured I could include one statement for both buttons, since they are of the same class. ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { if(e.getSource() == button1 || e.getSource() == button2) { System.out.println(e.getSource().getValue()); } } }; But this does not work. My reasoning was that since I can check: e.getSource() == button then the reference e.getSource() should give me access to my getValue(). Does …
has title: I want to retrieve values from my JButton extension
tagged with: reference
score: 2
linked to: http://stackoverflow.com/q/21790021
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41737534
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/26558249
tagged with: swing
tagged with: jbutton
type: Question

http://stackoverflow.com/q/26625607
has answer: http://stackoverflow.com/a/26625625
tagged with: java
has body: public class DecreasingCounter { private int value; // instance variable that remembers the value of the counter int valueInitial; public DecreasingCounter(int valueAtStart) { this.value = valueAtStart; } public void reset(){ this.value = 0; } public void setInitial(){ this.valueInitial = 0; } } I need to change the value back to what it was in DecreasingCounter(x); with setInitial(); using an object variable, but I don't know how.
type: Question
accepted answer: http://stackoverflow.com/a/26625625
tagged with: class
has answer: http://stackoverflow.com/a/26626243
possible better answer: http://stackoverflow.com/a/26625702
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26625702
has title: Setting counter value back to initial in class
type: AnsweredQuestion

http://stackoverflow.com/a/26657602
type: Answer
answers question: http://stackoverflow.com/q/26655431
has body: There is no way around it, you have to list all of the application packages you want to "prefer" over the Weblogic default. The best you can hope for is to add a * on the end to capture all of the packages you want at some package level. Are you really using that many packages outside of the Weblogic default? See the Oracle docs: here and here
score: 0

http://stackoverflow.com/comment/41749921
type: Comment
score: 0
type: AnswerComment
has text: He edited the question after the answers were made. You didn't even give people a chance to update their answers. Editing a question doesn't notify people who made answers.
comment on: http://stackoverflow.com/a/26565228

http://stackoverflow.com/q/26614285
has comment: http://stackoverflow.com/comment/41849326
has title: Making line color seperate from points in JFreeChart
type: UnansweredQuestion
has body: This should be a quick question, but I was wondering how I would make the line color different from points in JFreeChart. I'm using an XYLineAndShapeRenderer and I make getItemPaint(int,int) custom to look at a List to determine the color of each point. However when I make it so that all the points are the same color in the beginning, it makes it so that the line is the same color as all the points (Color.GREEN), but I would like it to be blue (Color.BLUE). Thank you in advance. Edit: I noticed now that when I update a single point it change the line before it to be that color, which I don't want. How do I keep the line and point colors seperate?
tagged with: jfreechart
tagged with: java
type: Question
score: 0
linked to: http://stackoverflow.com/q/9843451
answer count: 1
has answer: http://stackoverflow.com/a/26619534

http://stackoverflow.com/a/26611557
answers question: http://stackoverflow.com/q/26611424
upvote count: 3
has body: The official MIME type for Excel file .xls is application/vnd.ms-excel and for .xlsx is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. Also, I would suggest doing response.reset() prior to writing to the output stream and responseOutputStream.flush() (important) prior to closing the response.
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/41702717
has text: I feel this is the right answer to the wrong question, but had to -1 for *"so you can remove the pack() call, or add a preferred size with setPreferredSize() method"* either of which is bad practice.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26535105
type: AnswerComment

http://stackoverflow.com/q/26549832
has answer: http://stackoverflow.com/a/26549879
accepted answer: http://stackoverflow.com/a/26549879
has comment: http://stackoverflow.com/comment/41723457
upvote count: 1
tagged with: swing
type: Question
has title: Create boundingBox for shapes in java - use to select, drag and drop, rotate, translate
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41724495
has comment: http://stackoverflow.com/comment/41724748
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41723253
score: 1
tagged with: awt
has body: I want to create a bounding box in order to select a shape. I have a vector of shapes and a vector of all the points. The objective is to put some shape inside a bounding box, and then I can apply some transformations like move some shape around the canvas, rotate, resize etc. Now I'm focus on the bounding box to select and move some shape. The other transformations are for later. Here is the class, and I know that at least, I need this variables public class BoundingBox { int xmax; int xmin; int ymax; int ymin; public BoundingBox(Vector&lt;Point&gt; points) { } I have other classes implemented, for example, I have a editor panel with this Vector&lt;Shape&gt; shapes; // Current shape that is in construction (if any) Shape currentShape; // shape that is selected, if any Shape selectedShape; A class that implements a shape protected Vector&lt;Point&gt; points; protected boolean isAShapeBeingBuilt; //is any shape being built? protected boolean selected; //is any shape selected? protected ShapesEditorPanel parent; // reference to the panel I can´t put all the code here, obviously, but I hope that with this information some can help me. The main problem is how to select and move some shape inside a box!
favorite count: 0

http://stackoverflow.com/comment/63973551
has text: @GarretWilson If I gave the impression "we're tired of adding things" then that was mistaken. There was a whole list of potential methods on functional interfaces that we considered adding. There was a deliberate judgment call in a team discussion that adding them didn't produce enough benefit to justify the effort. The tradeoffs are clearer with things like `CharStream`; the amount of almost-duplicate code that would be required considerably outweighs the amount of use it (and other primitive streams) would get.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26553481
type: AnswerComment

http://stackoverflow.com/q/26665530
has comment: http://stackoverflow.com/comment/41932870
downvote count: 5
tagged with: overloading
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
possible better answer: http://stackoverflow.com/a/26665558
has answer: http://stackoverflow.com/a/26665558
has answer: http://stackoverflow.com/a/26665548
accepted answer: http://stackoverflow.com/a/26665548
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/26665613
has title: Calling an overloaded method
has body: how is it to make an overloaded method do the same plus their new functionality? Without copying the same code again. Something like this: void method(){ //code 1 } void method(String s){ //code 1 //code 2 }
has comment: http://stackoverflow.com/comment/41932862
favorite count: 0

http://stackoverflow.com/q/26656439
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26664459
type: Question
has comment: http://stackoverflow.com/comment/41915990
has comment: http://stackoverflow.com/comment/41918684
upvote count: 2
has comment: http://stackoverflow.com/comment/41915297
has title: how to identify class by json attribute name using GSON
answer count: 1
linked to: http://stackoverflow.com/q/6014674
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: UnansweredQuestion
has body: I have following json: { "list": [ { "BaseClass": { "id": 0 } }, { "ExtendedClass1": { "id": 1, "sum": 100 } }, { "ExtendedClass1_1": { "id": 2, "sum": 200, "expr": "text" } }, { "ExtendedClass2": { "id": 3, "total": 300 } } ] } Also I have following classes with declared inheritance: MetaClass.java import java.util.ArrayList; import com.google.gson.Gson; public class MetaClass{ public ArrayList&lt;BaseClass&gt; list = new ArrayList&lt;BaseClass&gt;(); public static void main(String[] args) { String json = "{\"list\":[{\"BaseClass\":{\"id\":0}},{\"ExtendedClass1\":{\"id\":1,\"sum\":100}},{\"ExtendedClass1_1\":{\"id\":2,\"sum\":200,\"expr\":\"text\"}},{\"ExtendedClass2\":{\"id\":3,\"total\":300}}]}"; MetaClass gson = new Gson().fromJson(json, MetaClass.class); } } BaseClass.java public class BaseClass{ public int id; public BaseClass() { } } ExtendedClass1.java public class ExtendedClass1 extends BaseClass{ public ExtendedClass1() { } public int sum; } ExtendedClass2.java public class ExtendedClass2 extends BaseClass { public ExtendedClass2() { } public int total; } ExtendedClass1_1.java public class ExtendedClass1_1 extends ExtendedClass1 { public ExtendedClass1_1() { } public String expr; } Also, there could be a lot of such classes with multilevel inheritance. I try to make this example simpler. How correctly parse mentioned json string? Assume please that I could not change input json, only I can change classes and write custom fromJson command somehow... EDIT: Of course, I can add to BaseClass.java all attributes that could be met in json (see below), but it seems not elegant solution. public ExtendedClass1 ExtendedClass1; public ExtendedClass2 ExtendedClass2; public ExtendedClass1_1 ExtendedClass1_1;

http://stackoverflow.com/a/26654232
type: Answer
answers question: http://stackoverflow.com/q/26654214
score: 1
upvote count: 1
downvote count: 0
has body: Change this while (index &gt;= primecalc;) to while (index &gt;= primecalc)

http://stackoverflow.com/comment/41763476
has text: I do not know how to do this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26572261

http://stackoverflow.com/comment/41837451
comment on: http://stackoverflow.com/q/26611188
has text: @TejeshYadav - Then I'd say you use https as protocol and transfer your sensitive information via POST, not GET. Then the information passed gets wrapped in the request body, instead of being passed over in the URL. And the whole request is secured by using the https protocol.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26668580
score: 0
has body: You should use for each function like public int getArraylistsum(ArrayList&lt;Integer&gt; row1){ int sum = 0; for(int i:row1){ sum += i; } return sum; }
type: Answer
answers question: http://stackoverflow.com/q/26667988

http://stackoverflow.com/q/26576718
has answer: http://stackoverflow.com/a/27168031
tagged with: java
tagged with: multithreading
has title: What determines number of simultaneous connections
type: Question
tagged with: performance
answer count: 6
score: 22
tagged with: servlets
has answer: http://stackoverflow.com/a/27263030
upvote count: 22
has answer: http://stackoverflow.com/a/27168458
has answer: http://stackoverflow.com/a/27179394
has body: In a Java servlet environment, what are the factors that are the bottleneck for number of simultaneous users. Number of HTTP connections the server can allow per port Number of HTTP connections the server can allow across several ports (I can have multiple WAS profiles on several HTTP ports) Number of servlets in pool Number of threads configured for WAS to use to service connections RAM available to server (is there any any correletation between number of service threads assuming 0-memory leak in application) Are there any other factors? Edited: To leave business logic out of the picture, assume have only one servlet printing one line on Log4j. Can my Tomcat server handle 6000 simultaneous HTTP connections? Why not (file handles? CPU time per request?)? Can I have thread pool size as 5000 (do idle threads cost CPU/RAM)? Can I have oracle connection pool size as 500 connections (do idle connections cost CPU/RAM)? Is the amount of garbage that is generated for each connection have an impact? For example, if for each HTTP connection 20KB of objects are created and left behind by Tomcat.. then by the time 2500 requests are processed 100MB heap would be used and this may trigger a GC pause of 300ms. Can we say something like this: if Tomcat uses 0.2 sec of CPU time for processing a single HTTP request, then it would be able to handle roughly 500 http connections in a second. So, 6000 connections would need 5 seconds.
downvote count: 0
accepted answer: http://stackoverflow.com/a/27263030
favorite count: 0
linked to: http://stackoverflow.com/q/2332741
has answer: http://stackoverflow.com/a/27168255
has answer: http://stackoverflow.com/a/27167864
possible better answer: http://stackoverflow.com/a/27168031
type: AnsweredQuestion

http://stackoverflow.com/a/26645778
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26645686
has body: Overriding can be possible when you extend a class or implement an interface. i.e., overriding can be applicable when we talk about Interfaces and Inheritance. In your code you are redefining the method that is not overriding. Only inherited methods may be overridden, and remember that private methods are not inherited.

http://stackoverflow.com/comment/41930044
type: AnswerComment
type: Comment
score: 0
has text: @SotiriosDelimanolis Maybe, it's just me, but I feel this is one of the most confusing parts of Java. Wouldn't it make more sense to have the class of the generic type to call on e.g. `R.class.cast()`, making generics a whole lot more useful.
comment on: http://stackoverflow.com/a/26663824

http://stackoverflow.com/q/26519447
has body: I am using Eclipse for Java EE developers, and I am getting this formatting error when pressing CTRL + SHIFT + F: &lt;% String loginError = (String) session.getAttribute("error"); if (loginError != null) { session.removeAttribute("error"); out.print(loginError); } %&gt; The if statement has an extra TAB offset to the right. I want it like this: &lt;% String loginError = (String) session.getAttribute("error"); if (loginError != null) { session.removeAttribute("error"); out.print(loginError); } %&gt; Question: How do I fix this, and make it format like in the example above? Extra info: I am using Eclipse Luna This is happening in a .jsp file, opened with a JSP editor
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: formatting
type: Question
has answer: http://stackoverflow.com/a/26560506
accepted answer: http://stackoverflow.com/a/26560506
has title: Eclipse EE format error
upvote count: 1
answer count: 1
favorite count: 0
tagged with: eclipse-luna

http://stackoverflow.com/q/26549183
type: UnansweredQuestion
has body: Imagine a list of foods. The user searches for a food and is presented with a list of all foods which match this. Example, user search 'apple', program returns 'red apple', 'green apple', etc. for (int i = 0; ; i++) { if (foodNames[i].contains(searchTerm){ foodChoice1 = foodName[i]; break; // then print food name } } How would this be extended to show more than one food name from the list? The code was just mocked up on the spot, likely doesn't work, just to show an example.
has comment: http://stackoverflow.com/comment/41721041
tagged with: java
has answer: http://stackoverflow.com/a/26549275
type: Question
has comment: http://stackoverflow.com/comment/41720937
has comment: http://stackoverflow.com/comment/41721062
has comment: http://stackoverflow.com/comment/41721204
score: 0
has answer: http://stackoverflow.com/a/26549280
answer count: 3
has title: How to present a list of matching strings in string array?
has answer: http://stackoverflow.com/a/26549350

http://stackoverflow.com/comment/41924173
has text: 1. Made sure: https://github.com/dtrunk90/webapp-base/blob/master/base/src/main/java/webapp/base/config/TransactionConfiguration.java#L12 2. I made a template pattern (didn't solved the problem) 3. I want to use Hibernate, not JPA.
score: 0
comment on: http://stackoverflow.com/a/26640603
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41749447
type: QuestionComment
comment on: http://stackoverflow.com/q/26565097
score: 0
has text: Here's the Java tutorial: http://docs.oracle.com/javase/tutorial/. And here's the javadoc: http://docs.oracle.com/javase/7/docs/api/.
type: Comment

http://stackoverflow.com/comment/41829355
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26606542
has text: No such thing, you can always make an MCVE, you are just not trying.
type: Comment

http://stackoverflow.com/q/26611187
has answer: http://stackoverflow.com/a/26612097
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41835316
linked to: http://stackoverflow.com/q/4056140
has title: maven resource filtering not working for lines with @ in it
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/41843196
has comment: http://stackoverflow.com/comment/124174277
tagged with: java
has body: i have a strange case where maven resources plugin does not filter lines with @ in them so if i have this property defined in pom.xml &lt;test-heuser.servername&gt;abcd&lt;/test-heuser.servername&gt; and have this line in one of my resources @(DESCRIPTION=(FAILOVER=ON)(ADDRESS=(HOST=${test-heuser.servername}) the expression is not substituted. I tried removing @ from the line and it works fine. Is this a bug or some form of escape sequence that has come into play. Thanks
type: Question

http://stackoverflow.com/comment/41795467
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26590139
has text: Somehow we have to handle the condition the given number is equal to 10. The question does not make clear what happens in this condition. Can you tell me which behaviour we have to follow in this situation? I personally can not :)
type: AnswerComment

http://stackoverflow.com/q/26554146
has comment: http://stackoverflow.com/comment/41730146
tagged with: java
has comment: http://stackoverflow.com/comment/41756850
has answer: http://stackoverflow.com/a/26554268
has answer: http://stackoverflow.com/a/26554787
possible better answer: http://stackoverflow.com/a/26554240
score: 0
has answer: http://stackoverflow.com/a/26554240
tagged with: this
accepted answer: http://stackoverflow.com/a/26554787
has comment: http://stackoverflow.com/comment/41730231
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26554574
has title: Why would you pass a reference itself?
has comment: http://stackoverflow.com/comment/41730194
type: AnsweredQuestion
tagged with: inner-classes
upvote count: 2
has answer: http://stackoverflow.com/a/26554453
downvote count: 2
has body: I was wondering when and why would an object reference itself. I was reading inner classes using the 'this' keyword and it is a little confusing. A simple example and explanation would be great.
type: Question

http://stackoverflow.com/a/26529597
score: 0
answers question: http://stackoverflow.com/q/26529205
type: Answer
has comment: http://stackoverflow.com/comment/41695973
has body: If you need to declare a large constant, append an 'L' to it which indicates to the compiler that is a long constant. However, as mentioned in another answer you can't declare arrays that large. I suspect the purpose of the exercise is to learn how to use the java.nio.Buffer family of classes.

http://stackoverflow.com/a/48896309
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26531846
has body: Well for someone with the same problem. It happened to me also. And the answer is: Did you check that your class is not inside the /src/test/java folder? Maven only copies classes to the jar whose are inside the folder /src/main/java. I know it is weird but it happens when you want to pack a Selenium automated test. the solution of course is to move your class to /src/main/java Hope it helps
upvote count: 2
has comment: http://stackoverflow.com/comment/89600526

http://stackoverflow.com/comment/41709099
score: 0
comment on: http://stackoverflow.com/q/26536091
type: Comment
type: QuestionComment
has text: Is RabbitMQ server on localhost up and running? In addition, it looks like you are using default guest:guest credentials which are banned (see question looks similar to this one: http://stackoverflow.com/questions/22850546/cant-access-rabbitmq-web-management-interface-after-fresh-install, can you access with the same guest credentials web management interface)?

http://stackoverflow.com/comment/41764319
comment on: http://stackoverflow.com/q/26571035
score: 0
type: QuestionComment
has text: Christian, It just refers to the factory class,
type: Comment

http://stackoverflow.com/comment/41803714
comment on: http://stackoverflow.com/a/26593911
type: AnswerComment
has text: only with third party libs but I dont know if such exists.
score: 0
type: Comment

http://stackoverflow.com/q/26605791
favorite count: 0
has body: I login one web application through url,after I wanted to jump one jsp or servlet through url. how I directly go 2nd jsp page through url
has comment: http://stackoverflow.com/comment/41824259
has comment: http://stackoverflow.com/comment/41824343
score: -3
downvote count: 4
type: AnsweredQuestion
tagged with: java
has title: How to hit two servlet in url in java
has comment: http://stackoverflow.com/comment/41824389
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41824330
has answer: http://stackoverflow.com/a/26606159
accepted answer: http://stackoverflow.com/a/26606159
has answer: http://stackoverflow.com/a/26606316
has comment: http://stackoverflow.com/comment/41824933
possible better answer: http://stackoverflow.com/a/26606027
upvote count: 1
has answer: http://stackoverflow.com/a/26606479
has answer: http://stackoverflow.com/a/26606027
answer count: 4

http://stackoverflow.com/a/26619151
type: Answer
has body: int x parameter will always be overrided by for(x = 1... So this can be right. BTW, to verify your method, create unit tests: import static org.junit.Assert.assertEquals; import org.junit.Test; class Part3Test { public static void testFactorial() { assertEquals(Part3.factorial(1, 1, 1), 1); assertEquals(Part3.factorial(2, 1, 1), 2); } }
answers question: http://stackoverflow.com/q/26618961
score: 0

http://stackoverflow.com/a/26540129
upvote count: 2
has body: Is there any reason why there are no parser generators that consume straight BNF? No, but most parser generators started out trying to do everything. It took the community a long time to figure out that sometimes less is more. Tools that consume (some variation) of BNF have been around for a long time. A paper describing MetaII was published back in 1963. MetaII's baseline BNF is what you expect (lefthandside plus right hand side) plus a number of now relatively standard EBNF extensions (Kleene Star and Plus, Groupting, alternatives) and non-standard embedded actions (used to generate literally syntax-directed translation output). It assumes built-in token lexers. MetaII can meta-compile its own grammar to reproduce itself exactly [the paper shows this and it is mind-blowing moment when you grok why this works], thus enabling bootstrapping to more sophisticated versions. and to compile other simple languages. A common easy extension is defining grammar rules for lexical tokens. I built a variety of implementations, and tools that used this, back in the 1970s because it was so cool and so useful. Tree Meta added actions for building trees, and an auxiliary grammar for pattern matching trees to generate output. When you add in all the extra EBNF and generation stuff, the resulting "BNF" for both MetaII and Tree Meta can be fairly hard for the uninitiated to read, mostly because it is dense and you have to be familiar with context. Otherwise it looks like the output of a chain printer (for those of you old to know what this is) that broke. Most modern compiler-compilers aren't much different. YACC has extended BNF with embedded (your favorite language) code to do actions, usually used to build trees. JavaCC uses an extended BNF; with JJTree you can build ASTs. ANTLR 1/2/3 also has an extended BNF, with embedded actions for building trees. That makes them just as, er, ugly as MetaII... no progress in 40 years IMHO. Our DMS Software Reengineering Toolkit (see my bio) use…
type: Answer
answers question: http://stackoverflow.com/q/26537890
score: 2
downvote count: 0

http://stackoverflow.com/a/26596612
has comment: http://stackoverflow.com/comment/41823095
has comment: http://stackoverflow.com/comment/42674988
has comment: http://stackoverflow.com/comment/41987804
has comment: http://stackoverflow.com/comment/41987796
has comment: http://stackoverflow.com/comment/42157038
has comment: http://stackoverflow.com/comment/42135788
has comment: http://stackoverflow.com/comment/41807757
score: 0
has body: Add a default empty constructor in class HelloAccessoryProviderConnection See the accepted answer for this question. Exactly same problem is happening with you intentservice no empty constructor, but there is a constructor Because your class is inside another class you might have to change the modifier. Go through the question for better understanding.
has comment: http://stackoverflow.com/comment/41807941
has comment: http://stackoverflow.com/comment/42118259
type: Answer
has comment: http://stackoverflow.com/comment/42069686
has comment: http://stackoverflow.com/comment/41810303
has comment: http://stackoverflow.com/comment/41822902
has comment: http://stackoverflow.com/comment/42071404
answers question: http://stackoverflow.com/q/26596580

audio
tags question: http://stackoverflow.com/q/26613324
tags question: http://stackoverflow.com/q/26667642
tags question: http://stackoverflow.com/q/26579188
tags question: http://stackoverflow.com/q/26550514
tags question: http://stackoverflow.com/q/26538718
tags question: http://stackoverflow.com/q/26519845
tags question: http://stackoverflow.com/q/26574788
tags question: http://stackoverflow.com/q/26515724
tags question: http://stackoverflow.com/q/26611780
tags question: http://stackoverflow.com/q/26546931
type: Tag
tags question: http://stackoverflow.com/q/26670001
tag name: audio
tags question: http://stackoverflow.com/q/26598753
tags question: http://stackoverflow.com/q/26636642
tags question: http://stackoverflow.com/q/26574326
tags question: http://stackoverflow.com/q/26618446
tags question: http://stackoverflow.com/q/26615104
tags question: http://stackoverflow.com/q/26616571
tags question: http://stackoverflow.com/q/26554530

http://stackoverflow.com/q/26591896
has comment: http://stackoverflow.com/comment/41799426
has comment: http://stackoverflow.com/comment/41801097
has comment: http://stackoverflow.com/comment/41799589
has comment: http://stackoverflow.com/comment/41799510
score: 0
has comment: http://stackoverflow.com/comment/41800019
has title: Hibernate - byNaturalId not working
has comment: http://stackoverflow.com/comment/41799529
has body: I have a user entity identified by two natural ids, something like @Entity @Table(name = "user", uniqueConstraints = { @UniqueConstraint(columnNames = "email"), @UniqueConstraint(columnNames = "nick") }) public User() {} @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) private id; @Column(name = "email", unique = true, nullable = false, length = 31) @NaturalId(mutable = true) private String email; @Column(name = "nick", unique = true, nullable = false, length = 31) @NaturalId(mutable = false) private String nick; However, when I try to execute session.byNaturalId(User.class).with(LockOptions.READ).using("email", "admin@mail.com").load(); it throws an exception org.hibernate.HibernateException: Entity [pervasive.com.gmail.tigerjack89.forum.shared.model.entities.User] defines its natural-id with 2 properties but only 1 were specified at org.hibernate.event.spi.ResolveNaturalIdEvent.&lt;init&gt;(ResolveNaturalIdEvent.java:75) at org.hibernate.event.spi.ResolveNaturalIdEvent.&lt;init&gt;(ResolveNaturalIdEvent.java:52) at org.hibernate.internal.SessionImpl$BaseNaturalIdLoadAccessImpl.resolveNaturalId(SessionImpl.java:2607) at org.hibernate.internal.SessionImpl$NaturalIdLoadAccessImpl.load(SessionImpl.java:2722) at pervasive.com.gmail.tigerjack89.forum.server.model.orm.StorageManager.getByNaturalId(StorageManager.java:217) at pervasive.com.gmail.tigerjack89.test.local.MyHibernateTest.test1(MyHibernateTest.java:37) at pervasive.com.gmail.tigerjack89.test.local.MyHibernateTest.main(MyHibernateTest.java:23) Why is this? I think it's also due to the log of the SQL syntax generated by Hibernate. Indeed, it is strange (redundant) at this point and I think it's the cause of the exception Hibernate: alter table user add constraint UK_t8tbwelrnviudxdaggwr1kd9b unique (email, nick) Hibernate: alter table user add constraint UK_ob8kqyqqgmefl0aco34akdtpe unique (email) Hibernate: alter table user add constraint UK_pvnbxcfihb58o5n2n1fnc7fh…
has comment: http://stackoverflow.com/comment/41799451
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49070410
has comment: http://stackoverflow.com/comment/41800973
has comment: http://stackoverflow.com/comment/41801845
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26594620
has comment: http://stackoverflow.com/comment/43431056
has comment: http://stackoverflow.com/comment/41801188
type: Question
answer count: 2

http://stackoverflow.com/q/26645186
has comment: http://stackoverflow.com/comment/41896325
accepted answer: http://stackoverflow.com/a/60991017
tagged with: java
has comment: http://stackoverflow.com/comment/42013730
has title: java SocketPermission only works in eclipse not in tomcat server
type: Question
has comment: http://stackoverflow.com/comment/41899465
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/60991017
answer count: 1
has body: In our application have to call external web service.We enabled java security manager to our project. This is how we grant the permission to call the web service, permission java.net.SocketPermission "servername:80", "connect, resolve"; it's work perfectly on eclipse IDE.but when we deployed it into tomcat server , no responed. Any ideas? Please help.
type: AnsweredQuestion

http://stackoverflow.com/comment/41783862
comment on: http://stackoverflow.com/q/26583586
score: 0
type: Comment
type: QuestionComment
has text: Concentrate on First one,When I open A file then Click on Rollback It performs roolback.But,When add/remove/change text only rollback/redo.Please check it.

http://stackoverflow.com/comment/41813832
score: 0
type: Comment
type: QuestionComment
has text: I get the strong feeling this is homework. So instead I will give a good hint. `(int) (Math.log(number) / Math.log(10));` - this will give you the number of digits you need to look at. Also write a method that does the sum for a digit. You will also need at least 1 loop in your program.
comment on: http://stackoverflow.com/q/26599609

http://stackoverflow.com/comment/41675063
type: Comment
score: 1
type: AnswerComment
has text: print(" " +((i%7)+1))
comment on: http://stackoverflow.com/a/26523325

javascript
tags question: http://stackoverflow.com/q/26630767
tags question: http://stackoverflow.com/q/26551489
tags question: http://stackoverflow.com/q/26670748
tags question: http://stackoverflow.com/q/26595872
tags question: http://stackoverflow.com/q/26614832
tags question: http://stackoverflow.com/q/26535609
tags question: http://stackoverflow.com/q/26584939
tags question: http://stackoverflow.com/q/26601372
tags question: http://stackoverflow.com/q/26671281
tags question: http://stackoverflow.com/q/26637206
tags question: http://stackoverflow.com/q/26548041
tags question: http://stackoverflow.com/q/26576225
tags question: http://stackoverflow.com/q/26547184
tags question: http://stackoverflow.com/q/26578228
tags question: http://stackoverflow.com/q/26599728
tag name: javascript
tags question: http://stackoverflow.com/q/26540897
tags question: http://stackoverflow.com/q/26573468
tags question: http://stackoverflow.com/q/26525554
tags question: http://stackoverflow.com/q/26644903
tags question: http://stackoverflow.com/q/26606234
tags question: http://stackoverflow.com/q/26634412
tags question: http://stackoverflow.com/q/26672189
tags question: http://stackoverflow.com/q/26534031
tags question: http://stackoverflow.com/q/26604179
tags question: http://stackoverflow.com/q/26549608
tags question: http://stackoverflow.com/q/26534578
tags question: http://stackoverflow.com/q/26631515
tags question: http://stackoverflow.com/q/26538976
tags question: http://stackoverflow.com/q/26542926
tags question: http://stackoverflow.com/q/26591359
tags question: http://stackoverflow.com/q/26623936
tags question: http://stackoverflow.com/q/26609207
type: Tag
tags question: http://stackoverflow.com/q/26543014
tags question: http://stackoverflow.com/q/26520900
tags question: http://stackoverflow.com/q/26658194
tags question: http://stackoverflow.com/q/26597232
tags question: http://stackoverflow.com/q/26525180
tags question: http://stackoverflow.com/q/26531500
tags question: http://stackoverflow.com/q/26651638
tags question: http://stackoverflow.com/q/26540524
tags question: http://stackoverflow.com/q/26654803
tags question: http://stackoverflow.com/q/26623353
tags question: http://stackoverflow.com/q/26536128
tags question: http://stackoverflow.com/q/26561292
tags question: http://stackoverflow.com/q/26524067
tags question: http://stackoverflow.com/q/26546715
tags question: http://stackoverflow.com/q/26541550
tags question: http://stackoverflow.com/q/26580442
tags question: http://stackoverflow.com/q/26584836
tags question: http://stackoverflow.com/q/26610350
tags question: http://stackoverflow.com/q/26525136
tags question: http://stackoverflow.com/q/26546565
tags question: http://stackoverflow.com/q/26601454
tags question: http://stackoverflow.com/q/26522739
tags question: http://stackoverflow.com/q/26562212
tags question: http://stackoverflow.com/q/26549313
tags question: http://stackoverflow.com/q/26545383
tags question: http://stackoverflow.com/q/26614368
tags question: http://stackoverflow.com/q/26599763
tags question: http://stackoverflow.com/q/26601841
tags question: http://stackoverflow.com/q/26612657
tags question: http://stackoverflow.com/q/26654487

http://stackoverflow.com/comment/41660365
type: Comment
type: QuestionComment
score: 2
has text: That sounds like a bug to me, you might want to consider filing it with oracle
comment on: http://stackoverflow.com/q/26515016

http://stackoverflow.com/comment/41799253
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26592033
score: 0
has text: @tnw Yep fixed it now. Thanks. Solved

http://stackoverflow.com/comment/41659049
comment on: http://stackoverflow.com/q/26514318
has text: Found this though you might find something usefull here: http://stackoverflow.com/questions/22057731/why-is-my-jframe-just-a-black-window
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26639667
type: AnsweredQuestion
tagged with: java
has body: How to draw a line in java if I pass inputs like (1,1) (2,2) (3,3). And the number of points may vary like (1,1) (2,2). Really having trouble getting this to work correctly. See my code below import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.swing.*; @SuppressWarnings("serial") public class DrawGraph extends JPanel { private static final int MAX_SCORE = 20; private static final int PREF_W = 800; private static final int PREF_H = 650; private static final int BORDER_GAP = 30; private static final Color GRAPH_COLOR = Color.green; private static final Color GRAPH_POINT_COLOR = new Color(150, 50, 50, 180); private static final Stroke GRAPH_STROKE = new BasicStroke(3f); private static final int GRAPH_POINT_WIDTH = 12; private static final int Y_HATCH_CNT = 10; private List&lt;Integer&gt; scores; public DrawGraph(List&lt;Integer&gt; scores) { this.scores = scores; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double xScale = ((double) getWidth() - 2 * BORDER_GAP) / (scores.size() - 1); double yScale = ((double) getHeight() - 2 * BORDER_GAP) / (MAX_SCORE - 1); String s ="(220 616) (220 666) (251 670) (272 647)"; String[] arr = s.split("\\)\\s*"); List&lt;Point&gt; graphPoints = new ArrayList&lt;Point&gt;(); for (String anArr : arr){ int x = Integer.parseInt(anArr.substring(1,anArr.indexOf(" "))); int y = Integer.parseInt(anArr.substring(anArr.indexOf(" ") + 1, anArr.length())); Point p = new Point(x,y); graphPoints.add(p); } for (int i = 0; i &lt; graphPoints.size() - 1; i++) { int x1 = graphPoints.get(i).x; int y1 = graphPoints.get(i).y; int x2 = graphPoints.get(i + 1).x; i…
type: Question
has comment: http://stackoverflow.com/comment/41888607
has answer: http://stackoverflow.com/a/26639786
score: 2
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26639786
has title: Java input coordinates and draw lines
has comment: http://stackoverflow.com/comment/41886678

http://stackoverflow.com/a/26527612
score: 2
has body: aSimply add it as dependency in mailing pom.xml my.com.parent.partner admin
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41682601
answers question: http://stackoverflow.com/q/26527560
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26527560

http://stackoverflow.com/comment/41918816
score: 1
has text: post some sample code and what you are trying to do. A little bit of context would help
comment on: http://stackoverflow.com/q/26658230
type: Comment
type: QuestionComment

http://stackoverflow.com/a/63303282
has body: public <T> void bulkUpdate(String collectionName, List<T> documents, Class<T> tClass) { BulkOperations bulkOps = mongoTemplate.bulkOps(BulkOperations.BulkMode.UNORDERED, tClass, collectionName); for (T document : documents) { Document doc = new Document(); mongoTemplate.getConverter().write(document, doc); org.springframework.data.mongodb.core.query.Query query = new org.springframework .data.mongodb.core.query.Query(Criteria.where(UNDERSCORE_ID).is(doc.get(UNDERSCORE_ID))); Document updateDoc = new Document(); updateDoc.append("$set", doc); Update update = Update.fromDocument(updateDoc, UNDERSCORE_ID); bulkOps.upsert(query, update); } bulkOps.execute(); } Spring Mongo template is used to perform the update. The above code will work if you provide the _id field in the list of documents.
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/26657055
downvote count: 0

http://stackoverflow.com/q/26514345
tagged with: java
type: Question
tagged with: arrays
has title: I keep getting the error of not finding a symbol what am i doing wrong?
score: 0
answer count: 2
has body: We have to use an array of 10 double integers in order to get a average of those ten user entered numbers. AverageArray.java:35: error: cannot find symbol double average = average(array[].class); import java.util.Scanner; public class AverageArray { public static int average(int[] array) { int sum = 0; int avg = 0; for (int i = 0; i&lt; array.length; i++) { sum += array[i]; } avg = sum / array.length; return avg; } public static double average(double[] array) { double sum = 0; double avg = 0; for (int i = 0; i&lt; array.length; i++) { sum += array[i]; } avg = sum / array.length; return avg; } public static void main(String[] Args) { Scanner input = new Scanner(System.in); double average = average(array[].class); System.out.println("Enter 10 double values: "); double[] array = new double[10]; for (int i=0; i&lt;10; i++) { array[i] = input.nextDouble(); } System.out.println(average); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26514403
has answer: http://stackoverflow.com/a/26514398

clone
tags question: http://stackoverflow.com/q/26524042
tags question: http://stackoverflow.com/q/26548991
tags question: http://stackoverflow.com/q/26545014
tags question: http://stackoverflow.com/q/26646089
tags question: http://stackoverflow.com/q/26532871
tags question: http://stackoverflow.com/q/26564016
tags question: http://stackoverflow.com/q/26544738
tag name: clone
tags question: http://stackoverflow.com/q/26578517
type: Tag

http://stackoverflow.com/comment/41766053
score: 0
has text: Did you actually sign your certificate with a CA? My guess is no. Another guess is that you will actually need to sign the certificate with a CA to get the "Certification path".
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26573713

http://stackoverflow.com/comment/41832750
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26608383
has text: Could you show `login.jsp` ? (I assume there is one since you use custom parameter names)
score: 0

http://stackoverflow.com/comment/41782830
comment on: http://stackoverflow.com/q/26582575
has text: @Sridevi - With so little detail, we cannot even suggest anything..
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41928100
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26646126
has text: I found that, this method do not work with self-defined object like ArrayList<Word>, ArrayList<People>, how come?
type: Comment

http://stackoverflow.com/a/26618776
downvote count: 0
type: Answer
has body: I assume you are trying to return a String containing all the fibonaci numbers you found? If you are, change the following: StringBuilder returnValue = new new StringBuilder() Add the following to your 2nd loop returnValue.append(result[i3]).append(","); Change the return value to: return returnValue.toString(); This should solve it (With an extra ',' in the end)
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26618677
answers question: http://stackoverflow.com/q/26618677
has comment: http://stackoverflow.com/comment/41881295
type: AcceptedAnswer

http://stackoverflow.com/comment/41751041
score: 1
has text: @user3261339 The loop starts with the knowledge that there is at least one element. (`if` on the first line checks that). This is the element (at index zero) that we designate the "best". Variable `best` stores the index of the best element so far. At each iteration the loop retrieves the next `cost`, and compares it to the cost at the `best` *position*. If the cost at `i` is better, `i` becomes the new `best`. Once the loop is over, `best` contains the index of the item with the best cost.
type: AnswerComment
comment on: http://stackoverflow.com/a/26540066
type: Comment

http://stackoverflow.com/comment/41684190
score: 0
comment on: http://stackoverflow.com/q/26528518
has text: Do you mean you want to render the image yourself, without using any Swing APIs?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26545814
score: 1
has body: Answer 1: Map tasks for both the Mappers should run parallel provided slots are available. Presence of a single slot may cause them to run in sequence(with possible interleaving), but it's not a normal scenario. If there is some configuration for Mapper sequence I'm not aware of this. Again I doubt that any api is available to identify which Mapper emitted &lt;key, value&gt;. To be precise, just the identification of value is required since same key may be emitted by different Maps. This is usually achieved by adding a prefix tag to the output value and resolving those tags in the reducer. eg : if(value.toString.startsWith("Input#1")){ //processing code } Have a look at this blogpost, it has all the required tips and tricks. Please note that all those examples are using old mapred api. But the logic will be the same in any case. Answer 2: Without MultipleInputs, in the Map you have to identify the filename of an incoming pair using the available Context object. eg : public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String fileName = ((FileSplit) context.getInputSplit()).getPath().getName(); //............ } Then just prepend a suitable tag to output value and rest is same as answer1. Answer 3: This is tricky. Use of DistributedCache for joining boosts performance when the file that's going to be added to the cache is small. This is probably due to the fact that the job now runs with a lesser number of Map tasks. But it affects adversely with the large files. The dilemma is to know how many bytes are considered small for DistributedCache. Since you mentioned that Input #2 file is pretty small, this should be your most suited solution. NB : Many comments of this post are (a little) opinion based. Expecting inputs from experts.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/26538855
type: Answer

http://stackoverflow.com/a/26549939
has comment: http://stackoverflow.com/comment/41723002
downvote count: 0
answers question: http://stackoverflow.com/q/26549663
has body: You should extend the most significant bit to the left. Offhand: short y = (short)((x &amp; 0b10000000000000 ) &gt; 0 ? ( x | 0b1100000000000000 ) : x); That is, if the most significant bit (for a 14 bit number) is 1, then the result of the &amp; is going to be non-zero. If so, add the two additional ones to the left with an or. Otherwise leave as is.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41723108
score: 2
has comment: http://stackoverflow.com/comment/41723442
has comment: http://stackoverflow.com/comment/41723618
has comment: http://stackoverflow.com/comment/41723201
has comment: http://stackoverflow.com/comment/41723419

http://stackoverflow.com/q/26546246
has answer: http://stackoverflow.com/a/26561111
has comment: http://stackoverflow.com/comment/41742779
answer count: 2
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26550242
favorite count: 0
has title: Find path of FIXED length through a 2D array which gives maximum sum
has comment: http://stackoverflow.com/comment/41742642
tagged with: maze
has answer: http://stackoverflow.com/a/26550242
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/26561111
tagged with: path
has comment: http://stackoverflow.com/comment/41743056
has comment: http://stackoverflow.com/comment/41739007
has comment: http://stackoverflow.com/comment/41743100
has comment: http://stackoverflow.com/comment/41715975
type: AnsweredQuestion
upvote count: 2
has body: I have looked through many forum codes which are similar to this question, but I am still unable to solve my question. Basically, given a 2D square array of size n, filled with integers within [-100,100], I have to find the maximum sum, given that the path is of length 10. This is done starting from a certain given grid (denoted by *). It is illegal to visit a same grid twice. A sample test case would be: -55 34 -51 35 1 -76 26 69 61 * 68 98 17 85 81 -27 -69 49 42 83 -10 31 44 75 -41 Would produce a maximum sum of 637. Denoted by the path: 61 69 26 98 17 85 81 83 42 75 If I'm not wrong, the problem with my code is about marking the grids that I have visited before. But I don't know how to solve that.. Below is my code: import java.util.*; class Maze { static int[][] matrix; static int counter = 0; static int size = 0; static int maximum = -100000; static int result = -1000000; static int currMax; static int topMax, downMax, leftMax, rightMax; public static void main(String [] args) { Scanner sc = new Scanner(System.in); size = sc.nextInt(); matrix = new int[size][size]; int xcord = 0; int ycord = 0; for (int i=0; i&lt;size; i++){ for (int j=0; j&lt;size; j++){ if (sc.hasNextInt()){ int util = sc.nextInt(); matrix[i][j] = util; } else{ String utilStr = sc.next(); xcord = i; ycord = j; matrix[i][j] = -2000; } } } result = 2000 + findMax(xcord, ycord); System.out.println(result); } static int findMax(int currx, int curry){ if (counter &gt;= 9){ return matrix[currx][curry]; } else { counter = counter+1; System.out.println("Round: "+counter); System.out.println("currx: "+currx+" curry: "+curry); int temp = matrix[currx][curry]; matrix[currx][curry] = -2000; downMax = -10000; //To reset it for comparison if (currx+1 != size &amp;&amp; matrix[currx+1][curry] == -2000){ downMax = findMax(currx+1,curry); } rightMax = -10000; if (curry+1 != size &amp;&amp; matrix[currx][curry+1] == -2000){ rightMax = findMax(currx,curry+1); } topMax = -10000; if (currx-1 &gt;=0 &amp;&amp; mat…
type: Question
tagged with: recursion
tagged with: java

http://stackoverflow.com/comment/41784322
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26583824
has text: Can you log in to "demo" as root using the MySQL command line tool?

http://stackoverflow.com/a/44767901
upvote count: 5
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26580723
type: Answer
has body: Roc answer is a great help. I would like to add a small block to it: mRecyclerView.scrollToPosition(mAdapter.getItemCount() - 1);

admob
tags question: http://stackoverflow.com/q/26578475
type: Tag
tag name: admob
tags question: http://stackoverflow.com/q/26610383

http://stackoverflow.com/a/40411178
answers question: http://stackoverflow.com/q/26563390
downvote count: 1
score: 3
has body: If you are using SceneBuilder you can set your table's OnMouseClicked to handleRowSelect() method as shown below: MyType temp; Date lastClickTime; @FXML private void handleRowSelect() { MyType row = myTableView.getSelectionModel().getSelectedItem(); if (row == null) return; if(row != temp){ temp = row; lastClickTime = new Date(); } else if(row == temp) { Date now = new Date(); long diff = now.getTime() - lastClickTime.getTime(); if (diff &lt; 300){ //another click registered in 300 millis System.out.println("Edit dialog"); } else { lastClickTime = new Date(); } } }
upvote count: 4
has comment: http://stackoverflow.com/comment/106946247
type: Answer

http://stackoverflow.com/comment/41809907
comment on: http://stackoverflow.com/q/26597634
score: 0
type: Comment
type: QuestionComment
has text: char array[10 20 30] feels very ambiguous can you elaborate more? what is in yourarray[0] ?

debian
tags question: http://stackoverflow.com/q/26650778
type: Tag
tag name: debian

http://stackoverflow.com/a/26654177
score: 2
has body: If you tries to decompile this simple program for(;;){ System.out.println("yes"); } You will get this one as result: do System.out.println("yes"); while(true); I'm using this decompile tool: JAD Java Decompiler (dont work for Java 8+)
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26653968
type: Answer

http://stackoverflow.com/comment/97992996
comment on: http://stackoverflow.com/a/26518093
score: 0
type: Comment
has text: What do you mean by "mutable Integer-like" object?
type: AnswerComment

http://stackoverflow.com/q/26541463
possible better answer: http://stackoverflow.com/a/26541487
tagged with: java
score: -1
downvote count: 1
type: Question
answer count: 2
has title: How to terminate a JFrame after a specific amount of time?
upvote count: 0
tagged with: http://stackoverflow.com/tag/gif
tagged with: awt
favorite count: 0
has body: I want a JFrame to display a gif, which is my loading screen and then automatically terminate. I am OK with either terminating it after a particular time period or after it completes displaying the gif. Is there any way to do this?
tagged with: jframe
has answer: http://stackoverflow.com/a/26541767
has answer: http://stackoverflow.com/a/26541487
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26541767

http://stackoverflow.com/a/26587532
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26587450
has body: You can try in this way. Use TimeUnit.MILLISECONDS.toDays() long duration = appDate.getTime() - currentDate.getTime(); long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration); long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration); long diffInHours = TimeUnit.MILLISECONDS.toHours(duration); long diffInDays = TimeUnit.MILLISECONDS.toDays(duration); // number of days

http://stackoverflow.com/a/26648865
has comment: http://stackoverflow.com/comment/41902197
answers question: http://stackoverflow.com/q/26648836
score: 0
has body: In the above method you have ; after each if statements, where as your second method is correct, which is proper way. if(gw.buttons[line][column].getIcon().equals(gw.red)); &lt;-- That terminates the if there it self. Your line of code equivalent to if(condition) { } Which means the code after the if conditions is dead.
type: Answer
has comment: http://stackoverflow.com/comment/41902438
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41902549

http://stackoverflow.com/q/26658072
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/42054573
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26659625
has comment: http://stackoverflow.com/comment/42023968
has title: JNI - Cannot find native library
has comment: http://stackoverflow.com/comment/42065635
has comment: http://stackoverflow.com/comment/41973423
has answer: http://stackoverflow.com/a/26749172
has body: I have a JNI wrapper for a C++ native library. When I try to load the library in my Java code, I see the following exception: java.lang.UnsatisfiedLinkError: no Foo in java.library.path I load the library like this: System.loadLibrary("Foo"); I set java.library.path as follow: java.library.path = /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib I added -XshowSettings:properties to the JVM options and confirmed that the java.library.path is set as shown above. Here's the library .so on the filesystem: $ l /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/libFoo.so -rwxr-xr-x 1 root wheel 448K 29 Oct 14:23 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/libFoo.so Environment information: java.version = 1.7.0_40 os.arch = x86_64 os.name = Mac OS X os.version = 10.10 So why can't I load the library?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26749172
has answer: http://stackoverflow.com/a/26659625

http://stackoverflow.com/comment/41807556
type: Comment
comment on: http://stackoverflow.com/a/26596205
has text: @Brett You need to use the import statements for them. `import java.util.Date;` and `import java.text.SimpleDateFormat;` Your IDE, if you're using one, will prompt you for the import. Date has several, so you have to explicitly find the `util` version, but SDF is unique.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41889799
has text: should i take out the boolean and void. put them on the top?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26641417

http://stackoverflow.com/comment/41808984
type: QuestionComment
type: Comment
has text: did you define css rule for .visitstatus , the date value in your sample html is belong to visitstatus and you should define the format within this class
comment on: http://stackoverflow.com/q/26597232
score: 0

http://stackoverflow.com/comment/45301844
score: 2
has text: I have nightmares that Java is the last programming language we will ever be allowed to use at work, and that we will be stuck in these linguistic "dark ages" until well after I retire (even as the hordes in the barbarian kingdoms beyond develop less clumsy languages with which to do battle). But yeah, I'm looking for a YAML log4j example, as well. XML is not the most readable stuff - unless you have a specialized tool for a given schema where you don't have to actually view the XML directly, then who cares...
comment on: http://stackoverflow.com/q/26550377
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26669761
answer count: 2
has comment: http://stackoverflow.com/comment/41940442
has comment: http://stackoverflow.com/comment/41940642
has title: read contents from a file to form sql statement in java
has answer: http://stackoverflow.com/a/26670092
score: 0
tagged with: sql
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26670083
has body: I have a file which has contents like: employee firstname lastname dob address ... department departmentname numberofemployees departmenthead ... . . . here the first word of each line is the name of table followed by certain number of fields. What I want is to read the first word of each line and if say the first word is employee then read the fields following this word till the end of the line and form the sql select statement based on these field. I am using below code to read in the lines and see if first word is a particular match but I am unable to proceed ahead to get the desired fields and form the select statements. I want to do this for any arbitrary table name StringBuilder sql = new StringBuilder(); sql.append("select "); File file = new File("abc.txt"); Scanner scanner = new Scanner(file); StringTokenizer st = null; while(scanner.hasNextLine()) String lines = scanner.nextLine(); if(lines.startsWith("employees")) //get the following fields till line ends //functionality here which I am unable to get NOTE: I want to achieve the above goal by the best possible way and not by just using Scanner. If there is some better way to do this then do provide me that.
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41940356
has comment: http://stackoverflow.com/comment/41940245
has comment: http://stackoverflow.com/comment/41940609
type: Question

http://stackoverflow.com/comment/41896865
type: QuestionComment
type: Comment
has text: @RayToal : The object of super-class means object of Parent class having child sub classes.
score: 0
comment on: http://stackoverflow.com/q/26645354

http://stackoverflow.com/comment/41866948
has text: Please see the edits.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26622721
type: Comment

http://stackoverflow.com/comment/41836719
has text: @SotiriosDelimanolis Apparently no. But the method looks a lot like a getter, so one could expect it to return a private member of some sort.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26552067
score: 0

http://stackoverflow.com/comment/41732924
comment on: http://stackoverflow.com/q/26555543
score: 0
type: QuestionComment
type: Comment
has text: @Kroyo. Im doing exactly the same as the answer and facing this problem.

fxml
tags question: http://stackoverflow.com/q/26578991
tags question: http://stackoverflow.com/q/26563347
tags question: http://stackoverflow.com/q/26649429
tags question: http://stackoverflow.com/q/26591327
tag name: fxml
tags question: http://stackoverflow.com/q/26614677
type: Tag
tags question: http://stackoverflow.com/q/26609350

http://stackoverflow.com/q/26646305
favorite count: 0
has body: I am working on am implementation of CountSort for my college class. I made a working code, that works fine for a smaller sized array (25 values), however when I try to run this one with multiple array sizes, an arrayoutofbounds exception is thrown and I'm not quite sure why. It seems to me like the array size shouldn't be of any problems, but any input on what is going on and how to fix it would be greatly appreciated! :) import java.util.*; public class CountSortMore { public static void main(String[] args) { int SIZE = 0; int sizeList[] = {1000, 10000, 100000, 500000, 1000000}; int[] nums = null; for (int sizeI = 0; sizeI &lt; sizeList.length; sizeI++) { SIZE = sizeList[sizeI]; nums = new int[SIZE]; //random num generation up to 100000 for (int i = 0; i &lt; SIZE; i++) nums[i] = (int)(Math.random()*100000); //for (int i = 0; i &lt; SIZE; i++) //{ // System.out.print(nums[i]); // System.out.println(""); //} //call CountSort final long startTime = System.currentTimeMillis(); countSort(nums, 0, SIZE -1); final long endTime = System.currentTimeMillis(); System.out.println("For n = " + SIZE + ", execution time = " + (endTime - startTime) ); //verify sorting //for (int i = 0; i &lt; SIZE; i++) //{ // System.out.print(nums[i]); // System.out.println(""); //} } } public static void countSort(int[] nums, int low, int high) { int[] counts = new int[high - low +1]; for (int x : nums) counts[x - low]++; int current = 0; for (int i = 0; i &lt; counts.length; i++) { Arrays.fill(nums, current, current + counts[i], i + low); current += counts[i]; } } }
has answer: http://stackoverflow.com/a/26646369
possible better answer: http://stackoverflow.com/a/26646523
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26646523
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26646369
tagged with: arrays
has comment: http://stackoverflow.com/comment/41897964
has comment: http://stackoverflow.com/comment/41898143
has comment: http://stackoverflow.com/comment/41898104
answer count: 2
has title: CountSort Array out of index
downvote count: 0
has comment: http://stackoverflow.com/comment/41897992

wso2-api-manager
tags question: http://stackoverflow.com/q/26662948
type: Tag
tag name: wso2-api-manager

gmail
type: Tag
tags question: http://stackoverflow.com/q/26572513
tag name: gmail
tags question: http://stackoverflow.com/q/26585485

http://stackoverflow.com/q/26642884
has body: I've created a complete, runnable example that reproduces the error of not having my list actually sorted by mergesort. What is printed to the console is 22, 22, 22, 1, 1, 1, -2, -2, -2, 1, 22, -2, 1, 22, -2. So it appears that mergesort never affects the second half of the list, and the first half is only sorted because insertSort is successfully called. Any help and suggestions are appreciated. Thank you! package threadedmergesort; import java.util.ArrayList; import java.util.Comparator; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.RecursiveAction; public class ThreadedMergeSort implements Comparator&lt;Integer&gt;{ public static void main(String[] args) { ArrayList&lt;Integer&gt; toSort = new ArrayList&lt;Integer&gt;(); toSort.add(1); toSort.add(22); toSort.add(-2); toSort.add(1); toSort.add(22); toSort.add(-2); toSort.add(1); toSort.add(22); toSort.add(-2); toSort.add(1); toSort.add(22); toSort.add(-2); toSort.add(1); toSort.add(22); toSort.add(-2); toSort.add(1); toSort.add(22); toSort.add(-2); ThreadedMergeSort.sort(toSort, 0, toSort.size()-11); for (Integer e: toSort){ System.out.println(e); } } public static void sort (ArrayList&lt;Integer&gt; inputComp){ sort(inputComp, 0, inputComp.size()-1); } public static void sort (ArrayList&lt;Integer&gt; inputComp, int low, int high){ if (high-low&lt; SIZE_LIMIT){ insertionSort(inputComp, low, high); return; } ArrayList&lt;Integer&gt; temp = new ArrayList(inputComp.size()); pool.invoke(new SortTask(inputComp, temp, low, high)); System.out.println("pool.invoke"); } static class SortTask extends RecursiveAction{ ArrayList&lt;Integer&gt; inputComp; ArrayList&lt;Integer&gt; temp; int low; int high; public SortTask(ArrayList&lt;Integer&gt; inputComp, ArrayList&lt;Integer&gt; temp, int low, int high){ this.inputComp=inputComp; this.temp=temp; this.low=low; this.high=high; } @Override protected void compute(){ if (high-low&lt;SIZE_LIMIT){ insertionSort(inputComp, low, high); return; } int middle = (…
score: 0
answer count: 1
tagged with: mergesort
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41892630
has comment: http://stackoverflow.com/comment/41892477
has comment: http://stackoverflow.com/comment/41892532
has title: java fork/join mergesort updated for easy duplication
tagged with: java
tagged with: fork-join
type: Question
has answer: http://stackoverflow.com/a/26643153
has comment: http://stackoverflow.com/comment/41892736

http://stackoverflow.com/q/26628914
tagged with: swing
type: Question
has body: I am using DJBrowser in my swing application to show a static html page with style sheets. The JWebBrowser instance is added inside the panel and the panel is inside JFrame. The issue is with focus not coming back inside the browser when the browser frame regains the focus. I am using java 6 (jdk 1.6.0_21 to be specific). I have tried the SimpleWebBrowserExample inside the DJProject. After opening the JWebBrowser, the focus/cursor will go inside the browser content e.g. google search text field. When the screen is de-focused by ALT+TAB and refocused using the same keys, focus does not come inside the text field again (Not sure where the focus is going). In my application, after opening the html page in the browser user generally wants to find some words inside the page using CTRL+F option then switch between the application and browser often. But after switching to browser user cannot access CTRL+F option as there is no focus on the native browser. (Unless he/she clicks on the browser by mouse). After reading other similar posts I have tried setting the focus to the native component like - getNativeComponent().requestFocus(), but this did not work. Could someone please help?
has answer: http://stackoverflow.com/a/26712504
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26712504
tagged with: http://stackoverflow.com/tag/html
has title: Focus issues with JWebBrowser when browser window is refocused
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26591171
has comment: http://stackoverflow.com/comment/41797417
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34052578
has answer: http://stackoverflow.com/a/26591670
has title: Java character to String
has comment: http://stackoverflow.com/comment/41797369
has comment: http://stackoverflow.com/comment/41797383
tagged with: java
has comment: http://stackoverflow.com/comment/41797210
linked to: http://stackoverflow.com/q/8172420
type: Question
has comment: http://stackoverflow.com/comment/41797292
score: 0
answer count: 3
tagged with: java-6
has answer: http://stackoverflow.com/a/26591911
has body: I tried multiple versions, including several solutions found here on StackOverflow, but I always get numbers instead of the characters in the console. For a homework in my uni, we need to invert the characters in a string. But creating the new string seems to be not so easy. I tried using a StringBuilder, StringBuilder builder = new StringBuilder(); // ... builder.append(c); // c of type char String concatenation, System.out.print("" + c); // c of type char and even String.valueOf(), System.out.print(String.valueOf(c)); // c of type char and each of them again with explicit conversion to char. But I always get the ordinal number of the characters in a sequence instead of the actual characters as output in the console. How do I correctly build a new string from chars? /** * Praktikum Informatik - IN0002 * Arbeitsblatt 02 - Aufgabe 2.6 (Buchstaben invertieren) */ public class H0206 { public static String readLine() { final StringBuilder builder = new StringBuilder(); try { // Read until a newline character was found. while (true) { int c = System.in.read(); if (c == '\n') break; builder.append(c); } } catch (java.io.IOException e) { ; // We assume that the end of the stream was reached. } return builder.toString(); } public static void main(String[] args) { // Read the first line from the terminal. final String input = readLine(); // Create a lowercase and uppercase version of the line. final String lowercase = input.toLowerCase(); final String uppercase = input.toUpperCase(); // Convert the string on the fly and print it out. for (int i=0; i &lt; input.length(); ++i) { // If the character is the same in the lowercase // version, we'll use the uppercase version instead. char c = input.charAt(i); if (lowercase.charAt(i) == c) c = uppercase.charAt(i); System.out.print(Character.toString(c)); } System.out.println(); } }

http://stackoverflow.com/a/26637257
has comment: http://stackoverflow.com/comment/41882025
has comment: http://stackoverflow.com/comment/41882325
has comment: http://stackoverflow.com/comment/41881899
score: -1
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41882574
has comment: http://stackoverflow.com/comment/41912127
answers question: http://stackoverflow.com/q/26637137
type: Answer
has comment: http://stackoverflow.com/comment/41882516
has body: You should have a look at the ASM library. With the library you can access the bytecode like this: ClassReader cr = new ClassReader("java.lang.Runnable"); ClassNode cn = new ClassNode(); cr.accept(cn, 0); Then you can access the information object based by using the getters of the ClassNode. An event based analysis using visitors is also possible. Note that you can instantiate the ClassReader with an input stream or a byte array instead of the class name as well.

http://stackoverflow.com/comment/41841084
type: Comment
type: QuestionComment
has text: Misleading title. `int` is a primitive type and therefore there is no such thing as `int.parseInt()`. Also I'm curious to know what is the `parseInt()` result for the string "asdasda" for example. Since you don't get any exception.
comment on: http://stackoverflow.com/q/26614809
score: 0

http://stackoverflow.com/a/73231201
has comment: http://stackoverflow.com/comment/129392619
answers question: http://stackoverflow.com/q/26574409
type: Answer
has body: The MongoDb or Jpa will not work for crud function if you are taking id as int or long. Always use string data type for autogenerate variable
score: 0

http://stackoverflow.com/q/26647395
answer count: 1
tagged with: ibatis
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has title: How to use select statement in iterate in IBATIS?
has body: MySQL query is as follow update group_entity set deleted = 1 where entity_id in (select entity_id from entity where entity_row_id in ('1-424g','1-242T') and entity_type='Data'); this query is working in mysql. my Ibatis query with changes is as follow update group_entity set deleted = 1 where entity_id in select entity_id from entity where entity_row_id in #parentIds[]# and entity_type = #parentType# But Ibatis query is not working getting Error ParameterObject or property was not a Collection, Array or Iterator. Error: --- Cause: com.ibatis.sqlmap.client.SqlMapException: ParameterObject or property was not a Collection, Array or Iterator.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: Please tell me how do i use select statement in iterate like Select id from table which returning list of id. My updateDataParameters class updateDataParameters { List<String> parentId; string parentType; // with getter and setter and receptive constructor }
has answer: http://stackoverflow.com/a/26648003
accepted answer: http://stackoverflow.com/a/26648003
score: 0

http://stackoverflow.com/a/26632652
has comment: http://stackoverflow.com/comment/41873276
downvote count: 0
has body: The code looks fine. I suspect it's the visualiser interpreting the two's complement signed values as unsigned (-1 becoming 255, -2 becoming 254 and so on). I write to a wav file and plot it with SonicVisualiser According to WAVE PCM soundfile format: 8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767. It looks like you either need to shift your sine wave up by 128 (so that it fits fully within the 0-255 range), or move to using 16-bit samples.
type: Answer
answers question: http://stackoverflow.com/q/26632480
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/41873409

http://stackoverflow.com/q/26666053
answer count: 1
favorite count: 0
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/41933890
linked to: http://stackoverflow.com/q/3001836
linked to: http://stackoverflow.com/q/3878192
type: AnsweredQuestion
tagged with: biginteger
has body: I am writing an object interface of type BigInteger that accepts ints as parameters. This has worked well so far with one exception which worries me. Is it safe to convert from BigInteger down to int? I know that it is alright to go in the opposite direction, but it seems like there could arise serious problems if the BigInt I am trying to down-convert is larger than int's range. I need to build some functionality into my interface to allow this, however. What is wise here? How should I proceed?
has comment: http://stackoverflow.com/comment/41934018
type: Question
has answer: http://stackoverflow.com/a/26666114
accepted answer: http://stackoverflow.com/a/26666114
score: 1
tagged with: java
tagged with: int
upvote count: 2
has title: Is it wise to convert from BigInteger to int?
downvote count: 1

http://stackoverflow.com/comment/41931993
has text: Now the answer is wrong. :-/ The original logic doesn't require all conditions to be true just to set, say, alpha. (Other answer makes the same mistake.)
type: Comment
comment on: http://stackoverflow.com/a/26665041
score: 0
type: AnswerComment

http://stackoverflow.com/q/26568712
favorite count: 0
has comment: http://stackoverflow.com/comment/41756608
tagged with: terminal
has comment: http://stackoverflow.com/comment/41756528
has title: getting terminal output into java
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: inputstream
type: Question
has answer: http://stackoverflow.com/a/26568773
tagged with: runtime
has comment: http://stackoverflow.com/comment/41756947
tagged with: io
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41756581
has body: I use the following code to get output of terminal command into my java program. check = CharStreams.toString(new InputStreamReader(java.lang.Runtime.getRuntime().exec(command).getInputStream())); when command = "ifconfig" this works fine. but when command = "ldapwhoami -D \"cn=admin,dc=example,dc=com\" -w password", the variable check is empty. When i run the same command in the terminal myself i get the desired output. What am i doing wrong here? please help.

http://stackoverflow.com/comment/41731915
type: Comment
comment on: http://stackoverflow.com/q/26554814
type: QuestionComment
has text: If you are running the entire process on the FX Application Thread, then that is the problem.
score: 0

http://stackoverflow.com/comment/41711026
score: 0
type: QuestionComment
type: Comment
has text: Removed the dots. Guess what!! it's working. Thank you all for your time, appreciate it.
comment on: http://stackoverflow.com/q/26543520

http://stackoverflow.com/comment/41731670
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26554887
has text: Why are you attempting to perform mathematical operations on a generic type? The operations will only work on specific data types.
score: 3

http://stackoverflow.com/comment/41892543
score: 0
type: QuestionComment
has text: I looked in the source code and thats supposed to be the default. Let me add it explicitly and get right back.
comment on: http://stackoverflow.com/q/26642906
type: Comment

http://stackoverflow.com/comment/41881591
type: Comment
has text: @pveentjer - That is not guaranteed to happen on all JVMs. Yes, this will happen on some JVMs but this statement is still, *implementation dependent*. The JVM specification doesn't specify this to be mandatory. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26632972

http://stackoverflow.com/q/26592856
tagged with: java
has comment: http://stackoverflow.com/comment/41800617
has comment: http://stackoverflow.com/comment/41800849
has comment: http://stackoverflow.com/comment/41800639
tagged with: junit
has answer: http://stackoverflow.com/a/26593054
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26593887
has title: Unit testing a class with constructor as the only public method
has comment: http://stackoverflow.com/comment/41800625
has comment: http://stackoverflow.com/comment/41800711
has body: I have a class which is as below: class ToTest { private MemberOne memberOne; private MemberTwo memberTwo; public ToTest(ParamOne paramOne, ParamTwo paramTwo) { setMemberOne(paramOne); setMemberTwo(paramTwo); } private setMemberOne(ParamOne paramOne) { //Build the object. } private setMemberTwo(ParamTwo paramTwo) { //build another object. } } The reason setters are only accessible via constructor is that I do not want to change a object once initialized because there is a dependency between memberOne and memberTwo(an example could be MemberOne represents table header and MemberTwo represent data in table and to keep coding simple and free from constraints checking if the number of columns are equal in header and data set). As a practice I do not write test cases for private methods. What would be a good strategy for writing test cases for this class.
possible better answer: http://stackoverflow.com/a/26592972
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/41800553
type: Question
has answer: http://stackoverflow.com/a/26592972
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26593887

http://stackoverflow.com/q/26649018
type: Question
has comment: http://stackoverflow.com/comment/41949583
tagged with: authorize.net
has answer: http://stackoverflow.com/a/54224138
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42545176
has title: Merchant authentication using JSON request - Authorize.Net
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41937312
has comment: http://stackoverflow.com/comment/41919248
tagged with: ruby-on-rails
tagged with: php
has body: This Doc Click here clearly tells me about the merchant authentication. However they only provide the content type : text/xml. Api end point for it is https://apitest.authorize.net/xml/v1/request.api ( sandbox account ). How can I send a JSON request with name and transaction key as the keys? Also, what is the End Point to which I should send this request for mechant authentication? Official DOC doesn't help. :'( Was hoping you could. DHC or HttpClientRequester doesn't help too. Getting error.
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/26646899
type: Answer
has body: There are several ways you can do this, the simplest being that you define a class field that contains your instance. Another way is to create an abstract factory that creates and caches your instances.
answers question: http://stackoverflow.com/q/26646794
score: 0

http://stackoverflow.com/comment/72931478
has text: surprisingly i started getting this issue when dropped schema expecting hbm2ddl.auto=true will create db and tables. however it failed. but wen i created empty schema hbm2ddl worked creating tables
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29520193
type: Comment

http://stackoverflow.com/comment/41752435
type: Comment
type: QuestionComment
has text: @Radiodef haven't learned those yet. and CandiedOrange I think it's just checking itself, know what I mean?
score: 0
comment on: http://stackoverflow.com/q/26566597

http://stackoverflow.com/comment/41827225
comment on: http://stackoverflow.com/a/26607261
has text: once user submitts the form(submitted data will be sent to email id) , it will redirect to another page which say thank you for submitting.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26575683
has body: The actual value of i will always be bigger or equal to j. What you are seeing in the logs is not the actual (current) value of i and j. It is the value of i and j at the moment they were evaluated. Your linked document states It is possible, however, that any given invocation of method two might observe a value for j that is much greater than the value observed for i, because method one might be executed many times between the moment when method two fetches the value of i and the moment when method two fetches the value of j. Thread t1 runs, increments i and j a bunch of times. Context switch. Thread t2 runs, evaluates i and concatenates it. Context switch. Thread t1 continues incrementing i and j. Context switch. Thread t2 evaluates j and concatenates it. So j is still smaller or equal to i, you just evaluated them at different times.
answers question: http://stackoverflow.com/q/26575623
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26575623
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/41702774
type: QuestionComment
type: Comment
has text: What are you doing? Are you subclassing LineChart and creating a custom chart with multiple axes or are you [using a StackPane to overlay multiple charts on top of each other](http://stackoverflow.com/questions/9667405/how-to-draw-multiple-axis-on-a-chart-using-javafx-charts)? Is this [solution for multiple axes on a chart](http://stackoverflow.com/questions/26303111/move-tick-label-javafx-2) useful (it is a bit of a hack)? I advise to tighten the question up and make it easier for somebody to answer ([mcve](http://stackoverflow.com/help/mcve) or image).
score: 0
comment on: http://stackoverflow.com/q/26538542

arrays
tags question: http://stackoverflow.com/q/26666633
tags question: http://stackoverflow.com/q/26646305
tags question: http://stackoverflow.com/q/26568350
tags question: http://stackoverflow.com/q/26661889
tags question: http://stackoverflow.com/q/26566173
tags question: http://stackoverflow.com/q/26643175
tags question: http://stackoverflow.com/q/26557087
tags question: http://stackoverflow.com/q/26527771
tags question: http://stackoverflow.com/q/26640581
tags question: http://stackoverflow.com/q/26567663
tags question: http://stackoverflow.com/q/26623363
type: Tag
tags question: http://stackoverflow.com/q/26537862
tags question: http://stackoverflow.com/q/26617304
tags question: http://stackoverflow.com/q/26515750
tags question: http://stackoverflow.com/q/26649327
tags question: http://stackoverflow.com/q/26533301
tags question: http://stackoverflow.com/q/26513962
tags question: http://stackoverflow.com/q/26552639
tags question: http://stackoverflow.com/q/26534038
tags question: http://stackoverflow.com/q/26620362
tags question: http://stackoverflow.com/q/26656391
tags question: http://stackoverflow.com/q/26540676
tags question: http://stackoverflow.com/q/26539781
tags question: http://stackoverflow.com/q/26589172
tags question: http://stackoverflow.com/q/26537270
tags question: http://stackoverflow.com/q/26672843
tags question: http://stackoverflow.com/q/26655443
tags question: http://stackoverflow.com/q/26592553
tags question: http://stackoverflow.com/q/26567561
tags question: http://stackoverflow.com/q/26536117
tags question: http://stackoverflow.com/q/26658261
tags question: http://stackoverflow.com/q/26671832
tags question: http://stackoverflow.com/q/26559455
tags question: http://stackoverflow.com/q/26592091
tags question: http://stackoverflow.com/q/26661776
tags question: http://stackoverflow.com/q/26561475
tags question: http://stackoverflow.com/q/26627083
tags question: http://stackoverflow.com/q/26522603
tags question: http://stackoverflow.com/q/26546387
tags question: http://stackoverflow.com/q/26549663
tags question: http://stackoverflow.com/q/26514351
tags question: http://stackoverflow.com/q/26660201
tags question: http://stackoverflow.com/q/26617882
tags question: http://stackoverflow.com/q/26630221
tags question: http://stackoverflow.com/q/26664781
tags question: http://stackoverflow.com/q/26644502
tags question: http://stackoverflow.com/q/26578736
tags question: http://stackoverflow.com/q/26535707
tags question: http://stackoverflow.com/q/26597728
tags question: http://stackoverflow.com/q/26577873
tags question: http://stackoverflow.com/q/26588976
tags question: http://stackoverflow.com/q/26550664
tags question: http://stackoverflow.com/q/26596151
tags question: http://stackoverflow.com/q/26650225
tags question: http://stackoverflow.com/q/26636019
tags question: http://stackoverflow.com/q/26539694
tags question: http://stackoverflow.com/q/26621574
tags question: http://stackoverflow.com/q/26622344
tags question: http://stackoverflow.com/q/26621824
tags question: http://stackoverflow.com/q/26621684
tags question: http://stackoverflow.com/q/26579885
tags question: http://stackoverflow.com/q/26573950
tags question: http://stackoverflow.com/q/26519646
tags question: http://stackoverflow.com/q/26617160
tags question: http://stackoverflow.com/q/26575955
tags question: http://stackoverflow.com/q/26641794
tags question: http://stackoverflow.com/q/26548598
tags question: http://stackoverflow.com/q/26622294
tags question: http://stackoverflow.com/q/26546715
tags question: http://stackoverflow.com/q/26669864
tags question: http://stackoverflow.com/q/26624942
tags question: http://stackoverflow.com/q/26539675
tags question: http://stackoverflow.com/q/26533490
tags question: http://stackoverflow.com/q/26638989
tags question: http://stackoverflow.com/q/26592391
tags question: http://stackoverflow.com/q/26587550
tags question: http://stackoverflow.com/q/26540772
tags question: http://stackoverflow.com/q/26634418
tags question: http://stackoverflow.com/q/26662624

http://stackoverflow.com/a/26619443
score: 0
has body: Try the following. You dont need var1 public static void main(String[] args) { // TODO Auto-generated method stub Scanner user = new Scanner(System.in); System.out.println("Welcome to the Fortune Telling program.\n"); //Welcome message System.out.print("Would you like me to tell your fortune? Type 1 for yes and any other number for no: "); int Var0 = 0; while(Var0 != -1) { System.out.print("Enter a number 1-8 and I will tell your fortune or -1 to quit "); //ask for number between 1-8 to find fortune or invalid Var0 = user.nextInt(); switch (Var0) { case 1: //case 1-8 fortunes System.out.println("\nYou will become great if you believe in yourself."); break; case 2: System.out.println("\nSerious trouble with bypass you."); break; case 3: System.out.println("\nYou will travel to many exotic places in your lifetime."); break; case 4: System.out.println("\nYour ability for accomplishment will follow with success."); break; case 5: System.out.println("\nWhen fear hurts you, conquer it and defeat it!"); break; case 6: System.out.println("\nYou will be called in to fulfill a position of higher honor and responsibility."); break; case 7: System.out.println("\nYour golden opportunity is coming shortly."); break; case 8: System.out.println("\nIntegrity is doing the right thing, even when nobody is watching."); break; default: System.out.print("That's not a valid number. Try again.\n"); //invalid number try to rerun for correct response } } System.out.print("Thank you for trying the fortune telling program.");//Thank you message user.close(); } Enclose the code in a try catch block just make sure you will capture any exception that may occur while using the scanner. close the scanner in a the finally block or even better if you are using java 1.7 and above use try-with-resources.
type: Answer
answers question: http://stackoverflow.com/q/26619146

http://stackoverflow.com/comment/42125830
type: Comment
has text: @Sleeper9 Ah yes, good point (regarding truncate month). If you feel there is a good use case for this, raise an issue in the Commons Jira.
comment on: http://stackoverflow.com/a/26682511
score: 0
type: AnswerComment

http://stackoverflow.com/a/26601649
answers question: http://stackoverflow.com/q/26601260
accepted answer of: http://stackoverflow.com/q/26601260
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: Try Window -> Preferences -> Java -> Code Style -> Code Templates. There you can edit existing code templates and even import new ones.
type: Answer

http://stackoverflow.com/q/26646499
tagged with: associations
has body: I have difficulties with two classes: Program class and EventHandler class. Program class creates two separate windows, one is "Ground" (window with background jpg) and another window has "add" button, which adds a flower to "Ground". "add" button calls method ActionListener which creates an object of class Eventhandler, public class Program implements Runnable { @Override //implements interface public void run() { example1.Ground g; g = new example1.Ground(); // ground object javax.swing.JFrame window = new javax.swing.JFrame("windowwithbutton"); //window (JFRAME) javax.swing.JPanel panel = new javax.swing.JPanel(); //content (JPANEL) javax.swing.JButton ab = new javax.swing.JButton("add"); ab.addActionListener(new eventHandler()); Eventhandler class: public class Eventhandler implements java.awt.event.ActionListener { @Override public void actionPerformed(java.awt.event.ActionEvent e) { example1.Flower flower; flower = new example1.Flower(); Everything works fine, but I have difficulties with adding piece of code to eventhandler, so when button is pressed - it should create flower on ground created by program class. How I should set this association between objects? Thanks :)
has title: java. eventhandler interface
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41898292
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26646765
has comment: http://stackoverflow.com/comment/41898278
has comment: http://stackoverflow.com/comment/41898664
score: 0
has comment: http://stackoverflow.com/comment/41898396
has comment: http://stackoverflow.com/comment/41898353
answer count: 1
tagged with: eventhandler
accepted answer: http://stackoverflow.com/a/26646765

http://stackoverflow.com/a/26559352
upvote count: 2
has body: What I'm confused about is how the for loop iterates the array. When iterating, does it assign e_ to the same memory location as list[index] or is e_ a new object cloned from list[index] Object[] someList = {...}; for(Object e:someList) { } Simply means, for each Object in someList assign it to variable e. ...because what I want to do is use == instead of equals() so that I can specifically call the object and not risk it being equal() to another. When comparing objects, you must provide your own implementation of the object's equals() method. Using == for comparing equality of objects might return unexpected result. Please note that == just compares the reference address of the objects to determine if they're equal. It's usually used only for comparing primitive types in Java. Read more about the equals() method and == operator here.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26559316
downvote count: 0
has comment: http://stackoverflow.com/comment/41739394

http://stackoverflow.com/comment/41843233
type: Comment
type: QuestionComment
has text: Log the context of the Activity in onStop() and onPause() - perhaps it is not the same instance.
score: 0
comment on: http://stackoverflow.com/q/26612823

http://stackoverflow.com/comment/41945001
comment on: http://stackoverflow.com/q/26653867
score: 0
type: Comment
type: QuestionComment
has text: @ChrisStratton lsof command has shown me that the file is still opened in my app. Is there a way force close it?

http://stackoverflow.com/comment/41742409
comment on: http://stackoverflow.com/q/26560556
score: 0
type: Comment
type: QuestionComment
has text: You can't change the structure of the tables, but you can process the rows in different transactions (multiple units of work). Am I right?

jar
tags question: http://stackoverflow.com/q/26550598
tags question: http://stackoverflow.com/q/26625464
tags question: http://stackoverflow.com/q/26556301
tags question: http://stackoverflow.com/q/26670556
tags question: http://stackoverflow.com/q/26672221
tags question: http://stackoverflow.com/q/26588497
tags question: http://stackoverflow.com/q/26625130
type: Tag
tags question: http://stackoverflow.com/q/26525368
tags question: http://stackoverflow.com/q/26566361
tags question: http://stackoverflow.com/q/26625032
tags question: http://stackoverflow.com/q/26615687
tags question: http://stackoverflow.com/q/26529128
tags question: http://stackoverflow.com/q/26588190
tags question: http://stackoverflow.com/q/26601123
tags question: http://stackoverflow.com/q/26661182
tags question: http://stackoverflow.com/q/26550427
tags question: http://stackoverflow.com/q/26576953
tag name: jar
tags question: http://stackoverflow.com/q/26607818
tags question: http://stackoverflow.com/q/26552786
tags question: http://stackoverflow.com/q/26519991
tags question: http://stackoverflow.com/q/26636855
tags question: http://stackoverflow.com/q/26662542
tags question: http://stackoverflow.com/q/26641879
tags question: http://stackoverflow.com/q/26627387
tags question: http://stackoverflow.com/q/26551621
tags question: http://stackoverflow.com/q/26610845
tags question: http://stackoverflow.com/q/26551718
tags question: http://stackoverflow.com/q/26548299
tags question: http://stackoverflow.com/q/26555773
tags question: http://stackoverflow.com/q/26587551
tags question: http://stackoverflow.com/q/26659205
tags question: http://stackoverflow.com/q/26638388
tags question: http://stackoverflow.com/q/26606379
tags question: http://stackoverflow.com/q/26566373
tags question: http://stackoverflow.com/q/26668790

http://stackoverflow.com/q/26566567
tagged with: java
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26566596
answer count: 1
has body: --- And you guys are way smarter than me!!! I am having trouble addressing this error. My app is crashing due to a a null pointer exception. Here is the error: java.lang.ArrayIndexOutOfBoundsException: length=6; index=6 at net.miraath.anbiyaa.SimpleMusicStream.updateAudioInfo(SimpleMusicStream.java:524) at net.miraath.anbiyaa.SimpleMusicStream.access$1400(SimpleMusicStream.java:30) at net.miraath.anbiyaa.SimpleMusicStream$AudioInfoLoadTask.onPostExecute(SimpleMusicStream.java:651) at net.miraath.anbiyaa.SimpleMusicStream$AudioInfoLoadTask.onPostExecute(SimpleMusicStream.java:596) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) 10-25 12:36:30.275 1560-1560/net.miraath.anbiyaa E/Trace﹕ error opening trace file: No such file or directory (2) 10-25 12:36:30.275 1560-1560/net.miraath.anbiyaa D/AndroidRuntime﹕ Shutting down VM 10-25 12:36:30.275 1560-1560/net.miraath.anbiyaa W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2ed3288) 10-25 12:36:30.275 1560-1560/net.miraath.anbiyaa E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start service net.miraath.anbiyaa.PlayerService@b3962930 with null: java.lang.NullPointerException at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2507) at android.app.ActivityThread.access$1900(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292) at…
type: AnsweredQuestion
has title: Java Null Pointer exception error on android app
accepted answer: http://stackoverflow.com/a/26566596
has comment: http://stackoverflow.com/comment/41752202
favorite count: 0
type: Question
tagged with: android
score: -1

http://stackoverflow.com/comment/41888460
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26640636
has text: Remember to do your due diligence before posting. An internet search, even restricted to SO has a very high ratio of reward to caloric expenditure.
type: Comment

http://stackoverflow.com/comment/41833945
type: AnswerComment
has text: @KishorePaparthi I edited my code again to convert to UTC time try it out let me know what you think.
type: Comment
comment on: http://stackoverflow.com/a/26610463
score: 0

http://stackoverflow.com/comment/41721892
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26549359
type: Comment
has text: thats exactly the point, i dont want to cancel my background task in an activity method, because it updates periodically the data which are used in different activities. I just want finish my Task when the application is closing...

http://stackoverflow.com/q/26524042
type: AnsweredQuestion
tagged with: clone
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/78536
upvote count: 1
has answer: http://stackoverflow.com/a/26524299
has body: I have a class, which contains a collection field (pets). This field contains other collections, which again contain objects. I want to create a deepcopy of one of this class' object. I have read about using copy constructors, which seem to be way more comfortable than using the Cloneable interface. I implemented one in my Person class and made use of the ArrayList's copy constructor. Unfortuntely, the copy of the pets ArrayList was not a deepcopy - the contents still reference the same contents. Only the pets ArrayList itself got copied. So the constructor ArrayList(Collection c) is not doing what I want it to do. But I have also read about iterating through collections to copy its contents again - this is what I did in the example below. Up to here the pets ArrayList and the contents, the ArrayLists containing different animals, are cloned. But what about the animal objects in the animal list? John and JohnClone have their own pet lists, but the pets are still the same. If something happens to John's dog Odin, JohnClone's dog will still be affected. What am I missing out? How do I create a real deepcopy of a collection? public class Person { String name; int age; ArrayList pets; public Person(String name, int age, ArrayList pets) { this.name = name; this.age = age; this.pets = pets; } public Person(Person person) { name = person.name; age = person.age; // pets = ArrayList(person.pets) didn't copy its contents ArrayList clone = new ArrayList(); for (Object list : person.pets) { clone.add(new ArrayList((ArrayList) list)); } pets = clone; } public static void main(String[] args) throws Exception { ArrayList dogs = new ArrayList(); dogs.add(new Dog("Odin")); dogs.add(new Dog("Hachiko")); ArrayList cats = new ArrayList(); cats.add(new Cat("Whisky")); ArrayList johnsPets = new ArrayList(); johnsPets.add(dogs); johnsPets.add(cats); Person john = new Person("John Doe", 33, johnsPets); Person johnClone = new Person(john); } I left Person's fields default and didn't use gen…
accepted answer: http://stackoverflow.com/a/26525609
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26524299
downvote count: 0
tagged with: copy
tagged with: deep-copy
has title: Clone collection containing another collection
tagged with: copy-constructor
favorite count: 0
has answer: http://stackoverflow.com/a/26525609
has comment: http://stackoverflow.com/comment/41676410

http://stackoverflow.com/comment/44954316
comment on: http://stackoverflow.com/a/26666030
type: AnswerComment
has text: @jameslarge The call to the method will be done, however it will be executed only when it is allowed.
score: 0
type: Comment

http://stackoverflow.com/a/26600295
answers question: http://stackoverflow.com/q/26600268
has body: There's no zoo variable in your code. Anyway.. Since class A is in package a, class C in package p, C cannot access the package-private variable spot. If you want spot to be accessible by extending classes, change its access modifier to protected.
has comment: http://stackoverflow.com/comment/41814715
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41814733
accepted answer of: http://stackoverflow.com/q/26600268

http://stackoverflow.com/q/26655741
has body: I will be parsing and converting a document in ms word format to JSON (or by via an XML finally to JSON). How such parsing and conversion will take care of image embeded in word doc. how this images can be represented in json format. Any pointers or demo example. I am thinking of using apache poi as parser and customised java class for json string builder. Is there any readily available tool for such parsing and conversion.
has answer: http://stackoverflow.com/a/26657129
type: AnsweredQuestion
score: 2
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/41915821
upvote count: 2
has title: Word Doc File to JSON
type: Question
accepted answer: http://stackoverflow.com/a/26657129
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: base64
has comment: http://stackoverflow.com/comment/41939675
tagged with: doc
possible better answer: http://stackoverflow.com/a/38578868
answer count: 2
has answer: http://stackoverflow.com/a/38578868
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26593840
answers question: http://stackoverflow.com/q/26593342
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26593342
score: 2
type: AcceptedAnswer
downvote count: 0
has body: problem with you code is you are not moving the Sacanner pointer in while loop so it were infinite loop. In your last for loop you are trying to access element from numberArray[n] which is wrong because n itself is a number from your array numberArray. you can try this : public static void main(String args[]) throws FileNotFoundException { Scanner file1 = new Scanner(new File("d:\\data.txt")); int lengt_h = 0; while (file1.hasNext()) { lengt_h++; file1.next(); } file1 = new Scanner(new File("d:\\data.txt")); // again put file pointer at beginning int[] numberArray = new int[lengt_h]; for (int i = 0; i &lt; numberArray.length; i++) { numberArray[i] = file1.nextInt(); // read integer from file } for (int n : numberArray) System.out.print(n + " "); }
type: Answer

http://stackoverflow.com/a/60395910
has body: JUnit 4 vs Jupiter - Wrong import may be causing the problem TL;DR import org.junit.jupiter.api.Test instead of org.junit.Test I had this issue when I imported the wrong Test class. While a constructor was using JUnit 5 features, I imported the old org.junit.Test rather than org.junit.jupiter.api.Test.
upvote count: 40
downvote count: 0
answers question: http://stackoverflow.com/q/26672229
score: 40
has comment: http://stackoverflow.com/comment/138221599
type: Answer

http://stackoverflow.com/comment/41695449
type: QuestionComment
score: 1
has text: @BohuslavBurghardt okay, so it appears to be better, I force closed the program, and restarted, and now all the folders have shown up.
type: Comment
comment on: http://stackoverflow.com/q/26534272

http://stackoverflow.com/comment/41846051
has text: I changed it to use my own style and it worked! Sad that I need to make a resource layout of plain TextViews just to change colors globally.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26571393
type: AnswerComment

soa
type: Tag
tags question: http://stackoverflow.com/q/26612474
tag name: soa
tags question: http://stackoverflow.com/q/26591831
tags question: http://stackoverflow.com/q/26645804

http://stackoverflow.com/comment/41784905
score: 0
type: Comment
type: QuestionComment
has text: Hi, Im trying to include in the array that i return all totals of sublists in the original array for example; if i have {1,-5, 3, 5} then i want to include in the array {1, -5, 3, 5, -4, -2, 8, -1, 3, 4} this gives all the totals of sublists of size 1 :{1, -5, 3, 5} , sublists of size 2: {-4, -2, 8 }, sublists of size 3 = {-1}, sublists of size 4 {4} in one array
comment on: http://stackoverflow.com/q/26584325

http://stackoverflow.com/comment/41851708
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26620444
score: 0
has text: Thanks. I don't have a Target Platform option, nor do I have a Plug-in Development option. Not even when I search for them.

http://stackoverflow.com/a/26625960
accepted answer of: http://stackoverflow.com/q/26583334
type: Answer
score: 0
has body: It seems, I'm not able to write back to the jar file, which contains the package, only if I'll unpack the Jar, overwrite the xml and then pack again the Jar.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26583334

http://stackoverflow.com/comment/41728213
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26552624
has text: @DreadHeadedDeveloper that is a mistake. There should be no spaces after the commas.

http://stackoverflow.com/a/79011084
score: 0
type: Answer
has body: Try following working kotlin native ad code : private fun loadNativeAd(ctx: Context, adContainerView: ViewGroup) { val adLoader = AdLoader.Builder(ctx, ctx.getString(R.string.native_unit_id)) .forNativeAd { nativeAd : NativeAd -> populateNativeAd(adContainerView, nativeAd) } .build() val adBuilder = AdRequest.Builder() adLoader.loadAd(adBuilder.build()) } private fun populateNativeAd(parent: ViewGroup, nativeAd: NativeAd) { val inflater = parent.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater val adView = inflater.inflate(R.layout.native_ad_layout, null) as NativeAdView val headlineView = adView.findViewById<TextView>(R.id.ad_headline) headlineView.text = nativeAd.headline adView.headlineView = headlineView val bodyView = adView.findViewById<TextView>(R.id.ad_body) bodyView.text = nativeAd.body adView.bodyView = bodyView val iconView = adView.findViewById<ImageView>(R.id.ad_app_icon) iconView.setImageDrawable(nativeAd.icon?.drawable) adView.iconView = iconView val button = adView.findViewById (R.id.ad_button) button.text = nativeAd.callToAction adView.callToActionView = button val mediaView = adView.findViewById<MediaView>(R.id.ad_media) mediaView.setImageScaleType(ImageView.ScaleType.CENTER_CROP) adView.mediaView = mediaView adView.setNativeAd(nativeAd) parent.removeAllViews() parent.addView(adView) } And create ui file "native_ad_layout.xml" for loading native ad : <?xml version="1.0" encoding="utf-8"?> <com.google.android.gms.ads.nativead.NativeAdView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/ad_bg_color"> <ImageView android:id="@+id/ad_app_icon" android:layout_width="72dp" android:layout_height="72dp" android:layout_gravity="center"/> <TextView android:id="@+id/ad_headline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="16sp"/> <TextView android:id="@+…
answers question: http://stackoverflow.com/q/26610383

http://stackoverflow.com/comment/41926196
comment on: http://stackoverflow.com/q/26662066
score: 3
has text: Please, no more `!! HELP !!` business as your question is no more important than any other on this site. To get quick attention to your question, you will instead want to write as clear a question as possible, one that is easy to answer.
type: Comment
type: QuestionComment

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/26649751
type: Tag
tags question: http://stackoverflow.com/q/26648292
tags question: http://stackoverflow.com/q/26559377

http://stackoverflow.com/comment/41698764
type: AnswerComment
comment on: http://stackoverflow.com/a/26536230
has text: @BrianJ I've added error handling as an aside at the end of my answer.
score: 0
type: Comment

http://stackoverflow.com/comment/113155793
type: QuestionComment
has text: Can you please mark which answer worked for you?
score: 0
comment on: http://stackoverflow.com/q/26646894
type: Comment

http://stackoverflow.com/comment/41756807
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26568298
has text: Thanks anyway but I've tried both of your suggestions to no avail...I agree that this is incredibly hacky/dirty but I **need** my combobox to be at least 40 pixels high **no matter what**...I've spoken to my teacher again (this is a uni assignment) and he isn't willing to budge at all on this issue...so what the heck do I have to do?! Use a `GroupLayout`ed panel inside the `FormLayout`?? Now **that's** what I call **really** hacky!
score: 0

http://stackoverflow.com/comment/41796321
comment on: http://stackoverflow.com/a/26589901
has text: I haven't found a way to send you a message so i will just ask it here. I fixed the previous problem but now when i try to print a string i get error that the variable im trying to print has not been yet initialised. But i have made a new string using #String output = new String (timeDigit + suffix);#
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26521932
has body: I have project which used JIRA REST Java Client. It worked fine until I tried to integrate it with Spring Boot. Since that I am not able to invoke createWithBasicHttpAuthentication from AsynchronousJiraRestClientFactory without error. I get: ClassNotFoundException: org.apache.http.util.Args So I added HttpComponents Core blocking I/O(httpcore) dependency to my pom.xml, but I after that I got ClassNotFoundException: org.apache.http.nio.NHttpMessageParserFactory Which I resolved with adding HttpComponents Core non-blocking I/O(httpcore-nio) to pom.xml. Now I have NoSuchMethodError: org.apache.http.nio.client.HttpAsyncClient.start()V I've compared dependency:tree when project has spring boot parent and when it's commented out. It shown me that adding spring boot parent changes versions of my dependencies. You can check diff here( on left without spring boot, on right with spring boot) It seems that JIRA REST Java Client need older versions of some dependencies. How can I solve this problem? pom.xml ... org.springframework.boot spring-boot-starter-parent 1.0.0.RELEASE ... com.atlassian.jira jira-rest-java-client-core RELEASE org.apache.httpcomponents httpcore 4.3.2 org.apache.httpcomponents httpcore-nio 4.3 ...
tagged with: java
has comment: http://stackoverflow.com/comment/41672937
tagged with: jira
type: Question
has comment: http://stackoverflow.com/comment/41673015
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/29772822
has comment: http://stackoverflow.com/comment/41675992
tagged with: rest
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/41673391
score: 3
tagged with: spring-boot
has title: Maven - how to work with multiple versions of dependencies?
has comment: http://stackoverflow.com/comment/41695126
upvote count: 3

http://stackoverflow.com/q/26520696
type: Question
has answer: http://stackoverflow.com/a/26520777
answer count: 4
score: -1
has title: Passing arguments to a method
possible better answer: http://stackoverflow.com/a/26520787
has answer: http://stackoverflow.com/a/26520787
downvote count: 1
has body: class method { public static void printChars(char ch1, char ch2, int numberPerLine) { for (int i = ch1; i &lt;= (int) ch2 - (int) ch1; i++) { //starting at ch1, loops until ch2 if (i % numberPerLine == 0) { //max 10 characters per line System.out.println((char) i); } else { System.out.print((char) i + " "); } } } } public class q2 { public static void main(String[] args) { method.printChars((char) 49, (char) 90, 10); //passes the ASCII values of 1 and Z onto the method } } I'm trying to write a program that takes 3 inputs- (beginning character, ending character and the number of characters per line) and then prints it out. Eg- (49, 90, 10) would print out all the ASCII characters from 1 to Z, 10 per line. I just started learning classes in class, I'm not sure If I'm passing the arguments on to the method correctly. My program is not printing anything, any idea what could be wrong?
accepted answer: http://stackoverflow.com/a/26520777
has answer: http://stackoverflow.com/a/26520833
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26520817
upvote count: 0
has comment: http://stackoverflow.com/comment/41670573
favorite count: 0
has comment: http://stackoverflow.com/comment/41670634

sensors
type: Tag
tags question: http://stackoverflow.com/q/26598794
tag name: sensors

http://stackoverflow.com/q/26667266
possible better answer: http://stackoverflow.com/a/26667959
type: Question
tagged with: mockito
has answer: http://stackoverflow.com/a/26801471
answer count: 2
has title: Counting current users viewing a page
downvote count: 0
tagged with: distributed-computing
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26801471
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26667959
has body: I am working on counting number of viewing user on a page. Basically, when a user view an URL localhost:8080/itemDetail.do?itemId=1, then the page will showing how many users are viewing on that page at the same time. Solution approach When user is viewing a particular page, that page will continue to send AJAX request every 1 second back to server, then server will use a Map&lt;String, Map&lt;String, Integer&gt;&gt; (both use ConcurrentHashMap for the initialization) to contain the itemId (to know which page is viewed) and the IP and timeout count (in the inner Map). Every time getting the request, then the counting will increase 1. There is a thread fired during the request process to decrease the timeout counting every 2 seconds. If in the end, the timeout counting is equal to 0, app will consider the user stopped viewing the page, then thread will remove that entry and thus the number of user will be decreased 1. A small problem for this approach is since the timeout number is increasing faster than decreasing, if user open the page long enough and close the page, then the app will take sometime to know that that user already left the page, because the timeout number at that moment is quite big Implementation // Controller @RequestMapping(value = AppConstants.ACTION_NUMBER_VIEWING, method = GET) @ResponseBody public int userItemViewing(HttpServletRequest request, @RequestParam(value = "itemId") String itemId) { try { return eventService.countUserOnline(request, itemId); } catch (CAServiceException e) { e.printStackTrace(); LOG.error("========== Error when counting number of online user ==========" + e.getMessage()); } return 0; } // Service private static Map&lt;String, Map&lt;String, Integer&gt;&gt; numberOfCurrentViews; private Thread countDownOnlineThread; class OnlineCountingDownRunnable implements Runnable { private List&lt;String&gt; timeoutList = new ArrayList&lt;String&gt;(); private void cleanTimeoutIps() { for (String itemId : numberOfCurrentViews.keyS…
tagged with: java

http://stackoverflow.com/comment/41876182
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26634130
has text: I think you need to mention the solution to not having public fields is to provide getters and setters.
score: 0

http://stackoverflow.com/comment/42023835
score: 0
type: Comment
type: QuestionComment
has text: It doesn't use ffmpeg... it just says that you can use ffmpeg to convert to other formats
comment on: http://stackoverflow.com/q/26609595

http://stackoverflow.com/comment/41729473
score: 0
comment on: http://stackoverflow.com/q/26539675
type: Comment
type: QuestionComment
has text: Please read my comment again; there are some things that you did not do that will cause compilation errors.

http://stackoverflow.com/comment/41972245
type: QuestionComment
has text: A Person with parent=null means that they are a parent, and cannot have a parent. It's an alien world haha
comment on: http://stackoverflow.com/q/26669841
score: 0
type: Comment

http://stackoverflow.com/q/26614438
has title: What is the difference between @XMLValue and @JsonValue
tagged with: java-ee-6
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26614540
linked to: http://stackoverflow.com/q/26578239
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/26614540
type: Question
tagged with: jakarta-ee
has body: @JsonValue javadoc states: "Marker annotation similar to javax.xml.bind.annotation.XmlValue". Why is it similar and what are the differences? I am asking this as a newbie in JAXB, because the javadoc is too cryptic so I can't find the real intent of both, and why @JsonValue is not available in the Java EE spec since it enables us to properly serialize an object into a string (see here for context)
tagged with: jackson

http://stackoverflow.com/q/26666028
has comment: http://stackoverflow.com/comment/41933779
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/41934647
score: 0
has body: I'm using spring to run my test and got weird error which block me for a while. Writer and Parser are classes with no attributes and only using default constructors. AbstractTestCaseUnit.java @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:spring-configuration/unit-test-config.xml" }) public abstract class AbstractTestCaseUnit { @Resource(name = "Parser") private DataParser Parser;; @Resource(name = "Writer") private DataWriter Writer; public DataParser getMessageParser() { return Parser; } public DataWriter getDataWriter() { return Writer; } } DataParseTest.java public class DataParserTest extends AbstractTestCaseUnit { @Test public void testParseMessageHappyCase() {...} } unit-test-config.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd "&gt; &lt;import resource="unit-test/environment.xml" /&gt; &lt;bean id="Parser" class="com.datatype.DataParser" /&gt; &lt;bean id="Writer" class="com.datatype.DataWriter" /&gt; Error: [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.013 sec [junit] [junit] Testcase: initializationError took 0.003 sec [junit] Caused an ERROR [junit] org.springframework.beans.BeanUtils.instantiateClass(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object; [junit] java.lang.NoSuchMethodError: org.springframework.beans.BeanUtils.instantiateClass(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object; [junit] at org.springframework.test.context.ContextLoaderUtils.resolveContextLoader(ContextLoaderUtils.java:87) [junit] at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:298) [junit] at org.springframework.test.context.TestContext.&lt;init&gt;(TestContext.java:100) [junit] at org.springframework.te…
answer count: 1
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41934847
tagged with: java
has answer: http://stackoverflow.com/a/31342307
has title: Spring Test NoMethod Error

http://stackoverflow.com/a/43012087
downvote count: 0
answers question: http://stackoverflow.com/q/26548505
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/74080247
has body: My problem was that embedded database was already connected. close connection

http://stackoverflow.com/a/26663354
downvote count: 0
has body: Use .equals() as opposed to == when comparing objects (Strings are objects). == will compare the objects' references, whereas .equals() will check to see if they have the same values. Since two objects will very rarely have the same reference you should never use == except for comparing primitive types (int, char, but String is not a primitive type!) where it doesn't matter. So you want ff.equals(iron)
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26663288
score: 1

http://stackoverflow.com/comment/41824122
comment on: http://stackoverflow.com/q/26598110
type: QuestionComment
has text: No luck means here: just no doing as expected, i.e. nothing gets generated. Actually, without annotated entities in my classpath, the processor does not kick in, i.e. I'm not even able to pass a processor option like "-Adebug=true" or specify a different configuration resource with "-ApersistenceXml=...".
score: 0
type: Comment

http://stackoverflow.com/a/26843724
has body: After Android version 2.3, you cannot do anything about the size of the heap other than using android:largeHeap attribute. There are two ways to cheat if you want a big heap not matter what: Using native api to allocate memory: Not a good idea as it increases complexity and if you are not planning to do things in native code, Allocating an unnecessarily big object before your execution to get a desired heap space: Although it will give you enough heap space once, it is not guaranteed that the heap size will stay the same. However, initial heap size is not a problem if it gets resized when needed. My opinion about memory management in a game lifecycle is a little bit different than those two things listed above and what you are probably doing. For a level, or a stage etc. you should not allocate memory at the exact time when you need it. This will not only cause stutters when allocating memory, but also stutter because of possible storage I/O. Anything, like sounds, graphics, fonts etc. should be prepared before a level. This is why a lot of games have a "loading" screen. You should prepare anything that you can do before starting the play. For a small stage, doing this is OK -but still not good-. As things go complex, it will take the performance down. A lot of games (like sports games, racing games etc.) do the allocation before starting the game. Others do it as much as they can. Some open world games (like GTA) does not load all the map objects in the map, but they have a draw distance, so they draw as you move in the map and they remove the farthest objects from memory when the memory has no more room. [The reason why your app with older LibGDX version got more heap size is probably an allocation which caused an increase in the heap size and a deallocation which freed some of the heap so that you get a good 30% usage.]
accepted answer of: http://stackoverflow.com/q/26639428
type: Answer
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/26639428
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41828088
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26603823
type: AnswerComment
has text: Would this be possible if ``main`` and ``dependency-project`` don't have maven configurations?

http://stackoverflow.com/comment/41734623
has text: how? which method exactly?
type: Comment
comment on: http://stackoverflow.com/a/26556413
score: 0
type: AnswerComment

http://stackoverflow.com/q/26531846
score: 6
tagged with: maven
upvote count: 6
has comment: http://stackoverflow.com/comment/41712173
tagged with: java
has comment: http://stackoverflow.com/comment/41711922
has body: I want to create a jar file from a maven project. I need to use an own assembly.xml because I need to exclude a few .so files: assembly.xml assembly-with-so jar false / true true runtime jcuda:libJCublas:so:linux-x86_64:0.6.5 [...] / jcuda:libJCublas:so:linux-x86_64:0.6.5 [...] pom.xml [...] <plugins> org.apache.maven.plugins maven-assembly-plugin jar-with-dependencies prepare-package single src/main/assembly/assembly.xml false org.test.Test [...] When I start the jar file using java -jar File.jar I'm getting the error that the class org.test.Test is missing. When I open the .jar file to have a look what's in it, I see that every file of the dependencies are there but the files of the main project are missing.
type: Question
has comment: http://stackoverflow.com/comment/41690665
downvote count: 0
has comment: http://stackoverflow.com/comment/41711826
has answer: http://stackoverflow.com/a/48896309
answer count: 1
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has title: maven assembly - jar misses own classes

http://stackoverflow.com/q/26548028
tagged with: servlets
type: Question
has title: servlet doGet is launched twice through servlet annotation calling
tagged with: intellij-idea
tagged with: jsp
tagged with: tomcat
answer count: 1
has answer: http://stackoverflow.com/a/26548830
has body: For some reasons my servlet doGet method is being called twice. I am calling servlet from the index.jsp page by using servlet annotation "/Profile/*. And it passes path as localhost:1919/Profile/username to getPost method. <a href="Profile/<%=lg.getUsername()%>">Your Profile Servlet Profile retrieves data from the java container stores it as an attribute and forwards to profile.jsp page. rd = request.getRequestDispatcher("/profile.jsp"); request.setAttribute("ProfileInfo", proInfo); rd.forward(request, response); My profile.jsp page uses java code to show all the data (and it shows it perfectly). But then I click link to the next update_profile.jsp page. Just simple link. Then I realize that on this step for strange reasons for me doGet method from Profile servlet is called the second time. And passes path as localhost:1919/Profile/update_profile.jsp Here is my profile.jsp code: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="uk.ac.dundee.computing.aec.instagrim.containers.*" %> Picturize - User Profile Picturize - Profile of user <% ProfileInfo proInfo = (ProfileInfo) request.getAttribute("ProfileInfo"); %> User: <%=proInfo.getUsername()%> First name: <%=proInfo.getFirstname()%> Last name: <%=proInfo.getLastname()%> Email address: <%=proInfo.getEmail()%> Update your profile information And update_profile.jsp file is just simple file with hello output. I have looked in the internet that this might be a mapping problem or my css relative path connection problem. As you see I have commented out my css connection and problem still exists. My run output in the IDE also shows these errors: org.apache.jasper.JasperException: An exception occurred processing JSP page /profile.jsp at line 27 24: %> 25: 26: 27: User: <%=proInfo.getUsername()%> 28: 29: 30: First name: <%=proInfo.getFirstname()%> Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) at org.apache.jasper.servlet.JspServletWrapper.servic…
score: 0
linked to: http://stackoverflow.com/q/10659459
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26548830

http://stackoverflow.com/comment/41745540
has text: Ohh, I get it. Yeah assignment has least precedence. I just find that behavior strange somehow.
comment on: http://stackoverflow.com/a/26562669
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41849083
score: 0
type: Comment
type: QuestionComment
has text: @user902383, yes u are right i am trying to do that
comment on: http://stackoverflow.com/q/26618961

http://stackoverflow.com/comment/41701665
comment on: http://stackoverflow.com/q/26537841
score: 0
has text: No that doesn't work either. Anymore suggestions?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26616723
has comment: http://stackoverflow.com/comment/41844698
favorite count: 0
linked to: http://stackoverflow.com/q/22431153
has title: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
linked to: http://stackoverflow.com/q/26789225
tagged with: maven
has comment: http://stackoverflow.com/comment/41844648
has comment: http://stackoverflow.com/comment/41846471
has answer: http://stackoverflow.com/a/28055089
has answer: http://stackoverflow.com/a/41268032
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27108254
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27409828
linked to: http://stackoverflow.com/q/20734540
tagged with: eclipse
type: Question
upvote count: 12
tagged with: jpa
has answer: http://stackoverflow.com/a/26721596
score: 12
has answer: http://stackoverflow.com/a/26658126
accepted answer: http://stackoverflow.com/a/27409828
possible better answer: http://stackoverflow.com/a/28147230
linked to: http://stackoverflow.com/q/18447541
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/28147230
has body: I am upgrading jpa, hibernate, spring, and jdk to enable the new features from JPA 2.1. But I am getting the following error: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index; I have read other postings about this, but they do not resolve the error on my machine. For instance, SJuan76's answer to this posting suggests upgrading to jpa 2.1, but I have set the eclipse jpa project facet to version 2.1 and I have also included hibernate-jpa-2.1-api in my pom.xml. You can read all the versions of the various libraries in the complete pom.xml by clicking on this link. What do I need to change in the pom.xml or in the eclipse project to resolve this error? Note: I can get rid of the error by changing the hibernate version in the pom.xml back to &lt;hibernate.version&gt;4.2.1.Final&lt;/hibernate.version&gt;, but this defeats the purpose of upgrading. Does the fact that changing the hibernate version turns the error on and off help us to diagnose the problem? If the problem is multiple jars conflicting with each other, I could use the eclipse type manager to disable one of the jars, but which jar would I look for? Here is the complete stack trace: ERROR ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/business-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.6.RELEASE.jar:4.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCa…

http://stackoverflow.com/q/26639049
type: Question
has title: Why do I get a ')' expected when I try to get my HTML to work in my Java code?
tagged with: java
score: -1
upvote count: 0
accepted answer: http://stackoverflow.com/a/26639144
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41885173
tagged with: cgi
has body: I was wondering why I cannot find a way to get my frameset (HTML) to work in java. I know I need more code for the frameset, but it keep ending up with the same error. private static void showHead() { if ( session == null ) System.out.println("Set-Cookie: __session="+(int)(Math.random()*100000000)); System.out.println("Content-Type: text/html"); System.out.println(); System.out.println(" "); System.out.println(" "); System.out.println(" "); System.out.println("<TITLE>The CGIcookie application "); System.out.println(" "); System.out.println(" "); System.out.println(" "); System.out.println(" "); System.out.println(" "); System.out.println(" "); //This line gives the error '(' expected } private static void showTail() { System.out.println(" \n "); } I don't know if you need more of the code to "solve" this. But when I tried to post with the whole code I got a msg that said my post was mostly code and therefore couldn't be submitted.
has answer: http://stackoverflow.com/a/26639144
has comment: http://stackoverflow.com/comment/41885250
downvote count: 1

http://stackoverflow.com/q/26564654
has comment: http://stackoverflow.com/comment/41770913
has comment: http://stackoverflow.com/comment/41751438
tagged with: java
has title: My values during the while loop does not update (Java)
has answer: http://stackoverflow.com/a/26564911
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26564884
upvote count: 0
linked to: http://stackoverflow.com/q/3715967
has answer: http://stackoverflow.com/a/26564721
score: -1
has comment: http://stackoverflow.com/comment/41761432
has body: Im trying to keep the FinalBal updated within the while loop but it doesn't. I think I need to add code to keep the FinalBal updated. I'm just praticing for a test. My class in college is basic java. Here is my code: import java.util.Scanner; public class TestPraticeBank { public static void main(String[] args) { int balance = 100; int TotalBal; int CurBal; int amount; Scanner keyboard = new Scanner(System.in); System.out.print("1. Deposit\n" + "2. Withdrawal\n" + "3. View\n" + "4. Exit\n" + "Enter choice:\n"); String input = keyboard.nextLine(); int choice = Integer.parseInt(input); while(choice &lt;= 4|| choice &gt;= 5) { if (choice == 4) { //System.out.print("Final Balance:"+TotalBal); System.exit(choice); } else if (choice == 3) { // System.out.print("Final Balance:"+TotalBal); } else if (choice == 1) { System.out.print("Enter the deposit amount:$"); String deposit = keyboard.nextLine(); amount = Integer.parseInt(deposit); TotalBal = balance + amount; System.out.print("Final Balance:$" + TotalBal); } else if (choice == 2) { System.out.print("Enter the withdrawal amount:$"); String withdrawal = keyboard.nextLine(); amount = Integer.parseInt(withdrawal); if (amount &lt;= balance) { TotalBal = balance - amount; System.out.print("Final Balance:$" + TotalBal); } else { System.out.print("Your withdrawal amount can't be bigger than your current balance"); } } else { System.out.print("Pick only options 1 - 4."); } System.out.print ("\n1. Deposit\n" + "2. Withdrawal\n" + "3. View\n" + "4. Exit\n" + "Enter choice:\n"); input = keyboard.nextLine(); choice = Integer.parseInt(input); } } }
answer count: 3
has comment: http://stackoverflow.com/comment/41748731
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26516765
tagged with: java
favorite count: 0
linked to: http://stackoverflow.com/q/17543091
type: Question
tagged with: jodatime
upvote count: 6
has comment: http://stackoverflow.com/comment/41664197
linked to: http://stackoverflow.com/q/25084576
answer count: 3
has answer: http://stackoverflow.com/a/26517792
has answer: http://stackoverflow.com/a/26519928
accepted answer: http://stackoverflow.com/a/26518093
tagged with: intersect
has body: I am working on a project that confuses me really bad right now. Given is a List&lt;TimeInterval&gt; list that contains elements of the class TimeInterval, which looks like this: public class TimeInterval { private static final Instant CONSTANT = new Instant(0); private final LocalDate validFrom; private final LocalDate validTo; public TimeInterval(LocalDate validFrom, LocalDate validTo) { this.validFrom = validFrom; this.validTo = validTo; } public boolean isValid() { try { return toInterval() != null; } catch (IllegalArgumentException e) { return false; } } public boolean overlapsWith(TimeInterval timeInterval) { return this.toInterval().overlaps(timeInterval.toInterval()); } private Interval toInterval() throws IllegalArgumentException { return new Interval(validFrom.toDateTime(CONSTANT), validTo.toDateTime(CONSTANT)); } The intervals are generated using the following: TimeInterval tI = new TimeInterval(ld_dateValidFrom, ld_dateValidTo); The intervals within the list may overlap: |--------------------| |-------------------| This should result in: |-------||-----------||------| It should NOT result in: |--------|-----------|-------| Generally speaking in numbers: I1: 2014-01-01 - 2014-01-30 I2: 2014-01-07 - 2014-01-15 That should result in: I1: 2014-01-01 - 2014-01-06 I2: 2014-01-07 - 2014-01-15 I3: 2014-01-16 - 2014-01-30 I'm using JODA Time API but since I'm using for the first time, I actually don't really have a clue how to solve my problem. I already had a look at the method overlap() / overlapWith() but I still don't get it. Your help is much appreciated! UPDATE I found something similar to my problem >here&lt; but that doesn't help me for now. I tried it over and over again, and even though it worked for the first intervals I tested, it doesn't actually work the way I wanted it to. Here are the intervals I have been given: 2014-10-20 ---&gt; 2014-10-26 2014-10-27 ---&gt; 2014-11-02 2014-11-03 ---&gt; 2014-11-09 2014-11-10 ---&gt; 2014-11-16 2014-11-17 ---&g…
score: 6
possible better answer: http://stackoverflow.com/a/26519928
tagged with: range
has answer: http://stackoverflow.com/a/26518093
type: AnsweredQuestion
downvote count: 0
tagged with: overlap
linked to: http://stackoverflow.com/q/20677541
has title: JAVA & Joda Time API: compare intervals, detect overlapping and generate new intervals

http://stackoverflow.com/a/26710505
has body: You can do this by using AuthorizationCodeInstalledApp to get the Credential. The following sample code is copied from the Google+ command line sample. It uses a similar auth flow to yours except it creates a LocalServerReceiver that listens for and receives the code so the user does not have to do any manual steps. // Set up the HTTP transport and JSON factory HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); // Load client secrets GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(jsonFactory, new InputStreamReader(PlusSample.class.getResourceAsStream("/client_secrets.json"))); // Set up authorization code flow GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, jsonFactory, clientSecrets, Collections.singleton(PlusScopes.PLUS_ME)).setDataStoreFactory(dataStoreFactory) .build(); // Authorize Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
type: Answer
answers question: http://stackoverflow.com/q/26616907
score: 0

http://stackoverflow.com/comment/41942300
type: AnswerComment
has text: Got it n done it .. :) but still some problem how to get sort code in table in xml i tried but nt able to do it
type: Comment
comment on: http://stackoverflow.com/a/26668608
score: 0

http://stackoverflow.com/comment/41726837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26552383
has text: What is the intended output?
score: 0

http://stackoverflow.com/q/26609861
tagged with: java
has comment: http://stackoverflow.com/comment/41831640
has comment: http://stackoverflow.com/comment/41831771
answer count: 1
tagged with: bluetooth
linked to: http://stackoverflow.com/q/26585037
score: 0
tagged with: android
has title: NullPointerException while pairing bluetooth devices
type: AnsweredQuestion
has body: I am able to scan the bluetooth devices from my app and list the scanned devices. But I am facing problem in pairing a devices. Below code I used in my app, private void pairToBLE(BluetoothDevice device) { // TODO Auto-generated method stub try { 22. Method method = device.getClass().getMethod("createBond", (Class[]) null); method.invoke(device, (Object[]) null); } catch (NoSuchMethodException e) { } The above function I called here. @Override public boolean onContextItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case R.id.menu_connect: pairToBLE(mBluetoothdevice); break; } and I registered Contextmenu. Before this I am able to scan and list the BT devices but whenever I try to pair it is giving NullPointerException on line number 22. What will be the reason for NullpointerException. Full code is here public class AvailableDevices extends ListFragment { String TAG = "com.example.tracker.AvailableDevices"; private LeDeviceListAdapter mLeDeviceListAdapter; private Handler mHandler; private boolean mScanning; Context context; public BluetoothDevice mBluetoothdevice; // Stops scanning after 10 seconds. private static final long SCAN_PERIOD = 10000; BLEService mBLEService; private String mDeviceAddrees; private String mDeviceName; @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); Log.i(TAG, "inside onActivityCreated"); context = AvailableDevices.this.getActivity(); mLeDeviceListAdapter = new LeDeviceListAdapter(); //System.out.println("value of adapter=="+mLeDeviceListAdapter.getCount()); setListAdapter(mLeDeviceListAdapter); scanLeDevice(true); registerForContextMenu(getListView()); } public class LeDeviceListAdapter extends BaseAdapter{ private ArrayList&lt;BluetoothDevice&gt; mLeDevices; private LayoutInflater mInflator; Bundle savedInstanceState; public LeDeviceListAdapter() { // TODO Auto-generated constructor stub super();…
has answer: http://stackoverflow.com/a/26609962
accepted answer: http://stackoverflow.com/a/26609962
type: Question

http://stackoverflow.com/a/26525036
has comment: http://stackoverflow.com/comment/41839126
score: 0
has comment: http://stackoverflow.com/comment/41689296
answers question: http://stackoverflow.com/q/26515016
type: Answer
has comment: http://stackoverflow.com/comment/41768846
has comment: http://stackoverflow.com/comment/41680394
has comment: http://stackoverflow.com/comment/41775309
has comment: http://stackoverflow.com/comment/41773128
has comment: http://stackoverflow.com/comment/41689242
has body: I was curious about you problem and i tried to replicate the environment: public class MyAnnotatedClass extends MyAnnotatedSuperClass{ @MyCustomAnnotation(name="annotationName", value="annotationValue") @Override public String getMyString() { return myString; } public static void main(String args[]) { Class&lt;MyAnnotatedClass&gt; myClass = MyAnnotatedClass.class; MyCustomAnnotation myCustomAnnotation = myClass.getMethods()[0].getAnnotation(MyCustomAnnotation.class); if(myCustomAnnotation!=null) System.out.println("ok: "+myCustomAnnotation.name()); else System.out.println("not ok"); } } abstract class MyAnnotatedSuperClass { public String myString; public abstract String getMyString(); } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface MyCustomAnnotation { public String name(); public String value(); } From my quick test, I would conclude that annotations in override methods work fine, so the problem may be on other point of the program.
has comment: http://stackoverflow.com/comment/41687062

http://stackoverflow.com/comment/41917934
has text: Yes, thank you very much. That's it. :) Solution: weapon.transform.translate(3, 0, 0).rotate(0,1,0, 45*delta).translate(-3, 0, 0);
type: QuestionComment
comment on: http://stackoverflow.com/q/26656334
score: 1
type: Comment

http://stackoverflow.com/a/52803328
type: Answer
answers question: http://stackoverflow.com/q/26655875
has body: In Spring-Boot, need below dependency Step 1- org.springframework.boot spring-boot-starter-web Step 2- Just need to do below configurations on application.properties file - server.port=8443 - server.ssl.key.alias=ode-https - server.ssl.key-store-type=JKS (just for testing i USED JSK, but for production normally use pkcs12) - server.ssl.key-password=password - server.ssl.key-store=classpath:ode-https.jks Step 3- now need to generate a certificate using the above details. keytool -genkey -alias ode-https -storetype JKS -keyalg RSA -keys ize 2048 -validity 365 -keystore ode-https.jks Step 4- move the certificate to resources folder in your program. Step 5- Create config class @Configuration public class HttpsConfiguration { @Bean public ServletWebServerFactory servletContainer() { TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); securityConstraint.addCollection(collection); context.addConstraint(securityConstraint); } }; tomcat.addAdditionalTomcatConnectors(redirectConnector()); return tomcat; } @Value("${server.port.http}") //Defined in application.properties file int httpPort; @Value("${server.port}") //Defined in application.properties file int httpsPort; private Connector redirectConnector() { Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); connector.setScheme("http"); connector.setPort(httpPort); connector.setSecure(false); connector.setRedirectPort(httpsPort); return connector; } } that's it.
score: 20
upvote count: 21
downvote count: 1

http://stackoverflow.com/q/26671478
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20591770
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/41943376
has comment: http://stackoverflow.com/comment/41943469
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41943483
linked to: http://stackoverflow.com/q/19166667
has comment: http://stackoverflow.com/comment/41943620
has comment: http://stackoverflow.com/comment/41943373
has title: Why is 403 error being thrown?
tagged with: spring
has body: I have a webservice (implemented in spring java) that's running in a my local machine. Now I can use rest client(Firefox plugin) to invoke webservice from my own machine however when I am trying to access the webservice from another machine the server is throwing HTTP 403 error! I have disabled firewall in my local machine still the same forbidden error is being thrown. What could possibly be the reason?

http://stackoverflow.com/comment/41778756
type: Comment
has text: Neither `notify()` nor `wait()` are ways to create or kill threads. I think you should go back and read up on the fundamentals a bit. If you like books, Java Concurrency In Practice is a good one.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26580984

http://stackoverflow.com/comment/42046541
type: Comment
has text: @fonkap thanks my friend you were right. Something was altering my output. I have resolved the issue now
score: 0
comment on: http://stackoverflow.com/q/26669012
type: QuestionComment

http://stackoverflow.com/q/26551714
has comment: http://stackoverflow.com/comment/41776933
type: AnsweredQuestion
has title: Java 8 + Swing: How to Draw Flush Polygons
has comment: http://stackoverflow.com/comment/41727628
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41757257
tagged with: swing
has comment: http://stackoverflow.com/comment/41728741
accepted answer: http://stackoverflow.com/a/26557669
type: Question
has comment: http://stackoverflow.com/comment/41728051
tagged with: polygon
has comment: http://stackoverflow.com/comment/41734134
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/41732854
downvote count: 0
has comment: http://stackoverflow.com/comment/41742099
favorite count: 0
has answer: http://stackoverflow.com/a/26557669
has body: (Sorry for the long post... at least it has pictures?) I have written an algorithm that creates a mosaic from an image by statistically generating N convex polygons that cover the image with no overlap. These polygons have anywhere between 3-8 sides, and each side has an angle that is a multiple of 45 degrees. These polygons are stored internally as a rectangle with displacements for each corner. Below is an image that explains how this works: getRight() returns x + width - 1, and getBottom() returns y + height - 1. The class is designed to maintain a tight bounding box around filled pixels so the coordinates shown in this image are correct. Note that width &gt;= ul + ur + 1, width &gt;= ll + lr + 1, height &gt;= ul + ll + 1, and height &gt;= ur + ul + 1, or there would be empty pixels on a side. Note also that it is possible for a corner's displacement to be 0, thus indicating all pixels are filled in that corner. This enables this representation to store 3-8 sided convex polygons, each of whose sides are at least one pixel in length. While it's nice to mathematically represent these regions, I want to draw them so I can see them. Using a simple lambda and a method that iterates over each pixel in the polygon, I can render the image perfectly. As an example, below is Claude Monet's Woman with a Parasol using 99 polygons allowing all split directions. The code that renders this image looks like this: public void drawOnto(Graphics graphics) { graphics.setColor(getColor()); forEach( (i, j) -&gt; { graphics.fillRect(x + i, y + j, 1, 1); } ); } private void forEach(PerPixel algorithm) { for (int j = 0; j &lt; height; ++j) { int nj = height - 1 - j; int minX; if (j &lt; ul) { minX = ul - j; } else if (nj &lt; ll) { minX = ll - nj; } else { minX = 0; } int maxX = width; if (j &lt; ur) { maxX -= ur - j; } else if (nj &lt; lr) { maxX -= lr - nj; } for (int i = minX; i &lt; maxX; ++i) { algorithm.perform(i, j); } } } However, this is not ideal for many reasons. First, the co…
has comment: http://stackoverflow.com/comment/41728839
has comment: http://stackoverflow.com/comment/41727239
has comment: http://stackoverflow.com/comment/41727946

http://stackoverflow.com/q/26639808
answer count: 6
has answer: http://stackoverflow.com/a/26639974
score: 0
tagged with: java
has title: Exiting a do while loop when a string is null or void (Java)
tagged with: loops
has body: I want to exit the do while loop when the user press the enter button, but I can't exit the do while loop. The program asks for two words (pal1 and pal2) and shows which of them is the shortest one and show shows how many characters it has. If the words have the same length it orders them alphabetically. It also shows which of the words asked in the loop is the shortest one and should leave the loop when the string is void or null. import java.util.Locale; import java.util.Scanner; /** * The program asks for two words (pal1 and pal2) and shows which of them is the shortest one and show shows how many characters it has. If the words have the same length it orders them alphabetically. It also shows which of the words asked in the loop is the shortest one and should leave the loop when the string is void or null. * * @author (your name) * @version (a version number or a date) */ public class P5 { public static void main (String[] args){ Scanner tec = new Scanner (System.in).useLocale(Locale.US); String pal1, pal2, palMasCorta="", palMasCortaAux; int longitudpal1, longitudpal2, longitudPalMasCorta=2000000000, longitudPalMasCortaAux; do{ System.out.println("Escribe una palabra"); pal1 = tec.next(); longitudpal1= pal1.length(); System.out.println("Escribe otra palabra"); pal2 = tec.next(); longitudpal2=pal2.length(); palMasCortaAux=palMasCorta; longitudPalMasCortaAux=longitudPalMasCorta; if (longitudPalMasCorta&gt;longitudPalMasCortaAux) palMasCorta=palMasCortaAux; if (longitudpal1&gt;longitudpal2){ palMasCorta = pal2; longitudPalMasCorta = longitudpal2; System.out.println("El número de caracteres de "+pal2+ " es "+longitudpal2); } else if (longitudpal1 == longitudpal2){ if (pal1.compareTo(pal2) &lt; 0){ System.out.println("El número de caracteres de "+pal1+ " es "+longitudpal1); palMasCorta=pal1; } else{ if (pal1.compareTo(pal2) &gt; 0){ System.out.println("El número de caracteres de "+pal2+ " es "+longitudpal2); palMasCorta=pal2; } else{ System.out.println("Has escrito …
linked to: http://stackoverflow.com/q/2231369
tagged with: do-while
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26640007
has answer: http://stackoverflow.com/a/26640349
tagged with: string
type: Question
has answer: http://stackoverflow.com/a/26640090
has answer: http://stackoverflow.com/a/26639965
has answer: http://stackoverflow.com/a/26639941

http://stackoverflow.com/q/26538936
tagged with: compare
possible better answer: http://stackoverflow.com/a/26539004
accepted answer: http://stackoverflow.com/a/26539007
has body: I was hoping there is some way in java do to as the title says. For example: int Num1 = 5; int Num2 = 9; char Char1 = 'a'; char Char2 = 'g'; char[] CharArray = {'1','2','3','4','5','6','7','8' '9','a','b','c','d','e','f'} I would like it to return true for Num1, Num2, and Char1, while Char2 should return false. I know in MATLAB it's quite easy, you can simply just do: ismember([Num1 Num2 Char1 Char2], CharArray) This will return 1,1,1,0
has answer: http://stackoverflow.com/a/26539125
duplicate of: http://stackoverflow.com/q/1128723
has title: Java: Making sure a value is one of possible values
has answer: http://stackoverflow.com/a/26539007
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26539004
linked to: http://stackoverflow.com/q/1128723
type: Question
upvote count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41703317
answer count: 3

http://stackoverflow.com/comment/41931610
has text: Yes, it expects a JSON request now..I have edited the web method @consumes(to accept only JSON request) now...Still not working
comment on: http://stackoverflow.com/a/26664583
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26611188
has comment: http://stackoverflow.com/comment/41834360
upvote count: 0
has title: How to change url in address bar through java
has comment: http://stackoverflow.com/comment/41834550
tagged with: java
has body: How can I change the url in the address bar through java code in browser(not through javascript or any front end languages)? I have the url in the address bar like " http://www.abcde.com/home?abc=def&amp;ghi=jkl " but I need to change that url through java code like " http://www.abcde.com/home ". I'm using jsp's for view. Can anyone help?
type: Question
has comment: http://stackoverflow.com/comment/41834727
has comment: http://stackoverflow.com/comment/41834480
tagged with: address-bar
score: -1
has comment: http://stackoverflow.com/comment/41834954
has comment: http://stackoverflow.com/comment/41837451
has comment: http://stackoverflow.com/comment/41835532
answer count: 1
downvote count: 1
tagged with: url
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26611777
has comment: http://stackoverflow.com/comment/41834873

http://stackoverflow.com/q/26551621
has body: Using this tutorial: http://mark.koli.ch/bundle-java-the-jre-and-launch-a-java-app-with-7zip-sfx I'm trying to put the jre and my .jar together,to result of a single executable file, so the JRE will not be required to launch my application. I use Eclipse to export my project into an executable app.jar file. (file - export - jar, executable jar). Then, I zip the jre and app.jar together: app.7z: - jre folder - app.jar My app.tag contains this: ;!@Install@!UTF-8! Title="7ZIP Java Launcher Example" ExtractDialogText="Extracting ..." GUIFlags="32" ExtractTitle="Extracting" FinishMessage="Application stopped." RunProgram="jre\bin\javaw.exe -jar app.jar \"%%S\" \"%%T\"" ;!@InstallEnd@! Then, I put app.tag, app.7z and 7zSD.sfx into the same folder and use this command line: C:\&gt; copy /b 7zSD.sfx + app.tag + app.7z start.exe The file start.exe is created. When I open it, it says "extracting...", but will always launch "Application stopped". I have no clue why this happens. I checked into the TEMP of Windows folder, and everything is extracted correctly. Any idea what I am doing wrong? The .jar itself will open normally when I double-click on it. Thank you!
has comment: http://stackoverflow.com/comment/72887175
tagged with: java
score: 0
answer count: 1
tagged with: jar
tagged with: sfx
has answer: http://stackoverflow.com/a/31532667
tagged with: 7zip
type: UnansweredQuestion
has title: Make single file with7zip SFX with java jar
type: Question

http://stackoverflow.com/q/26569110
tagged with: methods
type: Question
has body: I think I am just calling my variable to my main the wrong way, I want to convert feet to meters and meters to feet and print out ten iterations, with feet starting at 1.0 and meters starting at 20.0 going to 10.0 and 65.0 respectively. import java.util.Scanner; public class FeetMeters { public static void main(String [] Args) { System.out.println(" Feet \t Meters \t | \t Meters \t Feet"); System.out.println("________________________________________________________________"); for(int i=0; i&lt;10; i++) { System.out.println(foot + " \t " + meter + " \t " + " | " + "\t" + meter + " \t " + foot); foot++; meter = meter + 5; } double footStart = footToMeter(meter); double meterStart = meterToFoot(foot); } public static double footToMeter(double foot) { double meter = 0.305 * foot; return meter; } public static double meterToFoot(double meter) { double foot = 3.279 * meter; return foot; } }
has answer: http://stackoverflow.com/a/26569132
upvote count: 0
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/41757417
has comment: http://stackoverflow.com/comment/41757359
type: UnansweredQuestion
score: -2
has title: I keep getting a cannot find symbol error for a variable
has answer: http://stackoverflow.com/a/26569238
linked to: http://stackoverflow.com/q/23636815
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41757332

http://stackoverflow.com/comment/41782208
type: Comment
comment on: http://stackoverflow.com/a/26539742
score: 0
type: AnswerComment
has text: @GytisK **1.** It is not really needed, just a good coding style and helps the compiler to help you to prevent errors. **2.** Again, this is a good practice helping you to minimize the chance of producing bugs. **3.** Yes there is, you have to use a logger (that will preserve the order of debug messages and print them fifo)

http://stackoverflow.com/q/26540725
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26540750
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26477744
tagged with: java
has answer: http://stackoverflow.com/a/26540750
has title: long running or blocking process cause my JFrame wait and halt other activity
type: Question
has body: Recursively list large number of files and directories in Java cause my JFrame wait and halt other activity if java listing a large file like C:// and D:// root, in my computer it would take approximately around 15 minutes. while java do the listing, it will halt my jframe from doing other activity because the program have to wait for the task to finish. i use this method for file listing File[] files = directory.listFiles(); how to make our jframe able to proceed with other activity while files listing still running ANSWER DETAIL : http://www.javacreed.com/swing-worker-example/

http://stackoverflow.com/comment/41870811
has text: i know the difference between OOP VS Procedural approach, my question is PHP OOP...
comment on: http://stackoverflow.com/q/26627369
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26520858
has body: Your problem isn't necessarily with your layout (while you're missing required attributes, it's likely you're getting these filled in for you by your IDE), it's with the definition of the ProgressBar. You're missing the required style attribute that tells the framework which widget to render. If you use this in your layout, the resulting effect (if it even starts) is this: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/my_text" /> <ProgressBar android:layout_width="209dp" android:layout_height="wrap_content" android:id="@+id/progressBar"/> Result: If you define the style attribute like the code below, your result will be much better: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/my_text" /> <ProgressBar style="@android:style/Widget.ProgressBar.Horizontal" android:layout_width="209dp" android:layout_height="wrap_content" android:id="@+id/progressBar" android:progress="35"/> Result:
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26516327

http://stackoverflow.com/q/26595860
has title: Save the result set of a query against a view to a table using the java client library
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41841370
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43755628
tagged with: java
tagged with: google-bigquery
has comment: http://stackoverflow.com/comment/41834459
has body: Recently, one of our clients reported not being able to create a table based on a query against a view. That said, they were able to save the result of a query against a table into another table. This issue spawned a more implementation focused question using the Java client libraries. Specifically, is there any way to save the result set of a query against a view to a table using the Java client library? I will be digging and post anything that I find. That said, any early guidance would be appreciated! To be specific and add more context, I note that the the following process failed when the query was run against a union view. java -jar BigQueryToCloudExporter.jar ./GAFastAccessKey.p12 '' " Select date(date_add('2014-08-09',floor(datediff(date(sec_to_timestamp(visitstarttime)),'2014-08-03')/7)*7,"DAY")) WeekEndDate , hits.eventinfo.eventaction GA_RentalNo , count(distinct visitID) PDP_PPC FROM (TABLE_DATE_RANGE([Union_View.GA], TIMESTAMP('2014-08-30'), TIMESTAMP('2014-09-13'))) where hits.eventinfo.eventcategory='property attributes' and brandId=121 --hits.eventinfo.eventcategory='property inquiry' and trafficsource.medium like '%cpc%' --and trafficsource.campaign not like '%ppb%' and trafficsource.campaign like '%mpm%' group each by WeekEndDate, GA_XXXXXX order by WeekEndDate, GA_XXXXXX limit 100" StagingQueryTable QueryTable AVRO gs://XXXXXX/QueryTable*.avro On the other hand, the following process succeeded when the query was made against a BigQuery table (keeping everything else same). java -jar BigQueryToCloudExporter.jar ./GAFastAccessKey.p12 '' " Select date(date_add('2014-08-09',floor(datediff(date(sec_to_timestamp(visitstarttime)),'2014-08-03')/7)*7,"DAY")) WeekEndDate , hits.eventinfo.eventaction GA_XXXXXX , count(distinct visitID) PDP_PPC FROM (TABLE_DATE_RANGE([XXXXXX.ga_sessions_], TIMESTAMP('2014-08-30'), TIMESTAMP('2014-09-13'))) where hits.eventinfo.eventcategory='property attributes' and brandId=121 --hits.eventinfo.eventcategory='property inquiry…
tagged with: google-cloud-platform

http://stackoverflow.com/q/26531158
possible better answer: http://stackoverflow.com/a/26531509
answer count: 2
has answer: http://stackoverflow.com/a/26531509
has answer: http://stackoverflow.com/a/26531334
accepted answer: http://stackoverflow.com/a/26531334
score: 0
has title: Spring Hibernate: Getting list of objects from a list of unique values
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I have a Customer object and it has three fields: ID (Primary key), Username (Unique key), Email. I also have a list of customer names, e.g. ["Bob", "Fred", "John"]. How can I get a list of customers, i.e. List&lt;Customer&gt; , where each customer corresponds to its name in first list?
tagged with: hql
type: Question

http://stackoverflow.com/a/26605486
has body: The ViewResolver registered in your application configuration is responsible for resolving pages from a given URL. Example: Config for resolving URLs like /welcome to corresponding JSP file /pages/welcome.jsp &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/pages/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; However, JSP pages are dynamic and need special handling. For static resources like plain html pages, it is sufficient to set up a static mapping for your pages folder. &lt;mvc:resources location="/pages/" mapping="/**" /&gt; This would result in all resources in the folder /pages being mapped to URLs starting with "/". For example: /pages/welcome.html would be accessible by http://yourdomain/welcome.html And if you want to set up a view resolver for one specific URL you can use a view-controller in the configuration: &lt;mvc:view-controller path="/wodi/welcome" view-name="/pages/webwelcome.html"/&gt; UPDATE: As you are using Spring Boot with @EnableAutoConfiguration you are already using the second method. Here you can see a code snippet from the AutoConfiguration implementation. It shows that a ResourceHandler is added to URL /** with some predefined locations. If you want custom URL mappings, I suggest you use one of the above mentioned methods in a plain Spring MVC configuration. Here is the documentation for enabling Spring MVC config. You can decide yourself if you use xml or annotation based configuration.
has comment: http://stackoverflow.com/comment/41824788
has comment: http://stackoverflow.com/comment/41827378
downvote count: 0
has comment: http://stackoverflow.com/comment/41862686
has comment: http://stackoverflow.com/comment/41832505
has comment: http://stackoverflow.com/comment/41824127
has comment: http://stackoverflow.com/comment/41832194
type: Answer
has comment: http://stackoverflow.com/comment/41829258
has comment: http://stackoverflow.com/comment/41823729
has comment: http://stackoverflow.com/comment/41826703
upvote count: 1
answers question: http://stackoverflow.com/q/26605182
score: 1

http://stackoverflow.com/a/45991504
answers question: http://stackoverflow.com/q/26614368
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26614368
score: 3
has body: Using GWT 2.8 JsInterop with MapBox GL JS goes like this: Add the css and js on your index page as per MapBox Tutorial Make the mapboxgl.Map available to your Java: @JsType(isNative = true, namespace = "mapboxgl") class Map { @JsOverlay private static long serial = 0L; @JsConstructor protected Map(JavaScriptObject options) { } @JsOverlay public static Map build(AbsolutePanel panel) { return Map.build(panel, new JSONObject()); } @JsOverlay public static Map build(AbsolutePanel panel, JSONObject mapOptions) { String id = "map" + serial++; mapOptions.put("container", new JSONString(id)); panel.getElement().setId(id); Map result = new Map(mapOptions.getJavaScriptObject()); return result; } } Later on you can add other Methods, Properties, Events to your Map class Use the parameter JSONObject mapOptions to set your map properties, for example: { center: [-122.420679, 37.772537], zoom: 13, style: 'mapbox://styles/mapbox/dark-v9' } Create a class that extends AbsolutePanel to become your Map Widget public class MapPanel extends AbsolutePanel { private static boolean accessTokenIsSet = false; Map map; JSONObject mapOptions; MapPanel instance; public MapPanel(int width, int height) { this(width, height, new MapOptions()); } public MapPanel(int width, int height, JSONObject mapOptions) { instance = this; this.mapOptions = mapOptions; if ( !accessTokenIsSet ) { setAccessToken(); accessTokenIsSet = true; } getElement().getStyle().setWidth(width, Unit.PX); getElement().getStyle().setHeight(height, Unit.PX); this.addEvents(); } private void addEvents() { addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if ( event.isAttached() ) { map = Map.build(instance, mapOptions); } } }); } private static native void setAccessToken() /*-{ mapboxgl.accessToken = '&lt;your-key&gt;'; }-*/; } Instantiate your MapPanel widget and add wherever needed JSONObject mapOptions = new JSONObject(); JSONArray center = new JSONArray(); center.set(0, ne…
upvote count: 3
has comment: http://stackoverflow.com/comment/133465371
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41809202
score: 0
type: AnswerComment
type: Comment
has text: Should I be using an "ArrayAdapter" instead?
comment on: http://stackoverflow.com/a/26595858

http://stackoverflow.com/comment/41953227
score: 0
type: Comment
type: QuestionComment
has text: I did: I've noticed that the method is not specified in the @RequestMapping, and the default is GET.
comment on: http://stackoverflow.com/q/26671281

http://stackoverflow.com/q/26656567
score: 1
possible better answer: http://stackoverflow.com/a/26656766
tagged with: java
linked to: http://stackoverflow.com/q/24449344
has answer: http://stackoverflow.com/a/27150523
has comment: http://stackoverflow.com/comment/41917269
tagged with: eclipse
has title: appcompat_v7 error in eclipse
type: Question
has answer: http://stackoverflow.com/a/26657587
tagged with: adt
answer count: 6
accepted answer: http://stackoverflow.com/a/26657587
has answer: http://stackoverflow.com/a/32615198
downvote count: 0
linked to: http://stackoverflow.com/q/26597149
favorite count: 0
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/26656766
has body: I am a newbie at android development.I created a new project but along with it appcompat_v7 also got created.Now my project does not run since appcompat_v7 has errors. The error is only in the appcompat_v7-> res-> values-v21-> style_base.xml on the following line with the description Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton' I have tried cleaning and rebuilding the project but the error persists.How do I fix this? Here is the appcompat_v7 -> res -> values-v21 -> styles.xml This file is the one with the error on line 75: Error: This is the file <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <eat-comment/> This is myproject -> res -> values -> styles.xml
has answer: http://stackoverflow.com/a/26657967
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27081810

http://stackoverflow.com/a/37045666
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26639317
has body: In my attempt to make a Custom Launcher myself, to make that result you needed to disable the default launcher, that i was able to do using KeyguardManager. package com.themejunky.locker.services; public class KeyguardService extends Service { BroadcastReceiver mReceiver, mBatteryReceiver; // Intent myIntent; public class LocalBinder extends Binder { public KeyguardService getService() { return KeyguardService.this; } } @Override public IBinder onBind(Intent intent) { return mBinder; } private final IBinder mBinder = new LocalBinder(); @Override public void onCreate() { KeyguardManager.KeyguardLock k1; KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE); k1 = km.newKeyguardLock("IN"); k1.disableKeyguard(); KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE); KeyguardManager.KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); lock.disableKeyguard(); IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.setPriority(999); mReceiver = new LockScreenReceiver(); registerReceiver(mReceiver, filter); mBatteryReceiver = new BatteryReceiver(); IntentFilter filter2 = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); filter2.addAction(Intent.ACTION_BATTERY_OKAY); filter2.addAction(Intent.ACTION_BATTERY_LOW); registerReceiver(mBatteryReceiver, filter2); super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { return START_STICKY; } @Override public void onDestroy() { unregisterReceiver(mReceiver); unregisterReceiver(mBatteryReceiver); super.onDestroy(); } }

http://stackoverflow.com/comment/41854219
has text: Sure. Let me see them
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26621389

http://stackoverflow.com/a/26534889
upvote count: 1
has comment: http://stackoverflow.com/comment/41695877
has body: That would be disk caching at work. The first read is coming off the disk. The second read is coming out of the disk cache. I've done performance testing on algorithms in the past. File IO and caching are always getting in the way or effecting results. You need to think about what sort of performance you're looking for. If you are testing a complete system, you would keep the file IO in there, but you need to flush caches to get consistent results. If you are testing an algorithm, keep all IO out of your timers. Move your 'startTime = System.nanoTime()' after reading the file.
answers question: http://stackoverflow.com/q/26534739
has comment: http://stackoverflow.com/comment/41696618
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41935828
has text: Please post that as an Answer and accept it. Perfectly okay to answer your own Question on StackOverflow. Acceptance closes this question.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26624278
type: Comment

http://stackoverflow.com/a/26550563
has body: You can only access static values in static method So you should change your non-static variables int x, y to static int x, y or you can access by creating an instance of your class as : public class B { int x,y; public static void main(String[] args) { B b=new B(); System.out.println(b.x+" "+b.y); } }
upvote count: 2
answers question: http://stackoverflow.com/q/26550342
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/26543633
has comment: http://stackoverflow.com/comment/41713905
tagged with: eclipse
answer count: 1
downvote count: 0
score: 1
tagged with: tomcat
favorite count: 0
has title: Hibernate SessionFactory Mappings is not reloaded
tagged with: spring
has comment: http://stackoverflow.com/comment/41713616
type: AnsweredQuestion
has body: I'm using Hibernate with this SessionFactory configuration <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> mappings/File1.hbm.xml org.hibernate.dialect.Oracle10gDialect thread org.hibernate.cache.NoCacheProvider false validate 2 3 300 50 3000 It works fine until I add one more XML mapping file as follows: mappings/File1.hbm.xml mappings/File2.hbm.xml The added mapping "File2.hbm.xml" is not affected at all. I even try to set the class in "File2.hbm.xml" with an invalid name but there is no error shown in Hibernate (When I do that in "File1.hbm.xml", there is exception). Could you tell me why the mapping "File2.hbm.xml" is not affected? I use Eclipse and Tomcat, does it cache some where. I already tried to clean Tomcat and restart my PC but it does not help. Thank you in advance!
has answer: http://stackoverflow.com/a/28291615
tagged with: java
tagged with: hibernate
upvote count: 1
has comment: http://stackoverflow.com/comment/41712589
type: Question
accepted answer: http://stackoverflow.com/a/28291615

http://stackoverflow.com/q/26643045
favorite count: 0
upvote count: 8
has body: Suppose I've got this Scala trait: trait UnitThingy { def x(): Unit } Providing a Java implementation is easy enough: import scala.runtime.BoxedUnit; public class JUnitThingy implements UnitThingy { public void x() { return; } } Now let's start with a generic trait: trait Foo[A] { def x(): A } trait Bar extends Foo[Unit] The approach above won't work, since the unit x returns is now boxed, but the workaround is easy enough: import scala.runtime.BoxedUnit; public class JBar implements Bar { public BoxedUnit x() { return BoxedUnit.UNIT; } } Now suppose I've got an implementation with x defined on the Scala side: trait Baz extends Foo[Unit] { def x(): Unit = () } I know I can't see this x from Java, so I define my own: import scala.runtime.BoxedUnit; public class JBaz implements Baz { public BoxedUnit x() { return BoxedUnit.UNIT; } } But that blows up: [error] .../JBaz.java:3: error: JBaz is not abstract and does not override abstract method x() in Baz [error] public class JBaz implements Baz { [error] ^ [error] /home/travis/tmp/so/js/newsutff/JBaz.java:4: error: x() in JBaz cannot implement x() in Baz [error] public BoxedUnit x() { [error] ^ [error] return type BoxedUnit is not compatible with void And if I try the abstract-class-that-delegates-to-super-trait trick: abstract class Qux extends Baz { override def x() = super.x() } And then: public class JQux extends Qux {} It's even worse: [error] /home/travis/tmp/so/js/newsutff/JQux.java:1: error: JQux is not abstract and does not override abstract method x() in Foo [error] public class JQux extends Qux {} [error] ^ (Note that this definition of JQux would work just fine if Baz didn't extend Foo[Unit].) If you look at what javap says about Qux, it's just weird: public abstract class Qux implements Baz { public void x(); public java.lang.Object x(); public Qux(); } I think the problems here with both Baz and Qux have to be scalac bugs, but is there a workaround? I don't really care about the Baz part, but is there any w…
accepted answer: http://stackoverflow.com/a/26643803
tagged with: generics
score: 8
tagged with: scala
tagged with: boxing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26643803
type: Question
has title: Java interoperability woes with Scala generics and boxing
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41698393
has text: @StephenB .. maybe. Let's hope so.
type: Comment
comment on: http://stackoverflow.com/a/26536216
score: 0
type: AnswerComment

http://stackoverflow.com/comment/83056103
type: Comment
has text: (event.isPrimaryButtonDown() && event.getClickCount() == 2) is always false
comment on: http://stackoverflow.com/a/26564412
type: AnswerComment
score: 0

http://stackoverflow.com/q/26642051
has title: Credit Card Number validity with Luhn's Algorithm (Java)
has comment: http://stackoverflow.com/comment/41891143
linked to: http://stackoverflow.com/q/20725761
has comment: http://stackoverflow.com/comment/41890847
upvote count: 3
possible better answer: http://stackoverflow.com/a/26642177
type: Question
type: AnsweredQuestion
score: 3
tagged with: algorithm
tagged with: java
answer count: 2
tagged with: luhn
has body: I'm working on a school assignment that checks whether a credit card number that is entered is valid or not, using Luhn's Algorithm. In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. The algorithm is useful to determine whether a card number is entered correctly or whether a credit card is scanned correctly by a scanner. Credit card numbers are generated following this validity check, commonly known as the Luhn check or the Mod 10 check, which can be described as follows (for illustration, consider the card number 4388 5760 1840 2626): Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. Now add all single-digit numbers from Step 1: 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 Add all digits in the odd places from right to left in the card number: 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 Sum the results from Step 2 and Step 3: 37 + 38 = 75 If the result from Step 4 is divisible by 10 the card number is valid; otherwise, it is invalid. For example, the number 4388 5760 1840 2626 is invalid, but the number 4388 5760 1841 0707 is valid. I need to write this program using the methods in the code I have written: public class CreditCardValidation { public static void main(String[] args, long input) { Scanner numberinput = new Scanner(System.in); System.out.println("Enter a credit card number as a long integer: "); long cardnumber = numberinput.nextLong(); if (isValid(input) == true) { System.out.println(numberinput + " is valid."); } else { System.out.println(numberinput + " is invalid."); } } public static boolean isValid(long number){ int total = sumOfDoubleEvenPlace + sumOfOddPlace; return (total % 10 == 0) &amp;&amp; (prefixMatched(number, 1) == true) &amp;&amp; (getSize(number)&gt;=13) &amp;&amp; (getSize(number)&lt;=16); } public static int sumOfDoubleEvenPlace(long number) { int doubledevensum = 0; long place = 0; while (number &gt; 0) { place = numb…
has answer: http://stackoverflow.com/a/26642177
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26642112
accepted answer: http://stackoverflow.com/a/26642112

http://stackoverflow.com/comment/41715027
type: Comment
has text: The reason I had the String.valueOf here is because I couldnt use int == null
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26546028

http://stackoverflow.com/comment/41833922
comment on: http://stackoverflow.com/q/26610242
type: Comment
type: QuestionComment
has text: `[computers]` -> `Cars` in your example. Are we turning computers into cars? Is it a typo?
score: 0

http://stackoverflow.com/q/26535614
favorite count: 0
has comment: http://stackoverflow.com/comment/41709096
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: orm
type: Question
has body: I am new to ORM (EclipseLink), and am wondering what is the best practice in a case like this? I know that we're stuck with the legacy column names on existing tables, but what about new entities? For example, do most people generate the underlying DB table using customer_id or customerid, in the case below? I like having them the same name, but it might look odd to our Oracle DBA. Just want to go with the flow. public class Invoice { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "invoice_id", unique = true, nullable = false) private long invoiceId; @Column(name = "customer_id", length = 25, nullable = false) private String customerId; }
has title: JPA Naming Convention
has answer: http://stackoverflow.com/a/26536008
upvote count: 1
tagged with: jpa
answer count: 1

http://stackoverflow.com/comment/41902793
type: QuestionComment
has text: terminate the thread
score: 0
comment on: http://stackoverflow.com/q/26649122
type: Comment

mouseevent
tags question: http://stackoverflow.com/q/26524856
tags question: http://stackoverflow.com/q/26594609
type: Tag
tags question: http://stackoverflow.com/q/26516415
tag name: mouseevent
tags question: http://stackoverflow.com/q/26547731

http://stackoverflow.com/a/26638818
has body: Don't make Shapes a JPanel. Also take out its paintComponent method. Instead have a JPanel class which is the main drawing surface. Keep the List&lt;Shapes&gt; in the class. Iterate through the list in the paintComponent method of that class, calling each Shapes's draw method class DrawingPanel extends JPanel { List&lt;Shapes&gt; shapes; // add shapes protected void paintComponent(Graphics g) { super.paintComponent(g); for (Shapes shape: shapes) { shape.draw(g); } } } Then just add that panel to the frame. Remember that all painting should be done with the Graphics context passed into the paintComponent method. We do not do custom painting by using getGraphics. Also you'll probably want to store some state in the Shapes class so you can change the x/y/width/height state. Right now you are are using the same hard coded values for all your shapes. abstract class Shapes { int x, y; public Shapes(int x, int y) { this.x = x; this.y = y; } protected abstract void draw(Graphics g); } class RectangleShape extends Shape { int width, height; public RectangleShape(int x, int y, int width, int height) { super(x, y); this.width = width; this.height = height; } @Override public void draw(Graphics g) { g.fillRect(x, y, width, height); } } See a complete example with more complex objects with animation
has comment: http://stackoverflow.com/comment/41885045
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26638620
has comment: http://stackoverflow.com/comment/41884956

h2
tags question: http://stackoverflow.com/q/26529033
type: Tag
tag name: h2
tags question: http://stackoverflow.com/q/26667249
tags question: http://stackoverflow.com/q/26575689
tags question: http://stackoverflow.com/q/26580787
tags question: http://stackoverflow.com/q/26634808
tags question: http://stackoverflow.com/q/26651095

http://stackoverflow.com/a/26659013
upvote count: 1
has comment: http://stackoverflow.com/comment/41920257
type: Answer
has comment: http://stackoverflow.com/comment/41920701
has comment: http://stackoverflow.com/comment/41920471
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26658903
has body: What are you expecting to return from your get method? In java, ArrayList already has a get on it.. in C# also has a get defined on ArrayList but it is used differently. I mean... if you are using an ArrayList this would be totally pointless and wrong... And i'm guessing your instructor wouldn't find it funny if you did: public Object get(int i) { return myArrayList.get(i); } or i mean you could beat around the bush and do this: public Object get(int i) { Object[] myArray = new Object[myArrayList.size()]; myArray = myArrayList.toArray(myArray ); return myArray[i]; }

http://stackoverflow.com/a/26547584
answers question: http://stackoverflow.com/q/26547467
has comment: http://stackoverflow.com/comment/41731642
has comment: http://stackoverflow.com/comment/41719303
has comment: http://stackoverflow.com/comment/41721324
score: 3
has comment: http://stackoverflow.com/comment/41720853
upvote count: 3
has comment: http://stackoverflow.com/comment/41721261
downvote count: 0
has comment: http://stackoverflow.com/comment/41718882
has comment: http://stackoverflow.com/comment/41721108
type: Answer
has body: That very much depends on what parts of the java.util.concurrent package you use (and to a lesser degree on the implementation). E.g. the LinkedBlockingQueue as of Java 1.7 uses both ReentrantLocks and Conditions, while e.g. the java.util.concurrent.atomic classes or the CopyOnWrite* classes rely on volatiles + native methods (that insert the appropriate memory barriers). The actual native implementation of Locks, Semaphores, etc. also varies between architectures and implementations. Edit: If you really care about performance, you should measure performance of your specific workload. There are folks far more clever than me like A. Shipilev (whose site is a trove of information on this topic) on the JVM team, who do this and care deeply about JVM performance.

http://stackoverflow.com/a/26607911
upvote count: 1
answers question: http://stackoverflow.com/q/26607818
downvote count: 0
type: Answer
score: 1
has body: You can't easily do this in ordinary Java, though OSGi makes it possible. The better way is usually to create a separate API library with interfaces and have your "private" classes implement those interfaces. Then client code can use the interfaces to interact with your library but doesn't need to be aware of the particulars.

http://stackoverflow.com/a/26642604
downvote count: 1
has comment: http://stackoverflow.com/comment/41891912
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/26642544
type: Answer
has body: My wrong, it will work better with "!=" "quit.compareTo(guess)!=0" in your while

http://stackoverflow.com/comment/41695242
comment on: http://stackoverflow.com/a/26534291
score: 0
has text: So, in a nutshell you should make sure you can connect to Zookeeper servers on port 2181 and to HBase Master on port 60000. Namenode and datanodes have nothing to do with it.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41877068
comment on: http://stackoverflow.com/q/26634689
has text: Are you asking about how to invoke a (static) method using its name provided as String, i.e using Reflection?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41795915
comment on: http://stackoverflow.com/a/26580020
has text: I had looked at suggestion #1, but suggestion #2 might provide the functionality I need! Will definitely try.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26563282
type: Question
tagged with: facebook
tagged with: java
has answer: http://stackoverflow.com/a/26738983
upvote count: 1
has title: facebook4j how to getPictureURL size 480x480?
answer count: 1
has body: From API graph it is possible to get profile picture of 480x480 and also 640x640, it is possible to do the same thing with facebook4j? the enum PictureSize.large is 200x200 ...
accepted answer: http://stackoverflow.com/a/26738983
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42063467
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41864155

http://stackoverflow.com/a/26533912
has body: You don't need to do anything. Just leave the code as below: answer.setText("The Answer is: " + ans2); And similar to next one. You cannot use toString() or any methods on primitive data types. Remember: Methods are defined inside a class. So to use method, the variable must first be an object. Edited: You can also do answer.setText("The Answer is: " + String.valueOf(ans2));
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26533870

http://stackoverflow.com/a/26574152
has body: Actually, I have a theory - your Scanner code is working just fine, it's your binary search code that's broken. Whatever it's doing works on an input of 5 but falls into an infinite loop for other inputs. Consider breaking up your input parsing code from your binary searching code (e.g. do input parsing in main() and define a binarySearch() function that main() calls) so that you can test them separately.
score: 0
has comment: http://stackoverflow.com/comment/41803299
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26563849
answers question: http://stackoverflow.com/q/26563849

http://stackoverflow.com/q/26522615
has body: I'm using this in my driver a.indexFinder(4) and also a.indexFinder(2) if the element is not in the array then we are to return a -1 This code work when the index is 5(i get a -1) because 5 is not in the array. but for 4 it is giving me the index for the first 4.i want the last 4. int[] array = {2, 8, 8, 3, 4, 4, 4, 7}; //im suppose to find the index of the last 4. int index = 4; //4 or 5(return -1 when element is not found) public int findLast(int index) //this method is in my class { for(int index = 0; index &lt; a.length; index++) { if (a[index]== key) return index; } return -1; }
tagged with: indexing
tagged with: java
tagged with: class
type: Question
has answer: http://stackoverflow.com/a/26522679
score: 0
answer count: 2
upvote count: 1
has title: how to get the last index of element. (element is repeated a few times) JAVA
downvote count: 1
tagged with: arrays
favorite count: 0
tagged with: driver
has answer: http://stackoverflow.com/a/26522747
type: UnansweredQuestion

http://stackoverflow.com/comment/41887942
comment on: http://stackoverflow.com/q/26640526
has text: `new TreeMap(unsortedMap)` should work.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41796838
score: 0
type: QuestionComment
has text: @Duncan - you completely put all the comments out context without improving the quality of the question just like my edit comment states.
type: Comment
comment on: http://stackoverflow.com/q/26590453

http://stackoverflow.com/q/26569409
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26569676
has comment: http://stackoverflow.com/comment/41757968
has answer: http://stackoverflow.com/a/26569449
tagged with: arrays
tagged with: type-conversion
answer count: 2
has body: I have a client server Java code and the client is reading in a string "input" and it should then decrypt it, the decryption function needs an array of bytes, so I need to convert the string to array of bytes, which is done using "getBytes()" function, however it seems that this function is modifying the String! How can I convert the string into an array of bytes without changing its content. String input = inputline.substring(66, inputline.length()); System.out.println("Read message +"+input+"+"); byte[] bx = input.getBytes(Charset.forName("UTF-8")); System.out.println("Read message +"+bx.toString()+"+"); System.out.println("Read message +"+bx+"+"); the output of the code snippet is as follows: Read message +[B@161cd475+ Read message +[B@4e25154f+ Read message +[B@4e25154f+
has comment: http://stackoverflow.com/comment/41757897
has title: Java String to array of bytes wrong conversion
tagged with: string
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/41891526
comment on: http://stackoverflow.com/q/26641809
type: Comment
type: QuestionComment
has text: fge is correct. The first two sentences of the [documentation](http://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.html) couldn't be clearer: “Utility class for HTML form encoding. This class contains static methods for converting a String to the application/x-www-form-urlencoded MIME format.” Using URLEncoder for query parameters in a URL is wrong. I know it looks similar but it's not correct. The correct way to encode a query is with any java.net.URI constructor that takes more than one argument.
score: 0

http://stackoverflow.com/a/49216346
upvote count: 1
has comment: http://stackoverflow.com/comment/104809974
downvote count: 0
answers question: http://stackoverflow.com/q/26548505
type: Answer
has body: For those working with AWS MySQL RDS, it may occur when you are unable to connect to the database. Go to AWS Security Groups setting for MySQL RDS and edit the inbound IP rule by refreshing MyIP. I faced this issue and doing above got the problem fixed for me.
score: 1

http://stackoverflow.com/comment/41886056
has text: Yes, and post `login.jsp`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26638834
type: Comment

http://stackoverflow.com/a/26660093
score: -1
has body: @Named(value = "controladorMB") @SessionScoped public class ControladorMB implements Serializable {} call ControladorMB from ListadoFacturasMB @Named(value = "listadoFacturasMB") @SessionScoped public class ListadoFacturasMB implements Serializable { public void example() { try { FacesContext ctx = FacesContext.getCurrentInstance(); ValueExpression vex =ctx.getApplication().getExpressionFactory().createValueExpression(ctx.getELContext(), "#{controladorMB}", ControladorMB.class); ControladorMB gMB = (ControladorMB) vex.getValue(ctx.getELContext()); } catch (Exception e) { JsfUtil.addErrorMessage(e, "Error: buscarPersonalizado() " + e.getMessage()); } } }
has comment: http://stackoverflow.com/comment/41940933
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/26657368
type: Answer

http://stackoverflow.com/comment/41707675
type: AnswerComment
has text: @user949300 **Accuracy > Performance.** I have a habit of using [BigDecimal](http://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html) in my usual projects working with money and such where accuracy is required. If this scientific data could tolerate the inaccuracy of floating-point drift, then go for it. Might be faster, though for a total execution time of less than a second I would consider that [premature optimization](http://en.wikipedia.org/wiki/Program_optimization).
type: Comment
comment on: http://stackoverflow.com/a/26541475
score: 1

http://stackoverflow.com/q/26637225
accepted answer: http://stackoverflow.com/a/26637350
has body: I don't know why I can't find the answer to this, but I need to pass a blank UUID object in one of my functions to represent a lack of UUID. What is the UUID analagous form of val x: "" , which would be an empty string. I'm essentially trying to get an empty UUID. I tried UUID.fromString("") but received an error, as you need a valid UUID string. EDIT: I am implementing this in Scala.
downvote count: 0
possible better answer: http://stackoverflow.com/a/26637347
favorite count: 0
score: 24
type: Question
tagged with: scala
has comment: http://stackoverflow.com/comment/41882998
tagged with: uuid
tagged with: java
answer count: 2
upvote count: 24
has answer: http://stackoverflow.com/a/26637350
has answer: http://stackoverflow.com/a/26637347
has title: How can I create an empty java.util.UUID object?
type: AnsweredQuestion

http://stackoverflow.com/comment/41974834
type: Comment
type: QuestionComment
has text: now I see I described my problem not very clear, because this is a huge project, and I simplified teh code wrongly
score: 0
comment on: http://stackoverflow.com/q/26653572

http://stackoverflow.com/comment/47372632
has text: Just tested this, using curl and it uploaded the whole file Used: glyn$ curl -i -X PUT --data-binary @test.txt localhost:8080/upload/wibble
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26592787
type: Comment

http://stackoverflow.com/comment/42108668
has text: System.exit(0) terminates the JVM. This sometimes causes various null-pointer and system exceptions as background threads try to access resources as they are being released. If you have a background thread writing to a file, for example, just calling System.exit() could cause problems. Usually it's not a big deal, but if you are logging output, you might end up with a bunch of extraneous exceptions that make it difficult to tell between a crash and a user exit.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26557938

http://stackoverflow.com/comment/41755889
type: Comment
comment on: http://stackoverflow.com/a/26568248
has text: Regardless, creating that array will take time, time the OP is already pressed for. Perhaps I misspoke, the OP is concerned about time, and every unnecessary action is detrimental to the OP, if you look at my answer, a little type-casting quickly solved the issue of permitted responses without going overboards
score: 0
type: AnswerComment

http://stackoverflow.com/comment/131846263
type: AnswerComment
comment on: http://stackoverflow.com/a/47200160
type: Comment
has text: This is a good example for sending a request with a certificate. OP is talking about already having a controller that receives requests (with certificates) from clients not making API calls with a certificate as your solution presents.
score: 0

http://stackoverflow.com/a/26659545
upvote count: 1
has comment: http://stackoverflow.com/comment/41921659
has comment: http://stackoverflow.com/comment/41921740
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26658648
has body: I don't have enough theory knowledge to prove that this is context-free grammar. While regex flavors in the wild is known to match context-sensitive grammar, without recursive (Perl/PCRE) or balancing group (.NET), regex can't solve simple problems in context-free such as bracket balancing. By the way, this is the grammar: S -&gt; 'g' | 'h' | ... | 'p' S -&gt; 'A' S S -&gt; ( 'F' | 'D' | 'Q' | 'X' ) S S Usually, for such cases, it is better to write a parser. However, for toy problems, you can use regex to replace from the lowest level up and reduce the structure at the leaves A[g-p] or [FDQX][g-p]{2} to g (which represents a valid sentence). public static boolean checkGrammar(String input) { String prev = input; while (!(input = input.replaceAll("A[g-p]|[FDQX][g-p]{2}", "g")).equals(prev)) { prev = input; } return input.matches("[g-p]"); } Demo on ideone
type: Answer

http://stackoverflow.com/comment/41775420
type: QuestionComment
comment on: http://stackoverflow.com/q/26578917
has text: You can't, basically, the icon is supplied by the file association within the OS, you couldn't change the icons shown by the OS for a Word Document. You could create a shortcut, but this OS specific and would require some JNI/JNA or you could create an executable wrapper, which would allow you to specify the icon of the executable, but again, this is OS specific
score: 0
type: Comment

http://stackoverflow.com/q/26513747
has title: Efficient way to find min value in Map
tagged with: min
has comment: http://stackoverflow.com/comment/41657418
linked to: http://stackoverflow.com/q/6273833
has answer: http://stackoverflow.com/a/58071298
has comment: http://stackoverflow.com/comment/41658561
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/26514245
type: UnansweredQuestion
tagged with: dictionary
has comment: http://stackoverflow.com/comment/41658906
has comment: http://stackoverflow.com/comment/41658170
has comment: http://stackoverflow.com/comment/41657453
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26513812
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/41658260
has answer: http://stackoverflow.com/a/26514213
answer count: 6
has answer: http://stackoverflow.com/a/58071211
has comment: http://stackoverflow.com/comment/41658156
has body: I am trying to find key with minimum value in Map shown below. Map&lt;Node, Integer&gt; freeMap = new TreeMap&lt;&gt;(); Node minNode = null; for (Map.Entry&lt;Node, Integer&gt; entry : freeMap.entrySet()) { if (minNode == null) { minNode = entry.getKey(); } else { if (entry.getValue() &lt; freeMap.get(minNode)) { minNode = entry.getKey(); } } } Firstly, Is there a straight forward way to find key with minimum value than using foreach loop. Secondly, can you suggest some alternate data structure approach which can be used to store a Node object and an associated Integer value, so I can fetch entry with minimum value in constant time O(1).
has answer: http://stackoverflow.com/a/26514119

http://stackoverflow.com/q/26567234
score: 0
tagged with: java
answer count: 1
has title: Returning to Activity after playing video in external Video Player
type: UnansweredQuestion
tagged with: android-video-player
has answer: http://stackoverflow.com/a/26567326
has body: Wit this code i start an external video player and play video: public class MenuActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); l_video.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String file_name="34743773"; File path = new File(Environment.getExternalStorageDirectory() + File.separator + "AAAAA"+ File.separator +file_name+".mp4"); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(path))); intent.setDataAndType(Uri.parse(String.valueOf(path)), "video/*"); startActivity(intent); } }); } } My problem is that when playing of video end's, entire App closes! i want that only video player closes and control goes back to my App activity. What i have to do?
type: Question
tagged with: android
tagged with: android-intent
has comment: http://stackoverflow.com/comment/41753782

http://stackoverflow.com/q/26611383
has answer: http://stackoverflow.com/a/26617980
type: Question
tagged with: powershell
has answer: http://stackoverflow.com/a/47469129
accepted answer: http://stackoverflow.com/a/26617980
tagged with: scripting
downvote count: 0
has comment: http://stackoverflow.com/comment/41835527
has title: Powershell script to update Java to latest version
favorite count: 0
has comment: http://stackoverflow.com/comment/41842329
has body: We have an application that is Java dependent that we are working on a SCCM installer to push out to clients. Due to Java being updated almost monthly (and the old updates expiring 30 days thereafter) we're looking for a way to have the SCCM installer stay updated with the latest Java version. We have the ability to run a Powershell script from our SCCM installer, but we haven't found a way to write a script that will automatically download and install the latest Java version. Does anyone know if this is possible, and how we could go about it? Thanks in advance!!
possible better answer: http://stackoverflow.com/a/26612927
tagged with: sccm
has answer: http://stackoverflow.com/a/26612927
answer count: 4
has answer: http://stackoverflow.com/a/76856594
has comment: http://stackoverflow.com/comment/41841830
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/26516091
answer count: 1
tagged with: compiler-optimization
has title: Compiler optimization of method calls
favorite count: 0
linked to: http://stackoverflow.com/q/8256202
has comment: http://stackoverflow.com/comment/41662137
has body: Does the Java compiler apply some transformations to optimize method calls? Or does it always generate a faithful representation of the source with simple optimizations like removing dead code? Specifically if we have the below example: public static void main(String[] args) { System.out.println(foo()); System.out.println(foo()); System.out.println(foo()); System.out.println(bar()); System.out.println(bar()); System.out.println(bar()); } public static int foo() { int[] arr = {1, 2, 3, 4}; return arr[0]; } public static int bar() { return 10; } Does the compiler attempt to replace the call to bar (or even possibly foo) with a call to print the integer 10? public static void main(String[] args) { System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(10); System.out.println(10); System.out.println(10); } I know of a method called inlining that can lead to such transformations, but I was wondering if the Java compiler (at least the javac of the Oracle JDK) applies it, or if it's always deferred to the JVM.
has answer: http://stackoverflow.com/a/26516248
type: AnsweredQuestion
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/2096361
type: Question
has comment: http://stackoverflow.com/comment/41662097
tagged with: performance
accepted answer: http://stackoverflow.com/a/26516248
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41662157

http://stackoverflow.com/q/26588439
has answer: http://stackoverflow.com/a/32433166
upvote count: 7
accepted answer: http://stackoverflow.com/a/26588517
type: Question
tagged with: jakarta-ee
has body: I have converted my java web project to maven project using m2e plugin in eclipse. Now i need to convert it back to java web project. So now how it is possible to change it back to java web project.
tagged with: eclipse
has answer: http://stackoverflow.com/a/26588517
possible better answer: http://stackoverflow.com/a/50832725
answer count: 3
has comment: http://stackoverflow.com/comment/41791831
downvote count: 0
favorite count: 0
tagged with: maven
has title: How to convert back maven project to java web project
has comment: http://stackoverflow.com/comment/41792233
has answer: http://stackoverflow.com/a/50832725
type: AnsweredQuestion
score: 7
tagged with: java

spring-test
tags question: http://stackoverflow.com/q/26564751
tag name: spring-test
type: Tag
tags question: http://stackoverflow.com/q/26582977

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26668374
tags question: http://stackoverflow.com/q/26623568
tags question: http://stackoverflow.com/q/26670072
tags question: http://stackoverflow.com/q/26581060
tag name: deserialization
tags question: http://stackoverflow.com/q/26606089
tags question: http://stackoverflow.com/q/26565468
tags question: http://stackoverflow.com/q/26598397
tags question: http://stackoverflow.com/q/26547655

http://stackoverflow.com/q/26547127
tagged with: android
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: libgdx
has body: I have this issue in my LibGDX project, I essentially can't load up my gamescreen, I am following a YouTube tutorial (link to particular tutorial I'm on: https://www.youtube.com/watch?v=LSblkR4K1LU), and I have found that my sprite that is supposed to go on my screen, just it won't load up at all, it just opens, closes then pops this up: http://puu.sh/coxUv/d877d08a83.png, I will admit the only thing I have changed from the video was this: @Override public void render(float delta) { Gdx.gl.glClearColor(1F, 1F, 1F, 1F); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); I changed GL10.GL_COLOR_BUFFER_BIT (that was in the video), to GL20.GL_COLOR_BUFFER_BIT, because it gave me an error: GL10 cannot be resolved to a variable, does anyone have an idea why, tell me if there is any needed information. Thanks in advance. EDIT: Gamescreen Class: package com.edac.unforgivingunderground; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class GameScreen implements Screen{ UnforgivingUnderground game; OrthographicCamera camera; SpriteBatch batch; public GameScreen(UnforgivingUnderground game){ this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false,1920,1080); batch = new SpriteBatch(); } @Override public void render(float delta) { Gdx.gl.glClearColor(1F, 1F, 1F, 1F); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); } @Override public void resize(int width, int height) { // TODO Auto-generated method stub } @Override public void show() { // TODO Auto-generated method stub } @Override public void hide() { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } Assets Class: package com.edac.unfo…
has comment: http://stackoverflow.com/comment/41734697
tagged with: eclipse
has title: LibGDX Sprite Screens not loading graphics, or loading up screens
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41717178
has answer: http://stackoverflow.com/a/26563251
type: UnansweredQuestion

http://stackoverflow.com/a/58071298
has comment: http://stackoverflow.com/comment/134633451
type: Answer
has body: The keys for a concise, efficient and elegant solution here are the Collections#min method and the Map.Entry#comparingByValue method The first method can be applied to the entrySet of the map, and the second one provides a Comparator that compares map Entry objects by their value. So the solution is a one-liner, and you can either obtain the entry or the key directly, as shown in this example: import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; public class KeyWithMinValue { public static void main(String[] args) { Map&lt;String, Integer&gt; map = new LinkedHashMap&lt;String, Integer&gt;(); map.put("Zero", 0); map.put("One", 1); map.put("Two", 2); map.put("Three", 3); map.put("Four", 4); // Obtain the entry with the minimum value: Entry&lt;String, Integer&gt; entryWithMinValue = Collections.min( map.entrySet(), Entry.comparingByValue()); System.out.println(entryWithMinValue); // Or directly obtain the key, if you only need that: String keyWithMinValue = Collections.min( map.entrySet(), Entry.comparingByValue()).getKey(); System.out.println(keyWithMinValue); } }
has comment: http://stackoverflow.com/comment/134583350
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26513747
downvote count: 0

http://stackoverflow.com/comment/41776282
comment on: http://stackoverflow.com/q/26579506
type: Comment
has text: I believe it came before generics.
score: 1
type: QuestionComment

linked-list
tags question: http://stackoverflow.com/q/26624087
tags question: http://stackoverflow.com/q/26520127
tags question: http://stackoverflow.com/q/26600378
tag name: linked-list
tags question: http://stackoverflow.com/q/26646719
tags question: http://stackoverflow.com/q/26660554
type: Tag
tags question: http://stackoverflow.com/q/26641098
tags question: http://stackoverflow.com/q/26667344
tags question: http://stackoverflow.com/q/26657324
tags question: http://stackoverflow.com/q/26562973
tags question: http://stackoverflow.com/q/26519978
tags question: http://stackoverflow.com/q/26616589
tags question: http://stackoverflow.com/q/26565079
tags question: http://stackoverflow.com/q/26547980
tags question: http://stackoverflow.com/q/26520974
tags question: http://stackoverflow.com/q/26646795
tags question: http://stackoverflow.com/q/26667137
tags question: http://stackoverflow.com/q/26532871

http://stackoverflow.com/a/26547616
has body: You should check your path from the command line. I have multiple JDKs and JREs installed and if needed (for an old application), I change my path. Go to your command like, type path and hit enter. Also, in order to see the JAVA_HOME, type echo %JAVA_HOME% in your command line. Check exactly which version of java is still installed on your system. Then find it in the control panel and remove it. Please provide feedback. The more extreme solutions would be: Try another uninstaller such as revo uninstaller (I am not affiliated with them). Remove the directory, also the entries in your environmental variables (path, etc). Option 2 is the last solution and not the best.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26547403

http://stackoverflow.com/comment/41695092
has text: Exactly! Unsafe is not a documented JDK class. If you want to compare with something, compare with the `locks` in java.util.concurrent.locks
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26534489
type: Comment

http://stackoverflow.com/comment/42050572
type: Comment
comment on: http://stackoverflow.com/a/26671700
has text: @NavishSharma-i have now added that request mapping. the only other request mapping is for 'home' and that looks exactly the same as the code for 'welcome', just the word home replaces the word welcome on all instances.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41869501
type: Comment
type: QuestionComment
score: 0
has text: When I remember right, reinventing the wheel, was the only solution I found for this problem one year ago.
comment on: http://stackoverflow.com/q/26630095

http://stackoverflow.com/a/26617526
has body: It depends a lot on what you are trying to achieve One option is to keep 3 different maps: Map&lt;String, Integer&gt; Map&lt;String,Marker&gt; Map&lt;String,LatLng&gt; Another option is to make a: Map&lt;String,Object&gt; However you will have to 'instanceof' to check the real type, which is not a best practice.
answers question: http://stackoverflow.com/q/26617160
type: Answer
score: 0

http://stackoverflow.com/comment/41891847
score: 0
type: QuestionComment
type: Comment
has text: You say type `QUIT`, but `equals()` doesn't ignore case. Also, if you want the loop to run _until_ someone types quit, you would probably want a `!` in the condition instead...
comment on: http://stackoverflow.com/q/26642544

http://stackoverflow.com/q/26570846
favorite count: 0
has title: Python Change Output Folder of Java Executable
has answer: http://stackoverflow.com/a/26583425
has body: So I'm working on a basic multipurpose script which allows you to run minecraft server .jar files in python. Here is my current code: def run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return iter(p.stdout.readline, b'') for output_line in run_command('java -jar jar\\minecraft.jar'): print(output_line) Also here is my current file layout: /exec.py /jar/jarfile.jar So you can see it runs the jar file but the thing is when the jar file is run it creates all these files and folders for all the server stuff, but all the files get created in the main directory as the script running it but I want them to be created in the jar folder or another folder of my choice, so how would I get this? I've looked all over and can't find anything to match my problem.
tagged with: python
has answer: http://stackoverflow.com/a/26570943
type: AnsweredQuestion
tagged with: subprocess
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26583425
possible better answer: http://stackoverflow.com/a/26570943
type: Question
answer count: 2
tagged with: minecraft
downvote count: 0

http://stackoverflow.com/a/26734064
type: Answer
has body: The official documentation shows an example : Programatically Adding to the Current Configuration final LoggerContext ctx = (LoggerContext) LogManager.getContext(false); final Configuration config = ctx.getConfiguration(); Layout layout = PatternLayout.createLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN, config, null, null,null, null); Appender appender = FileAppender.createAppender("target/test.log", "false", "false", "File", "true", "false", "false", "4000", layout, null, "false", null, config); appender.start(); config.addAppender(appender); AppenderRef ref = AppenderRef.createAppenderRef("File", null, null); AppenderRef[] refs = new AppenderRef[] {ref}; LoggerConfig loggerConfig = LoggerConfig.createLogger("false", "info", "org.apache.logging.log4j", "true", refs, null, config, null ); loggerConfig.addAppender(appender, null, null); config.addLogger("org.apache.logging.log4j", loggerConfig); ctx.updateLoggers(); With these limitations : If the configuration file is changed the configuration will be reloaded and the manual changes will be lost. Modification to the running configuration requires that all the methods being called (addAppender and addLogger) be synchronized. This solution avoids to use method from the core implementation org.apache.logging.log4j.core.Logger, and it avoids dirty cast like that : import org.apache.logging.log4j.Logger; Logger logger = (Logger) LogManager.getLogger(this.getClass()); ((org.apache.logging.log4j.core.Logger) logger).addAppender(...); // Bypassing the public API
has comment: http://stackoverflow.com/comment/82784344
accepted answer of: http://stackoverflow.com/q/26668938
type: AcceptedAnswer
score: 27
answers question: http://stackoverflow.com/q/26668938
upvote count: 27
downvote count: 0

http://stackoverflow.com/comment/41665736
comment on: http://stackoverflow.com/q/26517876
score: 0
has text: AFAIK the jar generated for your dao layer can have its own spring config file where you configure the necessary beans, properties and other elements relevant to your dao layer only. Then, in your web (or any other kind of) application, you create another spring config file that imports the configuration in the dao spring file config. Not sure if this is what you're looking for.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/53294690
score: 1
has body: //write seperate function to remove tag comments !!sometest.Trades from the yaml file as it will cause issue while reading it Representer representer = new Representer() { @Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { // if value of property is null, ignore it. if (int.class.equals(property.getType())) { return null; } else { return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); } } }; representer.addClassTag(sometest.Trades.class, Tag.MAP); Yaml yaml1 = new Yaml(representer, options); Writer output; output = new BufferedWriter(new FileWriter(outputFilePath, true)); yaml1.dump(trades, output); output.close();
downvote count: 0
answers question: http://stackoverflow.com/q/26515519
type: Answer
upvote count: 1

http://stackoverflow.com/a/26533741
upvote count: 1
has body: Your constructor doesn't set the field values, so a has a default value of 0 and you divide by zero when you say /(2 * a). Fix your constructor like, public double discrim; // = (Math.pow(b, 2) - 4*a*c); public Quadratic(double a, double b, double c) { this.a = a; this.b = b; this.c = c; this.discrim = (Math.pow(b, 2) - 4*a*c); // &lt;-- also, move the math here. }
answers question: http://stackoverflow.com/q/26533706
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41793343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26589261
score: 4
has text: `while(!"</depends>".equals(nextLine)) {`

http://stackoverflow.com/a/26593949
upvote count: 5
accepted answer of: http://stackoverflow.com/q/26593845
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26593845
has body: It's possible because unreachable statement is a useful compile time error, not a runtime check/constraint. The code that you decompiled might have had something like this originally: boolean debug = true; do { if(debug) { return; } }while (this.aDegree == arrayOfFloat[0]); The compiler is smart enough to know that debug is always true and doesn't bother with the check in the byte code (for efficiency). Obviously my example is quite contrived, in reality it was probably more complex (although the end result is the same).
has comment: http://stackoverflow.com/comment/41808014

http://stackoverflow.com/comment/41888049
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26640564
has text: Regarding your question, `"Is what I have done correct and if not could someone please help me"` -- You should know this already by testing your code, and when you do this, does it work? If not, debug it first and find your errors before coming here.
score: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26654592
tags question: http://stackoverflow.com/q/26527602
tags question: http://stackoverflow.com/q/26517551
tags question: http://stackoverflow.com/q/26608344
tags question: http://stackoverflow.com/q/26594717
tags question: http://stackoverflow.com/q/26649950
tags question: http://stackoverflow.com/q/26611238
tags question: http://stackoverflow.com/q/26670889
tags question: http://stackoverflow.com/q/26657571
tags question: http://stackoverflow.com/q/26525039
tags question: http://stackoverflow.com/q/26587631
tags question: http://stackoverflow.com/q/26531115
tags question: http://stackoverflow.com/q/26662945
tags question: http://stackoverflow.com/q/26672674
tags question: http://stackoverflow.com/q/26528365
tags question: http://stackoverflow.com/q/26670537
tags question: http://stackoverflow.com/q/26659575
tags question: http://stackoverflow.com/q/26578539
type: Tag
tags question: http://stackoverflow.com/q/26563290
tags question: http://stackoverflow.com/q/26584172
tags question: http://stackoverflow.com/q/26650192
tags question: http://stackoverflow.com/q/26666547
tags question: http://stackoverflow.com/q/26585817
tags question: http://stackoverflow.com/q/26601849
tags question: http://stackoverflow.com/q/26664152
tags question: http://stackoverflow.com/q/26528765
tags question: http://stackoverflow.com/q/26584601
tags question: http://stackoverflow.com/q/26668772
tags question: http://stackoverflow.com/q/26583334
tags question: http://stackoverflow.com/q/26632496
tags question: http://stackoverflow.com/q/26516327
tags question: http://stackoverflow.com/q/26633379
tags question: http://stackoverflow.com/q/26651208
tags question: http://stackoverflow.com/q/26652224
tags question: http://stackoverflow.com/q/26619761
tags question: http://stackoverflow.com/q/26579409
tags question: http://stackoverflow.com/q/26603559
tags question: http://stackoverflow.com/q/26635784
tags question: http://stackoverflow.com/q/26586092
tags question: http://stackoverflow.com/q/26668982
tags question: http://stackoverflow.com/q/26549833
tags question: http://stackoverflow.com/q/26556878
tags question: http://stackoverflow.com/q/26668446
tags question: http://stackoverflow.com/q/26563328
tags question: http://stackoverflow.com/q/26626606
tags question: http://stackoverflow.com/q/26586046
tags question: http://stackoverflow.com/q/26666289
tags question: http://stackoverflow.com/q/26651391
tags question: http://stackoverflow.com/q/26618334
tags question: http://stackoverflow.com/q/26579729
tags question: http://stackoverflow.com/q/26561771
tags question: http://stackoverflow.com/q/26540070
tags question: http://stackoverflow.com/q/26536428
tags question: http://stackoverflow.com/q/26545358
tags question: http://stackoverflow.com/q/26659069
tags question: http://stackoverflow.com/q/26603096
tags question: http://stackoverflow.com/q/26651390
tags question: http://stackoverflow.com/q/26604257
tags question: http://stackoverflow.com/q/26595051
tags question: http://stackoverflow.com/q/26529912
tags question: http://stackoverflow.com/q/26615264
tags question: http://stackoverflow.com/q/26518144
tags question: http://stackoverflow.com/q/26655011
tags question: http://stackoverflow.com/q/26604679
tags question: http://stackoverflow.com/q/26640644
tags question: http://stackoverflow.com/q/26576204
tags question: http://stackoverflow.com/q/26632529
tags question: http://stackoverflow.com/q/26615540
tags question: http://stackoverflow.com/q/26611567
tags question: http://stackoverflow.com/q/26516635
tag name: xml
tags question: http://stackoverflow.com/q/26629912
tags question: http://stackoverflow.com/q/26521105
tags question: http://stackoverflow.com/q/26655590
tags question: http://stackoverflow.com/q/26603920
tags question: http://stackoverflow.com/q/26620061
tags question: http://stackoverflow.com/q/26660033
tags question: http://stackoverflow.com/q/26654210
tags question: http://stackoverflow.com/q/26657888

http://stackoverflow.com/comment/41751224
comment on: http://stackoverflow.com/a/26565660
has text: That's neat. I assume these rules are applied to transitive dependencies as well?
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26592439
score: 0
answer count: 2
tagged with: sqlite
has answer: http://stackoverflow.com/a/26592755
has answer: http://stackoverflow.com/a/26592741
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41800749
tagged with: android
has body: Is it possible to display the following data from sqlite database in a listview instead of a toast as shown in the code below ? btnlist = (Button) findViewById(R.id.btnlist); btnlist.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { handler = new Datahandler(getBaseContext()); String getName, getaddress, getDate, getTime, getSchoolName; getName = ""; getaddress = ""; getDate = ""; getTime = ""; getSchoolName = ""; handler.open(); Cursor C = handler.returnData();// return actual data from // database if (C.moveToFirst()) { do { getName = C.getString(0); getaddress = C.getString(1); getDate = C.getString(2); getTime = C.getString(3); getSchoolName = C.getString(4); } while (C.moveToNext()); } handler.close(); Toast.makeText( getBaseContext(), " Name :" + getName + "Address :" + getaddress + "Date :" + getDate + "Time :" + getTime + "School :" + getSchoolNname, Toast.LENGTH_LONG).show(); } }); }
has comment: http://stackoverflow.com/comment/41800109
type: Question
tagged with: android-layout
tagged with: java
has title: Display data from sqlite database in listview instead of toast?

http://stackoverflow.com/q/26631078
has comment: http://stackoverflow.com/comment/41870986
possible better answer: http://stackoverflow.com/a/26631219
downvote count: 0
has comment: http://stackoverflow.com/comment/113511496
tagged with: string
has comment: http://stackoverflow.com/comment/48402623
favorite count: 0
has comment: http://stackoverflow.com/comment/41870279
accepted answer: http://stackoverflow.com/a/26631968
answer count: 4
upvote count: 13
has body: What is the reason why substring has the starting parameter as an index and the 2nd parameter as the length from the beginning? In other words 1 2 3 | 4 5 &lt;=== Length from beginning A B C D E 0 | 1 2 3 4 &lt;=== Index If i want substring() to return BC i have to do "ABCDE".substring(1,3); Why is this the case? EDIT: What are the benefits of making the end index exclusive?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26631130
has title: Why is substring() method substring(start index(inclusive), end index (exclusive))
has answer: http://stackoverflow.com/a/26632136
has comment: http://stackoverflow.com/comment/41871854
has comment: http://stackoverflow.com/comment/41870791
has comment: http://stackoverflow.com/comment/112889187
score: 13
has comment: http://stackoverflow.com/comment/41870642
type: Question
has comment: http://stackoverflow.com/comment/58813262
tagged with: java
has comment: http://stackoverflow.com/comment/41882937
has answer: http://stackoverflow.com/a/26631219
has answer: http://stackoverflow.com/a/26631968

http://stackoverflow.com/comment/123250086
score: 0
type: Comment
has text: this was my answer too though a bit different. I was using ActivityScenarioRule, so now in the @Before method, i assign my acitivityRule
type: AnswerComment
comment on: http://stackoverflow.com/a/26561548

http://stackoverflow.com/q/26556466
has comment: http://stackoverflow.com/comment/41734496
tagged with: android
tagged with: sqlite
has body: I have a problem inserting data from a list into a db SQLite. Some element of the list are null and then when i'm going to take this element i see a null pointer exception. What i can do to store in db this data even though some are null?? This is the code: private void insertDB() { for(int i = 0; i &lt; listA.size(); i++) { int check = dbPF.createPF(listA.get(i).getA(), listA.get(i).getB(), listA.get(i).getC(), listA.get(i).getD()); } } public int createPF(int a, String b, String c, String d) { ContentValues initialValues = createContentValuesPF(a, b, c, d); return (int) database.insert(tableA, null, initialValues); } private ContentValues creaContentValuesPod(int a, String b, String c, String d) { ContentValues values = new ContentValues(); values.put(key1, a); values.put(key2, b); values.put(key3, c); values.put(key4, d); return values; } Eclipse return a NullPointerException when one of the node of the list is null, but i want to store in db also null values. What i can do? Thanks to all
answer count: 4
has answer: http://stackoverflow.com/a/26556613
accepted answer: http://stackoverflow.com/a/26562318
possible better answer: http://stackoverflow.com/a/26556609
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26556609
has comment: http://stackoverflow.com/comment/41734513
tagged with: java
tagged with: database
tagged with: eclipse
score: 0
has title: Inserting data into a db from a list
has answer: http://stackoverflow.com/a/26556711
has answer: http://stackoverflow.com/a/26562318
linked to: http://stackoverflow.com/q/9823514

http://stackoverflow.com/q/26527602
has body: I am working on a soap web service. I use JPA with namedquery annotation for data query. however using aggregated function like sum in combination with group by in my query resulted in some exceptions. my code is shown below. @Entity @Cacheable(false) @Table(name = "criteriatable") @XmlRootElement @NamedQueries( { @NamedQuery(name = "Criteriatable.findAll", query = "SELECT c FROM Criteriatable c"), @NamedQuery(name = "Criteriatable.findById", query = "SELECT c FROM Criteriatable c WHERE c.id = :id"), @NamedQuery(name = "Criteriatable.findByCriteriaid", query = "SELECT c FROM Criteriatable c WHERE c.criteriaid = :criteriaid"), @NamedQuery(name = "Criteriatable.findBySubcriteriaid", query = "SELECT c FROM Criteriatable c WHERE c.subcriteriaid = :subcriteriaid"), @NamedQuery(name = "Criteriatable.findByProjectid", query = "SELECT c FROM Criteriatable c WHERE c.projectid = :projectid"), @NamedQuery(name = "Criteriatable.findAllCriteriatableGroup", query = "SELECT c.criteriagroupname AS groupname, SUM(c.weight) AS groupweight FROM Criteriatable c WHERE c.projectid = :projectid GROUP BY c.criteriagroupname"), @NamedQuery(name = "Criteriatable.SumAllWeightByProjectid", query = "SELECT SUM(c.weight) AS TotalProjectWeight FROM Criteriatable c WHERE c.projectid = :projectid") }) public class Criteriatable implements Serializable { @Basic(optional = false) @NotNull @Column(name = "weight") private double weight; @Basic(optional = false) @NotNull @Column(name = "status") private int status; @Basic(optional = false) @NotNull @Lob @Size(min = 1, max = 65535) @Column(name = "criteriagroupname") WS Method @WebMethod(operationName = "getAllCriteriaGroupByProjectid") public List&lt;Criteriatable&gt; getAllCriteriaGroupByProjectid(@WebParam(name = "projectid") int projectid) { EntityManager em = emf.createEntityManager(); String find = "Criteriatable.findAllCriteriatableGroup"; TypedQuery&lt;Criteriatable&gt; query = em.createNamedQuery(find, Criteriatable.class); query.setParameter("…
tagged with: http://stackoverflow.com/tag/xml
has title: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException - with linked exception:
has answer: http://stackoverflow.com/a/26529406
tagged with: soap
accepted answer: http://stackoverflow.com/a/26529406
tagged with: web-services
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26527916
type: Question
has answer: http://stackoverflow.com/a/26527916
answer count: 2
tagged with: jpa
score: 0

http://stackoverflow.com/comment/41820670
has text: You define _different_ properties in `Student`/`Person` and `Students`/`Persons` which is not so interesting (not too much inheritance). An interesting part would be to have just one `id` property in `Person` or just one collection property (`people`, or whatever) in `Persons` mapped differently by superclasses. I.e. `id` as `studentId` in `Student` or `facultyId` in `Faculty`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26602909

http://stackoverflow.com/a/26560378
type: Answer
has comment: http://stackoverflow.com/comment/41746578
score: 3
has comment: http://stackoverflow.com/comment/41763853
downvote count: 1
has comment: http://stackoverflow.com/comment/41750342
accepted answer of: http://stackoverflow.com/q/26559724
upvote count: 4
answers question: http://stackoverflow.com/q/26559724
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41750494
has body: the previous will lock closing if indeed you press the key combination meaning there on even close X will not work. hence the following REVIEW: much better based on fast snail answer: public class OnKeyAltF4DontClose2 extends JFrame {//implements WindowListener { public OnKeyAltF4DontClose2() { setVisible(true); setDefaultCloseOperation(3); setBounds(400,400,400,400); addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e) { if(((KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, java.awt.event.InputEvent.ALT_DOWN_MASK)) != null) &amp;&amp; e.getKeyCode() == KeyEvent.VK_F4){ e.consume(); } } }); } public static void main(String[] args) { new OnKeyAltF4DontClose2(); } }

http://stackoverflow.com/comment/41780873
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26582048
has text: @stretchr Threads would be used to have N number of producers such that a buffer is constantly being filled. This buffer is being accessed by the consumer, which is adding the new list obtained by each producer to the specific place in the hash. Reading in chunks is just reading the file in some number of bytes. Of course, by doing it this way, some byes have to be put back into the stream if what is read is not white space. Of course, this is assuming that other treating had been done such that we ate actually dealing with words and not done word file with no white space...

http://stackoverflow.com/comment/41820580
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26602463
type: QuestionComment
has text: xml schema above does not have definition of element ArrayOfRecommendation. Plz share that as well. May be you want to use ArrayOfElements instead of ArrayOfRecommendation?

http://stackoverflow.com/a/26566023
has comment: http://stackoverflow.com/comment/41751963
upvote count: 1
has comment: http://stackoverflow.com/comment/41751330
has body: Your guess is incorrect: // Stop Threads this.threadPool.shutdown(); This command does not stop threads, that are in run state. It marks executor to decline all new tasks from execution and cancel not-started tasks in the queue. You should either stop your handlers by separate shared flag (e.g. AtomicBoolean shutdown = new AtomicBoolean(false);) or use threadPool.shutdownNow() for interruption of active threads.
has comment: http://stackoverflow.com/comment/41751166
has comment: http://stackoverflow.com/comment/41752198
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41751900
accepted answer of: http://stackoverflow.com/q/26565854
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26565854
type: Answer

http://stackoverflow.com/comment/41805063
type: Comment
comment on: http://stackoverflow.com/a/26595063
type: AnswerComment
score: 0
has text: The thing is that I want the nodes that are one step away to be next to each other. It looks like this just makes a shape out of the points that approaches a circle.

image-processing
tags question: http://stackoverflow.com/q/26577820
tags question: http://stackoverflow.com/q/26553028
tags question: http://stackoverflow.com/q/26525567
type: Tag
tags question: http://stackoverflow.com/q/26672682
tags question: http://stackoverflow.com/q/26575483
tags question: http://stackoverflow.com/q/26607815
tags question: http://stackoverflow.com/q/26575291
tag name: image-processing
tags question: http://stackoverflow.com/q/26597028

http://stackoverflow.com/comment/41773256
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26577901
type: AnswerComment
has text: i was afraid that this is the case... I will look into these wrapper classes. I considered putting it in another class but it just doesn't _feel_ right.

http://stackoverflow.com/q/26576345
has title: python subprocess hangs when stderr is piped
has body: I run a java program as a subprocess but when I redirect stderr to a pipe, the program hangs. For example myProcess = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE) works, but myProcess = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr=subprocess.PIPE)hangs. The command I run is something along the lines of: java -DSomeVals -classpath &lt;somevals&gt; package.Name Stderr generates massive amounts of output and I remember reading somewhere that with shell=True that might cause a deadlock. Unfortunately when i set shell=False, I get an error message that the file name is too long. I tried myProcess = subprocess.Popen(['java', args], shell=False, stdout = subprocess.PIPE, stderr = subprocess.PIPE)but then java complains that it can't find the class I'm trying to run. I want to pipe stderr because it's cluttering the output of my program.
tagged with: java
type: Question
upvote count: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26576544
has comment: http://stackoverflow.com/comment/41774675
favorite count: 0
has comment: http://stackoverflow.com/comment/41770480
type: UnansweredQuestion
tagged with: python
score: 2

http://stackoverflow.com/comment/41752264
type: Comment
type: QuestionComment
score: 0
has text: it might be a "Default" issue, meaning you might have set "MXPlayer" as your default player, clear that in Apps then try again.
comment on: http://stackoverflow.com/q/26566607

http://stackoverflow.com/q/26639447
has body: I am currently learning Java via a text book and I have run into some difficulty. The text book is asking me to make a program that overloads a method, basically the user inputs two numbers and if they are an integer it adds them and then divides them by two removing the decimal places. If they are doubles it does the same thing just leaves the decimal places. I don't know how to make it show it leaves the decimal places if it is a double. Here is my code. It all works besides the decimal places part. int x = 0; int y = 0; public static void average(double m, double n) { System.out.println((m + n) / 2); } public static void average(int l, int p) { System.out.println((l + p) / 2); } public static void main(String[] args) { double x = In.getDouble(); double y = In.getDouble(); int i =(int) x; int o =(int) y; if (x % 1 == 0) average(i,o); else average(x, y); }
has comment: http://stackoverflow.com/comment/41886055
score: 0
has comment: http://stackoverflow.com/comment/41885956
has comment: http://stackoverflow.com/comment/41885960
has comment: http://stackoverflow.com/comment/41886195
has comment: http://stackoverflow.com/comment/41886499
has title: Method Overloading in Java Returning fractional parts if double and removing them if int
has answer: http://stackoverflow.com/a/26639556
accepted answer: http://stackoverflow.com/a/26639556
tagged with: overloading
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/41885949

http://stackoverflow.com/comment/41932291
type: Comment
type: QuestionComment
score: 1
has text: Have you tried using a debugger to check which bits of your code are actually getting called?
comment on: http://stackoverflow.com/q/26665216

http://stackoverflow.com/a/26576887
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41782430
answers question: http://stackoverflow.com/q/26576316
accepted answer of: http://stackoverflow.com/q/26576316
has body: import java.util.Scanner; public class test3 { public static void main (String[] args) { Scanner keyboard=new Scanner(System.in); System.out.println("Input how many numbers you want to find the median for (numerical value) :"); int num = keyboard.nextInt(); System.out.println("Please enter " + num + " numbers."); int[] values = new int[num]; for (int i = 0; i &lt; num; i++) { values[i] = keyboard.nextInt(); } for (int i = 0; i &lt; num; i++) { System.out.println(values[i]); } } }

http://stackoverflow.com/q/26515274
has comment: http://stackoverflow.com/comment/41660404
has comment: http://stackoverflow.com/comment/41660476
tagged with: android
tagged with: android-toast
tagged with: android-activity
has comment: http://stackoverflow.com/comment/41663859
has comment: http://stackoverflow.com/comment/41660388
has title: Toast Is not being Displayed in The Android App , But first it was being diplayed then after two days it stopped
has answer: http://stackoverflow.com/a/26515865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41663298
type: Question
has comment: http://stackoverflow.com/comment/41663171
has comment: http://stackoverflow.com/comment/41663643
tagged with: java
has comment: http://stackoverflow.com/comment/41663390
has comment: http://stackoverflow.com/comment/41663323
has comment: http://stackoverflow.com/comment/41660542
linked to: http://stackoverflow.com/q/7298731
has body: I am Very new to Android Programming.. I have listed my code below. MainActivity.java and activity_main.xml. I have tried following solutions but to no avail. using only this using getapplicationcontext() using getbasecontext() public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button text2 = (Button) findViewById(R.id.text2); final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); text2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); Toast.makeText(getApplicationContext(), "Disabled", Toast.LENGTH_LONG).show(); } } }); // Disabling/Enabling Wifi Mechanism } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41663374
has comment: http://stackoverflow.com/comment/41660622

http://stackoverflow.com/a/26595390
upvote count: 3
answers question: http://stackoverflow.com/q/26595321
accepted answer of: http://stackoverflow.com/q/26595321
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I often find people organize their projects as /main and /test This is a matter of taste. Not 100% sure but at least maven projects have such organization. From Maven: Introduction to the Standard Directory Layout, this would be the project layout: src main java &lt;-- your Java source code resources filters config scripts webapp test java &lt;-- your unit tests for Java resources filters it assembly site Why people often have that folder? What does it contain? Usually, people write test cases to cover the code and check if the code works as expected. This is known as Code Coverage. Code coverage also serves as regression tests in case somebody makes changes in the code for enhancements like code refactoring. The test cases you will find them usually are for Unit Testing. Depending on the type of the project, you could also find Integration Tests. There is also Test Driven Development, or TDD, which is a practice whose basis is writing the test cases before writing the real code. Can you provide me with a link to a good tutorial about the practice of testing in java? This is off topic for the site. There are plenty tutorials on the net about this.

http://stackoverflow.com/a/26520148
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/41669859
has comment: http://stackoverflow.com/comment/41669792
has comment: http://stackoverflow.com/comment/41669688
has body: If you are storing your data in variables: Method 1: make them final Example: public static final FieldType MYFIELD; Method 2: you can make all your variables privateand write the getters for them. Example 2: private static FieldType myField; public static FieldType getMyField() { return myField; }
has comment: http://stackoverflow.com/comment/41669879
answers question: http://stackoverflow.com/q/26520129
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/41669818

http://stackoverflow.com/q/26572507
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41763187
type: Question
tagged with: client-server
answer count: 1
has comment: http://stackoverflow.com/comment/41763068
tagged with: string
score: 0
has answer: http://stackoverflow.com/a/26572684
has comment: http://stackoverflow.com/comment/41763097
tagged with: bootp
has body: I'm trying to write a BOOTP Client/Server in Java, and one of the specifications in the RFC is that the client can write the nickname of the server it wants to connect to. If the packet reaches a server that is not the one specified, it should discard the bootrequest. I have three classes (BOOTPClient, BOOTPServer and BOOTPMessage). As of now, I've successfully sent the bootrequest from the client to the server, who recieves it and starts to process it. The problem is here: String sname = new String(btpmsg.getSname()); String serverName = args[0]; boolean discard = false; System.out.println("|"+serverName+"|"+sname+"|"); if (!sname.equalsIgnoreCase("") &amp;&amp; !sname.equalsIgnoreCase(serverName)) { discard = true; System.out.println("The request was not for this server. Server requested: "+sname); } This meaning: if the string is not null (in which case we don't care about what server it arrives to), make sure it's the correct server. As you can see, I printed both strings between "|" to be 100% sure that there aren't whitespaces or anything that could mess up the comparison. Yet, it enters into if block and executes the sentences inside. It happens both if the string is the same as the server name and if it's blank. To clarify: btpmsg is an instance of the BOOTPMsg class, the server name is stored as an array of bytes (everything is coded into a byte array with ByteArrayOutputStream to send it with DatagramPacket) and then converted to a String. I don't know where the problem may be. A sample of the output: Server (called with "java BOOTPServer bootpserver"): Server bootpserver running. Awaiting requests. Bootrequest received. |bootpserver|bootpserver| The request was not for this server. Server requested: bootpserver Client: Enter your IP if known. Otherwise, press enter. Enter the IP of the server if known. Otherwise, press enter. Enter the name of the server if known. Otherwise, press enter. bootpserver Enter the file name if known. Otherwise, press enter. I'…
tagged with: equals
accepted answer: http://stackoverflow.com/a/26572684
has comment: http://stackoverflow.com/comment/41763080
has title: Equals returning false when comparing equal strings
has comment: http://stackoverflow.com/comment/41763148
has comment: http://stackoverflow.com/comment/41763016

http://stackoverflow.com/comment/41807035
type: AnswerComment
type: Comment
has text: First of all, you don't need to check two times the same condition 'if (... == 1), if (... == 1)', you can make only one if statement and your code will be more clear. I don't understand on what you apply your 'setOnItemSelectedListener' method. Second, don't say 'Eclipse', be specific about what environment are you using (Java? Android?)
comment on: http://stackoverflow.com/a/26595858
score: 0

http://stackoverflow.com/q/26603943
tagged with: android
has answer: http://stackoverflow.com/a/26603992
upvote count: 2
has body: I have a problem by following a tutorial for making an app. But now I get an error by adding an respond for a button. It gives an error at public void sendMessage, but I cant see what is wrong. package com.example.myfirstapp; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.content.Intent; /** Called when the user clicks the Send button */ public void sendMessage(View view){ Intent intent = new Intent(this, DisplayMessageActivity.class); } public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
tagged with: android-intent
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41821060
answer count: 2
has title: Android SDK public void gets an error
score: 1
has answer: http://stackoverflow.com/a/26603980
favorite count: 0
has comment: http://stackoverflow.com/comment/41820902
type: UnansweredQuestion

http://stackoverflow.com/a/39083896
has body: import java.util.*; public class Question { public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] arr = {1,2,3,3,4,5,6,1}; int[] ne = new int[arr.length]; ArrayList&lt;Integer&gt; already= new ArrayList(); int i = 0; while(i&lt;arr.length){ if(!already.contains(arr[i])) already.add(arr[i]); i++; } System.out.println(already.toString()); } }
upvote count: 0
answers question: http://stackoverflow.com/q/26517696
score: -1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/65515873

http://stackoverflow.com/comment/41795775
type: Comment
has text: @daddycool: You're right. The code above indeed has that restriction, but it's in the `std::map<std::type_index ...` part. Maps cannot have duplicate keys.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26589475

http://stackoverflow.com/comment/41812500
type: Comment
comment on: http://stackoverflow.com/q/26599030
has text: Well, because squared is equal to the number of stars I want displayed, squared.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26654402
tagged with: select
has comment: http://stackoverflow.com/comment/41911807
type: Question
has answer: http://stackoverflow.com/a/26689353
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/26713775
downvote count: 1
has comment: http://stackoverflow.com/comment/41911631
favorite count: 0
has body: error: java.lang.NullPointerException , What is the reason?? My class name is ; DP.java public static TPreparedStatement Fill(SessionStruct ss, String seq) throws SQLException { TPreparedStatement tp = null; try { String sql = "Select name,surname from NAMES where seq=? "; tp = new TPreparedStatement(ss, sql); tp.setString(1, seq); tp.executeQuery(); tp.close(); } catch (SQLException ex) { tp.close(); ss.rollbackNoException(); ex.printStackTrace(); throw ex; } return tp; } Another class is ; DLP.java public void Load() throws HException { TPreparedStatement tp = null; try { tp = DP.Fill(rc.ss, rc.getRequest() .getParameter("PK")); txtName.setValue(tp.getString("NAME")); txtSurname.setValue(tp.getString("SURNAME")); } catch (Exception ex) { ex.printStackTrace(); rc.ss.rollbackNoException(); } } When I run in debug mode it has skipped ; txtName.setValue(tp.getString("NAME")); txtSurname.setValue(tp.getString("SURNAME"));
has title: How to execute a SQL statement?
has comment: http://stackoverflow.com/comment/41912119
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41914044
has answer: http://stackoverflow.com/a/26657763
upvote count: 0
tagged with: java

http://stackoverflow.com/comment/41704846
comment on: http://stackoverflow.com/a/26536051
type: Comment
has text: @Pshemo good point! But i think that change just the scanner locale doesn't make sense because you need your entire app with a locale configuration, why just scanner? and the others things? I think that he could use another resource like Dates or whatever that would require i18n too.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41730847
comment on: http://stackoverflow.com/q/26554220
has text: the applications that run automatically as Admin are blocked by windows, and must be manually confirmed to run
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26576992
score: 0
answers question: http://stackoverflow.com/q/26576937
has body: When you instantiate a FileWriter object, it defaults to your platform default character encoding. Javadoc for FileWriter says: The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. To specify these values yourself, construct an OutputStreamWriter on a FileOutputStream. So, to set the encoding, instead of using FileWriter, use its parent class – OutputStreamWriter: FileOutputStream fileStream = new FileOutputStream(new File("out.txt")); OutputStreamWriter writer = new OutputStreamWriter(fileStream, "UTF-8");
type: Answer

http://stackoverflow.com/comment/41863015
comment on: http://stackoverflow.com/q/26626167
score: 0
type: Comment
has text: @Tom I wanted to write a Boolean statement that indicates if 'z' appears in "Word1" (which is the word that the user entered) or not. I thought about it a lot.
type: QuestionComment

http://stackoverflow.com/comment/41756114
type: QuestionComment
comment on: http://stackoverflow.com/q/26568411
has text: @Java42 The problem with requesting 'some code' is that the OP usually posts uncompilable code snippets and the snippet often does not contain the code responsible for the problem.
score: 0
type: Comment

http://stackoverflow.com/q/26612670
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/41837272
type: Question
has answer: http://stackoverflow.com/a/26618639
has title: Pane always on top - JavaFX
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26613470
has body: My stage have as node, a boderpane with 2 childrens, one on top, one on bottom (like graphics for a game, on top big screen and on bottom the menu). The idea is that the ''menu'' must be always on top. Lets say screen size will be 500x400, top children will be 800x400 and bottom children will be 100x400. I want that for user to be visible half-top side of topchildren and the bottom children. I hope what I wrote is understandable. Thank you!
tagged with: javafx-8
answer count: 2
possible better answer: http://stackoverflow.com/a/26613470
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/26618639
favorite count: 0
downvote count: 2

http://stackoverflow.com/comment/45793338
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26631227
has text: I had a problem recently for pre-Lollipop versions. Creating a custom EditText loses these colors that you define in Styles XML from AppCompat Library. In order to keep these colors, take a look on @hordurh 's answer. And use it programmatically in your custom EditText's constructor.

http://stackoverflow.com/a/26579977
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: Yes, this would work (but it is potentially confusing). The following are equivalent class G&lt;A&gt; {} class G&lt;B&gt; {} class G&lt;T&gt; {} class G&lt;String&gt; {} So I suggest you choose a placeholder name that reduces confusion. But this does seem to complicate things, because what if you wanted to have an attribute of type A or B within G? Again, you can avoid this by naming the placeholder something else. But if you have to, you can disambiguate by fully qualified name: class G&lt;A&gt;{ my.com.package.A someVariable; }
answers question: http://stackoverflow.com/q/26579954

http://stackoverflow.com/comment/41858187
score: 0
comment on: http://stackoverflow.com/q/26624116
has text: Thanks stalk, Yes I tried with using mongodb java drive. The mongodb drive is not supporting import data from Json file directly.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26529358
has answer: http://stackoverflow.com/a/26530048
tagged with: java
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/26541746
has body: I have a FragmentActivity where when the user presses the back button, it closes the application. To try and resolve this issue I have tried: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { onBackPressed(); } return super.onKeyDown(keyCode, event); } @Override public void onBackPressed() { Log.d("CDA", "onBackPressed Called"); Intent intent = new Intent(this, betaEventsActivity.class); startActivity(intent); } The problem is that this does not work well. It just takes the user to a specify activity, and not necessarily goes back to the previous activity. I have also tried: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//***Change Here*** startActivity(intent); finish(); System.exit(0); } return super.onKeyDown(keyCode, event); } but this simply closes the application. Below is my FragmentActivity code: public class usermatch extends FragmentActivity { private PageAdapter mPagerAdapter; private FeedbackDialog feedBack; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.viewpager_layout); initialisePaging(); feedBack = new FeedbackDialog(this, "id"); } private void initialisePaging() { // TODO Auto-generated method stub List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;(); fragments.add(Fragment.instantiate(this, Fragment1.class.getName())); fragments.add(Fragment.instantiate(this, Fragment2.class.getName())); fragments.add(Fragment.instantiate(this, Fragment3.class.getName())); fragments.add(Fragment.instantiate(this, Fragment4.class.getName())); fragments.add(Fragment.instantiate(this, Fragment5.class.getName())); mPagerAdapter = new PageAdapter(this.getSupportFragmentManager(), fragments); ViewPager pager = (ViewPager) findViewById(R.…
has comment: http://stackoverflow.com/comment/41685954
answer count: 2
has comment: http://stackoverflow.com/comment/41685815
downvote count: 0
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Move back to previous activity from fragment
score: 2
tagged with: android-fragments
upvote count: 2

http://stackoverflow.com/comment/41718606
type: Comment
type: QuestionComment
has text: @Zltantan try to print the textfield content with your previous condition. If you got something different then I can tell you. Cause right you've not posted whole code so I can assume that something is getting stored in `StringBuilder`.
score: 0
comment on: http://stackoverflow.com/q/26547689

http://stackoverflow.com/a/26656487
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26655769
has body: I would suggest using Camel's File component if you are open to it. The component will handle all the issues with concurrency to ensure that multiple threads don't try to process the same file. The biggest challenge with making your code multi-threaded is making sure the threads don't interact. Let a framework take care of this for you. Example: from("file://incoming?maxMessagesPerPoll=1&amp;idempotent=true&amp;moveFailed=failed&amp;move=processed&amp;readLock=none") .threads(10).process()

http://stackoverflow.com/comment/41871871
score: 0
comment on: http://stackoverflow.com/a/26628725
type: AnswerComment
has text: Thanks but it wud be more helpful if u could explain me this part? String st="",sw=""; for(int i=0;i<l;i++) st+=s.charAt(i); for(int j=l;j<length;j++) sw+=s.charAt(j);
type: Comment

http://stackoverflow.com/q/26630587
score: 1
tagged with: java
tagged with: integration-testing
type: Question
accepted answer: http://stackoverflow.com/a/26630898
tagged with: testing
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26632937
linked to: http://stackoverflow.com/q/304268
has body: I'm trying to write an integration test to see if a file is downloaded correctly from a url. I'm not sure how to test this because I expect to get the file in byte[] but I not really sure about the image that I'm comparing it to. I thought about downloading the file manually and then convert it to bytes and take the result and paste it in the code as the expected value and than compare it to the result i get. If you have a better idea I would be glad to hear it. Thanks:)
possible better answer: http://stackoverflow.com/a/26632937
favorite count: 0
linked to: http://stackoverflow.com/q/47167826
has answer: http://stackoverflow.com/a/26630898
upvote count: 1
has title: Integration test for image download java
type: AnsweredQuestion

http://stackoverflow.com/a/26649434
has comment: http://stackoverflow.com/comment/41918173
has comment: http://stackoverflow.com/comment/41904754
has comment: http://stackoverflow.com/comment/41904850
has comment: http://stackoverflow.com/comment/41918266
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26648130
accepted answer of: http://stackoverflow.com/q/26648130
type: Answer
has body: IMHO, the reason it works with the button is because you call the method as action, which handles the return value as navigation rule. &lt;f:event&gt; listener does not do that. Try this code for redirection (taken from this answer) String url = (something) FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); try { ec.redirect(url); } catch (IOException ex) { Logger.getLogger(Navigation.class.getName()).log(Level.SEVERE, null, ex); }
has comment: http://stackoverflow.com/comment/41918107
score: 0

http://stackoverflow.com/comment/41691952
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26532614
has text: Parentheses have higher priority than cast, but cast comes before multiplication (exponent doesn’t apply here as there’s no such operator in Java). By the way, if in doubt, you can put parentheses around anything and then press CTRL+1 in Eclipse an choose “Remove extra parentheses” from the popup menu which will remove all obsolete braces but retain all necessary ones.

http://stackoverflow.com/a/26604689
score: 0
answers question: http://stackoverflow.com/q/26604015
type: Answer
has body: Firstly system.gc() is not a committing command, it is just a triggering command which will generate a thread to check whether garbage collection is required or not and if it is required then it will clear the heap size only for the objects that are not in use. Secondly garbage collection can't be done on any element which is not initialized by null and hence if your program is able to run more than 7 minutes after using system.gc() then it is definitely some other memory location which is deallocated but for sure your code will produce outofmemory exception when your heap size get full and garbage collection can't be done.

http://stackoverflow.com/q/26606982
tagged with: java
has body: Code attached in the end. So this is my first try at java generic containers. I need to collect the objects in class Product.Java which is a random class. It has several other classes that extends product class. I have added them to a container called product using ArrayList but i doubt its efficient. Also i do not know how to call cheese instance. Is there a way i can assign an identifier to all the instances ? import java.util.*; public class GenericOrder { public static void main(String[] args) { ArrayList&lt;Product&gt; product = new ArrayList&lt;Product&gt;(); product.add(new Fruit(123)); product.add(new ComputerPart(65)); product.add(new Cheese(123)); product.add(new Service(65)); product.add(new Peripheral (123)); System.out.println(product); } }
has title: Java containers- adding objects more efficiently and how to return using Identifier
downvote count: 1
has comment: http://stackoverflow.com/comment/41826281
type: Question
tagged with: containers
has comment: http://stackoverflow.com/comment/41834915
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41826454
score: 0
has comment: http://stackoverflow.com/comment/41826706
favorite count: 0
has comment: http://stackoverflow.com/comment/41826938
has comment: http://stackoverflow.com/comment/41827429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41826619
upvote count: 1
has comment: http://stackoverflow.com/comment/41832961
tagged with: list
answer count: 0
has comment: http://stackoverflow.com/comment/41826433
has comment: http://stackoverflow.com/comment/41826556

http://stackoverflow.com/comment/41933551
type: AnswerComment
comment on: http://stackoverflow.com/a/26664240
type: Comment
has text: I changed the way I was creating the jar by including packaged libraries and for some reason that worked...thanks though. So it wasn't actually the jdbc jar itself...sounds weird but at least it worked.
score: 0

http://stackoverflow.com/a/26555763
downvote count: 0
score: 1
has body: The best way in sense of maintainability and simplicity is the already posted regular expression. Once familiar the this technic you know what to expect and it is very easy to widen the criteria if needed. Downside of this is the performance. The fastest way to go is the Array approach. Checking if a character's numerical value falls in the wanted range ASCII A-Z and 0-9 is nearly speed of light. But the maintainability is bad. Simplicity gone. You could use and java 7 switch case with char approach but that's just as bad as the second. In the end, since we are talking about java, I would strongly suggest to use regular expressions.
has comment: http://stackoverflow.com/comment/43219849
answers question: http://stackoverflow.com/q/26555346
upvote count: 1
type: Answer

http://stackoverflow.com/q/26641848
has comment: http://stackoverflow.com/comment/41890623
answer count: 1
tagged with: ssl
score: 0
tagged with: client-certificates
linked to: http://stackoverflow.com/q/16895762
has answer: http://stackoverflow.com/a/26642874
accepted answer: http://stackoverflow.com/a/26642874
has comment: http://stackoverflow.com/comment/41895440
tagged with: keystore
tagged with: web-services
has comment: http://stackoverflow.com/comment/41913336
type: AnsweredQuestion
tagged with: java
has title: Not able to invoke web service
has body: I'm trying to call a web service for which I send xml data with a POST AND I get a response back. The production web service requires a certificate for which I was given. I have imported this certificate to my keystore and have used it in my client code but I keep getting timed out errors. Do you know what can be causing this issue? 17:30:15,214 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) java.net.ConnectException: Operation timed out 17:30:15,214 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.PlainSocketImpl.socketConnect(Native Method) 17:30:15,215 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) 17:30:15,215 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 17:30:15,215 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 17:30:15,216 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 17:30:15,216 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at java.net.Socket.connect(Socket.java:579) 17:30:15,216 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618) 17:30:15,216 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at sun.security.ssl.SSLSocketImpl.&lt;init&gt;(SSLSocketImpl.java:407) 17:30:15,217 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) 17:30:15,217 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at hot.com.mhd.erp.action.client.PushStatusClient.pushXML(PushStatusClient.java:478) 17:30:15,217 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at main.com.mhd.erp.sched.StatusPushJob.execute(StatusPushJob.java:73) 17:30:15,218 ERROR [stderr] (DefaultQuartzScheduler_Worker-6) at org.quartz.core.JobRunSh…
type: Question

http://stackoverflow.com/q/26515179
has comment: http://stackoverflow.com/comment/41660225
has comment: http://stackoverflow.com/comment/41660420
has comment: http://stackoverflow.com/comment/41660649
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26515893
upvote count: 2
has comment: http://stackoverflow.com/comment/41660430
type: Question
has body: I'm trying to scrape images using JSoup and don't understand a piece of code that I stumbled upon. Part of the code: (src in this case is defined as an absolute url) private static void getImages(String src) throws IOException { String folder = null; //Exctract the name of the image from the src attribute int indexname = src.lastIndexOf("/"); if (indexname == src.length()) { // Don't understand this src = src.substring(1, indexname); } indexname = src.lastIndexOf("/"); String name = src.substring(indexname, src.length()); // more code } I don't understand the if statement. More specifically, when will indexname ever equal the length of src?
has comment: http://stackoverflow.com/comment/41660255
has title: Extracting name of an image from an src attribute (url)
tagged with: java
accepted answer: http://stackoverflow.com/a/26515893
tagged with: jsoup
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41660381
has comment: http://stackoverflow.com/comment/41660803
has comment: http://stackoverflow.com/comment/41660428
favorite count: 0
has comment: http://stackoverflow.com/comment/41660733
has comment: http://stackoverflow.com/comment/41660725

http://stackoverflow.com/a/26525069
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26521658
type: Answer
has body: Depending on which exact (update) version of jdk8 you are using, this might be the fix for RT-25679 (partially reverted in RT-38517) AFAIK, there is no public api to disable the auto-focus/select for the collection views in general. Only ListView has (undocumented! beware, they can change without notice) entries in its properties that disable the default behaviour // disable selecting the first item on focus gain - this is // not what is expected in the ComboBox control (unlike the // ListView control, which does this). listView.getProperties().put("selectOnFocusGain", false); // introduced between 8u20 and 8u40b7 // with this, testfailures back to normal listView.getProperties().put("selectFirstRowByDefault", false);
downvote count: 0
has comment: http://stackoverflow.com/comment/41686042

http://stackoverflow.com/comment/41669545
comment on: http://stackoverflow.com/a/26519342
type: Comment
has text: Thanks, I'm not using Maven. I'm coding everything by hand in a text editor.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26561722
has title: Checking if a word is a Palindrome or not
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26561739
has body: So when I'm running this code with any word, it is always returning false. The first String accepts the word, and then it's changed to lower case. Then I'm building a new String out of it to compare it to another string that is appended as the reverse of the original word. Am I not seeing something, or can you tell me what's wrong with it? public class Palindromes { public static void main(String[] args) { int count = Integer.parseInt(args[0]); for(int i = 1; i &lt;= count; i++) { System.out.print(isPalindrome(args[i]) + " "); } } public static boolean isPalindrome(String s) { String str = s.toLowerCase(); StringBuilder orig_str = new StringBuilder(str); StringBuilder revStr = new StringBuilder(); for (int i = str.length()-1; i &gt;= 0; i--) { revStr.append(orig_str.charAt(i)); } boolean isPal = (revStr == orig_str); return isPal; } }
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/513832
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26561739
upvote count: 1

http://stackoverflow.com/comment/41660931
score: 0
comment on: http://stackoverflow.com/q/26515394
type: Comment
type: QuestionComment
has text: are the fields numer and denom in the Rational class declared static?

http://stackoverflow.com/q/26562502
has comment: http://stackoverflow.com/comment/41754908
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26568058
has comment: http://stackoverflow.com/comment/41754927
type: Question
has title: Can Java Applets that I added to my security sitelist only run in sandbox mode?
has body: I have a Java JApplet that should execute the command: Runtime.getRuntime().exec("java -jar acceleration_de.jar"); If I run the java file in Compiler it execute this command. If I run it in browser and I have added this local page to my java security sitelist (white list) it does not execute this command. Is it because Applets are in general not allowed to run this command or is it because the Applet does only run in sandbox? Will it be able to run this command if I offical sign it?
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41754979
answer count: 1
accepted answer: http://stackoverflow.com/a/26568058
tagged with: applet
tagged with: security

http://stackoverflow.com/comment/109291623
score: 0
type: AnswerComment
has text: It happened to me too with the latest 5.4.15 version. But fixed with this: adding "?serverTimezone=" + TimeZone.getDefault().getID()" right next to ur database, solves the issues.
type: Comment
comment on: http://stackoverflow.com/a/54386284

http://stackoverflow.com/comment/41740094
comment on: http://stackoverflow.com/a/26559500
score: 0
has text: Right click your project, go to Build Path -> Configure Build Path and then make sure the library jar is under the library tab.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26526717
favorite count: 0
tagged with: rdd
upvote count: 4
type: AnsweredQuestion
has title: Update collection in MongoDb via Apache Spark using Mongo-Hadoop connector
tagged with: java
has answer: http://stackoverflow.com/a/26833688
accepted answer: http://stackoverflow.com/a/26833688
type: Question
score: 4
has body: I would like to update a specific collection in MongoDb via Spark in Java. I am using the MongoDB Connector for Hadoop to retrieve and save information from Apache Spark to MongoDb in Java. After following Sampo Niskanen's excellent post regarding retrieving and saving collections to MongoDb via Spark, I got stuck with updating collections. MongoOutputFormat.java includes a constructor taking String[] updateKeys, which I am guessing is referring to a possible list of keys to compare on existing collections and perform an update. However, using Spark's saveAsNewApiHadoopFile() method with parameter MongoOutputFormat.class, I am wondering how to use that update constructor. save.saveAsNewAPIHadoopFile("file:///bogus", Object.class, Object.class, MongoOutputFormat.class, config); Prior to this, MongoUpdateWritable.java was being used to perform collection updates. From examples I've seen on Hadoop, this is normally set on mongo.job.output.value, maybe like this in Spark: save.saveAsNewAPIHadoopFile("file:///bogus", Object.class, MongoUpdateWritable.class, MongoOutputFormat.class, config); However, I'm still wondering how to specify the update keys in MongoUpdateWritable.java. Admittedly, as a hacky way, I've set the "_id" of the object as my document's KeyValue so that when a save is performed, the collection will overwrite the documents having the same KeyValue as _id. JavaPairRDD&lt;BSONObject,?&gt; analyticsResult; //JavaPairRdd of (mongoObject,result) JavaPairRDD&lt;Object, BSONObject&gt; save = analyticsResult.mapToPair(s -&gt; { BSONObject o = (BSONObject) s._1; //for all keys, set _id to key:value_ String id = ""; for (String key : o.keySet()){ id += key + ":" + (String) o.get(key) + "_"; } o.put("_id", id); o.put("result", s._2); return new Tuple2&lt;&gt;(null, o); }); save.saveAsNewAPIHadoopFile("file:///bogus", Object.class, Object.class, MongoOutputFormat.class, config); I would like to perform the mongodb collection update via Spark using MongoOutputFormat …
tagged with: mongodb
tagged with: apache-spark
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41749536
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26564832
has text: (your project name) - replace with name of your project

http://stackoverflow.com/comment/41813891
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26599754
has text: related: http://stackoverflow.com/questions/7970857/shifting-elements-in-an-array
type: Comment

http://stackoverflow.com/a/26658500
has comment: http://stackoverflow.com/comment/41920264
has comment: http://stackoverflow.com/comment/41923201
has comment: http://stackoverflow.com/comment/41919917
accepted answer of: http://stackoverflow.com/q/26658194
has body: You define onEdit2(event) inside the if statement block, but you never execute it. Defining a function inside of a block like that is bad practice. You can't really conditionally define a function. See this link for more information on why this is bad. It seems like you want to execute the onEdit2 function if the if condition is true. If so, you should define the function globally so you can execute it from wherever you need to. You probably want to do something like this: function onEdit(event){ var sheet = event.source.getActiveSheet(); var editedCell = sheet.getActiveCell(); var columnToSortBy = 10; var tableRange = "J:J3"; // What to sort. if(editedCell.getColumn() == columnToSortBy){ var range = sheet.getRange(tableRange); range.sort( { column : columnToSortBy, ascending: true } ); onEdit2(event); // Execute the function, passing it whatever event was passed to onEdit } } // End definition of onEdit function onEdit2(passedEvent) { // Do the actual function definition out here var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = passedEvent.source.getActiveSheet(); var r = passedEvent.source.getActiveRange(); if(s.getName() == "Orders" &amp;&amp; r.getColumn() == 10 &amp;&amp; r.getValue() == "5. Archive") { var row = r.getRow(); var numColumns = s.getLastColumn(); var targetSheet = ss.getSheetByName("Archive"); var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1); s.getRange(row, 1, 1, numColumns).moveTo(target); s.deleteRow(row); } }
answers question: http://stackoverflow.com/q/26658194
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41920117
has comment: http://stackoverflow.com/comment/41919432
score: 0
type: Answer

http://stackoverflow.com/q/26549581
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27089674
has comment: http://stackoverflow.com/comment/41721715
score: -5
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/41722108
type: Question
has title: Reading and sorting multiple files
has comment: http://stackoverflow.com/comment/41724075
upvote count: 0
has comment: http://stackoverflow.com/comment/41721721
downvote count: 5
has body: Here is the complete problem I am having issues with: Sort names without duplicates: Write a program that reads the names from all ten files, sorts all names (boy and girl names together, duplicates removed), and stores the sorted names in one file ten per line (only names, no ranks). The files show baby names and their ranking. An example file is set up like this: 1 Lewis 12,000 Sarah 50,000 //rank, boy name, amountBoy, girl name, amountGirl The first step would be reading from the ten files. How can I do that without creating a new Scanner or BufferedReader for each file? Please point me in the right direction. I'm NOT asking for a complete solution.
tagged with: sorting
has comment: http://stackoverflow.com/comment/41721904
answer count: 1
has comment: http://stackoverflow.com/comment/41721974
favorite count: 0

http://stackoverflow.com/comment/41918173
type: Comment
comment on: http://stackoverflow.com/a/26649434
score: 1
type: AnswerComment
has text: That's a poor recommendation; a misuse of the session scope @PredragMaric.

http://stackoverflow.com/comment/41762007
type: AnswerComment
comment on: http://stackoverflow.com/a/26565751
type: Comment
has text: +1, I wonder why you've been downvoted.
score: 0

http://stackoverflow.com/comment/41858110
comment on: http://stackoverflow.com/q/26624153
has text: Start by doing "a constructor that has three int parameters". Your constructor has no parameter at all right now. Once it has parameters, the rest should become obvious.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26624632
has comment: http://stackoverflow.com/comment/41860086
upvote count: 1
has comment: http://stackoverflow.com/comment/41858903
answers question: http://stackoverflow.com/q/26624418
has comment: http://stackoverflow.com/comment/41859873
type: Answer
has body: public static void main(String[] args) { Arraylist&lt;movie&gt; myMovieList =new ArrayList&lt;movie&gt;(); movie up = new movie(); up.setName("Up"); up.setDesc("To avoid being taken away to a nursing home, an old widower tries to fly his home to Paradise Falls, South America, along with a boy scout who accidently lifted off with him. "); up.setYear(2008); myMovieList.add(up) movie wallE = new movie(); wallE.setName("Wall-E"); wallE.setDesc("In the distant future, a small waste collecting robot inadvertently embarks on a space journey that will ultimately decide the fate of mankind."); wallE.setYear(2008); myMovieList.add(wallE) dispdesc(myMovieList); } public void dispdesc(ArrayList&lt;movie&gt; movieList){ for(movie object : movieList) { movieNum = movieNum + 1; System.out.println("Movie #" + movieNum); System.out.println("Title: " + getName()); System.out.println("Description: " + getDesc()); System.out.println("Year: " + getYear()); } }
has comment: http://stackoverflow.com/comment/41859108
downvote count: 0
has comment: http://stackoverflow.com/comment/41859744
score: 1
has comment: http://stackoverflow.com/comment/41860277

http://stackoverflow.com/q/26552820
downvote count: 0
favorite count: 0
has title: GSON @SerializedName to get value from inner array in json
possible better answer: http://stackoverflow.com/a/38076608
has answer: http://stackoverflow.com/a/38076608
has answer: http://stackoverflow.com/a/26552864
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: This is my json { name: "mark" subject: "maths" phone: 123-456-7890 email_addresses: [ { email: "mark@example.com", is_primary: true } ] } My java class goes like this public class Student { @SerializedName("name") private String mName; @SerializedName("subject") private String mSubject; @SerializedName("phone") private String mPhone; private String mEmail; } Is there a way for to use @SerializedName for mEmail, so that I would be able to get the email field from the first object in the email_addresses array
tagged with: gson
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26552864
answer count: 2

http://stackoverflow.com/comment/41691685
type: Comment
type: QuestionComment
has text: Do you have anything configured in an XML or properties file?
score: 0
comment on: http://stackoverflow.com/q/26532570

http://stackoverflow.com/comment/41847185
has text: toString is often used during debugging. You can put as much or as little as you want. if you want to print out info about the book in a program you should NOT use toString() but instead rely on the book's getter methods to get the values you want and make a new string with those.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26617203
type: AnswerComment

http://stackoverflow.com/q/26644657
has comment: http://stackoverflow.com/comment/41902984
has answer: http://stackoverflow.com/a/26667613
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41902727
tagged with: spring-aop
possible better answer: http://stackoverflow.com/a/61366235
accepted answer: http://stackoverflow.com/a/26667613
has answer: http://stackoverflow.com/a/61366235
has title: Injected bean becomes null after using AOP
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41900782
has body: I am using Spring4 along with Spring Boot. Before I tired to use AOP, my Bean(CommandService),which is used in the controller, is auto injected well, but after I tired to use AOP to collect some debug message, the bean becomes null! Here is my Application.java @Configuration @EnableAutoConfiguration @ComponentScan({"hello","wodinow.weixin.jaskey"}) public class Application extends { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); LogUtil.info("Beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { LogUtil.info(beanName); } LogUtil.info("Application Boots completes!"); } @Bean public CommandService commandService(){ LogUtil.debug("CommandService.getInstance()"+ CommandService.getInstance()) ;//here indeed I could see spring executes this and returns a object when application boots return CommandService.getInstance();//This returns a singleton instance } } My controller that throws null pointer: @Controller public class CoreController { @Autowired CommandService commandService;//here the service is null after using aop //...some request methods } The Aspect which I added just now: //if I comment out these two annoations, the bean will be auto injected well @Aspect @Component public class LogAspect { @Pointcut("execution(* wodinow.weixin.jaskey..*.*(..))") private void debug_log(){}; @Around("debug_log()") public void debug(ProceedingJoinPoint joinPoint) throws Throwable{ LogUtil.debug("enter "+joinPoint.getSignature()); try{ joinPoint.proceed(); LogUtil.debug("returns from "+joinPoint.getSignature()); } catch(Throwable t){ LogUtil.error(t.getMessage()+"occurs in "+joinPoint.getSignature(),t); throw t; } } } I am new to Spring, can anybody help me with this?
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41935499
has comment: http://stackoverflow.com/comment/41903252
tagged with: java

http://stackoverflow.com/comment/41924479
type: Comment
has text: When you will write program using lambda expression , it automatically decreases code size . http://www.developer.com/java/start-using-java-lambda-expressions.html
comment on: http://stackoverflow.com/a/26660466
type: AnswerComment
score: 0

http://stackoverflow.com/a/26555366
has comment: http://stackoverflow.com/comment/41737741
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26553797
has body: It seems your Main class is not complete. What is the condition for the do while loop to stop? Is there anything else in the main method than this loop?

http://stackoverflow.com/a/27167864
score: 5
has comment: http://stackoverflow.com/comment/42894722
has comment: http://stackoverflow.com/comment/42841239
has body: There is another common bottleneck : the size of the database connection pool. But I have an additional remark : when you exhaust the number of allowed HTTP connections, of the number of threads allowed to serve request, you will only reject some requests. But when you exhaust memory (too much sessions with too much data for example), you can crash the whole application. The difference is that in the case of heavy load for a short time, when load later falls down : in first case, the application is up and can serve requests normally in second case the application is down and must be restarted EDIT : I forgot to remember real use cases. The biggest problem I ever found for serving numerous concurrent connections is the quality of the database requests (assuming you use a database). There is not a direct impact since there is no maximum number, but you can easily hog all database server resources. Common examples of poor database requests : no index on a table with a large number of rows a request (on a big table) that makes no use of any index the n+1 syndrome : with a ORM when you map a one to many relation to a collection no eagerly when you always need data from the collection the load full database syndrome : with a ORM when you map all relations as eager, any single request ends in loading a high quantity of dependent data. What is worse with those problems, is that they can cause no harm in tests when the database is young because there are not that many rows, but with time and increasing number of rows performances fall giving a unusable application over few users.
upvote count: 5
has comment: http://stackoverflow.com/comment/42858856
type: Answer
has comment: http://stackoverflow.com/comment/42827371
downvote count: 0
answers question: http://stackoverflow.com/q/26576718
has comment: http://stackoverflow.com/comment/42841205

http://stackoverflow.com/a/26591415
has body: Your biggest consideration is the size of the compressed file. If the compressed file is still fairly large (1/2+ MB) I'd just use JSON or XML to encode the checksum &amp; data fields. If you feel like this file type should be the absolute SMALLEST it can be, I would suggest allocating the first x bytes of data... 4 would be an int, 6 would be a long, but you might need more... the size of this field should be the MAXIMUM you could ever imagine your file size being
type: Answer
accepted answer of: http://stackoverflow.com/q/26590007
answers question: http://stackoverflow.com/q/26590007
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/41816857
has text: In your `SendFile(...)` method you are closing `fileWriter` which closes the socket's output stream and that can't be reopened.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26601517
score: 0

http://stackoverflow.com/comment/41824979
has text: you can't instantiate interface.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26606259

http://stackoverflow.com/comment/41849028
type: AnswerComment
has text: @Krayo: no need to escape special characters in a character class, read the previous comments. Thanks anyway for this correction.
type: Comment
comment on: http://stackoverflow.com/a/26618349
score: 0

http://stackoverflow.com/q/26619893
has title: Embed a moving image inside another jpanel
has comment: http://stackoverflow.com/comment/41853952
has comment: http://stackoverflow.com/comment/41850764
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/26519141
type: UnansweredQuestion
tagged with: swing
has body: I've been trying to move, and display an image (e.g. heart rate image). Here is what I have so far. The image keeps moving to the left forvever; so far so good. But I need to embed this moving image inside another frame. I know my question seems very import java.awt.EventQueue; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class HeartBeat extends JPanel{ public static void main(String[] args) throws Exception { new HeartBeat(); } public HeartBeat(){ EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel j = new JPanel(); j.add(new HeartBeat2()); frame.add(j); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } class HeartBeat2 extends JPanel{ BufferedImage bi; public HeartBeat2(){ try { bi = ImageIO.read(new URL("https://i.sstatic.net/i8UJD.jpg")); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Runnable r = new Runnable() { @Override public void run() { final BufferedImage canvas = new BufferedImage( bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_INT_RGB); final JLabel animationLabel = new JLabel(new ImageIcon(canvas)); ActionListener animator = new ActionListener() { int x = 0; @Override public void actionPerfor…
tagged with: java
has comment: http://stackoverflow.com/comment/41852143
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26621910
score: -1
has comment: http://stackoverflow.com/comment/41853887

http://stackoverflow.com/a/26622554
has comment: http://stackoverflow.com/comment/41872140
has body: You should retrieve RecyclerView in a Fragment after inflating core View using that View. Perhaps it can't find your recycler because it's not part of Activity @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_artist_tracks, container, false); final FragmentActivity c = getActivity(); final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); LinearLayoutManager layoutManager = new LinearLayoutManager(c); recyclerView.setLayoutManager(layoutManager); new Thread(new Runnable() { @Override public void run() { final RecyclerAdapter adapter = new RecyclerAdapter(c); c.runOnUiThread(new Runnable() { @Override public void run() { recyclerView.setAdapter(adapter); } }); } }).start(); return view; }
score: 36
has comment: http://stackoverflow.com/comment/94555662
type: Answer
has comment: http://stackoverflow.com/comment/41872858
has comment: http://stackoverflow.com/comment/94518327
has comment: http://stackoverflow.com/comment/41873007
upvote count: 36
downvote count: 0
has comment: http://stackoverflow.com/comment/41873468
answers question: http://stackoverflow.com/q/26621060
has comment: http://stackoverflow.com/comment/41872445
has comment: http://stackoverflow.com/comment/48806781

http://stackoverflow.com/q/26666289
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26666422
favorite count: 0
tagged with: jaxb2
has title: How to get effective default value of XmlType#name?
has body: In my test utility code, I print XML content like this. public static &lt;T&gt; void printXml(final Class&lt;T&gt; type, final T instance) throws JAXBException { final JAXBContext context = JAXBContext.newInstance(type); final Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); if (type.getAnnotation(XmlRootElement.class) == null) { marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); final XmlType xmlType = type.getAnnotation(XmlType.class); // xmlType.name() -&gt; "##default" marshaller.marshal( new JAXBElement&lt;&gt;(new QName(xmlType.namespace(), xmlType.name()), type, instance), System.out); return; } marshaller.marshal(instance, System.out); } Types with @XmlRootElement work just fine. But when I tried to print a type which has not an @XmlRootElement I got this. &lt;##default xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="..."&gt; ... &lt;/##default&gt; The xmlns part is fine. The marshaller found the namespaceUri I want. The question is, see that ##default?, how can I find the name part? I want this. &lt;someName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="..."&gt; ... &lt;/someName&gt;
has answer: http://stackoverflow.com/a/26666422
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2

http://stackoverflow.com/a/26620426
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42006784
has comment: http://stackoverflow.com/comment/42014342
type: Answer
has body: Back to basics. A query parameter is an item after a question mark in a url, separated by the "&amp;" symbol e.g. yourwebsite.com/run?report=1&amp;reportName=dogs Here are two query params, report and reportName. You should never have to send a complex object in a GET request (what happens if you just paste this into your address bar). As you can probably tell, those query params are easy to parse as long and string. So no complex objects as query params. A path parameter is an item within the url e.g. yourwebsite.com/run/1 Here there is one path param, the "1". It's a path param because it's part of the actual path, it's not extra information provided like in query params (which are usually optional). You should send a complex object (like your report) in a request like POST or PUT where you are telling the server to update something and providing the multiple values. So, you've explained that you would like to pass an object to the receiving end. To do this, you should best change the @GET annotation to @POST, the path can stay the same. But you will not include your complex object as a query param. Instead, it should be posted as json. Dropwizard should do the deserialization, providing the property names match up. So your endpoint can look like so: @POST @Path("/run") public String runReport(Report report) { // } An example request to this would be to perform a POST to yourwebsite.com/run with json like: { serialVersionUID: 1, hashCode: 1, description: "xxx" } Also note, the properties in your Report class should be annotated with @JsonProperty to be deserialized. If anything isn't clear, leave a comment and I can try to help.
downvote count: 0
answers question: http://stackoverflow.com/q/26594394

http://stackoverflow.com/a/26554960
has comment: http://stackoverflow.com/comment/41732023
downvote count: 0
has body: is this what you want? char[][] squares=new char[10][10]; String[] initStrings = { "...../....", "../.......", "......./..", "..........", "......../.", "..........", "..........", "...../../.", "../....../", ".........." }; int i=0; for(char[] squareRow:squares) squareRow=initStrings[i++].toCharArray();
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26554722
has comment: http://stackoverflow.com/comment/41732044
has comment: http://stackoverflow.com/comment/41731913

http://stackoverflow.com/comment/41857603
score: 0
comment on: http://stackoverflow.com/q/26623358
type: QuestionComment
type: Comment
has text: I also tried it but was unsuccessful

http://stackoverflow.com/comment/41712078
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26544160
has text: if(cell.getType() == CellType.EMPTY) EmptyCell e = (EmptyCell) cell; e. -> no setVale() or setString() methods.
type: AnswerComment

http://stackoverflow.com/q/26566902
type: Question
has body: I read on a thread on another forum that Android is not based on JME while it is based on Java. I also read Android is based on Harmony. Please can I get explanations, links or documents about that.
tagged with: android
score: -2
has comment: http://stackoverflow.com/comment/41752808
upvote count: 2
has answer: http://stackoverflow.com/a/26566928
answer count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41752810
downvote count: 4
favorite count: 0
has title: What is the relation between Android JME and Harmony

http://stackoverflow.com/q/26668323
tagged with: android-asynctask
tagged with: android
has title: Service vs AsyncTask to handle Configuration Changes and a TCP connection
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26668647
accepted answer: http://stackoverflow.com/a/26668647
type: Question
tagged with: android-service
tagged with: android-configchanges
score: 0
has body: This is the situation: my app has one activity, handles a long-lasting TCP connection and updates the UI dynamically with a lot of stuff (HashTables of objects, buttons, ArrayLists, adapters...). At the moment, I handle the connection with an AsyncTask, and looking for a way to save: the connection all the variables, like dynamically created views when the screen rotates or the user receives a call, I found this: http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html which looks pretty cool to me. But I also read everywhere that I should use a service instead, because it's better for long lasting TCP connections. Why AsyncTask: it looks like I can save the TCP connection using a Fragment I'll have to do something similar anyway, in order to save objects, buttons, etc from rotation/calls I have only one activity that needs the connection (aren't services indicated for more than one?) Why service: no need to use Fragments to save the TCP connection (is it true? what kind of service, normal, IntentService since I only have one client, or bounded, should I use to do this?) better for long-lasting connections When I say "service", I assume that I'll have to run an AsyncTask inside the service anyway, so it doesn't handle the connection on the main activity. What should I do?
answer count: 1

http://stackoverflow.com/comment/41757934
comment on: http://stackoverflow.com/a/26567537
type: AnswerComment
has text: @user3570803 Like everything, it takes a little time to get to gross with it, but you'll get there! Btw please do click the tick to mark as selected answer if you found it helpful (gives you some rep points too).
score: 0
type: Comment

http://stackoverflow.com/a/26632218
has comment: http://stackoverflow.com/comment/41872572
score: 2
accepted answer of: http://stackoverflow.com/q/26631682
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Probably you forgot to add Camera permission to AndroidManifest.xml: &lt;uses-permission android:name="android.permission.CAMERA" /&gt; See at: http://developer.android.com/reference/android/hardware/Camera.html
type: Answer
answers question: http://stackoverflow.com/q/26631682

http://stackoverflow.com/a/26663824
upvote count: 10
has comment: http://stackoverflow.com/comment/41929587
has comment: http://stackoverflow.com/comment/41930143
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41930094
downvote count: 0
has comment: http://stackoverflow.com/comment/41929504
has body: This is the same problem that List#toArray() has. Type erasure prevents us from knowing the type of array we should return. Consider the following class Custom&lt;T&gt; { private T t; public Custom (T t) {this.t = t;} public T[] toArray() {return (T[]) new Object[] {t};} // if not Object[], what type? } Custom&lt;String&gt; custom = new Custom("hey"); String[] arr = custom.toArray(); // fails An Object[] is not a String[] and therefore cannot be assigned to one, regardless of the cast. The same idea applies to Stream and List. Use the overloaded toArray(..) method.
accepted answer of: http://stackoverflow.com/q/26663399
has comment: http://stackoverflow.com/comment/41929538
type: Answer
has comment: http://stackoverflow.com/comment/41929547
has comment: http://stackoverflow.com/comment/41929962
answers question: http://stackoverflow.com/q/26663399
score: 10
has comment: http://stackoverflow.com/comment/41929834
has comment: http://stackoverflow.com/comment/41930044

http://stackoverflow.com/comment/41893482
type: QuestionComment
has text: Look at the actual *value* that results in the NFE. Work backwards from there. Attaching a debugger and stepping through the code would be very .. enlightening.
score: 1
comment on: http://stackoverflow.com/q/26643515
type: Comment

http://stackoverflow.com/comment/41763080
type: QuestionComment
has text: Woah, 11 and 64. That's quite a difference in length. I must be reading the strings from the byte array in a wrong way. I should check where I'm doing this wrong. Thanks a lot!!
comment on: http://stackoverflow.com/q/26572507
score: 0
type: Comment

http://stackoverflow.com/q/26632880
has title: compare Cron Expression with current time
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26749115
tagged with: cronexpression
answer count: 1
downvote count: 0
favorite count: 0
score: 7
has answer: http://stackoverflow.com/a/26749115
has body: I am designing a scheduler and using quartz library. I want to check whether cron expression time refer to the time in the future, Otherwise trigger won't be executed at all. Is there any way of comparing cron expression time with current time in java.
tagged with: quartz-scheduler
upvote count: 7

http://stackoverflow.com/comment/41675668
has text: You can't override private methods - simply, as that.
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26523720

http://stackoverflow.com/a/26634368
type: Answer
upvote count: 2
downvote count: 2
has body: You have to copy the original List. For example, using constructor which accepts Collection. List&lt;String&gt; copy = new ArrayList&lt;String&gt;(original); Below code prints "A" List&lt;String&gt; org = new ArrayList&lt;String&gt;(); org.add("A"); List&lt;String&gt; copy = new ArrayList&lt;String&gt;(org); copy.add("B"); copy.clear(); System.out.println(org); Keep in mind that it makes only a shallow copy of the List. It's enough for List, but if your list contains mutable objects you should create deep copy of the list.
score: 0
answers question: http://stackoverflow.com/q/26634304

http://stackoverflow.com/comment/41663378
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26516440
has text: Try to add your Strings to the List directly in the Item constructor

http://stackoverflow.com/comment/41933142
type: Comment
has text: How can I then add the pop up screen saying that the username/password is incorrect, i have tried inserting that also into the loop but all it does is open the next screen and then open the pop up 3 more times.
type: AnswerComment
comment on: http://stackoverflow.com/a/26665566
score: 0

http://stackoverflow.com/comment/41896506
has text: @kittu88 you can check demo and modify it acc to your needs :) i got no idea about jsup
type: Comment
comment on: http://stackoverflow.com/a/26624732
type: AnswerComment
score: 0

http://stackoverflow.com/q/26537970
has comment: http://stackoverflow.com/comment/41704723
type: Question
has body: I'm trying to import data into an Oracle database using Spring and Hibernate. I'm baffled by a mysterious pause which is crippling the performance of my program. Here's a typical cycle. Note the gap of a minute and a half after "disabling autocommit". 2014-10-23 12:03:20,054 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.j.i.LogicalConnectionImpl - Obtaining JDBC connection 2014-10-23 12:03:20,054 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.j.i.LogicalConnectionImpl - Obtained JDBC connection 2014-10-23 12:03:20,054 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.t.spi.AbstractTransactionImpl - begin 2014-10-23 12:03:20,054 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.t.i.jdbc.JdbcTransaction - initial autocommit status: true 2014-10-23 12:03:20,054 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.t.i.jdbc.JdbcTransaction - disabling autocommit 2014-10-23 12:04:52,759 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.t.spi.AbstractTransactionImpl - committing 2014-10-23 12:04:52,759 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Processing flush-time cascades 2014-10-23 12:04:52,759 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Dirty checking collections 2014-10-23 12:04:52,760 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 100 objects 2014-10-23 12:04:52,760 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections 2014-10-23 12:04:52,760 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.internal.util.EntityPrinter - Listing entities: (ton of logged entity data snipped) 2014-10-23 12:04:52,761 1.0.0-SNAPSHOT [ForkJoinPool.commonPool-worker-2] DEBUG o.h.internal.util.EntityP…
score: 3
tagged with: hikaricp
downvote count: 0
has comment: http://stackoverflow.com/comment/41701905
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
tagged with: spring
answer count: 0
has title: Mysterious pause in Spring + Hibernate
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41708749
has comment: http://stackoverflow.com/comment/41725405

http://stackoverflow.com/comment/41819221
has text: Note: The OP has the same issue in the `if` and `else-if` conditions
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26603005

http://stackoverflow.com/a/26648272
downvote count: 0
answers question: http://stackoverflow.com/q/26644135
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41933065
upvote count: 1
has comment: http://stackoverflow.com/comment/41927943
has body: You did not define a word, hence I will take this as a word character sequence, and here is an approach without exclusively using regexes, by iterating through splitting the String: String str = "word3 word2 word3 word4 word5 word3 word7 word8 word9 word10"; String[] words = str.split("\\W+"); for (int i = 0; i &lt; words.length; i++) { // Iterate in an inner loop for nearby elements if "word5" is found. if (words[i].equals("word5")) for (int j = Math.max(0, i - 3); j &lt; Math.min(words.length, i + 3); j++) if (words[j].equals("word3")) { // Do something with words[j] to show that you know it exists. // Or use it right here instead of assigning this debug value. words[j] = "foo"; } } // Prints the result. for (final String word : words) System.out.println(word); Code Demo STDOUT: word3 word2 foo word4 word5 foo word7 word8 word9 word10 Otherwise, here's the regex replacement: Pattern pattern = Pattern.compile("word3(?=(?:\\W*\\w++){0,2}?\\W*+word5)|(word5(?:\\W*\\w++){0,2}?\\W*+)word3"); Matcher matcher; String str = "word3 word2 word3 word4 word5 word3 word7 word8 word9 word10"; while ((matcher = pattern.matcher(str)).find()) // Do something with matcher.group(1) to show that you know it exists. // Or use it right here instead of replacing with this empty value. str = matcher.replaceFirst(matcher.group(1) == null ? "" : matcher.group(1)); System.out.println(str); However while this regex works, replacing away the third word word3 deemed the first word word3 able to be replaced away, which is why regex is not the way to go for this. Code Demo STDOUT: word2 word4 word5 word7 word8 word9 word10 Small modification to make this work would be: str = matcher.replaceFirst((matcher.group(1) == null ? "" : matcher.group(1)) + "baz");
accepted answer of: http://stackoverflow.com/q/26644135
type: AcceptedAnswer

http://stackoverflow.com/a/26533901
has body: Your listview is null. This should do it: stats.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( getBaseContext(), android.R.layout.simple_list_item_1, info); lv = (ListView) findViewById(R.id.list); lv.setAdapter(adapter); } });
score: 0
answers question: http://stackoverflow.com/q/26533802
type: Answer
has comment: http://stackoverflow.com/comment/41694433

http://stackoverflow.com/comment/41687831
comment on: http://stackoverflow.com/a/26530477
type: AnswerComment
has text: Hey, thank you for the response. It still isn't working, i don't think your answer really understood what i was doing :( i think i might just go back to using private members :P
score: 0
type: Comment

http://stackoverflow.com/q/26518185
tagged with: buffer
has answer: http://stackoverflow.com/a/26522908
upvote count: 4
type: AnsweredQuestion
has body: I'm getting weird results I can't explain from a BufferedReader when I vary the size of the buffer. I had strongly expected that performance would gradually increase as I increased the size of the buffer, with diminishing returns setting in fairly quickly, and that thereafter performance would be more or less flat. But it seems that, after only a very modest buffer size, increasing the size of the buffer makes it slower. Here's a minimal example. All it does is run through a text file, and calculate the sum of the lengths of the lines. public int traverseFile(int bufSize) throws IOException { BufferedReader reader = new BufferedReader(new FileReader("words16"), bufSize*1024); String line; int total=0; while ((line=reader.readLine())!=null) total+=line.length(); reader.close(); return total; } I tried benchmarking this with various buffer sizes, and the results were rather odd. Up to about 256KB, performance increases; after that point, it gets worse. I wondered whether it was just the time taken to allocate the buffer, so I tried adding something in to make it always allocate the same total amount of memory (see second line below): public int traverseFile(int bufSize) throws IOException { byte[] pad = new byte[(65536-bufSize)*1024]; BufferedReader reader = new BufferedReader(new FileReader("words16"), bufSize*1024); String line; int total=0; while ((line=reader.readLine())!=null) total+=line.length(); reader.close(); return total; } This makes no odds. I am still getting the same results, on two different machines. Here are the full results: Benchmark Mode Samples Score Error Units j.t.BufferSizeBenchmark.traverse_test1_4K avgt 100 363.987 ± 1.901 ms/op j.t.BufferSizeBenchmark.traverse_test2_16K avgt 100 356.551 ± 0.330 ms/op j.t.BufferSizeBenchmark.traverse_test3_64K avgt 100 353.462 ± 0.557 ms/op j.t.BufferSizeBenchmark.traverse_test4_256K avgt 100 350.822 ± 0.562 ms/op j.t.BufferSizeBenchmark.traverse_test5_1024K avgt 100 356.949 ± 0.338 ms/op j.t.BufferSizeBench…
tagged with: java
accepted answer: http://stackoverflow.com/a/26519036
type: Question
has title: Why am I getting *worse* performance with a *larger* buffer in my BufferedReader?
tagged with: performance
possible better answer: http://stackoverflow.com/a/26522908
has answer: http://stackoverflow.com/a/26519036
score: 4
answer count: 2
tagged with: file-io
downvote count: 0
tagged with: bufferedreader
favorite count: 0

http://stackoverflow.com/comment/41926454
comment on: http://stackoverflow.com/q/26662036
type: Comment
type: QuestionComment
score: 2
has text: FYI, I, J, K, and L are called Interfaces, not Implementations

http://stackoverflow.com/comment/41855109
type: QuestionComment
has text: @camickr Wow, you're on the war path today ;)
score: 0
comment on: http://stackoverflow.com/q/26621830
type: Comment

http://stackoverflow.com/a/26565037
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26564952
has body: This is called JSON bi directional reference problem. Refere : http://wiki.fasterxml.com/JacksonFeatureBiDirReferences Check @JsonIdentityInfo and the @JsonBackReference/@JsonManagedReference Annotate your entities with @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") should solve your problem.

http://stackoverflow.com/comment/41766856
type: Comment
comment on: http://stackoverflow.com/a/26572304
score: 0
type: AnswerComment
has text: In general, duck typing may lead to abuse of such a potential OR clause in generics. However, there are some cases where the usefulness of the OR clause would exist in absence of duck typing. The one I reported is an example (think of B as a "Boolean" or a third party library class).

http://stackoverflow.com/comment/41741241
has text: Did you try loading `/hello`?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26559947
type: AnswerComment

http://stackoverflow.com/q/26521983
tagged with: java
type: Question
tagged with: graphics
tagged with: sorting
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26522066
answer count: 1
type: UnansweredQuestion
has title: Graphics Draw-Ordering using ArrayList sorting
tagged with: performance
has body: There are similar questions to this, but they're asking how this is done. I know how, but I want to know why it doesn't work in the case I'm about to mention. I've been trying to tweak an engine for a 2D game--sort of along the lines of Legend of Zelda. It has levels, tiles, entities (this may sound familiar) and everything I've implemented with it has worked great so far. I created an entity called Wanderer that, predictably, wanders around the level. When first making the class, I became annoyed with how it always drew over my player character regardless of my position. So I thought a simple fix would be to just continually sort the Level class's "entities" ArrayList based on each entity's y position. public void tick(){ Collections.sort(entities, new DrawComp()); for(Entity e : entities){ e.tick(); } for(Tile t : Tile.tiles){ if(t == null) break; t.tick(); } } class DrawComp implements Comparator&lt;Entity&gt;{ public int compare(Entity e1, Entity e2){ if(e1.y &lt; e2.y) return -1; else if(e1.y == e2.y){ if(e1.x &lt; e2.x) return -1; } return 0; } } It worked great. I had a few Wanderers on screen and if I walked behind one my player would draw behind it, and if I walked in front of one my player would draw in front of it. The problem happens when I add more Wanderers. The whole thing breaks down. When I display the entities' indexes above them, I see 17's above 37's and 36's above 22's. It works for some, and not for others. So here's what I want to know: Why won't the ArrayList sort function always work properly? Is sorting a larger ArrayList at a faster rate something that takes too much resources?

http://stackoverflow.com/q/26516606
has answer: http://stackoverflow.com/a/26524052
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41675857
possible better answer: http://stackoverflow.com/a/26516884
score: 1
has comment: http://stackoverflow.com/comment/41665144
tagged with: java
has body: So I am working on a blackjack game, I have wrote a render process which will render a card going out of the cards stack and sliding to the place where it shows all dealer's cards. My method works fine, except one problem which I will elaborate: Whenever Y coordinate reaches the target Y coordinate first, the sprite will only move on X-asis because it cant move Y anymore, instead of making a straight angle to the point. So what it will do is move up diagonally and then instantly go to the right (in my case) GIF: (source: gyazo.com) MP4 (choose mp4 in the (..) menu http://gyazo.com/bec6daadcb46bedc4777a3e4c5ff8c77) As you can see, it does what I just said. What did I do wrong? how can I make it motion in a straight angle to the target without going diagonal up and than turn right away? My process code: // If the target is on the right side of the start point if (startPoint.getX() &lt; endPoint.getX()) { if (current.getX() &lt; endPoint.getX()) { current.x += moveSpeed; if (current.getX() &gt; endPoint.getX()) { current.x = (int) endPoint.getX(); } } else { xDone = true; } } else { if (current.getX() &gt; endPoint.getX()) { current.x -= moveSpeed; if (current.getX() &lt; endPoint.getX()) { current.x = (int) endPoint.getX(); } } else { xDone = true; } } // Vise-versa if (startPoint.getY() &lt; endPoint.getY()) { if (current.getY() &lt; endPoint.getY()) { current.y += moveSpeed; if (current.getY() &gt; endPoint.getY()) { current.y = (int) endPoint.getY(); } } else { yDone = true; } } else { if (current.getY() &gt; endPoint.getY()) { current.y -= moveSpeed; if (current.getY() &lt; endPoint.getY()) { current.y = (int) endPoint.getY(); } } else { yDone = true; } } // Callback, dw about it CardContainer.getCardSprite(CardContainer.SPECIAL, 0).drawSprite((int) current.getX(), (int) current.getY()); // Alert finished, in poisiuton if (xDone &amp;&amp; yDone) { ch.submitCard(card); } current = current position startPoint = the start point endPoint = the end point Thanks! EDite…
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41663281
accepted answer: http://stackoverflow.com/a/26524052
has title: Motion move sprite from point to point diagonally
answer count: 2
downvote count: 0
favorite count: 0
tagged with: geometry
has answer: http://stackoverflow.com/a/26516884
has comment: http://stackoverflow.com/comment/41663331

http://stackoverflow.com/a/26546278
accepted answer of: http://stackoverflow.com/q/26546196
answers question: http://stackoverflow.com/q/26546196
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41715653
type: Answer
score: 1
upvote count: 1
has body: try changing the version of database and then running it on phone. also post your SQLiteOpenHelper class code.
has comment: http://stackoverflow.com/comment/41715704

tableview
tags question: http://stackoverflow.com/q/26563390
type: Tag
tag name: tableview
tags question: http://stackoverflow.com/q/26609350
tags question: http://stackoverflow.com/q/26588540

http://stackoverflow.com/a/26629012
has body: Try using: Windows java -classpath java-mail-1.4.4.jar;. SendMail note this ----^
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26628969
type: Answer
accepted answer of: http://stackoverflow.com/q/26628969

http://stackoverflow.com/comment/41683062
type: QuestionComment
comment on: http://stackoverflow.com/q/26527918
has text: I already tried this it doesn't make a difference. The problem is that it returns 0 when there should be data. you can see in the logcat. there is no data available for 9 seconds, and then suddenly 776 bytes are available. very strange.
score: 0
type: Comment

http://stackoverflow.com/comment/68586443
score: 7
has text: The other proposed solution is better because it will pre-allocate the full size once, instead of possibly having to allocate the default size & then re-allocate space for the sublist while adding the elements.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26575088

http://stackoverflow.com/q/26543447
has answer: http://stackoverflow.com/a/26543795
has title: Android Environment Variable Setup in Windows 8.1
has body: installed jdk1.7 in my machine and I setup environment variable for jdk its working fine How to set up environment variable Android_Home in windows and How to check that whether android environment variable is properly set or not For java we use javac command to check the java environment setup like I need to find for android too can any one knows about this thanks
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: environment-variables
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/a/26615122
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41842427
has comment: http://stackoverflow.com/comment/41842392
type: Answer
answers question: http://stackoverflow.com/q/26614919
score: 0
has body: You could use enum to avoid instanceof: public enum AccountType { Check, Saving } public class Account { void Print(); AccountType getAccountType(); } public class SavingsAccount extends Account { void Print(){}; AccountType getAccountType() { return AccountType.Saving; } } public class CheckingAccount extends Account { void Print(){}; AccountType getAccountType() { return AccountType.Check; } } Now, if you want to know the type of an Account instance: Account a = ... switch(a.getAccountType()) { case Check: // do something specific to checking account break; case Saving: //do something specific to saving account break; default: break; } BTW, the use of extends to inherits classes is even worse than using instanceof in my opinion.

http://stackoverflow.com/a/43428864
has body: I've observed this incorrect behaviour as well in IBM JVM 1.7.0 while in Oracle JVM 1.6.0 this works as expected. The explanation is that IBM JVM apparatently has an internal bug which manifests by calling clock_gettime system call with incorrect clock_id parameter (random negative value). The workaround (not a fix) is to modify libfaketime.c to reset the clock_id to valid value in fake_clock_gettime function. case FT_START_AT: /* User-specified offset */ if (user_per_tick_inc_set) { /* increment time with every time() call*/ next_time(tp, &amp;user_per_tick_inc); } else { if (clk_id &lt; 0) { // jvm calls clock_gettime() with invalid random negative clock_id value clk_id = CLOCK_REALTIME; } switch (clk_id) // the rest is the same This will prevent the libfaketime.so.1 library from existing on error you are observing printf("\nInvalid clock_id for clock_gettime: %d", clk_id); exit(EXIT_FAILURE); Please note this workaround has a drawback that in case JVM is incorrectly asking system for invalid clockid, we will assume valid clockid which may be not what application expects.
answers question: http://stackoverflow.com/q/26602617
type: Answer
score: 0

http://stackoverflow.com/comment/41792815
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26588976
has text: Treat each row as an individual array. Sort the second row according to how you sorted the first row.
score: 0

http://stackoverflow.com/q/26658903
tagged with: object
has comment: http://stackoverflow.com/comment/41920468
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41920549
tagged with: arraylist
upvote count: 0
has comment: http://stackoverflow.com/comment/41920133
has body: How do I make a get method for an ArrayList? I have the method header but I have no idea how to proceed. public Object get(int i) { }
favorite count: 0
has comment: http://stackoverflow.com/comment/41920059
has title: How to make a get method for an arrayList in Java?
type: Question
has comment: http://stackoverflow.com/comment/41920150
has answer: http://stackoverflow.com/a/26659013
tagged with: getmethod
score: -1
has comment: http://stackoverflow.com/comment/41920442
tagged with: java
has comment: http://stackoverflow.com/comment/41920314
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41920267

http://stackoverflow.com/comment/41923473
has text: @MichailMichailidis How will be verify when there is no vowel in given string ?
comment on: http://stackoverflow.com/a/26660466
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26539724
type: Question
has comment: http://stackoverflow.com/comment/41704483
has body: Is it possible to include a starting seed with the Math.random method in Java? If so, what would the statement look like? I know how to include a starting seed in the Random class but how do I do this if I want to use the Math.random method instead of using the Random class?
has comment: http://stackoverflow.com/comment/41704506
upvote count: 2
duplicate of: http://stackoverflow.com/q/17445813
answer count: 2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41704521
linked to: http://stackoverflow.com/q/17445813
has answer: http://stackoverflow.com/a/26540027
score: 2
has title: Math.random starting seeds
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26539757
has comment: http://stackoverflow.com/comment/41704477

http://stackoverflow.com/comment/41746063
has text: Design issues, maintainability issues, backward compatibility issues, yes. But why would it raise security issues? Access modifiers are not security tools. Anyone can access private state with reflection. Access modifiers are design tools
type: AnswerComment
score: 5
type: Comment
comment on: http://stackoverflow.com/a/26563040

http://stackoverflow.com/q/26590456
downvote count: 0
has comment: http://stackoverflow.com/comment/41795798
has comment: http://stackoverflow.com/comment/41795835
score: 3
accepted answer: http://stackoverflow.com/a/26592517
favorite count: 0
tagged with: swing
has title: How to add an editable text box in JPanel
tagged with: text
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41795824
has answer: http://stackoverflow.com/a/26592517
has body: I am looking to add a text-box onto my JPanel. This text box will be similar to something like in Microsoft PowerPoint: one that you can resize, move around, etc. I have looked into JTextField but I don't think this is what I need. I do not need a popup box like this: I have a program that allows the user to add, resize and move shapes. I now want to be able to place a text box into these shapes. Here is an example of what I am looking for: Is there anyway I can do this? Thanks.
has comment: http://stackoverflow.com/comment/41795756
answer count: 1

http://stackoverflow.com/q/26600867
has title: java class main error for crontab
has answer: http://stackoverflow.com/a/26601169
possible better answer: http://stackoverflow.com/a/26601169
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41815722
type: Question
has answer: http://stackoverflow.com/a/26601741
accepted answer: http://stackoverflow.com/a/26601741
has body: When I try to run the exe jar file in unix: $ java -jar /tnpm_pm_test.jar It runs properly without any errors but when I try to add it in a crontab */15 * * * * /usr/bin/java java -jar /home/user1/tnpm/tnpm_pm_test.jar &amp;&gt; /dev/null I'm getting the error below: Exception in thread "main" java.lang.NoClassDefFoundError: version Caused by: java.lang.ClassNotFoundException: version at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) Could not find the main class: version. Program will exit. I'm not sure what exaclty is the difference between running it independently and using crontab. Anyone knows? whereis java = java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java which java = /usr/bin/java
score: 0
answer count: 2

http://stackoverflow.com/a/26578424
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26578368
downvote count: 0
type: Answer
has body: One way to solve this that does not require use of Thread#join and thus allows the two threads to run independently: Use an Observer Pattern listener interface, such as which can be obtained via Java Beans PropertyChangeSupport and a PropertyChangeListener. Don't extend Thread but instead implement Runnable. For example: import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import javax.swing.event.SwingPropertyChangeSupport; public class MainThreadTest { public static void main(String[] args) { DispThread2 dt2 = new DispThread2(); dt2.addPropertyChangeListener(DispThread2.STATE, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println("DT2 Thread state (from Main Thread): " + evt.getNewValue()); if (evt.getNewValue() == DispThreadState.DONE) { System.out.println("Thread dt2 is now done (from Main Thread)"); } } }); new Thread(dt2, "DT2").start(); System.out.println("Thread dt2 has started"); } } class DispThread2 implements Runnable { public static final String STATE = "state"; private volatile DispThreadState state = DispThreadState.PENDING; private PropertyChangeSupport support = new SwingPropertyChangeSupport(this); public void addPropertyChangeListener(PropertyChangeListener listener) { support.addPropertyChangeListener(listener); } public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { support.addPropertyChangeListener(propertyName, listener); } public void removePropertyChangeListener(PropertyChangeListener listener) { support.removePropertyChangeListener(listener); } public void run() { setState(DispThreadState.RUNNING); long endTimemillis = System.currentTimeMillis() + 10000; while (System.currentTimeMillis() &lt; endTimemillis) { } System.out.println("The task is done"); setState(DispThreadState.DONE); } public DispThreadState getState() { return state; } public void setState(DispThreadState sta…

http://stackoverflow.com/comment/41666266
has text: Is the project appCompatV7 is open or shown in your workSpace?
score: 0
comment on: http://stackoverflow.com/q/26518144
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41912077
type: QuestionComment
comment on: http://stackoverflow.com/q/26653818
has text: And why wouldn't others be allowed to create an object? Even a private constructor isn't a guarantee, using reflection I could still create an instance of the class (Spring with XML does this also). Given it is a little harder but there is no guarantee no-one will create another instance.
score: 0
type: Comment

http://stackoverflow.com/comment/41941779
comment on: http://stackoverflow.com/a/26669074
has text: @Dhilip Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(browserIntent) but this code ask where to open in chrome or Firefox. i like to show that page in my web view itself.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26612950
downvote count: 3
type: Question
score: -1
upvote count: 2
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41837535
has comment: http://stackoverflow.com/comment/41837437
answer count: 1
has answer: http://stackoverflow.com/a/26613513
has comment: http://stackoverflow.com/comment/41838008
has body: When we enter a no like "00982787878" (having 9 digits and zeros) the output should not be displayed after the zeros are trimmed. Problem: There is some problem in while loop as the output is a number with just one 0 trimmed. Code: public static String trimZeros(String mobNumber) { boolean exitLoop = true; int count = 0; while (exitLoop && mobNumber.substring(count) == "0") mobNumber = mobNumber.substring(0); if (mobNumber.charAt(count) != '0') { exitLoop = false; } count++; mobNumber = mobNumber.replaceAll(" ", ""); mobNumber = mobNumber.length() < 10 ? mobNumber.substring(mobNumber .length()) : mobNumber.substring(mobNumber.length() - 10); return mobNumber; }
has comment: http://stackoverflow.com/comment/41838396
favorite count: 0
has comment: http://stackoverflow.com/comment/41837445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41838384
linked to: http://stackoverflow.com/q/15889853
has comment: http://stackoverflow.com/comment/41837533
has title: String function to accept the 10 digit mobile no. , discards any no. less than 10 digits, trims zeroes at the beginning
tagged with: java

http://stackoverflow.com/a/26529449
has comment: http://stackoverflow.com/comment/41875796
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26529011
score: 3
upvote count: 3
has body: you could run an ISQL script that calls the stored procedure sp_helptext to get the code of the stored procedure. Hope this helps.

http://stackoverflow.com/comment/41893204
has text: Aside: if `foo += foo + 1;` shows up on an exam, your instructor is a stupid jerk.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26598481

http://stackoverflow.com/comment/41805379
type: QuestionComment
has text: Just add a new boolean field to class `Die` which you can set to `true` or `false` in the listner. And if it is true, then method `roll()` should not do anything. Btw, remove the obsolete `main` method from that class.
score: 0
comment on: http://stackoverflow.com/q/26595265
type: Comment

http://stackoverflow.com/comment/41909740
has text: i am getting this error in the RAD console when i fire a soap request on my wsdl endpoint which is hosted on my local server.
comment on: http://stackoverflow.com/q/26643360
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26628328
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26627439
upvote count: 2
has body: Suppose you do this: Scanner scanner = new Scanner(new File("/file/does/not/exist")); and the constructor throws FileNotFoundException. The first thing to note is that the constructor does not return a Scanner object. Instead the new expression will terminate abnormally, and the assignment to scanner won't happen. Control will eventually end up in some handler for the exception, which won't be able to refer to scanner because it is out of scope. So to answer your question: if the error actually gets thrown, does the scanner object get closed, or do I still have to do that when I handle the exception? If FileNotFoundException is thrown by the constructor, there is no Scanner object to close() ... so you don't need to close it. However, depending on how you wrote the code, you may reach a handler or a finally block without knowing whether an exception was thrown at all, whether it was thrown in the constructor, or after the constructor completed. The way to deal with this depends on which version of Java you are using. Prior to Java 7, the idiom is something like @Sangeeth's answer. For Java 7 and later you can write this: try (Scanner scanner = new Scanner(new File(path))) { //your code here } catch (FileNotFoundException e) { //log it } Note that the "try-with-resources" syntax has an implicit finally that automatically calls close() on each of the (autocloseable) resources declared at the start of the try. This absolves you of responsibility for the fiddly code that closes the resources in the various possible success and failure cases. In fact, we can take this a level deeper. The Scanner constructor calls FileInputStream to open the file, and that is where the FileNotFoundException would be thrown. In turn, this will call through to the native open method to actually open the file. If something goes wrong in this process (and an exception is thrown), then it is the constructors' responsibility to ensure that any resources are freed (e.g. native streams are closed…
downvote count: 0

http://stackoverflow.com/comment/41668786
score: 0
type: Comment
has text: If it wasn't for Barry, I would still have been pondering how to do what I was trying to do. All Barry did was he got me started on the toolbar, which I accomplished the rest (adding Actionlistener and such) I mean it was a simple thing that I over-complicated. And It is not like he did the whole assignment for me. He just showed me a path of what I was trying to do. The link you sent me also helped me but took a bit more time for me to understand due to Abstractness of the material. That is why I refer places like this, to run away from abstractness of the material that can be taught easily.
comment on: http://stackoverflow.com/a/26516054
type: AnswerComment

http://stackoverflow.com/q/26541282
accepted answer: http://stackoverflow.com/a/26580278
has answer: http://stackoverflow.com/a/26541378
tagged with: css
has comment: http://stackoverflow.com/comment/41726895
has title: GWT - Java - CSS - background-color not showing
type: Question
tagged with: gwt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26580278
tagged with: java
has body: I have cleared my cache and tried Chrome and IE and a number of different ways of coding, however I can not get the background-color of the buttons (pencilButton, blueButton, greenButton and redButton) to display. The java code is: //Create the colour choice buttons and add them to the HorizontalPanel "headingContainer". //Pencil final Button pencilButton = new Button("P"); pencilButton.addStyleName("pencilButton"); headingContainer.add(pencilButton); //Set the pencil colour to pencil. pencilButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pencilColour = "black"; } }); //Blue final Button blueButton = new Button("B"); blueButton.addStyleName("blueButton"); headingContainer.add(blueButton); //Set the pencil colour to blue. blueButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pencilColour = "blue"; } }); //Green final Button greenButton = new Button("G"); greenButton.addStyleName("greenButton"); headingContainer.add(greenButton); //Set the pencil colour to green. greenButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pencilColour = "green"; } }); //Red final Button redButton = new Button("R"); redButton.addStyleName("redButton"); headingContainer.add(redButton); //Set the pencil colour to red. redButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pencilColour = "red"; } }); And the CSS is: .blueButton { display: block; width: 25px; height: 25px; background-color: blue; opacity: 1; } .greenButton { display: block; width: 25px; height: 25px; background-color: green; background-size: 100% 100%; } .pencilButton { display: block; width: 25px; height: 25px; background-color: grey; background-size: 100% 100%; opacity: 1; } .redButton { display: block; width: 25px; height: 25px; background-color: red; } You will notice that I have tried something different in each one to try to get the background colour to show. The theory being that once I …
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2322779
possible better answer: http://stackoverflow.com/a/26541378

mysql
tags question: http://stackoverflow.com/q/26576330
tags question: http://stackoverflow.com/q/26546174
tags question: http://stackoverflow.com/q/26647557
tags question: http://stackoverflow.com/q/26648409
tags question: http://stackoverflow.com/q/26631267
tags question: http://stackoverflow.com/q/26520248
tags question: http://stackoverflow.com/q/26574032
tags question: http://stackoverflow.com/q/26514740
tags question: http://stackoverflow.com/q/26662021
tags question: http://stackoverflow.com/q/26531835
tags question: http://stackoverflow.com/q/26658152
tags question: http://stackoverflow.com/q/26671824
tags question: http://stackoverflow.com/q/26629851
tags question: http://stackoverflow.com/q/26556490
tag name: mysql
tags question: http://stackoverflow.com/q/26573444
tags question: http://stackoverflow.com/q/26626301
tags question: http://stackoverflow.com/q/26549300
tags question: http://stackoverflow.com/q/26568003
tags question: http://stackoverflow.com/q/26615426
tags question: http://stackoverflow.com/q/26670073
tags question: http://stackoverflow.com/q/26530947
tags question: http://stackoverflow.com/q/26643085
tags question: http://stackoverflow.com/q/26596547
tags question: http://stackoverflow.com/q/26587703
tags question: http://stackoverflow.com/q/26650651
tags question: http://stackoverflow.com/q/26515056
tags question: http://stackoverflow.com/q/26548783
tags question: http://stackoverflow.com/q/26623857
tags question: http://stackoverflow.com/q/26653342
tags question: http://stackoverflow.com/q/26525567
tags question: http://stackoverflow.com/q/26669801
tags question: http://stackoverflow.com/q/26649675
tags question: http://stackoverflow.com/q/26560556
tags question: http://stackoverflow.com/q/26610663
tags question: http://stackoverflow.com/q/26669761
tags question: http://stackoverflow.com/q/26649705
tags question: http://stackoverflow.com/q/26589976
tags question: http://stackoverflow.com/q/26666622
tags question: http://stackoverflow.com/q/26608044
tags question: http://stackoverflow.com/q/26652352
tags question: http://stackoverflow.com/q/26632644
tags question: http://stackoverflow.com/q/26582977
tags question: http://stackoverflow.com/q/26647689
tags question: http://stackoverflow.com/q/26560568
tags question: http://stackoverflow.com/q/26672682
tags question: http://stackoverflow.com/q/26553552
tags question: http://stackoverflow.com/q/26670459
tags question: http://stackoverflow.com/q/26557900
tags question: http://stackoverflow.com/q/26624262
tags question: http://stackoverflow.com/q/26559909
tags question: http://stackoverflow.com/q/26608546
tags question: http://stackoverflow.com/q/26576251
tags question: http://stackoverflow.com/q/26647179
tags question: http://stackoverflow.com/q/26551554
type: Tag
tags question: http://stackoverflow.com/q/26639078
tags question: http://stackoverflow.com/q/26625202
tags question: http://stackoverflow.com/q/26661711
tags question: http://stackoverflow.com/q/26582722
tags question: http://stackoverflow.com/q/26651621
tags question: http://stackoverflow.com/q/26637924
tags question: http://stackoverflow.com/q/26528193
tags question: http://stackoverflow.com/q/26555279
tags question: http://stackoverflow.com/q/26671600
tags question: http://stackoverflow.com/q/26605717
tags question: http://stackoverflow.com/q/26647395
tags question: http://stackoverflow.com/q/26583715
tags question: http://stackoverflow.com/q/26538804
tags question: http://stackoverflow.com/q/26575669
tags question: http://stackoverflow.com/q/26641623
tags question: http://stackoverflow.com/q/26607949
tags question: http://stackoverflow.com/q/26583840
tags question: http://stackoverflow.com/q/26541291
tags question: http://stackoverflow.com/q/26550472
tags question: http://stackoverflow.com/q/26576549
tags question: http://stackoverflow.com/q/26602606
tags question: http://stackoverflow.com/q/26668154
tags question: http://stackoverflow.com/q/26651771
tags question: http://stackoverflow.com/q/26562619

http://stackoverflow.com/comment/41735834
type: Comment
has text: But it's still only a "guess" - render could be using a `BufferedStrategy` or even some other framework...better to ask clarification avoid the potential down votes ;)
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26557258

http://stackoverflow.com/comment/41705303
type: AnswerComment
score: 0
has text: Synchronization actually happens after the write,not during. You are probably thinking of MUTEX, which `volatile` does not provide at all. As for N instances of `InetSocketAddress`, they *are* immutable, so maybe not as much problem as you think.
type: Comment
comment on: http://stackoverflow.com/a/26539643

http://stackoverflow.com/q/26564200
tagged with: java
type: Question
tagged with: firebird
has answer: http://stackoverflow.com/a/26567258
tagged with: sql
downvote count: 0
answer count: 1
favorite count: 0
tagged with: listener
has body: I need to develop app which could do this: user launches few copies of my app, in every copy there's one table with data from Firebird database. When user changes something in one copy of app, any other copies must immediately show the changed data. How to do it? I thought about some "UpdateListener", but couldn't find something similar in JDBC driver. P.S. update tables every second isn't a way.
upvote count: 2
accepted answer: http://stackoverflow.com/a/26567258
has title: Firebird JDBC update listener
tagged with: jdbc
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26536316
downvote count: 0
answers question: http://stackoverflow.com/q/26536173
has body: You must use Java 8 or above to have default implementations in interfaces. Instead you could use an abstract class. But even then, you wouldn't use the default keyword.
type: Answer
has comment: http://stackoverflow.com/comment/41736415
score: 1
has comment: http://stackoverflow.com/comment/41698808
upvote count: 1

http://stackoverflow.com/a/26543187
has comment: http://stackoverflow.com/comment/41710680
has comment: http://stackoverflow.com/comment/41710960
downvote count: 0
has comment: http://stackoverflow.com/comment/41710352
type: AcceptedAnswer
upvote count: 6
type: Answer
has body: The correct way to avoid this is to use the wait/notify mechanism implemented by java.lang.Object, or one of the higher level concurrency mechanisms provided by the Java class libraries: semaphores, latches / cyclic barriers, blocking queues; e.g. the classes that implemented the BlockingQueue interface. (Pick the mechanism that is the best match for what your specific use-case ...) Using Thread.sleep is not a good solution. While you reduce CPU load (compared with a polling loop), the flip-side is that you reduce responsiveness. I'm using a BlockingQueue now. But maybe I'm doing it incorrectly. I just added the actually code above. Do you see my problem? Yea. You are using the queue in a way that is designed to avoid blocking. That's the wrong approach. You should use take() (which will block until an entry becomes available) instead of poll(), and get rid of the code that tests the queue size. Your "killMeMailbox" stuff seems to be designed to allow you to stop waiting for mail. You should be able to implement that using Thread.interrupt. (An interrupt will unblock a take() call ...)
accepted answer of: http://stackoverflow.com/q/26543064
has comment: http://stackoverflow.com/comment/41710379
answers question: http://stackoverflow.com/q/26543064
score: 6
has comment: http://stackoverflow.com/comment/41710717

google-oauth
type: Tag
tag name: google-oauth
tags question: http://stackoverflow.com/q/26615522

http://stackoverflow.com/comment/41774598
type: QuestionComment
type: Comment
has text: You should setup your database. http://dba.stackexchange.com/questions/27328/how-large-should-be-mysql-innodb-buffer-pool-size And could you post your create table query?
score: 0
comment on: http://stackoverflow.com/q/26576251

http://stackoverflow.com/comment/41802920
type: QuestionComment
has text: You need to make an ActionListener for your button and then only take the code after the button has been pressed. I had a similar issue with my code [HERE](http://stackoverflow.com/questions/26198989/how-to-wait-for-user-input-when-using-jtextfields)
comment on: http://stackoverflow.com/q/26594046
score: 0
type: Comment

http://stackoverflow.com/q/26596857
score: 1
tagged with: java
tagged with: helios
accepted answer: http://stackoverflow.com/a/26596928
tagged with: inputstream
tagged with: cmusphinx
answer count: 1
downvote count: 0
has title: InputStream and URL incompatibility
favorite count: 0
has body: I am working in Eclipse Helios Java 1.6. I have downloaded CMU Sphinx-4 and added into Java project. The code below is to convert audio file into text file. import java.io.File; import edu.cmu.sphinx.api.Configuration; import edu.cmu.sphinx.api.SpeechResult; import edu.cmu.sphinx.api.StreamSpeechRecognizer; public class AudioToText { public static void main(String [] args){ Configuration configuration = new Configuration(); // Set path to acoustic model. configuration.setAcousticModelPath("C:/Program Files/eclipse/sphinx4-5prealpha/models/acoustic"); // Set path to dictionary. configuration.setDictionaryPath("C:/Program Files/eclipse/sphinx4-5prealpha/models/acoustic/wsj/dict/cmudict.0.6d"); // Set language model. configuration.setLanguageModelPath("C:/Program Files/eclipse/sphinx4-5prealpha/models/language/en-us.lm.dmp"); StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration); recognizer.startRecognition(new File("D:/audio.mp3").toURI().toURL()); SpeechResult result = recognizer.getResult(); recognizer.stopRecognition(); } } Error is in line: recognizer.startRecognition(new File("D:/audio.mp3").toURI().toURL()); Error: - The method startRecognition(InputStream) in the type StreamSpeechRecognizer is not applicable for the arguments (URL) - The method startRecognition(InputStream) in the type StreamSpeechRecognizer is not applicable for the arguments (File) - Line breakpoint:AudioToText [line: 19] - main(String[]) When I looked into startRecognition() definition, public void startRecognition(InputStream stream) { recognizer.allocate(); context.setSpeechSource(stream); } How to fix this compatibility issue? Code is taken from here Shifting from Helios to upgraded version or Java 1.6 to higher might be expensive because a lot of previous code is written on Helios and Java 1.6.
tagged with: java-6
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26596928
type: Question

http://stackoverflow.com/q/26624278
has comment: http://stackoverflow.com/comment/41935828
has body: I'm using Mac OS X 10.10 Yosemite and trying to run a NetBeans webapp using Apache Tomcat 8, but whenever I try to startup the server I get the following output: 29-Oct-2014 00:40:31.158 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 8412 ms And after some seconds "Failed starting up server" Message appears. The server used to work well in OS X 10.9, any idea in what could be wrong?
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41935487
tagged with: apache
answer count: 1
downvote count: 0
has title: Apache Tomcat in OS X 10.10 Yosemite
tagged with: macos
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/26738603
has comment: http://stackoverflow.com/comment/41859010
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41935943
tagged with: osx-yosemite

http://stackoverflow.com/a/26601548
accepted answer of: http://stackoverflow.com/q/26601372
answers question: http://stackoverflow.com/q/26601372
type: Answer
has comment: http://stackoverflow.com/comment/84207429
upvote count: 2
has comment: http://stackoverflow.com/comment/41817322
has body: This is a good case for an optimistic locking scenario. This will only work in the backend server code. You cannot lock the user using java script on the front end. Let me explain in simple terms how to do this: Add a version number column and a status flag to a database table. Probably on the record table. Manager 1 clicks on record, select the record from the database first, increment the version number and update the flag saying the record is now picked up. Manager 2 clicks on the record, (if he does so at the same Manager 2 will select the same record as selected by Manager 1). But when Manager 2 tries to update the record, the version number will not match up and the update will return back with no rows updated. Use this to update your UI saying the record is in progress. The conversation will be like the below: Manager1: select status, ver_no from record where record_id=? (ver_no is now zero) Manager2: select status, ver_no from record where record_id=? (ver_no is now zero) Manager1: update record set status='In progress', ver_no=1 where record_id=? and ver_no=0 (ver_no is now 1 - Success) Manager2: update record set status='In progress', ver_no=1 where record_id=? and ver_no=0 (This will fail to update any row) The above is only in case they both attack the same row at the same time. Most of the time when Manager 2 selects itself, the status will already be In progress. If not you can work with that record.
has comment: http://stackoverflow.com/comment/41817089
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26584691
downvote count: 0
has body: The are two things to notice. First, a NullPointerException is thrown because you are throwing a null object. This has nothing to do with the declared type of the exception you were trying to throw. Second, since subclasses of Error are unchecked exceptions, the compiler does not complain that a catch block for Error is missing. Your second example didn't compile, because it is not the case that all subclasses of Exception are unchecked exceptions. Thus when the compiler encountered a throw e statement where the declared type of e was Exception, it required a catch block for Exception.
type: Answer
answers question: http://stackoverflow.com/q/26584426
upvote count: 1
score: 1

http://stackoverflow.com/comment/41862658
has text: The code will be definitely required.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26626655

http://stackoverflow.com/q/26635502
has title: Multiple string method chained in single code
score: 0
answer count: 2
has body: I am working on this bit of code public class SimpleStringTest { public static void main(String args[]) { String ints="123456789"; System.out.println(ints.concat("0").substring(ints.indexOf("2"),ints.indexOf("0"))); } As per as my knowledge on java "When the multiple methods are chained on a single code statement, the methods execute from left to right" Then, Why is this bit of code throwing StringIndexOutOfBondsException? Thanks in advance, GPAR
possible better answer: http://stackoverflow.com/a/26635546
tagged with: string
has answer: http://stackoverflow.com/a/26635540
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26635540
type: Question
has answer: http://stackoverflow.com/a/26635546

http://stackoverflow.com/comment/41784209
type: Comment
type: QuestionComment
has text: update my question, maybe that clears my situation. (Spring handles all my transactions)
score: 0
comment on: http://stackoverflow.com/q/26583324

http://stackoverflow.com/comment/41720786
type: QuestionComment
comment on: http://stackoverflow.com/q/26525368
has text: Jar is creted with Maven Assembly Plugin. This is the manifest: http://pastebin.com/zympRZ9P
score: 0
type: Comment

jboss
tags question: http://stackoverflow.com/q/26571054
tags question: http://stackoverflow.com/q/26607482
tags question: http://stackoverflow.com/q/26620331
tags question: http://stackoverflow.com/q/26635828
tags question: http://stackoverflow.com/q/26582482
tags question: http://stackoverflow.com/q/26595305
tag name: jboss
tags question: http://stackoverflow.com/q/26639906
tags question: http://stackoverflow.com/q/26653755
type: Tag
tags question: http://stackoverflow.com/q/26617571
tags question: http://stackoverflow.com/q/26607384
tags question: http://stackoverflow.com/q/26669129
tags question: http://stackoverflow.com/q/26650366
tags question: http://stackoverflow.com/q/26607151
tags question: http://stackoverflow.com/q/26630665
tags question: http://stackoverflow.com/q/26620276
tags question: http://stackoverflow.com/q/26624036
tags question: http://stackoverflow.com/q/26628656
tags question: http://stackoverflow.com/q/26591267
tags question: http://stackoverflow.com/q/26527261
tags question: http://stackoverflow.com/q/26527892
tags question: http://stackoverflow.com/q/26530677
tags question: http://stackoverflow.com/q/26663114
tags question: http://stackoverflow.com/q/26546389
tags question: http://stackoverflow.com/q/26532936
tags question: http://stackoverflow.com/q/26624425
tags question: http://stackoverflow.com/q/26657777
tags question: http://stackoverflow.com/q/26608844
tags question: http://stackoverflow.com/q/26651195
tags question: http://stackoverflow.com/q/26634346
tags question: http://stackoverflow.com/q/26603614
tags question: http://stackoverflow.com/q/26570678

http://stackoverflow.com/comment/134855340
type: Comment
comment on: http://stackoverflow.com/a/72426126
score: 0
type: AnswerComment
has text: The lillte problem with this tool is that not all special characters are encoded. For instance plus signs in query params are not encoded!

http://stackoverflow.com/a/26654684
has body: You should choose the second version public class MyImpl extends MyAbstract { } The fact that you're extending the class that implements the interfaces is enough to infer that your concrete class also implements those interfaces as the contract is transitive. Adding the interfaces to your implementation is just duplication.
accepted answer of: http://stackoverflow.com/q/26654616
type: Answer
has comment: http://stackoverflow.com/comment/41912379
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41916357
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26654616

http://stackoverflow.com/q/26615898
has answer: http://stackoverflow.com/a/26616436
accepted answer: http://stackoverflow.com/a/26616436
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 5
has title: Key vs SecretKey in Java (encryption)
linked to: http://stackoverflow.com/q/18228579
type: AnsweredQuestion
tagged with: encryption
linked to: http://stackoverflow.com/q/3451670
type: Question
has comment: http://stackoverflow.com/comment/41849752
has body: I am trying to build an AES file encrypt/decrypt. I have used some neat tutorials and guides and I am wondering what the difference is between Key and SecretKey. For context I used the the following posts, with the first one using SecretKey (Duncan's reply) and the second one using Key (Shankar's reply) with some keyValue byte array. My guess is that harcoding some a value with using just Key (shankar's answer) isn't as safe as randomly doing this with SecretKey (Duncan's answer). Question: What is the difference between Key and Secret Key, and what is the reasoning for having keyValue within the second post (Key)? Can Key not be randomly generated Like Duncan did with SecretKey?
has comment: http://stackoverflow.com/comment/41844101
tagged with: java
score: 5

http://stackoverflow.com/comment/48358594
comment on: http://stackoverflow.com/q/26637363
type: QuestionComment
type: Comment
has text: Nope, the Common Name as reflected in my answer to the referenced question.
score: 0

http://stackoverflow.com/comment/41906151
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26651066
has text: I want to achieve the same result that I would get using the loop (updated above), but without acually having to loop, because if I get like `10000000` looping would might be more inefficient than eg devision, if possible at allö.

http://stackoverflow.com/a/26651354
score: 3
has body: Yes, of course it's possible. Since you didn't give any particular implementation, I'll just put the numbers in an array. This is just a demonstration, of course. Assume NUM_OF_PERSONS is the number of persons in your array, and NUM_TO_DISTRIBUTE is the number you want to distribute. In your example, 8. int persons[] = new int[NUM_OF_PERSONS]; int basicRation = NUM_TO_DISTRIBUTE / NUM_OF_PERSONS; int peopleGettingExtra = NUM_TO_DISTRIBUTE % NUM_OF_PERSONS; for ( int i = 0; i &lt; NUM_OF_PERSONS; i ++ ) { persons[i] = basicRation + ( i &lt; peopleGettingExtra ? 1 : 0 ); } Test case 1: 9 to give, 3 people. The base ration is 3. The number of people getting extra is zero. In the loop, since no i will be less than 0, everybody will get basicRation + 0 which means 3. Test case 2: 8 to give, 3 people. The base ration is 2. The number of people getting extra is 2. In the loop, people with indexes 0 and 1 will get 2 + 1, and the last person gets 2 + 0.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26651066
upvote count: 3
answers question: http://stackoverflow.com/q/26651066

http://stackoverflow.com/comment/59165211
type: AnswerComment
type: Comment
has text: @davidgyoung I added beaconManager.setBackgroundBetweenScanPeriod(60000l) in my BeaconReference Application class. But I'm not able to achieve it. [Question](http://stackoverflow.com/questions/35722489/not-able-to-start-notification-after-detecting-the-beacon) this is the link to my question. Please do share your feedback
comment on: http://stackoverflow.com/a/26610590
score: 0

http://stackoverflow.com/comment/41910398
score: 0
type: AnswerComment
has text: @mttdbrd: sorry for the title. I fixed it and improved the example.
type: Comment
comment on: http://stackoverflow.com/a/26644613

http://stackoverflow.com/q/26599345
has comment: http://stackoverflow.com/comment/41813122
type: Question
answer count: 2
tagged with: hashmap
downvote count: 0
accepted answer: http://stackoverflow.com/a/26599441
has comment: http://stackoverflow.com/comment/41813215
has title: HashMap yields same hashCode for different contents
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/41813138
has comment: http://stackoverflow.com/comment/41813205
has answer: http://stackoverflow.com/a/26599441
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26599517
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26599517
upvote count: 1
has body: I have the following unit test: I create 2 different Objects of my custom type Variable. I compare their hash codes which simply returns the hash code of their names, ie String.hashCode(). Then I create 2 HashSets, each holding one variable and compare the hash codes of the sets. In both cases the hash codes differ, as expected. However, if I create a HashMap with the name as index and the Variable as value, the assertion fails, ie they compare the same. Why is that? Using Oracle Java 1.8. EDIT: I can add another guarantee: Assert.assertNotEquals(map1, map2); also holds. Furthermore I think I interpret this sentence correctly: The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two maps m1 and m2, as required by the general contract of Object.hashCode(). Taken from http://docs.oracle.com/javase/7/docs/api/java/util/AbstractMap.html#hashCode%28%29 @Test public void test() { // this assertion holds Assert.assertNotEquals(new Variable("x").hashCode(), new Variable("y").hashCode()); Set&lt;Variable&gt; set1 = new HashSet&lt;&gt;(); set1.add(new Variable("x")); Set&lt;Variable&gt; set2 = new HashSet&lt;&gt;(); set2.add(new Variable("y")); // this assertion also holds Assert.assertNotEquals(set1.hashCode(), set2.hashCode()); HashMap&lt;String, Variable&gt; map1 = new HashMap&lt;&gt;(); map1.put("x", new Variable("x")); HashMap&lt;String, Variable&gt; map2 = new HashMap&lt;&gt;(); map2.put("y", new Variable("y")); // why does this assertion fail? Assert.assertNotEquals(map1.hashCode(), map2.hashCode()); } Here is the definition of class Variable. public class Variable { private String name; public Variable(String name) { this.name = name; } @Override public int hashCode() { return name.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof Variable)) return false; return name.equals(((Variable) …

http://stackoverflow.com/a/26623009
answers question: http://stackoverflow.com/q/26622965
has body: You probably just want to replace: counts[(Die.roll()+Die.roll())]++; with: counts[(myDie1.roll()+myDie2.roll())]++; Call the instantiated methods on the objects, not the uninstantiated methods on the class
score: 0
upvote count: 1
type: Answer
downvote count: 1

http://stackoverflow.com/q/26518411
score: 0
answer count: 3
has title: Java Class access from main
has body: public class mainTest { public static void main(String[] args) throws Exception { Scanner KB = new Scanner(System.in); String VehiclesFile = "Vehicles.txt"; File file1 = new File(VehiclesFile); Scanner infile1 = new Scanner(VehiclesFile); Vehicle[] Vehicles = new Vehicle[0]; try { Scanner scanner = new Scanner(file1); int lineCount = 0; while (scanner.hasNextLine()) { lineCount++; scanner.nextLine(); } Vehicles = new Vehicle[lineCount]; scanner = new Scanner(file1); int VehicleCount = 0; while (scanner.hasNextLine()) { String[] temp1 = scanner.nextLine().split(","); // file has been read into temp1[] now to use Vehicles // class type Vehicles[VehicleCount] = new Vehicle(); Vehicles[VehicleCount].setregistration(temp1[0]); Vehicles[VehicleCount].setmake(temp1[1]); Vehicles[VehicleCount].setModel(temp1[2]); Vehicles[VehicleCount].setyear(temp1[3]); Vehicles[VehicleCount].setodometer(temp1[4]); Vehicles[VehicleCount].setowner(temp1[5]); VehicleCount++; } } catch (IOException e) { // Print out the exception that occurred System.out.println("Unable to find "); } //*******This is where I need to access the class to print**************** System.out.println (Vehicle.class.getClasses()); } } I cannot seem to understand how to reference a specific part of the class/array of class objects The class for Vehicle is in defined with get/set so I didn't include the code.
has answer: http://stackoverflow.com/a/26518783
has answer: http://stackoverflow.com/a/26518796
has answer: http://stackoverflow.com/a/26518790
has comment: http://stackoverflow.com/comment/41666547
type: UnansweredQuestion
tagged with: object
tagged with: java
linked to: http://stackoverflow.com/q/10734106
type: Question
tagged with: class

http://stackoverflow.com/a/26612775
upvote count: 5
score: 5
downvote count: 0
has body: I am trying to create a toolbar that will go at the top of all the pages in my java swing application. Why don't just use JToolBar? See How to use Tool Bars I am creating a JPanel with a series of individual JPanels (containers) inside it. Each JPanel (container) has a north and south component or just a north component, set up using a GridBagLayout. Based on your code none of these statements is true: you are adding buttons (not panels) and you are using GridLayout not GridBagLayout: JPanel container1 = new JPanel(); container1.setLayout(new GridLayout(2,1)); // GridLayout JButton buttonDiary = new JButton("Diary"); // button here buttonDiary.setPreferredSize(new Dimension(140, 25)); JButton buttonCars = new JButton("Cars"); // another button here Besides you are using BorderLayout constraints that will be totally ignored by either GridLayout or GridBagLayout: container1.add(buttonDiary, BorderLayout.NORTH); container1.add(buttonCars, BorderLayout.SOUTH); You should have a look to the whole Laying Out Components Within a Container lesson to learn about layout managers and how do all of them work. In addition As wisely pointed out by @nIcEcOw, since Java 1.4 BorderLayout the use of new constants is highly encouraged: PAGE_START PAGE_END LINE_START LINE_END CENTER From How to Use BorderLayout tutorial (bold text mine): Before JDK release 1.4, the preferred names for the various areas were different, ranging from points of the compass (for example, BorderLayout.NORTH for the top area) to wordier versions of the constants we use in our examples. The constants our examples use are preferred because they are standard and enable programs to adjust to languages that have different orientations. Update Well now that your question has been edited to say that you actually use GridLayout it's easy to answer by saying that you can specify horizontal and vertical gaps between components either by using class' constructor: or setHgap() and setVgap() methods: JPanel container1 = n…
has comment: http://stackoverflow.com/comment/41840026
answers question: http://stackoverflow.com/q/26611904
type: Answer
has comment: http://stackoverflow.com/comment/41849355
has comment: http://stackoverflow.com/comment/41849688
has comment: http://stackoverflow.com/comment/41853636
has comment: http://stackoverflow.com/comment/41850078
has comment: http://stackoverflow.com/comment/41866824

http://stackoverflow.com/comment/41765362
score: 0
type: AnswerComment
has text: cheers for the answer! It works :) Didn't think it was that easy.
type: Comment
comment on: http://stackoverflow.com/a/26573733

http://stackoverflow.com/comment/41862801
type: Comment
has text: what about sizing the touchdelegate using the tolerance and image width and height? assuming you have a tolerance between 0 and 1, something like: (this is modified from the link I posted in the answer, not tested) `delegateArea.left -= tolerance*myButton.getWidth(); delegateArea.top -= tolerance*myButton.getHeight(); delegateArea.right += tolerance*myButton.getWidth(); delegateArea.bottom += tolerance*myButton.getHeight();`
comment on: http://stackoverflow.com/a/26593707
type: AnswerComment
score: 0

http://stackoverflow.com/a/26578322
has comment: http://stackoverflow.com/comment/41774350
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41774529
downvote count: 0
has body: When you write GenericQueue&lt;Token&gt; backup_result = result; you're not actually copying the queue, but just a reference to it. Any changes you make to result will be reflected in backup_result, and vice versa. You only ever have one queue, with two names. This is only one of the problems... The other is that if you need to copy the queue into a backup then you're thinking the wrong way about queues: they're designed for one part of your code to put things into it, and another to remove them and deal with them.
type: Answer
answers question: http://stackoverflow.com/q/26578278

http://stackoverflow.com/a/26606159
answers question: http://stackoverflow.com/q/26605791
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26605791
upvote count: 1
has body: There are all the solutions , 1. Use the Filters to intercept the URL through web.xml 2. Use the Redirect or Forward feature in Servlets or Jsp.
has comment: http://stackoverflow.com/comment/41825409

http://stackoverflow.com/q/26658601
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/41923164
has comment: http://stackoverflow.com/comment/41922581
has answer: http://stackoverflow.com/a/26672741
type: AnsweredQuestion
has body: I have g3db model that consists of cylinder and "10gonal" prism inside cylinder. Prism material has texture and blending attributes, and cylinder has blending and color attribute with 0.5 transparency. And the problem is that looking from different sides "changes" cylinder transparency: https://i.sstatic.net/1sPuh.jpg And I need cylinder to be transparent from any point of view.
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/41931133
tagged with: libgdx
tagged with: java
accepted answer: http://stackoverflow.com/a/26672741
has comment: http://stackoverflow.com/comment/41924176
has title: Whats wrong with Libgdx mesh transparancy?
score: 0
answer count: 1

http://stackoverflow.com/comment/41769760
score: 0
type: AnswerComment
type: Comment
has text: Thanks and now I see why should have included the code :) Do you see any benefit in unit testing the DAO with a mocking framework or is this best left to integration testing with a real database?
comment on: http://stackoverflow.com/a/26575344

relative-path
type: Tag
tags question: http://stackoverflow.com/q/26543512
tag name: relative-path

http://stackoverflow.com/a/26557337
accepted answer of: http://stackoverflow.com/q/26557309
has body: Your are trying to convert a JSONObject to a JSONArray. Use this HttpEntity ent= resp.getEntity(); text = EntityUtils.toString(ent); JSONObject json = new JSONObject(text); int success= -1; if(json.has("success")) success = json.getInt("success"); if (success == 1){ Log.v("JSON" ,"es 1"); }
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26557309

http://stackoverflow.com/a/26615812
type: Answer
has comment: http://stackoverflow.com/comment/41843447
has body: import java.io.File; import java.io.IOException; import java.util.Scanner; public class BasketballTeam { public static void main(String[] args) throws IOException { File f = new File("BasketballData.txt"); if (f.exists()) { Scanner input = new Scanner(f); int games = 0; int totalScore = 0; double avg = 0.0; while (input.hasNext()) { String s = input.next(); System.out.printf("%-9s", s); while (input.hasNextInt()) { int a = input.nextInt(); if(a != -1) { System.out.printf("%5s", a); games++; totalScore = totalScore + a; } } avg = (double)totalScore/games; System.out.printf("%14s%.2f\n", "Average of ", avg); games = 0; totalScore = 0; System.out.println(); } input.close(); } } } This is what you are looking for. You don't even need the -1 at the end of each line in the file you can get rid of that if you want unless it is part of the specification. It will work without the -1. Your inner loop you just want to add up your totals then outside of the inner loop get your average and display. Then reset your variables. You were pretty close just needed to change a couple things. If you have any questions on how this works just ask away. Hope this helps!
upvote count: 2
answers question: http://stackoverflow.com/q/26615355
score: 2
has comment: http://stackoverflow.com/comment/41843532
accepted answer of: http://stackoverflow.com/q/26615355
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26603610
has comment: http://stackoverflow.com/comment/41823960
answer count: 1
has body: I have to convert xml to Map&lt;String,String&gt;. I have following XML structure: &lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt; &lt;Environments&gt; &lt;Environment Name="A" URIPath="http://a.com" /&gt; &lt;Environment Name="B" URIPath="http://b.com" /&gt; &lt;Environment Name="C" URIPath="http://c.com" /&gt; &lt;/Environments&gt; I tried multiple ways but eneded with Class has two properties of the same name "URIPath". What is the right design for unmarshalling this XML? UPDATE: Using provided solution #1 I am getting : Class has two properties of the same name "environments" this problem is related to the following location: at public java.util.List app.model.Environments.getEnvironments() at app.model.Environments this problem is related to the following location: at public java.util.List app.model.Environments.environments at app.model.Environments Class has two properties of the same name "URIPath" this problem is related to the following location: at public java.lang.String app.model.Environment.getURIPath() at app.model.Environment at public java.util.List app.model.Environments.environments at app.model.Environments this problem is related to the following location: at java.lang.String app.model.Environment.URIPath at app.model.Environment at public java.util.List app.model.Environments.environments at app.model.Environments ] with root cause
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/41821076
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/26603687
type: Question
has title: How to unmarshal xml with repetitive entries using JAXB and Spring
downvote count: 0
accepted answer: http://stackoverflow.com/a/26603687

http://stackoverflow.com/a/26619822
has comment: http://stackoverflow.com/comment/41852068
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41878339
has comment: http://stackoverflow.com/comment/41852122
has body: You need to get Java directly from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/index.html) as Apple stopped supporting Java some time ago. Unless you have pressing reasons for using Java 6 I suggest also installing at least Java 7, although you can have all three versions installed and select the appropriate version for the app you want to run/develop. Edit Also, if you want to use Eclipse or IntelliJ (go for IntelliJ) you want to get the JDK and not the "runtime" (JRE).
answers question: http://stackoverflow.com/q/26619690
downvote count: 0
has comment: http://stackoverflow.com/comment/41878326
type: Answer

http://stackoverflow.com/q/26542812
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/74552981
has comment: http://stackoverflow.com/comment/51470274
has title: High Pass Filter in java code
tagged with: matlab
has body: I'm trying to implement a high pass filter to my accelerometer data to omit the in influence of the gravity. Android offers a method of having a 1st order IIR low pass filter to grab the gravity values from the accelerometer data and then subtract those gravity values from the original values (high pass filter) to obtain a filtered signal without the influence of the gravity (this is the linear acceleration). However, this method is not convenient to what I'm doing, the response of this 1st order filter is very weak because it changes the amplitude in a severe way. I need to directly implement a high pass filter to my accelerometer data, the cutoff frequency is 10Hz and the sample rate is 100Hz (sample rate of accelerometer reading in note II). I can have the filter designed in Matlab to get the coefficients, But I need the java (or C and I do the translation) code for the filter itself. Any help please?
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/28291582
tagged with: accelerometer
has comment: http://stackoverflow.com/comment/51470285
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26531742
has comment: http://stackoverflow.com/comment/41706896
type: Answer
has comment: http://stackoverflow.com/comment/41699330
answers question: http://stackoverflow.com/q/26531113
has comment: http://stackoverflow.com/comment/41699477
score: 0
has comment: http://stackoverflow.com/comment/41692625
has body: You cannot get data from that table. It is being dynamically created by javascript (AJAX particularly). And I don't think there is any api wich can process javascript. It would be possible to get data if it was a static file or the part you want would be static, but it is not. If you are using this site to get geolocation, then use google geocoding api for this. it would be better option.

http://stackoverflow.com/comment/41809131
type: QuestionComment
score: 2
has text: Does it make sense to `break` in both the `if` and the `else` part?
comment on: http://stackoverflow.com/q/26597411
type: Comment

schematron
tags question: http://stackoverflow.com/q/26662945
tag name: schematron
type: Tag

http://stackoverflow.com/q/26660306
score: 3
has answer: http://stackoverflow.com/a/26660466
tagged with: sorting
has body: I am trying to write a program that translates English into PigLatin. I am currently trying to solve the part on where to locate the first vowel of the word that way the program can properly slice the word and rearrange it properly. For example, the string "hello I am a guy" becomes "ellohay Iyay amyay ayay uygay". (At list I think my pig latin is correct, this is going off an example I created. So for the word "what" becomes "atwhay". The program finds that the first vowel is in slot 2, then gives me that integer,2. I was thinking of first comparing it to a string, vowels="aeiouy" and then go from there but I am stuck. Here is what I have: public static int indexOfFirstVowel(String word){ int index=0; String vowels="aeiouy"; return index; } In theory index will update to where the first vowel is.
has answer: http://stackoverflow.com/a/26660350
tagged with: arrays
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26660391
favorite count: 0
possible better answer: http://stackoverflow.com/a/26660539
answer count: 4
accepted answer: http://stackoverflow.com/a/26660350
has answer: http://stackoverflow.com/a/26660539
upvote count: 3
has title: Finding where the first vowel in a word occurs
tagged with: java
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/41710066
has text: @Nabin update the code. line 26 is exactly after `finish()` part. I mean `}`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26542967
score: 0

http://stackoverflow.com/comment/41854921
score: 1
type: QuestionComment
type: Comment
has text: Basically doing this: http://stackoverflow.com/questions/6724401/how-to-write-junit-tests-for-interfaces#comment28660208_6724555 ill update to show my example
comment on: http://stackoverflow.com/q/26622232

http://stackoverflow.com/a/26664972
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26664783
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41931973
has body: You've a couple of typos public static void main(String[] args) { ArrayList&lt;Integer&gt;[][] list = new ArrayList[2][26]; list[0][0] = new ArrayList&lt;Integer&gt;(); list[0][0].add(5); list[0][0].add(6); for (ArrayList&lt;Integer&gt;[] arr : list) { System.out.println(Arrays.toString(arr)); } }
has comment: http://stackoverflow.com/comment/41931809

http://stackoverflow.com/comment/80620874
type: Comment
score: 2
has text: See also: [Why were Null-Safe Operators (e.g. “Elvis operator”) rejected as part of Java's “Project Coin”?](https://softwareengineering.stackexchange.com/q/359414/81973)
type: AnswerComment
comment on: http://stackoverflow.com/a/26529503

http://stackoverflow.com/q/26657558
tagged with: int
score: 0
has title: Converting Pixels from int to unsigned byte in JAVA
accepted answer: http://stackoverflow.com/a/26658062
has body: Im trying to convert the pixels that i get from the getRGB function of a black and white image to unsigned byte, I have read and, correct if I am wrong, the getRGB function in java returns integer values, so what I want to do is to see values from 0-255 not the negative integer values Im getting with the function. I have tried this with no sucess: int width; int height; byte extract; int asign; int matrix[][]; for ( i = 0; i &lt; height; i++) { for ( j = 0; j &lt; width; j++) { extract =(byte)(xray.getRGB(j, i)); asign = (int)extract; //asign = asign &amp; 0xff; asign = asign + 128; matrix[i][j] = asign; } } Notice that xray is a buferred image. Hope you can help me with this issue guys. As you can see I've tried with mask, also I 've tried trying to add 128 to the value after the cast.
tagged with: byte
type: AnsweredQuestion
tagged with: unsigned
tagged with: pixel
has answer: http://stackoverflow.com/a/26658097
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26658062
answer count: 2
possible better answer: http://stackoverflow.com/a/26658097

http://stackoverflow.com/q/26537239
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/45033562
accepted answer: http://stackoverflow.com/a/26538269
has body: I'm trying to setup oauth2 using spring-security (2.0.3.RELEASE) in a spring-mvc application, with a grant type of password. When executing the following request to access a token: curl -X POST "http://localhost:8080/oauth/authorize?client_id=testclient&amp;grant_type=password&amp;username=user&amp;password=test123&amp;response_type=token" I'm getting a: org.springframework.security.authentication.InsufficientAuthenticationException: User must be authenticated with Spring Security before authorization can be completed. When tracking down this exception I noticed it is originated at AuthorizationEndpoint.java line 137 wheren the code checks if the user is authenticated: if (!(principal instanceof Authentication) || !((Authentication) principal).isAuthenticated()) { I find this odd, should I first login and the post to the /oauth/authorize resource before trying to access the token ? If so why ? I'm already adding my password and username to the /oauth/authorize request. I don't see the benefit of being logged in before trying to get a hold of a token if you must supply the password and username again ?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26538269
tagged with: spring-security
upvote count: 3
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/44991881
has title: oauth2 spring-security should you be logged in before requesting a token or code
has comment: http://stackoverflow.com/comment/69943243
favorite count: 0
tagged with: oauth
has comment: http://stackoverflow.com/comment/47406497
tagged with: spring

http://stackoverflow.com/q/26668900
has title: Finding Substring from a String
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26668946
has body: I have following String : Test: Testid #123123 - Updated I want to find the substring 123123 from this string. I tried : &lt;msg&gt;.substring(15, 21); It gives me the correct result. but I want to find this substring in the way that it should find the id between the # and the next space without giving the beginning and ending index. Thanks.
type: Question
accepted answer: http://stackoverflow.com/a/26668946
has answer: http://stackoverflow.com/a/26668943
has answer: http://stackoverflow.com/a/26669007
has answer: http://stackoverflow.com/a/26669016
possible better answer: http://stackoverflow.com/a/26668989
tagged with: substring
has answer: http://stackoverflow.com/a/26668989
has answer: http://stackoverflow.com/a/26669063
score: 0
answer count: 7
has answer: http://stackoverflow.com/a/26668949
tagged with: string

http://stackoverflow.com/comment/41943672
has text: Added some more explanation. :)
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26670931
type: AnswerComment

http://stackoverflow.com/a/54764877
type: Answer
has body: Another possible Solution using ProcessBuilder is:- try { new ProcessBuilder("Outlook.exe Path on Your System", "/m","Pass Parameters for mail like To, CC, BCC, Subject separated by &amp;", "/a","mail attachment Path on Your System").start(); } catch ( Exception ex ) { } For example :- try { new ProcessBuilder("C:\\Program Files (x86)\\Microsoft Office\\Office15\\OUTLOOK.EXE", "/m","test@gmail.com&amp;CC=testCC@gmail.com&amp;subject=testagain&amp;body=testbody", "/a","D:\\sample.pdf").start(); } catch ( Exception ex ) { }
score: 0
answers question: http://stackoverflow.com/q/26550295

http://stackoverflow.com/q/26546387
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/26546479
answer count: 3
upvote count: 4
tagged with: arrays
downvote count: 0
has body: I need to compare the first n bytes of two different java byte[] arrays. There is the Arrays equals() function but that tests the length of the arrays first and the whole of both arays after and my arrays are different lengths so that's no good. Any ideas apart from writing my own loop by hand ? Thanks,
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16646967
has answer: http://stackoverflow.com/a/26546512
has answer: http://stackoverflow.com/a/57603007
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41715724
has title: How to compare the first n bytes of two java arrays?

http://stackoverflow.com/a/26606013
has body: I fixed the problem by myself. You can do something like this: areachart.getData().removeAll(m_histogram.getData()); It will remove all kind of data inside the area chart!!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26604806
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26604806

http://stackoverflow.com/a/26552615
has body: If you check the source code you will see that Java does not try to detect the driver's implementation name (i.e. the driver class) from the url. Instead it asks each driver implementation it finds in the classpath if they are able to handle that url or not. The order of actions seems to be the following: When you ask for the connection the DriverManager class is loaded. It executes a static block that loads all the classes specified in the system property jdbc.drivers Then the Service Provider Mechanism is invoked and loads all classes of java.sql.driver it finds in the classpath. Now when you ask it for a connection it loops through the registered drivers and call the Driver.connect(String url, Properties info) method on them. Quote: Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn. The driver should throw an SQLException if it is the right driver to connect to the given URL but has trouble connecting to the database. So the first driver that returns a non null connection is the driver that will be used. Hope that helps
has comment: http://stackoverflow.com/comment/41727664
accepted answer of: http://stackoverflow.com/q/26551648
has comment: http://stackoverflow.com/comment/41728161
has comment: http://stackoverflow.com/comment/41729848
score: 5
answers question: http://stackoverflow.com/q/26551648
upvote count: 5
has comment: http://stackoverflow.com/comment/41727736
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41728058
type: Answer

http://stackoverflow.com/comment/41674068
type: QuestionComment
comment on: http://stackoverflow.com/q/26522776
has text: What error/behavior are you observing? Copy your stack trace here.
score: 0
type: Comment

http://stackoverflow.com/comment/41723795
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26550559
has text: Ok so you want suggestion list. Am I right??
score: 0

http://stackoverflow.com/q/26636082
has comment: http://stackoverflow.com/comment/43956928
upvote count: 1
score: 1
tagged with: java
tagged with: apache-commons-math
type: Question
has body: I wanted to get regression parameters by using Apache's Commons.Math3 library and the OLSMultipleLinearRegression. The regression should be polynomial with a power of 2. It worked fine with test data but when I use this experimental data the methode gives me an absolutely wrong regression. public static void poly (){ OLSMultipleLinearRegression quadRegression = new OLSMultipleLinearRegression(); double [] y = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59}; double [][] x = {{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{1.00,1.00},{0.95,0.90},{0.96,0.91},{0.96,0.92},{0.96,0.92},{0.96,0.92},{0.92,0.84},{0.92,0.85}, {0.92,0.86},{0.93,0.86},{0.93,0.87},{0.89,0.80},{0.90,0.81},{0.90,0.81},{0.90,0.82},{0.89,0.80},{0.90,0.81},{0.90,0.82},{0.91,0.82},{0.91,0.83},{0.90,0.80},{0.90,0.80},{0.90,0.81},{0.91,0.82}, {0.89,0.79},{0.89,0.80},{0.90,0.80},{0.90,0.81},{0.88,0.77},{0.88,0.77},{0.88,0.78},{0.88,0.78},{0.86,0.73},{0.86,0.74},{0.86,0.74},{0.86,0.74},{0.84,0.71},{0.85,0.72},{0.85,0.72},{0.85,0.73}, {0.84,0.71},{0.84,0.71},{0.84,0.71},{0.84,0.71},{0.83,0.69},{0.83,0.69},{0.83,0.69},{0.82,0.68},{0.82,0.68},{0.82,0.68},{0.82,0.68}}; quadRegression.newSampleData(y, x); quadRegression.setNoIntercept(false); double [] results = quadRegression.estimateRegressionParameters();} For this input data I get the equation y=117.54x²-504.83x+389.088 which would result in a y-value of 379.760.85 for x=59 - way beyond my input value. So I either handled the class absolutly wrong or I got stuck in a mathematical pitfall. If someone please could explain me what I did wrong or misinterpreted - this problem drives me insane.
downvote count: 0
has title: Java: Apache Regression gives me absolutly wrong regression parameters
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: regression

http://stackoverflow.com/comment/41843082
has text: Change your method to `public static void manipulate(int[] arr, final int num)` to see, that changing the value of an `final` variable is not possible. The current answers are showing you, why you can change `num`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26615707
type: QuestionComment

http://stackoverflow.com/a/26551619
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26551538
type: Answer
has body: You never initialized snakeGame; therefore snakeGame == null. You need to initialize it in your default constructor like SnakeGame snakeGame = new SnakeGame() I'm also curious why SnakeGame and Draw both have each other as private members.

http://stackoverflow.com/q/26576820
has comment: http://stackoverflow.com/comment/41771636
has title: Why boxing is preferred over var-args?
has body: I know from JLS that widening is preferred over boxing and boxing is preferred over var-args. I understand that, widening is legacy methodology and designers tend to keep it as a priority. What i fail to understand is why boxing is preferred over var-args. Here are my two concerns. Why boxing is preferred over var-args? How behind the scenes boxing and var-args is interpreted? Can someone explain with an example? As i understand, Var-args basically build an Arraytype to hold number of parameters provided. As i know array is an an object. I would like to demonstrate my confusion with this example // 1 Object is made which is basically a wrapper public void boxing(Integer i); // 1 object made which is an Array public void boxing(int.. x) In both cases, one object is made. Then the former is faster path than the later? Thanks,
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41771254
tagged with: java
has comment: http://stackoverflow.com/comment/41771232
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26576852
accepted answer: http://stackoverflow.com/a/26576852
linked to: http://stackoverflow.com/q/4524079

http://stackoverflow.com/a/30354406
upvote count: 10
type: AcceptedAnswer
downvote count: 0
has body: You have the necessary jar file you need in hibernate-validator. This jar includes the javax.validation.ValidatorFactoryvalidation-api. So if you are including validation-api explicitly, you might have dependency conflicts. If not, you might just be having class reloading issues. Try cleaning your tomcat and restarting your IDE.
type: Answer
answers question: http://stackoverflow.com/q/26637800
accepted answer of: http://stackoverflow.com/q/26637800
score: 10

http://stackoverflow.com/comment/41928384
comment on: http://stackoverflow.com/a/26663237
score: 0
type: Comment
has text: In that case length of array in between "space" and "space" will be 0.
type: AnswerComment

http://stackoverflow.com/comment/41867862
type: Comment
has text: check this.http://stackoverflow.com/questions/16694786/how-to-customize-a-spinner-in-android
comment on: http://stackoverflow.com/q/26629591
score: 0
type: QuestionComment

http://stackoverflow.com/q/26631979
has answer: http://stackoverflow.com/a/27655249
answer count: 1
tagged with: awt
has comment: http://stackoverflow.com/comment/41932356
tagged with: graphics2d
upvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/41942344
tagged with: java-2d
downvote count: 0
type: UnansweredQuestion
has title: Icon with TexturePaint throws InternalError: Surface not cachable
tagged with: swing
tagged with: java
score: 7
has body: I have a custom Icon which uses a TexturePaint as paint and calls fillPolygon on a Graphics2D object. This code works fine on JDK6 and JDK7, but fails under JDK8 with 64bit Linux (tried most recent JDK1.8 on 64bit Linux). On Windows, this runs fine with JDK8. Output of the java -version command for the JDK used to reproduce the issue. java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) Code to reproduce the issue: import java.awt.*; import java.awt.image.*; import javax.swing.*; public class TexturePaintIconTest { private static class CustomIcon implements Icon{ private static final int[] sXArray = new int[]{2, 5, 7, 12, 12, 4, 1, 1, 2}; private static final int[] sYArray = new int[]{4, 4, 2, 2, 11, 11, 8, 5, 4}; private static final int sNumberOfPoints = 9; @Override public void paintIcon(Component c, Graphics g, int x, int y) { g.translate(x,y); Graphics2D g2d = (Graphics2D) g; Color fillColor = new Color( 140, 25, 25, 35); g2d.setPaint(createPatternPaint(fillColor)); g2d.fillPolygon(sXArray, sYArray, sNumberOfPoints); g.translate(-x, -y); } private Paint createPatternPaint(Color color ){ int[] colors = new int[]{color.getRGB(), 0}; IndexColorModel colorModel = new IndexColorModel(1, 2, colors, 0, true, -1, DataBuffer.TYPE_BYTE); BufferedImage image = new BufferedImage(2, 2, BufferedImage.TYPE_BYTE_INDEXED, colorModel); DataBufferByte dataBuffer = (DataBufferByte) image.getRaster().getDataBuffer(); byte[] data = dataBuffer.getData(); data[0] = 0; data[1] = 1; data[2] = 1; data[3] = 0; return new TexturePaint(image, new Rectangle(2, 2)); } @Override public int getIconWidth() { return 16; } @Override public int getIconHeight() { return 16; } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame testFrame = new JFrame("TestFrame"); JLabel label = new JLabel("Label with icon", new CustomIcon(), SwingConstants.LEFT);…
type: Question

http://stackoverflow.com/q/26618595
has body: I have a class A that has to make two subsequent calls to a method of its dependency B that takes a collection as an argument: class A{ private B myDependency; public myClassMethod() { // ... on more than one occasion calls myDependency.dependencyMehtod(someColleciton); } } class B{ public void dependencyMehtod(Collection&lt;Something&gt; input) } I would like to write a unit test for class A (preferably using Mockito) that verifies that the dependency method was called exactly a given number of times and also verify the size of the input Collection at each subsequent invocation (the size of the argument varies between calls). How would I do that? I tried using myAObject.myClassMethod(); verify(myMockOfB).dependencyMehtod((Collection&lt;Something&gt;) argThat(hasSize(3)); //I expect a size of 3 on the first call verify(myMockOfB).dependencyMehtod((Collection&lt;Something&gt;) argThat(hasSize(1)); //I expect a size of 1 on the second call However, I get an error message from Mockito that A collection of size 1 was found where a collection of size 3 was expected. What am I doing wrong?
score: 0
has title: Verifying the arguments of subsequent calls to the same method in Mockito
type: UnansweredQuestion
tagged with: unit-testing
has answer: http://stackoverflow.com/a/26618938
linked to: http://stackoverflow.com/q/36573399
tagged with: java
has comment: http://stackoverflow.com/comment/64867843
type: Question
tagged with: mocking
has comment: http://stackoverflow.com/comment/41848321
tagged with: mockito
answer count: 1

http://stackoverflow.com/comment/41907619
comment on: http://stackoverflow.com/q/26652079
has text: Would really appreciate anybody's help!
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26658715
has body: Hi i am new to Java web development, im trying pass data into database through form, using data access object. Heres the method for inserting data i´ve created so far : public void addCustomer(String firstname, String lastName, String code) { try { st = getConnection().createStatement(); st.executeUpdate("insert into customer value(id ," + firstname + "," + lastName + "," + code+")"); } catch(Exception e) { throw new RuntimeException(e); } finally { closeResources(); //method which closes connection, resultset and statements } } Now im calling this method in Servlet which looks like this : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.println( "&lt;form action='/Add' method='post'&gt;" +"Eesnimi:&lt;input id='firstNameBox' name='firstName'/&gt; " +"Perekonnanim:&lt;input id='lastNameBox' name='lastName'/&gt;" +"Kood:&lt;input id='codeBox' name='code'/&gt;" +"&lt;input type='submit' value='Lisa'/&gt;" ); String firstname = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String code = request.getParameter("code"); CustomerDao dao = new CustomerDao(); dao.addCustomer(firstname, lastName, code); } Now im getting SQLSyntaxErrorException : user lacks privilege or object not found: NULL Im pretty sure that the case is in the addCustomer method, but i couldnt find solution from google, perhaps anyone here can help me?
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: servlets
type: Question
answer count: 1
tagged with: hsqldb
has answer: http://stackoverflow.com/a/26659078
has title: Inserting data into hsqldb using DAO pattern
tagged with: jdbc

http://stackoverflow.com/comment/41740468
type: Comment
type: QuestionComment
has text: Of course you have two independant pools: you're creating two DataSources, each with its own properties.
comment on: http://stackoverflow.com/q/26558976
score: 0

http://stackoverflow.com/comment/41808663
has text: Try reading in one line at a time.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26597099
score: 1

http://stackoverflow.com/q/26523599
has comment: http://stackoverflow.com/comment/41704229
tagged with: rabbitmq
has body: Is it possible to establish communication between server/client in this way using RabbitMQ and AMQP: Client send "command" to server Server runs some logic (saving to database) Server emits event (message) - "Data saved" Client listen to that message and refresh presented data EDIT Is it possible to accomplish something like comunication betwen server and client in case of using nodejs with socket.io ? Comunication must be non-blocking and async. Or something like communication betwen client/server via Event Bus when using vert.x and Java. How my two or more Java clients can share data in real-time with some central server programmed in Java.
answer count: 0
has comment: http://stackoverflow.com/comment/41676895
score: 1
tagged with: java
has title: Java and RabbitMQ - client server communication
upvote count: 1
type: Question
tagged with: message-queue
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41676291
type: UnansweredQuestion

http://stackoverflow.com/comment/41870547
type: Comment
has text: yes you are correct, finally i understood that php is interpreted language, so php is not supporting late binding
comment on: http://stackoverflow.com/a/26627492
score: 0
type: AnswerComment

http://stackoverflow.com/a/26671324
has comment: http://stackoverflow.com/comment/41943158
has comment: http://stackoverflow.com/comment/41943203
downvote count: 0
has comment: http://stackoverflow.com/comment/41943422
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26671286
type: Answer
has body: If you are testing the interface, it should be sufficient to test it with a single implementation, since the interface doesn't depend on a specific implementation. Of course you'll probably want to test each implementation, but for the purpose of testing the implementing class, not the interface itself.

http://stackoverflow.com/a/26555612
downvote count: 1
has comment: http://stackoverflow.com/comment/53845553
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/26516204
answers question: http://stackoverflow.com/q/26516204
has body: The meaning of the ? is specified in the SQL specification, and the JDBC specification defers to the SQL specification for this. A driver doesn't (and shouldn't) interpret a question mark in a literal as a parameter placeholder, as a question mark within a string literal is simply a character within the string literal. For more information look at chapter 5 of SQL:2011 Foundation (ISO-9075-2:2011). So escaping is not necessary (nor possible). However, that is the theory, and, unfortunately, in practice it doesn't work like that in the PostgreSQL JDBC driver. To address this, recent versions of the PostgreSQL driver provide an option to escape a question mark which is not a parameter placeholder by using ?? instead.
has comment: http://stackoverflow.com/comment/53845649
has comment: http://stackoverflow.com/comment/53837610
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/a/26600324
score: 0
type: Answer
has body: spot, having a default visibility, is NOT visible to any class other than within its own package, i.e. package a. See more details here: Visibility Modifiers
answers question: http://stackoverflow.com/q/26600268

http://stackoverflow.com/comment/41931207
type: QuestionComment
has text: Can you show the mapping for the problem objects?
comment on: http://stackoverflow.com/q/26664589
score: 0
type: Comment

http://stackoverflow.com/comment/41678279
has text: Well if you have a UI for example using the FileChooser to let a user choose the file you will get the correct path from that FileChooser Dialog. I will provide further sample code soon (underlying OS is Windows).
comment on: http://stackoverflow.com/q/26524607
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41734493
has text: This is why namespaces (`java.util`, `javax.swing`, etc) exist in languages like Java. Because, as more and more libraries and APIs are released, there's an increased chance of two (different and probably unrelated) classes having to share the same name. Namespaces are a way to distinguish between your `Timer` class and my `Timer` class, your `Window` class and my `Window` class, etc.
comment on: http://stackoverflow.com/q/26556399
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41908591
type: QuestionComment
comment on: http://stackoverflow.com/q/26652707
has text: you are missing adapter.notifyDataSetChanged() i guess inside onTextChanged
score: 1
type: Comment

http://stackoverflow.com/a/26670588
answers question: http://stackoverflow.com/q/26670304
score: 0
type: Answer
has body: If you are comfortable using Spring and Maven , find below link which might be useful : https://spring.io/guides/gs/consuming-web-service/

http://stackoverflow.com/q/26672909
has title: Spring Rest + JPA 2.0 Transaction Management - Return null value to delete
has comment: http://stackoverflow.com/comment/41946060
has comment: http://stackoverflow.com/comment/41947518
has comment: http://stackoverflow.com/comment/41946559
has comment: http://stackoverflow.com/comment/41947294
has comment: http://stackoverflow.com/comment/41947432
answer count: 0
has comment: http://stackoverflow.com/comment/41946186
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41947363
has body: I get Object: null is not a known entity type. error. I think, there are missing configuration in my Spring Rest + JPA application. In my code Operator operator = em.find(Operator.class, operatorId);, return null value. Sorry for my long code. OperatorDAO.java package com.ignite.easyticket.core.operator.persistence; @Repository("OperatorDAO") public class OperatorDAO extends BasicDAO implements IOperatorDAO { ... @Transactional(propagation = Propagation.REQUIRED) public void delete(String operatorId) throws DAOException { try { logger.debug("delete() method has been started."); Operator operator = em.find(Operator.class, operatorId); // <- Here always return null value, I am sure there is a record with id em.remove(operator); em.flush(); logger.debug("delete() method has been successfully finisehd."); } catch (PersistenceException pe) { logger.error("delete() method has been failed.", pe); throw translate("Failed to update Operator", pe); } } } OperatorService.java package com.ignite.easyticket.core.operator.service; @Service(value = "OperatorService") public class OperatorService implements IOperatorService { private Logger logger = Logger.getLogger(this.getClass()); @Resource(name = "OperatorDAO") private IOperatorDAO operatorDAO; @Transactional(propagation = Propagation.REQUIRED) public void deleteOperator(String operatorId) throws SystemException { try { logger.debug("deleteOperator() method has been started."); operatorDAO.delete(operatorId); logger.debug("deleteOperator() method has been successfully finisehd."); } catch (DAOException e) { logger.error("deleteOperator() method has been failed."); throw new SystemException(e.getErrorCode(), "Faield to delete a Operator", e); } } } OperatorController.java package com.ignite.easyticket.webservice; @Controller public class OperatorController { @RequestMapping(value = URIConstant.OPERATOR_DELETE, method = RequestMethod.POST) public @ResponseBody void deleteOperator(@RequestBody String operatorId) { logger.info("del…
has comment: http://stackoverflow.com/comment/41946865
tagged with: spring-mvc
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41946434
has comment: http://stackoverflow.com/comment/41972403
tagged with: jpa
has comment: http://stackoverflow.com/comment/41946150
score: 0

http://stackoverflow.com/comment/41736172
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26550787
has text: select e.employeeId, e.firstName from Employee e where e.lastName= :param1 and e.department.departmentName= :param2 ... will this work?

http://stackoverflow.com/a/26706077
has comment: http://stackoverflow.com/comment/42016294
has comment: http://stackoverflow.com/comment/42016577
has comment: http://stackoverflow.com/comment/42051066
answers question: http://stackoverflow.com/q/26627981
has comment: http://stackoverflow.com/comment/42050977
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has body: As of today, you would need to define a custom Instrumentation to do such a custom job. As pointed out in the comments, you can then use an Instrumentation.Compound to prepend the new behavior to for example FieldAccessor.ofBeanProperty() and thus reuse the field accessor code. In order to add custom code, Byte Buddy knows different abstraction levels: Instrumentation: Defines how a method is implemented. An instrumentation is able to define additional fields, methods or static initializer blocks that are required to implement a method. Furthermore, it determines if a method is to be defined for a type at all. A ByteCodeAppender is emitted by an Instrumentation and determines if a defined method is abstract and a method's byte code if a method is implemented. A StackManipulation is a byte code instruction with a given impact on an operand stack's size. Stack manipulations are composed for implementing a non-abstract method. In order to call a method in byte code, you need to load all arguments (including this) onto the stack and call the method after placing all these arguments. This can be done as follows: Load the this reference onto the stack by MethodVariableAccess.REFERENCE.loadFromIndex(0). Load a string onto the stack that describes the field that is access. This can be derived from the method's name which is given to a ByteCodeAppender as an argument. Using a TextConstant, a name can then be placed on the stack. A method can then be invoked by using a MethodInvocation where the setChanged method can be extracted from the created instrumented type's TypeDescription which is given to the Instrumentation as an argument. Of course, this is not very pretty and it is Byte Buddy's aspiration to hide this byte code level API from a user and to express anything in a DSL or in plain Java. You might therefore be happy to hear that I am currently working with Byte Buddy version 0.4 which comes with some features that you can use for this. For your example, you can imple…
accepted answer of: http://stackoverflow.com/q/26627981
score: 4

http://stackoverflow.com/a/26576534
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26572608
has comment: http://stackoverflow.com/comment/41771346
type: Answer
downvote count: 0
score: 1
has body: Your second approach is the way to go if you really want to deploy them individually. However, you are seeing a ClassNotFound exception because the WARs are individual projects and as such don't have access to the EAR's class path. To make that work, you have to add the public API of your application to your WAR's classpath. The public API consists of at least the EJB's remote interfaces of the EJBS that you would like to access from the WAR and any DTOs used in your API. The easiest way is to create a separate package (such as com.example.api) and let a build tools such as ant or Maven bundle that api package together with your EJBs and your WARs, or you create a myapp-api.jar and include it in the respective class-paths. Then you can remove the WARs from the EAR and deploy them as separate projects.
answers question: http://stackoverflow.com/q/26572608
has comment: http://stackoverflow.com/comment/41771821

http://stackoverflow.com/a/28139275
has body: Jetty creates instances of annotated client endpoints using reflection (see /jetty/websocket/jsr356/ClientContainer#newClientEndpointInstance()) but Java is unable to instantiate a non-static inner class that way. The actual cause exception is something like java.lang.NoSuchMethodException: &lt;pkg&gt;.OuterClass$InnerClass.&lt;init&gt;() but it is swallowed. Solution: annotated endpoint classes should be not nested or nested static (inner) classes.
type: Answer
answers question: http://stackoverflow.com/q/26658614
score: 0

http://stackoverflow.com/a/26555212
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26553797
type: Answer
has comment: http://stackoverflow.com/comment/41737782
has body: You never set the value of the record. X = reader1.readLine(); X = Records.getRecord(arr_count,y); Is discarding the value read. Create a setValue method in your Record class - X = reader1.readLine(); Records.setValue(arr_count, y, X); --- inRecord setValue ( x, y, val ) { records[x][y] = val; }
score: 0
accepted answer of: http://stackoverflow.com/q/26553797

http://stackoverflow.com/a/26599111
downvote count: 0
answers question: http://stackoverflow.com/q/26597987
upvote count: 2
has comment: http://stackoverflow.com/comment/41849024
accepted answer of: http://stackoverflow.com/q/26597987
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41890061
has comment: http://stackoverflow.com/comment/41823223
has comment: http://stackoverflow.com/comment/107558476
has comment: http://stackoverflow.com/comment/41854663
has comment: http://stackoverflow.com/comment/41851792
type: Answer
score: 2
has body: Use OpenSimplex noise: https://gist.github.com/KdotJPG/b1270127455a94ac5d19 Do sommething like: protected void generateLevel() { OpenSimplexNoise noise = new OpenSimplexNoise(); //optionally pass in a seed. for (int y = 0 y &lt; height; y++) { for (int x = 0; x &lt; width; x++) { double value = noise.eval(x / 24.0, y / 24.0, 0.5); if (value &lt; 0) { tiles[x + y * width] = 6; //set water } else { tiles[x + y * width] = 1; //set grass } } } } There are also alternatives such as Perlin noise and Simplex noise. I'd skip Perlin noise entirely because it tends to exhibit visually significant grid artifacts (it lines all of its features up with its underlying square grid). Simplex noise in 2D is okay, though most implementations of 2D Simplex noise on the internet use a weird gradient set that results in artifacts down the negative diagonal. And 3D simplex noise is patent-saddled. Perlin noise vs OpenSimplex noise, 2D slices of 3D: Left is noise(x, y, 0) grayscale Next is noise(x, y, 0) > 0 ? white : black Next is |noise(x, y, 0)| > 0.1 ? white : black Next is noise(x, y, 0.5) grayscale EDIT: Here's the code from the comment Fractal noise: OpenSimplexNoise n1 = new OpenSimplexNoise(seed1); OpenSimplexNoise n2 = new OpenSimplexNoise(seed2); OpenSimplexNoise n3 = new OpenSimplexNoise(seed3); for each x,y { double value = (n1.eval(x / 48.0, y / 48.0, 0.5) + n2.eval(x / 24.0, y / 24.0, 0.5) * .5 + n3.eval(x / 12.0, y / 12.0, 0.5) * .25) / (1 + .5 + .25); //Do whatever you need to with that value } Rivers: if (value &gt; -0.1 || value &lt; 0.1) water else land Biomes: OpenSimplexNoise n1 = new OpenSimplexNoise(seed1); OpenSimplexNoise n2 = new OpenSimplexNoise(seed2); OpenSimplexNoise n3 = new OpenSimplexNoise(seed3); for each x,y { double elevation = n1.eval(x / 24.0, y / 24.0, 0.5); double temperature = n2.eval(x / 24.0, y / 24.0, 0.5); double precipitation = n3.eval(x / 24.0, y / 24.0, 0.5); if (elevation &lt; 0) water else { //decide biome based on temperature, precipitati…

http://stackoverflow.com/comment/41864879
type: Comment
has text: thanks for the reply Alan.. but its not working in the way what i expected. it doesnt insert any foreign key & again gives duplicate entry in question table
type: AnswerComment
comment on: http://stackoverflow.com/a/26625740
score: 0

http://stackoverflow.com/a/26518919
answers question: http://stackoverflow.com/q/26518720
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41667588
score: 0
has body: After you create the JButton, you have to add an ActionListener for that button. Somthing like this: button1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { // Whatever you want to do when the user clicks the button } }); For example: public class Roll { DrawingKit dk = new DrawingKit("My Dice"); Graphics die1 = new Graphics(0,45); Graphics die2 = new Graphics(100,45); Graphics die3 = new Graphics(200,45); Graphics die4 = new Graphics(300,45); Graphics die5 = new Graphics(400,45); public static void main(String [] args ){ JPanel topPanel = new JPanel (); JButton button1 = new JButton("Roll"); button1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { // Roll and draws the dices rollDices(); drawDices(); } }); topPanel.add(button1); dk.addPanel(topPanel); } public static void rollDices() { die1.roll(); die2.roll(); die3.roll(); die4.roll(); die5.roll(); } public static void rollDices() { die1.draw(dk); die2.draw(dk); die3.draw(dk); die4.draw(dk); die5.draw(dk); } }
accepted answer of: http://stackoverflow.com/q/26518720

http://stackoverflow.com/comment/41731815
score: 0
has text: Your number is binary is: 0000001 This is the output I get for the number 6 when it should be 1000000 Any tips?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26554917

http://stackoverflow.com/comment/41815229
type: AnswerComment
comment on: http://stackoverflow.com/a/26600611
type: Comment
score: 1
has text: `public B b;` is correct (class field) Both classes are on different files

http://stackoverflow.com/q/26553579
has comment: http://stackoverflow.com/comment/41729389
possible better answer: http://stackoverflow.com/a/26553776
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/41729111
has answer: http://stackoverflow.com/a/26553776
accepted answer: http://stackoverflow.com/a/26553593
has body: For some reason a sentinel value will not work as expected public static int play() { String input;int result; do { input = JOptionPane.showInputDialog("Do you want to play-Enter 1 if yes , 0 if no"); result = Integer.parseInt(input); } while (result != 1 || result != 0); return result; } This code above never works but it works just fine if i change the condition from while (result != 1 || result != 0); to while (result &lt; 0 || result &gt; 1); Why is that so and how can i make not equal work in a do...while loop in java ? Thanks
score: 4
answer count: 2
downvote count: 0
has title: Not equal to in a do while loop
favorite count: 0
has comment: http://stackoverflow.com/comment/41729086
linked to: http://stackoverflow.com/q/6127694
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/6127694
tagged with: java
has answer: http://stackoverflow.com/a/26553593

http://stackoverflow.com/comment/41854236
type: Comment
type: QuestionComment
has text: Execute the code that accesses the `map` in a synchronize block: `synchronize(map){...}`
comment on: http://stackoverflow.com/q/26621907
score: 1

http://stackoverflow.com/a/26548576
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26538976
answers question: http://stackoverflow.com/q/26538976
has body: I'm not seeing any errors, but one thing I noticed is a spelling mistake here: $('.next-sbumit').on('click', function(e) { e.preventDefault(); showSpinner(); }); next-sbumit should likely be next-submit - correct?
upvote count: 1
type: Answer

http://stackoverflow.com/a/26521223
has body: Nobody so far has really explained what is happening... When you call a function it's not simply going there--it has to remember exactly where you were and what all your variables were so it can return to that exact spot when your function returns. It does this by storing the current state on a stack (An area of memory that builds up in one direction). Every time your app recurses the stack grows deeper needing more memory. A Stack overflow is when the stack has grown so big that it overflows the memory allocated to it. your looping version doesn't require any extra memory per iteration because it doesn't have to remember when to go back to--it just runs around in circles and can do so for ever. Sorry if this wasn't what you were asking.
type: Answer
answers question: http://stackoverflow.com/q/26521044
accepted answer of: http://stackoverflow.com/q/26521044
has comment: http://stackoverflow.com/comment/41729371
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41733643

http://stackoverflow.com/comment/41687368
type: Comment
has text: Yes I believe that should work, I see 269 uses of this in Eclipse + JDT. This does not have much to do with adapters.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26529415

http://stackoverflow.com/q/26564506
tagged with: java
has answer: http://stackoverflow.com/a/27551556
type: Question
answer count: 1
tagged with: kademlia
has title: Effiencient Kademlia Buckets
has body: I'm writing a modificted Kademlia P2P system here but the problem I'm describing here is very similar to the implementation of the original one. So, what's the most efficient way of implementing k-Buckets? What matters for me are access time, parallelism (read &amp; write) and memory consuption. Thought doing it with a ConcurrentLinkedQueue and a ConcurrentHashMap but that's pretty redundant and nasty, isn't it? At the moment I'm simply synchronizing a LinkedList. Here is my code: import java.util.LinkedList; class Bucket { private final LinkedList&lt;Neighbour&gt; neighbours; private final Object lock; Bucket() { neighbours = new LinkedList&lt;&gt;(); lock = new Object(); } void sync(Neighbour n) { synchronized(lock) { int index = neighbours.indexOf(n); if(index == -1) { neighbours.add(n); n.updateLastSeen(); } else { Neighbour old = neighbours.remove(index); neighbours.add(old); old.updateLastSeen(); } } } void remove(Neighbour n) { synchronized(lock) { neighbours.remove(n); } } Neighbour resolve(Node n) throws ResolveException { Neighbour nextHop; synchronized(lock) { int index = neighbours.indexOf(n); if(index == -1) { nextHop = neighbours.poll(); neighbours.add(nextHop); return nextHop; } else { return neighbours.get(index); } } } } Please don't wonder, I have implemented another neighbour eviction process.
tagged with: p2p
accepted answer: http://stackoverflow.com/a/27551556
linked to: http://stackoverflow.com/q/47507317
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/41762040
score: 0
has text: Thanks for the nice explanation, i will follow it to solve my problem.many thanks
type: Comment
comment on: http://stackoverflow.com/a/26570441
type: AnswerComment

http://stackoverflow.com/comment/41847172
comment on: http://stackoverflow.com/q/26557659
score: 0
type: QuestionComment
has text: Minor update. I tried some other random grayscale tifs I downloaded as well as generated via [http://image.online-convert.com/convert-to-tiff](http://image.online-convert.com/convert-to-tiff) and also uncompressed grayscale tiffs and they seem to work. Not sure what exactly the issue is with the grayscale tif under test .
type: Comment

http://stackoverflow.com/q/26657368
has comment: http://stackoverflow.com/comment/41917772
has comment: http://stackoverflow.com/comment/41917643
type: Question
tagged with: view-scope
has body: i would need to get a viewScoped managed bean from a sessionScoped managed bean. I tried firstly using the @ManagedProperty annotation, but i discovered immediately the it does not work and i know why. Secondly i tried to use the following method: Map&lt;String, Object&gt; viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap(); PulsantieraBean pulsantiera = (PulsantieraBean) viewMap.get("#{pulsantiera}"); but when i access in debug to the objects, pulsantiera is null and viewMap object contains only another viewScoped managed bean. The PulsantieraBean class is declared in the following way: @ViewScoped @ManagedBean(name = NomeBean.PULSANTIERA) public class PulsantieraBean extends ControllerBaseBean implements Serializable { whereas the class in which i do the request is declared as the following @SessionScoped @ManagedBean(name = NomeBean.IDF_TAB_IMPORTI) public class IdfTabImportiBean extends ControllerBaseBean implements Serializable { I do the request inside a method in which i am sure the viewScoped managed bean PulsantieraBean exists. Any help would be appreciated. Thanks, Marco
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41918231
has title: Can't get viewScoped bean from a SessionScoped bean
type: UnansweredQuestion
tagged with: managed-bean
tagged with: session-scope
tagged with: jsf
has comment: http://stackoverflow.com/comment/41917825
has answer: http://stackoverflow.com/a/26660093
tagged with: java

http://stackoverflow.com/q/26623717
answer count: 1
has comment: http://stackoverflow.com/comment/41857588
type: UnansweredQuestion
has title: Hibernate inserting records in multiple table
has body: My scenario is that i have three tables Template, Question and Choice. here Template will have many questions and Questions will have many choices and Other field in Choice Table. Im using single form in Struts2 to insert records. my Question is how to configure in hibernate??? Thanks !!! @Entity @Table(name="template") public class Template { @javax.persistence.Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="t_id") private Integer Id; private String temp; @OneToMany(targetEntity=Question.class, cascade=CascadeType.ALL) @JoinColumn(name="tempId", referencedColumnName="t_id") private Set&lt;Question&gt; question; //getter setter } @Entity @Table(name="question") public class Question { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="Qid") private Integer Qid; private String question; @ManyToOne @JoinColumn(name="tempid") private Template template; @OneToMany(targetEntity=Choice.class, cascade=CascadeType.ALL) @JoinColumn(name="qid", referencedColumnName="Qid") private Set&lt;Choice&gt; choice; //getter setter } @Entity @Table(name="choice") public class Choice { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer Id; private String choice; private String status; private String description; @ManyToOne @JoinColumn(name="qid") private Question question; //getter setter } ************ controller***************** public class UserController extends ActionSupport implements ServletRequestAware{ HttpServletRequest request; @Override public void setServletRequest(HttpServletRequest request) { this.request =request; } Dao dao = new Dao(); Template template = new Template(); Question question = new Question(); Choice choice = new Choice(); public Choice getChoice() { return choice; } public void setChoice(Choice choice) { this.choice = choice; } public Question getQuestion() { return question; } public void setQuestion(Question question) { this.question = question; } public Template getTemplate() { return template; } public void set…
has comment: http://stackoverflow.com/comment/41857443
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41857832
has comment: http://stackoverflow.com/comment/41857285
has comment: http://stackoverflow.com/comment/41857403
has answer: http://stackoverflow.com/a/26625740
type: Question
tagged with: struts2

http://stackoverflow.com/q/26599030
has comment: http://stackoverflow.com/comment/41812552
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41812500
possible better answer: http://stackoverflow.com/a/26599076
has answer: http://stackoverflow.com/a/26600709
has answer: http://stackoverflow.com/a/26599319
tagged with: for-loop
has answer: http://stackoverflow.com/a/26599076
has comment: http://stackoverflow.com/comment/41812539
answer count: 7
has comment: http://stackoverflow.com/comment/41812612
has comment: http://stackoverflow.com/comment/41812501
accepted answer: http://stackoverflow.com/a/26599104
favorite count: 0
has body: I am tasked with writing a program that displays the amount of asteriks that the user inputs, then squares it. So, if I were to input 6, the computer would display 36. I am programming in Java. This is what I should be getting: Please enter the number of stars you would like(between 1 and 20): 4 * * * * * * * * * * * * * * * * Whenever I run the program, after it prints Please enter the number of stars you would like(between 1 and 20):, it displays the number I input...and nothing happens. BLANK. Here is my code. I am not sure what I did wrong: Scanner input = new Scanner(System.in); String star = "*"; System.out.print("Please enter the number of stars you would like(between 1 and 20):\n&gt;&gt; "); int numStars = input.nextInt(); for(int squared = numStars*numStars; squared &lt; numStars+1; squared++) { for(int stop = 0; stop &lt; numStars; stop++) { System.out.print(star+" "); } System.out.println(star+" "); } System.out.println();
has title: Need help using a ForLoop inside a ForLoop
has comment: http://stackoverflow.com/comment/41812493
has answer: http://stackoverflow.com/a/26599080
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41812536
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/26599084
has answer: http://stackoverflow.com/a/26599091
type: Question
has answer: http://stackoverflow.com/a/26599104
has comment: http://stackoverflow.com/comment/41812516

http://stackoverflow.com/q/26544881
has comment: http://stackoverflow.com/comment/41713244
score: 0
answer count: 2
has body: I trying to convert the the binary to hex and put into Byte in Android. But the App crash , and the error log is E/AndroidRuntime(18032): java.lang.NumberFormatException: Invalid int: "0D" The code is like the following : String WorkStatus = "1101" byte[] control = new byte[11]; control[10] = (byte) Byte.parseByte(String.format("%02X", Integer.parseInt(WorkStatus,2))); It seems the 0D is invalid int , what should I use for instead of Integer.parseInt ? or did I missing something ? I want to do like the following: control[10] = (byte) 0x0d; Thanks in advance.
tagged with: hex
tagged with: binary
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26545011
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/26544976
has title: java.lang.NumberFormatException: Invalid int when convert the binary to hex in Android
type: Question

oop
tags question: http://stackoverflow.com/q/26586401
tags question: http://stackoverflow.com/q/26528360
tags question: http://stackoverflow.com/q/26602545
tags question: http://stackoverflow.com/q/26516025
tags question: http://stackoverflow.com/q/26531065
tags question: http://stackoverflow.com/q/26645686
tags question: http://stackoverflow.com/q/26550476
tags question: http://stackoverflow.com/q/26622294
tags question: http://stackoverflow.com/q/26579954
tag name: oop
tags question: http://stackoverflow.com/q/26536188
tags question: http://stackoverflow.com/q/26553797
tags question: http://stackoverflow.com/q/26539171
tags question: http://stackoverflow.com/q/26566950
tags question: http://stackoverflow.com/q/26576477
tags question: http://stackoverflow.com/q/26628643
tags question: http://stackoverflow.com/q/26567233
tags question: http://stackoverflow.com/q/26580342
tags question: http://stackoverflow.com/q/26553921
tags question: http://stackoverflow.com/q/26592482
tags question: http://stackoverflow.com/q/26576212
tags question: http://stackoverflow.com/q/26585209
tags question: http://stackoverflow.com/q/26561340
tags question: http://stackoverflow.com/q/26600912
tags question: http://stackoverflow.com/q/26654875
tags question: http://stackoverflow.com/q/26517713
tags question: http://stackoverflow.com/q/26615801
tags question: http://stackoverflow.com/q/26596042
type: Tag
tags question: http://stackoverflow.com/q/26617224
tags question: http://stackoverflow.com/q/26551749
tags question: http://stackoverflow.com/q/26645037
tags question: http://stackoverflow.com/q/26575545

http://stackoverflow.com/a/26640902
score: 0
has body: DerpRandom() means i have a function that i will call that takes no input and does some execution. it returns nothing because its void DerpRandom(result) means I have a function that takes an input of an integer called result and does something but returns nothing due to the void return type. What does the code do ? derpRandom() prints a number from 0-6 then it calls DerpResult(result); derpResult(result) makes sure the number passed into it is less than 7 which it is when the other method called it. so you could call DerpResult(result); there which is the same as calling DerpResult(6); however you could also call DerpResult and change the input param, say DerpResult(1) which would yield the same thing or DerpResult(11) which wouldnt print anything.
type: Answer
answers question: http://stackoverflow.com/q/26640800

http://stackoverflow.com/comment/41807856
type: AnswerComment
has text: Thank you!! spent so much time trying to find the mistake lol
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26596601

http://stackoverflow.com/comment/41867916
type: Comment
comment on: http://stackoverflow.com/a/26629206
score: 0
has text: well, actually, at that point, you interact with the `@Embedded` table through the `where` clause of the outer table, so you shouldn't need to create an ORM layer in Python for that particular table.
type: AnswerComment

http://stackoverflow.com/comment/41862793
type: QuestionComment
comment on: http://stackoverflow.com/q/26625793
type: Comment
has text: Yes, this exception confirms doubt of mine. You must configure the transaction manager.
score: 0

http://stackoverflow.com/comment/41732363
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26555142
has text: @ajb Huh??? Not if the condition is always true the first iteration I don't know what he is doing with his code and neither do you.
score: 0

http://stackoverflow.com/q/26631214
type: Question
has comment: http://stackoverflow.com/comment/41870576
accepted answer: http://stackoverflow.com/a/26631412
answer count: 1
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/4553633
has body: I need to create a Double with two decimals from a String- in other words, I need to turn "100" into 100.00. Surprisingly: double d = Double.valueOf("500"); DecimalFormat df = new DecimalFormat("#.00"); System.out.print(df.format(d)); Prints out: 500,00 I'd need rather "500.00". How can I fix it ? Thanks
has title: Create a Double with two decimals from a String
has comment: http://stackoverflow.com/comment/41871225
favorite count: 0
has answer: http://stackoverflow.com/a/26631412
upvote count: 1
linked to: http://stackoverflow.com/q/5054132
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5054132
tagged with: java
has comment: http://stackoverflow.com/comment/41870543

http://stackoverflow.com/q/26619318
has comment: http://stackoverflow.com/comment/41850068
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19843784
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/26619597
duplicate of: http://stackoverflow.com/q/19843784
type: Question
has title: cant resolve symbol for google play services in android manifest
linked to: http://stackoverflow.com/q/19879844
answer count: 1
has body: I was following this tutorial on how to get AdMob on your app: Tutorial here on the part where it tells you what to put in your AndroidManifest file, where it says &lt;!--This meta-data tag is required to use Google Play Services.--&gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; In my project in android studio whenever I try to write this in my android manifest the value "@integer/google_play_services_version" comes as cant resolve symbol. How do i fix this. I have installed Google play services, Google repository and Android support Repository and library in the sdk. Im using android studio not eclipse too.
has answer: http://stackoverflow.com/a/26619597

http://stackoverflow.com/q/26582662
has comment: http://stackoverflow.com/comment/41781644
has answer: http://stackoverflow.com/a/26582910
downvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26582858
has answer: http://stackoverflow.com/a/26582858
tagged with: java
accepted answer: http://stackoverflow.com/a/26582887
favorite count: 0
has title: SFTP in jdk1.4?
type: Question
has body: I am developing an application using java and SFTP. I am using SFTP in jdk1.6 but it consumed lot of machine memory. Is it possible to use SFTP in jdk1.4 ?
score: -2
has answer: http://stackoverflow.com/a/26582887
upvote count: 2
has comment: http://stackoverflow.com/comment/41781736
answer count: 3

http://stackoverflow.com/comment/41773714
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26578197
has text: This is not correct. There is a *happens-before* edge induced by the `acquireLock`-`relaseLock` methods.
type: Comment

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/26606977
tags question: http://stackoverflow.com/q/26639428
type: Tag
tags question: http://stackoverflow.com/q/26582859
tags question: http://stackoverflow.com/q/26558955

http://stackoverflow.com/q/26528765
tagged with: android-actionbar
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41708981
has title: Center an image in actionbar
type: Question
has comment: http://stackoverflow.com/comment/41684586
has comment: http://stackoverflow.com/comment/41684691
has comment: http://stackoverflow.com/comment/41685144
has comment: http://stackoverflow.com/comment/41684985
has comment: http://stackoverflow.com/comment/41684738
has comment: http://stackoverflow.com/comment/41685422
has comment: http://stackoverflow.com/comment/41684762
has body: I want to center an image on my action bar. So here it goes... Here's my actionbar_about.xml file. In this xml file is the image located &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;ImageView android:id="@+id/about_actionbar" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerHorizontal="true" android:layout_gravity="center" android:src="@drawable/ic_about" /&gt; &lt;/RelativeLayout&gt; And this is where I will overlay or inflate that xml file. AboutUs.java. This ain't mainactivity.java that's why I'm using getActivity() @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ActionBar ActionBar mActionBar = getActivity().getActionBar(); mActionBar.setDisplayShowHomeEnabled(true); mActionBar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.from(getActivity()); View mCustomView = mInflater.inflate(R.layout.actionbar_about, null); ImageView mImageView = (ImageView) mCustomView.findViewById(R.id.about_actionbar); mImageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_about)); mActionBar.setCustomView(mCustomView); mActionBar.setDisplayShowCustomEnabled(true); } THANKS GUYS! :)
score: 0
has comment: http://stackoverflow.com/comment/41688963
answer count: 1
has answer: http://stackoverflow.com/a/27542597
has comment: http://stackoverflow.com/comment/41704338
has comment: http://stackoverflow.com/comment/41684345
tagged with: android

http://stackoverflow.com/comment/41922918
type: QuestionComment
type: Comment
has text: Scenario is Storm cluster running on my machine. Topology has been submitted. Now using an independent Java program I want to check whether storm is running or not. I dont want to check it inside the topology class.
score: 0
comment on: http://stackoverflow.com/q/26639190

http://stackoverflow.com/q/26542552
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
tagged with: logging
has answer: http://stackoverflow.com/a/26557453
tagged with: java
downvote count: 1
has title: How to integrate java, log4j, nxlog, loggly in a Windows system?
tagged with: log4j2
type: Question
has body: I want to integrate my java desktop application running in Windows with Loggly. I have created an account in Loggly. I have installed nxlog and started the service. Nxlog.log file shows: 2014-10-22 19:02:16 INFO nxlog-ce-2.8.1248 started 2014-10-22 19:02:16 INFO connecting to logs-01.loggly.com:6514 2014-10-22 19:02:17 INFO successfully connected to logs-01.loggly.com:6514 I have integrated my java application with log4j as: &lt;appender name="socketappender" class="org.apache.log4j.net.SocketAppender"&gt; &lt;param name="Port" value="6514"/&gt; &lt;param name="RemoteHost" value="logs-01.loggly.com"/&gt; &lt;param name="Threshold" value="TRACE"/&gt; &lt;layout class="org.apache.log4j.PatternLayout"&gt; &lt;param name="ConversionPattern" value="%d{MMM dd HH:mm:ss} MYAPP: %-5p %m%n"/&gt; &lt;/layout&gt; &lt;/appender&gt; Windows logs are showing in Loggly but my java application logs are not found in Loggly. What else I have to do so that my application logs will be routed to Loggly?
score: -1
upvote count: 0
answer count: 1
tagged with: loggly

http://stackoverflow.com/q/26571710
has answer: http://stackoverflow.com/a/27080251
type: Question
has title: Appengine module: How to route error_handlers to non default module?
tagged with: gae-module
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27080251
has comment: http://stackoverflow.com/comment/42546186
favorite count: 0
has comment: http://stackoverflow.com/comment/41930470
tagged with: google-app-engine
tagged with: python
tagged with: module
has body: I am referring to the set up custom error responses for Google Appengine as described in the documentation for Configuring with app.yaml particulary on the following code: error_handlers - error_code: default file: default_error.html - error_code: over_quota file: over_quota.html Currently I am running an application by putting the code in separate modules where python run as a default module configured in app.yaml. Other module's runtime are in php and java which are run simultaneously thru dispatch.yaml as shown below: application: app-id dispatch: # Send favicon to default module - python - url: "*/favicon.ico" module: default # Send script to java module - url: "*/scripts/*" module: javamodule # Send others to php module - url: "*/*" module: phpmodule Everything seems to work as expected but I need to know what I have been missing here since I have put the above error_handlers in the app.yaml but fail to show either default_error.html on page not found (error code: 404) nor over_quota.html on over quota (error code:503). I have put them also in other modules with also no response. I have also make sure that the path to the error response file does not overlap with static file handler paths and that the both html file are less than 10 kilobytes.
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42136438

http://stackoverflow.com/a/26635751
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41880539
has comment: http://stackoverflow.com/comment/41879329
type: Answer
has comment: http://stackoverflow.com/comment/41879841
has comment: http://stackoverflow.com/comment/41880168
score: 1
upvote count: 1
has body: The constructors of the class are private, you cannot see them outside the class. You have to use the static method that creates the map. ArrayListMultimap&lt;String, int[]&gt; combinations = ArrayListMultimap.create(); As for the second error, I don't see any Guava class with this name, so maybe you mispelled it?
has comment: http://stackoverflow.com/comment/41879314
downvote count: 0
answers question: http://stackoverflow.com/q/26635700
has comment: http://stackoverflow.com/comment/41880443
has comment: http://stackoverflow.com/comment/41879553
accepted answer of: http://stackoverflow.com/q/26635700

http://stackoverflow.com/q/26570645
answer count: 2
has comment: http://stackoverflow.com/comment/41759802
score: 0
has title: Converter application error on Android
has comment: http://stackoverflow.com/comment/41759832
tagged with: android
accepted answer: http://stackoverflow.com/a/26570964
possible better answer: http://stackoverflow.com/a/26572688
has comment: http://stackoverflow.com/comment/41760202
has answer: http://stackoverflow.com/a/26570964
has comment: http://stackoverflow.com/comment/41759744
type: AnsweredQuestion
has body: Hello guys I am making an Android app that convert from binary to decimal and I have made a class called Binary and a class called Decimal and a function in the Binary class that convert from decimal to binary public Binary DtoB(Decimal decimal) { String temp = null; do { if(decimal.decimal%2!=0) temp+='1'; else temp+='0'; decimal.decimal/=2; }while(decimal.decimal&gt;0); while(temp.length()%4!=0) temp+='0'; for(int i=temp.length()-1;i&gt;=0;i--) { this.bn+=temp.charAt(i); } return this; } and in the activity there's a button that converts, but when I test and press on the button the app breaks b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub d1.decimal=Integer.parseInt(e1.getText().toString()); b.DtoB(d1); t1.setText(b.bn); } }); can any one help me please ??? Here is the logcat: 10-26 09:16:15.831: E/AndroidRuntime(280): FATAL EXCEPTION: main 10-26 09:16:15.831: E/AndroidRuntime(280): java.lang.NullPointerException 10-26 09:16:15.831: E/AndroidRuntime(280): at com.example.converter.MainActivity$1.onClick(MainActivity.java:34) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.view.View.performClick(View.java:2408) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.view.View$PerformClick.run(View.java:8816) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.os.Handler.handleCallback(Handler.java:587) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.os.Handler.dispatchMessage(Handler.java:92) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.os.Looper.loop(Looper.java:123) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-26 09:16:15.831: E/AndroidRuntime(280): at java.lang.reflect.Method.invokeNative(Native Method) 10-26 09:16:15.831: E/AndroidRuntime(280): at java.lang.reflect.Method.invoke(Method.java:521)
tagged with: java
has comment: http://stackoverflow.com/comment/41759809
has answer: http://stackoverflow.com/a/26572688
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41759818
type: Question

http://stackoverflow.com/comment/104083693
score: 0
comment on: http://stackoverflow.com/a/53076156
type: Comment
has text: Helped me a lot
type: AnswerComment

generics
tags question: http://stackoverflow.com/q/26604023
tags question: http://stackoverflow.com/q/26555883
tags question: http://stackoverflow.com/q/26668570
tags question: http://stackoverflow.com/q/26630523
tags question: http://stackoverflow.com/q/26657738
tags question: http://stackoverflow.com/q/26643045
tags question: http://stackoverflow.com/q/26535441
tags question: http://stackoverflow.com/q/26524817
tags question: http://stackoverflow.com/q/26515809
tags question: http://stackoverflow.com/q/26551339
tags question: http://stackoverflow.com/q/26585521
tags question: http://stackoverflow.com/q/26666415
tags question: http://stackoverflow.com/q/26554887
tags question: http://stackoverflow.com/q/26664274
type: Tag
tags question: http://stackoverflow.com/q/26650377
tags question: http://stackoverflow.com/q/26622232
tags question: http://stackoverflow.com/q/26552067
tags question: http://stackoverflow.com/q/26568861
tags question: http://stackoverflow.com/q/26535128
tags question: http://stackoverflow.com/q/26538980
tags question: http://stackoverflow.com/q/26577275
tags question: http://stackoverflow.com/q/26572250
tags question: http://stackoverflow.com/q/26578500
tags question: http://stackoverflow.com/q/26666161
tags question: http://stackoverflow.com/q/26551894
tags question: http://stackoverflow.com/q/26613588
tags question: http://stackoverflow.com/q/26577271
tags question: http://stackoverflow.com/q/26625807
tags question: http://stackoverflow.com/q/26579954
tags question: http://stackoverflow.com/q/26616796
tags question: http://stackoverflow.com/q/26534027
tags question: http://stackoverflow.com/q/26615172
tags question: http://stackoverflow.com/q/26586506
tags question: http://stackoverflow.com/q/26517632
tags question: http://stackoverflow.com/q/26576477
tags question: http://stackoverflow.com/q/26573769
tags question: http://stackoverflow.com/q/26529600
tag name: generics
tags question: http://stackoverflow.com/q/26530949
tags question: http://stackoverflow.com/q/26557233
tags question: http://stackoverflow.com/q/26668135
tags question: http://stackoverflow.com/q/26565606

affiliate
type: Tag
tags question: http://stackoverflow.com/q/26602869
tag name: affiliate

http://stackoverflow.com/comment/41765390
comment on: http://stackoverflow.com/q/26573839
score: 2
type: Comment
type: QuestionComment
has text: Instead of comparing strings, why not just compare the instance of `java.lang.Thread` that is `this`?

selenium-webdriver
tags question: http://stackoverflow.com/q/26547833
tags question: http://stackoverflow.com/q/26592554
tags question: http://stackoverflow.com/q/26604230
tags question: http://stackoverflow.com/q/26583930
tags question: http://stackoverflow.com/q/26582395
tags question: http://stackoverflow.com/q/26651086
tags question: http://stackoverflow.com/q/26516415
tags question: http://stackoverflow.com/q/26543521
tags question: http://stackoverflow.com/q/26514862
tags question: http://stackoverflow.com/q/26598239
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/26636508
tags question: http://stackoverflow.com/q/26600003
tags question: http://stackoverflow.com/q/26634860
tags question: http://stackoverflow.com/q/26520434
tags question: http://stackoverflow.com/q/26611725
tags question: http://stackoverflow.com/q/26556843
type: Tag
tags question: http://stackoverflow.com/q/26655628
tags question: http://stackoverflow.com/q/26516254
tags question: http://stackoverflow.com/q/26595069

http://stackoverflow.com/a/26602732
upvote count: 1
has body: For two applications to communicate, you need some form of Inter-Process Communication, IPC, pretty much by definition. So you need some kind of protocol. So, short answer to your question is: RMI is not the only way, but all other ways are similar, communication and not direct method call. If you just want to call the method in code of another application, then add the .jar with the class to your application, or load the .jar at runtime, and (since that is a static method) just call the method. But this is just normal static method call, so you probably did not mean this?
answers question: http://stackoverflow.com/q/26602520
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41818974
type: Answer

http://stackoverflow.com/comment/41770233
comment on: http://stackoverflow.com/a/26576259
type: Comment
type: AnswerComment
has text: *reference* field variables are assigned to null. *primitive* field variables are initialized to their [default values](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) (scroll down to default values)
score: 0

http://stackoverflow.com/a/26623444
has body: Spring provide three patterns in the url handler mappings ? - zero or one charecter *- one charecter ** - one or more charecters And below approach resolved my issue @RequestMapping(value = "/projects/{projectId}/resources/web/**", method = RequestMethod.GET) @ResponseBody public void getWebFileContent(@PathVariable("projectId") String projectIdHttpServletRequest httpServletRequest) throws Exception { String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); // will get path = /projects/pro1/resources/web/src/main/webapp String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); // will get bestMatchPattern = /projects/pro1/resources/web/** AntPathMatcher apm = new AntPathMatcher(); String exactPath = apm.extractPathWithinPattern(bestMatchPattern, path); // will get exactPath = src/main/webapp ..... } Any other approaches are appreciated....
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26623417
type: Answer
answers question: http://stackoverflow.com/q/26623417

http://stackoverflow.com/a/26561982
accepted answer of: http://stackoverflow.com/q/26561882
answers question: http://stackoverflow.com/q/26561882
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has body: It isn't defined there, but it is in Chapter 14, which talks about abrupt completion in general: If a statement evaluates an expression, abrupt completion of the expression always causes the immediate abrupt completion of the statement, with the same reason. All succeeding steps in the normal mode of execution are not performed. Unless otherwise specified in this chapter, abrupt completion of a substatement causes the immediate abrupt completion of the statement itself, with the same reason, and all succeeding steps in the normal mode of execution of the statement are not performed. So we can conclude it isn't specified for exceptions because it's true for all possible reasons of abrupt completion, not just exceptions.
type: Answer

http://stackoverflow.com/comment/41770111
type: QuestionComment
has text: possible duplicate of [Java: how do I check if a Date is within a certain range?](http://stackoverflow.com/questions/494180/java-how-do-i-check-if-a-date-is-within-a-certain-range)
comment on: http://stackoverflow.com/q/26568092
score: 0
type: Comment

http://stackoverflow.com/a/26635112
upvote count: 2
has comment: http://stackoverflow.com/comment/41902212
has body: You can use JavaMail API public static boolean isValidEmailAddress(String email) { boolean result = true; try { InternetAddress emailAddr = new InternetAddress(email); emailAddr.validate(); } catch (AddressException ex) { result = false; } return result; } UPDATE: I found a second alternative, where you can use SMTP commands to check whether there is a registered email server in the domain! Please look at this topic, where you can find this code and an explanation on SMTP VRFY commands!
score: 2
has comment: http://stackoverflow.com/comment/41878223
has comment: http://stackoverflow.com/comment/41878775
has comment: http://stackoverflow.com/comment/41878532
downvote count: 0
answers question: http://stackoverflow.com/q/26635005
type: Answer

http://stackoverflow.com/comment/41725772
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26550759
has text: Yes, I tried android:digits="0123456789." android:inputType="numberDecimal"

http://stackoverflow.com/q/26582207
possible better answer: http://stackoverflow.com/a/26582551
has title: How can I prints the sum of the 2nd to last digit of each integer?
answer count: 3
has answer: http://stackoverflow.com/a/26582551
has answer: http://stackoverflow.com/a/26582223
has comment: http://stackoverflow.com/comment/41780731
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26582223
score: 0
tagged with: java
has body: How can I print the sum of the 2nd to last digit of each integer? (so, 8 would be printed since 1 + 3 + 4 is 8) in the following Program: import java.util.*; public class Pr6{ public static void main(String[] args){ Scanner scan = new Scanner (System.in); int num1; int num2; int num3; int sumSecToLast; System.out.print("Please write an integer: "); num1 = scan.nextInt(); System.out.print("Please write an integer: "); num2 = scan.nextInt(); System.out.print("Please write an integer: "); num3 = scan.nextInt(); sumSecToLast = (num1/10) % 10 + (num2/10) % 10 + (num3/10) % 10; System.out.print((num1/10) % 10 + " + " + (num2/10) % 10 + " + " + (num3/10) % 10 + " = " + sumSecToLast); }//main }//Pr6
type: Question
has answer: http://stackoverflow.com/a/26582322
tagged with: sum

http://stackoverflow.com/comment/41944018
type: Comment
comment on: http://stackoverflow.com/a/26671359
has text: @HermanTorjussen: why would you want to *reuse* them? If implementation is different it requires different tests. If it isn't it shouldn't even exist.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26587493
has body: You can think of a PreparedStatement as a "cached" statement that will be compiled once on the database server. When you create the statement, it will be sent to the DB server, which will do the usual syntax checking and determine an efficient execution plan for the query. This way, it can re-use the same execution plan (which is cached as well) for multiple invocations of the same statement. The key of this cache is the statement itself without its parameter values filled. If the values are explicitly filled in the statement (i.e. you don't fill them using the set* methods), then a new execution plan would be accessed in the cache. That's why prepared statements are best used when executing several statements but with different values.
score: 3
downvote count: 0
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26587393

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/26658614
tags question: http://stackoverflow.com/q/26619846
type: Tag

http://stackoverflow.com/a/26585783
has comment: http://stackoverflow.com/comment/41815209
has body: The get() method of a future waits for computation to be finished. So it waits the two seconds your thread sleeps. Then the result is 1. And the result stays 1, because the thread is not re-run (and shouldn't be re-run!). So the second setVar has no effect on the result.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26585700
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41786976
downvote count: 0
answers question: http://stackoverflow.com/q/26585700
type: Answer

http://stackoverflow.com/q/26581057
tagged with: multithreading
has answer: http://stackoverflow.com/a/26586061
upvote count: 1
has comment: http://stackoverflow.com/comment/41778805
type: Question
has comment: http://stackoverflow.com/comment/41783456
accepted answer: http://stackoverflow.com/a/26586061
score: 1
has title: setPriority() method doesn't work properly
tagged with: java
tagged with: concurrency
possible better answer: http://stackoverflow.com/a/26584444
answer count: 2
has answer: http://stackoverflow.com/a/26584444
downvote count: 0
favorite count: 0
has body: I do the sample code from here. I get the result: Thread[Thread-3,1,main]: 5 Thread[Thread-0,10,main]: 5 Thread[Thread-2,1,main]: 5 Thread[Thread-1,1,main]: 5 Thread[Thread-4,1,main]: 5 Thread[Thread-0,10,main]: 4 Thread[Thread-3,1,main]: 4 Thread[Thread-2,1,main]: 4 Thread[Thread-0,10,main]: 3 Thread[Thread-5,1,main]: 5 Thread[Thread-3,1,main]: 3 Thread[Thread-2,1,main]: 3 Thread[Thread-1,1,main]: 4 Thread[Thread-5,1,main]: 4 Thread[Thread-3,1,main]: 2 Thread[Thread-2,1,main]: 2 Thread[Thread-5,1,main]: 3 Thread[Thread-3,1,main]: 1 Thread[Thread-4,1,main]: 4 Thread[Thread-0,10,main]: 2 Thread[Thread-2,1,main]: 1 Thread[Thread-5,1,main]: 2 Thread[Thread-4,1,main]: 3 Thread[Thread-5,1,main]: 1 Thread[Thread-1,1,main]: 3 Thread[Thread-0,10,main]: 1 Thread[Thread-4,1,main]: 2 Thread[Thread-1,1,main]: 2 Thread[Thread-4,1,main]: 1 Thread[Thread-1,1,main]: 1 It seems that setPriority doesn't work properly. Why? How can I modify the sample code to see the effect of property.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41789348

http://stackoverflow.com/a/26638363
type: Answer
has body: You can check Long object for null value with longValue == null , you can use longValue == 0L for long (primitive), because default value of long is 0L, but it's result will be true if longValue is zero too
score: 10
upvote count: 10
downvote count: 0
answers question: http://stackoverflow.com/q/26638047

logback
tags question: http://stackoverflow.com/q/26531913
tags question: http://stackoverflow.com/q/26636958
type: Tag
tags question: http://stackoverflow.com/q/26585959
tags question: http://stackoverflow.com/q/26662320
tags question: http://stackoverflow.com/q/26592541
tags question: http://stackoverflow.com/q/26563107
tags question: http://stackoverflow.com/q/26591160
tag name: logback
tags question: http://stackoverflow.com/q/26578442
tags question: http://stackoverflow.com/q/26656659

http://stackoverflow.com/a/26581246
score: 0
type: Answer
has body: As far as I can see, you need your own implementation of internalComplete() which instantiates your own equivalent of AltResult in case of null or exception. And your subclass supplyAsync() is supposed to return a new instance of your new CompletableFuture subclass.
has comment: http://stackoverflow.com/comment/41779429
answers question: http://stackoverflow.com/q/26579139

http://stackoverflow.com/comment/41848191
comment on: http://stackoverflow.com/a/26617343
score: 0
type: AnswerComment
type: Comment
has text: the thing is when you instanciate your class, the datas must have a fixed number of rows, but the DATA will change during the process so... it'd be most likely a List<class> that I should do.

http://stackoverflow.com/a/26525040
answers question: http://stackoverflow.com/q/26524961
type: Answer
score: 0
has body: Where id = IdInputVar Should work

http://stackoverflow.com/comment/41722321
type: AnswerComment
has text: Man, i love you... THANK YOU!
comment on: http://stackoverflow.com/a/26538466
type: Comment
score: 0

http://stackoverflow.com/comment/41779960
has text: One more thing, don't whether you have use GET method just for testing or not, but while exchanging sensitive data like login always use post.
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26581402

http://stackoverflow.com/a/26660213
answers question: http://stackoverflow.com/q/26652446
score: 0
has body: The call you're making is a Vault call. Vault is a means of storing card data with PayPal, but it does not assign that card to a given PayPal account.
type: Answer

jframe
tags question: http://stackoverflow.com/q/26572748
tags question: http://stackoverflow.com/q/26671319
tags question: http://stackoverflow.com/q/26520564
tags question: http://stackoverflow.com/q/26623773
tags question: http://stackoverflow.com/q/26513908
tag name: jframe
tags question: http://stackoverflow.com/q/26669498
tags question: http://stackoverflow.com/q/26581332
tags question: http://stackoverflow.com/q/26586904
tags question: http://stackoverflow.com/q/26616529
tags question: http://stackoverflow.com/q/26661152
tags question: http://stackoverflow.com/q/26662698
tags question: http://stackoverflow.com/q/26528850
tags question: http://stackoverflow.com/q/26639598
tags question: http://stackoverflow.com/q/26616026
tags question: http://stackoverflow.com/q/26600901
tags question: http://stackoverflow.com/q/26521718
tags question: http://stackoverflow.com/q/26620853
tags question: http://stackoverflow.com/q/26658611
tags question: http://stackoverflow.com/q/26584579
tags question: http://stackoverflow.com/q/26592643
tags question: http://stackoverflow.com/q/26541463
tags question: http://stackoverflow.com/q/26574496
tags question: http://stackoverflow.com/q/26599794
tags question: http://stackoverflow.com/q/26633876
tags question: http://stackoverflow.com/q/26524756
tags question: http://stackoverflow.com/q/26559777
tags question: http://stackoverflow.com/q/26534927
tags question: http://stackoverflow.com/q/26625985
type: Tag
tags question: http://stackoverflow.com/q/26543498
tags question: http://stackoverflow.com/q/26521846
tags question: http://stackoverflow.com/q/26586845

http://stackoverflow.com/a/26616225
has body: See if either of these work: getResource("/media/1414459175_Save.png") or Toolkit.getDefaultToolkit().getImage("media/1414459175_Save.png") (notice one with and one without a prefixed slash)
type: Answer
answers question: http://stackoverflow.com/q/26615527
score: 0

http://stackoverflow.com/q/26662309
type: AnsweredQuestion
has title: Mockito - Desired returned mock object not being used in class-under-test (CUT)
score: 0
accepted answer: http://stackoverflow.com/a/26663880
has body: I'm trying to get a handle on Mockito and have a situation where I'd like to use a mock object from within the class-under-test (CUT) but it does not appear to be working. I'm pretty sure I'm approaching the solution incorrectly. Here's some code: CUT: public class TestClassFacade { // injected via Spring private InterfaceBP bpService; public void setBpService(InterfaceBP bpService) { this.bpService = bpService; } public TestVO getTestData(String testString) throws Exception { bpService = BPFactory.getSpecificBP(); BPRequestVO bpRequestVO = new BPRequestVO(); InterfaceBPServiceResponse serviceResponse = bpService.getProduct(bpRequestVO); if (serviceResponse.getMessage().equalsIgnoreCase("BOB")) { throw new Exception(); } else { TestVO testVO = new TestVO(); } return testVO; } } Spring Configuration: &lt;bean id="testClass" class="com.foo.TestClassFacade"&gt; &lt;property name="bpService" ref="bpService" /&gt; &lt;/bean&gt; &lt;bean id="bpService" class="class.cloud.BPService" /&gt; Mockito Test Method: @RunWith(MockitoJUnitRunner.class) public class BaseTest { @Mock BPService mockBPService; @InjectMocks TestClassFacade mockTestClassFacade; String testString = "ThisIsATestString"; BPRequestVO someBPRequestVO = new BPRequestVO(); InterfaceBPServiceResponse invalidServiceResponse = new BPServiceResponse(); @Test (expected = Exception.class) public void getBPData_bobStatusCode_shouldThrowException() throws Exception { invalidServiceResponse.setMessage("BOB"); when(mockBPService.getProduct(someBPRequestVO)).thenReturn(invalidServiceResponse); mockTestClassFacade.getTestData(testString); verify(mockBPService.getProduct(someBPRequestVO)); } } What I'm trying to do is verify that the "if" conditional portion of the CUT (throwing the Exception) is being invoked in the case of a "BOB" message string being returned from the response of the 3rd party class (BPService). However, what's happening is that the "invalidResponse" object that I am trying to return in the "when" statem…
type: Question
tagged with: dependency-injection
tagged with: java
answer count: 2
tagged with: mockito
tagged with: junit
possible better answer: http://stackoverflow.com/a/26678559
has answer: http://stackoverflow.com/a/26678559
has answer: http://stackoverflow.com/a/26663880

http://stackoverflow.com/comment/41926478
comment on: http://stackoverflow.com/q/26659457
score: 0
type: Comment
type: QuestionComment
has text: Seems that just the output is being reordered. Are the log messages written to stdout or stderr?

http://stackoverflow.com/q/26524003
has body: I have a Fragment that implemets RecyclerView.OnItemTouchListener. How do I pass click and long-click motion events only from the RecyclerView to the GestureDetectorCompat. That is I mean I only want to handle clicks and long-clicks, rest of the events should be handled by the RecyclerView as it would happen normally. How can I set this up? public class MyFragment extends Fragment implements RecyclerView.OnItemTouchListener, GestureDetector.OnGestureListener { protected RecyclerView recyclerView; protected RecyclerView.Adapter adapter; protected LinearLayoutManager layoutManager; private GestureDetectorCompat detector; public MyFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.myfrag, container, false); recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); layoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutManager); recyclerView.addOnItemTouchListener(this); adapter = new MyAdapter(myData)); recyclerView.setAdapter(adapter); return rootView; } @Override public boolean onDown(MotionEvent e) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return false; } @Override public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent event) { return false; } @Override public void onTouchEvent(RecyclerView recyclerView, MotionEvent event) { } }
type: AnsweredQuestion
tagged with: java
tagged with: gesture
has title: Passing MotionEvents from RecyclerView.OnItemTouchListener to GestureDetectorCompat
accepted answer: http://stackoverflow.com/a/26529756
type: Question
upvote count: 4
downvote count: 0
score: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/28630036
has answer: http://stackoverflow.com/a/28630036
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26529756
tagged with: android-recyclerview

http://stackoverflow.com/a/26533059
accepted answer of: http://stackoverflow.com/q/26531115
has body: 1) Let HeartlessAdapter extend ArrayAdapter&lt;Integer&gt; instead of ArrayAdapter&lt;String&gt;. 2) on your constructor, call super(c, R.layout.imageview, imgs); It should work like that. 3) If you wanna optimize it a lot, remove the references to Context and the array of images from the adapter. You can get any item you need calling getItem(position) and the Context by calling getContext(). EDIT: In order for it to work, call this: super(c, R.layout.imageview, HeartlessAdapter.toIntegerArray(imgs)); and add this method to HeartlessAdapter: private static Integer[] toIntegerArray(int[] array){ Integer[] finalArray = new Integer[array.length]; for (int i=0; i&lt;array.length; i++){ finalArray[i] = array[i]; } return finalArray; }
type: Answer
has comment: http://stackoverflow.com/comment/41824199
answers question: http://stackoverflow.com/q/26531115
has comment: http://stackoverflow.com/comment/41692326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41693573
score: 0

http://stackoverflow.com/comment/127989586
type: Comment
comment on: http://stackoverflow.com/a/26563519
type: AnswerComment
score: 0
has text: But which is the best practice?..

http://stackoverflow.com/comment/41804508
has text: "The word, zatabracabrac, is not square free, since it has subword, abrac twice starting at position 4 of the word." That was my mistake, I forgot that bit.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26594837

http://stackoverflow.com/comment/41697733
score: 0
type: Comment
type: QuestionComment
has text: thank you to the two of you who have helped so far. both posts were very helpful and easy to understand. i was having trouble figuring out how to randomly choose a line from the files
comment on: http://stackoverflow.com/q/26535384

http://stackoverflow.com/q/26525232
tagged with: arrays
has answer: http://stackoverflow.com/a/26525260
tagged with: class
score: 0
answer count: 2
tagged with: initialization
favorite count: 0
has title: Java; I initialize an array in a constructor but it only gives me back zero values, why?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41678100
has body: I initialize an array in a constructor but it only gives me back zero values, why? I am writing this in processing 2 thought, but I don't think it has anything to do with the problem. Also, what is the syntax to initialize this outside the constructor? (when the object is created) Sorry if am unclear about my problem. class ArrayInClass { String test; private int[] data = new int[3]; // --- ArrayInClass(String TempTest) { test = TempTest; } // --- public ArrayInClass() { data = new int[] { 10, 20, 25 }; } } ArrayInClass InsTArrayInClass = new ArrayInClass ("TEST" ); println( InsTArrayInClass.test); println( InsTArrayInClass.data[0] + " " + InsTArrayInClass.data[1]);
has answer: http://stackoverflow.com/a/26525266
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/26626190
downvote count: 0
has body: You forgot to tell the JFrame that it should be listening for keys with this line of code:addKeyListener(this);
has comment: http://stackoverflow.com/comment/41862243
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41862013
accepted answer of: http://stackoverflow.com/q/26625985
score: 1
answers question: http://stackoverflow.com/q/26625985
type: AcceptedAnswer

http://stackoverflow.com/q/26628033
accepted answer: http://stackoverflow.com/a/26628192
has title: Add click event to JButton in gridlayout - JAVA
answer count: 5
has body: UPDATE: Thanks to some helpful people, the solution has been found. I am now creating the buttons like below, and adding the event: for(String s: new String[]{"7", "8", "9", "4", "5", "6", "1", "2","3", "0", ".", "=" }) {// change here, as per your need JButton btn = new JButton(s); numButtonPanel.add(btn); btn.addActionListener(new EventListener()); } NOTE: EventListener is a class that was created (scroll down to the answers and you can see the class there) I am creating a calculator using the JAVA Swing libraries, I currently have numerical buttons inside a gridlayout. My question is, given the below code, how would I add click events to my JButtons? Example of my JButtons: numButtonPanel.add(new JButton("8")); numButtonPanel.add(new JButton("9")); numButtonPanel.add(new JButton("4")); numButtonPanel.add(new JButton("5")); numButtonPanel.add(new JButton("6")); As you can see, I am creating them within the gridlayout...I am not just adding already created JButtons. If anyone could help, that would be great! Thanks!
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41865275
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26628079
tagged with: java
has answer: http://stackoverflow.com/a/26628192
has answer: http://stackoverflow.com/a/26628357
has answer: http://stackoverflow.com/a/26628245
has answer: http://stackoverflow.com/a/26628172
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26628245

aop
tags question: http://stackoverflow.com/q/26659907
tags question: http://stackoverflow.com/q/26611349
tags question: http://stackoverflow.com/q/26644913
tag name: aop
tags question: http://stackoverflow.com/q/26569504
tags question: http://stackoverflow.com/q/26635224
type: Tag

http://stackoverflow.com/comment/41891476
comment on: http://stackoverflow.com/q/26642153
type: Comment
type: QuestionComment
score: 1
has text: This sounds very much like a JIT bug. I would run with JIT debugging turned on and see whether there's any pattern there.

http://stackoverflow.com/comment/41906280
type: AnswerComment
comment on: http://stackoverflow.com/a/26649183
type: Comment
has text: @MarkoTopolnik Just checked the reference - what I had in mind was findAny(), though anyMatch() would also work.
score: 1

http://stackoverflow.com/comment/41767459
type: Comment
comment on: http://stackoverflow.com/a/26563752
score: 0
type: AnswerComment
has text: It's never correct to initialize fields marked with @FXML

http://stackoverflow.com/comment/41858469
type: Comment
comment on: http://stackoverflow.com/a/26621653
score: 0
type: AnswerComment
has text: As I said, you can find the window that last had focus (triggered the button), but beyond that, there's not much else you can detect. You might be able to use something like [this](http://stackoverflow.com/questions/1354254/get-current-active-windows-title-in-java), but it is probably equating to the same thing.

http://stackoverflow.com/comment/41943798
type: AnswerComment
has text: Is there a relation between two entities? Could you post entities in your question? If there is a relation (and there could be, based on `advert_property.advert_id`), and `Advert` has a relation like `AdvertProperty property;`, this query would work.
comment on: http://stackoverflow.com/a/26671695
type: Comment
score: 0

http://stackoverflow.com/q/26557090
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41735684
has comment: http://stackoverflow.com/comment/41735771
score: 0
has comment: http://stackoverflow.com/comment/41735873
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/41735665
tagged with: proguard
has title: ProGuard obfuscation leads to ClassNotFoundException
has comment: http://stackoverflow.com/comment/41736863
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26564790
has comment: http://stackoverflow.com/comment/41735662
has answer: http://stackoverflow.com/a/26557249
tagged with: java
has body: I try to obfuscate my code by ProGuard, but when I do that, it does not even find the initial Activity defined in AndroidManifest anymore (ClassNotFoundException). This is how the Activity looks: public class LoadingActivity extends Activity { private static final String TAG = LoadingActivity.class.getSimpleName(); private int effectiveWidth; private int effectiveHeight; private AsyncTask&lt;Void, Void, Void&gt; bitmapLoaderTask; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loading); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); initSpecs(); } @Override protected void onPause() { super.onPause(); if (bitmapLoaderTask != null) { bitmapLoaderTask.cancel(true); } } @Override protected void onStart() { super.onStart(); if (ResizedBitmapMapping.isStillHoldingAllImages()) { Logger.log(TAG, "ResizedBitmapMapping still contains all images, skip loading...", LogController.isLoggingEnabled(), Log.DEBUG); startMenu(); } else { bitmapLoaderTask = new BitmapLoaderTask(getResources(), effectiveWidth, effectiveHeight, this); bitmapLoaderTask.execute(); } } @SuppressWarnings("deprecation") private void initSpecs() { PackageNameHolder.setPackageName(getPackageName()); WindowManager windowManager = (WindowManager)this.getSystemService(Context.WINDOW_SERVICE); Point size = new Point(); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB_MR2) { windowManager.getDefaultDisplay().getSize(size); effectiveWidth = size.x; effectiveHeight = size.y; } else { Display display = windowManager.getDefaultDisplay(); effectiveWidth = display.getWidth(); effectiveHeight = display.getHeight(); } } public void startMenu() { final Intent gameIntent = new Intent(this, MenuActivity.class); startActivity(gameIntent); overridePendingTransition(0, 0); } public void cancel() { finish(); } } My proguard.cfg looks like this: -dontoptimize -dontshrink -verbose -keep class com.chartboost.** { *; …

http://stackoverflow.com/a/55144262
score: 0
answers question: http://stackoverflow.com/q/26561511
has body: Since I am opening the same activity under test in many test cases executed one after another and same IntentsTestRule class activity I could resolve the issue in my case by calling finishActivity on activityTestRule class and intentTestRule class eg: @After fun method() { mainActivityTestRule.finishActivity() mIntentsRule.finishActivity() }
type: Answer

http://stackoverflow.com/q/26586135
tagged with: java
possible better answer: http://stackoverflow.com/a/26586230
has answer: http://stackoverflow.com/a/26586230
has title: Time Format error
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26586175
has body: 10-27 06:58:39.781: java.text.ParseException: Unparseable date: "" at offset 0 (at offset 0) I am getting this exception at runtime.I am not sure about the timing format.But I am expected the timing like this 12:23am. Time.java: private void setTime(int iETextID) { try { etTimePicker = (EditText) findViewById(iETextID); String strTime = etTimePicker.getText().toString(); final Calendar mcurrentTime = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("hh:mm aa", Locale.getDefault()); mcurrentTime.setTime(formatter.parse(strTime));
tagged with: android
has comment: http://stackoverflow.com/comment/41787455
score: -2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41787553
downvote count: 2
accepted answer: http://stackoverflow.com/a/26586175
type: Question
has comment: http://stackoverflow.com/comment/41787649

http://stackoverflow.com/comment/41758047
type: AnswerComment
has text: @user2898147 you're welcome! Also note that you have to _declare_ your resource inside the try-with-resources statement; that is, you cannot do `Closeable c; try ( c = something() ) { ... }`
type: Comment
comment on: http://stackoverflow.com/a/26569460
score: 0

http://stackoverflow.com/a/26536158
downvote count: 0
has body: It depends on the country your in and locale you use. In US I get the same error if I use comma instead of dot. You may have to use "comma" or set the locale properly. See below decimal seperator by country. http://en.wikipedia.org/wiki/Decimal_mark
type: Answer
answers question: http://stackoverflow.com/q/26535932
score: 3
upvote count: 3

http://stackoverflow.com/comment/41887417
comment on: http://stackoverflow.com/a/26639843
has text: No, Your Original Code Just initialize an array object of type Classroom. Each element of this array is a reference to a Classroom object.you must have to create Classroom object i.e. new Classroom() , and assign a reference for these objects to each element of the array. if you skip it you'll get NullPointerException when calling any method of Classroom class using these references.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26530915
possible better answer: http://stackoverflow.com/a/26531038
tagged with: sorting
has answer: http://stackoverflow.com/a/26531038
answer count: 5
has comment: http://stackoverflow.com/comment/41688409
has answer: http://stackoverflow.com/a/26531084
has answer: http://stackoverflow.com/a/26531019
type: AnsweredQuestion
type: Question
has title: Java, sorting ArrayList using comparator
has comment: http://stackoverflow.com/comment/41688350
has answer: http://stackoverflow.com/a/26531079
tagged with: java
has comment: http://stackoverflow.com/comment/41688477
accepted answer: http://stackoverflow.com/a/26531019
has answer: http://stackoverflow.com/a/26531320
has body: I want to sort my list of Task object by two criterion. First it is sorted by leftEntryTime and then by timeNeededToBeProcessed. Can someone help me? So far I did sorting by leftEntryTime but how I can sort it by timeNeededToBeProcessed in the same Comparator class? Task(int procesID, int neededTime, int waitingTime, int leftEntryTime) { this.procesID = procesID; this.timeNeededToBeProcessed = neededTime; this.waitingTime = waitingTime; this.leftEntryTime = leftEntryTime; } This is my Comparator: import java.util.Comparator; public class TimeEntryComparator implements Comparator&lt;Task&gt; { @Override public int compare(Task o1, Task o2) { int entryTime; int taskTime = o1.getLeftEntryTime()- o2.getLeftEntryTime(); if (taskTime &gt; 0){ return 1; } if (taskTime &lt; 0) { return -1; } return 0; } } then I sort it by: Collections.sort(list, new TimeEntryComparator());
score: 0
tagged with: comparator

http://stackoverflow.com/comment/41721850
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26549702
has text: Ok, so what is your question?

http://stackoverflow.com/a/26598284
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26598155
has body: Instead of a array you can use a list. Than you don't have to set a size. ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); String[] array = new String[4] int counter = 0; String query = String.format("SELECT * FROM notes"); Cursor cursor = db.getReadableDatabase().rawQuery(query, null); while (cursor.moveToNext()) { String note = cursor.getString(1); list.add(note); if(counter &lt; array.length){ array[counter] = note; counter++; } } Now I put both solution in the code. You have also to decide which row it is.
downvote count: 0
score: 1

http://stackoverflow.com/comment/41887911
comment on: http://stackoverflow.com/a/26639749
has text: I don't think this is exactly what I asked for! But thanks for trying! :D
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/29415905
type: Answer
answers question: http://stackoverflow.com/q/26672519
has body: This issue was resolved by setting DB2XADataSource's supportsAsynchronousXARollback flag to true. final DB2XADataSource dataSource = new DB2XADataSource(); dataSource.setsupportsAsynchronousXARollback(DB2BaseDataSource.YES); ... ... Hope this helps others too.
score: 0

http://stackoverflow.com/a/26540907
answers question: http://stackoverflow.com/q/26540890
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41706679
type: Answer
score: 3
downvote count: 0
has body: Avoid using null layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify See Why is it frowned upon to use a null layout in SWING? for more details... You have two basic mistakes... You've decided to use a null layout, but neglected to set the size of the JScrollPane You set the JTextPane as the view for the JScrollPane but then add it to the container, along with the JScrollPane. A component can only belong to a single container, by adding it a second time, you've removed it from the JScrollPane See How to Use Scroll Panes for more details
has comment: http://stackoverflow.com/comment/41706696
accepted answer of: http://stackoverflow.com/q/26540890
upvote count: 3

http://stackoverflow.com/q/26540356
has title: What is the output created when constructing an instance of an object
has answer: http://stackoverflow.com/a/26540527
has body: Suppose the following code runs without error: And suppose that in some other class we have a main method: A var1 = new C(); I was given these two questions which I answered wrong: 1) What output will be created by constructing that instance of C? My answer to this was some, and I thought it was this because it says new C();, so it creates a new C object and in the constructor in that class it prints some. But I was wrong, the correct answer was one here some. This doesn't make sense to me, and I don't really know how that was possible. 2) which method is called if the method call ((B) var1).report() is used. My answer to this was the method report in the B class. I thought this was the correct answer because var1 is casted with B so I assumed that it will use the method in the B class. But I was wrong for this as well. The correct answer was the method in the C class. This doesn't make sense to me either. This was very confusing and I don't really know how to get those answers. If someone could explain to me what exactly is happening and how they got that answer that would be really appreciated.
downvote count: 0
has answer: http://stackoverflow.com/a/26540599
answer count: 3
possible better answer: http://stackoverflow.com/a/26540599
favorite count: 0
accepted answer: http://stackoverflow.com/a/26540527
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26540530
has comment: http://stackoverflow.com/comment/41705635
type: Question

http://stackoverflow.com/a/36712346
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26524010
has body: AFAIKT, the intellij terminal on linux is just the same as running a standalone terminal session. It's just conveniently located in the IDE. In response to the question, "How do I change [the terminal environment variables]?" I'm using virtualenvwrapper to manage my terminal's environment variables for different environments, such as dev, test and production. It's working just as well for java development as it was for python development. https://virtualenvwrapper.readthedocs.org

http://stackoverflow.com/q/26598869
type: Question
has comment: http://stackoverflow.com/comment/41812347
tagged with: object
has body: I need to convert an Array List to Object[][], I have tried several different methods, and all seem to toss up an error or two. My latest try is this: Object[][] array = dataList.toArray(new Object[dataList.size()][]); This throws the following error: java.lang.ArrayStoreException at java.lang.System.arraycopy(Native Method) at java.util.ArrayList.toArray(Unknown Source) My array list is populated with classes I made, this is the class: class dataClass { int x; int y; int z; String string1; String string2; Date date; int event; public dataClass(int x, int y, int z, String string1, String string2, Date date, int event) { this.x = x; this.y = y; this.z = z; this.string1 = string1; this.string2 = string2; this.date = date; this.event = event; } } This is how I initialize my array list: public static List&lt;dataClass&gt; dataList = new ArrayList&lt;dataClass&gt;(); I then add my new dataClass via: .add(new dataClass(...)); Any help would be great, thanks.
has comment: http://stackoverflow.com/comment/41812360
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26599088
has comment: http://stackoverflow.com/comment/41812106
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/26599012
answer count: 2
has title: ArrayList to Object[][]
has answer: http://stackoverflow.com/a/26599012
has comment: http://stackoverflow.com/comment/41812194
has comment: http://stackoverflow.com/comment/41812292
has comment: http://stackoverflow.com/comment/41812492
favorite count: 0
has comment: http://stackoverflow.com/comment/41812101
has comment: http://stackoverflow.com/comment/41813102
has comment: http://stackoverflow.com/comment/41812122
has answer: http://stackoverflow.com/a/26599088
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/41770544
type: QuestionComment
comment on: http://stackoverflow.com/q/26575676
has text: Can you turn the logging level up to DEBUG and post the ouput of the logs when you post the specified JSON to the controller?
score: 0
type: Comment

http://stackoverflow.com/q/26591991
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: Which the cost of performance to use an interceptor in the java application (Only the cost for the intercept method, excluding processing within the interceptor)?
has comment: http://stackoverflow.com/comment/41949699
has title: Which the cost of performance to use an interceptor in the java application?
tagged with: ejb-3.1
type: Question
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/41798823
favorite count: 0
tagged with: interceptor
score: 2

http://stackoverflow.com/comment/61195520
comment on: http://stackoverflow.com/a/26685564
type: Comment
has text: Considering for more than a year now, the Selenium folks have not maintained the Safari Driver, it might not come from them... sigh.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41845633
comment on: http://stackoverflow.com/q/26617160
type: QuestionComment
type: Comment
has text: map is just key value pairs.HashMap<Integer, String, LatLng, Marker> makes very little sense
score: 0

http://stackoverflow.com/comment/41766257
type: Comment
comment on: http://stackoverflow.com/q/26574284
score: 0
type: QuestionComment
has text: _have a simple login .jsp page which calls a method which returns a html form_ how do you do that ??show us some code ??

http://stackoverflow.com/q/26627978
favorite count: 0
has answer: http://stackoverflow.com/a/26628087
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26628114
type: Question
possible better answer: http://stackoverflow.com/a/26628132
has body: In my application i receive a String like this: String1 = "[6, I.3, Contaminación Mecánica, 0.0, 0.0, 0.0, 196.875, 0.0, 196.875]"; String2 = "[16, E.19, Errores de los usuarios, 0.0, 0.0, 3281.25, 0.0, 0.0, 3281.25]"; From this strings i need only the first value (from String1 and String2). This is solved, with this code where you get the first two digits: String Amenaza = InformeAmenazasAGR.get(i).toString(); Amenaza = Amenaza.substring(1,3); Amenaza = Amenaza.replace(",",""); Now i can receive this string too String3 = "[39854, R.01, Robo Outdoor, 0.0, 84000.0, 24500.0, 24500.0, 0.0, 133000.0]"; I tried to use String Amenaza = InformeAmenazasAGR.get(i).toString(); Amenaza = Amenaza.substring(1,6); Amenaza = Amenaza.replace(",",""); but when the first value only has 1 digit, obtains chars of the second value and this code can has more than 5 digits. How i can obtain only the first value if has a random number of digits?. Thank you in advance.
has answer: http://stackoverflow.com/a/26628132
tagged with: substring
has title: Get from String the first value with random digits
upvote count: 2
tagged with: replace
has answer: http://stackoverflow.com/a/26628134
accepted answer: http://stackoverflow.com/a/26628087
tagged with: string

http://stackoverflow.com/comment/41715733
has text: What do you mean fire `ESC`, do you want to cancel editing?
score: 1
comment on: http://stackoverflow.com/q/26546271
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41739826
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26559180
type: QuestionComment
has text: Share a few example data for clarity(they are json I guess), and what's your plan. Otherwise you'll get only opinion based answers if any.

http://stackoverflow.com/comment/41886313
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26632799
has text: In some circumstances the space in the automatic stack frame will be allocated. But the cost to allocate 4-8 bytes of stack frame space is vanishingly small.
score: 0

http://stackoverflow.com/comment/41799966
type: Comment
type: QuestionComment
has text: which line is line 19?
comment on: http://stackoverflow.com/q/26592553
score: 0

http://stackoverflow.com/a/26534230
has body: Change file[i+1]="EoA"; to file[i]="EoA"; Otherwise, you'll have a null entry in the position that precedes the "EoA" entry, which causes the NullPointerException. Of course, you can get rid of the "EoA" entry, and just change the loop's condition to : while (file[i] != null) That's much more readable. One last thing, how do you guarantee that your input won't be larger than the 500 length of your array?
has comment: http://stackoverflow.com/comment/41694622
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26534173
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26534173
has comment: http://stackoverflow.com/comment/41694874
score: 2

http://stackoverflow.com/comment/41797474
type: Comment
has text: Be aware this can only work if you have a single server. Finding a DB solution is probably best. Note that with the right isolation levels, if you do a read of the row, then that will lock it for read for the duration of the transaction, and you can update it later. Alternatively, you can select-for-update to read with write intent.
comment on: http://stackoverflow.com/a/26586433
type: AnswerComment
score: 3

http://stackoverflow.com/q/26569638
answer count: 2
has title: Drawing fully transparent "white" in Java BufferedImage
downvote count: 0
has answer: http://stackoverflow.com/a/26570426
favorite count: 0
accepted answer: http://stackoverflow.com/a/26570426
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26571599
upvote count: 3
has answer: http://stackoverflow.com/a/26571599
tagged with: java
has body: This might sound like a bit of strange title, but bear with me, there is a reason: I am trying to generate a white glow around a text on a gray background. To generate the glow, I created a new BufferedImage that's bigger than the text, then I drew the text in white onto the canvas of the image and ran a Gaussian Blur over the image via a ConvolveOp, hoping for something like this: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; At first I was a bit surprised when the glow turned out darker than the gray background of the text: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; But after a bit of thinking, I understood the problem: The convolution operates on each color channel (R, G, B, and A) independently to calculate the blurred image. The transparent background of the picture has color value 0x00000000, i.e. a fully transparent black! So, when the convolution filter runs over the image, it not only blends the alpha value, but also mixes the black into the RGB values of the white pixels. This is why the glow comes out dark. To fix this, I need to initialize the image to 0x00FFFFFF, i.e. a fully transparent white instead, but if I just set that color and fill a rectangle with it, it simply does nothing as Java says "well, it's a fully transparent rectangle that you're drawing! That's not going…
type: Question
linked to: http://stackoverflow.com/q/26575187
tagged with: graphics
score: 3
has comment: http://stackoverflow.com/comment/41760864

http://stackoverflow.com/q/26592009
accepted answer: http://stackoverflow.com/a/26592059
type: AnsweredQuestion
downvote count: 0
tagged with: string
favorite count: 0
type: Question
score: 3
tagged with: regex
has answer: http://stackoverflow.com/a/26592059
upvote count: 3
answer count: 1
has body: i want to ignore the . in quotation marks. what the regex should i use? example sentences : String sentence = "i love you. \"i'm sorry. but love someone else,\" he said to me. "; there are three . but i want to ignore the . in quotation marks in order to the sum of sentence is two. my code and some regex that i have : public static String[] ignoreWord(String word){ String [] arrWords = word.replaceAll(", *| , *|- *| - *|\\( *| \\( *|\\) *|\\{ *| \\} *| \\} *| \\{*|\\} *", " ").split("\\. "); return arrWords; }
tagged with: java
has title: how to ignore the "dots" in quotation marks

http://stackoverflow.com/a/26584449
has comment: http://stackoverflow.com/comment/41784576
score: 8
has comment: http://stackoverflow.com/comment/41784667
type: Answer
has comment: http://stackoverflow.com/comment/41784776
has comment: http://stackoverflow.com/comment/41784617
downvote count: 0
has comment: http://stackoverflow.com/comment/41784653
has comment: http://stackoverflow.com/comment/41784677
has comment: http://stackoverflow.com/comment/41784710
has comment: http://stackoverflow.com/comment/41784554
upvote count: 8
answers question: http://stackoverflow.com/q/26584426
has comment: http://stackoverflow.com/comment/41784913
has comment: http://stackoverflow.com/comment/41784801
has comment: http://stackoverflow.com/comment/41784656
has comment: http://stackoverflow.com/comment/41784939
has body: You are attempting to throw a null object, which fails, and causes a NullPointerException to be thrown instead. You should throw an exception with throw new Exception (); Just to clarify. In case you were asking why your second example doesn't compile, while the fourth example does : Error and its sub-classes are unchecked exceptions, which doesn't have to be caught or declared in a throws clause. The unchecked exception classes are the run-time exception classes and the error classes. (JLS 11.1.1.) That's why you can throw an Error and catch an Exception, and the code will compile. On the other hand, in your second example, you are trying to throw a checked exception (Exception) and catch a NullPointerException, which is not a super-class of Exception. That's why the code won't compile unless you catch Exception or declare that your main method throws Exception.
has comment: http://stackoverflow.com/comment/41784825

http://stackoverflow.com/comment/41902327
comment on: http://stackoverflow.com/a/26648913
type: Comment
has text: Thank you @J.Lucky, I know the above solution but i want that object to set it in my object. Please look at code once again
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41736382
comment on: http://stackoverflow.com/a/26557042
has text: I do not think the referenced document sections are addressing my question.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41776276
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26579411
has text: This is exactly the scenario where you want to use type-safe enums. They would have prevented this error.

http://stackoverflow.com/comment/115876810
type: AnswerComment
comment on: http://stackoverflow.com/a/26607059
type: Comment
has text: What if I'm not using Hibernate?
score: 0

http://stackoverflow.com/comment/41703488
type: Comment
has text: Java actually infers the supertype `Serializable & Comparable<? extends Serializable & Comparable<? extends Comparable<?>>>` in this case.
score: 1
comment on: http://stackoverflow.com/a/26539101
type: AnswerComment

http://stackoverflow.com/comment/41877680
type: AnswerComment
score: 0
has text: Weird, this bug seems to be fixed since a long time : https://bugs.eclipse.org/bugs/show_bug.cgi?id=166113 Maybe it's only fixed in stack trace, not in logging entries
type: Comment
comment on: http://stackoverflow.com/a/26615827

http://stackoverflow.com/comment/41801299
has text: You have to add it to the panel. What you have now is only creating the JTextArea along with some setters.
comment on: http://stackoverflow.com/q/26593176
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26632994
has comment: http://stackoverflow.com/comment/133594429
upvote count: 1
has comment: http://stackoverflow.com/comment/41878371
has body: The MongoItemReader utilizes paging as a mechanism for returning data instead of a cursor. Since there is no cursor of the full dataset, using MongoDB's cursor#skip and cursor#limit are not an option. To get what you'd want to do, you'd have to implement your own MongoItemReader. That being said, we would appreciate a contribution if you feel it's useful for others!
has comment: http://stackoverflow.com/comment/74647875
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26627332
type: Answer
accepted answer of: http://stackoverflow.com/q/26627332
has comment: http://stackoverflow.com/comment/133708824

http://stackoverflow.com/q/26608159
has body: I'm having hibernate3.jar and hibernate-core-4.2.0.CR1.jar in my classpath and I'm using Spring 3.1.3 version. Code got compiles sucessfully but while runtime I'm getting following error 2014-10-28 10:51:25,174 DEBUG [RMI TCP Connection(2)-10.126.30.203] - Target method failed for RemoteInvocation: method name 'getPriceByKeys'; parameter types [java.util.List, java.util.Date] java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session; I google it but not find any solution. Please note : My project needs hibernate3.jar but at the same time my project dependent on some other 3rd party jar which inturn using hibernet4.2.0 jar. Any help Pls ??
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26608933
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26705685
type: Question
has title: NoSuchMethodError: org.hibernate.SessionFactory.openSession()
score: 1
tagged with: java
tagged with: hibernate
answer count: 2

http://stackoverflow.com/comment/41972645
comment on: http://stackoverflow.com/a/26660960
type: AnswerComment
score: 0
type: Comment
has text: to iterate through all elements use: `for (int i = 0; i < list.length; i++) System.out.println(list[0]); // Or whatever` You can also use: `for (int i : list) System.out.println(i);`

http://stackoverflow.com/a/26566596
has body: I don't know where infos is initialized, but based on the exception (java.lang.ArrayIndexOutOfBoundsException: length=6; index=6), it has a length of 6, and therefore infos[6] is out of the array bounds.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26566567
has comment: http://stackoverflow.com/comment/41752269
has comment: http://stackoverflow.com/comment/41774758
downvote count: 0
score: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41769445
answers question: http://stackoverflow.com/q/26566567

http://stackoverflow.com/comment/41883617
score: 0
type: Comment
has text: tree.getLeadSelectionPath().getLastPathComponent();
comment on: http://stackoverflow.com/a/26637680
type: AnswerComment

spring-security
tags question: http://stackoverflow.com/q/26554673
tags question: http://stackoverflow.com/q/26535511
tags question: http://stackoverflow.com/q/26667646
tags question: http://stackoverflow.com/q/26558427
tags question: http://stackoverflow.com/q/26642493
tags question: http://stackoverflow.com/q/26540524
tags question: http://stackoverflow.com/q/26531280
type: Tag
tags question: http://stackoverflow.com/q/26627295
tags question: http://stackoverflow.com/q/26548138
tags question: http://stackoverflow.com/q/26635728
tags question: http://stackoverflow.com/q/26613865
tags question: http://stackoverflow.com/q/26537239
tags question: http://stackoverflow.com/q/26630095
tags question: http://stackoverflow.com/q/26583713
tags question: http://stackoverflow.com/q/26556081
tags question: http://stackoverflow.com/q/26572256
tags question: http://stackoverflow.com/q/26589484
tags question: http://stackoverflow.com/q/26578581
tags question: http://stackoverflow.com/q/26587641
tags question: http://stackoverflow.com/q/26545343
tags question: http://stackoverflow.com/q/26526830
tags question: http://stackoverflow.com/q/26561676
tags question: http://stackoverflow.com/q/26608383
tags question: http://stackoverflow.com/q/26637789
tags question: http://stackoverflow.com/q/26554664
tags question: http://stackoverflow.com/q/26621693
tags question: http://stackoverflow.com/q/26635918
tag name: spring-security
tags question: http://stackoverflow.com/q/26590669
tags question: http://stackoverflow.com/q/26604841

http://stackoverflow.com/comment/41923526
has text: no, change it from 2.1 to the latest you have. It will still run on 2.1 as you have the v7-appcompact
score: 0
comment on: http://stackoverflow.com/q/26660645
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41921184
comment on: http://stackoverflow.com/a/26658991
score: 0
type: AnswerComment
has text: @nhahtdh you've got a point with that example. Maybe I rushed on marking this answer as solving the issue. I hope this doesn't discourage you and the rest of the people to keep on helping to find the exact final solution. I removed that mark just to allow more people to notice the question keeps open. Not that I don't value your great effort, Sly
type: Comment

http://stackoverflow.com/comment/41701507
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26529298
has text: How would I append JAVA_HOME in the batch file? I want to compress this folder and share it with java 8 locally.

http://stackoverflow.com/q/26649389
tagged with: android
tagged with: poodle-attack
tagged with: client
has comment: http://stackoverflow.com/comment/41903218
has answer: http://stackoverflow.com/a/32466614
upvote count: 19
has answer: http://stackoverflow.com/a/40886791
type: UnansweredQuestion
tagged with: httpsurlconnection
score: 19
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/32371903
has answer: http://stackoverflow.com/a/26652981
answer count: 8
has comment: http://stackoverflow.com/comment/41903940
has title: How to disable SSLv3 in android for HttpsUrlConnection?
downvote count: 0
has comment: http://stackoverflow.com/comment/41903628
has answer: http://stackoverflow.com/a/29946540
favorite count: 0
has answer: http://stackoverflow.com/a/29672085
has answer: http://stackoverflow.com/a/34904758
has body: We wrote client application in android which connects with https servers using HttpsUrlConnection apis. Due to Poodle vulnerability, we need to disable SSLv3 from the list of enabled protocols while invoking any request. We followed the guidelines captured by oracle and added following line before invoking url connection java.lang.System.setProperty("https.protocols", "TLSv1"); This solution works fine with normal java program. We got SSLHandShakeException when tried to connect with a server which only works on SSLv3 protocol. But concern is : same fix does not work for android. Am I missing something or should I try another approach for android? Please suggest.
linked to: http://stackoverflow.com/q/32425547
has answer: http://stackoverflow.com/a/45855308

http://stackoverflow.com/comment/44151148
has text: It's in progress... But not without difficulty. As you can see on this ticket : http://stackoverflow.com/questions/27859419/javame-raspberrypi-uart-to-rs485-connection-give-error-daapi-iso-1cannot-o
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27838698

http://stackoverflow.com/q/26660201
upvote count: 0
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/41925225
has comment: http://stackoverflow.com/comment/41930194
answer count: 1
has comment: http://stackoverflow.com/comment/41930299
tagged with: throw
has answer: http://stackoverflow.com/a/26660332
favorite count: 0
has comment: http://stackoverflow.com/comment/41928141
has body: Working on program that calculates the "Volunteer of the Year" by totaling weekly hours from a .txt and then seeing if they are above average volunteer hours that week and awarding points for both. I am throwing an exception with an array being out of bounds and can't figure out why... public class volunteerOfTheYear { //declaring int name for indexing because the name will always be in the first //postion of the array at nameOfArray[i][0] final static int NAME = 0; /** * @param args the command line arguments * @throws java.io.FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException{ //declare file handle File inputText = new File("volunteerFile.txt"); //get Scanner from method Scanner input = getInput(inputText); //convert file to 2-d array String[][] volunteerChart = getvolunteerChart(input); //calculate weekly averages and store in array for comprarison double[] weeklyAverages = new double[53]; int week = 1; do{ weeklyAverages[week] = getAverageWeeklyHours(volunteerChart, week); week++; }while(week &lt; 52); //compare volunteer's volunteer hours to weekly averages and calculate points for week //and total volunter's points int[] totalPoints = new int [25]; totalPoints = getVolunteerPoints(volunteerChart, weeklyAverages, week); //display VOFT } /** * * @param textFile * @return input * @throws java.io.FileNotFoundException */ public static Scanner getInput(File textFile) throws FileNotFoundException{ Scanner input = new Scanner(textFile); return input; } /** * * @param input * @return volunteerNamesAndHours */ public static String[][] getvolunteerChart(Scanner input){ String[][] volunteerNamesAndHours = new String [25][53]; int ID = 0; int week; do{ volunteerNamesAndHours[ID][NAME] = input.next(); for(week = 1; week &lt; 53; week++){ volunteerNamesAndHours[ID][week] = Integer.toString(input.nextInt()); } ID++; } while(ID &lt;= 24); return volunteerNamesAndHours; } /** * * @param volunteerHours * @param week * @return */ public …
type: AnsweredQuestion
has title: Throwing a exception while compiling the program to test as going
tagged with: java
tagged with: indexoutofboundsexception
accepted answer: http://stackoverflow.com/a/26660332
has comment: http://stackoverflow.com/comment/41924551
has comment: http://stackoverflow.com/comment/41926956
downvote count: 1
type: Question

http://stackoverflow.com/q/26598794
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/31060955
type: UnansweredQuestion
tagged with: fitbit
score: 6
upvote count: 6
tagged with: java
type: Question
tagged with: accelerometer
has body: I'm trying to use data from my Fitbit to catch my hand movement. Then I find the Fitbit Api here: https://wiki.fitbit.com/display/API/Fitbit+Resource+Access+API In the collection resources part, it seems that I can only get some data like body measurements, weight, recent activities, friends, etc. So, my question is, does Fitbit provide any API to help me get its realtime accelerometer data and Gyroscope data?
tagged with: api
has title: Can I use Fitbit Api to get the acceleration data of my Fitbit?
tagged with: sensors
answer count: 1

http://stackoverflow.com/a/26577695
answers question: http://stackoverflow.com/q/26577579
type: Answer
score: 1
has body: public static void main(String[] args) { for(int i=0;i&lt;5;i++){ int n = 1 + 2 * (2 - Math.abs(2 - i)); for (int j = 0; j &lt; n; j++) System.out.print("* "); System.out.println(); } }
has comment: http://stackoverflow.com/comment/41777782
has comment: http://stackoverflow.com/comment/41780564
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26514570
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41660390
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26514454
has body: change your the || to &amp;&amp; in your do while condition } while ((j &lt; (dest.size() - 1)) &amp;&amp; !x); If you never find fileDOYint, your loop will continue and continue until you get an out of bounds exception, regardless of what j is.
accepted answer of: http://stackoverflow.com/q/26514454

http://stackoverflow.com/q/26642870
answer count: 2
has answer: http://stackoverflow.com/a/26735008
tagged with: jsp
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26642970
tagged with: model-view-controller
score: 1
tagged with: java
has body: I use Spring MVC &amp; jsp. It's my homeController. return "test String"; @RequestMapping(value="/",method = RequestMethod.GET) public String home(Locale locale,Model model){ model.addAttribute("test","test String"); return "home"; } home.jsp &lt;html&gt;&lt;head&gt; &lt;% String test = ${test} %&gt; &lt;/head&gt; &lt;body&gt; ${test} //it shows "test String" &lt;%=test%&gt; //but it doesn't show anything. error. &lt;/body&gt;&lt;/html&gt; how to use dollar sign in &lt;% %> ?
downvote count: 1
type: Question
tagged with: jstl
has title: How to use dollar sign in jsp

http://stackoverflow.com/comment/41773000
type: QuestionComment
comment on: http://stackoverflow.com/q/26577685
score: 0
has text: @davidp027 this is a perfect time to learn something about regex. Look at some other answers, try some stuff out. You will fail, then fail again then eventually succeed. This is when you learn something. Not to mention this is a very simple regex to write.
type: Comment

http://stackoverflow.com/q/26584249
accepted answer: http://stackoverflow.com/a/26584312
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26584489
has comment: http://stackoverflow.com/comment/41784616
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26584312
has body: I have a jsp page with two textboxes and one submit button. On getting the input value from the form, the value for the second textbox named as "amount" is coming as null. This is my jsp page - <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> CREDIT / DEBIT Funds <% String context_path=request.getContextPath(); String navbar_path=context_path+"/pages/navbar.jsp"; %> <%@include file="../navbar.jsp" %> CREDIT / DEBIT Funds <c:if test="${ accountStatus != null}"> ${accountStatus} </c:if> Credit Debit From/To Amount Submit And this is the formbean from where i am getting the values - public class AccountFormBean { private String amount; private String accountNumber; private String CreditDebit; public void setAccountNumber(String accountNumber){ this.accountNumber = accountNumber; } public String getAccountNumber() { return accountNumber; } public void setbalance(String amount) { this.amount = amount; } public String getbalance() { return amount; } public void setCreditDebit(String CreditDebit) { this.CreditDebit = CreditDebit; } public String getCreditDebit() { return CreditDebit; } } The value for account number is coming fine but it is coming as null for amount.
score: 0
answer count: 2
has title: Value of text field in jsp form is coming as null
tagged with: jsp
possible better answer: http://stackoverflow.com/a/26584489
tagged with: model-view-controller

http://stackoverflow.com/a/26660492
has body: It is because the method enterNumber doesn't have access to the variable phoneBook. You must declare it as an instance variable like this import java.util.HashMap; public class MapTester{ HashMap&lt;String, String&gt; phoneBook = new HashMap&lt;String, String&gt;(); public void main(String args[]){ MapTester tester = new MapTester(); tester.enterNumber("Jenna Simpson", "3424 6785"); } public void enterNumber (String name, String number) { phoneBook.put(name, number); } } Also you have to create an object of the class Maptester. Because you cannot call the method enterNumber from the main method directly unless and otherwise the method is static. And if the method is declared static, then the map should also be a static variable.
has comment: http://stackoverflow.com/comment/44062385
type: Answer
answers question: http://stackoverflow.com/q/26660355
score: 0

http://stackoverflow.com/a/45737198
score: 8
answers question: http://stackoverflow.com/q/26517051
downvote count: 0
upvote count: 8
has body: Nowadays you might want to use: String.join(separator, strings)
type: Answer

http://stackoverflow.com/comment/41870923
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26631419
has text: Where is your StartSearch.class activity?

http://stackoverflow.com/q/26585128
tagged with: swt
tagged with: treeviewer
has title: ViewerFilter on TreeViewer
tagged with: java
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/41786107
type: Question
tagged with: jface
has comment: http://stackoverflow.com/comment/41813255
has body: I have a JFace TreeViewer with four TreeColumn. I added a ViewerFilter class into my Tree and Filter by a search text. The problem is it's only filtering the TreeParent and not working on TreeChildren. For example: A A1 A2 A2.1 A2.2 B C Result for searchtext = "A" is only A without children. Result for searchtext = "A1" is nothing. Result for searchtext = "A2.1" is nothing also. My code: @Override public boolean select(Viewer viewer, Object parentElement, Object element) { boolean result = true; if (text != null &amp;&amp; text.length() &gt; 0) { TreeTableObject object = ((TreeTableObject) element).getChild(); String personText = object.toString().toLowerCase(); System.out.println("Text: " + text.toLowerCase()); System.out.println("Filter text: " + personText); result = personText.indexOf(text.toLowerCase()) != -1; } return result; }
score: 0

http://stackoverflow.com/comment/100226921
type: Comment
has text: This can still be instantiated. Using an enum is ironclad, this is plasticclad.
type: AnswerComment
comment on: http://stackoverflow.com/a/26619453
score: 0

http://stackoverflow.com/a/26660724
has body: You can listen for SWT.Selection for the left click and SWT.MenuDetect for the right click: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); Button bn = new Button(shell, SWT.FLAT); bn.setText("Right Click to see the popup menu"); Menu popupMenu = new Menu(bn); MenuItem newItem = new MenuItem(popupMenu, SWT.CASCADE); newItem.setText("New"); bn.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { System.out.println("click"); } }); bn.addListener(SWT.MenuDetect, new Listener() { @Override public void handleEvent(Event e) { System.out.println("menu"); } }); bn.setMenu(popupMenu); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } That said, for the menu you don't need the SWT.MenuDetect listener. Just calling Button#setMenu(Menu) does the job just fine.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/41949652
downvote count: 0
answers question: http://stackoverflow.com/q/26660447
has comment: http://stackoverflow.com/comment/41943135
has comment: http://stackoverflow.com/comment/41945459
has comment: http://stackoverflow.com/comment/41949610
score: 4
has comment: http://stackoverflow.com/comment/41941018
has comment: http://stackoverflow.com/comment/41939546

http://stackoverflow.com/a/26527414
answers question: http://stackoverflow.com/q/26527369
type: Answer
has body: Every string in the program is given a matching key. If after concatenation you create a string that matches the same string literal that was already present, then they both are equal and pointing to the same value.
score: 0

http://stackoverflow.com/a/26666801
has comment: http://stackoverflow.com/comment/104613001
downvote count: 0
score: 1
has body: Try this: After the list is displayed, hover to the item then click it WebElement listItem = driver.findElement(By.xpath("//div[contains(text(), 'Michael W Baber')]")); Actions action = new Actions(driver); action.build(); action.moveToElement(listItem) .click(); action.perform();
type: Answer
answers question: http://stackoverflow.com/q/26547833
upvote count: 1

http://stackoverflow.com/q/26599497
upvote count: 1
has title: Adding more buttons
tagged with: java
has answer: http://stackoverflow.com/a/26599807
type: Question
answer count: 1
tagged with: button
tagged with: android
score: -1
favorite count: 0
has body: I'm working on a app. Past days i'm trying to get more then one button to work on my page. But i can't figur it out. Can some one help? I'm new to Development :) Layout (xml) Activity_main <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.rust.rustapp.MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> </RelativeLayout> Java: MainActivty: package com.rust.rustapp; import android.support.v7.app.ActionBarActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; public class MainActivity extends ActionBarActivity { Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { private void button1Click() { startActivity(new Intent(MainActivity.this, Intro.class)); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button1: button1Click(); break; } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManife…
type: UnansweredQuestion
downvote count: 2

extends
tags question: http://stackoverflow.com/q/26530506
type: Tag
tag name: extends
tags question: http://stackoverflow.com/q/26537005

http://stackoverflow.com/comment/41725567
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26550571
has text: How many files are contained within the remote directory? Is it possible the command isn't completing in the five seconds that you wait for it? Are you getting an exception when you run this? What is the message in the exception?
score: 0

http://stackoverflow.com/comment/41842107
comment on: http://stackoverflow.com/a/26615169
type: AnswerComment
score: 0
type: Comment
has text: @Tetramputechture I would suggest creating the map where you manage your user input (e.g. a class `ActionHandler`). Then only this class knows about the `Action` objects / Key -> Action bindings.

http://stackoverflow.com/q/26631378
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41870860
type: Question
has comment: http://stackoverflow.com/comment/41871253
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26631434
has answer: http://stackoverflow.com/a/26631525
has answer: http://stackoverflow.com/a/26631470
has body: Say you create a class called Album and a class called Song. You want Album objects to be able to use the fields stored within Song objects (for example, the song's filesize or runtime). What do you have to do to allow this to happen? I've tried changing my fields within Song to public instead of private, but that hasn't worked. To be honest, I'm new to OOP and I think I'm overlooking something pretty fundamental here.
has comment: http://stackoverflow.com/comment/41870877
has title: How do you allow an object to use fields stored in another object?

http://stackoverflow.com/comment/42202299
has text: Have you tried [OWASP Java HTML Sanitizer](https://www.owasp.org/index.php/OWASP_Java_HTML_Sanitizer_Project#tab=Main)? I don't but it seems highly configurable and it is open source. Found at [wikipedia](http://en.wikipedia.org/wiki/HTML_sanitization) in "HTML sanitization" entry. Hope it helps.
comment on: http://stackoverflow.com/q/26549608
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41841954
type: QuestionComment
type: Comment
has text: `getResource` is not finding your images.
comment on: http://stackoverflow.com/q/26614932
score: 0

http://stackoverflow.com/comment/41936642
type: QuestionComment
comment on: http://stackoverflow.com/q/26667525
has text: Interesting, that should work indeed. Why isn't the hard constraint being trigged and affecting the score in the bottom of the window? Have you made any other edits than the input xml file? Try downloading an OptaPlanner distribution zip from scratch and using that one to open that input file.
score: 0
type: Comment

http://stackoverflow.com/q/26520187
has comment: http://stackoverflow.com/comment/43094809
favorite count: 0
has answer: http://stackoverflow.com/a/26579286
tagged with: web-services
linked to: http://stackoverflow.com/q/4455195
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/26520678
accepted answer: http://stackoverflow.com/a/26579286
type: Question
has body: I've looked high and low for a solution to this problem I have a java project (which I've inherited). It is essentially a RESTful wrapper to a SOAP web service. I'm not entirely sure why other than they were having problems with PHP connecting to their Webservice so created a Restful service which connected to the WS as a client. The problem is that the jax-ws autogenerated web services artifacts/classes are being hardcoded to a local path as the machine which compiles the project. Here is the example of annotations created in the java file which is auto generated by jax-ws upon project compile. /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.10-b140803.1500 * Generated source version: 2.2 * */ @WebServiceClient( name = "flahImplService", targetNamespace = "http://flah.com/", wsdlLocation = "file:/C:/Users/WindowsUser/PathToNetBeansProjectFolder/flah.wsdl") public class flahImplService } It seems to be linking to the online WSDL and building the files based on that. The only other important thing i can find is that in /nbproject/jax-ws.xml there is a xml such as this: <?xml version="1.0" encoding="UTF-8"?> <jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1"> <services> <service name="flahImplService"> com.service.management.flahImplService https://blah.com/flah.wsdl blah.com/flah.wsdl Where should I be specifying a path to replace this auto generate and hardcoded local WSDL location? Edit: btw, when I run this project locally it of course works because the path to the wsdl file is ok, but when deployed to the application server it fails.
answer count: 2
possible better answer: http://stackoverflow.com/a/26520678
downvote count: 0
has title: Stop jax-ws creating a local absolute path
tagged with: rest

java-8
tags question: http://stackoverflow.com/q/26575265
tags question: http://stackoverflow.com/q/26568555
tags question: http://stackoverflow.com/q/26663399
tags question: http://stackoverflow.com/q/26665024
tags question: http://stackoverflow.com/q/26568196
tags question: http://stackoverflow.com/q/26561818
tags question: http://stackoverflow.com/q/26595916
tags question: http://stackoverflow.com/q/26615988
tags question: http://stackoverflow.com/q/26590453
tags question: http://stackoverflow.com/q/26571250
tags question: http://stackoverflow.com/q/26611873
tags question: http://stackoverflow.com/q/26522205
tags question: http://stackoverflow.com/q/26648107
tags question: http://stackoverflow.com/q/26597490
tags question: http://stackoverflow.com/q/26576614
tags question: http://stackoverflow.com/q/26658022
tags question: http://stackoverflow.com/q/26524633
tags question: http://stackoverflow.com/q/26532184
tags question: http://stackoverflow.com/q/26536173
tags question: http://stackoverflow.com/q/26665662
tags question: http://stackoverflow.com/q/26649412
tags question: http://stackoverflow.com/q/26642153
tag name: java-8
tags question: http://stackoverflow.com/q/26663060
tags question: http://stackoverflow.com/q/26649062
tags question: http://stackoverflow.com/q/26549659
tags question: http://stackoverflow.com/q/26644933
tags question: http://stackoverflow.com/q/26522005
type: Tag
tags question: http://stackoverflow.com/q/26524010
tags question: http://stackoverflow.com/q/26653469
tags question: http://stackoverflow.com/q/26595020
tags question: http://stackoverflow.com/q/26539113
tags question: http://stackoverflow.com/q/26643539
tags question: http://stackoverflow.com/q/26529091
tags question: http://stackoverflow.com/q/26547286
tags question: http://stackoverflow.com/q/26579139
tags question: http://stackoverflow.com/q/26638467
tags question: http://stackoverflow.com/q/26634741

http://stackoverflow.com/comment/41786976
type: Comment
has text: That, plus the way OP sets the `var` after starting the thread maks no sense. A basic misunderstanding is hiding behind his attempts.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26585783

ognl
tags question: http://stackoverflow.com/q/26638974
tag name: ognl
type: Tag

http://stackoverflow.com/a/26632157
type: Answer
answers question: http://stackoverflow.com/q/26631730
has body: int n = in.nextInt(); if((n*2)==(in.nextLine().length()-1)) //correct length else //Incorrect length Try the above code. In the file,if integers are seperated by spaces,then it also counts as a character in length. Subtracting one from length is because the number of spaces is one less than the number of integers. Note that the above is applicable only when n>1.
score: 0

http://stackoverflow.com/q/26592923
upvote count: 2
tagged with: osgi
has body: I'm trying to embed apache felix into a simple hello world java project with maven, but I can't find a way to get a reference to a service of a bundle. I've installed org.apache.felix.bundlerepository bundle into OSGi from a jar and also added it as a maven dependency to my project. After that I'm starting the bundle, getting BundleContext from it and then calling getServiceReference(RepositoryAdmin.class.getName()) on that bundle context. The first thing I'm unhappy with is that I have to use BundleContext from the installed bundle, if I'd use BundleContext of the Framework the ServiceReference will be always null. This is not convinient. The second, more important issue, is that when I finally receiving a reference to RepositoryAdmin service from bundlerepository bundle I can't cast it to org.apache.felix.bundlerepository.RepositoryAdmin, executing the following code: (RepositoryAdmin)admin.getBundleContext().getService(ref) will throw this exception: java.lang.ClassCastException: org.apache.felix.bundlerepository.impl.RepositoryAdminImpl cannot be cast to org.apache.felix.bundlerepository.RepositoryAdmin I know this is a kind of classpath issue and may be caused by incompatibility of interfaces, but I'm using a bundle jar of the same version (2.0.2) as a maven dependency of my project. I'm also aware of Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA osgi configuration option which should force a bundle to use a package from the host application, but it didnt help me. Here is the main class of my project https://github.com/ArtemZ/osgi-study/blob/master/src/main/java/com/artemz/demo/Main.java which is messy because I was trying different things on it in order to get a reference to a service, but none actually worked for me. Hope someone will help me, because I'm really desperate with this issue.
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has title: Can't get a working reference to an OSGi service
has answer: http://stackoverflow.com/a/26598019
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-felix
accepted answer: http://stackoverflow.com/a/26598019

http://stackoverflow.com/comment/41934902
has text: Imagine what would happen if `nums` had a length of 0. Your first for loop would never be entered, `newNums` would never get created, your return statement tries to return something that doesn't exist.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26666681

http://stackoverflow.com/comment/41658719
has text: You are not using the same instance of `NumberFormat` concurrently without synchronization, right?
score: 0
comment on: http://stackoverflow.com/q/26514290
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41899605
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26589026
has text: @Tarlog Thanks! I am able to install jars to my local repository using the command mvn install:install-file, which can be used by my web app to build :)

http://stackoverflow.com/q/26529011
has answer: http://stackoverflow.com/a/26545469
tagged with: database
accepted answer: http://stackoverflow.com/a/26634300
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26529449
has answer: http://stackoverflow.com/a/26529449
has answer: http://stackoverflow.com/a/26634300
type: AnsweredQuestion
has title: Read stored procedure source code from Sybase ASE 15.7 database
tagged with: java
has body: I want to get access to the source code of some stored procedures, which are stored in a Sybase ASE 15.7 database. At the moment I copy the text manually in a textfile and read it via executed java-code from the disk. Now it is my goal to improve this process: I will get the sourcecode directly from the database within my executed java-code. Is that possible? Sorry, I have no idea. I have Rapid SQL to work on the database.
tagged with: sap-ase
type: Question

http://stackoverflow.com/a/26580749
has body: Correct. Change this private double balance; to protected double balance; So that the sub-class can access it directly. Alternatively you can use setBalance(double) and getBalance() instead.
upvote count: 1
answers question: http://stackoverflow.com/q/26580739
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26613168
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41838177
tagged with: java
has comment: http://stackoverflow.com/comment/41839368
type: Question
has comment: http://stackoverflow.com/comment/41838376
has answer: http://stackoverflow.com/a/26613212
score: 2
has comment: http://stackoverflow.com/comment/41838418
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26613212
linked to: http://stackoverflow.com/q/9633188
upvote count: 2
has body: the application I am working on has a login page where users put in their credentials, and log in. For some reason, if the user presses the backspace key while typing the password, the application just closes back to the phone's main screen. The only logcat result that is shown upon the press is: 4332-4332/com.etc.etc W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection I looked around but could not find a fix for this - maybe I am just missing something. Thank you! EDIT: I have found this code which was responsible for this. I don't know what the previous developer had in mind, but after commenting it out there were no more issues. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { finish(); return super.onKeyDown(keyCode, event); }
tagged with: android
has comment: http://stackoverflow.com/comment/41838554
has comment: http://stackoverflow.com/comment/41839247
has title: Android closes on login screen when backspace pressed on login activity

http://stackoverflow.com/a/26559808
has body: Replace public class ReservacionFormulario extends ListActivity{ with public class ReservacionFormulario extends Activity{ As you have extended the ListActivity so Android is searching for the a ListView with Id list, but In your XML there is no any such type of ListView.
has comment: http://stackoverflow.com/comment/41740328
score: 1
answers question: http://stackoverflow.com/q/26559464
downvote count: 0
has comment: http://stackoverflow.com/comment/41740300
type: Answer
upvote count: 1

executorservice
type: Tag
tags question: http://stackoverflow.com/q/26516372
tags question: http://stackoverflow.com/q/26559481
tag name: executorservice
tags question: http://stackoverflow.com/q/26567315
tags question: http://stackoverflow.com/q/26570058

http://stackoverflow.com/q/26656608
tagged with: owl
has comment: http://stackoverflow.com/comment/41915776
tagged with: sparql
tagged with: http://stackoverflow.com/tag/rdf
has title: Querying all "AnnotationAssertions" for a class/individual
accepted answer: http://stackoverflow.com/a/26656802
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am trying to query all AnnotationAssertion pertaining to an class/individual. Below is a snippet of my source: <AnnotationProperty abbreviatedIRI="rdfs:comment"/> #Car A car has four tyres <AnnotationProperty IRI="http://www.w3.org/2004/02/skos/core#definition"/> #car a road vehicle, typically with four wheels, powered by an internal combustion engine and able to carry a small number of people. <AnnotationProperty IRI="http://www.w3.org/2004/02/skos/core#example"/> #car Audi etc.. I am trying to query AnnotationProperties associated with this class/individual and its list of AnnotationAssertions. SPARQL-DL API provides an possibility to query annotationproperties via Annotation(a, b, c) Any pointers towards querying AnnotationAssertions would be really helpful.
has comment: http://stackoverflow.com/comment/41915976
has comment: http://stackoverflow.com/comment/41915947
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26656802

http://stackoverflow.com/comment/41785846
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26574534
type: QuestionComment
has text: @M.Deinum thanks for pointing out. I´ll fix this. Though this does not solve the problem. The question is why does this statement not work? And how can i get it to work, if possible without specifying the column types?

http://stackoverflow.com/q/26658152
tagged with: resultset
accepted answer: http://stackoverflow.com/a/26658441
has body: I am trying to select multiple columns from different tables in MySQL. MySQL: CREATE TABLE IF NOT EXISTS movie( movie_id TINYINT(3) UNSIGNED AUTO_INCREMENT, movie_title VARCHAR(255) NOT NULL, movie_genre VARCHAR(255) NOT NULL, movie_rating ENUM('G', 'PG', 'R-13', 'R-16', 'R-18', 'PENDING') NOT NULL, movie_cast VARCHAR(255) NOT NULL, movie_runtime TINYINT(3) UNSIGNED NOT NULL, movie_poster VARCHAR(255) NOT NULL, PRIMARY KEY(movie_id) ); CREATE TABLE IF NOT EXISTS mall( mall_id VARCHAR(255), mall_name VARCHAR(255) NOT NULL, PRIMARY KEY(mall_id) ); CREATE TABLE IF NOT EXISTS schedule( schedule_id TINYINT(3) UNSIGNED AUTO_INCREMENT, movie_id TINYINT(3) UNSIGNED NOT NULL, mall_id VARCHAR(255) NOT NULL, schedule_cinema TINYINT(2) UNSIGNED NOT NULL, schedule_price DECIMAL(5, 2) NOT NULL, schedule_date DATE NOT NULL, schedule_time TIME NOT NULL, schedule_seats TINYINT(2) UNSIGNED NOT NULL, PRIMARY KEY(schedule_id), FOREIGN KEY(movie_id) REFERENCES movie(movie_id), FOREIGN KEY(mall_id) REFERENCES mall(mall_id) ON DELETE CASCADE ON UPDATE CASCADE )ENGINE=INNODB; CREATE TABLE IF NOT EXISTS transaction( transaction_id SMALLINT(5) UNSIGNED AUTO_INCREMENT, user_id VARCHAR(255) NOT NULL, schedule_id TINYINT(3) UNSIGNED NOT NULL, transaction_date DATE NOT NULL, PRIMARY KEY(transaction_id), FOREIGN KEY(user_id) REFERENCES user(user_id), FOREIGN KEY(schedule_id) REFERENCES schedule(schedule_id) ON DELETE CASCADE ON UPDATE CASCADE )ENGINE=INNODB; I tested this query directly in XAMPP MySQL and it returned all desired columns. The transaction_id is also left-padded as intended. SELECT SQL: SELECT LPAD(transaction_id, 5, 0), transaction_date, movie_title, schedule_price, mall_name, schedule_cinema, schedule_date, schedule_time FROM transaction INNER JOIN schedule ON transaction.schedule_id = schedule.schedule_id INNER JOIN movie ON schedule.movie_id = movie.movie_id INNER JOIN mall ON schedule.mall_id = mall.mall_id WHERE user_id = 'admin'; This method was supposed to return a list of H…
downvote count: 0
tagged with: select
type: Question
has answer: http://stackoverflow.com/a/26658441
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
tagged with: sql
upvote count: 1
has title: Not getting MySQL SELECT LPAD() in ResultSet
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26601841
tagged with: tomcat
favorite count: 0
has body: My WebApp uses Java annotations to map the URL to the servlet (@WebServlet) and I don't have a web.xml file. I want to foward the request to another HTML file and I did it like so: request.getRequestDispatcher("/WEB-INF/test/testpage.html").forward(request, response); It works, but I can't get additional resources (javascript) from the server. &lt;script type="text/javascript" src="testsuite.js"&gt;&lt;/script&gt; testsuite.js is located in /WEB-INF/test/testsuite.js, the same folder as testpage.html. When requesting testsuite.js I get 404. How can I configure Tomcat to serve all the resources in my work tree without a web.xml? Worst case I will simply embed JS. Additionally I let eclipse install the web server on my local machine so I have no idea how they are deployed.
answer count: 1
accepted answer: http://stackoverflow.com/a/26601896
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/26601896
type: Question
has title: Eclipse - How do I publish non-Java resources without a web.xml file?
downvote count: 0
tagged with: javascript

http://stackoverflow.com/a/26575123
score: 3
has body: You can access the dialog's date picker and set it's min/max dates like so: dp.getDatePicker().setMinDate(dateNow.getTimeInMillis()); Note that when setting a minimum date for a picker it must be before the selected date of the picker, otherwise you get an IllegalArgumentException (same goes for max date of course).
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26573902
type: Answer
has comment: http://stackoverflow.com/comment/41780894
has comment: http://stackoverflow.com/comment/41781444
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26573902

http://stackoverflow.com/a/26517770
downvote count: 0
has comment: http://stackoverflow.com/comment/41666003
answers question: http://stackoverflow.com/q/26517632
accepted answer of: http://stackoverflow.com/q/26517632
type: Answer
has comment: http://stackoverflow.com/comment/41665799
has body: You have two issues here: int is a POD, not an object. Boxing and unboxing from int[] to corresponding Integer[] is not automatically performed. You need to declare intArray as: Integer[] intArray = {2,3,5,1}; Integer implements Comparable&lt;Integer&gt;, not Comparable&lt;Object&gt;. The two specializations are different and incompatible types. The right way to declare selectionSort is by using generics, as you suggest in the title: public static &lt;T extends Comparable&lt;T&gt;&gt; void selectionSort(T[] input)
score: 5
has comment: http://stackoverflow.com/comment/41665529
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/41666369

http://stackoverflow.com/comment/41827835
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26607813
has text: possibly duplicate: http://stackoverflow.com/questions/19332489/how-to-fix-failed-to-write-core-dump-core-dumps-have-been-disabled-error-whil
score: 0

http://stackoverflow.com/a/26736109
has comment: http://stackoverflow.com/comment/42287805
upvote count: 2
type: Answer
score: 2
has body: Have a look at GeoTools, it may have what you need.
answers question: http://stackoverflow.com/q/26659363
downvote count: 0

http://stackoverflow.com/comment/42345147
comment on: http://stackoverflow.com/q/26668723
type: Comment
has text: nm, I got it to work using the following jvm parameters in Control Panel: -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41717751
type: QuestionComment
has text: `in fact, i dont't know. i have jtable with jradiobuttons in cells. **works fine** (radio button is switching) except the fact that actual state of the jradiobutton is rendered just after i press esc key on keyboard or click on another component.` == it doesn't works fine
comment on: http://stackoverflow.com/q/26546271
score: 0
type: Comment

http://stackoverflow.com/comment/42512196
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26582452
score: 0
has text: possible duplicate of [Parse stanford trees into python](http://stackoverflow.com/questions/26710981/parse-stanford-trees-into-python)

http://stackoverflow.com/a/26673664
has body: Use UTC Server-Side Typically in database you store dates in UTC. You perform date translation after you fetch it to avoid time zone change problems. tz database For Java, you can obtain fresh time zone data. Download the latest version of tzdata file, also known as the "Olson database". Add that file to your JVM bundle. See these instructions.
accepted answer of: http://stackoverflow.com/q/26671996
type: Answer
answers question: http://stackoverflow.com/q/26671996
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26645427
answers question: http://stackoverflow.com/q/26645343
score: 0
has body: You can use a comparator object to sort. Collections.sort(); does the sorting. This will work with your List. The method to be used is compareTo. if (list.size() &gt; 0) { Collections.sort(list, new Comparator&lt;Emp&gt;() { @Override public int compare(final Emp object1, final Emp object2) { return object1.getMarks().compareTo(object2.getMarks()); } } ); }
type: Answer

http://stackoverflow.com/comment/41939798
has text: @M.Deinum Thank you sir and thanks to your expect! yes i indeed intend to use `SessionFactory` because I decide use hibernate criteria.
comment on: http://stackoverflow.com/q/26667910
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/44427670
comment on: http://stackoverflow.com/q/26544266
score: 1
type: Comment
has text: Hi @bardi. The file size doesn't seem to be a concern as much as I'd thought. I tried sending a small jpeg file with setChunkedStreamingMode enabled and the error occurs as well, though it worked when chunking is disabled.
type: QuestionComment

http://stackoverflow.com/comment/41791502
has text: I think it's neither possible nor desirable! 'try - finally' is a fine, well used and understood concept.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26588272
score: 0

http://stackoverflow.com/comment/41666459
comment on: http://stackoverflow.com/q/26515019
score: 0
has text: how big is the document you are retrieving? it sounds like you have a database problem, not an xml/json problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41726713
score: 1
has text: It's not that easy for me to refactor the code... the OAuth2Parameters - Class becomes com.google.gdata.client.authn.oauth.OAuthParameters ?? What are the right attributes to set id, secret and uri And OAuthUtil has no static methods at all... I just really can't understand why they don't give us a java snippet - after all it's needed for all the android apps wishing to use the gdata api..
comment on: http://stackoverflow.com/a/26523080
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41853234
type: QuestionComment
comment on: http://stackoverflow.com/q/26621394
score: 0
has text: if I use, while(usStatus != 'Y') it works perfect, but when i combine the two boolean expressions with the || (OR) logical operator, the loop never ends.
type: Comment

http://stackoverflow.com/q/26627546
accepted answer: http://stackoverflow.com/a/26628979
type: Question
has body: I am trying to implement content assist for a textViewer from the JFace library on my stand-alone java application. It has been working thus far. However, I was wondering if it is possible to change the key used to select the proposal from the popup? I want to use the ENTER key for something else in my application. Thank you.
tagged with: content-assist
tagged with: user-interface
tagged with: keyboard
score: 0
answer count: 1
tagged with: jface
has answer: http://stackoverflow.com/a/26628979
type: AnsweredQuestion
has title: program different key to select proposal from content assist
tagged with: java

http://stackoverflow.com/a/26631991
has comment: http://stackoverflow.com/comment/41872289
has comment: http://stackoverflow.com/comment/41873420
accepted answer of: http://stackoverflow.com/q/26631555
has comment: http://stackoverflow.com/comment/41872989
has comment: http://stackoverflow.com/comment/41872575
answers question: http://stackoverflow.com/q/26631555
has comment: http://stackoverflow.com/comment/41872786
score: 0
type: AcceptedAnswer
has body: The only major issue I see is that you have not implemented the Getters and Setters as was probably intended. In Java most classes have Getters/Setters for each variable that needs to be accessed, something like: public String getTitle() { return title; } public void setTitle(String _title) { this.title = _title; } Also, there is nothing "wrong" with the way you have done the Print and toString functions, but I would have written up the toString to output more similar to how you have print doing it, and then calling toString from the print. Something like: public String toString() { return "SerialNumber: " + serialNumber +"\n" +"Title: " + title + "\n" +"Author: " + author +"\n"; } public void print() { System.out.println(this.toString()); } As a final note, you did not include any code to use this class, as mentioned in the last line of question 2. Hope this helps
has comment: http://stackoverflow.com/comment/41872694
type: Answer
has comment: http://stackoverflow.com/comment/41872718
has comment: http://stackoverflow.com/comment/41872400

http://stackoverflow.com/q/26657727
type: UnansweredQuestion
has body: I need to validate maximum length of a String value that is going to be stored as VARCHAR2(4000 bytes) column in database. What maximum length should I take? I assumed 2000, because Java String is encoded in UTF-16, but am I missing something? Is there any case that 2000-charactr string can take more than 4000 bytes?
tagged with: java
type: Question
answer count: 2
tagged with: encoding
tagged with: utf-16
has title: Maximum string length for given number of bytes
score: 0
has answer: http://stackoverflow.com/a/26659896
has answer: http://stackoverflow.com/a/27516697

http://stackoverflow.com/comment/41861658
score: 0
comment on: http://stackoverflow.com/a/26620300
type: AnswerComment
type: Comment
has text: That, I won't fotget. Thanks again.

http://stackoverflow.com/comment/41954164
comment on: http://stackoverflow.com/a/26633098
score: 0
type: AnswerComment
type: Comment
has text: What is the problem? Is it the fact that you are not getting enough numbers in your set? If that is the problem it is because the set is not adding duplicate numbers to the set (like you want). instead of a for loop you could use a while loop with the condition RandomNumbers.size() != 6

http://stackoverflow.com/q/26611567
score: 1
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26612401
downvote count: 0
has body: This is more of an academic question, but I started working on configuring JAXB schema validation because I was researching what would happen using more than one schema with an element name conflict. Is it possible to configure JAXB and have schema files which support an XML document which looks something like this? <my:inventory xmlns:my="http://www.my.com" xmlns:ab="http://www.ab.com" xmlns:xy="http://www.xy.com"> <my:products> <ab:product> 123 some ap product 12.22 </ab:product> <xy:product> 123 some xy product 63.45 </xy:product> </my:products> </my:inventory> The basic idea is to have product information from both AB company and XY company. The two companies have the same data but store them in different tags. I would like to have MY company schema to define an inventory of products from the two other companies. I started to create the XSD files and the JAXB annotated classes for this. It quickly spiraled into an unending stream of configuration and parsing exceptions, so I thought I'd ask.
has title: JAXB, XSD stylesheets, and element name conflict resolution
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
upvote count: 1
tagged with: xsd

http://stackoverflow.com/comment/41727428
has text: Did you perhaps mean `ArrayList<int [9]>`? The `Array` class only contains static methods, and isn't a templated type.
comment on: http://stackoverflow.com/q/26552639
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26561292
has body: I'm using Java 8 Nashorn to render CommonMark to HTML server side. If I compile and cache and reuse a CompiledScript, a certain page takes 5 minutes to render. However, if I instead use eval, and cache and reuse the script engine, rendering the same page takes 3 seconds. Why is CompiledScript so slow? (sample code follows) What's a good approach for running Javascript code in Nashorn, over and over again as quickly as possible? And avoiding compiling the Javascript code more than once? This is the server side Scala code snippet that calls Nashorn in a way that takes 5 minutes: (when run 200 times; I'm compiling many comments from CommonMark to HTML.) (This code is based on this blog article.) if (engine == null) { val script = scala.io.Source.fromFile("public/res/remarkable.min.js").mkString engine = new js.ScriptEngineManager(null).getEngineByName("nashorn") compiledScript = engine.asInstanceOf[js.Compilable].compile(s""" var global = this; $script; remarkable = new Remarkable({}); remarkable.render(__source__);"""); } engine.put("__source__", "**bold**") val htmlText = compiledScript.eval() Edit Note that the $script above is reevaluated 200 times. I did test a version that evaluated it only once, but apparently then I wrote some bug, because the only-once version wasn't faster than 5 minutes, although it should have been one of the fastest ones, see Halfbit's answer. Here's the fast version: ... val newCompiledScript = newEngine.asInstanceOf[js.Compilable].compile(s""" var global; var remarkable; if (!remarkable) { global = this; $script; remarkable = new Remarkable({}); } remarkable.render(__source__);""") ... /Edit Whereas this takes 2.7 seconds: (when run 200 times) if (engine == null) { engine = new js.ScriptEngineManager(null).getEngineByName("nashorn") engine.eval("var global = this;") engine.eval(new jio.FileReader("public/res/remarkable.min.js")) engine.eval("remarkable = new Remarkable({});") } engine.put("source", "**bold**") val htmlText = engine.eval(…
favorite count: 0
has comment: http://stackoverflow.com/comment/41743804
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 19
type: Question
tagged with: nashorn
tagged with: performance
tagged with: javascript
upvote count: 19
has answer: http://stackoverflow.com/a/26574568
has answer: http://stackoverflow.com/a/26577661
accepted answer: http://stackoverflow.com/a/26577661
has title: How make Java 8 Nashorn fast?
answer count: 2
possible better answer: http://stackoverflow.com/a/26574568

http://stackoverflow.com/comment/41755607
type: Comment
has text: @Kootling just read what an `ArrayList` is: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html In short it is a more powerful array.
comment on: http://stackoverflow.com/a/26568146
score: 1
type: AnswerComment

http://stackoverflow.com/a/26544668
type: Answer
answers question: http://stackoverflow.com/q/26544567
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26544567
has body: You can use Reflections to get access to these methods. Have a look at Class.getDeclaredMethods() and AccessibleObject.setAccessible() But if you need to do this your design is definitely wrong. The methods were hidden for a reason.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26638743
score: 2
answers question: http://stackoverflow.com/q/26632334
type: AcceptedAnswer
downvote count: 0
has body: On Linux getHardwareAddress() is implemented using SIOCGIFHWADDR ioctl request on a temporarily created datagram socket. Something like this. Both socket and ioctl system calls may fail. The error will be translated to SocketException.
accepted answer of: http://stackoverflow.com/q/26632334
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41805638
score: 1
comment on: http://stackoverflow.com/q/26595529
type: Comment
type: QuestionComment
has text: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCAQFjAA&url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F7%2Fdocs%2Fapi%2Fjavax%2Fswing%2FJButton.html&ei=2Z9OVMjyDPLGsQTly4GwDQ&usg=AFQjCNFwtfUDpO35cMSq9rjz7bwhUEKZAw&sig2=IhK0Go8QYEVF3XySBN_7fQ&bvm=bv.77880786,d.cWc and https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2Ftutorial%2Fuiswing%2Fevents%2Factionlistener.html&ei=6J9OVPagH8S1sQSAq4CwDQ&usg=AFQjCNFp3dH1WtGwb_Qf_ci4bYGqzfhL4Q&sig2=sjJDf1mUQgGGlvNwIYeGqQ

http://stackoverflow.com/q/26550008
favorite count: 0
has title: Programming in Debug context in Eclipse IDE
possible better answer: http://stackoverflow.com/a/26550023
has comment: http://stackoverflow.com/comment/41722518
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26550096
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: debugging
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26550096
has body: Is there a way to program (Java), I mean, write some piece of code anywhere in IDE, to evaluate something in the current debug context when the program execution is waiting on some debug point in an Eclipse IDE? The feature I require is very much similar to what Google Chrome offers for a Javascript developer. In below image $(this).text() returns the button's text in current debug context.
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26550023

http://stackoverflow.com/comment/41812492
comment on: http://stackoverflow.com/q/26598869
has text: Oh that's right, there it is.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/127406709
has text: If you happen to have a last `filter()` operation before needing to `count()`. you can replace the sequence `...filter(expr.findAny().isPresent());` by `...anyMatch(expr)`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/59646406
score: 5

http://stackoverflow.com/q/26532338
tagged with: java
type: Question
tagged with: iterator
has title: Set an integer using ListIterator
has comment: http://stackoverflow.com/comment/41693912
tagged with: listiterator
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41691309
score: 0
tagged with: random
upvote count: 1
answer count: 1
downvote count: 1
has body: The task I want to accomplish is to set a random int from 0 to 1000, for each element of an ArrayList of 1,000,000 elements. I did it successfully using simple for loops, but now I want to obtain this trough the ListIterator and its set() method. static int i = 0; public static void main(String[] args) { List rInt = new ArrayList(); for (int i = 0; i &lt;= 1000; i++) { rInt.add(i); } List hMSAL = new ArrayList(); for (int i = 1; i &lt;= 1000000; i++) { hMSAL.add(i); } ListIterator&lt;Integer&gt; gI = hMSAL.listIterator(); while (gI.hasNext()) { Collections.shuffle(rInt); int rand = (int) rInt.get(333); gI.next(); gI.set(rand); int f = gI.next(); System.out.println(++i + " " + f); } The problem is the output. Output: 1 2 2 4 3 6 4 8 5 10 ... Q: What should I modify in my code, so for each i from 1 to 1,000,000 the assigned value would be a random integer from 1 to 1000.
favorite count: 0
has answer: http://stackoverflow.com/a/26532743
accepted answer: http://stackoverflow.com/a/26532743
type: AnsweredQuestion

http://stackoverflow.com/q/26587294
tagged with: jtextfield
type: Question
has body: Currently Having my fields like that: final JTextField PID = new JTextField("Product ID", 7); frame.getContentPane().add(PID); My method: public StockItem(Long id, String name, String desc, double price) { this.id = id; this.name = name; this.description = desc; this.price = price; } Trying to use this method with values from my JTextFields, but it does not allow to use JTextFields under my Long/String/double places. Is there any way how I could convert my JTextFields into the required things without editing my Method.
has answer: http://stackoverflow.com/a/26587633
has title: How to make JTextField into String/Long?
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26588860
has answer: http://stackoverflow.com/a/26588860
tagged with: parsing
accepted answer: http://stackoverflow.com/a/26587633
has comment: http://stackoverflow.com/comment/41791022
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41789713
linked to: http://stackoverflow.com/q/1313390
tagged with: methods
tagged with: swing

http://stackoverflow.com/comment/41854265
score: 0
type: Comment
type: QuestionComment
has text: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Type mismatch: cannot convert from String to float The operator - is undefined for the argument type(s) java.lang.String, java.lang.String The operator * is undefined for the argument type(s) java.lang.String, java.lang.String The operator / is undefined for the argument type(s) java.lang.String, java.lang.String at FracCalcApp.main(FracCalcApp.java:53)
comment on: http://stackoverflow.com/q/26621905

set
tags question: http://stackoverflow.com/q/26631555
tags question: http://stackoverflow.com/q/26668814
tags question: http://stackoverflow.com/q/26530592
tags question: http://stackoverflow.com/q/26638556
type: Tag
tags question: http://stackoverflow.com/q/26548123
tags question: http://stackoverflow.com/q/26514278
tag name: set
tags question: http://stackoverflow.com/q/26563213
tags question: http://stackoverflow.com/q/26578257
tags question: http://stackoverflow.com/q/26641477

http://stackoverflow.com/q/26619263
has answer: http://stackoverflow.com/a/26619882
answer count: 1
tagged with: builder
has comment: http://stackoverflow.com/comment/41849971
has body: Currently others i distribute to get "A Java Exception has occurred" from the java run time environment. How would I go about distributing this properly as a .jar? package my.onis; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import static java.lang.Thread.sleep; import javax.swing.JOptionPane; public class onis extends javax.swing.JFrame { public onis() { initComponents(); } public int oxygen = 100; @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); btn = new javax.swing.JLabel(); pb = new javax.swing.JProgressBar(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("One Night In Space"); setAlwaysOnTop(true); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } }); jPanel1.setPreferredSize(new java.awt.Dimension(1135, 633)); jPanel1.setLayout(null); btn.setIcon(new javax.swing.ImageIcon("C:\\Users\\rando_000\\Desktop\\butt.png")); // NOI18N btn.setPreferredSize(new java.awt.Dimension(200, 100)); btn.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnMouseClicked(evt); } }); jPanel1.add(btn); btn.setBounds(430, 200, 200, 100); pb.setBackground(new java.awt.Color(0, 0, 0)); pb.setForeground(new java.awt.Color(255, 255, 51)); pb.setValue(oxygen); pb.setBorderPainted(false); pb.setFocusable(false); pb.setStringPainted(true); jPanel1.add(pb); pb.setBounds(30, 564, 280, 30); jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\rando_000\\Desktop\\Background.jpeg")); // NOI18N jPanel1.add(jLabel2); jLabel2.setBounds(0, 0, 1051, 633); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizont…
tagged with: java
linked to: http://stackoverflow.com/q/16924347
duplicate of: http://stackoverflow.com/q/16924347
downvote count: 0
tagged with: compilation
has comment: http://stackoverflow.com/comment/41849507
type: UnansweredQuestion
type: Question
tagged with: user-interface
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41849593
has comment: http://stackoverflow.com/comment/41849534
has title: How to distribute a java GUI builder project
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/41849905

http://stackoverflow.com/q/26535597
type: Question
has comment: http://stackoverflow.com/comment/41697254
answer count: 3
possible better answer: http://stackoverflow.com/a/26535700
downvote count: 1
has answer: http://stackoverflow.com/a/26535700
favorite count: 0
tagged with: ascii-art
has title: What logic needs to be changed to get the star pattern
has body: class Starr { public static void main(String[] args) { int res; for(int i=1;i&lt;=5;i++) { for(int j=1;j&lt;=5;j++) { res=i+j; if(res&gt;=6) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } } Output: * ** *** **** ***** Expected: * * * * * * * * * * * * * * * To get the above expected result i made the following changes, { System.out.print(" *"); /* Added a space before '*' */ } else { System.out.print(" "); /* Added 2 spaces */ } I would like to know if this expected result can be achieved in another logic where i don't have to change the print statement. Whatever changes i have done is a right approach?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46692408
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41697291
score: -1
has answer: http://stackoverflow.com/a/26536105
accepted answer: http://stackoverflow.com/a/26536105

http://stackoverflow.com/comment/41671249
comment on: http://stackoverflow.com/q/26520238
score: 0
type: Comment
type: QuestionComment
has text: It works. What's happening in eclipse then?

http://stackoverflow.com/q/26579458
score: 14
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
has comment: http://stackoverflow.com/comment/59612862
has comment: http://stackoverflow.com/comment/41819968
type: Question
possible better answer: http://stackoverflow.com/a/47240776
has comment: http://stackoverflow.com/comment/53843170
upvote count: 15
accepted answer: http://stackoverflow.com/a/43760399
answer count: 2
has answer: http://stackoverflow.com/a/47240776
has comment: http://stackoverflow.com/comment/60543395
tagged with: themes
has comment: http://stackoverflow.com/comment/41776762
has comment: http://stackoverflow.com/comment/53842349
has comment: http://stackoverflow.com/comment/55661899
tagged with: vaadin-valo-theme
has comment: http://stackoverflow.com/comment/41834949
has comment: http://stackoverflow.com/comment/106754674
favorite count: 0
linked to: http://stackoverflow.com/q/60348621
has body: The new Valo theme is now the default in Vaadin 7.3 apps. This theme renders visually with widgets (buttons, fields, and so on) that are dramatically larger (wider and taller) than in the previous default Reindeer theme. This kind of look is now popular in mobile apps in Android and iOS 7/8 as well as some web sites. But those contexts are for brief usage in the range of mere minutes. In contrast, business-oriented desktop-style apps are used by people for much longer work sessions, perhaps for hours on-and-off all day. And business-oriented apps present much more information in a denser format. For such use, the default rendering of the Valo theme is inappropriate. Specifically, the fonts are too thin and faint, and the size is too large for fonts and widgets. Valo's claim to fame is that it is built to be adjustable and easy to morph just a few lines of Java and/or CSS code. Has any one experimented with altering Valo to be sized similar to the Reindeer theme? Any source code or instructions to share? To be clear, my goal is simply reduce the visual height &amp; width and their font size. I'm not asking about altering the design, I would be grateful just to get back some pixel space. I'm looking simply for the easiest and safest way to get the Valo widgets’ size to parallel the visual size of their counterparts in Reindeer theme. In the short term, I will continue to override the default to use Reindeer, as described on this StackOverflow.com Question, Change from “Valo” theme to “Reindeer” in new Vaadin 7.3 app. But longer term, the Vaadin team is betting big on Valo. Eventually Reindeer will fall out of favor, so I would like to learn how to transition. I did open Ticket # 14,909 to suggest providing a switch to make Valo automatically downsize to Reindeer scheme. Some people have misread this post: we are not talking about storage size on disk. We are talking about pixels here, not bits. Visual size, not file size. Graphical layout, not widgetset optimization. …
has answer: http://stackoverflow.com/a/43760399
linked to: http://stackoverflow.com/q/26519650
tagged with: vaadin7
downvote count: 1
has title: Scale down the Valo theme’s spacing and widget size to that of the Reindeer theme

http://stackoverflow.com/q/26615104
type: Question
tagged with: audio
has comment: http://stackoverflow.com/comment/41841657
has title: java - best way to compare mp3 and wav files with different specifications?
tagged with: java
has body: Speaking conceptually, is there a way to compare .mp3 and .wav files? If so what? Is converting .mp3 to .wav files advisable for comparison? Anybody who can just explain me the concept would be really helpful. I have done a comparison of wav files using FFT but want to now compare mp3 and wav files.
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26618337
has comment: http://stackoverflow.com/comment/41842064
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/26538999
tagged with: javassist
type: UnansweredQuestion
tagged with: bytecode-manipulation
answer count: 0
has comment: http://stackoverflow.com/comment/41703825
tagged with: java
has comment: http://stackoverflow.com/comment/41703458
type: Question
has body: I am having some trouble with javaassist. I'm attempting to generate a class on the fly and I'm getting an error that says: no such class: Foo during the compilation step in the generateFooMethod step below. Can anyone help me? try { final ClassPool pool = ClassPool.getDefault(); pool.importPackage("com.amir"); // &lt;-- foo exists here final CtClass ctClass = pool.makeClass(className); ctClass.addMethod(generateFooMethod(ctClass, methodName)); return ctClass.toClass(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("compile failed"); } } private static CtMethod generateFOOMethod(final CtClass declaringClass, final String methodName) throws CannotCompileException { final StringBuilder sb = new StringBuilder(); sb.append("public static Foo " +methodName+ "(Foo foo) {"); sb.append(" return foo"); sb.append("}"); return CtMethod.make(sb.toString(), declaringClass); // &lt;-- failure happens here } I've also tried explicitly referring to Foo in the method declaration as in: sb.append("public static com.amir.Foo " +methodName+ "(com.amir.Foo foo) {"); which also does not work.
score: 0
has comment: http://stackoverflow.com/comment/41703367
has title: Error generating java method using javaassist

http://stackoverflow.com/q/26623133
has comment: http://stackoverflow.com/comment/41859887
has comment: http://stackoverflow.com/comment/41856426
has comment: http://stackoverflow.com/comment/41858841
has answer: http://stackoverflow.com/a/26623628
has answer: http://stackoverflow.com/a/26624219
answer count: 3
has comment: http://stackoverflow.com/comment/41856835
has comment: http://stackoverflow.com/comment/41859816
score: 0
has title: Resolve ambiguous structures in Java
accepted answer: http://stackoverflow.com/a/26624219
has comment: http://stackoverflow.com/comment/41856406
has answer: http://stackoverflow.com/a/26624585
tagged with: design-patterns
type: Question
type: AnsweredQuestion
has body: I have two programs One creats a structure and one resolves it the structure is as follows class A { List&lt;B&gt; } class B { List&lt;A&gt; } Now the problem is that the program that creates the structure is not sure whether the structure is A1-&gt;B1 |-&gt;B2-&gt;A2 |-&gt;A3-&gt;B3-&gt;A4 OR A1-&gt;B1 |-&gt;B3-&gt;A4 |-&gt;B2-&gt;A2 |-&gt;A3 Could someone please provide a way to pass this ambiguity whether B3 is attached to A1 or A3 such that the second program can know that there is an ambiguity and can decide which structure to use depending on some constraint.
tagged with: algorithm
tagged with: java
possible better answer: http://stackoverflow.com/a/26624585

http://stackoverflow.com/q/26558373
has body: I am implementing a small chat application using java-ee websockets. At one time I want to close session for a client for various reasons so for closing connection. For closing connection I called onClose function and in that function I called session.close() But after that I got the following error: java.lang.IllegalStateException: The WebSocket session has been closed and no method (apart from close()) may be called on a closed session at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:643) at org.apache.tomcat.websocket.WsSession.addMessageHandler(WsSession.java:168) at org.apache.tomcat.websocket.pojo.PojoEndpointBase.doOnOpen(PojoEndpointBase.java:81) at org.apache.tomcat.websocket.pojo.PojoEndpointServer.onOpen(PojoEndpointServer.java:70) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:129) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:629) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) I'm not sure what I did wrong and I why I got this exception.
tagged with: java
tagged with: jakarta-ee
answer count: 4
has answer: http://stackoverflow.com/a/42170039
has answer: http://stackoverflow.com/a/40316118
downvote count: 0
tagged with: websocket
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/55212376
favorite count: 0
has answer: http://stackoverflow.com/a/32778895
type: Question
has answer: http://stackoverflow.com/a/26560244
upvote count: 6
has title: How to close java-ee websocket connection properly

http://stackoverflow.com/q/26602463
tagged with: java
type: Question
has body: I'm trying to generate a JAX-WS response and getting the following exception: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "tns"&amp;#xd;. at [row,col {unknown-source}]: [20,26].&lt;/faultstring&gt;&lt;/soap:Fault&gt; &lt;/return&gt; &lt;/soap:Body&gt;&lt;/soap:Envelope&gt; Here's my schema: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://url" xmlns:tns="http://url"&gt; &lt;xs:element name="context" nillable="true" type="tns:context" /&gt; &lt;xs:complexType name="context"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" maxOccurs="1" name="Recommendations" type="tns:ArrayOfElements" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="ArrayOfElements"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" maxOccurs="unbounded" name="Recommendation" nillable="true" type="tns:Recommendation" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Recommendation"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="1" maxOccurs="1" name="item" type="xs:int" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:element name="Recommendation" nillable="true" type="tns:Recommendation" /&gt; &lt;xs:element name="ArrayOfRecommendation" nillable="true" type="tns:ArrayOfRecommendation" /&gt; &lt;/xs:schema&gt; Any suggestions what could be the reason of this error? I'm using JBoss 6.2 for this JAX-WS PS. Adding ArrayOfRecommendation: &lt;xs:complexType name="ArrayOfRecommendation"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" maxOccurs="unbounded" name="Recommendation" nillable="true" type="tns:Recommendation" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Recommendation"&gt; &lt;xs:sequence&gt;
score: 0
has comment: http://stackoverflow.com/comment/41842047
has comment: http://stackoverflow.com/comment/42372687
has title: trying to generate a JAX-WS response and getting an exception
answer count: 0
has comment: http://stackoverflow.com/comment/41820580
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41858538
tagged with: soap

http://stackoverflow.com/a/26541129
has comment: http://stackoverflow.com/comment/41707036
score: 4
type: Answer
upvote count: 4
has body: The only way is to assign such values in the constructor, so you would need to add a constructor to your structure class: class Product{ Product(double item1, double item2, double item3) { this.item1 = item1; this.item2 = item2; this.item3 = item3; } final double item1; final double item2; final double item3; } And then use it in the rest of your code: public Store(int[] elements) { Product x = new Product(elements[0], elements[1], elements[2]); }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26541087
has comment: http://stackoverflow.com/comment/41706967
answers question: http://stackoverflow.com/q/26541087
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41707000

http://stackoverflow.com/a/30473266
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26571495
has body: Even I'm working on the same problem and having issues. This is how much I have done: You need to change the properties to support chinese language as follows: props.setProperty("customAnnotatorClass.segment","edu.stanford.nlp.pipeline.ChineseSegmenterAnnotator"); props.setProperty("pos.model","edu/stanford/nlp/models/pos-tagger/chinese-distsim/chinese-distsim.tagger"); props.setProperty("parse.model","edu/stanford/nlp/models/lexparser/chinesePCFG.ser.gz"); props.setProperty("segment.model","edu/stanford/nlp/models/segmenter/chinese/ctb.gz"); props.setProperty("segment.serDictionary","edu/stanford/nlp/models/segmenter/chinese/dict-chris6.ser.gz"); props.setProperty("segment.sighanCorporaDict","edu/stanford/nlp/models/segmenter/chinese"); props.setProperty("segment.sighanPostProcessing","true"); props.setProperty("ssplit.boundaryTokenRegex","[.]|[!?]+|[。]|[！？]+"); props.setProperty("ner.model","edu/stanford/nlp/models/ner/chinese.misc.distsim.crf.ser.gz"); props.setProperty("ner.applyNumericClassifiers","false"); props.setProperty("ner.useSUTime","false"); But the problem that still persists is the tokenizer being used is still defaulting to PTBTokenizer(for English). For Spanish the corresponding properties are: props.setProperty("tokenize.language","es"); props.setProperty("sentiment.model","src/international/spanish"); props.setProperty("pos.model","src/models/pos-tagger/spanish/spanish-distsim.tagger"); props.setProperty("ner.model","src/models/ner/spanish.ancora.distsim.s512.crf.ser.gz"); props.setProperty("ner.applyNumericClassifiers","false"); props.setProperty("ner.useSUTime","false"); props.setProperty("parse.model","src/models/lexparser/spanishPCFG.ser.gz"); This works just fine for Spanish. Notice the 'tokenize.language' property being set to 'es'. Such a property is not there for Chinese. I have tried to set it to 'ch','cn','zh','zh-cn' but nothing works. Tell me if you proceed further.

http://stackoverflow.com/comment/41835502
score: 0
comment on: http://stackoverflow.com/q/26611771
type: Comment
has text: @user2336315 is correct, it would be best that you store your double into a different variable then declare tmp as an int and follow the links posted to figure out how to convert
type: QuestionComment

http://stackoverflow.com/a/26634652
accepted answer of: http://stackoverflow.com/q/26634324
upvote count: 3
answers question: http://stackoverflow.com/q/26634324
has body: Unless there's some code you've omitted, parse is returning a Double, not a BigDecimal. (Try System.out.println(number.getClass()) to check this.) If you want a BigDecimal, you have to use setParseBigDecimal to tell it to return a BigDecimal. (And to do that, format has to be declared as DecimalFormat.) DecimalFormat format = new DecimalFormat("#.0000000000######"); format.setParseBigDecimal(true); Number number = format.parse(text);
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41665477
has text: @KickButtowski with my sumbittedAnswers method
comment on: http://stackoverflow.com/q/26517713
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26637643
type: Answer
has comment: http://stackoverflow.com/comment/41973984
score: 0
has comment: http://stackoverflow.com/comment/41889473
answers question: http://stackoverflow.com/q/26637601
has comment: http://stackoverflow.com/comment/41889489
has comment: http://stackoverflow.com/comment/41900569
has body: If I understood correctly what you need to do is : when you click the button, get the int value from the shared preferences first, it if does not exist, create it increment the value by one save this value to the SharedPreferences again So it would translate to something like that: @Override public void onClick(View v) { // TODO Auto-generated method stub int totalCount = mySharedPreferences.getInt("INT_KEY", -1); if(totalCount == -1) { totalCount = 0; //initialize the total count value to 0 } count += 1; totalCount += 1; SharedPreferences.Editor editor = mySharedPreferences.edit(); editor.putInt("INT_KEY", totalCount); editor.commit(); current.setText("Your current count is "+ count); total.setText("Your total count is " + totalCount); } For more efficiency, get the totalCount value from the SharedPreferences when you start the app and save it to the SharedPreferences before you finish your activity. You can read the android doc of the SharedPreferences class for more informations.
has comment: http://stackoverflow.com/comment/41884848

http://stackoverflow.com/q/26661100
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26661733
tagged with: centos6
tagged with: bash
possible better answer: http://stackoverflow.com/a/26661665
has answer: http://stackoverflow.com/a/26661665
linked to: http://stackoverflow.com/q/2146727
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41925429
has answer: http://stackoverflow.com/a/26661733
has title: cannot pass remote commnds (ssh) using Runtime.Exec
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41924599
has body: I am trying to reboot remote server from my java code. I have password-less ssh setup in place and sudoers file has argument in place so that no password is required for executing the system commands. I run the following command from "bash shell" on my local machine and my remote system shutsdown and comes up just fine ssh -t user1@192.168.2.125 'sudo reboot' Above command restarts the remote server without checking for any passwords; and now I pass the above command thru the java code as follows (I surrounded 'sudo reboot' in special characters so that it goes as one command) String cmd="ssh -t user1@192.168.2.125 \'sudo reboot\'"; log.info("Executing command.."+cmd); p = Runtime.getRuntime().exec(cmd); //open error stream and input stream and process However I get the following error [2014-10-30 19:07:55,593] INFO Executing command..ssh -t user1@192.168.2.125 'sudo reboot' [2014-10-30 19:07:57,070] ERROR ERROR while executing command: ssh -t user1@192.168.2.125 'sudo reboot' [2014-10-30 19:07:57,070] ERROR Pseudo-terminal will not be allocated because stdin is not a terminal. bash: sudo reboot: command not found What am I doing wrong? I am trying to avoid 3rd party libraries(ex:JSch). I am using centos6 and Java 7 SOLUTION 1)took out single quotes as suggested by @hcs. Then I get another error mesg about ".. tty.." 2)updated sudoers file as suggested in the link https://serverfault.com/questions/15667/remotely-reboot-tomcat
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41924960

http://stackoverflow.com/q/26609508
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/94095520
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/41856968
has comment: http://stackoverflow.com/comment/41898232
has comment: http://stackoverflow.com/comment/41898584
has comment: http://stackoverflow.com/comment/41898661
answer count: 1
downvote count: 0
has body: Alright, I couldn't find an answer to my question with google so... Currently I'm using JasperReports and DynamicJasper to build my reports and print them. All works fine when I use just single jasper-files or jrxml-files. I also have a piece of code which merges all JasperPrint-files into one if I need to combine reports. However, this isn't really optimal... Can I use one .jasper or .jrxml-file as a master report (it has a header, a footer and en empty detail-band) and fill its detail-band with 1-n subreports (currently in .jasper or .jxrml)? Currently only one of my wannabe subreports use datasource (tablemodel) and other wannabe subreports get their data from parameters. I've found several different ways to do something which could end up it a result which I want, but so far no success... Which builders/managers/whatever I need? Getting a bit frustrated because can't find enough info about different classes, methods and their parameters. Why they are there and what is required. Examples don't explain enough... Should I use DynamicReportBuilder to build DynamicReport for the DynamicJasperHelper which generates JasperReport which in turn is filled with JasperFillManager.fillReport method?
has answer: http://stackoverflow.com/a/26646901
favorite count: 0
tagged with: dynamic-jasper
has comment: http://stackoverflow.com/comment/41898614
has title: Adding subreports to master report at runtime (java)
linked to: http://stackoverflow.com/q/53615452
tagged with: subreport
accepted answer: http://stackoverflow.com/a/26646901
has comment: http://stackoverflow.com/comment/41898683
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41898410

http://stackoverflow.com/comment/41796059
type: Comment
has text: thank you for your response. I appreciate it. This code works fine, but how about if I want to use string BufferOutput = "", and return BufferOutput the display the same data without swaping.
type: AnswerComment
comment on: http://stackoverflow.com/a/26590287
score: 0

http://stackoverflow.com/a/26618120
type: Answer
has body: It's pretty much the same, just without the .exe: &lt;path_to_jre&gt;/bin/java -jar Executable.jar
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26618057
downvote count: 0

http://stackoverflow.com/a/76722492
score: 0
type: Answer
has body: Maven doesn't inherently support skipping tests based on whether a module's source code has changed. However, you can approximate such functionality using a combination of Maven profiles and carefully crafted commands. First, if you aren't using them already, modularize your code using Maven Modules. Each module should have its own pom.xml. Then, you can use Maven profiles to skip tests for each module: skipTests <maven.test.skip>true</maven.test.skip> You can activate this profile when building a module to skip tests: mvn clean install -PskipTests Checks which files have changed since the last commit. Determines which module(s) those files belong to. Builds only those modules without skipping tests. Builds the rest of the modules with the skipTests profile active.
answers question: http://stackoverflow.com/q/26543490

http://stackoverflow.com/comment/41783562
type: QuestionComment
score: 2
has text: @hagubear what effect can `flush` have after the file has been `close`d?
comment on: http://stackoverflow.com/q/26583743
type: Comment

http://stackoverflow.com/comment/53316235
type: AnswerComment
has text: If you get some out of memory in playframework when developing a lot, you can try to add "-XX:MaxMetaspaceSize=512m" parameter to make "java.lang.OutOfMemoryError: Metaspace" go away for a little bit longer (there is an issue for memory leak https://github.com/playframework/playframework/issues/3799).
comment on: http://stackoverflow.com/a/30932421
type: Comment
score: 1

http://stackoverflow.com/comment/41728005
score: 0
has text: The loop executes once. When it goes back to the beginning of the loop, it stays at the begninning without going inside the loop. It stays at for(int i = 0; i < z.length()/4; i++) until the argument is true. SO i increments without going in the loop
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26552616

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26519879

http://stackoverflow.com/comment/41682521
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26527815
has text: That's logical.. any idea how to effectively clean repository from unwanted files/directories ?

http://stackoverflow.com/q/26545125
has comment: http://stackoverflow.com/comment/41713898
has comment: http://stackoverflow.com/comment/41713574
has comment: http://stackoverflow.com/comment/41726005
answer count: 0
has title: JWrapper icons on a Linux system
type: UnansweredQuestion
score: 1
tagged with: jwrapper
tagged with: java
has comment: http://stackoverflow.com/comment/41728067
type: Question
has comment: http://stackoverflow.com/comment/41817313
has comment: http://stackoverflow.com/comment/41724336
has body: We use JWrapper for deployment of some of our desktop apps. I must say I am quite impressed with JWrapper, the ease of use and the features it provides. We develop mostly in Linux environments but our clients use mostly Windows. We use JavaFX for our desktop apps with Java 8. We use Java 8 because of the fact that it plays nicely with JavaFX and things like the Date chooser are only available since Java 8. After making sample apps to test the features of JWrapper, with the JRE-1.7 bundle, everything worked like a charm: icons on Linux, Windows and Mac. For our demo apps I had to bundle Java 8 for JWrapper, everything worked fine, the apps installed everywhere and launched after install, but on Linux (Ubuntu) no icons appeared in the Dash. I searched in the ~./local folder for the .desktop files and only found the sample apps' .desktop files there. I scoured the JWrapper forums for similar issues and found one referring to a similar problem, but the question did not get any attention and JWrapper retired their forum a day or two ago in favour of using stackoverflow. Here is the question in the forum: http://www.jwrapper.com/old-forum.html#nabble-td209 This leads me to the conclusion that there is a incompatibility with JWrapper and Java 8 on Linux. I understand Java 8 is still new, and is yet to be bundled and tested by the good people of JWrapper. (I would offer my help with this if you guys are interested) I can go and write the creation of icons (.desktop files) for Linux systems in a JWrapperPostInstallApp but that would only be a workaround. Am I missing something? Does anyone have an already working workaround?
upvote count: 1
has comment: http://stackoverflow.com/comment/41737163
downvote count: 0
has comment: http://stackoverflow.com/comment/41722502
favorite count: 0
has comment: http://stackoverflow.com/comment/41722398
tagged with: linux
has comment: http://stackoverflow.com/comment/41726057

http://stackoverflow.com/q/26627044
has comment: http://stackoverflow.com/comment/41863897
has comment: http://stackoverflow.com/comment/41863383
has answer: http://stackoverflow.com/a/26627336
accepted answer: http://stackoverflow.com/a/26627130
has comment: http://stackoverflow.com/comment/41863407
type: AnsweredQuestion
downvote count: 2
type: Question
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/26627130
answer count: 2
has title: Why do I get a compilation error when using the [] operator?
upvote count: 0
has body: So far I have public static void sort(Collection&lt;Integer&gt; l1){ Iterator&lt;Integer&gt; it = l1.iterator(); while(it.hasNext()){ //meant to be for(int i; i&lt;l1.size(); i++) if(l1[i] &lt; l1[i+1]){ l1[i] = l1[i+1]; l1[i+1] = l1[i]; } } I am getting my error in my if statement.
possible better answer: http://stackoverflow.com/a/26627336
favorite count: 0

http://stackoverflow.com/q/26575286
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26575393
tagged with: infinite-loop
tagged with: bubble-sort
has body: When I try to use my Compare method in my Bubblesort code to determine the alphabetical order of strings to sort, I get stuck in an infinite loop in the Compare method, which works otherwise. Any ideas? Thanks! public static int Compare(String s1 , String s2) { //compares two strings alphabetically int result = 0 ; String newS1 = ""; String newS2 = ""; for (int i = 0; i&lt; s1.length(); i++){ //loop converts strings from uppercase to lowercase char s1Char = s1.charAt(i); if (65 &lt;= s1Char &amp;&amp; s1Char &lt;=90){ s1Char = (char)( (s1Char + 32) ); } newS1 = newS1 + s1Char; } for (int i = 0; i&lt; s2.length(); i++){ char s2Char = s2.charAt(i); if (65 &lt;= s2Char &amp;&amp; s2Char&lt;=90){ s2Char = (char)( (s2Char + 32) ); } newS2 = newS2 + s2Char; } for (int i = 0 ; i &lt;newS1.length();){ //compares the two lowercase strings by ascii value if (newS1.charAt(i) &lt; newS2.charAt(i)){ result = -1 ; System.out.println(newS1+ " is before " +newS2+ " in the dictionary"); break ; } if (newS1.charAt(i) &gt; newS2.charAt(i)){ result = 1 ; System.out.println(newS2+ " is before " +newS1+ " in the dictionary"); break ; } if (newS1.charAt(i) == newS2.charAt(i)) { i++ ; } else { result = 0 ; System.out.println("The words are the same."); break ; } } return result ; } public static int bubbleSort(String[] input_array) { //sorts an array alphabetically int n = input_array.length ; String temp = "" ; int comparisons = 0 ; boolean swap = false ; while (swap == true) { swap = false ; for(int i = 1 ; i &lt; input_array.length - 1 ; ){ if(Compare(input_array[i] , input_array[i+1]) == -1) { //use compare method above comparisons++ ; temp = input_array[i] ; input_array[i] = input_array[i-1] ; //swap if sorting needed input_array[i-1] = temp ; swap = true ; System.out.println(input_array); i++ ; } else { i++ ; } } } return comparisons; } public static void main(String[] args) { // used to test code String[] testArray = {"b" , "c" ,"e" , "d"} ; bubbleSort(testArray) ; }
has answer: http://stackoverflow.com/a/26575396
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has title: Infinite loop when calling a method
has comment: http://stackoverflow.com/comment/41769258
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/26556624
score: 4
has comment: http://stackoverflow.com/comment/41734995
type: AcceptedAnswer
has body: You method is declared to return an int value. This means you are obligated to always return an int value, not just in your if(TH[i].isAlive()) return i; statement. In your case, you return a value if a thread inside the TH array is alive. What you can do is return an error value at the end of your method that will only happen if no threads inside TH are alive. For example, you can add this statement at the end of your method: return -1; This part of the code will only be reached if your loop runs full iteration. Even if you know there will always be an alive thread and this part of the code will actually never be reached, you need to put it there to humor the compiler. Also, your loop condition NotFound is never updated inside your loop. This means you have an infinite loop in case no threads inside TH are alive. You don't really need that variable at all. What you can do is change the loop condition to something like: while(i &lt; TH.length) Or, as it seems the variable PL is the length of TH, you can put: while(i &lt; PL) This would also protect you from an ArrayIndexOutOfBoundsException in case i goes beyond the length of TH
accepted answer of: http://stackoverflow.com/q/26556593
type: Answer
answers question: http://stackoverflow.com/q/26556593
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/41906968
type: Comment
comment on: http://stackoverflow.com/q/26651391
type: QuestionComment
score: 1
has text: try to check this answer: http://stackoverflow.com/questions/6362926/xml-syntax-validation-in-java

http://stackoverflow.com/comment/41809500
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26597486
score: 0
has text: Done. A NullPointerException

http://stackoverflow.com/comment/41771628
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26577015
has text: Why don't you use an ArrayList? It is a dynamic data structure so you do not need to boher with resizing.
type: Comment

http://stackoverflow.com/a/26517533
type: Answer
has comment: http://stackoverflow.com/comment/41700935
upvote count: 1
has body: Yes, it is possible. However, to prevent errors and random problems, you need to read the entire file from the stream and then close the stream before deleting it.
score: 1
answers question: http://stackoverflow.com/q/26517458
has comment: http://stackoverflow.com/comment/41693652
downvote count: 0

filter
tags question: http://stackoverflow.com/q/26591773
tags question: http://stackoverflow.com/q/26640591
tag name: filter
type: Tag
tags question: http://stackoverflow.com/q/26597004
tags question: http://stackoverflow.com/q/26610228
tags question: http://stackoverflow.com/q/26575483

http://stackoverflow.com/a/26531203
type: AcceptedAnswer
has body: You need to initialize the members in InvoiceDate: public class InvoiceDate { private double invoiceAmount; private OurDate todayDate = new OurDate(); private OurDate invoiceDate = new OurDate();
score: 0
answers question: http://stackoverflow.com/q/26519763
accepted answer of: http://stackoverflow.com/q/26519763
type: Answer

http://stackoverflow.com/a/26615303
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26613035
answers question: http://stackoverflow.com/q/26613035
has comment: http://stackoverflow.com/comment/61552143
upvote count: 26
downvote count: 1
type: Answer
has body: The response code is 406 Not Accepted. You need to specify an 'Accept' request header which must match the 'produces' field of your RequestMapping. RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter()); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM)); HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(headers); ResponseEntity&lt;byte[]&gt; response = restTemplate.exchange(URI, HttpMethod.GET, entity, byte[].class, "1"); if(response.getStatusCode().equals(HttpStatus.OK)) { FileOutputStream output = new FileOutputStream(new File("filename.jar")); IOUtils.write(response.getBody(), output); } A small warning: don't do this for large files. RestTemplate.exchange(...) always loads the entire response into memory, so you could get OutOfMemory exceptions. To avoid this, do not use Spring RestTemplate, but rather use the Java standard HttpUrlConnection directly or apache http-components.
score: 25
has comment: http://stackoverflow.com/comment/41909774
has comment: http://stackoverflow.com/comment/62850641

http://stackoverflow.com/comment/41695121
has text: Whoa! Amazing ammount of errors.. this in't good way.. Few examples: `Prime.java:2: error: package javax.servlet does not exist import javax.servlet.ServletException; ^ Prime.java:3: error: package javax.servlet.annotation does not exist import javax.servlet.annotation.WebServlet; ^ Prime.java:12: error: cannot find symbol public class Prime extends HttpServlet {`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26534281

http://stackoverflow.com/comment/41713351
has text: ???? You wanted to delete the second one you said. right1.
score: 0
comment on: http://stackoverflow.com/q/26543301
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41883027
has text: Did you mean to tag this as Java? That looks more like Javascript to me.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26637907

http://stackoverflow.com/comment/41810470
score: 0
comment on: http://stackoverflow.com/a/26595669
type: Comment
has text: doesn't seem to work, where would I place that code in the above program?
type: AnswerComment

http://stackoverflow.com/comment/41944784
type: AnswerComment
has text: What do we set the last element to after setting it to index 1? Do we set it to 0?
comment on: http://stackoverflow.com/a/26671958
type: Comment
score: 0

http://stackoverflow.com/q/26594299
has comment: http://stackoverflow.com/comment/41803457
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41803893
has body: I get following exception: 10-27 18:52:54.699: E/AndroidRuntime(23636): FATAL EXCEPTION: main 10-27 18:52:54.699: E/AndroidRuntime(23636): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.project/com.project.activity.QRScannerActivity_}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.project/com.google.zxing.client.android.CaptureActivity}; have you declared this activity in your AndroidManifest.xml? 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.app.ActivityThread.access$600(ActivityThread.java:153) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.os.Handler.dispatchMessage(Handler.java:99) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.os.Looper.loop(Looper.java:137) 10-27 18:52:54.699: E/AndroidRuntime(23636): at android.app.ActivityThread.main(ActivityThread.java:5227) 10-27 18:52:54.699: E/AndroidRuntime(23636): at java.lang.reflect.Method.invokeNative(Native Method) 10-27 18:52:54.699: E/AndroidRuntime(23636): at java.lang.reflect.Method.invoke(Method.java:511) 10-27 18:52:54.699: E/AndroidRuntime(23636): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 10-27 18:52:54.699: E/AndroidRuntime(23636): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) 10-27 18:52:54.699: E/AndroidRuntime(23636): at dalvik.system.NativeStart.main(Native Method) 10-27 18:52:54.699: E/AndroidRuntime(23636): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.project/com.google.zxing.client.android.CaptureActivity}; have you declared this activity in yo…
type: UnansweredQuestion
tagged with: android
tagged with: shared-libraries
answer count: 0
score: 1
tagged with: java
tagged with: zxing
upvote count: 1
type: Question
tagged with: qr-code
has title: Unable to find explicit activity class {.CaptureActivity}; .. in manifest when calling ZXScanHelper.scan
has comment: http://stackoverflow.com/comment/41803754

http://stackoverflow.com/a/26593010
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26588540
has body: When you create a TableView&lt;S&gt;, S is the type of the object displayed in each row of the table. The items property of the table, which is an ObservableList&lt;S&gt; contains the collection of items, each one of which is displayed in a table row. If your data is in the form ObservableList&lt;ObservableList&lt;Stitch&gt;&gt; stitchList, then you need a TableView&lt;ObservableList&lt;Stitch&gt;&gt;. (In other words, S is ObservableList&lt;Stitch&gt;.) Each element of stitchList, which is an ObservableList&lt;Stitch&gt; represents a row in the table. TableView is not designed with ObservableList&lt;ObservableList&gt; as the primary use case for representing data, so you need to do a little bit of work to get the cellValueFactory to work right. If you are certain that every row has the same number of items, you can perhaps minimize this a bit, but you need something like the following: TableView&lt;ObservableList&lt;Stitch&gt;&gt; pattern = new TableView&lt;&gt;(); ObservableList&lt;ObservableList&lt;Stitch&gt;&gt; stitchList = ... ; // Set items (i.e. rows) in table: pattern.setItems(stitchList); // iterate through all rows: for (ObservableList&lt;Stitch&gt; row : pattern) { // if this row contains more elements than columns we have already created, // (must be true on first row, may be true on subsequent rows if data not rectangular) // create a new column for each additional element for (int i = pattern.getColumns().size(); i &lt; row.size() ; i++) { TableColumn&lt;ObservableList&lt;Stitch&gt;, Color&gt; column = new TableColumn&lt;&gt;(); final int columnIndex = i ; column.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;ObservableList&lt;Stitch&gt;, Color&gt;, ObservableValue&lt;Color&gt;&gt;() { @Override public ObservableValue&lt;Stitch&gt; call(CellDataFeatures&lt;ObservableList&lt;Stitch&gt;, Stitch&gt;&gt; stitch) { return stitch.getValue() // the row value, i.e. an ObservableList&lt;Stitch&gt; .get(columnIndex) // the Stitch for this cell .getDisp…
answers question: http://stackoverflow.com/q/26588540

http://stackoverflow.com/q/26554814
linked to: http://stackoverflow.com/q/22945117
upvote count: 11
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
has title: JavaFx - Updating GUI
has body: All I wanted is to update a label as my program is running. I am reading some files and I wanted it to display the name of the file is was reading. However, it only displays the last file using the code below (basically GUI doesn't respond until the whole process is completed): static Text m_status_update = new Text(); //I declared this outside the function so dont worry m_status_update.setText("Currently reading " + file.getName()); I got around 4-5 files and I just want to display the name. I saw a similar question Displaying changing values in JavaFx Label , the best answer recommended the following: Label myLabel = new Label("Start"); //I declared this outside the function so dont worry myLabel.textProperty().bind(valueProperty); However the valueProperty is a StringProperty and I am stuck converting a string into a string property. Also, I saw this Refresh label in JAVAFX , but the OP could update the label based on action. I really dont have any action going on?
linked to: http://stackoverflow.com/q/13227809
has answer: http://stackoverflow.com/a/26555262
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41732036
favorite count: 0
has comment: http://stackoverflow.com/comment/41731915
accepted answer: http://stackoverflow.com/a/26555262
has comment: http://stackoverflow.com/comment/41731891
has comment: http://stackoverflow.com/comment/41731868
score: 11

http://stackoverflow.com/comment/128235977
has text: @AshishAugustine it depends on the project you are working on. Java configuration is more modern way.
type: AnswerComment
comment on: http://stackoverflow.com/a/26563519
score: 0
type: Comment

http://stackoverflow.com/q/26529054
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26529415
type: Question
tagged with: casting
tagged with: eclipse
upvote count: 1
answer count: 1
tagged with: adapter
tagged with: eclipse-plugin
favorite count: 0
has body: If you get a selection of projects as IStructuredSelection, use .toArray() to get their Object[]-content, then why does casting each Object to IAdaptable and then simply casting again to IJavaProject work fine for me and I get all the Classes/Interfaces with their methods.... But when using (IJavaProject) adaptable.getAdapter(IJavaProject.class) instead, some interface methods get lost? What exactly does the Adapter do (other than "Returns an object which is an instance of the given class parameter...") and why does everyone recommend to use it instead of a cast? Here is the relevant code IAdaptable adaptable = (IAdaptable) selectedObject; IJavaProject javaProject = (IJavaProject) adaptable.getAdapter(IJavaProject.class); final IProject iProject = javaProject.getProject(); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); final IJavaProject javaRefreshedProject = JavaCore.create(iProject); //processing further using ASTParser and CompilationUnit
accepted answer: http://stackoverflow.com/a/26529415
type: AnsweredQuestion
has title: Eclipse plugin - what is the benefit of using Adapter instead of a cast?
downvote count: 0

http://stackoverflow.com/q/26563439
has comment: http://stackoverflow.com/comment/41746890
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26563773
has body: Ok. I have two classes. One is my GUI and the other has an ArrayList on it. The GUI is working great and my ActionListeners are all working fine. My question is - how i take the inputs from the textfields and zap them across into my ArrayList for further processing? How do I get the values that have been entered into textfeilds in one class into an ArrayList in another class? I know how to populate the ArrayList. I just don't no how to populate tha ArrayList using information from a textfeild in a different class.
tagged with: java
has comment: http://stackoverflow.com/comment/41746641
has comment: http://stackoverflow.com/comment/41746826
tagged with: jtextfield
type: Question
tagged with: actionlistener
has title: How do I get input from a JtextField in one class to an ArrayList in another class. Java
tagged with: arraylist
score: 0
answer count: 1
tagged with: string

http://stackoverflow.com/comment/41890543
score: 0
type: AnswerComment
type: Comment
has text: @RealSkeptic the result is: `9`
comment on: http://stackoverflow.com/a/26641499

http://stackoverflow.com/q/26651462
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41910727
has comment: http://stackoverflow.com/comment/41907163
tagged with: swing
has comment: http://stackoverflow.com/comment/41910653
type: Question
score: 0
has body: I am trying to develop an Java code in which regular/irregular shapes will be arranged in that manner so that I can utilize whole page consider. I want make an application which will try to find all possible way to arrange the custom shapes into given area, so that I can utilize my area as much possible. I have read the to generating probability using Random class. Also I've made small snippet I know its not working as I stated but I want to arrange these shape. Any algorithm or link would be appreciated. Here is my code: import javax.swing.*; import java.awt.*; import java.util.Random; public class DrawGraph { JPanel panel; JFrame frame; Random rand; public DrawGraph() { frame = new JFrame("Graph"); rand = new Random(); panel = new JPanel(){ private static final long serialVersionUID = 1L; protected void paintComponent(Graphics g2) { super.paintComponents(g2); Graphics2D g = (Graphics2D) g2; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.black); int i,j,x=0,y=0; int width = panel.getWidth(); int height = panel.getHeight(); int intervalX = (int)Math.round(width*0.02); int intervalY = (int)Math.round(height*0.02); for(i=0,j=0;i&lt;=width || j&lt;=height;i+=intervalX,j+=intervalY) { g.drawLine(x, j, width, j); g.drawLine(i,y,i,height); } g.setColor(Color.GREEN); for(i=1;i&lt;=5;i++) generateShape(g); } }; frame.setSize(400,400); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setVisible(true); } public void generateShape(Graphics2D g) { //demo shape int radius = rand.nextInt(200); int originX,originY; originX = rand.nextInt(300-10) + 10; originY = rand.nextInt(300-10) + 10; g.setStroke(new BasicStroke(5)); g.drawOval(originX, originY, radius, radius); } public static void main(String[] args) { // TODO Auto-generated method stub new DrawGraph(); } } Here the output: I want to use t…
has comment: http://stackoverflow.com/comment/41910835
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/41916201
has comment: http://stackoverflow.com/comment/41907120
has title: Java - Arranging irregular shapes
answer count: 0

http://stackoverflow.com/a/26572679
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41763403
has body: "the problem is that I can't initialize such this kind of arrays because I don't know what its second dimension will be.." You want to look into the collections framework which allows you to create lists without specifying size. So: ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); Then you can add stufff to list: list.add("stuff"); list.add("stuff2"); list.add("stuff3"); //as many time as you want Loop for(String str : list) { System.out.println(str); } And then rest of code. For a tutorial on collections, checkout caveOfProgramming
answers question: http://stackoverflow.com/q/26572497
upvote count: 1
has comment: http://stackoverflow.com/comment/41763495

http://stackoverflow.com/q/26608574
type: UnansweredQuestion
downvote count: 6
has title: No main method detected
has comment: http://stackoverflow.com/comment/41829801
tagged with: java
type: Question
has body: The compiler keeps saying there is no main method but there is one: import java.util.HashMap; import java.util.Map; import java.util.Scanner; class StarWarsFinal { final static Map&lt;String, String&gt; firstNameMap = new HashMap&lt;&gt;(); static { firstNameMap.put("A", "Cho"); firstNameMap.put("B", "R2"); firstNameMap.put("C", "C-3po"); firstNameMap.put("D", "Yod"); firstNameMap.put("E", "Nas"); firstNameMap.put("F", "Slea"); firstNameMap.put("G", "Jan"); firstNameMap.put("H", "Zhur"); firstNameMap.put("I", "Boba"); firstNameMap.put("J", "Thre"); firstNameMap.put("K", "Bib"); firstNameMap.put("L", "Kit"); firstNameMap.put("M", "Kyp"); firstNameMap.put("N", "Gonk"); firstNameMap.put("O", "Zlung"); firstNameMap.put("P", "Adi"); firstNameMap.put("Q", "Nat"); firstNameMap.put("R", "Ru"); firstNameMap.put("S", "Cla"); firstNameMap.put("T", "Kir"); firstNameMap.put("U", "Obi"); firstNameMap.put("V", "Ken"); firstNameMap.put("W", "Ziro"); firstNameMap.put("X", "Zev"); firstNameMap.put("Y", "Tavion"); firstNameMap.put("Z", "Jar"); } final static Map&lt;String, String&gt; lastNameMap = new HashMap&lt;&gt;(); static { lastNameMap.put("A", "tzki"); lastNameMap.put("B", "hut"); lastNameMap.put("C", "der"); lastNameMap.put("D", "kzos"); lastNameMap.put("E", "vos"); lastNameMap.put("F", "vader"); lastNameMap.put("G", "thrawn"); lastNameMap.put("H", "mesk"); lastNameMap.put("I", "thuo"); lastNameMap.put("J", "skywalker"); lastNameMap.put("K", "D2"); lastNameMap.put("L", "maul"); lastNameMap.put("M", "sith"); lastNameMap.put("N", "muzzar"); lastNameMap.put("O", "jusik"); lastNameMap.put("P", "horn"); lastNameMap.put("Q", "phisto"); lastNameMap.put("R", "farlander"); lastNameMap.put("S", "dunhaussan"); lastNameMap.put("T", "jar"); lastNameMap.put("U", "binks"); lastNameMap.put("V", "lbis"); lastNameMap.put("W", "gnarzlo"); lastNameMap.put("X", "anakin"); lastNameMap.put("Y", "ackbur"); lastNameMap.put("Z", "axmis"); } final static Map&lt;String, String&gt; jobMap = new HashMap&lt;…
has comment: http://stackoverflow.com/comment/41829618
has answer: http://stackoverflow.com/a/26609132
tagged with: class
has comment: http://stackoverflow.com/comment/41830210
upvote count: 0
has comment: http://stackoverflow.com/comment/41829939
tagged with: program-entry-point
answer count: 1
has comment: http://stackoverflow.com/comment/41829713
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/41829346

http://stackoverflow.com/a/26661823
has comment: http://stackoverflow.com/comment/41949389
type: AcceptedAnswer
downvote count: 0
has body: Paypal is fixing this issue soon. https://github.com/paypal/PayPal-PHP-SDK/issues/146 For the time being you can add a ? to the end of your urls. "redirect_urls": { "return_url": "...confirm?", "cancel_url": "...checkout?" }
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26634777
answers question: http://stackoverflow.com/q/26634777

http://stackoverflow.com/q/26625752
tagged with: vala
accepted answer: http://stackoverflow.com/a/26627753
tagged with: webkit2
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: swt
has title: fatal error: webkit2/webkit2.h: No such file or directory
type: Question
possible better answer: http://stackoverflow.com/a/26627727
has answer: http://stackoverflow.com/a/26627727
has answer: http://stackoverflow.com/a/26627753
tagged with: eclipse
answer count: 2
has body: On Arch Linux, after upgrading to Gnome 3.14, I have several troubles with Webkit2Gtk. Vala: Consider the following vala test: using Gtk; using WebKit; public class ValaWebkit : Window { private WebView web_view; public ValaWebkit(){ this.title = "Testing youtube"; set_default_size (800, 600); web_view = new WebView(); add(web_view); //this.web_view.open ("http://www.youtube.com/"); this.web_view.load_uri ("https://www.youtube.com/"); } public static int main (string[] args) { Gtk.init (ref args); new ValaWebkit().show_all(); Gtk.main(); return 0; } } Before upgrading to Gnome 3.14, I could copile like this valac --pkg gtk+-3.0 --pkg webkit2gtk-3.0 --vapidir . valawebkit.vala (I'm not pasting here webkit2gtk-3.0.vapi because it's too long). Now with gnome 3.14 if I try to compile i get /home/luca/Sources/vala/webkit test/valawebkit.vala.c:8:29: fatal error: webkit2/webkit2.h: No such file or directory #include &lt;webkit2/webkit2.h&gt; ^ compilation terminated. error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) Also, If I try to run the binary that I had compiled BEFORE upgrading to Gnome 3.14, I get this error: ./valawebkit: error while loading shared libraries: libwebkit2gtk-3.0.so.25: cannot open shared object file: No such file or directory 2) GJS / Eclipse / Java (SWT): If I run either this gjs example, or eclipse (luna) or any other swt 4.4 based app, I get the following: No bp log location saved, using default. [000:000] Cpu: 6.58.9, x4, 2600Mhz, 7847MB [000:000] Computer model: Not available [000:000] Browser XEmbed support present: 1 [000:000] Browser toolkit is Gtk2. [000:004] Using Gtk2 toolkit [000:004] Warning(optionsfile.cc:47): Load: Could not open file, err=2 [000:004] No bp log location saved, using default. I have the feeling that it is a kind of packaging issue on ArchLinux and Gnome 3.14. Does anyone is having the same issue? Is there a workaround both to compile and run against webkit2gtk? EDIT I made a little progress…

http://stackoverflow.com/q/26644903
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I have built an embedded web server by extending NanoHTTPD (1.25). It is used for Firefox browser to show its content within the same machine. (SuSE 11) Since the Firefox needs to show changing content within a very short duration (0.2 sec refreshment), it keeps polling the JSON URLs very quickly. setInterval(function() { $.getJSON("content.json", function(d) { ... $('#content_div').html(d); }) .error(function() { $('#content_div').html(""); }); }, 200); As a result, it creates a lot of unused connections and sometimes cannot get any response from my web server. netstat -ap |grep "localhost:80" |wc -l (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) 2212 Why are there so many TIME_WAIT connections? How can I make my web server healthy and ensure response from my web server?
tagged with: firefox
answer count: 1
accepted answer: http://stackoverflow.com/a/26645007
tagged with: javascript
tagged with: jquery
tagged with: nanohttpd
has answer: http://stackoverflow.com/a/26645007
has title: Reduce unused firefox connection

http://stackoverflow.com/q/26514278
tagged with: hashcode
score: 0
tagged with: java
tagged with: hibernate
tagged with: set
has body: How do I make my code to add identical objects to a SET? I guess I will have to do something with hashcode() or equal() functions. Class Order { private id; private Set&lt;Discount&gt;; } Class Discount { private id; private Long amount; } Now if I try to save two discounts of $1 each, the SET only shows one discount. When hibernate saves it, discounts will have different IDs, but they are same as of now. Don;t want to change the definition of Order class, as it's a big project and changes will be endless
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41659528
has comment: http://stackoverflow.com/comment/41658400
has answer: http://stackoverflow.com/a/26515321
has comment: http://stackoverflow.com/comment/41658479
has comment: http://stackoverflow.com/comment/41658504
has comment: http://stackoverflow.com/comment/41658548
has answer: http://stackoverflow.com/a/26515104
has comment: http://stackoverflow.com/comment/41658562
has title: Add identical objects to a Set<E>
favorite count: 0
has comment: http://stackoverflow.com/comment/41658476
tagged with: equals
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/26634426
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/26658038
tagged with: java
has comment: http://stackoverflow.com/comment/41876681
upvote count: 1
has comment: http://stackoverflow.com/comment/41876612
possible better answer: http://stackoverflow.com/a/26655305
has answer: http://stackoverflow.com/a/26655305
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41904397
downvote count: 0
has title: Spring Boot external configuration and xml context
score: 1
favorite count: 0
type: Question
has body: I want to externalize my configuration with Spring Boot, but I want to continue to partially use my xml context. My main class SpringServerApplication.java : @Configuration @PropertySources(value = {@PropertySource("classpath:/application.properties")}) public class SpringServerApplication { public static void main(String[] args) throws Exception { SpringApplication.run(new Object[] { SpringServerApplication.class, "classpath:ApplicationContextServer.xml" }, args); } } I put my configuration in application.properties. And in ApplicationContextServer.xml, I want to use some parameter like this : ${user}. But it does not work. Thanks in advance for your help.
has answer: http://stackoverflow.com/a/26658038
answer count: 2
tagged with: spring

http://stackoverflow.com/q/26567359
linked to: http://stackoverflow.com/q/4274606
score: 1
tagged with: java
tagged with: cursor
duplicate of: http://stackoverflow.com/q/7211029
upvote count: 1
has comment: http://stackoverflow.com/comment/41754991
has comment: http://stackoverflow.com/comment/41756934
linked to: http://stackoverflow.com/q/7211029
has title: Nice looking hand cursor with drop shadow?
favorite count: 0
has comment: http://stackoverflow.com/comment/41758520
answer count: 0
downvote count: 0
has body: How to get nice looking Hand cursor, similar to Default cursor and Wait cursor. For example: Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); on windows l&amp;f (windows 7) returns nice looking animated cursor with drop shadow, while Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); returns win98-style plain Hand cursor without drop shadow. Since cursors in java don't support semi-transparent pixels in cursor images, how do I get drop shadow effect? Or is there another way to get nice looking win7 Hand cursor?
type: UnansweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/comment/41782383
comment on: http://stackoverflow.com/q/26581752
score: 0
has text: Also check the targetSdkVersion in your AndroidManifest.xml to ensure that it's set to the newest API level (e.g. android:targetSdkVersion="21").
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26579646
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26579083
has body: C and C++ are intended to work with the native representation on machines using 1s or 2s complement or signed magnitude. With 2s complement you get a range from -2 n through 2 n -1, about like in Java. Otherwise you lose the most negative number and gain a representation for -0. In C++ you're only guaranteed that n (the number of bits)is at least 16 where Java guarantees it's exactly 32.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41809457
has text: Have you checked your network connection?
comment on: http://stackoverflow.com/q/26597506
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26530677
has answer: http://stackoverflow.com/a/26618197
has answer: http://stackoverflow.com/a/29942016
has comment: http://stackoverflow.com/comment/41688343
has comment: http://stackoverflow.com/comment/41688820
tagged with: logging
has title: Why "Failed to define class" WARN from server startup?
type: AnsweredQuestion
has body: When I execute liquibase in JBoss I get the following WARN but everything is updated correctly: 12:32:01,499 WARN [org.jboss.modules] (ServerService Thread Pool -- 49) Failed to define class liquibase.sdk.watch.WatchCommand$DynamicContentHandler in Module "deployment.WebStories.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link liquibase/sdk/watch/WatchCommand$DynamicContentHandler (Module "deployment.WebStories.war:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:407) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:254) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.Module.loadModuleClass(Module.java:518) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1] at liquibase.servicelocator.DefaultPackageScanClassResolver.loadClass(DefaultPackageScanClassResolver.java:358) [liquibase-core-3.2.2.jar:] at liquibase.servicelocator.DefaultPackageScanClassResolver.loadImplementationsInJar(DefaultPackageScanClassResolver.java:406) [liquibase-core-3.2.2.jar:] at liquibase.servicelocator.DefaultPackageScanClassResolver.findAllClasses(DefaultPackageScanClassResolver.java:226) [liquibase-core-3.2.2.jar:] at liquibase.servicelocator.DefaultPackageScanClass…
tagged with: java
tagged with: liquibase
accepted answer: http://stackoverflow.com/a/26618197
has comment: http://stackoverflow.com/comment/41688649
score: 9
type: Question
has comment: http://stackoverflow.com/comment/41776669
upvote count: 9
has answer: http://stackoverflow.com/a/63660474
has comment: http://stackoverflow.com/comment/41776646
tagged with: jboss
has comment: http://stackoverflow.com/comment/41776580
answer count: 3
has comment: http://stackoverflow.com/comment/41693976
downvote count: 0
possible better answer: http://stackoverflow.com/a/29942016
favorite count: 0

http://stackoverflow.com/q/26559098
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41738967
has comment: http://stackoverflow.com/comment/41738980
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41738947
tagged with: charat
has answer: http://stackoverflow.com/a/26559153
has title: Creating a program that will give the number of A's both lower and upper case in the user entered string (java)
type: Question
accepted answer: http://stackoverflow.com/a/26559153
score: -2
possible better answer: http://stackoverflow.com/a/26559121
has answer: http://stackoverflow.com/a/26559121
has comment: http://stackoverflow.com/comment/41738968
tagged with: char
answer count: 3
has answer: http://stackoverflow.com/a/26559184
upvote count: 0
tagged with: string
favorite count: 0
has body: Alright, so here is my dilemma. Unfortunately my Java teacher does not teach how to start the projects in class, nor does he tell us where to find the information to start the program. This is my first programming course, so I'm still trying to learn a few things. So, lets get to the point, he wants it to look like this: This program is written by Ben Barcomb Enter a String: Alaska Number of A: 3 //End of program That is it. I just don't know where to start. Any help would be greatly appreciated! This is what I have right now. The program ends after I enter Alaska. import java.util.Scanner; public class P4_BenjaminBarcomb { public static void main(String[] args) { System.out.println("This program is written by Benjamin Barcomb\n"); Scanner kb = new Scanner(System.in); int counter = 0; System.out.print("Enter a String: "); String word = kb.next(); for (int i = 0; i &lt; word.length(); i++) { if (word.substring(i, i+1).equalsIgnoreCase("a")) counter++; } } }

http://stackoverflow.com/comment/41671519
type: QuestionComment
has text: And? Seems pretty obvious to me...
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26521231

http://stackoverflow.com/q/26628867
type: Question
has answer: http://stackoverflow.com/a/26629219
has body: i need to create a table in access database. For this i tried with the following code public class Testac { public static void main(String[] args) { try { System.out.println("Begining conn"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String accessFileName = "Centre"; String connURL = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.accdb);DBQ=" + accessFileName + ".accdb;PWD="; Connection con = DriverManager.getConnection(connURL, "", ""); Statement stmt = con.createStatement(); System.out.println("Conn done succesfully"); stmt.execute("create table student ( Name string, ID integer )"); // create a student stmt.execute("insert into student values(‘Md. SHAHJALAL’, ‘02223540’)"); // insert data into student stmt.execute("select * from student"); // execute query in table student ResultSet rs = stmt.getResultSet(); // get any Resultt that came from our query if (rs != null) { while (rs.next()) { System.out.println("Name: " + rs.getString("Name") + " ID: " + rs.getString("ID")); } } stmt.close(); con.close(); } catch (Exception err) { System.out.println("ERROR: " + err); } } } But it throws the following error " ERROR: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ".
answer count: 3
has title: How to create a table in access database using java
downvote count: 0
tagged with: ms-access
favorite count: 0
has answer: http://stackoverflow.com/a/26629189
has answer: http://stackoverflow.com/a/26631491
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/26655839
has comment: http://stackoverflow.com/comment/41914388
has comment: http://stackoverflow.com/comment/41928150
type: Answer
answers question: http://stackoverflow.com/q/26654963
has body: Try designating the null item as a noSelectionOption, since it looks like that's your intention anyway: &lt;h:selectOneMenu id="city" value="#{cc.attrs.city}" converter="anySelectConverter"&gt; &lt;f:selectItem itemLabel="#{msg['general.choose']}" itemValue="#{null}" noSelectionOption="true"/&gt; &lt;f:selectItems itemLabel="#{city.name}" itemValue="#{city}" var="city" value="#{locationComponentController.getAllCities()}" /&gt; &lt;p:ajax event="valueChange" update="district subdistrict village neighbourhood #{cc.attrs.updateOnSelection}" /&gt; &lt;/h:selectOneMenu&gt;
score: 0

http://stackoverflow.com/a/26629285
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26629250
downvote count: 0
has body: You need to escape the special characters like this : String s = "String res=\"\"id\":\"565\",\"value\":\"Y\"";
type: Answer

http://stackoverflow.com/comment/41786991
has text: @waqaslam and how can i do this?
comment on: http://stackoverflow.com/q/26585521
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26539021
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41703471
possible better answer: http://stackoverflow.com/a/26539991
has comment: http://stackoverflow.com/comment/41704171
has comment: http://stackoverflow.com/comment/41703611
has body: Here is my problem. I want to document a piece of program and want to express something, I believed quite common among the programming community, but can't hack the idea into a word. Take a look at this class : public class RemoteClient { private InetSocketAddress remoteAddress; /*+ some other fields not in the scope of this topic*/ public RemoteClient(String hostName, int port /*+ some other arguments not in the scope of this topic*/){ this.remoteAddress=new InetSocketAddress(hostName, port); } public InetSocketAddress getRemoteAddress() { return this.remoteAddress; } } The obvious problem in a multithreaded environment is that the caller of the constructor has no guaranty that hostName will be resolved, and therefore build time is not deterministic. It would be, I believe, much better if the construction of InetSocketAddress was lazy, such as follow : public class RemoteClient { private volatile InetSocketAddress remoteAddress; private final String hostName; private final int port; /*+ some other fields not in the scope of this topic*/ public RemoteClient(String hostName, int port /*+ some other arguments not in the scope of this topic*/){ this.hostName=hostName; this.port=port; } /** lazy instanciation **/ public InetSocketAddress getRemoteAddress() { if(remoteAddress==null){ synchronized(hostName){ if(remoteAddress==null){ this.remoteAddress=new InetSocketAddress(hostName, port); } } } return this.remoteAddress; } } So in this case, the Thread calling the constructor operator, which might at some time build from a list of host names, has no more network-related indetermination. It is now delegated to the Thread in charge of communication with the remote client. My questions are : can you give reasons why the second proposition is/isn't better designed? could you put a word on the idiom behind this practice ? I believe this is not a opinion-based topic, as I'm asking for a design.
has answer: http://stackoverflow.com/a/26540284
answer count: 3
linked to: http://stackoverflow.com/q/3964211
has comment: http://stackoverflow.com/comment/41703451
upvote count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/801993
has answer: http://stackoverflow.com/a/26539991
favorite count: 0
has title: Can't find the design / programming idiom behind a intuitively good practice : give your object construction a deterministic period
has comment: http://stackoverflow.com/comment/41703464
has answer: http://stackoverflow.com/a/26539643
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41703534
has comment: http://stackoverflow.com/comment/41703356
has comment: http://stackoverflow.com/comment/41704202
type: Question
tagged with: deterministic
accepted answer: http://stackoverflow.com/a/26540284

resteasy
tags question: http://stackoverflow.com/q/26526830
tag name: resteasy
type: Tag
tags question: http://stackoverflow.com/q/26651419
tags question: http://stackoverflow.com/q/26550660
tags question: http://stackoverflow.com/q/26666956

http://stackoverflow.com/q/26634346
has title: Why does JBoss web app work fine without web.xml?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26635163
possible better answer: http://stackoverflow.com/a/26634547
type: Question
has answer: http://stackoverflow.com/a/26635163
tagged with: jboss
tagged with: eclipse
tagged with: servlets
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26634547
favorite count: 0
has body: I'm developing my first web application with JBoss with Eclipse Luna and Windfly as server. Looking in the WEB-INF i cannot find the web.xml file. It is all ok, the application works, but where are the web.xml settings located? How can i change, for example, the class-URL associations? Please note that i can't see any annotation inside the classes i've coded.

http://stackoverflow.com/a/26624197
has comment: http://stackoverflow.com/comment/41858942
has comment: http://stackoverflow.com/comment/41859308
has comment: http://stackoverflow.com/comment/41858288
has comment: http://stackoverflow.com/comment/41859209
has comment: http://stackoverflow.com/comment/41858508
has comment: http://stackoverflow.com/comment/41858344
has body: The instance variables are the private members of your class : private int month; private int day; private int year; You are expected to write a constructor that accepts 3 parameters and assigns them to those instance variables.
score: 0
has comment: http://stackoverflow.com/comment/41858612
has comment: http://stackoverflow.com/comment/41858716
type: Answer
answers question: http://stackoverflow.com/q/26624153
has comment: http://stackoverflow.com/comment/41859303

http://stackoverflow.com/comment/41814004
score: 0
type: Comment
type: QuestionComment
has text: oh, how do i implement it, because it will depend on user click. is there a way i can auto create a new one when user click.sorry i am new and have lot to learn
comment on: http://stackoverflow.com/q/26599794

http://stackoverflow.com/a/71706069
type: Answer
has comment: http://stackoverflow.com/comment/126795549
has comment: http://stackoverflow.com/comment/126762324
has comment: http://stackoverflow.com/comment/126822376
has body: For me it was a conflict with jakarta.validation version 3.0.1. Rolling it back to 2.0.2 fixed it.
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26637800
has comment: http://stackoverflow.com/comment/126795107

http://stackoverflow.com/q/26543904
tagged with: stomp
tagged with: spring-websocket
has title: Stomp over websocket : The send buffer size exceeded the allowed limit
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/80644678
answer count: 1
has answer: http://stackoverflow.com/a/29072606
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/78166102
tagged with: spring-4
tagged with: java
has body: At client side I am using Stomp for websocket connection and server side I am using Spring 4 It client side I did configuration as var socket = new SockJS(urlBase + "/" + contextroot+'/hello'); stompClient = Stomp.over(socket); Below code executed for every 2 second to send data to server stompClient.send('/app/sendRequest/'+indexVal, {}, JSON.stringify({index : simIndex})); Server respond to below queue stompClient.subscribe('/queue/response', processResponseObj); at server side configuration done as &lt;websocket:message-broker application-destination-prefix="/app"&gt; &lt;!--&lt;websocket:transport send-timeout="15000" message-size="1051648" send-buffer-size="1051648"/&gt; --&gt; &lt;websocket:stomp-endpoint path="/hello"&gt; &lt;websocket:sockjs /&gt; &lt;/websocket:stomp-endpoint&gt; &lt;websocket:stomp-broker-relay prefix="/topic, /queue" /&gt; &lt;websocket:message-converters&gt; &lt;beans:bean class="org.springframework.messaging.converter.MappingJackson2MessageConverter"&gt; &lt;beans:property name="objectMapper" ref="objectMapper" /&gt; &lt;/beans:bean&gt; &lt;/websocket:message-converters&gt; &lt;/websocket:message-broker&gt; Message responsded as at server side messagingTemplate.convertAndSend("/queue/response",obj); After some second I am getting error message 2014-10-24 16:39:33,869 ERROR et.messaging.SubProtocolWebSocketHandler: 330 - Terminating session id 'dkbzrkxp' org.springframework.web.socket.handler.SessionLimitExceededException: The send buffer size 1147188 bytes for session 'dkbzrkxp exceeded the allowed limit 1051648 at org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator.sessionLimitReached(ConcurrentWebSocketSessionDecorator.java:162) ~[ConcurrentWebSocketSessionDecorator.class:4.0.6.RELEASE] at org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator.checkSessionLimits(ConcurrentWebSocketSessionDecorator.java:150) ~[ConcurrentWebSocketSessionDecorator.class:4.0.6.RELEASE] at org.springframework.web.…
upvote count: 10
type: Question

http://stackoverflow.com/comment/41737759
type: Comment
has text: I'd probably add some sort of function to do the problems. They're all likely doing the same things: Printing 2 lines asking for input, taking in 2 numbers as input, and performing a single operation. Edit: To clarify, I'd use a switch statement on `Conf` for 1 to 6 that calls some `doMath()` function, with a parameter specifying the math type.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26558121

http://stackoverflow.com/a/26578440
has body: You're on the right track. I can see you're confused about your setters. Title, Author, and Serial Number are variables accessible to the whole class, so in your setters you can directly place values inside of them. In the parameter of your setters, you should have a different name than the names of these variables. For example: public void setTitle(String t) { title = t; } the function will have a string passed through its parameters (String t) and that value is placed inside title. Right now, you're placing the default values into the variable setters, and that is incorrect. The default values are for the default constructor, which you did correctly. To help you understand a little more, I'll give you an example of what your test classes might look like: Manual myManual = new Manual(); //now that the Manual Object has been instantiated, //the variables contain the default values from your //default constructor. myManual.setTitle("Some Title"); //"Some Title" was passed through the parameters of the //setTitle method, and the title variable in Manual is equal //that value On a side note, you could always capitalize the beginning of a word following the first word in titles of methods, variables, etc. setTitle, getAuthor, etc EDIT: The first snippet of code is how your setters should look in the Manual class. You should change all your setters to look similar in format. The second few lines with all the comments would be in the main method. Also, I looked at your pastebin code and you still are setting the variables in your setters to the default values. That is not correct. You should be setting your variable to whatever was passed through the parameter.
score: 0
has comment: http://stackoverflow.com/comment/41774481
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26578257
answers question: http://stackoverflow.com/q/26578257
has comment: http://stackoverflow.com/comment/41774255

http://stackoverflow.com/q/26529128
type: Question
answer count: 2
tagged with: jar
favorite count: 0
accepted answer: http://stackoverflow.com/a/26529236
has comment: http://stackoverflow.com/comment/41686095
has answer: http://stackoverflow.com/a/26529252
has comment: http://stackoverflow.com/comment/41687190
upvote count: 2
possible better answer: http://stackoverflow.com/a/26529252
has comment: http://stackoverflow.com/comment/41685959
downvote count: 1
has comment: http://stackoverflow.com/comment/41685822
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26529236
score: 1
tagged with: java
has title: Remote Updating of JAR file
has body: I have a JAR file of a project which im creating for a business. It will be places on their network drive and ran from there by several people throughout the company. I will be leaving the business soon but would like the ability to remotely update the JAR file with small bugfixes if anything is reported. Ideally its as simple as placing a new JAR in a folder on server and current JAR will check for update on launch and update if necessary. The same effect with an Android App or Firefox. Whats the most common way of doing this?
has comment: http://stackoverflow.com/comment/41684932

http://stackoverflow.com/comment/41797977
score: 0
type: Comment
type: AnswerComment
has text: Seems I'm wasting my time. The original problem still occurs (graphical glitches when phone sleeps) and it might be because I've got a GLSurfaceView attached to a view in the Main Activity's XML layout. When the screen rotates (to show lock screen) this seems to corrupt my app.
comment on: http://stackoverflow.com/a/26586726

http://stackoverflow.com/comment/41769160
type: AnswerComment
comment on: http://stackoverflow.com/a/26575682
has text: It worked, thank you! I've almost been ripping my hair off. What does the last parameter do?
type: Comment
score: 0

http://stackoverflow.com/a/32051438
score: 0
answers question: http://stackoverflow.com/q/26603717
type: Answer
has body: You cannot disable constraint checking in hibernate, because hibernate shows an errror which was originally thrown by your database. You are probably using the same database connection for inserting the data. But as you said you have multiple DBs, you need to get a connection/session for your other database. If the table is well defined, you can insert without any reference to other books. Also, you'd need to remove the joins, since those are only for tables in the same column. You need to join Books and Covers manually, if those tables do not share the same database (and thus session).

http://stackoverflow.com/comment/41955749
has text: when i tried this it started kicking off and underlying session in read saying 'cannot find symbol' in net beans. any reason why?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26678310
type: AnswerComment

http://stackoverflow.com/a/26575344
has body: Your code is hard to test because the responsibilities aren't correctly separated. The WidgetBoundary almost doesn't do anything, and delegates everything to the WidgetService. The WidgetService mixes business logic (like checking if a widget is discontinued before creating it) with persistence logic (like saving or querying widgets). That makes the WidgetBoundary completely dumb, and not really worth to test, whereas the WidgetService is too complex to be tested easily. The business logic should be moved to the boundary (which I would call a service). The service (which should be called a DAO) should only contain persistence logic. That way, you can test that the queries executed by the DAO work correctly (by populating your database with test data, calling the query method, and see if it returns the correct data). And you can also test the business logic easily and quickly, by mocking the DAO. That way, you don't need any database to test the business logic. For example, a test of the createWidget() method could look like this: @Test(expected = ItemDiscontinuedException) public void createWidgetShouldRejectDiscontinuedWidget() { WidgetDao mockDao = mock(WidgetDao.class); WidgetService service = new WidgetService(mockDao); when(mockDao.countDiscontinued("someCode").thenReturn(1); Widget widget = new Widget("someCode"); service.createWidget(widget); }
downvote count: 0
has comment: http://stackoverflow.com/comment/41769760
accepted answer of: http://stackoverflow.com/q/26573612
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41770090
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26573612

http://stackoverflow.com/a/26633331
has comment: http://stackoverflow.com/comment/41875659
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41882978
accepted answer of: http://stackoverflow.com/q/26632819
type: Answer
answers question: http://stackoverflow.com/q/26632819
downvote count: 0
has body: you can't use jeditorpane to view html page correctly since it has limitation. you can use editorpane only for basic html .it does not provide good css support and it doesn't support javascript .if you want to show a webpage correctly you could use a good html css and js supporting library .take a look lobo browser http://lobobrowser.org/java-browser.jsp and also you can use JavaFX WebView update..... this is example how you can use javafx webView in your swing application to view a webpage properly .i only have make minimal changes to your code . complete code import com.sun.javafx.application.PlatformImpl; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.web.WebView; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; public class browser extends JFrame implements HyperlinkListener { URL pageURL; private static final long serialVersionUID = 1630568393141656837L; JPanel panel; JButton back, forward, go; JTextField website; JScrollPane sp; private JFXPanel display; WebView webComponent; public void setPanel() { panel = new JPanel(); back = new JButton("&lt;&lt;"); forward = new JButton("&gt;&gt;"); go = new JButton("GO"); panel.add(back); panel.add(forward); website = new JTextField("http://", 10); panel.add(website); panel.add(go); display = new JFXPanel(); createScene(); go.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Platform.runLater(new Runnable() { @Override public void run() { browse(); } }); } }); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); add(panel, BorderLayout.NORTH)…
score: 1
has comment: http://stackoverflow.com/comment/41876157

http://stackoverflow.com/q/26604288
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41821713
has answer: http://stackoverflow.com/a/26604394
accepted answer: http://stackoverflow.com/a/26604394
favorite count: 0
linked to: http://stackoverflow.com/q/6617067
has comment: http://stackoverflow.com/comment/41821755
tagged with: package
tagged with: android
possible better answer: http://stackoverflow.com/a/26604422
has title: Am I using packages incorrectly?
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26604427
type: Question
has answer: http://stackoverflow.com/a/26604422
has body: I'm building an android chat app. I've been using packages to store similar classes together, but I'm not sure this is right now. I've been doing this: com.myApp.adapters //- All my ListAdapters (FriendsListAdapter, MessagesListAdapter) com.myApp.fragments //- All my Fragments (FriendsFragment, ConversationFragment) com.myApp.database //- All my Database classes (DatabaseHelper, MessagesDataSource, etc...) com.myApp.models //- All my Models (Friend, Message, Conversation) com.myApp.communications //- All my Comms classes (GCM classes, Facebook Classes, etc...) Is this a reasonable thing to do? Or should it be more like: com.myApp.Conversations //- Everything for Conversations (MessageListAdapter, ConversationFragment, MessagesDatasource) com.myApp.Friends //- Everything for Friends (FriendsListAdapter, FriendsFragment, FriendsDataSource) // ...and so on. I suspect it should be the latter, packages based on a function or feature of the application itself, rather than grouping the classes by what they have in common with each other, if that makes sense? EDIT: Actually, are both the above wrong, I should define the subsystems right from the start, so more like this: com.myApp.UserInterface com.myApp.Database com.myApp.Communications Which in terms of individual classes is a mix of both the above, but each package is a clear defined subsystem. In which case, where would things like Models fit?

http://stackoverflow.com/a/26657294
score: 7
has comment: http://stackoverflow.com/comment/41916889
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41917340
has body: Java is technically correct, the inverse of 11 mod 26 is (approximately) 0.09090909090909 because 0.09090909090909 * 11 is approximately 1, whether mod 26 or not. However, what you're trying to find is an integer with the same property, 19, because 19*11 = 1 mod 26, and you can't do that with the same approach. Fortunately, the standard library has you covered: import java.math.BigInteger; class Test { public static void main(String[] args) { System.out.println( new BigInteger("11").modInverse(new BigInteger("26"))); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/26657119
has comment: http://stackoverflow.com/comment/41916861
downvote count: 0
answers question: http://stackoverflow.com/q/26657119
has comment: http://stackoverflow.com/comment/41917282
has comment: http://stackoverflow.com/comment/41916822

http://stackoverflow.com/a/26620438
type: Answer
has comment: http://stackoverflow.com/comment/41884501
has comment: http://stackoverflow.com/comment/41856294
upvote count: 1
answers question: http://stackoverflow.com/q/26619996
score: 1
accepted answer of: http://stackoverflow.com/q/26619996
has body: There is no special way for handling objects read from an iterator. If the only changes needed are just setting different values to the members of the Building class, this can be done the standard way, i.e. by adding member setter functions. For example, to modify the buildingType at any time, a setBuildingType() method is needed: public class Building { private String buildingName; private String buildingType; private double width; private double length; private String managerName; .... public void setBuildingType(String buildingType) { this.buildingType = buildingType; } } Given the above, the iterator-based code can be modified as follows: Iterator&lt;Building&gt; i = buildingsCache.iterator(); while (i.hasNext()) { Building b = i.next(); b.setBuildingType("Whatever type"); buildingComboBoxModel.addElement(b); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41856168

http://stackoverflow.com/comment/54824454
comment on: http://stackoverflow.com/a/29946540
score: 0
type: Comment
has text: Every android version supports a range of protocols, you can check it out here http://developer.android.com/reference/javax/net/ssl/SSLContext.html#getInstance(java.lang.String)
type: AnswerComment

http://stackoverflow.com/comment/41820922
type: Comment
comment on: http://stackoverflow.com/q/26603929
score: 0
has text: I don't know how to start.. I know how to check if file exsists in directory but nothing more..
type: QuestionComment

http://stackoverflow.com/comment/41817046
score: 0
comment on: http://stackoverflow.com/q/26601543
type: Comment
type: QuestionComment
has text: Hmmm i don't really understand, the detectedAdapter is for a different arraylist I am not using right now.

http://stackoverflow.com/comment/43026223
type: AnswerComment
comment on: http://stackoverflow.com/a/27150552
type: Comment
has text: I got this error while doing that: Parsing Data for android-21 failed Unsupported major.minor version 51.0
score: 0

http://stackoverflow.com/comment/41699816
type: Comment
type: QuestionComment
has text: How would I define the file to play then?
comment on: http://stackoverflow.com/q/26536759
score: 0

http://stackoverflow.com/q/26660344
tagged with: certificate
tagged with: ssl
tagged with: https
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26673257
has body: I've an SSL secured rest ws. In my java client I've added the certificat to the cacerts store, but it work only if i set explicitly the cacerts file path in the javax.net.ssl.trustStore parameter and the password in javax.net.ssl.trustStorePassword. the java home is set to : java.home : C:\ide\jdk1.7.0_45\jre and the two parameters are set to : Properties pp = System.getProperties(); Set&lt;Object&gt; s = pp.keySet(); for (Object object : s) { System.out.println(object + " : " + pp.get(object)); } System.setProperty("javax.net.ssl.trustStore", "C:\\ide\\jdk1.7.0_45\\jre\\bin\\cacerts"); System.setProperty("javax.net.ssl.trustStorePassword", "secret"); result: java.runtime.name : Java(TM) SE Runtime Environment sun.boot.library.path : C:\ide\jdk1.7.0_45\jre\bin ..... java.home : C:\ide\jdk1.7.0_45\jre .... other java parameters value WS called with success execution with Exception: Properties pp = System.getProperties(); Set&lt;Object&gt; s = pp.keySet(); for (Object object : s) { System.out.println(object + " : " + pp.get(object)); } //System.setProperty("javax.net.ssl.trustStore", "C:\\ide\\jdk1.7.0_45\\jre\\bin\\cacerts"); //System.setProperty("javax.net.ssl.trustStorePassword", "secret"); result : java.runtime.name : Java(TM) SE Runtime Environment sun.boot.library.path : C:\ide\jdk1.7.0_45\jre\bin ..... java.home : C:\ide\jdk1.7.0_45\jre .... other java parameters value Exception in thread "main" Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:397) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149) at org.apache.http.impl.conn.AbstractPooledConnAdapter.op…
tagged with: keystore
has title: Default java cacerts don't work
has comment: http://stackoverflow.com/comment/41942912
has comment: http://stackoverflow.com/comment/41943172
has comment: http://stackoverflow.com/comment/41927913
upvote count: 1
accepted answer: http://stackoverflow.com/a/26673257
has comment: http://stackoverflow.com/comment/41922840
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26626657
has body: I tried to use native sessions with Grails: [main] sessionManager = org.apache.shiro.session.mgt.DefaultSessionManager securityManager.sessionManager = \$sessionManager It works great until session is not found or invalidated. Start server. Login Restart server. org.apache.shiro.session.ExpiredSessionException: Session with id [3c3ffbef-ee93-4f6e-a599-1f1f4c03d037] has expired. Last access time: 29.10.14 12:18. Current time: 29.10.14 12:18. Session timeout is set to 1 seconds (0 minutes) at org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:292) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipal(DelegatingSubject.java:149) at org.apache.shiro.web.servlet.ShiroHttpServletRequest.getSubjectPrincipal(ShiroHttpServletRequest.java:95) at org.apache.shiro.web.servlet.ShiroHttpServletRequest.getUserPrincipal(ShiroHttpServletRequest.java:111) What's the point? Why Shiro throws an…
answer count: 1
tagged with: java
tagged with: shiro
has answer: http://stackoverflow.com/a/26646732
tagged with: session
downvote count: 0
type: UnansweredQuestion
tagged with: grails
type: Question
score: 1
favorite count: 0
has title: Shiro throws an exception when session expires / invalidates
upvote count: 1

http://stackoverflow.com/a/26643307
downvote count: 0
has body: I am using Apache POI 3.10. So far, Apache POI XSSF can't add line marker! So, I use excel vba to do it. What I do is I have create a xlsm template with VBA macro to add line marker when user open the xlsm file. Also, we can't add the VBA macro by POI as mentioned in here, Macros can not be created. The are currently no plans to support macros. However, reading and re-writing files containing macros will safely preserve the macros. Therefore we have to create a template and use it as an POI input. FileInputStream file = new FileInputStream(new File("template.xlsm")); XSSFWorkbook workbook = new XSSFWorkbook(file); Here is my VBA macro: Sub auto_open() Dim myChart As ChartObject For Each myChart In Sheets("Sheet1").ChartObjects For Each Series In myChart.Chart.SeriesCollection Series.MarkerStyle = xlMarkerStyleSquare Next Next myChart End Sub By using this workaround, we can add more style to the simple output line chart of POI.
answers question: http://stackoverflow.com/q/26625316
score: 1
accepted answer of: http://stackoverflow.com/q/26625316
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41707734
comment on: http://stackoverflow.com/q/26541550
score: 0
type: Comment
type: QuestionComment
has text: Why do you think it won't work in Java? Have you tried it? If so, what was the error message?

http://stackoverflow.com/comment/41762334
comment on: http://stackoverflow.com/a/26572064
type: Comment
has text: Yes. But the issue is I want to a check on a property i.e. the objects are not strings but have a property called `name` that has those values.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41773470
has text: java.lang.ClassCastException
comment on: http://stackoverflow.com/q/26577970
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41816198
type: QuestionComment
comment on: http://stackoverflow.com/q/26601057
score: 0
has text: While I really like the idea of using a JSpinner (it would be a fun feature) I have to validate the user's input. I had read that post while I was researching my problem about the second window. It is actually hard to explain. When I run the program, two windows automatically when I only intended one. The one I didn't mean to open is blank and I can't see where I told it to open at.
type: Comment

http://stackoverflow.com/q/26644135
has comment: http://stackoverflow.com/comment/41895828
has title: How do I find a word within range of another word with regex?
has body: if I have a string "word3 word2 word3 word4 word5 word3 word7 word8 word9 word10" And I want to find all "word3" such that it is within 3 words of "word5", I would get a match to the second and third occurrences of "word3" what regex expression or logic would I use? I had 2 ways I was going to approach it, but they seem incredibly inefficient to me.
has comment: http://stackoverflow.com/comment/41894705
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26648272
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26648272
answer count: 1
has comment: http://stackoverflow.com/comment/41894570
score: 0
has comment: http://stackoverflow.com/comment/41895798
tagged with: regex

http://stackoverflow.com/q/26540392
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41705833
has comment: http://stackoverflow.com/comment/41705843
tagged with: double
has comment: http://stackoverflow.com/comment/41706075
has comment: http://stackoverflow.com/comment/41706088
has body: I'm having trouble figuring this out: Write a fragment that uses a for statement to set the double variable sum to the value of: Here's what I tried: class thing { public static void main (String [] args) { double sum = 1; for (int i = 1; i&lt;=25; i++) { sum += Math.pow(i,1.0/i) ; System.out.println(sum); } } } I know this is wrong because it does not end with the proper calculation of 1.137411462. Any help is appreciated! :)
has comment: http://stackoverflow.com/comment/41705964
has answer: http://stackoverflow.com/a/26540452
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/41705911
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41705995
has title: Java root and power of
has answer: http://stackoverflow.com/a/26540486
type: Question
accepted answer: http://stackoverflow.com/a/26540486
tagged with: exponent
has comment: http://stackoverflow.com/comment/41705794
tagged with: square-root
has comment: http://stackoverflow.com/comment/41705991
possible better answer: http://stackoverflow.com/a/26540452
upvote count: 2
has comment: http://stackoverflow.com/comment/41706148
answer count: 2
has comment: http://stackoverflow.com/comment/41706195

http://stackoverflow.com/q/26553300
tagged with: static-binding
has comment: http://stackoverflow.com/comment/41731956
has comment: http://stackoverflow.com/comment/41728923
score: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41731345
upvote count: 1
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/41728696
has comment: http://stackoverflow.com/comment/41737382
has answer: http://stackoverflow.com/a/26553651
tagged with: java
has comment: http://stackoverflow.com/comment/41736048
type: Question
has body: I have found an issue about static binding. My real class are very extended, so I will use several toy class to express my problem. We suppose that we have the following hierarchy. public class Element{} public class Element1 extends Element{} public class Element2 extends Element{} I have a Stock class which use the different Element specialization defined by Element hierarchy. public class Stock{ public void operation(Element1 e1){ System.out.println("Operation - " + e1.getClass().getName()); } public void operation(Element2 e2){ System.out.println("Operation - " + e2.getClass().getName()); } } Finally, I have a StockManager which allows to manage a Stock. public StockManager{ Stock stock; public StockManager(Stock stock){ this.stock=stock; } public void manage(List&lt;Element&gt; elements){ for(Element element: elements){ stock.operation(element); } } } Of course, this code does not compile, because Stock does not define a method which includes a Element as argument. In this case we could fix the code using different approaches. First, I will be able to define a method which will define a Element as input arg, e.g. public void operation(Element e){ System.out.println("Operation - " + e.getClass().getName()); } This method could define a switch for managing the different concrete elements (Element1, Element2). However, this is imposible for me, because the switch violate the Open/Close Principle, and I have a lot (a lot) of concrete elements. Another alternative, I could use something like the Visitor Pattern. I could send the Stock object to a concrete element. And the concrete element will be charge of using the Stock operations. So, the class could change to: public abstract class Element{ public abstract void stockOperation(Stock stock); } public class Element1 extends Element{ public abstract void stockOperation(Stock stock){ stock.operation(this); } } public class Element2 extends Element{ public abstract void stockOperation(Stock stock){ stock.operation(thi…
tagged with: dynamic-binding
downvote count: 0
answer count: 1
has title: Avoid static binding in operations which use hierarchy arguments
favorite count: 0
has comment: http://stackoverflow.com/comment/41729125
has comment: http://stackoverflow.com/comment/41728863
has comment: http://stackoverflow.com/comment/41729303

http://stackoverflow.com/comment/42002252
has text: But you run into the same problem you started with. The database will run in single user/standalone mode...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26667249
type: QuestionComment

http://stackoverflow.com/comment/41698351
has text: @Tom I may be wrong, but I think it is just incorrect indenting.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26536216

http://stackoverflow.com/q/26538718
type: Question
accepted answer: http://stackoverflow.com/a/26539674
possible better answer: http://stackoverflow.com/a/45049056
has body: This is a question with regard to a scenario I observed: what is the way to effectively close the system resources opened by a Java library like AudioSystems.getAudioInputStream which I do not have visibility and control over? So take a look at my following code snippet: public static void main(String[] args) throws UnsupportedAudioFileException, IOException { System.out.println("Before everthing starts...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); AudioInputStream stream = AudioSystem.getAudioInputStream(new File("CaptchaResource/silence20ms.wav")); System.out.println("After reading in one AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); stream.close(); System.out.println("After closing the AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); stream = AudioSystem.getAudioInputStream(new File("CaptchaResource/silence20ms.wav")); System.out.println("After reading in one AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); stream.close(); System.out.println("After closing the AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()) stream = AudioSystem.getAudioInputStream(new File("CaptchaResource/silence20ms.wav")); System.out.println("After reading in one AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); stream.close(); System.out.println("After closing the AudioInputStream...Number of open fd: " + ((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount()); } As you see…
has answer: http://stackoverflow.com/a/45049056
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 2
has title: AudioInputStream.close() not releasing resources properly, is there a workaround?
has answer: http://stackoverflow.com/a/26539674
score: 2
tagged with: audio
type: AnsweredQuestion
tagged with: ioexception
tagged with: java
tagged with: inputstream

http://stackoverflow.com/a/41845241
answers question: http://stackoverflow.com/q/26625902
score: -1
has body: you can add @RestController annotation before your class. @RestController @RequestMapping(value = "/v1/range") public class RangeRestController { }
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/41745670
type: Comment
has text: It pays to look a bit into markdown editing if you want to really get into stackoverflow. It works a lot nicer than HTML once you get into it, and it's pretty easy to learn.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26542250

http://stackoverflow.com/q/26654963
has comment: http://stackoverflow.com/comment/41914148
type: Question
has comment: http://stackoverflow.com/comment/41914294
has comment: http://stackoverflow.com/comment/41914716
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/26655839
favorite count: 0
has title: JSF, registering null value to bound instances
downvote count: 0
type: UnansweredQuestion
tagged with: jsf
tagged with: primefaces
score: 1
has body: I'm having trouble assigning the value null to a bound instance. Whenever a selection is made within the selectOneMenu everything works as expected (the instance registered as cc.attrs.city is set to the selected value, as shown in example below), however when selecting the hardcoded null value, I'm examining that my selection is not forwarded to the bound instance. Any help would be appriciated. Usage example : &lt;h:selectOneMenu id="city" value="#{cc.attrs.city}" converter="anySelectConverter"&gt; &lt;f:selectItem itemLabel="#{msg['general.choose']}" itemValue="#{null}"/&gt; &lt;f:selectItems itemLabel="#{city.name}" itemValue="#{city}" var="city" value="#{locationComponentController.getAllCities()}" /&gt; &lt;p:ajax event="valueChange" update="district subdistrict village neighbourhood #{cc.attrs.updateOnSelection}" /&gt; &lt;/h:selectOneMenu&gt; Any select converter : @FacesConverter("anySelectConverter") public class AnySelectConverter implements Converter{ private static Map&lt;Object, String&gt; entities = new ConcurrentHashMap&lt;Object, String&gt;(); @Override public String getAsString(FacesContext context, UIComponent component, Object entity) { // TODO : Geçici çözüm sebebi araştırılmalı if(entity == null) return ""; synchronized (entities) { if (!entities.containsKey(entity)) { String uuid = UUID.randomUUID().toString(); entities.put(entity, uuid); return uuid; } else { return entities.get(entity); } } } @Override public Object getAsObject(FacesContext context, UIComponent component, String uuid) { for (Entry&lt;Object, String&gt; entry : entities.entrySet()) { if (entry.getValue().equals(uuid)) { return entry.getKey(); } } return null; } }
tagged with: java

http://stackoverflow.com/q/26541053
tagged with: android
has title: Webview app resolution is too big on device
linked to: http://stackoverflow.com/q/3916330
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/26541114
tagged with: java
tagged with: webview
upvote count: 1
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26541114
favorite count: 0
has body: I tried to create an app where it open my web app. I used webview to call the app, but when I run it, the app is kinda zoomed in (not in actual size). How can I change the size of the view? My device resolution is 1280px x 800px. I set up the web with the same resolution. I tried to add viewport meta-tag on my header.php but it only works in device's browser, not in the app. Tried this but doesn't work "> activity_main.xml <WebView android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" /> MainActivity.java package com.example.suryaagung; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; import android.app.Activity; import android.view.Window; import android.view.WindowManager; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //No title bar is set for the activity requestWindowFeature(Window.FEATURE_NO_TITLE); //Full screen is set for the Window getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); final WebView SuryaAgung = (WebView)findViewById(R.id.main); SuryaAgung.setWebViewClient(new WebViewClient()); SuryaAgung.loadUrl("http://localhost:8080/app"); SuryaAgung.getSettings().setJavaScriptEnabled(true); } } AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-permission android:name="android.permission.INTERNET"/>

http://stackoverflow.com/q/26542814
possible better answer: http://stackoverflow.com/a/26544968
tagged with: java
has answer: http://stackoverflow.com/a/26544968
tagged with: concurrency
has answer: http://stackoverflow.com/a/67543445
type: AnsweredQuestion
downvote count: 0
score: 17
favorite count: 0
has title: AtomicInteger: keep non-negative
has body: Is there a way to perform a "decrement if result is positive or zero" operation with an AtomicInteger? To clarify the desired behavior: if the current value is greater than zero, decrement if the current value is equal to zero, do nothing (negative current value is not handled)
type: Question
has answer: http://stackoverflow.com/a/26542963
tagged with: atomic
has comment: http://stackoverflow.com/comment/41709753
accepted answer: http://stackoverflow.com/a/26542963
answer count: 3
upvote count: 17

http://stackoverflow.com/comment/44428397
type: AnswerComment
type: Comment
has text: That is true but how do I link that SQL Query ( most likely a findQuery) to a Projection ? so that when I call /app/A/?projection=reduced , then that query gets fired for projections only. So, if I visit /app/A, then findAll() anyway will get all Columns but when I hit a projection URL then, it gets the subset only in SELECT
comment on: http://stackoverflow.com/a/28020916
score: 0

http://stackoverflow.com/a/62474398
type: Answer
answers question: http://stackoverflow.com/q/26524010
upvote count: 4
score: 4
downvote count: 0
has body: For me it was because IntelliJ IDEA did not launch the shell as a "login" shell. All of my environment variables are set as I expect in a login shell, but in a non-login shell, many of them are missing. By way of example, I expect /usr/local/bin to be in my PATH, but that is only true within login shells (as I get when I run iTerm2). This is an excerpt from a terminal session within IntelliJ IDEA: amacleod@valjean ~&gt; echo $PATH | grep -c /usr/local/bin 0 (1) amacleod@valjean ~&gt; $SHELL --login Welcome to fish, the friendly interactive shell amacleod@valjean ~&gt; echo $PATH | grep -c /usr/local/bin 1 One possible workaround would be to add my expected PATH and other variables to the shell configuration for non-login shells, but I would really rather just always be in a login shell. I would have hoped that IntelliJ IDEA would have a checkbox for sending --login in the Terminal settings. However, it is possible to override the Shell path setting to include the login flag.

http://stackoverflow.com/a/26621149
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41853064
accepted answer of: http://stackoverflow.com/q/26621029
type: Answer
has comment: http://stackoverflow.com/comment/41853131
has comment: http://stackoverflow.com/comment/41853217
has comment: http://stackoverflow.com/comment/41852895
has body: You do not need valid variable . Rename marks to compareMarks and change its return type to void . The naming convention says that methods names should be verbs . Finally just call the method in main . Try to indenting your code well. It makes it more readable public static void main(String args []) { Scanner sc= new Scanner (System.in); int x, y ; System.out.println("Student 1 please enter your mark: "); x= sc.nextInt(); System.out.println("Student 2 please enter your mark: "); y=sc.nextInt(); compareMarks (x, y); } public static void compareMarks (int x, int y) { if (x&gt;100 || y&gt;100) { System.out.println("Invalid mark!! the marks has to be between 0-100"); } else if (x&lt;y) { System.out.println("Student 2 has higher mark than Student 1"); } else { System.out.println("Student 1 has higher mark than Student 2"); } }
has comment: http://stackoverflow.com/comment/41852976
score: 0
answers question: http://stackoverflow.com/q/26621029

http://stackoverflow.com/q/26562847
has body: I'm using bytesCount = InputStream.read(byteArray) to read data from a client: My Server: InputStream IS = Connection.getInputStream(); byte[] InData = new byte[1024]; int bytesCount = IS.read(InData); My Client: ObjectOutputStream OOS = null; try { OOS = new ObjectOutputStream(connection.getOutputStream()); } catch (Exception e) {} OutputStreamWriter OSW = new OutputStreamWriter(OOS); try { OSW.write("ABC"); OSW.flush(); } catch (Exception e) {} As you can see, the client sends a string "ABC", but the byte array that the server receives is InData = [-84, -19, 0, 5, 119, 3, 65, 66, 67, 0, 0, 0, ...] and bytesCount = 9 What are those first 6 bytes?
tagged with: java
has answer: http://stackoverflow.com/a/26563860
tagged with: inputstream
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/26563860
answer count: 1
has title: InputStream.read(byte[] b) returns unexpected bytes
has comment: http://stackoverflow.com/comment/41747474
has comment: http://stackoverflow.com/comment/41750096
has comment: http://stackoverflow.com/comment/41747308
type: AnsweredQuestion

http://stackoverflow.com/a/26625740
has body: @Entity @Table(name="template") public class Template { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="t_id") private Integer Id; private String temp; @OneToMany(mappedBy="template", cascade=CascadeType.ALL) private Set&lt;Question&gt; questions; } @Entity @Table(name="question") public class Question { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="Qid") private Integer Qid; private String question; @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="tempid") private Template template; @OneToMany(mappedBy="question", cascade=CascadeType.ALL) private Set&lt;Choice&gt; choices; public void addChoice(Choice choice){ choices.add(choice); choice.setQuestion(this); } public void setTemplate(Template template){ this.template = template; template.getQuestions.add(this); } @Entity @Table(name="choice") public class Choice { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer Id; private String choice; private String status; private String description; @ManyToOne @JoinColumn(name="qid") private Question question; } Template template = //; Choice choice = //; Question question = new Question(); question.addChoice(choise); question.setTemplate(template); public void insertQuestion(Question qn1) { SessionFactory sf = Dbutil.getConnection(); Session session = sf.openSession(); Transaction tx = session.beginTransaction(); session.save(qn1); tx.commit(); }
answers question: http://stackoverflow.com/q/26623717
has comment: http://stackoverflow.com/comment/41864879
type: Answer
has comment: http://stackoverflow.com/comment/41867597
score: 0

http://stackoverflow.com/comment/41779758
type: QuestionComment
comment on: http://stackoverflow.com/q/26581543
has text: output> 33 45 39 36 21 43 4 37 77 38 31 14 90 71 ---------------------------------
score: 0
type: Comment

http://stackoverflow.com/comment/41810520
type: AnswerComment
comment on: http://stackoverflow.com/a/26598119
score: 0
type: Comment
has text: I already tried that, also uninstalling and installing the application

http://stackoverflow.com/a/26587163
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41789684
answers question: http://stackoverflow.com/q/26586114
has body: String name = new String(scannerObj.nextLine()); this line is causing the problem as it is causing the input to skip to the next line thereby skipping the input for city 0. use this code it will work -: String name = new String(scannerObj.next());
accepted answer of: http://stackoverflow.com/q/26586114

http://stackoverflow.com/comment/41663006
type: Comment
comment on: http://stackoverflow.com/q/26516527
type: QuestionComment
has text: reportList seams to be not initialized like 'List<ReportInfo>reportList = new ArrayList<ReportInfo>();'
score: 0

http://stackoverflow.com/comment/41845930
type: QuestionComment
comment on: http://stackoverflow.com/q/26616916
has text: Of course it's calling `close()` on the Connection. That's what it's for.
score: 0
type: Comment

http://stackoverflow.com/q/26575485
has comment: http://stackoverflow.com/comment/41769427
has body: I need to run my program as root. I looked at this question and it works somewhat. I need to use stdin and using the bash script doesn't seem to accept stdin. I am using Eclipse and Ubuntu. Any ideas? This also causes problems for other Java programs as they don't accept stdin either. If you run this code: import java.io.IOException; public class Test { public static void main(String[] args) { while (true) { try { System.out.print((char) System.in.read()); } catch (IOException e) { e.printStackTrace(); } } } } And they you type stuff into the Console and hit enter, it outputs what you typed in. When I use the bash script: #!/bin/bash # file: /usr/lib/jvm/java-8-oracle/bin/java # descr: Starter for jdk. Runs jdk as root when # cmd-line-arg "--run-as-root" is specified. # jre="/usr/lib/jvm/java-8-oracle/bin/java.ori" run_as_root=false args= # Filter command-line argument for arg in "$@" do case "$arg" in --run-as-root) run_as_root=true ;; *) args="$args $arg" ;; esac done # Remove leading whitespaces args=$(echo $args | sed -e 's/^[ \t]*//') if $run_as_root then echo "WARNING: Running as root!" gksu "$jre $args" else $jre $args fi I get a bunch of weird characters and when I remove the char cast, I get -1, meaning end of stream.
has title: Run Java program as root in Eclipse
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/2580279
favorite count: 0
has answer: http://stackoverflow.com/a/26575826
has comment: http://stackoverflow.com/comment/41768743
has comment: http://stackoverflow.com/comment/41775164
has comment: http://stackoverflow.com/comment/41769486
downvote count: 0
has comment: http://stackoverflow.com/comment/41768760
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41768791
type: Question
score: 1
tagged with: java
tagged with: ubuntu
tagged with: eclipse

http://stackoverflow.com/q/26647689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26648624
has title: Counting value based on values in mysql table using Java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/26648624
type: Question
has body: I have created a program to do something as follows: I have 22000 authors separated into 22000 files. Each file contains set of keywords (can be one or hundreds). For example AUTHOR-22945.txt consists of keywords as follows: algorithm problem computational solution general application base And then, I have 100 tables in mysql (topic0 until topic99). Each table consists of keywords and value. Each topic table contains 20 lines. For example: keywords | value us 0.021263 base 0.019618 within 0.014545 new 0.010844 apply 0.010296 process 0.010158 propose 0.009199 provide 0.008239 analysis 0.007005 three 0.006594 approach 0.006183 domain 0.005634 structural 0.004126 adapt 0.003989 aspect 0.003989 product 0.003441 efficient 0.003441 information 0.003167 associate 0.003167 class 0.00303 I tried to create a program that will produce set of value for each author taken from all 100 topics. I want to get the average value of an author from topic0 to topic99. So if a keyword from author file exists in topic0, I will take the values and sum it. And so on until topic99. Therefore, an author can have an output that consists of sum of each topic [t0, t1, t2, ..., t99] which will be for example [0, 0.3452, 0.2343, .... , 0.08342]. Currently what my program do is quiet messy way. When I tested it with one author data, it worked and produced the correct number. But when I input 22000 authors all for it to produce the output, it took more than 5 days to do that. And the result was wrong when I took samples and checked them randomly. I want to ask you what would be the right algorithm or tools or logical way to do this that would produce an accurate output and also not so long compiling time to do it? FYI, I also have all the authors data and keywords for each author in mysql table. Would it be better using mysql innerjoin or java in this situation? Thank you very much. FYI, my current messy code is as follows: package counttopicscore; import java.sql.*; import java.io.*; import java.uti…
tagged with: java
score: 0
answer count: 2
tagged with: vector
has answer: http://stackoverflow.com/a/26647925
tagged with: io
possible better answer: http://stackoverflow.com/a/26647925

http://stackoverflow.com/comment/41719336
comment on: http://stackoverflow.com/q/26544880
type: Comment
type: QuestionComment
has text: Unfortunately, I do not have enough time right now to write an answer. I'll do that later on. In the mean time, to loosely couple components, you could take a look at [Otto](http://square.github.io/otto/)
score: 0

http://stackoverflow.com/q/26630873
has comment: http://stackoverflow.com/comment/41870012
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/41869978
type: Question
has comment: http://stackoverflow.com/comment/41869889
has title: increase and decrease the value of the day
has comment: http://stackoverflow.com/comment/41869895
has comment: http://stackoverflow.com/comment/41870354
has comment: http://stackoverflow.com/comment/41870004
has comment: http://stackoverflow.com/comment/41869918
score: 0
has comment: http://stackoverflow.com/comment/41870993
has comment: http://stackoverflow.com/comment/41869989
has comment: http://stackoverflow.com/comment/41871336
answer count: 0
has comment: http://stackoverflow.com/comment/41870101
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41870730
has body: i want to increase and decrease the value of the day, with a random number of days, resulting always in a correct date. i want it to do it without calendar....is possiible this to be ? And how because i can not do it ..if someone can help ? i do this public void addDaysInDate(int numberOfDates) { for (int i=1; i&lt;= numberOfDates; i++) { day++; if(day&gt;31) { month++; day=1; if (month&gt;12) { year++; month=1; } } } }

http://stackoverflow.com/comment/41781372
score: 0
type: AnswerComment
has text: To keep object's monitor you need synchronized block on this object. Synchronized method is wrong idea.
comment on: http://stackoverflow.com/a/26582553
type: Comment

http://stackoverflow.com/q/26630927
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26631619
accepted answer: http://stackoverflow.com/a/26631619
type: AnsweredQuestion
upvote count: 1
tagged with: struts-1
type: Question
has body: What is the lifetime of the class that extends Action (Struts 1.3.10)? public class AddProcessAction extends Action { ProcBox procBox = new ProcBox(); @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { procBox.addToProcBox((ProcessForm)form); return mapping.findForward("success"); } }
has title: LifeTime Action class Struts 1.3.10
score: 1
tagged with: java
tagged with: struts
tagged with: servlets

http://stackoverflow.com/a/26662765
has body: Thank you MadProgrammer for all your help and patience. I just figured out what the problem was with my original program. It was pretty simple. I was creating the TextArea component with java.awt....however, the methods that I was using to print apparently were only compatible with javax.swing! Now my program works perfectly, which really is a big relief because I was getting really confused.
answers question: http://stackoverflow.com/q/26659321
score: 0
type: Answer

http://stackoverflow.com/q/26551409
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26551525
tagged with: date
has title: How to display date in exact format with month and year format
type: Question
score: -1
duplicate of: http://stackoverflow.com/q/454315
answer count: 2
downvote count: 1
has body: Hi how to display given string with July 3, 1969 for string 1969-07-03 String a="1969-07-03"; Expected output: July 3, 1969 I used this method initially to convert it to the right format. textView.setText(reverseIt(a)); // but this reverse the whole string. public static String reverseIt(String source) { int i, len = source.length(); StringBuffer dest = new StringBuffer(len); for (i = (len - 1); i &gt;= 0; i--) dest.append(source.charAt(i)); return dest.toString(); } Please help me solve this.
favorite count: 0
has answer: http://stackoverflow.com/a/26551517
linked to: http://stackoverflow.com/q/454315
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/26609676
score: 1
answers question: http://stackoverflow.com/q/26593498
downvote count: 0
has body: Figured it out: Go to Google Developer Console --> permission of project1 -->add member --> add the service account of project2 using the account's client email id. Then it works
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41739867
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26550669
has text: While i can't say that the ImageIO.Write method is blocking the thread... i can say definitively that this is where the thread stops... i used System.out.println("some comment") after each line of the code to check and see where things are stopping... there are no exceptions being thrown... this is my first foray into sockets and i'm cannot honestly say that i am not doing something wrong on the client side that might be completely wrong... i can say the client side will loop with no problem, i post runnables from another thread and they function but the bitmap always returns null...
score: 0

http://stackoverflow.com/a/29103346
has body: You need to add following filters in web.xml file and try to make worked with new tomcat org.springframework.web.context.request.RequestContextListener org.springframework.security.web.session.HttpSessionEventPublisher
answers question: http://stackoverflow.com/q/26556081
type: Answer
score: 0

http://stackoverflow.com/comment/41838906
comment on: http://stackoverflow.com/a/26613212
has text: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { finish(); return super.onKeyDown(keyCode, event); }
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26563468
has title: How to put Array List of Strings in text fields
has body: Let's say I have a method that return with an array of strings "arr1" its size "s=arr1.size" and I have also some Text Fields lets say (JtextField1,JTextField2,JTextField3....) now I want to put each String in this array in each Text Field how can I do it?
has comment: http://stackoverflow.com/comment/41746799
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41746975
has comment: http://stackoverflow.com/comment/41746704
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/41746743
has comment: http://stackoverflow.com/comment/41746841
has comment: http://stackoverflow.com/comment/41746762
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41746727

http://stackoverflow.com/a/26572700
has comment: http://stackoverflow.com/comment/41780043
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41779920
has comment: http://stackoverflow.com/comment/41779937
has body: Try regular expressions. But be careful with huge amount of data. Could be slow. import java.util.regex.Matcher; import java.util.regex.Pattern; public class SearchDemo { public static void main(String[] args) { String data = "1|002|3|Lubna|M|141021081331|\n" + "2|003|3|Rashid|1|141021081431|\n" + "3|002|3|Amal|M|141021081340|\n" + "4|002|3|Lubna|F|141021081531|"; Pattern p = Pattern.compile("^\\d+[|]\\d+[|]\\d+[|]([^|]+)[|]([M]?)[|]\\d+[|]", Pattern.MULTILINE); Matcher m = p.matcher(data); while (m.find()) { System.out.println("search name: " + m.group(1) + " type: " + m.group(2)); Pattern p2 = Pattern.compile("^\\d+[|]\\d+[|]\\d+[|](" + m.group(1) + ")[|]([F]?)[|]\\d+[|]", Pattern.MULTILINE); Matcher m2 = p2.matcher(data); if (m2.find()) { System.out.println("found name: " + m2.group(1) + " type: " + m2.group(2)); } else { System.out.println("no match name: " + m.group(1) + " type: " + m.group(2)); } } } }
accepted answer of: http://stackoverflow.com/q/26572497
has comment: http://stackoverflow.com/comment/41802468
type: Answer
answers question: http://stackoverflow.com/q/26572497
has comment: http://stackoverflow.com/comment/41779927
has comment: http://stackoverflow.com/comment/41779932
has comment: http://stackoverflow.com/comment/41764434

http://stackoverflow.com/q/26611510
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26611576
has title: File move is not working
answer count: 1
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26611576
has body: @RequestMapping("/XMLGenSuccess.json") public static String getXMLGenerationSuccess() { DBService dbService = new DBService(); boolean success = false; try { DerivContactInfo contactInfo = dbService .DerivContactInfoService(); Option option = dbService.BankReportService("fake bank"); option.setinfo(contactInfo); File file = XMLgenService.buildXML(option); success = file.renameTo(new File("src/main/resources/Cache/report.xml")); }catch(Exception e){ e.printStackTrace(); } if(success == true){ return "True"; } else{ return "False"; } } } I have no idea why it doesn't work when i deploy server using maven. I made a seperate test class within the project and and yes it works and it drops the genereated xml in the directory i specfied. Would any of you know the possible reason why this is not showing up, its just a blank page and no xml file is droped in the to the cache folder.
score: 0

http://stackoverflow.com/q/26659205
has answer: http://stackoverflow.com/a/26659446
tagged with: jar
has title: Could not find or load main class cmd, it works fine in Eclipse, build paths seem ok
answer count: 2
tagged with: javac
downvote count: 0
tagged with: cmd
accepted answer: http://stackoverflow.com/a/26659446
favorite count: 0
has body: Hi guys and thanks for trying I am using the JExcelApi to create an excel file from a cmd prompt with a java file. The code works perfectly within eclipse with the right build paths etc. When i try it in the cmd prompt the javac works then when i execute it i get the Could not find or load main class GenerateExcel This is the GenerateExcel Java file import java.io.*; import jxl.*; import java.util.*; import jxl.Workbook; import jxl.write.DateFormat; import jxl.write.Number; import jxl.write.*; import java.text.SimpleDateFormat; public class GenerateExcel { public static void main(String[] args) { try { String filename = "excelTEST.xls"; WorkbookSettings ws = new WorkbookSettings(); ws.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(new File(filename), ws); WritableSheet s = workbook.createSheet("Sheet1", 0); WritableSheet s1 = workbook.createSheet("Sheet1", 0); writeDataSheet(s); writeImageSheet(s1); workbook.write(); workbook.close(); } catch (IOException e) { e.printStackTrace(); } catch (WriteException e) { e.printStackTrace(); } } private static void writeDataSheet(WritableSheet s) throws WriteException { /* Format the Font */ WritableFont wf = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD); WritableCellFormat cf = new WritableCellFormat(wf); cf.setWrap(true); /* Creates Label and writes date to one cell of sheet*/ Label l = new Label(0,0,"Date",cf); s.addCell(l); WritableCellFormat cf1 = new WritableCellFormat(DateFormats.FORMAT9); DateTime dt = new DateTime(0,1,new Date(), cf1, DateTime.GMT); s.addCell(dt); /* Creates Label and writes float number to one cell of sheet*/ l = new Label(2,0,"Float", cf); s.addCell(l); WritableCellFormat cf2 = new WritableCellFormat(NumberFormats.FLOAT); Number n = new Number(2,1,3.1415926535,cf2); s.addCell(n); n = new Number(2,2,-3.1415926535, cf2); s.addCell(n); /* Creates Label and writes float number upto 3 decimal to one cell of sheet */ l = new Label(3,0,"3dps",cf); s.addC…
upvote count: 1
type: AnsweredQuestion
tagged with: jexcelapi
possible better answer: http://stackoverflow.com/a/26659337
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26659337
type: Question

http://stackoverflow.com/q/26576986
tagged with: android
has answer: http://stackoverflow.com/a/26578590
tagged with: android-alertdialog
downvote count: 0
score: 1
tagged with: java
has title: Android AlertDialog dismiss method does not work
has comment: http://stackoverflow.com/comment/41771551
type: Question
has comment: http://stackoverflow.com/comment/41771808
tagged with: dialog
has comment: http://stackoverflow.com/comment/41772248
answer count: 2
has body: I've created an AlertDialog, but I can't close it... I can see it and press the buttons, but when I press the "positive button", the program shall do some tasks and then close (dismiss) the dialog. All tasks are being done, without closing the dialog, it just flickers once (it might close and then reopen, I don't know). AlertDialog.Builder builder = new AlertDialog.Builder(myContext); builder.setTitle("Congratulations, you won!"); builder.setMessage("Time: x seconds\nScore: xxxx\nHigh score: yyyy"); builder.setPositiveButton("Play again!", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Doing stuff! circle1Paint = yellowPaint; circle2Paint = yellowPaint; circle3Paint = yellowPaint; playing = true; // Trying to close it after doing "the stuff" dialog.dismiss(); } }); builder.setNegativeButton("Exit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { System.exit(0); } }); builder.create.show(); Thanks in advance! CoderOgden
upvote count: 1
has answer: http://stackoverflow.com/a/29727535
has comment: http://stackoverflow.com/comment/41771726
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27607647
upvote count: 1
answers question: http://stackoverflow.com/q/26660583
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Turns out this was a bug. I worked with the iText support team on this and they were able to come up with a solution. The fix appears to have made it into the 5.5.6 release.
type: Answer
accepted answer of: http://stackoverflow.com/q/26660583

http://stackoverflow.com/q/26548991
score: 0
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/41783197
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41780798
has comment: http://stackoverflow.com/comment/41780373
has body: I have some domain objects in a javafx application that I'm trying to clone using the Java deep cloning library. If I add a listener to one of the javafx properties the cloning fails with a NoClassDefFoundError. I have tried telling the cloner to insert null instead of clone for the listener classes, but this ha no effect: com.rits.cloning.Cloner cloner = new com.rits.cloning.Cloner(); cloner.nullInsteadOfClone(ChangeListener.class, InvalidationListener.class); Does anyone have any tips? Example code: Domain object with javafx property: public class ItemType implements Serializable { private final LongProperty id; private final StringProperty description; public ItemType() { this.id = new SimpleLongProperty(); this.description = new SimpleStringProperty(); } public Long getId() { return this.id.get(); } public void setId(Long id) { this.id.set(id); } public LongProperty idProperty() { return this.id; } public String getDescription() { return this.description.get(); } public void setDescription(String description) { this.description.set(description); } public StringProperty descriptionProperty() { return this.description; } Code that succeeds: ItemType itemtype = new ItemType(1L, "test"); cloner.deepClone(itemtype); Code that fails: ItemType itemtype = new ItemType(1L, "test"); itemtype.idProperty().addListener(new ChangeListener&lt;Number&gt;() { @Override public void changed(ObservableValue&lt;? extends Number&gt; observable, Number oldValue, Number newValue) { throw new UnsupportedOperationException("Not supported yet."); } }); cloner.deepClone(itemtype);
answer count: 0
tagged with: clone
tagged with: java
has comment: http://stackoverflow.com/comment/41743229
has comment: http://stackoverflow.com/comment/41782904
type: Question
has title: Cloning of domain objects with javafx properties

http://stackoverflow.com/a/26531431
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: You are very close you need to do one more thing and that is getting the tekst from the labels and textfield by calling getText(). public class event1 implements ActionListener{ public void actionPerformed(ActionEvent JP1sub1){ ShowActions.setText(LLName.getText() + "\n" + LLAddress.getText() + "\n" + LLPhone.getText() + "\n" + LLbankDeets.getText()); } } Hope this helps :)
has comment: http://stackoverflow.com/comment/41691071
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26530893
answers question: http://stackoverflow.com/q/26530893

http://stackoverflow.com/q/26587450
downvote count: 1
favorite count: 0
has title: Not able to get exact difference in number of days between two days using Java
has body: I'm working on getting the number of days between two dates using Java. When I give the application date as 27 it shows 0, and when I give as 26 it even shows 0. Is there anything wrong in my code? Any ideas would be greatly appreciated. Here is my code public static void main (String[] args) throws java.lang.Exception { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date currentDate = new Date(); System.out.println("Current date:"+dateFormat.format(currentDate)); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String strAppDate = "2014-10-28 15:11:30.0"; Date appDate = formatter.parse(strAppDate); System.out.println("Application date :"+formatter.format(appDate)); long diff = appDate.getTime() - currentDate.getTime(); long diffDays = diff / (24 * 60 * 60 * 1000); System.out.println("Diff days :"+diffDays); }
has answer: http://stackoverflow.com/a/26587532
upvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26587564
has comment: http://stackoverflow.com/comment/41789990
tagged with: java
has comment: http://stackoverflow.com/comment/41790043
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/26589241

http://stackoverflow.com/a/26619349
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26618890
downvote count: 0
has comment: http://stackoverflow.com/comment/41929029
has body: One benefit is that you're absolutely guaranteed that no instances can be created, even from inside the class. A disadvantage is that this goes beyond the usual intent of enums. However, we already do this for singletons implemented with enums. This bit from "Effective Java" by Joshua Bloch about such singletons also applies to utility classes: ...you get an ironclad guarantee that there can be no instances besides the declared constants. The JVM makes this guarantee, and you can depend on it. Disclaimer: I have not used this pattern, and am not recommending for or against it.
has comment: http://stackoverflow.com/comment/41948379
type: Answer
upvote count: 31
has comment: http://stackoverflow.com/comment/41958182
has comment: http://stackoverflow.com/comment/41930476
score: 31
has comment: http://stackoverflow.com/comment/41929811
accepted answer of: http://stackoverflow.com/q/26618890
has comment: http://stackoverflow.com/comment/41929918

http://stackoverflow.com/comment/41907571
has text: @BrunoLowagie Please answer on http://stackoverflow.com/questions/26652029/how-to-do-xml-to-html-conversion-to-generate-closed-tags
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26648853
score: 0

http://stackoverflow.com/q/26542926
accepted answer: http://stackoverflow.com/a/29841288
has title: Size of the parameter in applet call is too big
downvote count: 0
answer count: 1
tagged with: javascript
tagged with: applet
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/29841288
has comment: http://stackoverflow.com/comment/41781230
upvote count: 4
has comment: http://stackoverflow.com/comment/41738285
has body: I have problem in passing some data from JavaScript to an applet. I think size of data is too big (18M characters in string) to pass it through LiveConnect. I put code samples below: JavaScript: var bigData = generateSomeBigData(18000000); // string contaning 18 000 000 characters applet.Execute(bigData); // no error Applet: public void Execute(String data) { this.doSomethingWithData(data); // data is null } I didn't get any error or exceptions in java console or in javascript code. I've tried running applet with bigger heap, but it didn't help. ... &lt;param name="java_arguments" value="-Xmx128m" /&gt; ... The only problem is I get null instead of string contaning data, it doesn't depend on browser (FF, Chrome).
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41781596
tagged with: java
type: Question
tagged with: liveconnect

http://stackoverflow.com/a/26539102
score: 2
downvote count: 0
has body: You have strings that you want to sort by a certain substring interpreted as a Double, so no way around parsing them. But if you parse each line once, and save those results to sort on, that will be faster than calling parseDouble within each comparison.
answers question: http://stackoverflow.com/q/26539051
upvote count: 2
type: Answer

http://stackoverflow.com/q/26617017
has title: OnClickListener and CheckBox Errors
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26617067
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/26617219
answer count: 2
has body: I'm relatively new to app development and very confused about what to do here. Please be very clear and very detailed in your responses, much appreciated! I'm getting a host of errors from the following code block: //Blank out the appropriate blanks chkRect.setOnClickListener(new onClickListener() { @Override public void onClick(View v) { if (chkRect.isChecked()){ chkCyl.setEnabled(false); txtDiameter.setText("0"); txtDiameter.setEnabled(false); } else { chkRect.setEnabled(true); txtDiameter.setText(""); txtDiameter.setEnabled(true); } }}); chkCyl.setOnClickListener(new onClickListener(){ @Override public void onClick(View v) { if (chkCyl.isChecked()){ chkRect.setEnabled(false); txtHeight.setText("0"); txtWidth.setText("0"); txtHeight.setEnabled(false); txtWidth.setEnabled(false); } else { chkRect.setEnabled(true); txtHeight.setText(""); txtWidth.setText(""); txtHeight.setEnabled(true); txtWidth.setEnabled(true); } }}); On both "onClickListener" lines and the 'public void' lines, the following shows up: -onClickListener cannot be resolved as a type. (multiple lines) -Method setOnClickListener(View.onClickListener) in the type View is not applicable for the arguments new onClickListener. -The Method "onClick(View v)" must override or implement a supertype method. Here are my imports and variable declarations: import java.text.DecimalFormat; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Spinner; public class MaterialCalculator extends ActionBarActivity implements View.OnClickListener{ public Spinner materialDD; public CheckBox chkRect; public CheckBox chkCyl; //public Spinner shapeDD; DecimalFormat d = new DecimalFormat("#"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(s…
has answer: http://stackoverflow.com/a/26617067
possible better answer: http://stackoverflow.com/a/26617219
score: 0
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/26640252
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26640042
type: Answer
has comment: http://stackoverflow.com/comment/41926938
has body: You shouldn't hard-code the implementation classes into the switch like that; it essentially eliminates all the advantages of polymorphism. Instead, use an Abstract Factory to instantiate the Runnable for the operation. This is a case where Java's Service Provider Interface is perfect; it essentially allows you to scan for implementations (plugins) of some interface at runtime, and isn't difficult to use. See the javax.crypto API for an example of how this works in practice.
answers question: http://stackoverflow.com/q/26640042
score: 0

http://stackoverflow.com/a/26906008
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26641425
score: 1
answers question: http://stackoverflow.com/q/26641425
upvote count: 1
has body: Your application needs the following three types of "resources" System Resources: JRE classes, some extensions/libraries provided by the server you deploy on. Your dependencies: Any libraries you use, say common-utils, poi etc. These JAR files go in your web-inf/lib folder Your classes. These are deployed with the WAR file at web-inf/classes So, to answer your questions: If you are deploying to Tomcat, the tomcat-jdbc.jar will be provided. Take care of the version though. If your prod server will be tomcat but dev is say Jetty, then you need to provide this jar in your local IDE, but not export it in the WAR file. But if you are developing on tomcat and say deploying on some other server, then this jar has to be bundled with your war file (web-inf/lib folder). Dev and Prod servers need not be same, but take care of the JRE version and dependency on Prod server provided libraries. JRE is a configurable setting for your server and also your IDE (Eclipse) Project hierarchy is correct, but you will most probably deploy as WAR file, so your build folder is exported in web-inf/classes. You can verify by opening the WAR file with any zip editor. Regarding the portability of tomcat-jdbc.jar Unfortunately this depends on the tomcat library and version. There might be more dependencies of this jar file which might cause problems later on. I would recommend not relying on this jar unless you plan to deploy on tomcat.
type: AcceptedAnswer

http://stackoverflow.com/q/26605562
downvote count: 5
has answer: http://stackoverflow.com/a/26605776
tagged with: nio
has comment: http://stackoverflow.com/comment/41823772
answer count: 1
has body: why i am getting this error Exception in thread "Thread-2" org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2214) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095) at org.hibernate.loader.Loader.list(Loader.java:2090) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at daoimplclasses.site_configdaoimpl.listPendingSiteConfig(site_configdaoimpl.java:41) at service.Config.run(Config.java:119) Caused by: java.sql.SQLException: Unknown column 'this_.temperEnabled' in 'field list' at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695) at com.mysql.jdbc.Connection.execSQL(Connection.java:3026) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1137) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1231) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1778) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2211) ... 7 more
linked to: http://stackoverflow.com/q/3988788
has comment: http://stackoverflow.com/comment/41823816
has comment: http://stackoverflow.com/comment/41823827
favorite count: 0
accepted answer: http://stackoverflow.com/a/26605776
type: AnsweredQuestion
tagged with: java
has title: i am getting Hibernate error
score: -4
has comment: http://stackoverflow.com/comment/41824266
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41823992
tagged with: hibernate

http://stackoverflow.com/comment/41738359
type: QuestionComment
comment on: http://stackoverflow.com/q/26557386
has text: possible duplicate of [Map enum in JPA with fixed values?](http://stackoverflow.com/questions/2751733/map-enum-in-jpa-with-fixed-values)
type: Comment
score: 0

http://stackoverflow.com/a/26550395
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41829535
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41765873
has body: If by delivered to each client you mean that you need to send it to each client, then the easiest technique is to use the methods on ChannelGroup itself. The writeAndFlush method (write method if netty 3.x) returns a future that will be signalled when the message has been flushed to all channels in the group. ChannelGroupFuture future = broadcast.writeAndFlush(message); future.awaitUninterruptibly(); You can use the methods of ChannelGroupFuture to determine if the message was written all channels, and to figure out which channels failed. This will limit you to the performance of the slowest channel but your example code implies that's ok. Having individual channels run at full speed, or knowing the message was actually delivered, increases the scope dramatically.
answers question: http://stackoverflow.com/q/26527208

http://stackoverflow.com/a/26522387
has body: Nope, there is no imshow equivalent in java. Please refer this link.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26515981
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26515981
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/26668016
has title: Error 404 not found pivot4j file in the Pentaho BiServer
type: Question
score: 0
answer count: 1
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/26668066
has answer: http://stackoverflow.com/a/26668066
has body: I've download pivot4j and install from Pentaho Marketplace After restart tomcat server, in the web browser console.log while opening the bi-server, it show red error as following. GET http://192.168.1.116:8080/pentaho/mantle/home/properties/config_en.properties?_=1414732010505 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/mantle/home/properties/config_en-US.properties?_=1414732010506 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/mantle/home/properties/messages_en.properties?_=1414732010508 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/mantle/home/properties/messages_en-US.properties?_=1414732010509 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/undefined.properties?_=1414732010510 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/undefined_en.properties?_=1414732010511 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/undefined_en-US.properties?_=1414732010512 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/api/repos/pivot4j/webapp/resources/pivot4j/i18n/messages.properties.properties?_=1414732010513 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/api/repos/pivot4j/webapp/resources/pivot4j/i18n/messages.properties_en.properties?_=1414732010514 404 (Not Found) jquery-1.9.1.min.js:5 GET http://192.168.1.116:8080/pentaho/api/repos/pivot4j/webapp/resources/pivot4j/i18n/messages.properties_en-US.properties?_=1414732010515 404 (Not Found) And there is no pivot4j in File -> New menu. I've no idea how to fix this... I have lag skilled of java tomcat application. Please advice me. (Pentaho 5.0.1-stable, pivot4j 1.0-SNAPSHOT)
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: pentaho
tagged with: java

http://stackoverflow.com/a/26614466
answers question: http://stackoverflow.com/q/26613588
downvote count: 0
has body: As you cannot overload method with generics and different parameters (see: Oracle’s tutorial “Restrictions on Generics”) you don't have to bother about generics with the reflection API. There is no ambiguity, you can simply get your method like that: Method m = this.generatedClazz.getMethod("dynamicGra", Instance.class, ExecutionParms.class, WorkDataDefinition.class, KnownWorkData.class, KnownWorkData.class, TaskContext.class); Then you invoked with null so it means that dynamicGra must be static, if it's not the case you must pass the instance of generatedClazz on which you want to call the method : Object instance = this.generatedClazz.newInstance(); // A new one or any other reference of generatedClazz m.invoke(instance, onInst, parm, returntype, this.accumulationFunction, this.resultBindings, context);
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26613588
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/41821058
type: Comment
comment on: http://stackoverflow.com/a/26601927
has text: What do you mean "should not be a string"? The variable is a little awkwardly named but it's obviously a String. I'm not sure how the getCount method even works, I have a similar method and it won't work without single quotes when using String...
score: 0
type: AnswerComment

http://stackoverflow.com/q/26603476
has answer: http://stackoverflow.com/a/26603497
answer count: 2
has comment: http://stackoverflow.com/comment/41820128
upvote count: 0
has comment: http://stackoverflow.com/comment/41821890
favorite count: 0
has comment: http://stackoverflow.com/comment/41820905
tagged with: io
has comment: http://stackoverflow.com/comment/41820802
type: UnansweredQuestion
has title: Java io using read()
downvote count: 1
has body: I was trying this code snippet- import java.io.*; class demo { public static void main(String args[]) throws IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int c; do { c= (char)br.read(); System.out.println(c); }while(c!='q'); } } Now when I give input-22 output is- 50 50 13 10 I understand the output 50, 50 but why the the compiler is printing 13 and 10 ? Kindly help. Thanks!
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26603626

http://stackoverflow.com/a/28928118
has body: The solution to fix this issue was to remove all html formatted tags within my method documentations. In some of the comments i had self closing html elements which caused some issues. But I still haven't found out why they've changed this with the newest version.
score: 6
type: Answer
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/26552279
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26552279

http://stackoverflow.com/comment/41848058
score: 0
type: Comment
has text: This will not compile due to the unreachable return statement.
type: AnswerComment
comment on: http://stackoverflow.com/a/26618515

http://stackoverflow.com/a/26665872
score: 2
downvote count: 0
upvote count: 2
has body: From here this this Oracle docs! I could understand that When the heap grows or shrinks, the JVM must recalculate the old and new generation sizes to maintain a predefined NewRatio., The NewSize and MaxNewSize parameters control the new generation’s minimum and maximum size. The size of the young generation relative to the old generation is controlled by NewRatio. For example, setting -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3, the combined size of eden and the survivor spaces will be fourth of the heap. To size the Java heap: Make plenty of memory available to the young generation. The default is calculated from NewRatio and the -Xmx setting. Can you try setting a value for NewSize and see if that makes a difference?
answers question: http://stackoverflow.com/q/26608136
type: Answer

http://stackoverflow.com/q/26649938
has answer: http://stackoverflow.com/a/26988974
tagged with: download
has title: Not able to download ARM EABI 7a system image for Android 4.4
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
has body: I am not able to install arm eabi system 7a system image for android 4.4 I am getting this while trying to install from sdk: Downloading Android SDK Tools, revision 23.0.5 Download interrupted: Unexpected HTTP Status 403 Downloading Android TV ARM EABI v7a System Image, Android API 21, revision 1 Download interrupted: Unexpected HTTP Status 403 Downloading Android TV Intel x86 Atom System Image, Android API 21, revision 1 Download interrupted: Unexpected HTTP Status 403 Downloading ARM EABI v7a System Image, Android API 21, revision 1 Download interrupted: Unexpected HTTP Status 403 Downloading Intel x86 Atom_64 System Image, Android API 21, revision 1 Download interrupted: Unexpected HTTP Status 403 Downloading Intel x86 Atom System Image, Android API 21, revision 1 Download interrupted: Unexpected HTTP Status 403 Done. Nothing was installed. I tried installing it offline.I downloaded the zip file from : http://dl-ssl.google.com/android/repository/sys-img/android-wear/sysimg_wear_arm-20_r02.zip Then I copied the .zip file in the temp folder of my sdk directory.But still it tries to install the system image from the internet and gives the same error as mentioned above. Without the arm system image file I am not able to create an avd and hence not able to proceed. Any idea how I can fix this.
tagged with: sdk
tagged with: android
tagged with: android-virtual-device

http://stackoverflow.com/comment/41677027
type: Comment
comment on: http://stackoverflow.com/a/26524387
has text: As far as I know, IJ uses the default shell of the OS (for windows cmd.exe, you can specify which executable to use though. Therefore the env variables should be the same as when you execute cmd.exe (or applicable executable on other platforms) yourself
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41926408
type: QuestionComment
comment on: http://stackoverflow.com/q/26661876
score: 0
has text: How can I format the code properly? (First post)
type: Comment

http://stackoverflow.com/a/26649758
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41905345
answers question: http://stackoverflow.com/q/26647928
has body: connection.start() starts a new thread, but that thread is probably a daemon thread, so it ends when the program ends. You are lucky that you receive even 1 message. Try for example a Thread.sleep( 60000) at the end of your main, the listener will then stay in the air for one minute and you will proabably receive a few more messages.
accepted answer of: http://stackoverflow.com/q/26647928
upvote count: 1
has comment: http://stackoverflow.com/comment/41907063

http://stackoverflow.com/a/26563021
type: AcceptedAnswer
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/26562992
type: Answer
has body: No. There is no performance impact to making your methods more visible. But, it is not considered a best practice to expose more methods then necessary for the function of your code.
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26562992

http://stackoverflow.com/q/26579073
tagged with: arrays
has body: I found this problem on leetcode, I've solved it on my platform. For the tests I've used 1000 elements arrays, and never got an error. On leetcode platform it throws ArrayIndexOutOfBoundsException. If you look carefully, there is no way the elements a, b, or can n go further than array's length. This is the description of the problem: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate exists in the array. public class Solution { public int findMin(int[] num) { int a = 0; int b = num.length - 1; int n = ( a + b ) / 2; while ( true ) { if ( num[n] &lt; num[n+1] &amp;&amp; num[n] &lt; num[n-1] ) break; if ( num[a] &lt; num[b] ) { b = n; n = (a + n) / 2 + 1; } else { a = n; n = ( b + n ) / 2; } } return num[n]; } }
upvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/32568261
tagged with: binary
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/32568261
score: -1
tagged with: java
tagged with: indexoutofboundsexception
has title: Minimum in Rotated Sorted Array ArrayIndexOutOfBoundsException
downvote count: 1
type: Question
tagged with: rotation
has answer: http://stackoverflow.com/a/28575747

http://stackoverflow.com/a/26523070
answers question: http://stackoverflow.com/q/26519866
score: 0
has comment: http://stackoverflow.com/comment/41687974
type: Answer
has comment: http://stackoverflow.com/comment/41685073
has comment: http://stackoverflow.com/comment/41686361
has comment: http://stackoverflow.com/comment/41685174
has comment: http://stackoverflow.com/comment/41685935
has body: Your code is confusing, you have three "new PDJpeg" and one of them is in a catch (which should just handle the error). And what does "read()" do? Does it pass a stream or a BufferedImage? If it is a stream, then it is wrong, because PDJpeg is for JPEGs, not for PNG. The second one img = new PDJpeg(documento, (getClass().getResourceAsStream("/com/img/" + Byte.toString(item.getId()) + ".png"))); is definitively wrong for the same reason: PDJPeg is not for PNG files / streams. If you want to create an image from a PNG file / stream, use PDPixelMap. It is possible to create a PDJpeg object from a BufferedImage, but this is recommended only if the image wasn't encoded before. Because if you would read a BufferedImage from a JPEG, and then use PDJPeg for this, you'll have a slight loss of quality as the image is decoded and encoded again (JPEG is a "lossy" compression format). If my advice doesn't help, please upload the JPEG file and the PDF somewhere. Also make sure that you're using the latest version, which is 1.8.7. Update after comments: the parameters to createGraphics.drawImage() should be 0, 0 and not width, height. The two parameters are a location, not a size.
has comment: http://stackoverflow.com/comment/41685512

http://stackoverflow.com/a/26577885
score: 1
type: Answer
has body: Yes, you have a conceptual problem here. You want the gallonsSaved to be a value calculated from other values. Usually, such values are not accessed through getters and setters, but through a calculation (class behavior). There are usually two things you may do. The first is to have getters and setters for all the values that your behavior depends upon - distanceTraveled, in this case. You'd probably also have getters and setters for other fields, but they are not pertinent to the behavior we are currently discussing. Then, you write a method that runs the behavior you need based on the values currently existing in your object (regardless of whether they were entered by constructor or by setter). public double gallonsCalculated() { return distanceTraveled/mpg; } You will have no gallonsSaved field because it depends on the other fields and therefore redundant. When you need it, you call that function. The second approach, used especially when the calculation is called many times and its results are less likely to change, is to do the calculation once, store it in a private field, and return that field when you need the value. In that case, you should perform the actual calculation whenever your setters are used: public void setDistanceTravelled( double distanceTravelled ) { this.distanceTravelled = distanceTravelled; this.gallonsSaved = distanceTravelled/mpg; } public double gallonsCalculated() { return this.gallonsSaved; } It's done like this so that the internal value of gallonsSaved always matches the current distanceTravelled. If there is no setter for distanceTravelled and it's only set from the constructor, you can do the calculation in the constructor itself and it will then never change. You can even declare gallonsSaved final if you do that. The reason you keep getting 0 is that you seem to have picked the second option - keeping a hidden variable for the result of a calculation - but you never performed the calculation and stored it in it.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26577662
answers question: http://stackoverflow.com/q/26577662
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41771867
has text: You would need to add a getter method. See the following questions in SO [Why use getters and setters?](http://stackoverflow.com/questions/1568091/why-use-getters-and-setters) and [How do getters and setters work?](http://stackoverflow.com/questions/2036970/how-do-getters-and-setters-work)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26576848
score: 0

http://stackoverflow.com/a/26657013
downvote count: 0
answers question: http://stackoverflow.com/q/26656863
has body: How about getting all key names using getNames() and moving on from there? In Android it is names()
type: Answer
accepted answer of: http://stackoverflow.com/q/26656863
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26538773
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41703482
answers question: http://stackoverflow.com/q/26538709
downvote count: 0
score: 1
has body: The problem is here: while(roll != 2 || roll != 12) Think about it. If roll is 2, it won't be 12, and therefore false OR true is true If roll is 12, it won't be 2 and therefore true OR false is true If roll is anything else, true OR true is true. In short, there is no value for roll that will result in roll != 2 || roll != 12 evaluating to false. Thus you get an infinite loop.

http://stackoverflow.com/a/26570442
type: Answer
has body: you never incrememt i. thus i stays at the original value and your while loop runs forever...
score: 0
answers question: http://stackoverflow.com/q/26570406

http://stackoverflow.com/q/26650237
type: Question
tagged with: websphere
tagged with: jndi
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jms
has body: I have set up a JMSTemplate via JNDI like this: java:comp/env/jms/ConnectionFactory java:comp/env/jms/SchedulingRequestQueue My web.xml: JMS Connection jms/ConnectionFactory javax.jms.ConnectionFactory Container Shareable However, when I try to bind the JNDI resource in my Websphere, I get the following error when starting up my application: Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jms.core.JmsTemplate com.plexus.xesac_il.server.service.decide.DecideServiceImpl.jmsTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in class path resource [spring/xesac-il-appcontext-jms.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ibm.ws.sib.api.jms.impl.JmsManagedConnectionFactoryImpl' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ibm.ws.sib.api.jms.impl.JmsManagedConnectionFactoryImpl] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) ... 116 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in class path resource [spring/xesac-il-appcontext-jms.xml]: Initialization of bean failed; nested exception is org.springframewor…
has answer: http://stackoverflow.com/a/26650544
upvote count: 2
has title: Cannot convert value of type [JmsManagedConnectionFactoryImpl] to required type [javax.jms.ConnectionFactory]
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26650544

http://stackoverflow.com/a/26573847
answers question: http://stackoverflow.com/q/26573432
upvote count: 0
has comment: http://stackoverflow.com/comment/41770102
score: -1
has comment: http://stackoverflow.com/comment/41797984
downvote count: 1
has body: you can use Character.hashCode(char value).
type: Answer

http://stackoverflow.com/a/26568657
accepted answer of: http://stackoverflow.com/q/26568608
answers question: http://stackoverflow.com/q/26568608
type: AcceptedAnswer
downvote count: 0
has body: is there a way to manually prevent autoboxing? The only sure way would be use a version of Java earlier than Java 5, which was when autoboxing was introduced. Or maybe compiling with a -source flag that specifies Java 1.4 source compatibility would do it. Note: this won't work with javac in Java 9 or later, because support for -source less or equal to 5 has not been removed from javac. Doing either would be a really bad idea for anything other than experimentation. You would also lose a LOT of other important Java language features by reverting to the Java 1.4 level; e.g. generics, enums, and so on. In short, autoboxing / unboxing is a fundamental part of the modern Java language and it can't be turned off and on at will.
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/comment/41797773
has text: @bestsss I see no reason to do that. It still took time and effort to produce a worked example. If someone would like to post a better answer they are always welcome. I realise, of course, this response makes it seem like I care about a few upvotes, which at 25k I really don't. I mostly dislike how CW answers are editable by pretty much everyone.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26591296

http://stackoverflow.com/q/26635671
tagged with: java
upvote count: 10
tagged with: gradle
type: Question
downvote count: 0
score: 10
has body: In my project classes I've used java.util.logging.Logger and added various log output's throughout my code, using various log levels ie. src/main/java/Run.java import java.util.logging.Level; import java.util.logging.Logger; public class Run{ public static void main( String args[] ){ System.out.println("Hello World"); logger.log(Level.CONFIG, "Just some config info"); Logger logger = Logger.getLogger(Run.class.getName()); logger.log(Level.INFO, "Just logging some info"); logger.log(Level.FINE, "Fine logging"); logger.log(Level.FINER, "Finer logging"); logger.log(Level.WARNING, "This is a warning log!"); } } Currently when I run gradle -i test all log messages with the Level.INFO defined are shown but none of the config, warn or fine messages are output. I've tried updating my build.gradle file such that: apply plugin: 'java' apply plugin:'application' mainClassName = "Run" repositories { mavenCentral() } dependencies { testCompile "junit:junit:4.11" } run{ systemProperties = ['java.util.logging.config.file' : 'logging.properties'] } I've included: systemProperties = ['java.util.logging.config.file' : 'logging.properties'] Then created /src/main/resource/logging.propertiess handlers= java.util.logging.ConsoleHandler .level= CONFIG java.util.logging.ConsoleHandler.level = FINER java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter Running: gradle run I get: :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :run Hello World BUILD SUCCESSFUL And when running gradle -i run I get: Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java'' Hello World :run (Thread[main,5,main]) completed. Took 0.202 secs. BUILD SUCCESSFUL ie. no logging information. However commenting out the system.properties from within the run task and re-running gradle -i run I get: Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java'' Hello …
has answer: http://stackoverflow.com/a/26787050
answer count: 1
favorite count: 0
has title: Gradle Logging Output Levels
accepted answer: http://stackoverflow.com/a/26787050
tagged with: logging
type: AnsweredQuestion

http://stackoverflow.com/comment/41754081
has text: @cYrixmorten did not get i think that was database Question
comment on: http://stackoverflow.com/q/26567347
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41812308
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26598884
has text: Thank you both. I implemented @AlanKlaassen method correction and then the return suggested by Andreas, and it fixed my issue.

http://stackoverflow.com/comment/41710058
type: Comment
has text: http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html
comment on: http://stackoverflow.com/q/26543064
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41865761
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26624211
has text: Are you sure that this is a valid `ST`? Can you use it?

http://stackoverflow.com/q/26577873
upvote count: 0
has body: gets a single letter from the user. This method validates that it’s either a valid letter or the quit character, ‘!’. It'll eventually keep asking for characters, then once the user is done, they'll type ‘!’ to make the loop end and move on to printing their list of chars public static String isValidLetter(){ char[] charArray; charArray = new char[11]; charArray[0] ='C'; charArray[1] ='E'; charArray[2] ='F'; charArray[3] ='H'; charArray[4] ='I'; charArray[5] ='J'; charArray[6] ='L'; charArray[7] ='O'; charArray[8] ='P'; charArray[9] ='S'; charArray[10] ='T'; charArray[11] ='U'; String input; char letter; Scanner kb = new Scanner(System.in); System.out.println("Enter a single character: "); input=kb.nextLine(); letter = input.charAt(0);
tagged with: arrays
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26578177
has comment: http://stackoverflow.com/comment/41773443
score: -1
favorite count: 0
has title: How can I have a user search a character array for a letter?
type: Question
has comment: http://stackoverflow.com/comment/41773354
has answer: http://stackoverflow.com/a/26578160
has answer: http://stackoverflow.com/a/26578169
tagged with: java
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/41773399
has comment: http://stackoverflow.com/comment/41773437
has comment: http://stackoverflow.com/comment/41773346

http://stackoverflow.com/q/26520127
tagged with: linked-list
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26520191
answer count: 2
downvote count: 0
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26520155
has title: Is there a way to use "get" for a Linked list as you would in an ArrayList.
has answer: http://stackoverflow.com/a/26520155
has comment: http://stackoverflow.com/comment/41669579
favorite count: 0
has body: I am trying to use the get function as I do in an Array list but it's not working I wanted to know if there was any way to do so. private ArrayList&lt;OneFace&gt; face= new ArrayList&lt;OneFace&gt;(); private LinkedList&lt;String&gt; friend = new LinkedList&lt;String&gt;(); ; for (int i = 0 ; i&lt; profiles; i++) { String arrayName = face.get(i).getName(); System.out.println(arrayName); LinkedList&lt;String&gt; linkName = friend.getlink(i).getFriend(); System.out.println(linkName); } This works String arrayName = face.get(i).getName(); This doesn't work* LinkedList&lt;String&gt; linkName = friend.getlink(i).getFriend();
has answer: http://stackoverflow.com/a/26520191
type: AnsweredQuestion

http://stackoverflow.com/q/26553797
has answer: http://stackoverflow.com/a/26555366
type: AnsweredQuestion
tagged with: oop
downvote count: 0
score: 1
tagged with: java
tagged with: loops
type: Question
answer count: 2
has title: Getter within loop returning null after assigning values
tagged with: null
has body: I've got a slight problem with my program. Simply put, what I do is this: Choose the option to "Add a new Student record". When I try to display the newly added values (First Name, Last Name, Course), it all comes back as null. I can't wrap my head around what's wrong, but I'll try to post the needed codes in order for all of you to get a better view. Main class: public static void main(String[] args) throws Exception{ String cont1=" "; String X; int x1,arr_count=1; String[] option = {"First Name","Last Name","Course"}; BufferedReader reader1=new BufferedReader(new InputStreamReader(System.in)); do{ System.out.println("\nWelcome! Please select a task: \nA. View a record.\nB. Add a record.\nC. Edit a record.\nD. Exit the program."); String option1 = reader1.readLine(); if("a".equals(option1)|| "A".equals(option1)){ System.out.println("Please enter the Student ID for the record to view."); String a = reader1.readLine(); x1 = Integer.parseInt(a); for(int y=0;y&lt;3;y++){ System.out.print(Records.getRecord(x1,y) + " "); } System.out.print("\nSubjects and Grades: \n"); for(int y=3;y&lt;6;y++){ System.out.print(Records.getRecord(x1,y) + " (" + Records.getRecord(x1,y+3) + ")\n"); } System.out.println("\nReturn to Main Menu? (Y/N)"); cont1= reader1.readLine(); } else if("b".equals(option1)||"B".equals(option1)){ arr_count++; for (int y = 0; y&lt;3;y++){ System.out.println("Enter Value for "+ option [y]+":" ); X = reader1.readLine(); X = Records.getRecord(arr_count,y); } System.out.println("\nNew Student added:\nID number: "+ arr_count); for(int y=0;y&lt;3;y++){ X = Records.getRecord(arr_count,y); System.out.print(X + " "); } Records class: public class Records { public static String getRecord(int recordID,int index1)throws Exception{ //BufferedReader reader1=new BufferedReader(new InputStreamReader(System.in)); String records[][] = new String [10][9]; records[0][0] = "John"; records[0][3] = "English"; records[0][6] = "C"; records[0][1] = "Smith"; records[0][4] = "Math"; rec…
accepted answer: http://stackoverflow.com/a/26555212
upvote count: 1
has comment: http://stackoverflow.com/comment/41729866
possible better answer: http://stackoverflow.com/a/26555366
favorite count: 0
has answer: http://stackoverflow.com/a/26555212

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/26521613

template-engine
tags question: http://stackoverflow.com/q/26574096
tag name: template-engine
tags question: http://stackoverflow.com/q/26514974
type: Tag
tags question: http://stackoverflow.com/q/26597658
tags question: http://stackoverflow.com/q/26619956

http://stackoverflow.com/comment/41853503
has text: I works perfectly if I use: while (usStatus != 'y' && usStatus != 'Y') ------ I dont understand why, because far as I know with the && operator both conditions should be fulfilled. Thank you so much!
type: Comment
comment on: http://stackoverflow.com/a/26621440
type: AnswerComment
score: 0

http://stackoverflow.com/a/26525488
answers question: http://stackoverflow.com/q/26525444
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26525444
downvote count: 0
type: AcceptedAnswer
has body: use c1.getName() instead getName() because objects are null by the default so you are getting values before initialize .that's why you are getting null c1 hold a instance of Cyclist class. the values you set only update to instance which hold by c1 method local variable
type: Answer

http://stackoverflow.com/comment/42003341
score: 0
type: AnswerComment
has text: I finally got a chance to check out the example and I believe that is exactly what I am looking for.
type: Comment
comment on: http://stackoverflow.com/a/26644192

reflection
tags question: http://stackoverflow.com/q/26651208
tags question: http://stackoverflow.com/q/26657260
tags question: http://stackoverflow.com/q/26577903
tags question: http://stackoverflow.com/q/26532346
tags question: http://stackoverflow.com/q/26621995
tags question: http://stackoverflow.com/q/26665024
tags question: http://stackoverflow.com/q/26578984
type: Tag
tags question: http://stackoverflow.com/q/26554990
tags question: http://stackoverflow.com/q/26622232
tags question: http://stackoverflow.com/q/26597946
tags question: http://stackoverflow.com/q/26552067
tags question: http://stackoverflow.com/q/26649101
tags question: http://stackoverflow.com/q/26515016
tags question: http://stackoverflow.com/q/26519167
tag name: reflection
tags question: http://stackoverflow.com/q/26613588

http://stackoverflow.com/a/26652157
answers question: http://stackoverflow.com/q/26651621
upvote count: 10
type: Answer
has body: I think you have to add closeMethod="close" to your Resource in context.xml. Then Tomcat should close your DB connections when you reload context. Modified context.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context&gt; &lt;Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" username="root" password="admin" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/myDB?allowMultiQueries=true" defaultAutoCommit="false" initialSize="20" maxActive="50" maxIdle="30" minIdle="15" maxWait="5000" testOnBorrow="true" testWhileIdle="true" validationQuery="SELECT 1" timeBetweenEvictionRunsMillis="35000" minEvictableIdleTimeMillis="55000" removeAbandoned="true" removeAbandonedTimeout="3600" logAbandoned="true" validationInterval="35000" closeMethod="close" /&gt; &lt;/Context&gt;
downvote count: 0
score: 10
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26651621

http://stackoverflow.com/comment/44287616
type: Comment
has text: It's worth noting that if the value needs to be a Spring expression (SpEL), the value can be declared as an attribute and they null key can be declared as a child element
comment on: http://stackoverflow.com/a/26552299
type: AnswerComment
score: 0

http://stackoverflow.com/q/26563390
favorite count: 0
has answer: http://stackoverflow.com/a/72138150
possible better answer: http://stackoverflow.com/a/26564412
tagged with: javafx-8
has answer: http://stackoverflow.com/a/26564412
has title: Detect doubleclick on row of TableView JavaFX
upvote count: 72
has answer: http://stackoverflow.com/a/49065543
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/56036632
type: Question
has answer: http://stackoverflow.com/a/26565887
tagged with: tableview
accepted answer: http://stackoverflow.com/a/26565887
has body: I need to detect double clicks on a row of a TableView. How can I listen for double clicks on any part of the row and get all data of this row to print it to the console?
has answer: http://stackoverflow.com/a/48042771
has answer: http://stackoverflow.com/a/40411178
answer count: 7
has comment: http://stackoverflow.com/comment/41750935
score: 72

http://stackoverflow.com/a/65990642
type: Answer
has comment: http://stackoverflow.com/comment/136753854
answers question: http://stackoverflow.com/q/26580723
has comment: http://stackoverflow.com/comment/118153459
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/120184933
has body: You can scroll to the bottom of the last item, if the height of the last item is too large, you need to offset private void scrollToBottom(final RecyclerView recyclerView) { // scroll to last item to get the view of last item final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); final RecyclerView.Adapter adapter = recyclerView.getAdapter(); final int lastItemPosition = adapter.getItemCount() - 1; layoutManager.scrollToPositionWithOffset(lastItemPosition, 0); recyclerView.post(new Runnable() { @Override public void run() { // then scroll to specific offset View target = layoutManager.findViewByPosition(lastItemPosition); if (target != null) { int offset = recyclerView.getMeasuredHeight() - target.getMeasuredHeight(); layoutManager.scrollToPositionWithOffset(lastItemPosition, offset); } } }); }
downvote count: 0

date
tags question: http://stackoverflow.com/q/26596100
tags question: http://stackoverflow.com/q/26670997
tags question: http://stackoverflow.com/q/26637168
tag name: date
tags question: http://stackoverflow.com/q/26603650
tags question: http://stackoverflow.com/q/26588970
tags question: http://stackoverflow.com/q/26527539
tags question: http://stackoverflow.com/q/26599946
tags question: http://stackoverflow.com/q/26584582
tags question: http://stackoverflow.com/q/26551409
tags question: http://stackoverflow.com/q/26521469
tags question: http://stackoverflow.com/q/26625977
tags question: http://stackoverflow.com/q/26668068
tags question: http://stackoverflow.com/q/26630873
tags question: http://stackoverflow.com/q/26624412
tags question: http://stackoverflow.com/q/26522840
type: Tag
tags question: http://stackoverflow.com/q/26548747
tags question: http://stackoverflow.com/q/26573902
tags question: http://stackoverflow.com/q/26587953
tags question: http://stackoverflow.com/q/26528258
tags question: http://stackoverflow.com/q/26622883
tags question: http://stackoverflow.com/q/26642720
tags question: http://stackoverflow.com/q/26665594
tags question: http://stackoverflow.com/q/26624561
tags question: http://stackoverflow.com/q/26542359
tags question: http://stackoverflow.com/q/26575265
tags question: http://stackoverflow.com/q/26653543

http://stackoverflow.com/comment/41910413
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26653278
has text: Well you seem to be doing fine in your `AddMan` method. I'm not a Java developer, but if `Group` doesn't see `Man`, that could be because both classes are not in the same package.

http://stackoverflow.com/comment/41767881
comment on: http://stackoverflow.com/q/26575048
has text: The program stops at the "in.readLine()" method and i have no idea why.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41661586
type: AnswerComment
score: 0
type: Comment
has text: how can i get maxdepth? can i implement getdepth function in ArrayStack then use it here ?
comment on: http://stackoverflow.com/a/26515669

http://stackoverflow.com/a/26540182
upvote count: 1
answers question: http://stackoverflow.com/q/26540145
downvote count: 0
has body: I figured it out. Use sc.next() instead of line.
type: Answer
score: 1

http://stackoverflow.com/a/27053512
score: -2
has comment: http://stackoverflow.com/comment/42627519
has comment: http://stackoverflow.com/comment/43390815
type: Answer
answers question: http://stackoverflow.com/q/26632799
has body: No. Reason: compile time optimization. As you code: public int foo(){ int x; //Write code which does not use/initialize x } Most Java compilers will be able to figure out that x plays no role in the code execution thus they remove it entirely thanks to compilation optimization. Even if you use: int x = 999; x shouldn't be included - some dumb compilers may include it but this might change in the future. However, int x = methodA(); Will definitely have x included. Modern compilers will eliminate a lot of inefficiency in the code, so you can focus on your problems.
downvote count: 3
upvote count: 1

http://stackoverflow.com/q/26571817
has body: Is it important to define required attributes on the builder as final ? ( code performance ) This is an example illustrating my question : public class User { private final String firstName; // required private final String lastName; // required private final int age; // optional private final String phone; // optional private final String address; // optional private User(UserBuilder builder) { this.firstName = builder.firstName; this.lastName = builder.lastName; this.age = builder.age; this.phone = builder.phone; this.address = builder.address; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public int getAge() { return age; } public String getPhone() { return phone; } public String getAddress() { return address; } public static class UserBuilder { private final String firstName; // required private final String lastName; // required private int age; private String phone; private String address; public UserBuilder(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public UserBuilder age(int age) { this.age = age; return this; } public UserBuilder phone(String phone) { this.phone = phone; return this; } public UserBuilder address(String address) { this.address = address; return this; } public User build() { return new User(this); } } }
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41762669
has answer: http://stackoverflow.com/a/26572007
downvote count: 0
has title: Builder design pattern : Required attributes
answer count: 1
has comment: http://stackoverflow.com/comment/41761894
favorite count: 0
has comment: http://stackoverflow.com/comment/41761941
accepted answer: http://stackoverflow.com/a/26572007
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4279420

http://stackoverflow.com/comment/42824611
has text: @diminuta, sorry for long time no reply, was at vacation. Now you can view an answer if it is still actual.
comment on: http://stackoverflow.com/a/26642025
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/26567220
has comment: http://stackoverflow.com/comment/41757876
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/41753517
has comment: http://stackoverflow.com/comment/41753505
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/26569530
type: Question
has comment: http://stackoverflow.com/comment/41753799
has comment: http://stackoverflow.com/comment/41753550
has comment: http://stackoverflow.com/comment/41755409
upvote count: 0
answer count: 1
score: -1
tagged with: colors
has comment: http://stackoverflow.com/comment/41768174
has comment: http://stackoverflow.com/comment/41753720
has body: So I want to set my Rectangle's color to whatever the JColorChooser picks, but unfortunately, I don't think that it recognises it as it just stays black, unless I assign it a real color like Color.BLUE. This is the rectangle which should get the color from the other class: TestProjectJPanel jpp = new TestProjectJPanel(); public void paintComponent(Graphics g){ super.paintComponent(g); Rectangle r = new Rectangle(500,300,250,400); g.setColor(jpp.bodyColour); g.fillRect((int)r.getX(),(int)r.getY(),(int)r.getHeight(),(int)r.getWidth()); g.setColor(Color.BLUE); g.drawString("banana", 50, 60); } and this is the class which has the color itself import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TestProjectJPanel extends JFrame { public JButton b; public JButton u; public JButton l; public JButton r; public String s; public Color color = (Color.WHITE); public JPanel panel; public Color bodyColour; public Color doorColour; public Color wheelColour; public TestProjectJPanel(){ JFrame f = new JFrame(); panel = new JPanel(); panel.setBackground(color); // bodyColour button b = new JButton("Body Colour"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { bodyColour = JColorChooser.showDialog(null, "Pick the colour", bodyColour); if (bodyColour == null) bodyColour = Color.RED; } }); u = new JButton("Wheel Colour"); u.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ wheelColour = JColorChooser.showDialog(null, "Pick the colour", wheelColour); if (wheelColour == null) wheelColour = (Color.BLACK); } }); l = new JButton("Door Colour"); l.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { doorColour = JColorChooser.showDialog(null, "Pick the colour", doorColour); if(doorColour==null) doorColour = (Color.RED); } }); r = new JButton("Change Name"); r.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { s…
favorite count: 0
has title: Not recognising Color from different class
has comment: http://stackoverflow.com/comment/41753754

http://stackoverflow.com/comment/41804307
comment on: http://stackoverflow.com/q/26593603
type: Comment
type: QuestionComment
has text: You are making a network request on main thread, clear from `android.os.NetworkOnMainThreadException` Use AsycTask to do that
score: 1

http://stackoverflow.com/a/26630908
score: 0
has body: The JRegex project (which I am neither affiliated with nor have been a user of) might interest you. It claims to provide a Java library to handle perl regular expressions.
answers question: http://stackoverflow.com/q/26626909
type: Answer

http://stackoverflow.com/q/26537862
has body: I`ve been trying to bubble sort an array in java for some time now, but every time it just does a few and then it follows the array list. public void mysort() { Random randomNumbers = new Random(); int randomArray[] = new int[20]; for (int j = 0; j &lt;= 19; j++) { randomArray[j] = randomNumbers.nextInt(200 + 1); for (int k = 1; k &lt; 20; k++) { if (randomArray[k - 1] &lt; randomArray[k]) { int hjelp = randomArray[k - 1]; randomArray[k - 1] = randomArray[k]; randomArray[k] = hjelp; } } } for (int i = 0; i &lt;= 19; i++) { System.out.println(randomArray[i]); } } How do I make my bubble sort work properly?
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26537990
tagged with: sorting
score: -4
has title: sorting arrays only sorts a few
has comment: http://stackoverflow.com/comment/41701375
downvote count: 4
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26537972
favorite count: 0
possible better answer: http://stackoverflow.com/a/26537932
has answer: http://stackoverflow.com/a/26537932
has answer: http://stackoverflow.com/a/26537990
has comment: http://stackoverflow.com/comment/41701515
has comment: http://stackoverflow.com/comment/41701520
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41714880
has text: on your question, u have a switch case with the R.id.* of the correct or wrong imagebuttons. The logic is the same, but you store the R.id.* (_of the correct one_) on **correctAnswer** var any time you load that specific level.
type: AnswerComment
comment on: http://stackoverflow.com/a/26544772
score: 0
type: Comment

regex
tags question: http://stackoverflow.com/q/26533596
tags question: http://stackoverflow.com/q/26653572
tags question: http://stackoverflow.com/q/26638426
tags question: http://stackoverflow.com/q/26644577
tags question: http://stackoverflow.com/q/26592009
tags question: http://stackoverflow.com/q/26666827
tags question: http://stackoverflow.com/q/26658648
tag name: regex
tags question: http://stackoverflow.com/q/26537977
tags question: http://stackoverflow.com/q/26574114
tags question: http://stackoverflow.com/q/26514136
tags question: http://stackoverflow.com/q/26627366
tags question: http://stackoverflow.com/q/26590301
tags question: http://stackoverflow.com/q/26553567
tags question: http://stackoverflow.com/q/26541550
tags question: http://stackoverflow.com/q/26584836
tags question: http://stackoverflow.com/q/26526675
tags question: http://stackoverflow.com/q/26597099
tags question: http://stackoverflow.com/q/26522613
tags question: http://stackoverflow.com/q/26571151
tags question: http://stackoverflow.com/q/26652614
tags question: http://stackoverflow.com/q/26566862
tags question: http://stackoverflow.com/q/26541389
tags question: http://stackoverflow.com/q/26554746
tags question: http://stackoverflow.com/q/26655643
tags question: http://stackoverflow.com/q/26521315
tags question: http://stackoverflow.com/q/26595422
tags question: http://stackoverflow.com/q/26659296
tags question: http://stackoverflow.com/q/26608966
tags question: http://stackoverflow.com/q/26608967
tags question: http://stackoverflow.com/q/26523335
tags question: http://stackoverflow.com/q/26598264
tags question: http://stackoverflow.com/q/26644135
tags question: http://stackoverflow.com/q/26540742
tags question: http://stackoverflow.com/q/26622157
tags question: http://stackoverflow.com/q/26655820
tags question: http://stackoverflow.com/q/26565667
tags question: http://stackoverflow.com/q/26577685
tags question: http://stackoverflow.com/q/26566556
tags question: http://stackoverflow.com/q/26555346
tags question: http://stackoverflow.com/q/26598531
tags question: http://stackoverflow.com/q/26639685
tags question: http://stackoverflow.com/q/26543329
tags question: http://stackoverflow.com/q/26663222
tags question: http://stackoverflow.com/q/26582575
tags question: http://stackoverflow.com/q/26557109
tags question: http://stackoverflow.com/q/26574950
tags question: http://stackoverflow.com/q/26630590
tags question: http://stackoverflow.com/q/26531502
tags question: http://stackoverflow.com/q/26644852
tags question: http://stackoverflow.com/q/26564261
tags question: http://stackoverflow.com/q/26626909
tags question: http://stackoverflow.com/q/26624294
tags question: http://stackoverflow.com/q/26625932
tags question: http://stackoverflow.com/q/26525295
tags question: http://stackoverflow.com/q/26537930
tags question: http://stackoverflow.com/q/26645121
tags question: http://stackoverflow.com/q/26622890
tags question: http://stackoverflow.com/q/26664561
tags question: http://stackoverflow.com/q/26606090
tags question: http://stackoverflow.com/q/26536829
tags question: http://stackoverflow.com/q/26624627
tags question: http://stackoverflow.com/q/26546288
type: Tag
tags question: http://stackoverflow.com/q/26618188

http://stackoverflow.com/comment/115636659
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/50544655
has text: This is the answer in my opinion

http://stackoverflow.com/comment/41846185
type: AnswerComment
comment on: http://stackoverflow.com/a/26616770
score: 0
type: Comment
has text: I'm not sure what you are getting at. Once I have the SDK Manager open, I can access the AVD Manager for sure. Can't open either one though without launching the SDK Manager with command prompt.

http://stackoverflow.com/q/26617014
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47236375
has title: Translating a sentence from english to pig latin
answer count: 0
has comment: http://stackoverflow.com/comment/41851740
type: Question
has body: import java.util.*; public class Lab04D { public static boolean startsWithVowel (String a) { String VOWELS = "aeiouAEIOU"; return (VOWELS.indexOf(a) != -1); } public static int findVowel(String str) { for (int i = 0; i &lt; str.length(); i++) { if (startsWithVowel(str.charAt(i))) { return i; } } return -1; } public static String piggy (String str) { int firstVowel = findVowel(str); if (firstVowel &lt;= 0) { return str + "way"; } else { return str.substring(firstVowel, str.length()) + str.substring(0,firstVowel) + "ay"; } } public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter a sentence with 5 words:"); String str = input.nextLine(); //This is where I seperate the sentence into strings int space = str.indexOf(" "); String s1 = str.substring(0,space); String s2 = str.substring(space+1); int space2 = str.indexOf(" "); String s3 = str.substring(0,space2); String s4 = str.substring(space2+1); int space3 = str.indexOf(" "); String s5 = str.substring(0,space3); String s6 = str.substring(space3+1); int space4 = str.indexOf(" "); String s7 = str.substring(0,space4); String s8 = str.substring(space4+1); System.out.println(" My Pig Latin Translator"); System.out.println(" by: Student Name Here"); System.out.println("Your original sentence is:"+str); System.out.println("Your pig latin is: "+(piggy(s1))+" "+(piggy(s2))+" "+(piggy(s3))+" "+(piggy(s4))); } } I am attempting to translate this sentence but when I input the example sentence "pig latin is so cool" my output is "igpay atinlay is so cool". What can I do to separate these words so that each one will be translated?
tagged with: language-translation
score: 0

http://stackoverflow.com/comment/41807656
score: 0
type: Comment
has text: I generated my own keystore containing all of the certs from /etc/ssl/certs/ and put it as /etc/ssl/certs/java/cacerts. Now everything works fine. I am pretty sure that some package postinstall or something should have done this for me.
type: QuestionComment
comment on: http://stackoverflow.com/q/26594277

http://stackoverflow.com/a/26538095
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41702164
type: Answer
score: 17
upvote count: 17
accepted answer of: http://stackoverflow.com/q/26538048
has body: Square brackets [] would indicate an array. In your case of code: public double[] MethodName(){ .... } You have a public method MethodName which returns an array. Double indicates what type the array is, i.e. stores an array of objects of type double. EDIT: Forgot about answering your return question. But for your line of code, MethodName would return an array of type double (which would depend on the implmentation inside the method body). Hope that helps (I'm new to Java too; climbing the SO rep ladder)
answers question: http://stackoverflow.com/q/26538048

http://stackoverflow.com/comment/41922871
has text: Can you post the server side code(only api) because as per log it throws 500,so may be it's rest api issue?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26660030

http://stackoverflow.com/comment/41853116
type: Comment
has text: Well, by nature of inheritance, you already get that for free... anything in a `Sun` object is automatically passed down to a subclass object.
comment on: http://stackoverflow.com/a/26621117
type: AnswerComment
score: 0

http://stackoverflow.com/a/26580544
score: 1
answers question: http://stackoverflow.com/q/26580529
type: Answer
upvote count: 1
has body: Since your return statements are all inside one of your if-else clauses, you need to give a default return value for the case when none of your if-else conditions are met. Something like: public static int playGame(String userChoose) { System.out.println("Enter your choice."); userChoose=kbd.nextLine().toLowerCase(); String computerChoose=computerChoose(); if (userChoose.equals(computerChoose)) { return 3; } else if (userChoose.equals("rock")) { if (computerChoose.equals("scissors")) return 1; else if (computerChoose.equals("paper")) return 2; } else if (userChoose.equals("paper")) { if (computerChoose.equals("scissors")) return 2; else if (computerChoose.equals("rock")) return 1; } else if (userChoose.equals("scissors")) { if (computerChoose.equals("paper")) return 1; else if (computerChoose.equals("rock")) return 2; } return -1; //--&gt; the default return value }
downvote count: 0

http://stackoverflow.com/comment/41732679
type: Comment
has text: In the paper I should send a Header, then raw binary data, then the Footer, but I think that if I can store the raw data into the String, I can send it all in one step using BufferedWriter. About the Base64, I'm afraid that the other end won't use it. Maybe I'll ask them about it later.
type: AnswerComment
comment on: http://stackoverflow.com/a/26555232
score: 0

http://stackoverflow.com/comment/41879601
has text: Afaik the JIT will get rid of dead code and will even remove the 'int j=5'. So there is not really much point looking at the byte-code; you should look at the assembly.
type: AnswerComment
type: Comment
score: 3
comment on: http://stackoverflow.com/a/26632972

http://stackoverflow.com/comment/42107643
comment on: http://stackoverflow.com/q/26623108
type: QuestionComment
has text: what is your classpath look like?
type: Comment
score: 1

http://stackoverflow.com/q/26645449
has comment: http://stackoverflow.com/comment/41897115
linked to: http://stackoverflow.com/q/22745306
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26645747
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41896914
score: -1
tagged with: firebase
has title: Hashmap in RecycerView cannot be cast to List
tagged with: java
has comment: http://stackoverflow.com/comment/41896842
downvote count: 1
type: Question
has body: I have a List where the news class has a title, date, url, image Url, and Image alt. When i try to access the specific news item in the position of the array it throws a java.util.HashMap cannot be cast to News here is the Recycler Adapter http://hastebin.com/ohuvopoqiv.avrasm edit: here is the full exception 10-29 22:18:24.587 28148-28148/io.github.brady131313.shsnewspaper E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: io.github.brady131313.shsnewspaper, PID: 28148 java.lang.ClassCastException: java.util.HashMap cannot be cast to io.github.brady131313.shsnewspaper.News.NewsItem at io.github.brady131313.shsnewspaper.News.NewsAdapter.onBindViewHolder(NewsAdapter.java:53) at io.github.brady131313.shsnewspaper.News.NewsAdapter.onBindViewHolder(NewsAdapter.java:22) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:4048) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3366) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3258) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1803) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1302) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1265) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:522) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:1918) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2155) at android.view.View.layout(View.java:15745) at android.view.ViewGroup.layout(ViewGroup.java:4868) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at android.view.View.layout(View.java:15745) at android.view.ViewGroup.layout(ViewGroup.java:4868) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.…
tagged with: hashmap
tagged with: casting
upvote count: 0
has comment: http://stackoverflow.com/comment/41897693

http://stackoverflow.com/comment/78979039
comment on: http://stackoverflow.com/a/26665277
type: AnswerComment
has text: Although this doesn't directly address OP's question, this is the answer I was searching for.
type: Comment
score: 1

http://stackoverflow.com/comment/108858346
type: Comment
has text: good answer from Kev but it may worth pointing out 1>TCP belongs to layer 4 - transport layer while both HTTP and Websocket belong to layer 7 - application layer.
score: 3
comment on: http://stackoverflow.com/a/26560860
type: AnswerComment

http://stackoverflow.com/a/26566905
downvote count: 0
has body: regex = "[^\\d\\s\\+]" ^: not, negate d: number s: space +: you know :)
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41752777
accepted answer of: http://stackoverflow.com/q/26566862
type: Answer
answers question: http://stackoverflow.com/q/26566862
score: 2

http://stackoverflow.com/comment/41918516
type: AnswerComment
comment on: http://stackoverflow.com/a/26655231
score: 0
type: Comment
has text: Well, this will work until the OP tries this in a situation where there are quotes in the string that should be passed to the JavaScript side. (Probably not a huge risk for a contract number but could be a problem, generally.) What the OP wants to do is quite doable by passing the string as an argument. I do it all the time.

http://stackoverflow.com/q/26617474
favorite count: 0
tagged with: asynchttpclient
type: UnansweredQuestion
has title: async-http-client requests timing out with NettyAsyncHttpProvider
upvote count: 3
tagged with: java
type: Question
has body: I'm using async-http-client but I'm having trouble with NettyAsyncHttpProvider. It gives this warning: Oct 28, 2014 12:50:16 PM org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool WARNING: Failed to get all worker threads ready within 10 second(s). Make sure to specify the executor which has more threads than the requested workerCount. If unsure, use Executors.newCachedThreadPool(). My problem here is even if I use a Executors.newCachedThreadPool() the following issue will persist. Once the number of threads reaches the corePoolSize, requests get dropped. Whatever requestTimeoutInMs or other options I try, only a fraction of the responses come back and the threads in the pool stall. ExecutorService executor = new CustomThreadPoolExecutor(2, 2, 60, TimeUnit.SECONDS, new LinkedBlockingQueue&lt;Runnable&gt;(), new ThreadFactory() { @Override public Thread newThread(Runnable r) { int number = threadCreationCount.incrementAndGet(); LOG.info("newThread - {} ", number); Thread th = new Thread(r); th.setName("AsyncHttpClient-" + number); LOG.info("thread ={}", th); return th; } }); AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); builder.setMaximumConnectionsTotal(-1) .setMaximumConnectionsPerHost(-1) .setConnectionTimeoutInMs(1000) .setIdleConnectionInPoolTimeoutInMs(60000) .setIdleConnectionTimeoutInMs(60000) .setRequestTimeoutInMs(3000) .setFollowRedirects(true) .setMaximumNumberOfRedirects(5) .setAllowPoolingConnection(true) .setIOThreadMultiplier(4) .build(); builder.setExecutorService(executor); AsyncHttpClientConfig config = builder.build(); AsyncHttpClient client = new AsyncHttpClient(new NettyAsyncHttpProvider(config), config); //Spin up 500 async requests to google.com for (int i = 1; i &lt;= 500; i++) { LOG.info("i = {}", i); ListenableFuture&lt;Response&gt; future = client.prepareGet("http://www.google.com").execute( new AsyncCompletionHandler&lt;Response&gt;() { @Override public Response onCompleted(Response response) throws Exc…
has answer: http://stackoverflow.com/a/34633548
answer count: 2
downvote count: 0
tagged with: threadpoolexecutor
has answer: http://stackoverflow.com/a/34303589
score: 3
tagged with: netty

http://stackoverflow.com/q/26670459
has title: how to implement an url seen test / cache across multiple crawlers and maintain a good performance?
has comment: http://stackoverflow.com/comment/41941507
has comment: http://stackoverflow.com/comment/41942503
tagged with: java
tagged with: database
tagged with: mysql
tagged with: web-crawler
tagged with: caching
type: Question
has comment: http://stackoverflow.com/comment/41945514
has comment: http://stackoverflow.com/comment/41941869
score: 0
has comment: http://stackoverflow.com/comment/41941651
has comment: http://stackoverflow.com/comment/41941575
has body: Currently I am developing a small webcrawler for private testing purpose. My basic setup is like this: -2 Computers do the crawling (small ram) -1 Computer is the main "Database" (big ram). My primary question is how to properly implement a URL seen test across multiple crawlers? If I only had 1 crawler I would implement a bloom filter in java, but I got stuck on how to do this when you have "infinite" crawlers - since they needed to be "synchronized"? So there needs to be a central cache or something, and how does it stay fast? Querying MySQL with millions of rows after some time may be really slow...
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26635784
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41902572
has answer: http://stackoverflow.com/a/26638403
has comment: http://stackoverflow.com/comment/41879411
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26635990
has comment: http://stackoverflow.com/comment/41879227
upvote count: 1
has body: I have a simpe XML that I want to unmarshall into a model class. I have annotated the class with JAXB annotations for defining the access type (FIELD): import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @XmlAccessorType(XmlAccessType.FIELD) public class DtoTest { private String name; public DtoTest() {} public DtoTest(String name) { super(); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "DtoTest [name=" + name + "]"; } } This is my main class where I run an unmarshal method against a simple XML saved in a String variable: public class Test { public static void main(String[] args) throws Exception { Object obj = new DtoTest(); String testXML = " example "; obj = unmarshal(obj, testXML); System.out.println(obj); } /* This is a generic unmarshall method which I've already used with success with other XML*/ public static <T> T unmarshal(T obj, String xml) throws Exception { XMLInputFactory xif = XMLInputFactory.newFactory(); XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(xml)); Class<? extends Object> type = obj.getClass(); JAXBContext jc = JAXBContext.newInstance(type); Unmarshaller unmarshaller = jc.createUnmarshaller(); obj = (T)unmarshaller.unmarshal(xsr, type).getValue(); xsr.close(); return obj; } } Whenever I run the code I get the same output: DtoTest [name=null] I don't understand what I'm doing wrong.
type: Question
score: 1
tagged with: java
answer count: 2
downvote count: 0
favorite count: 0
tagged with: jaxb
has title: Unmarshall with JAXB doesn't work

jakarta-ee
tags question: http://stackoverflow.com/q/26573538
tags question: http://stackoverflow.com/q/26555779
tags question: http://stackoverflow.com/q/26583255
tags question: http://stackoverflow.com/q/26572608
tags question: http://stackoverflow.com/q/26654634
tags question: http://stackoverflow.com/q/26573424
tags question: http://stackoverflow.com/q/26533616
tags question: http://stackoverflow.com/q/26515733
tags question: http://stackoverflow.com/q/26534400
type: Tag
tags question: http://stackoverflow.com/q/26578890
tags question: http://stackoverflow.com/q/26546389
tags question: http://stackoverflow.com/q/26565682
tags question: http://stackoverflow.com/q/26585462
tags question: http://stackoverflow.com/q/26578239
tags question: http://stackoverflow.com/q/26548771
tags question: http://stackoverflow.com/q/26647399
tags question: http://stackoverflow.com/q/26608642
tags question: http://stackoverflow.com/q/26623311
tags question: http://stackoverflow.com/q/26588667
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/26616239
tags question: http://stackoverflow.com/q/26668016
tags question: http://stackoverflow.com/q/26636295
tags question: http://stackoverflow.com/q/26604337
tags question: http://stackoverflow.com/q/26527892
tags question: http://stackoverflow.com/q/26579686
tags question: http://stackoverflow.com/q/26558373
tags question: http://stackoverflow.com/q/26525685
tags question: http://stackoverflow.com/q/26640218
tags question: http://stackoverflow.com/q/26614832
tags question: http://stackoverflow.com/q/26641879
tags question: http://stackoverflow.com/q/26611022
tags question: http://stackoverflow.com/q/26549868
tags question: http://stackoverflow.com/q/26598628
tags question: http://stackoverflow.com/q/26605791
tags question: http://stackoverflow.com/q/26573612
tags question: http://stackoverflow.com/q/26583927
tags question: http://stackoverflow.com/q/26546404
tags question: http://stackoverflow.com/q/26561995
tags question: http://stackoverflow.com/q/26600690
tags question: http://stackoverflow.com/q/26542892
tags question: http://stackoverflow.com/q/26667071
tags question: http://stackoverflow.com/q/26590141
tags question: http://stackoverflow.com/q/26588439
tags question: http://stackoverflow.com/q/26592258
tags question: http://stackoverflow.com/q/26614438
tags question: http://stackoverflow.com/q/26572401
tags question: http://stackoverflow.com/q/26541756
tags question: http://stackoverflow.com/q/26564598
tags question: http://stackoverflow.com/q/26605477
tags question: http://stackoverflow.com/q/26553984

http://stackoverflow.com/a/32651228
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26560185
has body: You need to make sure all the assertion conditions are true. (labels.isContinuous() &amp;&amp; labels.type() == CV_32S &amp;&amp; (labels.cols == 1 || labels.rows == 1) &amp;&amp; labels.cols + labels.rows - 1 == data.rows) Here labels refers your model, therefore you need to make sure all the properties are correctly set before you passed it into the cvKMeans2 function. Access the each property and see which one causing the error. Simple System.out.println("Type :" + model .type()); would do. I can clearly see that your model.type() is not CV_32S, since you cloned it from IplImage directly it in default format IPL_DEPTH_8U, convert it to IPL_DEPTH_32S. Likewise, figure out one by one. Regards.

http://stackoverflow.com/a/26666401
has comment: http://stackoverflow.com/comment/41934586
has body: Yes and no... You could make the Painter transparent and overlay the snake on top of the walls, but the call to g.fillRect(0, 0, 500, 500); would make that redundant, as it fills the entire component with the current color... Seen as the paintComponent method for both painters would be called every time you want to update the UI, it's also kind of pointless. A better solution would be to render the map to BufferedImage and paint it inside the painter before painting the snake.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41934566
accepted answer of: http://stackoverflow.com/q/26666369
answers question: http://stackoverflow.com/q/26666369

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/26538999
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/26627981

http://stackoverflow.com/comment/41728287
score: 0
type: AnswerComment
has text: I've given the OP the benefit of the doubt that `Array<>` is simply a typo for `ArrayList<>`. On that basis, everything I've said is correct, relevant to the question and certainly does _not_ merit a downvote. Whether it's 1D or 2D makes no difference.
comment on: http://stackoverflow.com/a/26552928
type: Comment

http://stackoverflow.com/q/26569921
tagged with: swing
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26569952
accepted answer: http://stackoverflow.com/a/26569952
downvote count: 0
has answer: http://stackoverflow.com/a/26569945
favorite count: 0
has title: Checking if file exists when saving file in Java Swing
type: AnsweredQuestion
score: 2
has body: So, I am saving XML data in Java. I am allowing the user to choose to path and name. Now, if the file already exists, I want to prompt them with a message like: "Do you want to overwrite the current file?" Is there anyway I can do this? Thanks JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(".")); chooser.setApproveButtonText("Save"); chooser.setDialogTitle("Save"); FileFilter filter = new FileNameExtensionFilter("XML File", new String[] { "xml" }); chooser.setFileFilter(filter); chooser.addChoosableFileFilter(filter); int r = chooser.showOpenDialog(this); if (r == JFileChooser.APPROVE_OPTION) { try { JAXBContext jaxbContext = JAXBContext.newInstance(Shapes.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); File XMLfile = new File(chooser.getSelectedFile().toString() + ".xml"); jaxbMarshaller.marshal(myShapes, XMLfile); } catch (JAXBException e) { e.printStackTrace(); } } }
upvote count: 2
tagged with: java
tagged with: save
possible better answer: http://stackoverflow.com/a/26569945

http://stackoverflow.com/comment/41832602
score: 0
type: Comment
type: QuestionComment
has text: Your question is not very clear. Please provide a SSCCE http://sscce.org/
comment on: http://stackoverflow.com/q/26610174

http://stackoverflow.com/a/26564089
type: Answer
upvote count: 0
score: -1
has body: Forwarding directly to error pages not to error handler. Maybe this can be accessible for you: 500 /resources/errorPage404.jsp
downvote count: 1
answers question: http://stackoverflow.com/q/26563879
has comment: http://stackoverflow.com/comment/41747873

http://stackoverflow.com/comment/41694547
has text: Still got the same errors.
comment on: http://stackoverflow.com/q/26533238
score: 0
type: Comment
type: QuestionComment

android-wifi
tags question: http://stackoverflow.com/q/26569361
tag name: android-wifi
type: Tag

http://stackoverflow.com/comment/41808662
comment on: http://stackoverflow.com/q/26594271
score: 0
type: Comment
type: QuestionComment
has text: I don't see the point of the enum here?

http://stackoverflow.com/a/26514870
has comment: http://stackoverflow.com/comment/41659797
score: 0
has comment: http://stackoverflow.com/comment/41659869
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41659661
has body: Calculate the count and count2 inside the loop. This way it'll increment. count = annualSales;//initial value for (int i = 0; i &lt; 10; i++) { count = count + 5000;//increment it by 5000 every iteration count2 = count * .03 * 1.25;//recalcualte count2 System.out.println(count + " | " + count2 ); }
type: Answer
accepted answer of: http://stackoverflow.com/q/26514751
answers question: http://stackoverflow.com/q/26514751

http://stackoverflow.com/comment/41699272
has text: no, you haven't understood me right. I want this Regex ^([^Then]*)(Then+)(.*)(\r?\n|$) But that don't higlight any "Then" when it's commented code " ' ".
comment on: http://stackoverflow.com/a/26521543
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26540516
score: 0
has body: Before trying to write data, you need to check if data is present in the queue. If not, you can use Thread.sleep() to yield to the other threads then try again when the thread wakes up, or you can create a wait condition, and have the other threads notify the wait when they have written data.
type: Answer
has comment: http://stackoverflow.com/comment/41706244
answers question: http://stackoverflow.com/q/26540358
has comment: http://stackoverflow.com/comment/41705985

http://stackoverflow.com/comment/41702845
score: 0
has text: it's most likely logic in your while loop
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26538709

http://stackoverflow.com/a/26534154
has body: Your code should read: public enum MyConstantsEnum { MY_DATE_FORMAT("sdes"), BATCH_SIZE(3); MyConstantsEnum(final String value) { // do something } MyConstantsEnum(final int value) { // do something } } Note the comma after MY_DATE_FORMAT and not the semi-colon that you have. That said, this design will likely create significant issues downstream.
has comment: http://stackoverflow.com/comment/41723271
has comment: http://stackoverflow.com/comment/41694652
score: 0
answers question: http://stackoverflow.com/q/26533940
type: Answer

http://stackoverflow.com/a/26602174
has body: Restrictions in .htaccess usually only affect the data sent by the server, i.e. the server might send a arror code 403 and a HTML page with some error message. This, however, is all part of the HTTP protocol, and it requires a functioning TCP connection. The server might close the connection after the response, even if the client want a persistent connection. But this is something the client has to be able to deal with anyway. In short: no restrictions in .htaccess should not cause the problems you describe.
accepted answer of: http://stackoverflow.com/q/26602098
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26602098
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26679142
has body: Unsure if this answers your question, but have you considered Spring Data? I have used it with ElasticSearch and it was fairly powerful. Can expose data via an interface and some minor annotations. It also gives you a level of freedom to swap out the data layer with another technology. It can perform the mapping for you although do a manual review afterwards as there can be some oddities.
answers question: http://stackoverflow.com/q/26566813
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26606579
upvote count: 3
has comment: http://stackoverflow.com/comment/41836545
score: 3
has comment: http://stackoverflow.com/comment/41861509
has body: Lets clear out your FIFO and LRU understanding. FIFO: the operating system keeps track of all the pages in memory in a queue, with the most recent arrival at the back, and the oldest arrival in front. When a page needs to be replaced, the page at the front of the queue (the oldest page) is selected. While FIFO is cheap and intuitive, it performs poorly in practical application. eg. if you have 10 shoes with you and your mom says trash out any 5, then you will choose the oldest 5 to trash out. LRU: LRU works on the idea that pages that have been most heavily used in the past few instructions are most likely to be used heavily in the next few instructions too. eg. here, if you have 10 shoes with you and your mom says trash out any 5, then you will chose those 5 shoes to trash out which you use less frequently.
downvote count: 0
has comment: http://stackoverflow.com/comment/41839845
has comment: http://stackoverflow.com/comment/41841342
type: Answer
has comment: http://stackoverflow.com/comment/41839884
answers question: http://stackoverflow.com/q/26603903

http://stackoverflow.com/q/26521214
has comment: http://stackoverflow.com/comment/41671493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41675991
score: 3
has comment: http://stackoverflow.com/comment/41673331
tagged with: java
has body: I am trying to develop a game in which I need to draw a grid. For that I am using the paintComponent(Graphics g) method which is being called by repaint() method. The problem is that the repaint method is inside the infinite While loop and it never calls the paintComponent() method unless I minimize and maximize the screen. After that it works fine and calls the paintComponent() perfectly in the while loop. So in short, I need to trigger it by Minimizing-Maximizing the screen. Can anybody help me out? In the code you can see 3 classes namely, Frame.java, MenuHandler.java &amp; Screen.java. Code starts from the main method in Frame class and it adds the Screen class to itself as Screen extends JPanel. However, the control goes to the Screen class only when user selects "Create Map" on the menu. Then MenuHandler class passes the control to the Screen class where the run method is called in the createMap method and I invoking the repaint method inside this run method. package so; public class Screen extends JPanel implements Runnable { Frame frame; public Screen(Frame frame) { this.frame = frame; } public void createMap() { thread.start(); } public void paintComponent(Graphics g) { g.setColor(Color.BLUE); } @Override public void run() { System.out.println("Success******"); long lastFrame = System.currentTimeMillis(); int frames = 0; running = true; scene = 0; // the map grid would be refreshed every 2 ms so that we don't get the // flickering effect while (running) { frames++; if (System.currentTimeMillis() - 1000 &gt;= lastFrame) { fps = frames; frames = 0; lastFrame = System.currentTimeMillis(); } // to draw stuff all the time on the screen : goes around 2 millions // frames per second. Which is of no use. repaint(); try { Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } } System.exit(0); } } Timer code in the run method: public void run() { System.out.println("Success"); long lastFrame = System.currentTimeMillis(); int frames = 0; running =…
type: Question
has comment: http://stackoverflow.com/comment/41672479
has answer: http://stackoverflow.com/a/26552933
accepted answer: http://stackoverflow.com/a/26552933
answer count: 1
has comment: http://stackoverflow.com/comment/41673164
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/41676424
has comment: http://stackoverflow.com/comment/41672701
has title: paintComponent() gets called only when Minimizing-Maximizing Screen
has comment: http://stackoverflow.com/comment/41672672
has comment: http://stackoverflow.com/comment/41672550
tagged with: paintcomponent
tagged with: repaint
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/41674813
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/41727938

http://stackoverflow.com/a/26593729
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26593228
score: 1
upvote count: 1
has body: Having: String inputString = "my dog did a Foo"; 1. To convert a String to an array of chars: In your case, maybe an ArrayList is not the best option. You could simply use a char array: char[] allStringChars; The String class already provides a method for that, or you can do this with some loop like the following algorithm: declare allStringChars with the inputString size declare i as 0 for each char on inputString do copy the char at inputString[i] to the allStringChars[i] increment i end To get a specific char from inputString, use inputString.chatAt(i) method. 2. Do operations on the values: After to covert the inputString to a array of characters, your can obtain the integer value of any character: int firstValue = allStringChars[0]; int lastValue = allStringChars[allStringChars.length - 1]; Hope it helps.

tomcat
tags question: http://stackoverflow.com/q/26624612
tags question: http://stackoverflow.com/q/26590154
tags question: http://stackoverflow.com/q/26646372
tags question: http://stackoverflow.com/q/26610513
tags question: http://stackoverflow.com/q/26612925
tags question: http://stackoverflow.com/q/26651621
tags question: http://stackoverflow.com/q/26528001
tags question: http://stackoverflow.com/q/26515700
tags question: http://stackoverflow.com/q/26543633
tags question: http://stackoverflow.com/q/26548929
tags question: http://stackoverflow.com/q/26572116
tags question: http://stackoverflow.com/q/26589484
tags question: http://stackoverflow.com/q/26656421
tags question: http://stackoverflow.com/q/26523575
tags question: http://stackoverflow.com/q/26581348
tags question: http://stackoverflow.com/q/26639651
tags question: http://stackoverflow.com/q/26548028
tags question: http://stackoverflow.com/q/26575669
tags question: http://stackoverflow.com/q/26590249
tags question: http://stackoverflow.com/q/26607949
tags question: http://stackoverflow.com/q/26601841
tags question: http://stackoverflow.com/q/26574032
tags question: http://stackoverflow.com/q/26594346
tags question: http://stackoverflow.com/q/26540645
tags question: http://stackoverflow.com/q/26671824
tags question: http://stackoverflow.com/q/26669391
tags question: http://stackoverflow.com/q/26573258
tags question: http://stackoverflow.com/q/26590431
tags question: http://stackoverflow.com/q/26641425
tags question: http://stackoverflow.com/q/26646495
tags question: http://stackoverflow.com/q/26557628
tags question: http://stackoverflow.com/q/26586661
tags question: http://stackoverflow.com/q/26661515
tags question: http://stackoverflow.com/q/26567263
tags question: http://stackoverflow.com/q/26636452
tags question: http://stackoverflow.com/q/26549037
tags question: http://stackoverflow.com/q/26558976
tags question: http://stackoverflow.com/q/26628161
tag name: tomcat
tags question: http://stackoverflow.com/q/26645186
tags question: http://stackoverflow.com/q/26529912
tags question: http://stackoverflow.com/q/26654461
tags question: http://stackoverflow.com/q/26520904
tags question: http://stackoverflow.com/q/26592310
tags question: http://stackoverflow.com/q/26622236
tags question: http://stackoverflow.com/q/26648103
tags question: http://stackoverflow.com/q/26637550
tags question: http://stackoverflow.com/q/26655480
tags question: http://stackoverflow.com/q/26670684
tags question: http://stackoverflow.com/q/26624278
tags question: http://stackoverflow.com/q/26545186
tags question: http://stackoverflow.com/q/26636958
tags question: http://stackoverflow.com/q/26588958
tags question: http://stackoverflow.com/q/26546564
tags question: http://stackoverflow.com/q/26517169
tags question: http://stackoverflow.com/q/26548783
tags question: http://stackoverflow.com/q/26537355
tags question: http://stackoverflow.com/q/26608877
tags question: http://stackoverflow.com/q/26534400
tags question: http://stackoverflow.com/q/26522475
tags question: http://stackoverflow.com/q/26647179
type: Tag
tags question: http://stackoverflow.com/q/26524418
tags question: http://stackoverflow.com/q/26668186
tags question: http://stackoverflow.com/q/26585911
tags question: http://stackoverflow.com/q/26526261
tags question: http://stackoverflow.com/q/26570839
tags question: http://stackoverflow.com/q/26580935
tags question: http://stackoverflow.com/q/26562615
tags question: http://stackoverflow.com/q/26585462
tags question: http://stackoverflow.com/q/26635721
tags question: http://stackoverflow.com/q/26621140
tags question: http://stackoverflow.com/q/26637800
tags question: http://stackoverflow.com/q/26667319
tags question: http://stackoverflow.com/q/26585584
tags question: http://stackoverflow.com/q/26617414
tags question: http://stackoverflow.com/q/26628656
tags question: http://stackoverflow.com/q/26563879
tags question: http://stackoverflow.com/q/26648580
tags question: http://stackoverflow.com/q/26618637

http://stackoverflow.com/a/26604507
has comment: http://stackoverflow.com/comment/41822229
has body: Unit testing business logic becomes very complicated if user-interface code is mixed in with it. Ideally, you should adopt a design pattern, such as MVC or MVP that prevents this entirely. If you can't or won't go down that route, consider defining an interface that contains all your message box methods. E.g. public interface MessagePrompter { boolean poseQuestion(title, message); // ... } In your class constructor, accept an object of this type and store it. In your tests, you can mock this object and use it to control what the test user has done. In your production code, use a concrete implementation of this interface that calls your MessageBoxProvider methods. This type of approach has the benefit of making your application more portable. If you want to release a command-line version or a web-based version, you simply change the way your concrete implementation behaves.
type: Answer
has comment: http://stackoverflow.com/comment/41822924
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26604220
downvote count: 0

http://stackoverflow.com/comment/41926907
comment on: http://stackoverflow.com/q/26662366
score: 0
has text: Make sure you have the correct version of Java installed. At first glance, it seems to me that you don't have the correct libraries installed or eclipse is looking in the wrong place.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26561645
has title: ArrayList returning null value
has body: I'm working on a Java application. I create a Singleton class to restrict the instantiation of this class to one object. In the same class I've got a method which returns an ArrayList of object called GuestAgent. Here my method: //Singleton class: Tenant public ArrayList&lt;GuestAgent&gt; gAgentList() { final ArrayList&lt;GuestAgent&gt; guestAgents = new ArrayList&lt;&gt;(); String url = "http://localhost:8080/StackUI/v2.0/"; url = url + this.tenantId; url = url + "/os-agents"; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url)); builder.setHeader("X-Auth-Token", this.tokenId); try { builder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { Window.alert("Attenzione si è verificato un errore"); } @Override public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { final HTML respBox = new HTML(); respBox.setHTML(response.getText()); String risposta = response.getText(); JSONValue jsonValue; JSONArray jsonArray; JSONObject jsonObject; JSONString jsonString; JSONNumber jsonNumber; jsonValue = JSONParser.parseStrict(risposta); if ((jsonObject = jsonValue.isObject()) == null) { Window.alert("Error parsing the JSON"); } jsonValue = jsonObject.get("agents"); if ((jsonArray = jsonValue.isArray()) == null) { Window.alert("Error parsing the JSON"); } for (int i = 0; i &lt; jsonArray.size(); i++) { GuestAgent guestAgent = new GuestAgent(); jsonValue = jsonArray.get(i); if ((jsonObject = jsonValue.isObject()) == null) { Window.alert("Error parsing the JSON"); } jsonValue = jsonObject.get("agent_id"); if ((jsonNumber = jsonValue.isNumber()) == null) { Window.alert("Error parsing the JSON"); } guestAgent.setAgentId(jsonNumber.toString()); jsonValue = jsonObject.get("architecture"); if ((jsonString = jsonValue.isString()) == null) { Window.alert("Error parsing the JSON"); } guestAgent.setArchitecture(jsonString.stringValue()); jsonValue = json…
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26561746
tagged with: singleton
tagged with: android
has comment: http://stackoverflow.com/comment/41743664
has comment: http://stackoverflow.com/comment/41743631
possible better answer: http://stackoverflow.com/a/26561746
has comment: http://stackoverflow.com/comment/41743586
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26561808
accepted answer: http://stackoverflow.com/a/26561808
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2

http://stackoverflow.com/a/26552169
type: Answer
has comment: http://stackoverflow.com/comment/41731207
score: 1
upvote count: 1
has body: Think about what you're really testing, what you're really trying to test. The test name can be very helpful. You call this "daemonIsSuccessfullyInstalled", but you are trying to test that, after starting, its status is "running". Try to name your test methods starting with "should": "shouldBeRunningWhenStarted", maybe. In terms of implementation - you're not testing how isRunning() is implemented, just that it returns true after the object starts. Simplest possible implementation (simplest thing that could possibly work): return true;. Now, you know that's not really working, so you need to exercise it a bit more. Maybe put an assertion before calling start that ensures it's not already running. You're not really testing what isRunning does. You might want to, as a separate unit test, and that test might incorporate mocks. This test is just about the interaction between start and `isRunning'.
has comment: http://stackoverflow.com/comment/41731977
downvote count: 0
answers question: http://stackoverflow.com/q/26551541

http://stackoverflow.com/a/26574941
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26574873
upvote count: 2
has body: OK. So, the user inputs a card number X, and the program should list all the cards owned by the person owning the card X. So, that's what you should implement. In pseudo code: Card cardX = findCardWithNumber(x); String owner = cardX.getOwner(); for (Card card: allCards) { if (card.getOwner().equals(owner)) { System.out.println(card); } }
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26574873

http://stackoverflow.com/q/26648004
has answer: http://stackoverflow.com/a/26648212
accepted answer: http://stackoverflow.com/a/26648451
type: Question
possible better answer: http://stackoverflow.com/a/26648212
linked to: http://stackoverflow.com/q/10631715
has comment: http://stackoverflow.com/comment/41900859
score: 0
answer count: 2
tagged with: jsp
has title: how to store select box values from DB by spilit comma(,)?
has answer: http://stackoverflow.com/a/26648451
has body: I am trying to fill the select box values(split values by comma) from mysql database.First, i show my DB design below, Standard Subject Features I Science Plants,Animals,Humans,Nature I Maths Integer,Division,Modules II Science BB,CC,DD,FF,GG my code i tried so far, ListFeature.jsp &lt;select name="chapterdropdown" id="chapterdropdown" onchange="selectchange()"&gt; &lt;% Class.forName("com.mysql.jdbc.Driver"); Connection connection =DriverManager.getConnection("jdbc:mysql://localhost:3306/raptor1_5","root",""); Statement st=connection.createStatement(); ResultSet rs=st.executeQuery("select * from contentselection where Standard='"+class1+"' and Subject='"+subject+"'"); while(rs.next()) { String featvar = rs.getString("Features"); // here how to split the features by comma??? %&gt; &lt;option&gt;&lt;%=featvar%&gt;&lt;/option&gt; &lt;% } %&gt; %&gt; &lt;/select&gt; there selected feautures should display one by one in chapterdropdown select box. Please someone fix my problem.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41827277
type: Comment
has text: Alright! Thanks for your help I'll try to look into it with inflate. From what I understood is, add 1 listitem in XML and duplicate it with inflate right?
comment on: http://stackoverflow.com/a/26605353
type: AnswerComment
score: 0

http://stackoverflow.com/q/26577015
answer count: 2
tagged with: arrays
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/4450628
has comment: http://stackoverflow.com/comment/41771629
has comment: http://stackoverflow.com/comment/41771691
has comment: http://stackoverflow.com/comment/41771665
type: UnansweredQuestion
upvote count: 1
has body: I need to dynamically resize an array several times rather than guessing how many elements will be in it. I have code done for this but it doesn't seem to be working, Could anyone help me figure out what's wrong! Basically I need to keep adding to the match array when a match is found (another method is implemented for this). Currently it just fills the matches array and then gives an ArrayIndexOutOfBoundsException for the next element it tries to put in the array. Here are the 2 functions. Thanks private static String[] subStrings(String[] tokens) { String[] matches; matches = new String[40]; //creates a new array of matches for (int i = 0; i &lt;=tokens.length; i++){ for (int j = i+1; j &lt;tokens.length;j++){ if(Text.match(tokens[i],tokens[j])){ matches[i]=(tokens[i]+" | "+tokens[j]); System.out.println(matches[i]); if(matches[matches.length-1]!=null){ reSize(matches, matches.length+10); } } } } public static String[] reSize(String[] matches, int s){ if(s&lt;0){ return null; } String BiggerMatch[] = new String[s]; for(int i=0; i&lt; matches.length; ++i){ BiggerMatch[i]=matches[i]; //saves the original array in a temporary variable } matches = new String[s]; //adds s integer to the array size of matches for(int i=0; i&lt;=matches.length - s ; i++){ //leaves s spaces null at the end of the array matches[i]= BiggerMatch[i]; } matches = BiggerMatch; subStrings(matches); //sending the new array back to the subStrings method return BiggerMatch;//returns the new array } }
has comment: http://stackoverflow.com/comment/41771628
type: Question
has answer: http://stackoverflow.com/a/26577142
has title: "Resizing" an Array in Java, and sending it back
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26577071

http://stackoverflow.com/comment/41739572
type: Comment
comment on: http://stackoverflow.com/a/26559344
type: AnswerComment
has text: Every line downward in the text file is being read, not going from left to right.
score: 0

http://stackoverflow.com/q/26539422
has answer: http://stackoverflow.com/a/26539454
accepted answer: http://stackoverflow.com/a/26548024
has body: I am developing an ANT build script that should be invoked via another application (the Oxygen XML editor). This application passes some properties, one of which is a path, encoded as an URL (note: I don't have control over this input; it just is an URL). For example, the property ${project.url} is assigned file:/F:/projectpath/. In my ANT script, I'm stripping the file:/ part to get a path I can use in ANT tasks like &lt;mkdir dir="${project.path}/_temp/&gt;. Yet, this appears to be too simplistic for more complex URLs. Suppose the project path contains a space. Then the ${project.url} property will be assigned file:/F:/project%20path/. Just stripping out the 'file:/ part results in a path that is still problematic to ANT tasks. In this case, the URL encoded space character (%20) should be decoded again to a space for the &lt;mkdir/&gt; task above to work. Of course, this problem isn't limited to spaces, but applies to all characters that will end up escaped in the encoded URL. Therefore, the URL should be properly decoded in order to be of use in ANT tasks. Is there an easy way in ANT (preferably without ANT-contrib) to: decode a URL assign this decoded URL to another property ...so that, given the property ${project.url} with value file:/F:/project%20path/, I can derive another property ${project.path} with value F:/project path/?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26548024
score: 1
tagged with: java
has title: decode URL in ANT
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26539454
tagged with: ant
tagged with: urldecode
answer count: 2
downvote count: 0
tagged with: url
favorite count: 0

http://stackoverflow.com/comment/41696365
score: 0
comment on: http://stackoverflow.com/a/26534524
has text: @cfrick The thing is these questions appear while I was reading the chapter 7. I've build these projects, but there are no any details about how gradle exactly work with subprojects. I'd like to understand how it works in details.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41849836
comment on: http://stackoverflow.com/a/26617716
type: Comment
score: 2
type: AnswerComment
has text: Don't really need the ternary operator either, `bool isDoubleDigit = ! ( check / 10 == 0 && check / 100 == 0 )`

http://stackoverflow.com/comment/41917577
type: Comment
has text: so if I change sessiondemo.html to sessiondemo.jsp, will it work ?
comment on: http://stackoverflow.com/a/26657559
type: AnswerComment
score: 0

http://stackoverflow.com/q/26662624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41927484
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41928604
has comment: http://stackoverflow.com/comment/41927660
has comment: http://stackoverflow.com/comment/41927376
tagged with: java
has comment: http://stackoverflow.com/comment/41927635
has comment: http://stackoverflow.com/comment/41927585
type: Question
tagged with: arrays
favorite count: 0
has body: I am currently doing a array project in my intro CS class and I have to successfully make a game of hangman. I think I am starting it off fairly right, but I can't seem to grasp how to replace a char into a string. I have to have a method to create a random word, so that's why I have a method in my code. Check out what I have so far: import java.util.Random; import java.util.Scanner; public class ProjectNum2 { //creator's name public static void main(String[] args) { System.out.println("Welcome to the Hangman Word game!"); String[] wordKey = { "loop", "for", "while", "java", "switch", "scanner", "else", "double", "integer", "public", "static", "method", "return", "null", "void", "true", "false", "import", "string", "character" }; String[] wordSpace = { "_ _ _ _", "_ _ _", "_ _ _ _ _", "_ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _ _", "_ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _", "r _ _ _ _ _", "_ _ _ _", "_ _ _ _", "_ _ _ _", "_ _ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _", "_ _ _ _ _ _ _ _ _" }; char[] letters = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; final int guesses = 6; int index = 0; index=(int) randomGen(wordKey, wordSpace); Scanner keyboard = new Scanner(System.in); System.out.println(); System.out.print("Choose a letter or enter zero to guess the word: "); char letter = keyboard.nextLine().charAt(0); } private static Object randomGen(String[] wordKey, String[] wordSpace) { String gameWord; Random randIndex = new Random(); int index = randIndex.nextInt(wordKey.length); gameWord = wordSpace[index]; System.out.print(gameWord); return (index); } }
score: 0
has comment: http://stackoverflow.com/comment/41927331
answer count: 3
has answer: http://stackoverflow.com/a/26662714
has comment: http://stackoverflow.com/comment/41948192
has title: How to get a char to replace parts in a string (java)
has comment: http://stackoverflow.com/comment/41927416
has answer: http://stackoverflow.com/a/26662694
has answer: http://stackoverflow.com/a/26662843

http://stackoverflow.com/q/26656088
has answer: http://stackoverflow.com/a/36846508
has comment: http://stackoverflow.com/comment/41917015
has body: I'm heaving heavy problems with drawing a Sprite on a Box2D body. I'm creating a platformer and I did draw a sprite on a body before but then realized that my gravity is really floaty. After googling I found out that I should work with meters when using Box2D and I changed my code to work with a pixel to meter conversion ratio of 25. Since then I can't get everything to work though, my sprite just won't draw on my body. Camera: float width = Gdx.graphics.getWidth() * PIXELS_TO_METERS; float height = Gdx.graphics.getHeight() * PIXELS_TO_METERS; camera = new OrthographicCamera(width / 2, height / 2); camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0); camera.update(); Here is the code for my body: idleRegion = new TextureRegion(xeonTexture, 20, 13, 50, 65); xeonSprite = new Sprite(idleRegion); //Physics bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(100 * PIXELS_TO_METERS, 100 * PIXELS_TO_METERS); bodyDef.fixedRotation = true; body = world.createBody(bodyDef); PolygonShape shape = new PolygonShape(); shape.setAsBox((xeonSprite.getWidth() / 2) * PIXELS_TO_METERS, (xeonSprite.getHeight() / 2) * PIXELS_TO_METERS); FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = shape; fixtureDef.density = 1f; fixtureDef.friction = 1f; fixtureDef.restitution = 0f; fixtureDef.isSensor = false; physicsFixture = body.createFixture(fixtureDef); Here is how I set the position of my sprite: final float widthD2 = (xeonSprite.getWidth() / 2); final float heightD2 = (xeonSprite.getHeight() / 2); final float angle = this.getBodyAngle(); xeonSprite.setOrigin(widthD2, heightD2); xeonSprite.setPosition(body.getPosition().x - xeonSprite.getWidth() / 2, body.getPosition().y - xeonSprite.getHeight() / 2); xeonSprite.setRotation((float) Math.toRadians(angle)); I also tried the following: xeonSprite.setPosition(body.getPosition().x - xeonSprite.getWidth() / 2 * METERS_TO_PIXELS, body.getPosition().y - xeonSprite.getHeight() /…
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: physics
tagged with: java
tagged with: box2d
tagged with: sprite
type: Question
tagged with: libgdx
has title: Libgdx Box2D - Draw Sprite on Body - Heavy problems
has comment: http://stackoverflow.com/comment/41922718

http://stackoverflow.com/a/26603196
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26602068
has body: Problems with your LayoutManager's. Use BorderLayout for jpanel2 as suggested by MadProgrammer, for resizing JScrollPane inside jpanel2. With c.fill=BOTH you need to use c.weightx = 1;c.weighty = 1; to specify how much additional space need grab by component. Read more. Here is example: import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class TestFrame extends JFrame { public TestFrame() { init(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } private void init() { JPanel p1 = new JPanel(); p1.setBorder(BorderFactory.createTitledBorder("P1")); p1.add(new JLabel("test")); JPanel p2 = new JPanel(new BorderLayout()); p2.setBorder(BorderFactory.createTitledBorder("P2")); p2.add(new JScrollPane(new JTable(2,2))); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridx=0; c.gridy=0; add(p1,c); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridx=0; c.gridy=1; add(p2,c); } public static void main(String args[]) { new TestFrame(); } }
downvote count: 0
type: Answer

http://stackoverflow.com/q/26614144
has answer: http://stackoverflow.com/a/26627696
upvote count: 1
tagged with: eclipse
type: Question
answer count: 2
has body: Currently,I have to change device(laptop) for working ---> I have to change the environment to be suitbale with my Project. However, I got an issue relating to setting the M2_REPO home. At first, M2_REPO is being set default to a local in C such as the below : However, I want to change M2_REPOT to other local such as : I set M2_REPO in the environment but they still don't work as well. Please tell me know to config them ( Supposing I am using Eclipse for our project) Thanks.
downvote count: 0
has answer: http://stackoverflow.com/a/26614405
favorite count: 0
has title: How to change the M2_REPO of Maven in windows
type: UnansweredQuestion
tagged with: maven
score: 1
tagged with: java

http://stackoverflow.com/a/26604357
answers question: http://stackoverflow.com/q/26604023
has body: If it's just about the generic parkCars implementation, then here it is: public abstract class Garage&lt;T extends Car&gt; { public List&lt;T&gt; parkedCars = new ArrayList&lt;&gt;(); public void parkCars(T... cars) { Collections.addAll(parkedCars, cars); } } public class SportsCarGarage extends Garage&lt;SportsCar&gt; {}
score: 0
type: Answer

http://stackoverflow.com/comment/41715784
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26546309
has text: Where is setVisible() thingy? Or you just ignored it for the question?
score: 0

http://stackoverflow.com/a/26592991
score: 1
has comment: http://stackoverflow.com/comment/79146919
upvote count: 1
type: AcceptedAnswer
has body: Here's a sample using certificate-based authentication at the container level: https://github.com/SpringOne2GX-2014/microservice-security/tree/master/certs (it's more about stuff that would live in server.xml than in web.xml in a non-embedded container). That app is secure. If you add a WebSecurityConfigurationAdapter and call http.x509() you will also get the authenticated principal turned into an Authentication and made available in the usual places for Spring Security.
accepted answer of: http://stackoverflow.com/q/26589484
type: Answer
answers question: http://stackoverflow.com/q/26589484
downvote count: 0

http://stackoverflow.com/comment/41925922
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26657191
type: Comment
has text: *"Interface was a contract so that you could use impose functionality across different implementations"* - Isn't that something the collection interfaces do successfully in the end? Using exceptions as part of the functionality is maybe unpopular but it is a language feature and there is nothing optional when using or implementing a collection correctly. You have to throw / expect exceptions. I have wished for thinner interfaces or at least methods like `.supportsRemoval()` often enough though. `ImmutableSet` extends `Set` in that it specifies which methods are now guaranteed to throw.

http://stackoverflow.com/q/26529912
has comment: http://stackoverflow.com/comment/41687173
has comment: http://stackoverflow.com/comment/41686554
tagged with: spring
has title: Spring boot. Mapping 2 seperate project controllers ignoring a project
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/37628083
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41686823
tagged with: java
has body: I have a spring boot application, that loads the configurations of 2 other projects as follows: The application annotation: @ImportResource("path/to/xml/config.xml") Which maps to the config.xml containing : &lt;import resource="classpath:path/to/project1/config.xml"/&gt; &lt;import resource="classpath:path/to/project2/config.xml"/&gt; These config.xml's contain the following lines respectively : &lt;context:component-scan base-package="my.project1.package" /&gt; &lt;context:component-scan base-package="my.project2.package" /&gt; Within those packages I have a controller: Project 1 controller package my.project1.package; @RestController @RequestMapping("/project1") @SessionAttributes("batchNumber") public class Project1Controller { @RequestMapping(value="/sample", method = RequestMethod.GET) public String sampleMethod() { return "hi"; } } and Project 2 controller: package my.project2.package; @RestController @RequestMapping("/project2") @SessionAttributes("batchNumber") public class Project2Controller { @RequestMapping(value="/sample", method = RequestMethod.GET) public String sampleMethod() { return "hi2"; } } Yes, the method names and their mappings need to be the same, only the class's ReqeustMapping is different. When I start my application using Spring Boot. I get the Mapped [/project1/sample] line which works fine, however the /project2/sample never gets mapped. Is there a possible reason why these controllers aren't getting mapped/scanned?
type: Question
has answer: http://stackoverflow.com/a/37628083
tagged with: tomcat
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41686608
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/26587722
answers question: http://stackoverflow.com/q/26586764
has body: It's about BootstrapAjaxLink, if you look at it's source code, then u'll see, that it adds ButtonBehavior, which has overriden onComponentTag method (source) with following check: Components.assertTag(component, tag, "a", "button", "input"); This code throws an error, because disabled link has tag span, as you already mentioned. Do not know, why it was implemented like this, and yes, you can override disableLink method, but better way is to use BootstrapAjaxButton and &lt;input type="submit" value="ok"/&gt; markup. It only adds disabled="disabled" tag to disabled button's markup, and error won't be thrown.
type: Answer
accepted answer of: http://stackoverflow.com/q/26586764
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26541552
type: Answer
has comment: http://stackoverflow.com/comment/41774094
has comment: http://stackoverflow.com/comment/41709914
has body: I solved this by upgrading to Netbeans 8.0.
answers question: http://stackoverflow.com/q/26541413
score: 0
has comment: http://stackoverflow.com/comment/43655822

http://stackoverflow.com/a/26623599
answers question: http://stackoverflow.com/q/26623568
type: Answer
score: 2
downvote count: 0
has body: Values of type long should have an L at the end: 9929929939L.
upvote count: 2

http://stackoverflow.com/comment/41800404
type: AnswerComment
comment on: http://stackoverflow.com/a/26592059
type: Comment
has text: can you explain more. i still learn. why when i split the sentence they don't like this : `i love you` and `"i'm sorry. but love someone else,\" he said to me` ?
score: 0

http://stackoverflow.com/q/26639317
tagged with: android-launcher
score: 22
has body: I'm creating a custom launcher that is used like a kiosk mode for the phone. This means most things are hidden away but allows the user to access some apps. I've noticed that when I launch apps from the Recent Apps list, when I press the back button, the stock launcher comes up instead of my custom launcher. I made sure my custom launcher is the default launcher since that's the launcher that comes up when I press the home button. Has anyone run into this issue? How do I solve it?
answer count: 2
downvote count: 0
favorite count: 0
tagged with: android
has title: Apps from Recent Apps back out to stock launcher instead of custom launcher
has answer: http://stackoverflow.com/a/37045666
upvote count: 22
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27380085
type: Question

http://stackoverflow.com/comment/42470196
type: QuestionComment
comment on: http://stackoverflow.com/q/26548229
has text: Are you trying to insert or update the number? The code tries to do an update.
score: 0
type: Comment

http://stackoverflow.com/q/26535886
has comment: http://stackoverflow.com/comment/41796791
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/19537265
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26536279
has comment: http://stackoverflow.com/comment/41728713
tagged with: http-status-code-404
has comment: http://stackoverflow.com/comment/41701285
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26592952
upvote count: 0
has comment: http://stackoverflow.com/comment/41723344
has body: I am trying to run a web application example in Struts 2 and I am facing a problem. Here are the codes, web.xml: <?xml version="1.0" encoding="UTF-8"?> Struts 2 index.jsp struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> Hello World Hello World From Struts2 Please enter your name struts.xml: <?xml version="1.0" encoding="UTF-8"?> <constant name="struts.devMode" value="true" /> HelloWorld.jsp /oops.jsp HelloWorldAction.java: package com.junaid1.struts2; public class HelloWorldAction{ private String name; public String execute() throws Exception { return "success"; } public String getName() { return name; } public void setName(String name) { this.name = name; } } When I execute this project on Tomcat server it displays the index.jsp page just fine. This page has a form. When I press the submit button it gives an error saying that "the requested resource is not available" with a message "/test1/abc". abc is the name of the action and this action is not being called. I have searched a lot before posting this question. At first, I thought I might be missing some libraries, but this does not seem to be the issue now to me as I am using Maven for dependency management. Here is my pom.xml: 4.0.0 test test1 0.0.1-SNAPSHOT war org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 org.apache.struts struts2-core 2.3.16 log4j log4j 1.2.14 The project structure:
score: -1
has title: The requested resource is not available, 404 status code in Struts 2
tagged with: struts2

http://stackoverflow.com/q/26612474
tagged with: bpel
downvote count: 1
type: Question
score: -1
has body: I have an Oracle SOA Composite that is generating a BPEL fault in Weblogic 11g. In EnterpriseManager I see the fault and the message: 0 When I drill into the instance I see the following message listed on an assignement: Error in evaluate expression at line "493". The result is empty for the XPath expression : "/ns27:UsersCollection/ns27:Users/ns27:id" I see the following error in the WLS-SOA1-diagnostic.log: com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} at com.collaxa.cube.engine.ext.bpel.common.BPELWMPHelper.evalFromValue(BPELWMPHelper.java:344) at com.collaxa.cube.engine.ext.bpel.v1.wmp.BPEL1AssignWMP.__executeStatements(BPEL1AssignWMP.java:138) at com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform(BaseBPELActivityWMP.java:166) at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:2687) at com.collaxa.cube.engine.CubeEngine._handleWorkItem(CubeEngine.java:1190) at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1093) at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:78) at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:218) at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:297) at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4609) at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4541) at com.collaxa.cube.engine.CubeEngine._createAndInvoke(CubeEngine.java:713) at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:560) at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke(CubeEngineBean.java:103) at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke(CubeEngineBean.java:145) at com.collaxa.cube.engine.ejb.impl.bpel.BPELEngineBean.syncCreateAndInvoke(BP…
accepted answer: http://stackoverflow.com/a/26895701
upvote count: 0
has title: Oracle BPEL fault selectionFailure
answer count: 1
favorite count: 0
tagged with: oracle-database
tagged with: soa
tagged with: xpath
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26895701
tagged with: java

http://stackoverflow.com/comment/41806040
comment on: http://stackoverflow.com/q/26585817
score: 0
has text: It looks like you have log4j in your classpath (otherwise you would get ClassNotFoundException). What version of GridGain and what version of log4j are you using?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26532184
accepted answer: http://stackoverflow.com/a/26533797
has body: Why does IntStream.sum() return an int value? Is it some conceptual mistake? When creating a stream from the exemplary array: int A[] = {2^31-5, 2, 2, 2}; Sum of all elements exceeds the maximal integer value, but no exception is thrown. Does anybody know how to prevent such situations?
type: AnsweredQuestion
upvote count: 1
tagged with: java-8
type: Question
score: 1
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/26536645
downvote count: 0
has answer: http://stackoverflow.com/a/26536645
has title: IntStream.sum() exception handling
favorite count: 0
has answer: http://stackoverflow.com/a/26533797
has comment: http://stackoverflow.com/comment/41690783

http://stackoverflow.com/comment/41921389
comment on: http://stackoverflow.com/q/26659365
score: 0
type: Comment
type: QuestionComment
has text: I thought it will run the Mat.Random again and generate a new number. The integer must be the same value at all times.

http://stackoverflow.com/a/26655525
type: Answer
has comment: http://stackoverflow.com/comment/41916676
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26636452
answers question: http://stackoverflow.com/q/26636452
has body: You are being disconnected because your main thread in your client application is ending. After you send "now", your program simply exits. If you want to do anything else (like wait for a response from the server, for instance), then you'll have to prevent the main thread from exiting. Try something like this at the end of your main method: System.in.read(); This will cause your process to sit and wait for input from standard input. Simply wait for your test to complete and then press ENTER on the command-line to terminate the client. You will, of course, want to register a handler for receiving messages back from the server to the client. Right now, you can only send messages from the client to the server.
upvote count: 2
has comment: http://stackoverflow.com/comment/43915534
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/44011438

http://stackoverflow.com/comment/41786046
has text: yeah of course, but how can I make it mandatory to implement the counting system for all classes that implement my interface? How can I get the number of all ICountable objects without counting separately for all the implementing classes and summing it up?
comment on: http://stackoverflow.com/q/26585209
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41718993
comment on: http://stackoverflow.com/q/26547467
type: Comment
has text: @overexchange 'What is the mechanism used by java concurrent package to implement synchronization?' synchronized is a keyword; not a class or a package, which do you mean when you say 'synchronization'?
score: 0
type: QuestionComment

http://stackoverflow.com/q/26514305
favorite count: 0
has answer: http://stackoverflow.com/a/26514645
has title: java selenium navigate through a webpage using xpath
has comment: http://stackoverflow.com/comment/41666624
tagged with: http://stackoverflow.com/tag/html
tagged with: xpath
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41659323
tagged with: java
has comment: http://stackoverflow.com/comment/41659578
tagged with: selenium
has body: I'm trying to use selenium to make a login, navigate, fill a form and download a file. When i'm trying to navigate i need to click a link, sounds pretty basic. Since it has no id or name, i used FirePath to get the xPath(.//*[@id='id25']/li[4]/a) then i did the following: driver.findElement(By.xpath(".//*[@id='id25']/li[4]/a")); Selenium returns me Unable to locate element: I did some reading here and there and tried a few different things: driver.findElement(By.linkText("Network Support")).click(); driver.findElement(By.xpath("//a[@title='Network Support']")).click(); driver.findElement(By.cssSelector(".LI_Primary")); driver.findElement(By.xpath("[@id='id25']/li[4]/a")); driver.findElement(By.xpath("/html/body/form/span/div[1]/div/div[1]/div/ul/li[4]/a")).click(); None of those work, selenium always return "Unable to locate element:" The html: #document <!-- [if lte IE 7 ]> <![endif] --> <!-- [if IE 8 ]> <![endif] --> <!-- [if IE 9 ]> <![endif] --> <!-- [if (gt IE 9)|!(IE)]><! --> <!-- <![endif] -->
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26515193
has comment: http://stackoverflow.com/comment/41666601
linked to: http://stackoverflow.com/q/18366689
answer count: 2
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/26514645
accepted answer: http://stackoverflow.com/a/26515193

http://stackoverflow.com/q/26662667
tagged with: objectify
has title: Most efficient way to read many to many objects from GAE datastore
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26680224
accepted answer: http://stackoverflow.com/a/26680224
tagged with: java
type: Question
has body: I've read some questions and articles about many to many relations in the google datastore but I'm still not sure which is the most efficient way in my case: I have a User which references N CollectionOfThings. A CollectionOfThings can reference M users. Both, M and N are very small. I except no more then 5. (Nature of my application). The user object is fetched almost in every request. The other object not. I need to query from an instance of CollectionOfThings all users and from a user all instances of her CollectionOfThing instances. So I see to possible implementations: CollectionOfThings has a List of Users. User has a collection of CollectionOfThings. Both ends of the relation are NOT annotated with @Load. If I need the objects of one the relatin parts I load them with ofy().load().keys(); I use a relation object which I can query ofy()....filter("user", ...) and vice versa. Now the big question is: What is the most efficient way in perspective of data store read operations?
tagged with: google-cloud-datastore
score: 0
answer count: 1

http://stackoverflow.com/comment/41713435
type: QuestionComment
has text: Using a switch-case construct instead of the if-else stuff makes the code more readable.
comment on: http://stackoverflow.com/q/26545028
score: 0
type: Comment

http://stackoverflow.com/q/26534031
has answer: http://stackoverflow.com/a/26537130
has body: after adding a javascript file to my Wicket panel like so renderJsHeaderItem(response, "js/jquery/dist/jquery.min.js"); I get an error in the javascript console along the lines of GET http://localhost:9080/js/jquery/dist/jquery.min.map 404 (Not Found) How would I add the map file to my Panel code? (same question for css.map) Thanks!
tagged with: javascript
has title: adding .js.map files to page header in apache wicket-6.x
tagged with: wicket
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: wicket-6
answer count: 1

http://stackoverflow.com/q/26599983
tagged with: cxf
score: 7
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26632712
answer count: 2
upvote count: 7
has answer: http://stackoverflow.com/a/26643442
favorite count: 0
has title: WS-Security UsernameToken with Apache CXF
type: UnansweredQuestion
tagged with: soap
has body: I have a java application that interacts with a SOAP service. I used the WSDL to generate a java client via CXF, but I need to authenticate my calls using ws-security. I am looking for a code-only way to do this, and I don't have any xml configurations. This is what I have tried: Map ctx = ((BindingProvider)port).getRequestContext(); ctx.put("ws-security.username", "joe"); ctx.put("ws-security.password", "joespassword"); port.makeSoapCall(); But I get a parse error for invalid WS-Security header. What is the right way to do this? In SOAP UI, I can do this easily by right-clicking the soap header, clicking "Add WSS UsernameToken", and selecting "Password Text"
downvote count: 0

http://stackoverflow.com/comment/41763437
comment on: http://stackoverflow.com/q/26565763
has text: I understand that behaviour as the dev_appservers way of emulating the blob/data-store. When deployed no such entity is needed as that entity is now stored in the blobstore proper. You are not missing anything.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41755999
type: Comment
comment on: http://stackoverflow.com/a/26568365
score: 0
type: AnswerComment
has text: @StephenC Thank you. However why do you state that I would need to `make sure that the duplicates...are at the high end of the array`?

http://stackoverflow.com/a/26577759
answers question: http://stackoverflow.com/q/26577426
score: 0
has comment: http://stackoverflow.com/comment/41773993
type: Answer
has body: Assuming your use-case is strictly related to what you've asked (simple expressions like "D*g") the simplest solution would be to use directly the match method with your input as parameter, replacing the * with the dot. .... String vnos=input.nextLine(); vnos = vnos.replace("*","/."); List&lt;String&gt; results = new ArrayList&lt;String&gt;(); //Iterates on string list for (int i=0; i&lt;listA.size(); i++){ String s = (String)listA.get(i); if (s.matches(vnos)) results.add(s); } However, for more complex cases, you need to translate the user input into a valid regular expression yourself (or rely upon a library for the translation). I suggest you a good tutorial which can be usefull to understand regular expression in a Java environment, as well as more complex examples. http://www.vogella.com/tutorials/JavaRegularExpressions/article.html

http://stackoverflow.com/q/26663399
has comment: http://stackoverflow.com/comment/41928929
linked to: http://stackoverflow.com/q/529085
has comment: http://stackoverflow.com/comment/41929272
tagged with: java-8
has answer: http://stackoverflow.com/a/26663883
type: Question
has comment: http://stackoverflow.com/comment/61136117
has comment: http://stackoverflow.com/comment/61136170
has body: Whilst I was working on a project involving Java 8's new streams, I noticed that when I called Stream#toArray() on a stream, it return an Object[] instead of a T[]. Surprised as I was, I started digging into the source code of Java 8 and couldn't find any reason why they didn't implement Object[] toArray(); as T[] toArray();. Is there any reasoning behind this, or is it just an (in)consistency? EDIT 1: I noticed in the answers that a lot of people said this would not be possible, but this code snippet compiles and return the expected result? import java.util.Arrays; public class Test&lt;R&gt; { private Object[] items; public Test(R[] items) { this.items = items; } public R[] toArray() { return (R[]) items; } public static void main(String[] args) { Test&lt;Integer&gt; integerTest = new Test&lt;&gt;(new Integer[]{ 1, 2, 3, 4 }); System.out.println(Arrays.toString(integerTest.toArray())); } }
tagged with: java
possible better answer: http://stackoverflow.com/a/26665277
score: 17
has comment: http://stackoverflow.com/comment/41929038
has comment: http://stackoverflow.com/comment/41929182
has answer: http://stackoverflow.com/a/26663824
accepted answer: http://stackoverflow.com/a/26663824
has comment: http://stackoverflow.com/comment/41929233
linked to: http://stackoverflow.com/q/23079003
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/41928888
has title: Why do the new Java 8 streams return an Object Array on toArray calls?
has comment: http://stackoverflow.com/comment/41929102
favorite count: 0
has comment: http://stackoverflow.com/comment/41929227
has answer: http://stackoverflow.com/a/26665277
upvote count: 18
has comment: http://stackoverflow.com/comment/41929245
type: AnsweredQuestion

http://stackoverflow.com/a/26522901
score: 0
type: Answer
has body: There you go. You can retrieve HashMap Keys using: myMap.keySet() function, like this: Set&lt;String&gt; = map.keySet(); Or, you can iterate through the HashMap like this: public static void iterateMap(Map map) { Iterator iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry item = (Map.Entry)iterator.next(); //Do whatever you like with item.getKey() and item.getValue() iterator.remove(); } } Finally, you can use map.entrySet() function: for (Map.Entry&lt;String, String&gt; item : map.entrySet()){ //Do as you please with item.getKey() and itme.getValue() }
answers question: http://stackoverflow.com/q/26522776

http://stackoverflow.com/q/26567193
has title: ANDROID STUDIO >> Sql Listview
type: Question
answer count: 1
has body: I have this code which displays the content of the JOUEUR column. This table has other columns, but I do not know how to display the column _ID next to the JOUEUR name private void show_tab() { helper = new TaskDBHelper(ValiderJoueurs.this); SQLiteDatabase sqlDB = helper.getReadableDatabase(); Cursor cursor = sqlDB.query(Round.TABLE, new String[]{Playas.Columns._ID, Playas.Columns.JOUEUR, Playas.Columns.PLACE}, null, null, null, null, null); listAdapter = new SimpleCursorAdapter( this, R.layout.players_view, cursor, new String[]{Playas.Columns.JOUEUR}, new int[]{R.id.nomdujoueur}, 0 ); this.setListAdapter(listAdapter); } Thank you very much!
score: 0
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26567246
tagged with: java

http://stackoverflow.com/comment/41945989
type: QuestionComment
comment on: http://stackoverflow.com/q/26672883
score: 0
has text: This example code is quite horrible by the way.
type: Comment

http://stackoverflow.com/comment/41765553
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26573866
score: 0
has text: Start by indenting the code correctly, to make it readable.

http://stackoverflow.com/comment/41820901
type: Comment
has text: I've tried after removing @FXML .. Result remains the same.. And full stack of exceptions are given now..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26581703

http://stackoverflow.com/q/26647902
has answer: http://stackoverflow.com/a/26648340
type: AnsweredQuestion
tagged with: overloading
downvote count: 0
score: 1
tagged with: java
has title: Multiple argument overloaded functions
has answer: http://stackoverflow.com/a/26648018
has body: I have read the fact that in method overloading , Priority goes as: Exact Match>widening>boxing/unboxing>varargs This works great for functions having only one argument. But for functions having more than one argument this sometimes give strange results, presumably because I am not able to apply this rule correctly. For example: Code 1: public static void overloadResolve(long i,int j){} //1 public static void overloadResolve(int i,Integer o){} //2 overloadResolve(5,6); // calls 1 Code 2: public static void overloadResolve(int i,int... j){} //1 public static void overloadResolve(Integer i,long o){} //2 overloadResolve(5,6); // calls 2 Can you explain how to deal with multiple argument functions in the case of overloading?
type: Question
tagged with: wrapper
upvote count: 1
possible better answer: http://stackoverflow.com/a/26647975
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26647975
has answer: http://stackoverflow.com/a/26647980
accepted answer: http://stackoverflow.com/a/26647980

http://stackoverflow.com/comment/41933132
score: 0
comment on: http://stackoverflow.com/q/26665396
type: Comment
type: QuestionComment
has text: @user_1003 don't post additional information in an answer - instead *edit your question* to provide additional details. Have a read through this: [How to ask](http://stackoverflow.com/help/how-to-ask).

http://stackoverflow.com/a/26618261
score: 0
type: Answer
has body: The problem I believe is at this line: new Stage(new StretchViewport( Gdx.graphics.getWidth(), Gdx.graphics.getHeight()), batch); Remove batch from the Stage Initialization change it to this: new Stage(new StretchViewport( Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); You are passing the batch from the Screen to the stage and you are calling batch.end() before stage.draw(). However stage has its own batch so you do not have to pass a batch for the stage to draw. If for your own reasons (e.g. batch projection matrix configuration) you still want your Screen batch passed to the stage do not call batch.end() before stage.draw() since your batch of the stage and your main batch are the same. Call batch.end() after stage.draw()
answers question: http://stackoverflow.com/q/26617002

http://stackoverflow.com/comment/41855257
type: Comment
type: QuestionComment
has text: @nhahtdh thank you very much! now I understand why I should not validate it.
comment on: http://stackoverflow.com/q/26622157
score: 0

http://stackoverflow.com/comment/41706372
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26540753
score: 1
has text: Note to OP: Or you can place this character inside of a character class `[+]` which takes away the characters special meaning as well.

http://stackoverflow.com/comment/41775098
has text: If you want it so that it isn't, then just discard any matches where s1 equals s2
score: 0
comment on: http://stackoverflow.com/q/26578736
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41889095
has text: Thank you very much! The code I ended up with is here: http://pastebin.com/Btqv1u1S
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26641014

http://stackoverflow.com/comment/41895957
score: 0
type: Comment
type: QuestionComment
has text: @AleksandrM : My application requirement is to set values in HttpServletRequest object in action of first namespace and access it in action of second namespace. I am using the concept of Action Chaining. But in the action of second namespace the request values are null. So from above code, I was trying to figure out whether these request values are present in same namespace or not, but still it shows it as null.
comment on: http://stackoverflow.com/q/26630034

http://stackoverflow.com/comment/41895260
has text: This is completely wrong syntax, Java vectors don't work like this.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26644613
type: Comment

http://stackoverflow.com/q/26612611
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41837290
has title: Manipulate a single element of vector
has comment: http://stackoverflow.com/comment/41836941
has comment: http://stackoverflow.com/comment/41837047
tagged with: vector
answer count: 1
has comment: http://stackoverflow.com/comment/41837128
score: 0
has answer: http://stackoverflow.com/a/26612789
accepted answer: http://stackoverflow.com/a/26612789
has comment: http://stackoverflow.com/comment/41836987
has body: I'm currently trying to manipulate a single element of a vector in Java. If I try to do this with elementAt(i) or get(i) in a loop, the whole vector is still changed. I'm looking for a way to try and do this while still using vectors (as I use them throughout the rest of my program). I have tried to clone my vector into a temporary one, then remove all elements of the vector except the one to be manipulated, but to no avail. Here is my code segment: @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; for (int i = 0; i &lt; shapes.size(); i++) { if (shapes.get(i) != null){ g2.setColor(colorSelected()); if(fill.isSelected() &amp;&amp; !((String)shapesList.getSelectedItem() == "Line")){ g2.fill(shapes.elementAt(i)); } else { g2.draw(shapes.elementAt(i)); } } } } The problem that's happening is I'm trying to either fill/draw/change the color of the single next element drawn in my makeshift paint program, but it changes every shape. Any tips (or an explanation as to why this is happening) would be greatly appreciated.

http://stackoverflow.com/comment/41907190
comment on: http://stackoverflow.com/q/26651086
type: QuestionComment
type: Comment
score: 0
has text: please provide your script to check this

http://stackoverflow.com/a/26635191
score: 2
has comment: http://stackoverflow.com/comment/41879959
has body: If you're missing a second output, it's likely that the value of that property is a string that is blank. This line: System.out.println(((Node) row.get("A")).getProperty("name").toString()); In the presence of an attribute "name" that is blank, this will print nothing at all (but a linefeed). Also, the way you're doing this is a bit dangerous; keep in mind that in general nodes can be missing, so getProperty("name") can return null. Meaning that when you call toString() on it, you can end up with a NullPointerException. It's better to maybe write either this: row.get("A").getProperty("name", "missing").toString(); That will return "missing" if the property is missing, or: Object propValue = row.get("A").getProperty("name"); if(propValue != null) System.out.println(propValue.toString()); else System.out.println("Missing name property");
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26634870
has comment: http://stackoverflow.com/comment/41879384
upvote count: 2
has comment: http://stackoverflow.com/comment/41879587

http://stackoverflow.com/a/26648855
accepted answer of: http://stackoverflow.com/q/26648773
type: Answer
has body: Like this: String sourceFilePath = resourceURI.substring( resourceURI.indexOf("/") + 1, resourceURI.lastIndexOf('/') + 1); Basically, create a substring containing everything between the first slash and the last slash. Output will be: C:/Users/uiqbal/Desktop/IFM_WorkingDirectory/SWA_Playground/
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26648773

http://stackoverflow.com/q/26543430
has comment: http://stackoverflow.com/comment/41711056
has comment: http://stackoverflow.com/comment/41711247
has body: I was trying to send an event from a child presenter to a mother presenter. First i thought the events would simply get lost. I surrounded the fireEvent call with a try/catch block and get this error: (-:-) 2014-11-06 10:13:26,069 [ERROR] Exception caught: com.google.gwt.core.client.JavaScriptException: (TypeError) __gwt$exception: : Cannot read property 'b' of undefined at Unknown.f2b(mdm-0.js@180:2440) at Unknown.k2b(mdm-0.js@182:2442) at Unknown.t2b(mdm-0.js@51:2448) My original question got way too long and all the edits may have confused most people. So i constructed a totally stripped-down example, where the error still occurs. This will make it easier to track the error down (i hoped on this way i could solve it myself, but i can't). I also included the imports now, just to be sure not to miss a detail. I have mother presenter (which i also stripped down), which now nearly does not do anything: package testproject.client.application.policies; import testproject.client.application.ApplicationPresenter; import testproject.client.application.policies.test.TestPolicyPresenterWidget; import testproject.client.events.TestPolicyEvent; import testproject.client.events.TestPolicyEvent.TestPolicyEventHandler; import testproject.client.place.NameTokens; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.inject.Inject; import com.google.web.bindery.event.shared.EventBus; import com.gwtplatform.mvp.client.Presenter; import com.gwtplatform.mvp.client.View; import com.gwtplatform.mvp.client.annotations.NameToken; import com.gwtplatform.mvp.client.annotations.ProxyEvent; import com.gwtplatform.mvp.client.annotations.ProxyStandard; import com.gwtplatform.mvp.client.proxy.ProxyPlace; public class PolicyPresenter extends Presenter<PolicyPresenter.MyView, PolicyPresenter.MyProxy> implements TestPolicyEventHandl…
has title: Why do my events get lost? / Strange JavaScript Exception
has comment: http://stackoverflow.com/comment/41711191
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41710912
has answer: http://stackoverflow.com/a/26783367
has comment: http://stackoverflow.com/comment/41713065
tagged with: gwtp
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/41710946
has comment: http://stackoverflow.com/comment/41711329
tagged with: java
accepted answer: http://stackoverflow.com/a/26783367
score: 0
answer count: 1

http://stackoverflow.com/comment/41693328
type: Comment
has text: A recursive method with a loop in it is a strange beast.
comment on: http://stackoverflow.com/q/26533333
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41723831
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26550465
has text: if the function is that simple and doesn't modify datas, you can also use a traditional `PreparedStatement` with "`select total_cancellations() from dual`".
type: Comment

http://stackoverflow.com/q/26636019
tagged with: arrays
has body: I'm making a method that takes 2 inputs, one is int[][], the other is int. I need to store that int value as the "row" of the int array. For example if I input (int[][] array, int 3493), I need the row to be {3 4 9 3}. This is basically like the 2048 games, as I need to be able to manipulate the array later. I do not know the proper syntax for this, however. Please help. Thank you.
answer count: 1
has answer: http://stackoverflow.com/a/26636340
has title: How to set values in a 2D array? (Java)
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26636340
downvote count: 2
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41881474
score: -1
has comment: http://stackoverflow.com/comment/41879459
has comment: http://stackoverflow.com/comment/41879655

http://stackoverflow.com/q/26604090
has answer: http://stackoverflow.com/a/26604150
score: 0
has title: How open fragment using navigation drawer onClickListener()
has comment: http://stackoverflow.com/comment/41821194
answer count: 3
has body: In my navigation drawer i use this kind of method to open an activity: edited mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { Fragment fragment = null; @SuppressLint("ResourceAsColor") @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Fragment fragment = null; FragmentManager fragmentManager = getFragmentManager(); Bundle bundle = new Bundle(); switch (position) { case 0: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str))); break; case 1: fragment = new TrimFragment(); fragment.setArguments(bundle); fragmentManager.beginTransaction() .replace(R.id.content_frame, fragment).commit(); break; startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(strg))); break; case 3: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(strtwit))); break; } } }); } But what i want is open a fragment right now. Is it possible from this structure do it? Thanks
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26604390
tagged with: navigation-drawer
type: Question
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/26604127

http://stackoverflow.com/q/26558397
accepted answer: http://stackoverflow.com/a/26558510
favorite count: 0
has body: I am trying to output the values that are less than five and the values that are greater than the average of all the values in the array . I can't figure out how to make it all work out and output the correct numbers. Can anyone help? Here's what I have, I am almost there I just don't know what I'm doing wrong. { int[] numbers = {2, 4, 6, 8, 10, 12, 14, 16}; int sum = 0; for (int x : numbers) sum += x; System.out.println("Numbers in order:"); { for(int x = 0; x &lt; numbers.length; ++x) System.out.println(numbers[x]); } System.out.println("Numbers in reverse order:"); { for(int x = 0; x &lt; numbers.length; ++x) System.out.println(numbers[x]); } System.out.println("The sum of all eight numbers is: " + sum); System.out.println("The lowest number is: " + numbers[0]); System.out.println("The highest number is: " + numbers[7]); System.out.println("The average of all eight numbers is: " + sum * 1.0 / 8); System.out.println("All numbers higher than the average are: "); { for(int x = 0; x &lt; numbers.length &amp;&amp; x &gt; 9;) {numbers[x] = x + 1;} int x = 0; System.out.println(numbers[x]); } System.out.println("Numbers less than 5: "); { for(int x = 0; x &lt; numbers.length &amp;&amp; x &gt; 5;) {numbers[x] = x + 1;} int x = 0; System.out.println(numbers[x]); } }
has title: How to find numbers in an array that are greater than, less than, or equal to a value?
has answer: http://stackoverflow.com/a/26558450
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26558450
tagged with: java
tagged with: loops
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26558510
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41737830
has answer: http://stackoverflow.com/a/39405955
tagged with: arrays
downvote count: 0
score: 4
answer count: 3

http://stackoverflow.com/comment/41773152
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26576225
has text: Check [How send automatic reply on particular email id when an user registers?](http://stackoverflow.com/q/5431061/573032)

http://stackoverflow.com/comment/41872704
type: Comment
comment on: http://stackoverflow.com/q/26632094
type: QuestionComment
has text: *"I tried to do it myself however I failed"* - Ok, [what have you tried?](http://mattgemmell.com/what-have-you-tried/)
score: 2

http://stackoverflow.com/q/26652594
has comment: http://stackoverflow.com/comment/41908682
tagged with: apache-commons-beanutils
tagged with: cpu-usage
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41908533
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41910115
answer count: 0
has comment: http://stackoverflow.com/comment/41908628
type: Question
has body: I wrote a java program which queries oracle database and converts it to object using beanutils During Load Testing I found high CPU usage. Outline of the program is: List&lt;Map&lt;String, List&gt;&gt; rows = queryList(query, new Object[]{params..}); while(rows.hasNext()){ beanutils.setProperty(obj, field, row.get("some column name")); } DB returns approximately 350 rows. Executing the program makes my CPU to spike 100%. Removing the beanutils and testing query - CPU usage was 30%. Now if I remove the beanutils.setProperty and use getters and setters CPU is not spiking(50%) In jvisualvm sampler I find: oracle.net.ns.Packet.receive() org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer() org.apache.tomcat.util.net.NioEndpoint$Poller.run() taking most of Self time CPU I used jmeter to load test ( 20 concurrent requests ). BaseLine of the jvisualvm graph is 0%. So definitely because of this load test only cpu is spiking. Is it reflection that is causing high CPU usage? Does executing a query eg: queryforlist takes CPU utilization to increase. Later if my computation increases then should I reduce the number of threads accessing this api as it will spike my cpu again. Thanks in advance.
tagged with: performance
has comment: http://stackoverflow.com/comment/41909093
tagged with: java
has comment: http://stackoverflow.com/comment/41933201
score: 0
has comment: http://stackoverflow.com/comment/41944634
has comment: http://stackoverflow.com/comment/41908954
has title: Java Program High CPU usage
has comment: http://stackoverflow.com/comment/41908557
has comment: http://stackoverflow.com/comment/41935467

http://stackoverflow.com/a/26603464
has comment: http://stackoverflow.com/comment/71885763
has comment: http://stackoverflow.com/comment/41820488
has comment: http://stackoverflow.com/comment/71934816
has comment: http://stackoverflow.com/comment/71942631
has comment: http://stackoverflow.com/comment/71879824
downvote count: 0
has comment: http://stackoverflow.com/comment/71937661
has comment: http://stackoverflow.com/comment/41831994
has comment: http://stackoverflow.com/comment/135523365
has comment: http://stackoverflow.com/comment/71935546
has comment: http://stackoverflow.com/comment/135557866
type: Answer
has body: That's simply the chosen default value for primitive and wrapper types in the default Mockito answer. This 0 default has been chosen when null was used and too many users experienced NPEs due to unboxin, hard to diagnose for novices in particular, when null was used. While this might be surprising for people used to reference and un/boxing, this trade-off was worth it in usability. One day maybe this could be revisited when/if Java gets a nullability notation reachable via reflection. And regardless mockito allows you to change the default answers if it doesn't suit the project/team.
score: 15
answers question: http://stackoverflow.com/q/26601555
upvote count: 15

http://stackoverflow.com/comment/42003459
score: 0
type: Comment
has text: Thanks I hadn't understood the syntax error on having two methods that look like different signatures: Class<InterfaceType> and Class.
comment on: http://stackoverflow.com/a/26668728
type: AnswerComment

shader
tags question: http://stackoverflow.com/q/26564143
type: Tag
tag name: shader
tags question: http://stackoverflow.com/q/26563765
tags question: http://stackoverflow.com/q/26563484

http://stackoverflow.com/comment/41789108
score: 0
type: Comment
has text: Without threadList, how would I notify all the threads with the last thread? I used (in main) else { synchronized(this){this.notifyAll()} } and it's not stopping the program when done.
type: AnswerComment
comment on: http://stackoverflow.com/a/26539742

http://stackoverflow.com/q/26597634
has title: Convert char array to int array with spaces
answer count: 3
has comment: http://stackoverflow.com/comment/41809628
has comment: http://stackoverflow.com/comment/41809907
favorite count: 0
has comment: http://stackoverflow.com/comment/41809680
has comment: http://stackoverflow.com/comment/41809828
downvote count: 2
accepted answer: http://stackoverflow.com/a/26597775
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26597685
possible better answer: http://stackoverflow.com/a/26598255
has comment: http://stackoverflow.com/comment/41809745
tagged with: java
has body: I have browsed all over for this.I have a char array[10 20 30].I want to convert this to an int array or ArrayList of integers such that my int array become int[] charToInt={10,20,30}; I need the initial guidance to approach this problem.I don't want the whole code.Just a hint.And I will code that hint. Thanks in advance
has comment: http://stackoverflow.com/comment/41809855
has answer: http://stackoverflow.com/a/26598255
has comment: http://stackoverflow.com/comment/41809945
has comment: http://stackoverflow.com/comment/41809722
type: Question
has comment: http://stackoverflow.com/comment/41809688
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26597775

http://stackoverflow.com/a/26563663
has body: You're not doing any copy. All you're doing is assigning the same Vector to another variable: Before: finished ------&gt; [a, b, c, d] After: finished ------&gt; [a, b, c, d] ^ | finished_copy ---/ Here's how you would copy all the elements of a Vector into another one: Vector&lt;Allocated&gt; finishedCopy = new Vector&lt;&gt;(finished); or Vector&lt;Allocated&gt; finishedCopy = new Vector&lt;&gt;(); finishedCopy.addAll(finished); This, however, will create two different vectors containing references to the same Allocated instances. If what you want is a copy of those objects, then you need to create explicit copies. Without doing a copy, changing the state of an object in the first list will also change its state in the second one, since both lists contain references to the same ojects. Note that: classes should start with an uppercase letter variables should not contain underscares, but be camelCased Vector should not be used anymore. ArrayList should be, since Java 2. We're at Java 8.
has comment: http://stackoverflow.com/comment/41747143
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26563561
answers question: http://stackoverflow.com/q/26563561
has comment: http://stackoverflow.com/comment/41747653

http://stackoverflow.com/a/27600307
score: 0
answers question: http://stackoverflow.com/q/26545385
has body: Seems to me like the Samsung bug reported here: NumberFormatException: Invalid int: "8.0dip" only on Galaxy Tab 2 I had the same issue with using paddingStart / paddingEnd in a layout file. This seems to only happens on Galaxy Tab 2 & Galaxy Note.
type: Answer

http://stackoverflow.com/q/26546222
tagged with: supercsv
tagged with: java
has title: Selective Serialization to CSV, Java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41717453
downvote count: 0
favorite count: 0
has body: I am using jsefa library to selectively deserialize a csv for eg. maping only header no. 1,3,5 to my object, this works fine. Now I want to do the opposite of it selectively serialize my object to header postion 1,3,5 and rest positions should get separated by semicolon (;) automatically. So the output would look something like this: Header1;Header2;Header3;Header4;Header5;Header6;Header7 bla1;;bla3;;bla5 Can anybody suggest, how can this be done with jsefa or with any other library.
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/41715756
tagged with: opencsv
has answer: http://stackoverflow.com/a/30048777
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26558315

http://stackoverflow.com/a/26548510
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26548061
type: Answer
has body: I set up an Animation subclass so I can have convenience methods to apply the scale each time the sprite is updated with a new region. For example: public class AnimationPlus extends Animation { float scale; public AnimationPlus (float frameDuration, Array&lt;? extends TextureRegion&gt; keyFrames, PlayMode playMode, float scale) { super(frameDuration, keyFrames, playMode); this.scale = scale; } public void applyKeyFrameToSprite (float stateTime, Sprite sprite) { TextureRegion region = getKeyFrame(stateTime); sprite.setSize(scale, scale * region.getRegionHeight() / region.getRegionWidth()); } } By the way, if you name your frames of animation with underscore number suffixes (such as "bike_0", "bike_1", "bike_2", etc), then you can conveniently get the array of regions like this: Array&lt;TextureRegion&gt; bikeRegions = textureAtlas.findRegions("bike"); AnimationPlus animation = new AnimationPlus(0.1f, bikeRegions, PlayMode.LOOP, 7f);
score: 0
accepted answer of: http://stackoverflow.com/q/26548061

http://stackoverflow.com/q/26599891
downvote count: 0
has comment: http://stackoverflow.com/comment/41814136
favorite count: 0
upvote count: 8
type: Question
tagged with: rx-java
has body: I'm using RxJava to essentially collect the list of individually emitted Observables and combine them into a list of Observables (essentially sort of the opposite of flatMap). Here's my code: // myEvent.findMemberships() returns an Observable&lt;List&lt;Membership&gt;&gt; myEvent.findMemberships() .flatMap(new Func1&lt;List&lt;Membership&gt;, Observable&lt;User&gt;&gt;() { @Override public Observable&lt;User&gt; call(List&lt;Membership&gt; memberships) { List&lt;User&gt; users = new ArrayList&lt;User&gt;(); for (Membership membership : memberships) { users.add(membership.getUser()); } return Observable.from(users); } }) .toList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer&lt;List&lt;User&gt;&gt;() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { Timber.e(e, "Error when trying to get memberships"); } @Override public void onNext(List&lt;User&gt; users) { Timber.d("%d users emitted", users.size()); } }) I notice that my onNext is never called. I can't seem to understand this. If i remove the .toList call and basically output the individual Users (as shown below) it works by emitting each item. subscriptions // .add(currentEvent.findMemberships() .flatMap(new Func1&lt;List&lt;Membership&gt;, Observable&lt;User&gt;&gt;() { @Override public Observable&lt;User&gt; call(List&lt;Membership&gt; memberships) { List&lt;User&gt; users = new ArrayList&lt;User&gt;(); for (Membership membership : memberships) { users.add(membership.getUser()); } return Observable.from(users); } }) .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer&lt;User&gt;() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { Timber.e(e, "Error when trying to get memberships"); } @Override public void onNext(User user) { Timber.d("%d users emitted", user.getName()); } })); Q1. Is my understanding of .toList incorrect? Q2. How d…
has comment: http://stackoverflow.com/comment/41816940
tagged with: frp
has title: Collecting Observables to a List doesn't seem to emit the collection at once
answer count: 1
accepted answer: http://stackoverflow.com/a/26600686
score: 8
tagged with: java
has answer: http://stackoverflow.com/a/26600686
type: AnsweredQuestion

http://stackoverflow.com/comment/90221552
type: AnswerComment
has text: @AsadMukhtar Hi, I am having the same issue, i created the banner ad and also have everything verified and after 2 days i am not getting ads(no ads not even test ads are showing). Same msg "Error code 3 No add fill from the server" could you please _/\\_ HELP? What happened in your case?, how did you solve it? or was this temporary?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/31846398

http://stackoverflow.com/a/26665182
has body: Use below class: public class Example { private int id; private String name; private String number; private List&lt;List&lt;Object&gt;&gt; polygons; } Test: String json = "{\"id\":5,\"name\":\"1322\",\"number\":\"1\"," + "\"polygons\":[[[[-122.00895192246342,37.41167155605386]," + "[-122.0089070066992,37.41181283360041]," + "[-122.0087533947856,37.411780725090495]," + "[-122.00879741223456,37.411636593387556]," + "[-122.00895192246342,37.41167155605386]]," + "0," + "\"#11d4a0\"," + "\"A Zone Name\"]]}"; GsonBuilder gsonBuilder = new GsonBuilder(); Gson gson = gsonBuilder.create(); Example example = gson.fromJson(json, Example.class); Validate solution: Inner list will be deserialized as an object which may be another List or a String or a Double value for your sample json. Loop over that list and get values. For instance: for (int i = 0; i &lt; example.polygons.get(0).size(); i++) { Object polygon = example.polygons.get(0).get(i); if (polygon instanceof List) { for (int j = 0; j &lt; ((List) polygon).size(); j++) { Object innerArray0 = ((List) polygon).get(j); System.out.print("Item#" + i + "." + j); if (innerArray0 instanceof List) { for (int k = 0; k &lt; ((List) innerArray0).size(); k++) { Object value = ((List) innerArray0).get(k); System.out.print(" : value[" + k + "] :" + value + " "); } } System.out.println(""); } } else if (polygon instanceof Double || polygon instanceof String) { System.out.println("Item#" + i + " : value : " + polygon); } System.out.println(""); } System.Out: Item#0.0 : value[0] :-122.00895192246342 : value[1] :37.41167155605386 Item#0.1 : value[0] :-122.0089070066992 : value[1] :37.41181283360041 Item#0.2 : value[0] :-122.0087533947856 : value[1] :37.411780725090495 Item#0.3 : value[0] :-122.00879741223456 : value[1] :37.411636593387556 Item#0.4 : value[0] :-122.00895192246342 : value[1] :37.41167155605386 Item#1 : value : 0.0 Item#2 : value : #11d4a0 Item#3 : value : A Zone Name
answers question: http://stackoverflow.com/q/26660874
type: Answer
score: 0

http://stackoverflow.com/q/26661776
tagged with: syntax
type: UnansweredQuestion
tagged with: java
type: Question
favorite count: 0
has title: java: Syntax error on token in polymorphic array
has body: I'm trying to follow theNewBoston's java tutorial 55 Introduction to Polymorphism (from '09) class apples { public static void main(String[] args){ food mark[]=new food[2]; mark[0] = new potpie; mark[1] = new tuna; for(int x=0;x&lt;2;++x){ mark[x].eat(); } } } I've copied the code exactly(I've checked 3 or so times now) but I keep getting this error at mark[0] = new potpie; Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error on token ";", ( expected - Syntax error on token ";", ( expected I've got 4 classes counting the main one and the .eat method is just a println. Also when I run it i get Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error on token(s), misplaced construct(s) Syntax error on token ";", ( expected tuna cannot be resolved to a variable Don't know if that helps but sometimes you never know.
has comment: http://stackoverflow.com/comment/41925697
answer count: 2
has answer: http://stackoverflow.com/a/26661832
tagged with: arrays
tagged with: token
downvote count: 3
score: -3
upvote count: 0
has answer: http://stackoverflow.com/a/26661826

http://stackoverflow.com/comment/41807858
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26596021
has text: I have changed task 4 and 5 and I no longer have an error. But now I am getting an error from task 3 which was fine before. It says the line file.print("Mean = " + mean + "; S.D. = " + stdDev); cannot find symbol.

http://stackoverflow.com/comment/41760390
type: QuestionComment
comment on: http://stackoverflow.com/q/26570115
score: 0
has text: See http://stackoverflow.com/questions/9883918/how-change-build-options-in-netbeans, add "-g" to "Additional compiler options"
type: Comment

http://stackoverflow.com/comment/41677467
type: Comment
comment on: http://stackoverflow.com/a/26524627
type: AnswerComment
score: 0
has text: tick answer so that in future people get solution.

http://stackoverflow.com/comment/41663651
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26516839
has text: So you want your program to both open a new notepad and not open a new one when the current one is closed? I'm confused... (why not create a "quit" button next to your "go" button? And do the `waitFor` in a different thread.)
score: 0

http://stackoverflow.com/comment/41904681
type: Comment
type: QuestionComment
score: 0
has text: Usually you will get no deadlock for EDT on using `SwingWorker`. Two `SwingWorker`s can have a deadlock when they use the same resources, but EDT will not be involved in this deadlock (it will not be blocked).
comment on: http://stackoverflow.com/q/26650106

http://stackoverflow.com/q/26550237
tagged with: debugging
has title: Tracking a java program
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41723101
accepted answer: http://stackoverflow.com/a/26550459
has comment: http://stackoverflow.com/comment/41723039
has comment: http://stackoverflow.com/comment/41722881
type: AnsweredQuestion
has body: I've currently got a snippet of java code running in eclipse, which has a bug somewhere. In fixing the bug, I'd like to see what the program's actually doing. I know Java traces where the program goes when it displays an error message; can I access that data to find out where I'm going wrong? Thanks!
has comment: http://stackoverflow.com/comment/41722774
tagged with: java
has answer: http://stackoverflow.com/a/26550459
has comment: http://stackoverflow.com/comment/41722895
tagged with: traceback
type: Question
has comment: http://stackoverflow.com/comment/41722751

http://stackoverflow.com/q/26638207
has comment: http://stackoverflow.com/comment/41883677
has title: How does the List has fast random access in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/26638496
has answer: http://stackoverflow.com/a/26638513
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26638376
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26638376
has comment: http://stackoverflow.com/comment/41884251
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26638513
has body: The RandomAccess interface identifies that a particular java.util.List implementation has fast random access. This interface tries to define an imprecise concept: how fast is fast? The documentation provides a simple guide: if repeated access using the List.get() method is faster than repeated access using the Iterator.next() method, then the List has fast random access. The two types of access are shown in the following code examples: Object o; for (int i=0, n=list.size(); i &lt; n; i++) o = list.get(i); Object o; for (Iterator itr=list.iterator(); itr.hasNext(); ) o = itr.next(); How does the List has fast random access when its list.get() method is faster than repeated access using the Iterator.next() method.
has comment: http://stackoverflow.com/comment/41883855
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/41750072
has text: several things to check for you : 1) `text.split("")` splits after every character, dont know if u want that... but probably more like after every word (`text.split(" ")`)?! 2) long time ago i last used swing, but aren't the components not visible by default? try `setVisible(true)` on the panel or checkboxes maybe? has the panel a layout attached? FlowLayout or something like that? Or try invoke a repaint. UpdateUI doesnt actual do anything repainting related (i think)
score: 0
comment on: http://stackoverflow.com/q/26545530
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41891422
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26642310
type: Comment
has text: Thanks for all the answers. Can the down voter explain me what's wrong with my question.

http://stackoverflow.com/a/26588084
upvote count: 1
has comment: http://stackoverflow.com/comment/41791650
score: 1
has body: Java itself does not provide anything here. But you can use maven to manage dependencies. Maven integrates nicely with eclipse. However if the problem is that simple this might be overkill.
answers question: http://stackoverflow.com/q/26587999
downvote count: 0
type: Answer

http://stackoverflow.com/comment/127129502
type: AnswerComment
comment on: http://stackoverflow.com/a/71942652
type: Comment
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
score: 1

http://stackoverflow.com/q/26666827
has body: I am building a product database and when I'm using the update database function my program crashes. The issue is one string the program itself throws in. I retrieve the data from the database text file and because I'm using numberformat.getCurrencyInstance and it throws in a dollar sign. So I threw in an exception String price = updatePriceTextField.getText().substring(1); so it would bypass the dollar sign in the beginning of the text field and send the information back to the textfile and save. Now it brought up my current problem which is: when I enter a number bigger than 999 and I get to thousands, it brings in a comma: example: $3000.00 is now $3,000.00 and when i try to send that information back to the database it throws in an error and crashes. Now I know I could just simply add in another substring to avoid, and solve the problem like that, but what if the price of the object lets say is: $300000000.00 the the program throws in 2 commas $300,000,000.00 and would crash again. So what sort of exception or command should I throw in to bypass these commas except substring. Sorry for the long post, but I tried to explain the issue as well as I could. import java.util.ArrayList; /** * * @author 0103425014 */ public class EditProduct extends javax.swing.JFrame { ProductTextFile txtfile = new ProductTextFile(); ArrayList&lt;Product&gt; products = txtfile.getProducts(); /** * Creates new form UpdateProduct */ public EditProduct() { initComponents(); for (Product p : products) updateComboBox.addItem(p.getCode() + " " + p.getDescription()); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { updateComboBox = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); updateCodeTextField = new …
tagged with: regex
has answer: http://stackoverflow.com/a/26666845
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has title: Should I use substring to avoid a certain string in java database or is there another way to bypass it?
accepted answer: http://stackoverflow.com/a/26666845
tagged with: substring
score: 0
answer count: 1
tagged with: string

http://stackoverflow.com/comment/41891266
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26642075
has text: You picture actually suggest you want a `JMenu` within a `JMenu`, not a `JPopupMenu`

http://stackoverflow.com/comment/41932984
type: Comment
has text: yes, and increment the count threshold to count > 2
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26665453

http://stackoverflow.com/q/26667785
answer count: 1
has comment: http://stackoverflow.com/comment/41937078
favorite count: 0
has comment: http://stackoverflow.com/comment/41937066
tagged with: android
accepted answer: http://stackoverflow.com/a/26667891
downvote count: 0
has body: This is my object public static class Phone{ public String model; public String imei; public String date_active; } This is my list object example Phone a = new Phone ("Qs17", "1122", "20/10/2014"); Phone b = new Phone ("Qs18", "4345", "20/10/2014"); Phone c = new Phone ("Qs19", "3451", "21/10/2014"); Phone d = new Phone ("Qs20", "6756", "22/10/2014"); Phone e = new Phone ("Qs17", "1257", "22/10/2014"); Phone f = new Phone ("Qs17", "9077", "22/10/2014"); list.add(a); list.add(b); list.add(c); list.add(d); list.add(e); list.add(f); I want split my list to some multiple list which has the same date. Example: list1 = [{"QS17","1122","20/10/2014"}, {"QS18","4345","20/10/2014"}] list2 = [{"QS19","3451","21/10/2014"}] list3 = [{"QS20","6756","22/10/2014"}, {"QS17","1257","22/10/2014"}, {"QS17","9077","22/10/2014"}] I seach some way on web, and found this static &lt;T&gt; List&lt;List&lt;T&gt;&gt; chopped(List&lt;T&gt; list, final int L) { List&lt;List&lt;T&gt;&gt; parts = new ArrayList&lt;List&lt;T&gt;&gt;(); final int N = list.size(); for (int i = 0; i &lt; N; i += L) { parts.add(new ArrayList&lt;T&gt;( list.subList(i, Math.min(N, i + L))) ); } return parts; } But seem it depend on specific number to sublist, not base on a property of object. I also search to find a another way, and found this Map&lt;YourSplitterProperty, List&lt;YourItem&gt;&gt; map = new HashMap&lt;YourSplitterProperty, List&lt;YourItem&gt;(); for (YourItem item : yourItems) { List&lt;YourItem&gt; list = map.get(item.getSplitterProperty()); if (list == null) { list = new ArrayList&lt;YourItem&gt;(); map.put(item.getSplitterProperty(), list); } list.add(item); } But this way only return a list, I need to return multiple list which have the same property on root list. May anybody help me ?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26667891
type: Question
has comment: http://stackoverflow.com/comment/41937059
type: AnsweredQuestion
has title: How to generate list object into multiple list base on a object property?
upvote count: 1

http://stackoverflow.com/a/26514692
has comment: http://stackoverflow.com/comment/41659479
score: 0
type: Answer
has body: for(int i=array.length; i&gt;0; i--){ sum = 20; for(int j=0; j &lt; (i - 1); j++) { sum *= 10; } } Use inner loop to multiply by 10 the number of times i is for that iteration. You would need to reset sum in your outer loop each time.
answers question: http://stackoverflow.com/q/26514659
has comment: http://stackoverflow.com/comment/41659379

http://stackoverflow.com/q/26518345
score: 6
has body: I'm just starting out and I'm completely lost on how to do this. I want to be able to check a string for a smaller string and return true if the string contains the letters of the string in order. I'm not sure how to go about making sure the letters of the second string are in order, even if there are other letters between them. An example would be that "chemistry" would return true for the string "hit". It would return false for the string "him" though. Any help would be greatly appreciated. EDIT: Thank you, I changed the word "substring" to string. As I said, I'm just beginning and wasn't aware that meant something else. I really appreciate all the help. It should get me moving in the right direction.
downvote count: 4
has title: How to Check if a String Contains a Second String with its Characters in Order?
tagged with: java
has comment: http://stackoverflow.com/comment/41670224
has comment: http://stackoverflow.com/comment/41666528
type: Question
has answer: http://stackoverflow.com/a/26535615
has answer: http://stackoverflow.com/a/26520426
answer count: 6
has comment: http://stackoverflow.com/comment/41666694
has comment: http://stackoverflow.com/comment/41701656
has answer: http://stackoverflow.com/a/26518437
upvote count: 10
tagged with: string
has answer: http://stackoverflow.com/a/26518444
favorite count: 0
has answer: http://stackoverflow.com/a/26518551
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26518479

http://stackoverflow.com/a/26593341
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26591773
downvote count: 0
has body: There is no way to cleanly do exactly what you want, but here are two options: Index a new field called something like has_language, setting its value to language!=null at doc submission time. This is more of a hack because range should only be used with integers, but I have used it successfully on literal fields (range field=language [0,}).

http://stackoverflow.com/comment/69372861
type: AnswerComment
comment on: http://stackoverflow.com/a/26631968
type: Comment
has text: Consistency with the for loop, is the best explanation I've seen so far
score: 0

http://stackoverflow.com/a/26622397
has comment: http://stackoverflow.com/comment/41855166
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/41855100
answers question: http://stackoverflow.com/q/26622374
has body: From the Eclipse Luna documentation, it appears to mean that it is a protected method.
has comment: http://stackoverflow.com/comment/41855132
type: Answer
score: 1

http://stackoverflow.com/comment/41840535
comment on: http://stackoverflow.com/a/26611687
has text: You should probably put it into a new question if you're having issues implementing the provided solutions.
score: 0
type: Comment
type: AnswerComment

io
tags question: http://stackoverflow.com/q/26596468
tags question: http://stackoverflow.com/q/26622348
tags question: http://stackoverflow.com/q/26545014
tags question: http://stackoverflow.com/q/26580729
tags question: http://stackoverflow.com/q/26580078
tags question: http://stackoverflow.com/q/26657640
tags question: http://stackoverflow.com/q/26661464
tags question: http://stackoverflow.com/q/26648955
tag name: io
tags question: http://stackoverflow.com/q/26551875
tags question: http://stackoverflow.com/q/26645940
tags question: http://stackoverflow.com/q/26575009
tags question: http://stackoverflow.com/q/26647689
tags question: http://stackoverflow.com/q/26583743
tags question: http://stackoverflow.com/q/26603476
tags question: http://stackoverflow.com/q/26605671
type: Tag
tags question: http://stackoverflow.com/q/26543411
tags question: http://stackoverflow.com/q/26568712
tags question: http://stackoverflow.com/q/26591033
tags question: http://stackoverflow.com/q/26539675
tags question: http://stackoverflow.com/q/26660844

http://stackoverflow.com/q/26576855
tagged with: google-analytics
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41789431
has answer: http://stackoverflow.com/a/38426620
has body: What I need to do is log clicks and etc and log them in google analytics in a java program. I have done lots of googling, but have found nothing. Does anyone know how to do this?
has comment: http://stackoverflow.com/comment/41783514
has title: How can I use Google Analytics in a Java program
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41782142
type: Comment
comment on: http://stackoverflow.com/q/26583058
score: 3
type: QuestionComment
has text: Why don't you look at source code once ?

http://stackoverflow.com/comment/41822660
has text: @user3703289 - What difference does a `new method` make?
type: QuestionComment
comment on: http://stackoverflow.com/q/26604875
score: 0
type: Comment

http://stackoverflow.com/comment/41848277
has text: We're not doing your homework for you. Ask a proper question.
score: 0
comment on: http://stackoverflow.com/q/26618649
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26641630
downvote count: 0
answers question: http://stackoverflow.com/q/26641556
upvote count: 2
type: Answer
has body: You are implementing the very standard linked list deletion algorithm. Here's a sample Google hit for it, but you can just search for yourself and follow anything. You may also just actually use a Java LinkedList. You may also try reading the actual source code in Java for the remove method for LinkedList. I also want to point out you're not "using classes like lists." You're just implementing a LinkedList, and choosing to call your class Example, instead of List or LinkedList or SinglyLinkedList.
score: 2

http://stackoverflow.com/q/26518253
favorite count: 0
has body: I'm trying to solve this problem: I have a byte value (1 byte) and I need to transform this value into a long value (8 bytes). But what I want is just replace the first byte of the long variable with the byte value I had before. A example: My Byte Value: 11001101 My Long Value: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 What I want: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 11001101 Simple as that! I'm trying to do this (example): byte b = -112; long l = 0; l = l | b; System.out.println(l); But I get the result -112! In my understanding, the java bit or operator should do an "or" with the first byte of the long value and the byte value. Instead, the or operator is copying the 2-complement representation of the byte value into the long value, and this is not what I want. The result I was expecting in that case was 144, since -112 is 10010000, which is 144 when considering a unsigned value. Hope you understand me. Thanks!
tagged with: byte
has title: Understanding Java Inclusive or Operator ( | )
has answer: http://stackoverflow.com/a/26518318
upvote count: 1
has comment: http://stackoverflow.com/comment/41666217
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41666221
accepted answer: http://stackoverflow.com/a/26518318
answer count: 2
tagged with: long-integer
downvote count: 0
possible better answer: http://stackoverflow.com/a/26518312
has answer: http://stackoverflow.com/a/26518312

http://stackoverflow.com/comment/41730640
has text: You may wish to start by generalizing the flow of your job, taking advantage of job inheritance and parameters, as well as abstract references to beans within that flow that are specific to a particular job.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26553873
type: Comment

http://stackoverflow.com/q/26514740
has comment: http://stackoverflow.com/comment/41697452
has comment: http://stackoverflow.com/comment/41664418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41724885
tagged with: jdbc
tagged with: connection
accepted answer: http://stackoverflow.com/a/26554773
favorite count: 0
has comment: http://stackoverflow.com/comment/41664612
type: Question
has comment: http://stackoverflow.com/comment/41659636
has comment: http://stackoverflow.com/comment/41659470
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/41664387
has title: MySQL connections not closing
has comment: http://stackoverflow.com/comment/41664277
has comment: http://stackoverflow.com/comment/41684371
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/41659882
tagged with: mysql
has comment: http://stackoverflow.com/comment/41698553
has answer: http://stackoverflow.com/a/26554773
has comment: http://stackoverflow.com/comment/41659567
has comment: http://stackoverflow.com/comment/41664480
downvote count: 0
has comment: http://stackoverflow.com/comment/41668881
has body: I have a web application running on Tomcat7 that connects to MySQL 5.5. I have two servers running the identical code: Ubuntu Red Hat The Ubuntu one runs fine maintaining a steady 8-16 connections, but the Red Hat one leaks connections and the connection count grows, never going down. The server eventually resets ~152 connections. The code to close the connection is getting called: try { conn.close(); } catch (SQLException e) { exceptionController.logException(this.getClass().getSimpleName(), "finalize Db", e.getMessage(), false); }finally{ conn = null; } All connections to MySQL are from this app. Why the difference in behavior? Are there configuration settings that I should be considering - like closing sleeping connections setting? Ubuntu Server Status: Red Hat Server Status: Partial screen of the connection list: I found this post, which appears to have slowed o/s connections, but they still are creeping up. EDIT Research is pointing to the connections not closing properly. Why would the connections close in one environment but not another? I have edited my.cnf with the following setting: wait_timeout=30 However, client connections are sleeping and never getting killed. The server has been restarted with the new setting in place. What am I not understanding?

http://stackoverflow.com/comment/41875943
comment on: http://stackoverflow.com/a/26616167
has text: thank u i edit the code and edit name="meeting_id" in meeting_Id.jsp then i the run now it shows class not found exception that is java.lang.NoClassDefFoundError: classes/meeting
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26616589
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41844397
accepted answer: http://stackoverflow.com/a/26616680
type: Question
tagged with: linked-list
score: 0
tagged with: java
has title: Event based model for polling a message from a linked list
answer count: 1
has body: I have a linked list on which messages are stored. I would like to 'listen' to the linked-list and would want to process the message serially (one at a time , at its own pace). The point is, I do not want to poll for the messages in a infinite 'while' loop, unless you tell me it is fine. I think that is a in-efficient way of doing things. So basically I need a queue which behaves like a blocking queue at one end (receiver) i.e the linked list listener gets up only when message is posted on it. Is there a way to achieve it?
has answer: http://stackoverflow.com/a/26616680
tagged with: polling

http://stackoverflow.com/comment/41804716
type: AnswerComment
has text: Hi, 1 - How to debug with an Openshift java application ? 2 - If it's overriden out, where ? 3 - My Eclipse works fine I think, because I can print out with a simple java project.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26576537

http://stackoverflow.com/a/26523320
accepted answer of: http://stackoverflow.com/q/26523262
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41675055
has comment: http://stackoverflow.com/comment/41675220
has comment: http://stackoverflow.com/comment/41675172
has body: ClientConnectionEntity entity1 = new ClientConnectionEntity(); entity1.setConnectionTime(1l); entity1.setClientBrowser("1"); ClientConnectionEntity entity2 = new ClientConnectionEntity(); entity1.setConnectionTime(2l); entity1.setClientBrowser("2"); ClientConnectionEntity entity3 = new ClientConnectionEntity(); entity1.setConnectionTime(2l); entity1.setClientBrowser("2"); ClientConnectionEntity entity4 = new ClientConnectionEntity(); entity1.setConnectionTime(4l); entity1.setClientBrowser("4"); You did a copy/paste and forgot to change the variables name
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26523262
score: 2
has comment: http://stackoverflow.com/comment/41675115

http://stackoverflow.com/comment/41872137
comment on: http://stackoverflow.com/q/26631490
score: 0
has text: Java code would help. Also, what's the relationship between your Spring server and Selenium? Does your Spring server accept a request from HTTP, then run Selenium?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41663643
has text: It looks like if you disable notifications in the settings of the device in JB+, then toasts will not show either. That's interesting, hadn't seen that before.
comment on: http://stackoverflow.com/q/26515274
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26665709
has comment: http://stackoverflow.com/comment/41933244
has body: I am trying to generate a random number larger than and smaller than the previous random number, but cannot figure out how. I have this so far: number = (int)( max * Math.random() ) + min; guess = (int)( max * Math.random() ) + min; if (guess&lt;number) { guess = (int)( max * Math.random() ) + min; System.out.println(guess); } else if (guess&gt;number) { guess = (int)( max * Math.random() ) + min; System.out.println(guess); } UPDATE: How do I make sure it doesn't generate a random number that it already has generated? The computer gets 10 tries to guess the number that was generated, but I want to make it logical in the way that it wouldn't generate one that it already knows is wrong.
tagged with: math
tagged with: java
tagged with: inequality
accepted answer: http://stackoverflow.com/a/26665859
linked to: http://stackoverflow.com/q/363681
type: Question
has title: Generate a random number larger or smaller than the previous random number
score: 5
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/26665834
has comment: http://stackoverflow.com/comment/41933383
tagged with: int
tagged with: random
has comment: http://stackoverflow.com/comment/41963209
has comment: http://stackoverflow.com/comment/41963258
favorite count: 0
has comment: http://stackoverflow.com/comment/41933911
has answer: http://stackoverflow.com/a/26665859
has comment: http://stackoverflow.com/comment/41933291
has answer: http://stackoverflow.com/a/26683648
has comment: http://stackoverflow.com/comment/41933266
has answer: http://stackoverflow.com/a/26665819
has comment: http://stackoverflow.com/comment/41933278
answer count: 4
has comment: http://stackoverflow.com/comment/41933875
possible better answer: http://stackoverflow.com/a/26683648
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41933316

http://stackoverflow.com/comment/41899631
type: Comment
type: QuestionComment
has text: Are you talking about [Image Processing](http://en.wikipedia.org/wiki/Image_processing)?
comment on: http://stackoverflow.com/q/26647307
score: 0

http://stackoverflow.com/comment/113202304
score: 0
type: Comment
has text: MyBatis supports typesafe DSL too. You can use it instead of old plain SQL inside XML or Annotations.
type: QuestionComment
comment on: http://stackoverflow.com/q/26639057

http://stackoverflow.com/comment/41674468
comment on: http://stackoverflow.com/q/26522910
score: 0
type: Comment
type: QuestionComment
has text: @Rustam can u reply me

http://stackoverflow.com/q/26637340
has answer: http://stackoverflow.com/a/26639066
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm trying to pass a string of the format below as the body of a http post request. param1=PARAM1&amp;param2=PARAM2&amp;param3=PARAM3 But retrofit encodes my body so that = becomes \u003d and &amp; becomes \u0026. And I end up with a string which actually looks like this: param1\u003dPARAM1\u0026param2\u003dPARAM2\u0026param3\u003dPARAM3 How can I prevent that? My retrofit rest api is defined as follows. public interface RestAPI { @POST("/oauth/token") public void getAccessToken(@Body String requestBody, Callback&lt;Response&gt; response); }
has answer: http://stackoverflow.com/a/29291614
score: 15
type: Question
upvote count: 15
possible better answer: http://stackoverflow.com/a/29291614
downvote count: 0
accepted answer: http://stackoverflow.com/a/26639066
favorite count: 0
tagged with: retrofit
has answer: http://stackoverflow.com/a/48501780
answer count: 4
has title: Prevent retrofit from encoding my http request body
has answer: http://stackoverflow.com/a/43956656

singleton
tags question: http://stackoverflow.com/q/26611402
tags question: http://stackoverflow.com/q/26548930
tags question: http://stackoverflow.com/q/26546564
type: Tag
tags question: http://stackoverflow.com/q/26561645
tags question: http://stackoverflow.com/q/26647814
tags question: http://stackoverflow.com/q/26520436
tags question: http://stackoverflow.com/q/26661454
tag name: singleton

http://stackoverflow.com/comment/41694463
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26534169
has text: I think you will find that there is no measurable performance difference and this is a question of style. Use whichever version is easiest to read and [**Write Dumb Code**](http://www.oracle.com/technetwork/articles/javase/devinsight-1-139780.html).

http://stackoverflow.com/comment/41696076
type: QuestionComment
comment on: http://stackoverflow.com/q/26534722
has text: what function of the activity life cycle are you using the above code ?
score: 0
type: Comment

http://stackoverflow.com/comment/41822108
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26604601
has text: Your question needs improving i.e. clarification. Where is this "Comma"?
type: Comment

http://stackoverflow.com/q/26650999
tagged with: java
has answer: http://stackoverflow.com/a/26651228
has body: I have been trying to code a train reservation system which is my school project, but I don't know why my if statement is directly jumping to the else even if the if statement is true. Removing the else statement fixes the problem, but I need it because it is mandatory to print an appropriate error message. for (int j=0;j&lt;len;j++) { if (trainno[j]==tno) { stna = trainname[j]; stno = tno; sto = origin[j]; std = destination[j]; stf = fare[j]; } else if (tno==0) { System.out.println("Thanks for visiting our website!"); return; } else { System.out.print("Wong input! Try again...."); } //I wasn't able to assign an error message due to some problem because of which it was always jumping to else statement even if trainno[j] was equal to tno, do tell me if you can find the problem } Whole code import java.io.*; class PROJECT { BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); void main () throws IOException { System.out.println("Welcome to IRCTC Railway Reservation System! Please proceed further to book your train!"); System.out.println(); String[] trainname = {"Rajdhani EXP", "AUG Kranti EXP", "Chennai EXP", "Aravali EXP", "Paschim EXP", "Gareeb Rath", "Punjab Mail", "Dehradun EXP", "Swaraj EXP", "Aravali EXP"}; int[] trainno = {57835, 87612, 15384, 16512, 65265, 51654, 31543, 56416, 85484, 78455}; String[] origin = {"Mumbai", "Mumbai", "Delhi", "Kolkata", "Mumbai", "Goa", "Durg", "Aligarh", "Jaipur", "Bhuj"}; String[] destination = {"Surat", "Delhi", "Chennai", "Mumbai", "Ajmer", "Mumbai", "Bikaner", "Agra", "Madurai", "Buxar"}; int[] fare = {650, 950, 1100, 1200, 1050, 600, 1100, 1250, 1300, 1100}; int len = trainname.length; int len1 = trainno.length; int len2 = origin.length; int len3 = destination.length; int len4 = fare.length; String stna = ""; int stno = 0; String sto = ""; String std = ""; int stf = 0; System.out.println("Train Name\t\tTrain No.\tOrigin\t Destination\tFare"); System.out.println(); for (int i=0;i&lt;len;i++) { System.out.p…
type: Question
downvote count: 3
has answer: http://stackoverflow.com/a/26651295
answer count: 4
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/41905950
has answer: http://stackoverflow.com/a/26651501
type: UnansweredQuestion
score: -3
has title: Java directly jumping to else statement?
has answer: http://stackoverflow.com/a/26651258

http://stackoverflow.com/q/26522065
tagged with: keylistener
accepted answer: http://stackoverflow.com/a/26522315
type: Question
tagged with: jtextarea
answer count: 1
has answer: http://stackoverflow.com/a/26522315
tagged with: awt
score: 0
has comment: http://stackoverflow.com/comment/41672880
has title: Is there any function operates as JButton pressed?
upvote count: 1
downvote count: 1
favorite count: 0
has body: I'm making KeyListener for JTextArea in chatting program If I press ENTER key, JTextArea gets new line However, I want to make ENTER key operates as "SEND" function This is my code public void keyPressed(KeyEvent ke) { if(ke.getKeyCode() == KeyEvent.VK_ENTER) sendButton.??? else if(ke.getKeyCode() == KeyEvent.VK_ALT + KeyEvent.VK_ENTER) inputTextArea.setText(inputTextArea.getText() + "\n"); } What should I do at the point -> ??? And is there any useful advice, teach me and let my program develop :)
tagged with: jbutton
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41834510
has text: It's a great article, thanks. Moreover, when you say that in a real life app sooner or later you allocate the whole stack memory.. Well, I really dont' see how. In threads stack you save function params, method calls, thread state and that's all ligtweight and is measured in kilobytes, so I guess a difference between 10 or 1000 threads can be tens of MB which is not such a big improvement? Am I missing something?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26601117
score: 0

http://stackoverflow.com/a/26565054
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26565016
has body: Store your information inside of a map instead. When a user enters a string that you key off of (sword, boots, etc), then update its value. public class DataClass { Map&lt;String, Integer&gt; data = new HashMap&lt;&gt;(); public void addValueToData(String key) { if(!data.containsKey(key)) { data.put(key, 0); } else { data.put(key, data.get(key) + 1); } } }
type: Answer
answers question: http://stackoverflow.com/q/26565016
upvote count: 5
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/26557645
upvote count: 2
tagged with: java
type: Question
has title: Does LuaJ support __gc metamethod functionality
tagged with: luaj
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: lua
score: 2
has body: When experimenting with LuaJ on some personal (trivial) projects, I found that I seemed unable to make use of __gc in table metatables as shown in the example below: do local tbl = {id="tblID"} setmetatable(tbl,{__gc=function(self) print("gc'd :"..self.id) end }) print(tbl.id) end collectgarbage('collect') Though I'm aware in LuaJ collectgarbage() is a redundant function call, due to LuaJ relying on Java's own garbage collection instead, I included it as some other interpreters seem to require it ( e.g. Lua's own at http://www.lua.org/cgi-bin/demo) The given example seems to function in the online interpreter provided above. I'm currently assuming the fault is either with LuaJ in some fashion or garbage collection occurring at the end of program execution not calling __gc metamethods on collected objects. I've tried giving java enough time to GC the table before the application ends by providing a lengthy wait period following the call along with a call to System.gc() to suggest garbage collection to the runtime, all currently to no avail.
answer count: 0

http://stackoverflow.com/q/26533615
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/41693899
type: UnansweredQuestion
tagged with: non-static
has comment: http://stackoverflow.com/comment/41694110
has comment: http://stackoverflow.com/comment/41693423
has comment: http://stackoverflow.com/comment/41693482
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41693414
upvote count: 1
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/41693481
linked to: http://stackoverflow.com/q/15827869
has answer: http://stackoverflow.com/a/26533841
tagged with: class
has body: my professor refuses to tell me what I'm doing wrong and I for the life of my can't figure it out. I'm just starting java so I may look foolish but import java.util.Scanner; public class Library { MediaItem[] items = new MediaItem[100]; int numberOfItems = 0; static int displayMenu(){ @SuppressWarnings("resource") Scanner dog = new Scanner(System.in); System.out.println("Menu:\n1:Add New Item\n2:Mark Item as Loaned\n3:List All Items\n4:Mark Item as Returned\n5:Quit"); int cat = dog.nextInt(); return cat; } void addNewItem(String title, String format){ MediaItem item = new MediaItem(); item.setTitle(title); item.setFormat(format); items[numberOfItems] = item; numberOfItems++; } void markItemOnLoan(String title, String name, String date){ for (int i=0;i&lt;numberOfItems;i++){ MediaItem item = items[i]; String title5 = item.getTitle(); if (title5 == title){ item.markOnLoan(name, date); i=numberOfItems; } } } String[] listAllItems(){ String[] all = new String[numberOfItems]; for (int i=0;i&lt;numberOfItems;i++){ MediaItem item = items[i]; if (item.onLoan=true){ all[i]=item.getTitle()+" "+item.getFormat()+" "+item.getOnLoan()+" "+item.getLoanedTo()+" "+item.getDateLoaned()+" "; }else{ all[i]=item.getTitle()+" "+item.getFormat()+" "+item.getOnLoan()+" "; } } return all; } void markItemReturned(String title){ for (int i=0;i&lt;numberOfItems;i++){ MediaItem item = items[i]; String title1 = item.getTitle(); if (i==numberOfItems){ System.out.println("Title not found."); }else if (title1 == title){ item.markReturned(); i=numberOfItems; } } } public static void main(String[] args) { Library banana = new Library(); String invalid = "Invalid Option"; @SuppressWarnings("resource") Scanner dog = new Scanner(System.in); for (int i=0; i==0;){ int cat = displayMenu(); if (cat&lt;=0){ System.out.println(invalid); } if (cat&gt;=6){ System.out.println(invalid); } switch (cat){ case 1: System.out.println("What is the title of the item?"); String title = dog.nextLine(); System.out.println(…
answer count: 1
has title: Cannot make a static reference to the non-static method Library
downvote count: 0

http://stackoverflow.com/comment/41674547
comment on: http://stackoverflow.com/a/26522193
score: 1
type: AnswerComment
has text: You do not need to remove annotations. You can use both. Annotations are just overwrite when xml file is present
type: Comment

http://stackoverflow.com/comment/41839598
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26613943
has text: I created a separate method that defines the string pattern as four randomly generated digits concatenated into a string.
type: Comment

http://stackoverflow.com/comment/41891133
type: AnswerComment
comment on: http://stackoverflow.com/a/26641926
has text: I tried the code but it seems it still couldn't find the list iterator class. I imported them at the beginning regardless.
score: 0
type: Comment

http://stackoverflow.com/comment/41720459
type: Comment
type: QuestionComment
has text: Someone else already provided a good answer, but I just wanted to comment that you should learn to read your error messages better. In your error message you see `at StatsDemo.main(StatsDemo.java:47)`. The 47 is the line number where the exception occurs, I think it points to the line `line = inputFile.nextLine();`.
comment on: http://stackoverflow.com/q/26548778
score: 0

http://stackoverflow.com/q/26602209
type: Question
has body: I'm a newbie to java. Can anyone pls help me with resolving the error arrayindexoutofboundsexception. public class Minesweeper { public static void main(String[] args) { int M = Integer.parseInt(args[0]); int N = Integer.parseInt(args[1]); double p = Double.parseDouble(args[2]); // game grid is [1..M][1..N], border is used to handle boundary cases boolean[][] bombs = new boolean[M+2][N+2]; for (int i = 1; i &lt;= M; i++) for (int j = 1; j &lt;= N; j++) bombs[i][j] = (Math.random() &lt; p); // print game for (int i = 1; i &lt;= M; i++) { for (int j = 1; j &lt;= N; j++) if (bombs[i][j]) System.out.print("* "); else System.out.print(". "); System.out.println(); } // sol[i][j] = # bombs adjacent to cell (i, j) int[][] sol = new int[M+2][N+2]; for (int i = 1; i &lt;= M; i++) for (int j = 1; j &lt;= N; j++) // (ii, jj) indexes neighboring cells for (int ii = i - 1; ii &lt;= i + 1; ii++) for (int jj = j - 1; jj &lt;= j + 1; jj++) if (bombs[ii][jj]) sol[i][j]++; // print solution System.out.println(); for (int i = 1; i &lt;= M; i++) { for (int j = 1; j &lt;= N; j++) if (bombs[i][j]) System.out.print("* "); else System.out.print(sol[i][j] + " "); System.out.println(); } } } and here is the exception: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Minesweeper.main(Minesweeper.java:5)
has answer: http://stackoverflow.com/a/26602235
has comment: http://stackoverflow.com/comment/41817850
has answer: http://stackoverflow.com/a/26602236
has comment: http://stackoverflow.com/comment/41817836
score: 4
has comment: http://stackoverflow.com/comment/41818126
has answer: http://stackoverflow.com/a/26618493
has title: how to fix java.lang.arrayindexoutofboundsexception: 0?
downvote count: 1
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/26602237
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41817985
answer count: 4
has comment: http://stackoverflow.com/comment/43917049
favorite count: 0

http://stackoverflow.com/comment/41912496
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26654592
has text: Particularly I also think a lot easier. But I will send the XML to a web service, and the need to be in xml format that I quoted.

http://stackoverflow.com/q/26587270
type: Question
has body: I have a thread named runner. I want to stop this thread onBackPressed but this is not happening. Here is the code: public class StrobeLightConfig extends Activity { Camera cam; StrobeRunner runner; Thread bw; CheckBox strobe; private boolean isFlashOn; private boolean hasFlash; private Parameters params; private MediaPlayer mp; VerticalSeekBar skbar, skbaroff; ToggleButton togglebutton; public final Handler mHandler = new Handler(); public final Runnable mShowToastRunnable = new Runnable() { public void run() { showMessage(); } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); skbar = (VerticalSeekBar) findViewById(R.id.SeekBar01); strobe = (CheckBox) findViewById(R.id.checkBox1); togglebutton = (ToggleButton) findViewById(R.id.ToggleButton01); skbaroff = (VerticalSeekBar) findViewById(R.id.SeekBar02); hasFlash = getApplicationContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); turnOnFlash(); strobe.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView.isChecked()) { cam.release(); Toast.makeText(getApplicationContext(), "Released 1", 0) .show(); } else { cam.release(); Toast.makeText(getApplicationContext(), "Released 2", 0) .show(); } } }); runner = StrobeRunner.getInstance(); runner.controller = this; if (runner.isRunning) { } else { try { if (cam == null) { cam = Camera.open(); } } catch (RuntimeException ex) { togglebutton.setEnabled(false); TextView t = (TextView) findViewById(R.id.TextViewHW2); t.setText(R.string.nocamera); Toast.makeText(getApplicationContext(), "Error connecting to camera flash.", Toast.LENGTH_LONG) .show(); return; } } togglebutton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks if (strobe.isChecked()) { if (togglebutton…
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26587487
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/41789783
has title: Unable to stop thread onBackPressed
tagged with: java

http://stackoverflow.com/comment/41661877
type: Comment
comment on: http://stackoverflow.com/q/26515251
score: 0
type: QuestionComment
has text: The answer to this question has a nice little case class to map function that you could modify to return a `SolrDocument` http://stackoverflow.com/a/1227643/47496

model-view-controller
tags question: http://stackoverflow.com/q/26537322
tag name: model-view-controller
tags question: http://stackoverflow.com/q/26601443
tags question: http://stackoverflow.com/q/26584249
tags question: http://stackoverflow.com/q/26616121
tags question: http://stackoverflow.com/q/26619560
tags question: http://stackoverflow.com/q/26554015
tags question: http://stackoverflow.com/q/26642870
tags question: http://stackoverflow.com/q/26569504
tags question: http://stackoverflow.com/q/26631524
tags question: http://stackoverflow.com/q/26656769
type: Tag
tags question: http://stackoverflow.com/q/26580935
tags question: http://stackoverflow.com/q/26517856
tags question: http://stackoverflow.com/q/26630826

http://stackoverflow.com/comment/41802039
comment on: http://stackoverflow.com/a/26593278
score: 0
type: AnswerComment
type: Comment
has text: @Harry: You'll need to `(re-)validate()` the enclosing container and possibly `repaint()`, for [example](http://stackoverflow.com/a/5812981/230513).

http://stackoverflow.com/q/26583713
type: AnsweredQuestion
tagged with: cxf
tagged with: java
has answer: http://stackoverflow.com/a/26595113
accepted answer: http://stackoverflow.com/a/26595113
type: Question
answer count: 1
tagged with: spring-security
score: 0
has title: can not deploy JAX-RS with spring's DelegatingFilterProxy filter
tagged with: jax-rs
has body: I try to implement Spring Security basic authentication for JAX-RS project. pom.xml file <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 org.wso2.af attws default-SNAPSHOT war attws attws <carbon.platform.version>4.2.0</carbon.platform.version> <junit.version>4.8.2</junit.version> <cxf.version>2.6.1</cxf.version> 1.0 <org.springframework.version>3.2.0.RELEASE</org.springframework.version> <dependencies> org.springframework.security spring-security-web ${org.springframework.version} jar runtime org.springframework.security spring-security-config ${org.springframework.version} jar runtime org.springframework.security spring-security-core ${org.springframework.version} jar compile org.springframework.security spring-security-taglibs ${org.springframework.version} compile web.xml file JAX-WS/JAX-RS Webapp springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* applicationKey attws JAXServlet JAX-WS/JAX-RS Servlet JAX-WS/JAX-RS Endpoint org.apache.cxf.transport.servlet.CXFServlet service-list-stylesheet servicelist.css 1 JAXServlet /services/* 60 contextConfigLocation classpath:security-context.xml org.springframework.web.context.ContextLoaderListener security-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.x…

http://stackoverflow.com/comment/41683335
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26527212
has text: Thanks for the in depth explanation for all of those, I will be testing this asap and will let you know how it goes.
score: 0

http://stackoverflow.com/comment/41739903
type: Comment
comment on: http://stackoverflow.com/a/26559344
has text: @jdog1218 anyway i updated the answer that will give you the exactly output
score: 0
type: AnswerComment

http://stackoverflow.com/q/26526759
tagged with: struts
type: Question
has answer: http://stackoverflow.com/a/30894402
has comment: http://stackoverflow.com/comment/41692389
score: 0
answer count: 1
tagged with: file-upload
type: UnansweredQuestion
has title: Struts file upload not working with jar files in lib folder
has body: Can someone help me please ? I am stuck and don't have any clue. I want to upload a file in struts 1.2. I know that struts uses 'commons-io.jar' and 'commons-fileupload.jar' for file upload and I need to place these jars in WebContent / Web-INF / lib folder. I placed the jars in lib folder but application is giving class definition not found error. I tried creating a lib folder and placing these jar files under WEB-INF folder. I also tried adding these jar files in build path but still giving same below error. I also tried using 3 differnet versions (1, 1.4, 2.4) of 'commons-io.jar'. Can some one help please ? java.lang.NoClassDefFoundError: org.apache.commons.io.output.DeferredFileOutputStream at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:59) at java.lang.J9VMInternals.verify(J9VMInternals.jenter code hereava:57) at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
tagged with: java

http://stackoverflow.com/comment/41833142
type: Comment
comment on: http://stackoverflow.com/a/26610463
score: 0
type: AnswerComment
has text: @KishorePaparthi There you go I edited it to display current date and time! Hope this helps!

http://stackoverflow.com/comment/41681054
has text: Anyway... Did you try writing the network path of the image file to `inFile`? For example `inFile = "networkpath/image.png"`. AFAIK you can read image like that.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26525567

http://stackoverflow.com/a/26564305
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26564261
type: Answer
has body: I'm not completely clear about your requirement, but this will probably work for you: Pattern word_pattern = Pattern.compile("\\B\\$" + word + "\\b", Pattern.CASE_INSENSITIVE); \B tests for non-word boundary. Since $ is after \B, there must be no character before $ (beginning of a line) or the character before $ must be a non-word character for it to match. You must validate that word only contains valid characters, which I assume it to be [a-zA-Z0-9_], which is the definition of \w and. And the exact solution may differ if your definition of valid character is different from [a-zA-Z0-9_]. (I forgot about case-insensitive matching and was reminded by Pshemo's answer)
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26564261

http://stackoverflow.com/q/26535320
possible better answer: http://stackoverflow.com/a/26535839
type: AnsweredQuestion
downvote count: 0
type: Question
score: 3
has answer: http://stackoverflow.com/a/26535366
accepted answer: http://stackoverflow.com/a/26535366
tagged with: java
has answer: http://stackoverflow.com/a/26535839
upvote count: 3
answer count: 2
has body: I'm using this function to check wheather an url image exists or not : public Boolean testImage(String url) { try { BufferedImage image = ImageIO.read(new URL(url)); //BufferedImage image = ImageIO.read(new URL("http://someimage.jpg")); if (image != null) { return true; } else { return false; } } catch (MalformedURLException e) { // TODO Auto-generated catch block System.err.println("URL error with image"); e.printStackTrace(); } catch (IOException e) { System.err.println("IO error with image"); // TODO Auto-generated catch block e.printStackTrace(); } return null; } And then i call this method : if (testImage("URLHERE")) { System.out.println("Yes"); } else { System.out.println("No"); } The problem is when i execute this code, i got this result : Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes IO error with image javax.imageio.IIOException: Can't get input stream from URL! at javax.imageio.ImageIO.read(ImageIO.java:1369) I just want get Yes or No, not an error, i know that in some cases the url isn't valid and that's what i what to determin. Is it possible ? Thanks
has title: Check if image URL exists
favorite count: 0

http://stackoverflow.com/comment/41887848
score: 0
has text: what is the error you are having? I am as well running into trouble with the j2mod, with the port policies.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26621299

timer
tag name: timer
tags question: http://stackoverflow.com/q/26634043
tags question: http://stackoverflow.com/q/26615759
tags question: http://stackoverflow.com/q/26515357
type: Tag
tags question: http://stackoverflow.com/q/26523841
tags question: http://stackoverflow.com/q/26660158
tags question: http://stackoverflow.com/q/26655194
tags question: http://stackoverflow.com/q/26624644
tags question: http://stackoverflow.com/q/26613439
tags question: http://stackoverflow.com/q/26651047
tags question: http://stackoverflow.com/q/26604717
tags question: http://stackoverflow.com/q/26571631

http://stackoverflow.com/comment/41686095
comment on: http://stackoverflow.com/q/26529128
score: 0
has text: Its a lot of expense just to swap a JAR file. Probably better just emailing the file to an employee and asking them to swap it. The shared server is my own and i was gonna just use it to update. Any easy way of doing it without SSH?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41742075
has text: I have java 1.8. Yes, i was trying the autoclose the writer.
comment on: http://stackoverflow.com/q/26560548
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41842699
score: 0
type: Comment
type: QuestionComment
has text: I would also put quotes in, as `CLASSPATH="..."` and `java -cp "$CLASSPATH" ...` It doesn't matter in this case since there are no spaces, but it's a good habit to get into with shell scripts.
comment on: http://stackoverflow.com/q/26615620

http://stackoverflow.com/comment/41734113
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26556240
has text: Isn't really a good idea what you are trying get to do
score: 0

http://stackoverflow.com/comment/41837212
type: AnswerComment
comment on: http://stackoverflow.com/a/26612789
has text: I see. I did not know that. Thank you for the information. I'll begin to change my program to work with ArrayList if I can.
type: Comment
score: 0

http://stackoverflow.com/comment/41923523
score: 0
comment on: http://stackoverflow.com/q/26660663
type: QuestionComment
type: Comment
has text: and does isWon() return true/increment its counter?

http://stackoverflow.com/a/26641015
answers question: http://stackoverflow.com/q/26640736
has body: It does exactly what I want, but I wondered if there was a more natural way to express the idea. Languages have idiomatic constructs unique to the syntax to stuff. In Java, the first option you showed: boolean ok = false; try { doWork(); ok = true; } finally { if (!ok) { doCleanup(); } } it is the idiomatic way of doing it in Java that feels natural to the (no pun intended) natural syntax of said language. You are looking for a natural on-error only mechanism, and Java does not have one. You are trying create a clean-up mechanism without involving compiler checks on checked throwables. One would think to use generics, but generics have restrictions (namely, one cannot parameterize a subclas of throwable.) However, IIRC, there are ways to circumvent compiler checking by parameterizing the enclosing method with a Class, then manufacture the instance via reflection and throwing it. But, in the general case, now we are getting into the realm of the hairy for no apparent and useful reason. I would stick to the example you showed. It is clear what it does, it is clean and there are no asinine and unexpected gotchas in it. .ps. For the love of God, I hope you are not using C++ catch-all idiom (at least not without preceding it with with a battery of type-specific catch blocks, including std::exception). There is nothing worse than having to deal with code that reaches such a catch-all block. There is no freaking information whatsoever, near impossible to trace what threw it. Been there and don't that for a living. The stuff of nightmares.
score: 0
type: Answer

http://stackoverflow.com/q/26603559
type: Question
score: 1
tagged with: java
has body: I want to use JAXB to generate very specific XML schema and then parse the XML documents matching the schema. I have the AbstractViewElement class that is a base for everything that will show up in the XML. Then there's Layout class and widgets: public class Layout extends AbstractViewElement { private List&lt;AbstractViewElement&gt; children; ... } public class TextField extends AbstractViewElement { ... } public class Button extends AbstractViewElement { ... } Now, I want to be able to parse XML documents that look more or less like this: &lt;ucl:Layout&gt; &lt;ucl:Button/&gt; &lt;ucl:TextField/&gt; &lt;/ucl:Layout&gt; So, basically I want to get rid of the "children" tag, that is normally required by the Layout class. I'm not sure how to set up the xml namespaces in JAXB either, so... help?
tagged with: jaxb
answer count: 1
downvote count: 0
favorite count: 0
has title: Parsing abstract objects without container tag with JAXB
has answer: http://stackoverflow.com/a/26604329
accepted answer: http://stackoverflow.com/a/26604329
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/a/26579854
upvote count: 1
has comment: http://stackoverflow.com/comment/41776989
answers question: http://stackoverflow.com/q/26579804
downvote count: 0
has body: I can't judge whether you should really do it this way, or manage to change your program to pass in the string. But in general, you would be able to get that by looking at the stack. This answer almost gets you there: https://stackoverflow.com/a/442789/709537 Not sure how much time it costs to create the stack trace, if your method is called very often, you should check that.
score: 1
type: Answer

http://stackoverflow.com/a/26601679
accepted answer of: http://stackoverflow.com/q/26600444
has body: Instead of using POST request, try GET one: Document query_result = Jsoup.connect("http://www.shopping.com/digital-camera/products?CLT=SCH&amp;KW=digital+camera") .get(); Take a look how does this search works. It doesn't use POST method and it keeps all search parameters in a query string. After this small change your first select example will work well.
answers question: http://stackoverflow.com/q/26600444
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41817670
type: Answer
has comment: http://stackoverflow.com/comment/41820007

http://stackoverflow.com/a/26623290
has comment: http://stackoverflow.com/comment/41894004
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26623253
has comment: http://stackoverflow.com/comment/41893971
type: Answer
upvote count: 2
score: 2
has body: " when I try to use getGraphics() on the JFrame im using" - DON'T, this is not how custom is painting is done in Swing. getGraphics will, at best, return a snap shot of the last paint cycle and anything painted to it will be painted over on the next paint cycle and at worst, will return null. Take a look at Painting in AWT and Swing and Performing Custom Painting for dore details about how painting works in Swing and how you should work with it... Instead, create your self a custom component, extending from something like JPanel and use it's paintComponent to paint your images. Normally, content stored in the src will be made available your application as embedded resources (this will depend on your IDE and build system), but generally speaking, you should not access any resource with the path containing src, this should be an immediate read flag for potential issues. In this case you should be using Class#getResource to load the resource... public class Images{ public static final Image Image1 = tk.getImage(Images.class.getResource("/images/image1.png")); for example. I would discourage you from using Toolkit.getImage as it will use a background thread to load the image and doesn't throw any kind of exception if the image wasn't loaded Instead considering using ImageIO.read, see Reading/Loading an Image for more details Like before, I don't want to make a class for every single image, I would prefer if they were all in one class. Additionally, when I try to use getGraphics() on the JFrame I'm using, I do through this GIGANTIC loop between making thing statics and not being able to apply static terms to non-static context, such as making a variable static, but then it says can't be used in static context, but then when you don't make it static a different variable says change it back to static, you don't make that static, and you go through this huge loop between making it static and changing to not be static (sorry for long explanation, was trying to be specific). …
answers question: http://stackoverflow.com/q/26623253

http://stackoverflow.com/q/26626406
downvote count: 2
answer count: 1
has title: get attributeby is not working
has answer: http://stackoverflow.com/a/26626886
has comment: http://stackoverflow.com/comment/41862619
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41863207
has body: String a=driver.findElement(By.id(locator))).getAttribute("value"); System.out.println("the value is "+ a); Log.info(" Required object is present in the applicaiton"+ object); **MANTPLAP29102014100955627** I need to get the MANTPLAP29102014100955627 value from the above HTML code. Please help..
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/41863128
tagged with: selenium
tagged with: webdriver
type: Question

http://stackoverflow.com/a/26630743
score: 1
has body: @Vlad Ilie thanks for having a look , its solved now.. the problem is with jar creation ant script . The earlier ant task for the jar creation is not able to club all the jars in the class path and resulting... classnotfoundexception which in turn caused the ExceptionInInitializerError and NullPointerException . Below is the fixed "jar" task which is successfully able to add all the jars in the class path . &lt;target name="jar" depends="compile"&gt; &lt;jar destfile="${env.ANT_HOME}/lib/custom-task.jar" basedir="build/classes" &gt; &lt;zipgroupfileset dir="${basedir}/libs/" includes="*.jar"/&gt; &lt;/jar&gt; &lt;/target&gt; Above I used zipgroupfileset which is very handy .
upvote count: 1
answers question: http://stackoverflow.com/q/26605928
has comment: http://stackoverflow.com/comment/44047524
downvote count: 0
type: Answer

http://stackoverflow.com/a/26623435
answers question: http://stackoverflow.com/q/26623105
has comment: http://stackoverflow.com/comment/41856908
score: 0
has body: Replace post.close(); with post.flush(); and you should be fine. Close the stream when the exit condition is entered.
type: Answer
has comment: http://stackoverflow.com/comment/41857337

http://stackoverflow.com/comment/41807941
has text: Yeah... implicit isn't enough to instantiate.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26596612
type: Comment

http://stackoverflow.com/q/26601860
answer count: 2
has body: A Thread can be created via implementing runnable as public class Program implements Runnable{ public void run(){ System.out.println("Thread in progress"); } public static void main(string args[]){ Program p1 = new Program(); new Thread(p1).start(); //we can also use (new Thread(new Program())).start(); } } Is one way preferred over the other?
has answer: http://stackoverflow.com/a/26602059
has answer: http://stackoverflow.com/a/26601907
type: AnsweredQuestion
has title: Creating a thread via implementing runnable interface
possible better answer: http://stackoverflow.com/a/26602059
tagged with: java
tagged with: multithreading
type: Question
accepted answer: http://stackoverflow.com/a/26601907
score: 0

http://stackoverflow.com/comment/41811358
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26598527
has text: It reads a line of input

pdf-parsing
type: Tag
tag name: pdf-parsing
tags question: http://stackoverflow.com/q/26548900

http://stackoverflow.com/a/26658104
answers question: http://stackoverflow.com/q/26657795
score: 0
type: Answer
has body: One straightforward solution would be: 1) Implement a checker method inside Transport class which would check if a given Transport has a relation with a given Shop (Transport#isRelatedWith(Shop):boolean) 2) Create a tag (could be either a Java implementation or a JSP) which would use the checker method to set status of checkboxes Another solution (not recommended) would be to implement this logic right in place, using JSP so-called scriptlets &lt;% code-goes-here %>

http://stackoverflow.com/comment/41698732
comment on: http://stackoverflow.com/a/26535591
type: Comment
has text: thank you very much both of you! both comments were very helpful. i'm making progress (i think) but now i'm lost with how to print the modified story into a text field. i've edited the above to show what i have so far, and i've clarified what i need to do above the code.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26514136
downvote count: 0
has answer: http://stackoverflow.com/a/26514170
favorite count: 0
type: UnansweredQuestion
tagged with: regex
score: 1
tagged with: java
upvote count: 1
has body: how can I determine if this matches: (WORD|DIGIT)(\\s*|$) if word or digit is found - after that, a whitespace must follow - until it is not the end of line.. is this right?
type: Question
has comment: http://stackoverflow.com/comment/41659998
has title: Regular Expression (java) after word only whitespace or end of line
answer count: 1

http://stackoverflow.com/q/26602520
type: Question
has comment: http://stackoverflow.com/comment/41818705
has comment: http://stackoverflow.com/comment/41819005
has answer: http://stackoverflow.com/a/26602732
has comment: http://stackoverflow.com/comment/41818470
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41818938
favorite count: 0
has title: Is it possible to call a method from running application
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41818762
has comment: http://stackoverflow.com/comment/41818492
linked to: http://stackoverflow.com/q/60764
linked to: http://stackoverflow.com/q/1416780
has comment: http://stackoverflow.com/comment/41818793
has body: I have an application like the follows, public class OpenApp { public static void main(String[] args) { if(args.length&gt;0) System.out.println("Hi " + args[0]); System.in.read(); } public static String sayHi(){ return "Hi"; } } So The OpenApp will be running. I have some other methods. Can I call the sayHi method from another application, without creating new instance of the class.? Because I have some data constrains on running OpenApp. Please Correct me If my question is wrong. Simply I'm trying to communicate between 2 JVM. So, I read, RMI is the best way to make the communication. So Is there any other way.
score: 1
has comment: http://stackoverflow.com/comment/41818809
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41818601

http://stackoverflow.com/a/26606510
score: 0
has body: Try reading the file using the Files class. This code will find the first occurrence in every line: Path path = Paths.get("path"); List&lt;String&gt; lines = Files.readAllLines(path); int found = -1; for (String line : lines) found = line.indexOf("word"); Don't forget to replace the path and the search word. If you want to find the first occurrence in the whole file, use a StringBuilder to concatenate the lines: StringBuilder sb = new StringBuilder(); for (String line : lines) sb.append(line); found = sb.toString().indexOf("word"); Or find the first occurrence in every line with respect to all lines before it: int loc = 0; for (String line : lines) { if (line.indexOf("word") != -1); found = loc + line.indexOf("word"); loc += line.length(); } You can also use a Pattern-Matcher combination for this and it will be easier if you want to find all occurrences of the word.
type: Answer
answers question: http://stackoverflow.com/q/26600800

http://stackoverflow.com/a/26589475
type: Answer
answers question: http://stackoverflow.com/q/26589227
has body: Boost.Any does the job. This should basically do what the author shows: #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;map&gt; #include &lt;typeindex&gt; #include &lt;boost/any.hpp&gt; class heterogenous_map : std::map&lt;std::type_index, boost::any&gt; { public: template &lt;typename T&gt; void add(T&amp;&amp; value) { emplace(typeid(typename std::remove_reference&lt;T&gt;::type), std::forward&lt;T&gt;(value)); } template &lt;typename T&gt; T &amp; get() { return *boost::any_cast&lt;T&gt;(&amp;at(typeid(T))); } template &lt;typename T&gt; T const&amp; get() const { return *boost::any_cast&lt;T&gt;(&amp;at(typeid(T))); } }; int main() { heterogenous_map map; map.add(6584); map.add&lt;std::string&gt;("Hi!"); std::cout &lt;&lt; "My favourite integer: " &lt;&lt; map.get&lt;int&gt;() &lt;&lt; '\n'; std::cout &lt;&lt; "My favourite string : " &lt;&lt; map.get&lt;std::string&gt;() &lt;&lt; std::endl; } Demo.
has comment: http://stackoverflow.com/comment/41795407
has comment: http://stackoverflow.com/comment/41797865
has comment: http://stackoverflow.com/comment/41795685
score: 0
has comment: http://stackoverflow.com/comment/41795867
has comment: http://stackoverflow.com/comment/41795775

http://stackoverflow.com/comment/41805839
comment on: http://stackoverflow.com/q/26595499
type: Comment
type: QuestionComment
score: 0
has text: from your screenshot it looks like the ferrari instance of Car isn't setup correctly.. maybe there are other error messages somewhere in a log file or console output?

http://stackoverflow.com/comment/41951294
has text: Can you please put your code in try catch block..the above code is throwing a lot of exceptions..
type: AnswerComment
comment on: http://stackoverflow.com/a/26672851
score: 0
type: Comment

http://stackoverflow.com/q/26666496
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41952333
type: Question
has comment: http://stackoverflow.com/comment/41940668
tagged with: java
tagged with: hibernate
score: 0
tagged with: jpa
has title: NPE Hibernate Cache and org.hibernate.collection.PersistentSet.initializeFromCache
has body: I'm getting a NPE on a Model called IssueStepFieldTypeModel at @Override public int hashCode() { final int hash = 5; return 53 * hash + getCode().hashCode(); } getCode() is null even though code is annotated @NotNull and the instance is indeed in the database with all its data. the error is being thrown in the call to getIssueStepFieldTypeById. in the web app the user is requesting to display the model so the query really can't fail. this error occured after adding the following line to hibernate.cfg.xml &lt; class-cache class="hae.op.issu.server.model.IssueStepFieldTypeModel" include="all" usage="read-write" /&gt; remove the line and all is well. the error is happening both my local instance of tomcat (which is single user) and on the development server with a load balancer FieldType has a reference to its 'owner' StepType @ManyToOne(fetch = FetchType.EAGER, optional = false) @JoinColumn(name = "ISSUETYPE_STEP_TYPE_ID", referencedColumnName = "ID") @NotNull private IssueStepTypeModel issueStepType; StepType has a Set of the FieldTypes it 'owns' @OneToMany(fetch = FetchType.EAGER, mappedBy = "issueStepType") private Set&lt;IssueStepFieldTypeModel&gt; issueStepFieldTypes; abreviated stack trace follows any assistance would be greatly appreciated thank you java.lang.NullPointerException at hae.op.issu.server.model.IssueStepFieldTypeModel.hashCode(IssueStepFieldTypeModel.java:128) at java.util.HashMap.hash(HashMap.java:362) at java.util.HashMap.put(HashMap.java:492) at java.util.HashSet.add(HashSet.java:217) at org.hibernate.collection.PersistentSet.initializeFromCache(PersistentSet.java:149) at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:58) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:159) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:71) at o…
tagged with: spring

http://stackoverflow.com/comment/41667054
has text: Is this a pre-existing table with a fixed schema? If you are able to specify the type of the PK the solution is relatively simple
comment on: http://stackoverflow.com/q/26518683
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26563328
downvote count: 0
has answer: http://stackoverflow.com/a/26563519
favorite count: 0
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26563519
has body: I am using spring framework and for database I am using hibernate.cfg.xml in the following way <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.cache.NoCacheProvider false update <mapping class="com.lynas.test.Student" /> </hibernate-configuration> Now is there any way to write this code in the java file. Like a bean or something??
has title: hibernate.cfg.xml alternative in java file
type: Question
has answer: http://stackoverflow.com/a/26564063
score: 3
possible better answer: http://stackoverflow.com/a/62276165
has answer: http://stackoverflow.com/a/62276165
answer count: 3

http://stackoverflow.com/q/26553628
has answer: http://stackoverflow.com/a/26553756
has comment: http://stackoverflow.com/comment/41729175
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26554171
has answer: http://stackoverflow.com/a/26553781
has title: How can I find the positions of something in an ArrayList in a nested loop?
answer count: 4
has answer: http://stackoverflow.com/a/26553849
has comment: http://stackoverflow.com/comment/41729300
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26553756
tagged with: java
has body: is there a way to compare two arrayLists to see if either of them have equal values at any point? I know that I can use two nested loops, however I am trying to do this in log(n) time, so instead, I am trying to do it similarly to how one would merge two lists in mergesort, however I can't really figure out exactly how to implement it. Any help would be greatly appreciated! Thanks! Edit: Yeah I meant nlog(n), not log(n), sorry
possible better answer: http://stackoverflow.com/a/26553781
type: Question

http://stackoverflow.com/comment/63623111
type: AnswerComment
comment on: http://stackoverflow.com/a/32466614
has text: @Hans-ChristophSteiner will this enable TLS support for Android versions below 4.1?
type: Comment
score: 0

http://stackoverflow.com/comment/41902259
comment on: http://stackoverflow.com/q/26648885
has text: Java basics: http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26609402
answers question: http://stackoverflow.com/q/26608967
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26608967
score: 1
has comment: http://stackoverflow.com/comment/41831269
has body: You can place capturing groups around what you want to retain and refer those groups in the replacement call. String s = "ga- te, ga - te, foo - bar"; s = s.replaceAll("([a-z]) *- *([a-z])", "$1$2"); System.out.println(s); //=&gt; "gate, gate, foobar"
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/26537355
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/29631206
tagged with: websocket
tagged with: tomcat
tagged with: sockets
has title: Tomcat websockets and separate java process communication
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/29631206
has body: I have a tomcat 7.0.53 server running for the purpose of communicating between java and the website through websockets. I wrote the website script as well as the websocket server java code and they communicate and work correctly. However the information I want passed to the website is from another java program running in the background on a Linux machine. The problem lies however with that when I try to pass messages into a sendmessage type of function on the websocket server java code, it thinks that no sessions are open to send the websocket message to even if I do have the website opening waiting for a message from the separate java process to be passed through the websocket server. I found out this problem arises since I have to make a new instance of the websocket server when passes messages from my separate java process into the websocket server sendmessage function and thus there are no websocket sessions in that instance. I am stumped as to a way around this problem other then to making a socket between my websocket server and the other java process running which will be messy and want to avoid. Does anyone else know anyway else this can be done with communicating a separate java process with a websocket server for tomcat, or is this just impossible to do without making a socket?
tagged with: tomcat7
type: Question

http://stackoverflow.com/comment/41663171
comment on: http://stackoverflow.com/q/26515274
has text: MainActivity.this also does not work i had told before
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26662366
has title: Unable to run hello world program on new ADT Plugin Version 23.0.4.1468518
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41928697
tagged with: java
has comment: http://stackoverflow.com/comment/41926907
has body: I am a newbie to android development. Download ADT bundle for windows and installed the Android 4.1.2 through SDK manager.Even installed ADT plugin through Eclipse Juno. When I created the first Project-Hello World , I am getting so many build errors in eclipse. Here are the 12 errors: 1.ActionBarActivity cannot be resolved to a type MainActivity.java /HelloWorld/src/com/example/helloworld line 8 Java Problem 2.ActionBarActivity cannot be resolved to a type MainActivity.java /HelloWorld/src/com/example/helloworld line 12 Java Problem 3.ActionBarActivity cannot be resolved to a type MainActivity.java /HelloWorld/src/com/example/helloworld line 32 Java Problem 4.error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml /HelloWorld/res/values line 7 Android AAPT Problem 5.R cannot be resolved to a variable MainActivity.java /HelloWorld/src/com/example/helloworld line 13 Java Problem 6.R cannot be resolved to a variable MainActivity.java /HelloWorld/src/com/example/helloworld line 19 Java Problem 7.R cannot be resolved to a variable MainActivity.java /HelloWorld/src/com/example/helloworld line 29 Java Problem 8.The import android.support.v7 cannot be resolved MainActivity.java /HelloWorld/src/com/example/helloworld line 3 Java Problem 9.The method getMenuInflater() is undefined for the type MainActivity MainActivity.java /HelloWorld/src/com/example/helloworld line 19 Java Problem 10.The method onCreate(Bundle) of type MainActivity must override or implement a supertype method MainActivity.java /HelloWorld/src/com/example/helloworld line 11 Java Problem 11.The method onCreateOptionsMenu(Menu) of type MainActivity must override or implement a supertype method MainActivity.java /HelloWorld/src/com/example/helloworld line 17 Java Problem 12.The method onOptionsItemSelected(MenuItem) of type MainActivity must override or implement a supertype method MainActivity.java /HelloWorld/src/com/example/helloworld line …
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/4085959
answer count: 2
has comment: http://stackoverflow.com/comment/41927229
has answer: http://stackoverflow.com/a/26662850
has answer: http://stackoverflow.com/a/26663080

http://stackoverflow.com/comment/41710827
type: QuestionComment
comment on: http://stackoverflow.com/q/26539713
score: 0
has text: What do you mean by "Adding Java Project to my Scala Project"? Is it in the IDE? Is it in the build tool? What IDE & Build tool are you using?
type: Comment

http://stackoverflow.com/comment/42357195
comment on: http://stackoverflow.com/a/26672555
type: Comment
has text: Tweaking the _values_ I mentioned has nothing to do wether you run Tomcat on Windows or Linux.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41847267
type: AnswerComment
has text: Ya it's what I figured. Just wanted to make sure there wasn't some other faster/less resource intensive wat to move PNG bytes into a Bitmap object.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26617880

http://stackoverflow.com/comment/41705096
type: QuestionComment
comment on: http://stackoverflow.com/q/26538748
score: 0
has text: I have just added the area where I placed it. Is that the correct area. I'm thinking that is where I made my mistake but every article I have seen hasn't been to clear.
type: Comment

http://stackoverflow.com/a/27069845
has comment: http://stackoverflow.com/comment/83039808
has comment: http://stackoverflow.com/comment/57635563
type: Answer
has body: Just set setStackFromEnd=true or setReverseLayout=true so that LLM will layout items from end. The difference between these two is that setStackFromEnd will set the view to show the last element, the layout direction will remain the same. (So, in an left-to-right horizontal Recycler View, the last element will be shown and scrolling to the left will show the earlier elements) Whereas setReverseLayout will change the order of the elements added by the Adapter. The layout will start from the last element, which will be the left-most in an LTR Recycler View and then, scrolling to the right will show the earlier elements. Sample: final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); linearLayoutManager.setReverseLayout(true); _listView.setLayoutManager(linearLayoutManager); See documentation for details.
answers question: http://stackoverflow.com/q/26580723
has comment: http://stackoverflow.com/comment/66247669
downvote count: 25
upvote count: 252
has comment: http://stackoverflow.com/comment/52413624
score: 227
has comment: http://stackoverflow.com/comment/135395533
has comment: http://stackoverflow.com/comment/63408975
has comment: http://stackoverflow.com/comment/48741437
accepted answer of: http://stackoverflow.com/q/26580723
has comment: http://stackoverflow.com/comment/62163408
type: AcceptedAnswer

http://stackoverflow.com/q/26552353
downvote count: 1
type: Question
type: AnsweredQuestion
upvote count: 9
tagged with: java
has body: I lost hours of searching and reading. I didnt really understand how to work with PJSIP. I have some questions about it: Can you explain how actually this library is used when developing for Android? When I build the library do I use only Java code or defintely I'll have to write in C++? My goal is encrypted VOIP Application for Android. Is there a good documentation with description of all methods, fields and constructors? Do you have any references to some tutorials or samples?
answer count: 2
has answer: http://stackoverflow.com/a/31861738
tagged with: voip
possible better answer: http://stackoverflow.com/a/31861738
tagged with: pjsip
has answer: http://stackoverflow.com/a/26564096
tagged with: android
has title: How to use PJSIP on Android?
has comment: http://stackoverflow.com/comment/106838380
favorite count: 0
score: 8
accepted answer: http://stackoverflow.com/a/26564096

http://stackoverflow.com/comment/41703279
type: Comment
comment on: http://stackoverflow.com/q/26538709
type: QuestionComment
score: 0
has text: @TonyEnnis wowwwwwwww nice point

http://stackoverflow.com/comment/41712514
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26539324
type: AnswerComment
has text: @Bohemian: Of course, you have to specify a side-effect free, [*associative*](http://en.wikipedia.org/wiki/Associative_property) function to `reduce` in order to get consistent results with parallel reduction. If you meet the criteria, there is no problem. And to your surprise: *it works* with string concatenation, as concatenation is associative, i.e. `(a+b)+c` has the same result as `a+(b+c)` if `a`, `b` and `c` are all `String`s. This implies that also `a+b+c+d` has the same result as `(a+b)+(c+d)` and therefore `(a+b)` and `(c+d)` can be evaluated concurrently.

http://stackoverflow.com/q/26595224
answer count: 1
has title: CXF - Cannot Add Feature
favorite count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: cxf
tagged with: java
tagged with: eclipse
type: Question
has body: I have been using Apache CXF 2.7.0 for quite a while now, but recently I had to restructure my project in Eclipse. After I did that, for some reason, I cannot add a "WSAddressingFeature" Feature to the endpoint. What am I missing?? endpoint.getFeatures().add(new org.apache.cxf.ws.addressing.WSAddressingFeature()); Eclipse is reporting that: "The method add(Feature) in the type List&lt;Feature&gt; is not applicable for the arguments (WSAddressingFeature)" This is my full implementation: String url = "http://localhost:" + m_Port + "/infoburst/handler"; Object implementor = new HandlerImpl(); org.apache.cxf.jaxws.EndpointImpl endpoint = new org.apache.cxf.jaxws.EndpointImpl(implementor); endpoint.getFeatures().add(new org.apache.cxf.ws.addressing.WSAddressingFeature()); endpoint.publish(url); org.apache.cxf.endpoint.Server server = endpoint.getServer(); org.apache.cxf.jaxws.JaxWsServerFactoryBean serverFB = endpoint.getServerFactory(); If I remove the line of code that adds the feature, the following error occurs: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.cxf.common.util.ReflectionUtil.getDeclaredMethod(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:276) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createOperation(ReflectionServiceFactoryBean.java:1045) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createOperation(JaxWsServiceFactoryBean.java:642) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createInterface(ReflectionServiceFactoryBean.java:990) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:481) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(Reflect…
has answer: http://stackoverflow.com/a/26597364
upvote count: 3

http://stackoverflow.com/q/26583586
favorite count: 0
has body: I wrote the logic for Undo and Redo operations.But,It's not working correctly.When I Open a File Then I click "Rollback",The whole file content was removed and When I replace any Word using Replace MenuItem,Then I Click on Rollback The replace text is not rollback,The Whole Text removed.Please Help Me.Thank you. My Code: public class UndoAndRedoAction extends javax.swing.JFrame { JTextArea text; int i=0; UndoManager undoManager = new UndoManager(); public UndoAndRedoAction() { initComponents(); text = new JTextArea(); rollback.setEnabled(false); redo.setEnabled(false); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tp = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); open = new javax.swing.JMenuItem(); rollback = new javax.swing.JMenuItem(); redo = new javax.swing.JMenuItem(); replace = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); fileMenu.setText("File"); open.setText("Open"); open.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openActionPerformed(evt); } }); fileMenu.add(open); rollback.setText("Rollback"); rollback.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rollbackActionPerformed(evt); } }); fileMenu.add(rollback); redo.setText("Redo"); redo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { redoActionPerformed(evt); } }); fileMenu.add(redo); replace.setText("Replace"); replace.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceActionPerformed(evt); } }); fileMenu.add(replace); jMenuBar1.add(fileMenu); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayou…
has comment: http://stackoverflow.com/comment/41785334
type: AnsweredQuestion
has title: How To Implement Undo and Redo operations using Swing
has comment: http://stackoverflow.com/comment/41786259
downvote count: 0
has answer: http://stackoverflow.com/a/26586013
accepted answer: http://stackoverflow.com/a/26586013
has comment: http://stackoverflow.com/comment/41785726
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41783463
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41783862
tagged with: undo-redo
has comment: http://stackoverflow.com/comment/41783274
linked to: http://stackoverflow.com/q/24433089
has comment: http://stackoverflow.com/comment/41783611
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41900675

http://stackoverflow.com/q/26651192
has comment: http://stackoverflow.com/comment/41906471
has comment: http://stackoverflow.com/comment/41907387
accepted answer: http://stackoverflow.com/a/26652790
tagged with: java
has comment: http://stackoverflow.com/comment/41908053
downvote count: 1
has comment: http://stackoverflow.com/comment/41907255
type: Question
has comment: http://stackoverflow.com/comment/41906332
type: AnsweredQuestion
has title: onActivityResult not respecting the RESULT_OK through IF condition
has answer: http://stackoverflow.com/a/26652937
has comment: http://stackoverflow.com/comment/41907028
answer count: 2
upvote count: 0
has body: I'm getting the FirstConnection class from the MainActivity class thanks to the baseline code: Intent intent = new Intent(MainActivity.this,FirstConnection.class) ; startActivityForResult(intent, REQUEST_CODE_INITILIZATION); Once the activity of the FirstConnection class is finished, I use the following code to come back to the MainActivity class : Intent returnIntent = new Intent(); setResult(RESULT_OK, returnIntent); finish(); Then in the MainActivity class I use this code: public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_INITILIZATION) { if (resultCode == Activity.RESULT_OK) { // &lt;= !! Problem HERE !! // code } if (resultCode == RESULT_CANCELED) { // code } } else super.onActivityResult(requestCode, resultCode, data); } My problem is : when i come back to the MainActivity class with resultCode == RESULT_OK, there is no way, my code doesn't go inside of the IF condition despite this condition is true! I really don't understand, nad I'm sure that resultCode == RESULT_OK because I have checked in DEBUG mode. Is there somobody having the similar issue? Thanks! UPDATE I post the both class content. MainActivity public class MainActivity extends Activity implements NamesAdapterListener{ private int REQUEST_CODE_INITILIZATION = 2 ; private List&lt;TitleList&gt; listExisting ; private SQliteHelper db ; private TextView titleV; private CheckBox checkPartage; private CheckBox checkLocal; private EditText input; private LinearLayout layout; private LayoutInflater mInflater; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // boolean resultInitilization = appInitialization(); // if (resultInitilization == false){ // Intent intent = new Intent(MainActivity.this,FirstConnection.class) ; // startActivityForResult(intent, REQUEST_CODE_INITILIZATION); // } /** * Opening of the database */ db = new SQliteHelper( this ) ; /** * Initialization …
possible better answer: http://stackoverflow.com/a/26652937
has comment: http://stackoverflow.com/comment/41906732
favorite count: 0
has comment: http://stackoverflow.com/comment/41907679
tagged with: android
has answer: http://stackoverflow.com/a/26652790
has comment: http://stackoverflow.com/comment/41906713
score: -1

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26627357
type: Tag

http://stackoverflow.com/a/55007813
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/110545549
downvote count: 1
answers question: http://stackoverflow.com/q/26669732
upvote count: 9
has body: Years later, the simple answer: Right click inside the file and hit "Run"!
has comment: http://stackoverflow.com/comment/96878266

http://stackoverflow.com/comment/41821565
type: Comment
type: QuestionComment
score: 0
has text: No, they aren't. Rules for Beans are stricter than for POJOs.
comment on: http://stackoverflow.com/q/26604337

abstract
tags question: http://stackoverflow.com/q/26530506
tags question: http://stackoverflow.com/q/26568196
type: Tag
tag name: abstract
tags question: http://stackoverflow.com/q/26613946
tags question: http://stackoverflow.com/q/26520436

http://stackoverflow.com/comment/41802337
type: Comment
comment on: http://stackoverflow.com/a/26593634
has text: No symlinks :| I just have this line: INFO: Deploying web application archive /var/lib/tomcat7/webapps/my-webapp.war and then it is just starting twice. Maybe it is not related to tomcat, but it is hardly to imagine why it is happening.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41856173
has text: He wants the output as 2 as there are only 2 Digits which are in common for both the array
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26622294
score: 0

http://stackoverflow.com/comment/41808627
score: 0
type: AnswerComment
has text: Updated my answer, try adding the namespace to your root element
type: Comment
comment on: http://stackoverflow.com/a/26596747

http://stackoverflow.com/q/26569240
accepted answer: http://stackoverflow.com/a/26725309
favorite count: 0
upvote count: 1
tagged with: maven
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26557828
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26725309
type: Question
has body: I'm trying to reconcile these two sets of directions in order to create a 2 module Google App Engine project: 1] Directions for generating a Google App Engine directory structure with Maven (https://cloud.google.com/appengine/docs/java/tools/maven#creating_app_engine_applications_or_backend_apis_using_the_archetypes) 2] Google App Engine modules configuration (https://cloud.google.com/appengine/docs/java/modules/#Java_Configuration) A simple issue is where to put a module's appengine-web.xml? Document 1 says to run this: mvn archetype:generate -Dappengine-version=1.9.14 -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes:appengine-skeleton-archetype And the result is a structure like this: Notice the location of the appengine-web.xml for what is presumably the default module: /myapp/src/main/webapp/WEB-INF/appengine-web.xml Now if I want to turn this Maven-generated 1-module structure into a 2-module structure, Document 2 says I will need a directory structure like this: So it looks like the default module's appengine-web.xml file needs to be moved to: /myapp/module1/WEB-INF/appengine-web.xml Am I correctly interpreting the directions for Document 2?
answer count: 1
downvote count: 0
has title: How morph Maven-generated GAE skeleton into a 2-module application?
linked to: http://stackoverflow.com/q/26664888
tagged with: google-app-engine

http://stackoverflow.com/a/26626494
upvote count: 1
has body: Take a look at TimeZone.getOffset(long time) The method returns the time difference between UTC and your target timezone. So you can do something like this: public static long getUTCToMillis(String time) { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault()); TimeZone timezone = TimeZone.getTimeZone("CET"); try { Date date = sdf.parse(time); long offSet = timezone.getOffset(date.getTime()); cal.setTime(date); cal.add(Calendar.MILLISECOND, offset); return cal.getTimeInMillis(); } catch (ParseException e) { e.printStackTrace(); } return -1; } As a side note, I suggest you store time values in UTC regardless of where your user is. For example, if your application is used in two different time zones simultaneously, the server should store the same value. Time conversion will and should be done locally on user's device based on the time zone he/she is in.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26625856
type: Answer
accepted answer of: http://stackoverflow.com/q/26625856
score: 1

http://stackoverflow.com/comment/41768995
type: Comment
score: 0
has text: Ah thats a good point I'll look into it thank you.
type: QuestionComment
comment on: http://stackoverflow.com/q/26575667

http://stackoverflow.com/q/26578736
has comment: http://stackoverflow.com/comment/41775098
tagged with: iteration
type: UnansweredQuestion
has title: Something stopping method resizing being called
has comment: http://stackoverflow.com/comment/41775078
has comment: http://stackoverflow.com/comment/41774913
has body: This code runs through and "resizes" (meaning transfers elements into bigger array) the array when I have j=0 or j=1 but it matches elements of the array against themselves therefore doesnt work properly It only fills the array once and doesn't call the reSize method when j=i+1 and when i!=j, can anyone shed some light because I know it's something simple....its driving me mad. private static String[] subStrings(String[] tokens) { String[] matches; matches = new String[40]; //creates a new array of matches for (int i = 0; i &lt;=tokens.length; i++){ for (int j=i+1; j &lt;tokens.length ; j++){ if(Text.match(tokens[i],tokens[j])&amp;&amp;i!=j){ if(matches[matches.length-1]!=null){ matches = reSize(matches, 10); } matches[i]=(tokens[i]+" | "+tokens[j]); System.out.println(matches[i]); } } } return matches; //default return for compilation purposes } public static String[] reSize(String[] matches, int s){ if(s&lt;0){ return null; } String BiggerMatches[] = new String[matches.length + s]; for(int i=0; i&lt; matches.length; i++){ BiggerMatches[i]=matches[i]; } matches=BiggerMatches; return matches; }
has comment: http://stackoverflow.com/comment/41775012
answer count: 0
has comment: http://stackoverflow.com/comment/41774981
type: Question
tagged with: indexing
tagged with: java
has comment: http://stackoverflow.com/comment/41774766
tagged with: sorting
score: 0
has comment: http://stackoverflow.com/comment/41774937
tagged with: arrays

http://stackoverflow.com/comment/41824975
type: QuestionComment
has text: Finally I got the answer. The issue come from layout of the activity. I forget to delete scrollView on top of fragment container
type: Comment
comment on: http://stackoverflow.com/q/26533485
score: 0

http://stackoverflow.com/comment/41673933
type: Comment
has text: Thanks! if I knew about regex earlier, my life would have been much easier. I used to convert characters to their ASCII values and comparing.
comment on: http://stackoverflow.com/a/26522664
type: AnswerComment
score: 0

http://stackoverflow.com/q/26594647
type: Question
answer count: 2
tagged with: jtree
has answer: http://stackoverflow.com/a/26595179
downvote count: 0
has answer: http://stackoverflow.com/a/26595176
favorite count: 0
has body: I know that JTree's model can be set using this form in the properties section: It takes the text in the left area and based on indentation, it creates the nodes. My question is: If I have an indented text like the one in the left (say, in a file) and I want to pass it as an argument to the model from the code, how can I do it? I guess I could parse it manually, but I see that it can do it from the graphical form so there has to be a method already implemented that I can call, right?
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/41807535
linked to: http://stackoverflow.com/q/21735468
has comment: http://stackoverflow.com/comment/41806957
has title: How can I set a JTree model using an indentation-based text?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41807394

http://stackoverflow.com/comment/41717272
has text: It's not my area but this is taken from another answer (http://stackoverflow.com/questions/18428417/store-arabic-text-in-mysql-database-using-php): $BD->query("SET NAMES 'utf8'"); $BD->query("SET CHARACTER SET utf8");
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26547083
score: 1

http://stackoverflow.com/a/26579976
type: Answer
has comment: http://stackoverflow.com/comment/41777795
has body: Generic type variables, like any other variables, have scope. Their scope is the body of the class they are declared in. Within that class, the name they were defined with always refers to the generic type. If you have another type of the same name declared elsewhere, you'll need to use its fully qualified name. class Generic&lt;Integer&gt; { Integer ourTypeVariable; java.lang.Integer realInteger; } Don't code like this, especially for common type names (everything in the JDK basically).
accepted answer of: http://stackoverflow.com/q/26579954
has comment: http://stackoverflow.com/comment/41777848
score: 4
answers question: http://stackoverflow.com/q/26579954
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41777150

http://stackoverflow.com/a/26657694
has body: You want: callTime = time; Not time = callTime; in your constructor. You have them flipped around.
answers question: http://stackoverflow.com/q/26657634
has comment: http://stackoverflow.com/comment/41922616
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26657634
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41922594

http://stackoverflow.com/comment/41866527
has text: Yes, this error occur when I start the server after placing my *.war in the folder. My JBOSS version is 5
comment on: http://stackoverflow.com/q/26628656
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41756097
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26568411
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).

http://stackoverflow.com/comment/41677980
type: QuestionComment
has text: Probably there is still a non-daemon thread running. Try to list all right after printing "Done": http://stackoverflow.com/questions/1323408/get-a-list-of-all-threads-currently-running-in-java
score: 0
comment on: http://stackoverflow.com/q/26525162
type: Comment

http://stackoverflow.com/a/26638371
answers question: http://stackoverflow.com/q/26638092
type: Answer
has body: Your hentAntall method should be like this: public int hentAntall() throws Exception { File file = new File("Hvorfor.txt"); Scanner readfile = new Scanner(file); while (readfile.hasNextLine()) { String word = readfile.next(); if (word.contains(sokeord)) { antall++; System.out.println("Antallet av:" + sokeord + "er " + antall); } else { System.out .println("Error no such search word in the given text: "); } } readfile.close(); return antall; } Don't forget to close the Scanner resource to avoid leaks.
score: 0

http://stackoverflow.com/comment/41697900
score: 0
type: QuestionComment
type: Comment
has text: where i can get it from ? i even could create a class
comment on: http://stackoverflow.com/q/26535927

http://stackoverflow.com/comment/41948379
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26619349
has text: Here is an example of what I talk about: http://pastebin.com/LDLyMikx there is exactly one instance of ByteBufferFactory. There could be different impl. based on the system configuration but effectively there would be a single impl... unless there is a different type gets to be desirialized. Pay attention that the enum is actually not publicly visible, so there is no other way to get a different instance.

http://stackoverflow.com/comment/41663363
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26516527
has text: the method 'getReportList()' return null, then getReportList().add(..) will trigger the null pointer exception
type: Comment

http://stackoverflow.com/q/26669841
tagged with: spring
has body: I'm trying to do a nested join on a self referencing entity, please bear with me, it will make sense :) Thing.java class Thing { Integer something; Person owner; } Person.java class Person { String name; Person parent; } Note: A Person with parent=null means that they are a parent, and cannot have a parent. It's an alien world! :P Query: Root&lt;Thing&gt; root = query.from(Thing.class); Join&lt;Thing, Person&gt; ownerJoin = root.join(Thing_.owner); Join&lt;Person, Person&gt; parentJoin = ownerJoin.join(Person_.parent); Path&lt;String&gt; ownerNameField = ownerJoin.get(Person_.name); Path&lt;String&gt; parentNameField = parentJoin.get(Person_.name); return cb.or(cb.equal(ownerNameField, "John"), cb.equal(parentNameField, "John")); So basically, I'm trying to find "Things" that either belong to me, or that I'm the parent of the Person who owns that "Thing". The SQL statement I'm trying to generate is supposed to look something like this: SELECT * FROM Thing t WHERE t.something = 1 AND (t.owner.name = "John" OR t.owner.parent.name = "John") Now the problem is that with this criteria it's only giving me the results of t.owner.parent.name = "John"
answer count: 0
tagged with: java
tagged with: spring-data
tagged with: criteria-api
type: Question
has title: Java Criteria API join self referencing entity
tagged with: criteria
score: 0
has comment: http://stackoverflow.com/comment/41940441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41972245
has comment: http://stackoverflow.com/comment/41979492

http://stackoverflow.com/q/26594717
has comment: http://stackoverflow.com/comment/41804651
possible better answer: http://stackoverflow.com/a/26601942
has title: How to read specifications from a REST Web Service
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/41805127
has answer: http://stackoverflow.com/a/26595805
downvote count: 1
accepted answer: http://stackoverflow.com/a/26595805
type: Question
has answer: http://stackoverflow.com/a/26601942
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I need to create a project with consist to read specifications(a contract, document, info) of a rest web service, what are their methods, return types, param methods and etc... but i see that not all services that implement a specification like WSDL SOAP. How to do that?
answer count: 2
tagged with: wsdl
favorite count: 0
tagged with: rest

http://stackoverflow.com/q/26571054
has title: Session timeout issue in java MVC(Struts,Spring) web application
tagged with: spring
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41784979
type: Question
has answer: http://stackoverflow.com/a/26571284
tagged with: session
tagged with: jboss
tagged with: struts2
answer count: 1
type: UnansweredQuestion
has body: We have been facing a session timeout issue for our java MVC(struts and spring) web application.below is the issue description. Issue Description : The ssesion expires soon after login . approximately the session expire in 10-30 mins after login. below are the different levels we set idle timeout. SSO Idle Timeout: min idle timeout - 1hr , max idle timeout - 8hrs Idle timeout in application code(in web.xml) - 2hrs Idle timeout in JBoss application server(in jboss-web.xml) : default idle timeout - 30mins Some extra details : After login successful, the application opens in a new window. so as the SSO default idle timeout is 1hr ,the idle timeout in application's web.xml is 2hr, and the JBoss application server's default idle timeout is 30mins, why the session expires in 10-30mins after login ? please help us...

http://stackoverflow.com/a/26625962
has body: In all probability, it builds a map. The keys are strings, the values are lists of SubscriptionBeans. After it builds that map, it returns it. But of course, the way to know that is to read the method's documentation.
has comment: http://stackoverflow.com/comment/41897570
accepted answer of: http://stackoverflow.com/q/26625807
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26625807
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26673282
downvote count: 0
type: Answer
upvote count: 1
has body: You've currently declared questionid as a local variable in the onCreate method. That variable only exists for the duration of that method call. You want an instance variable - i.e. something which is part of the state of the object, and which is available within all methods. public class Example { private ArrayList&lt;String&gt; questionid; @Override protected void onCreate(Bundle savedInstanceState) { questionid = new ArrayList&lt;String&gt;(); questionid.add("1"); ... } private void newQuestion() { String firstQuestion = questionid.get(0); ... } }
score: 1
accepted answer of: http://stackoverflow.com/q/26646628
answers question: http://stackoverflow.com/q/26646628
type: AcceptedAnswer

http://stackoverflow.com/a/26662439
has comment: http://stackoverflow.com/comment/41927090
has comment: http://stackoverflow.com/comment/41926817
type: Answer
has comment: http://stackoverflow.com/comment/41927175
upvote count: 6
has comment: http://stackoverflow.com/comment/41927074
score: 6
has body: Your current approach is effectively treating the three values as a 24-bit number - effectively 0x313239. It sounds like you should be converting it into a string, then parsing that: String text = new String(b_array, StandardCharsets.US_ASCII); // "129" int value = Integer.parseInt(text);
has comment: http://stackoverflow.com/comment/41927443
has comment: http://stackoverflow.com/comment/41927746
has comment: http://stackoverflow.com/comment/41926876
accepted answer of: http://stackoverflow.com/q/26662401
has comment: http://stackoverflow.com/comment/41927789
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41927058
answers question: http://stackoverflow.com/q/26662401

http://stackoverflow.com/comment/41781189
has text: @Eran so how can i modify it so that if i inserted one digit it declare it as the second to the last?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26582223
type: Comment

http://stackoverflow.com/comment/41849330
score: 0
has text: Thank you for the update, but, unfortunately, everything is still the same. I aslo tried another xml, I tried using BufferedReader, I tried passing directly a link to doc.parse("SomeLink"). Still the same result
comment on: http://stackoverflow.com/a/26618471
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41773954
has text: I'm not sure that your posted code and text is adequate to allow us to understand your problem enough to answer it. If you don't get a decent answer soon, consider creating and posting a [Minimal, Complete, and Verifiable Example Program](http://stackoverflow.com/help/mcve).
type: QuestionComment
comment on: http://stackoverflow.com/q/26578325
score: 0
type: Comment

http://stackoverflow.com/a/26544258
answers question: http://stackoverflow.com/q/26543703
has comment: http://stackoverflow.com/comment/41715184
type: Answer
has comment: http://stackoverflow.com/comment/41713111
has body: Tomcat is a servlet container only. It's not a full Java EE enterprise stack, nor does it contain a CDI container. Apache TomEE, on the other hand, is Tomcat with EE capabilities. Bauke Scholtz, the infamous BalusC, wrote an excellent blog on installing CDI on Tomcat. This might help you. Otherwise, an alternative approach will be to install Apache TomEE and run your application from there. After all, it's still Tomcat anyway.
has comment: http://stackoverflow.com/comment/41712285
accepted answer of: http://stackoverflow.com/q/26543703
upvote count: 5
has comment: http://stackoverflow.com/comment/41713533
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41787005
type: Comment
has text: pair class is part or `javafx`. Can we use in SE?
comment on: http://stackoverflow.com/a/26585776
type: AnswerComment
score: 0

http://stackoverflow.com/q/26618796
has body: How can I encode RSA public key in C# so that I can use is later in a Java application ()? Please, note that I need to do it on the .NET side. I'm trying to use BouncyCastle API to achieve this, but I cannot find a single piece of documentation that would describe such functionality.
tagged with: rsa
has comment: http://stackoverflow.com/comment/41862758
tagged with: public-key-encryption
downvote count: 0
answer count: 1
favorite count: 0
has title: Export an RSA Public Key from C# for Java's X509EncodedKeySpec
linked to: http://stackoverflow.com/q/10368111
accepted answer: http://stackoverflow.com/a/26629440
linked to: http://stackoverflow.com/q/11743160
has comment: http://stackoverflow.com/comment/41852280
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41866642
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26629440
upvote count: 1
type: Question
tagged with: c#

http://stackoverflow.com/a/26632764
has comment: http://stackoverflow.com/comment/41875785
type: Answer
answers question: http://stackoverflow.com/q/26632529
has body: You cannot reference the servlet context in your XML like this because its lifecycle is controlled by the servlet container. The solution is to have com.abc.ProductController implement ServletContextAware and then Spring will set it for you.
score: 0

http://stackoverflow.com/a/26643270
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26638786
downvote count: 0
type: Answer
has body: Dealing with "exactness" in computational geometry is an issue that comes up more often than you might think. Other than fixed point arithmetic (which has already been suggested), another approach is to use adaptive precision arithmetic -- evaluating operations in better than double precision, but only when necessary to preserve correctness. Implementing adaptive precision operations is very much a non-trivial task, but there are a few libraries that are available, i.e. Shewchuck's robust predicates and/or the MPFR library that is used by the CGAL geometry library. Robustly detecting the intersection between two lines could be done via a few calls to Shewchuk's orientation routine.

http://stackoverflow.com/comment/41698282
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26535679
has text: @ajb If that's true, then I managed to teach OP three new things with four words :)

http://stackoverflow.com/q/26615540
answer count: 1
downvote count: 0
has body: I am unable to deserialize a list that is directory a child of the root element, I have tried various kinds of things. My code: private static class Cards { @JacksonXmlElementWrapper(localName = "Cards") private List cards; public List getCards() { return new ArrayList<>(cards); } } private static class Card { @JsonProperty("Name") private String name; @JsonProperty("Image") private String image; @JsonProperty("CardType") private String cardType; private final Map<String, Integer> resources = new HashMap<>(); private boolean duplicateResources = false; private final List<String> duplicateResourceNames = new ArrayList<>(); @JsonAnySetter private void addResource(final String name, final Object value) { if (resources.containsKey(name)) { duplicateResources = true; duplicateResourceNames.add(name); } resources.put(name, Integer.parseInt(value.toString())); } public String getName() { return name; } public String getImage() { return image; } public String getCardType() { return cardType; } @JsonAnyGetter public Map<String, Integer> getResources() { if (duplicateResources) { throw new UncheckedCardLoadingException("Resources " + duplicateResourceNames + " have duplicate entries"); } return new HashMap<>(resources); } } And: ObjectMapper xmlMapper = new XmlMapper(); Cards cards = xmlMapper.readValue(path.toFile(), Cards.class); When trying to deserialize the following XML: test test It gives as error: com.cardshifter.core.cardloader.CardLoadingException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Card" (class com.cardshifter.core.cardloader.XmlCardLoader$Cards), not marked as ignorable (one known property: "Cards"]) at [Source: C:\Users\Frank\Dropbox\NetbeansProjects\Cardshifter\cardshifter-core\target\test-classes\com\cardshifter\core\cardloader\single-card.xml; line: 3, column: 9] (through reference chain: com.cardshifter.core.cardloader.Cards["Card"])
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/26616032
has title: Unable to deserialize list directly inside rootelement using Jackson XML
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 5
tagged with: jackson
score: 5
accepted answer: http://stackoverflow.com/a/26616032

http://stackoverflow.com/comment/41865988
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26628232
has text: i am not intiallizing outGoingMsg but at the end putting null to outGoingMsg ,,,and its working fine for the first time...

http://stackoverflow.com/comment/41913325
score: 0
type: AnswerComment
has text: Yeah, that does look like a nice answer. :)
type: Comment
comment on: http://stackoverflow.com/a/26652131

http://stackoverflow.com/comment/41798685
has text: @Iggy No, it still is an issue. The problem I think is around the 'GL11.glEnable(GL11.GL_BLEND);' line. When I remove that, the quads display normally, but then the text is just really, REALLY small and I can't increase it.
score: 0
comment on: http://stackoverflow.com/q/26553916
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41727474
comment on: http://stackoverflow.com/q/26552616
score: 0
type: Comment
type: QuestionComment
has text: I am reading the amount of integers in the file. Since each integer is 4 bytes. z.length() is 16. (4 Ints in file * 4 bytes per int) So 16 / 4(bytes) = 4

http://stackoverflow.com/comment/41843352
type: AnswerComment
has text: It's a program to play craps so if the rollDice is 7 or 11 it prints win and if it is 3,2 or 12 it prints lose.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26615863

http://stackoverflow.com/q/26557828
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: The Google App Engine documentation for modules (https://cloud.google.com/appengine/docs/java/modules/#Java_Configuration) describes a few .xml files. Is there a way to generate all of these files with Maven? Some of the files seem like they have to be manually created, particularly appengine-application.xml and application.xml. Is that true or can I use Maven somehow?
has title: Can appengine-application.xml be generated?
accepted answer: http://stackoverflow.com/a/26560317
answer count: 1
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/26560317
tagged with: maven

http://stackoverflow.com/a/26628957
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26628789
answers question: http://stackoverflow.com/q/26628789
has comment: http://stackoverflow.com/comment/41881191
has body: Locks are owned by threads. If your thread already owns a lock, Java assumes that you don't need to acquire it a second time and just continues. You'll get a deadlock if you start a second thread in method1() while holding the lock and the second thread executes the method method2(). If you prefer code, then synchronized works like this: Lock lock = Integer.class.getLock(); boolean acquired = false; try { if(lock.owner != Thread.currentThread()) { lock.acquire(); acquired = true; } ...code inside of synchronized block... } finally { if(acquired) lock.release(); } Here is code to demonstrate the deadlock. Just set runInThread to true: package com.test; public class DeadLock { private void method1() { synchronized (Integer.class) { boolean runInThread = false; if( runInThread ) { Thread t = new Thread() { @Override public void run() { method2(); } }; t.start(); try { t.join(); // this never returns } catch( InterruptedException e ) { e.printStackTrace(); } } else { method2(); } } } private void method2() { System.out.println("trying to lock"); synchronized (Integer.class) { System.out.println("hi there"); } } public static void main(String[] args) { new DeadLock().method1(); } }
has comment: http://stackoverflow.com/comment/41866872
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41866643

http://stackoverflow.com/q/26648107
tagged with: java-8
has title: Refactoring if-else if chain in Java 8 style
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41901453
upvote count: 1
has comment: http://stackoverflow.com/comment/41901067
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41901910
has answer: http://stackoverflow.com/a/26648308
score: 0
has comment: http://stackoverflow.com/comment/41900895
has comment: http://stackoverflow.com/comment/41901069
has answer: http://stackoverflow.com/a/26648349
has answer: http://stackoverflow.com/a/26648446
favorite count: 0
has answer: http://stackoverflow.com/a/26648369
has body: I have a method with the following if-else-if chain: if(downstreamActual.getNumber() &lt;= downstreamRecommended.getNumber()){ downstreamActual.setInvalid(); showErrorWindow(); throw new NumberFormatException(); }else if(upstreamActual.getNumber() &lt;= upstreamRecommended.getNumber()){ upstreamActual.setInvalid(); showErrorWindow(); throw new NumberFormatException(); }else if(biUpstreamActual.getNumber() &lt;= biUpstreamRecommended.getNumber()){ biUpstreamActual.setInvalid(); showErrorWindow(); throw new NumberFormatException(); }else if(biDownstreamActual.getNumber() &lt;= biDownstreamRecommended.getNumber()){ biDownstreamActual.setInvalid(); showErrorWindow(); throw new NumberFormatException(); } Every step we do the same work (call the same method for first object that uses in boolean expression, call showErrorWindow() and throw an Exception) What are some good techniques especially using Java 8 to make this code more manageable?
accepted answer: http://stackoverflow.com/a/26648308
possible better answer: http://stackoverflow.com/a/26648349
has comment: http://stackoverflow.com/comment/41900898

substring
tags question: http://stackoverflow.com/q/26650138
type: Tag
tags question: http://stackoverflow.com/q/26627978
tags question: http://stackoverflow.com/q/26666827
tags question: http://stackoverflow.com/q/26668900
tags question: http://stackoverflow.com/q/26666359
tags question: http://stackoverflow.com/q/26571737
tag name: substring
tags question: http://stackoverflow.com/q/26648773

http://stackoverflow.com/comment/41816559
score: 0
type: Comment
has text: possible duplicate of [jTextField accept only alphabet and white space](http://stackoverflow.com/questions/14058505/jtextfield-accept-only-alphabet-and-white-space)
type: QuestionComment
comment on: http://stackoverflow.com/q/26601271

http://stackoverflow.com/a/26548361
accepted answer of: http://stackoverflow.com/q/26548059
downvote count: 1
answers question: http://stackoverflow.com/q/26548059
has body: Instead of props.put("mail.transport.protocol", "smtps"); Transport transport = session.getTransport("smtps"); Use props.put("mail.transport.protocol", "smtp"); Transport transport =session.getTransport("smtp"); Use smtp, not smtps I used JDK 8, Netbeans 8, JavaMail 1.5.2 and this example works fine: public static void main(String[] args) { Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("username@gmail.com","password"); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("frommail@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("tomail@gmail.com")); message.setSubject("Testing Subject"); message.setText("Test Mail"); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } } If you are not able connect with port 465, try port 587
has comment: http://stackoverflow.com/comment/41721360
has comment: http://stackoverflow.com/comment/46622785
type: Answer
has comment: http://stackoverflow.com/comment/89420552
has comment: http://stackoverflow.com/comment/41720525
has comment: http://stackoverflow.com/comment/41720194
has comment: http://stackoverflow.com/comment/41720968
has comment: http://stackoverflow.com/comment/41720806
has comment: http://stackoverflow.com/comment/41721704
type: AcceptedAnswer
upvote count: 23
score: 22

http://stackoverflow.com/a/26611739
type: Answer
has comment: http://stackoverflow.com/comment/41836437
has body: Is this a bidirectional relation between Cross and Nod? If so, you don't have to annotate both sides of the relation in this way. It is possible that this is confusing hibernate. Here is an example of it working. I think this should do it @Entity @Table(name = "nod") public class Nod extends Equipement { protected Cross cross; @OneToOne(cascade = CascadeType.ALL, optional = true, fetch = FetchType.EAGER) @JoinTable(name = "assoc_nod_cross", joinColumns = @JoinColumn(name = "nod_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "cross_id", referencedColumnName = "id")) public Cross getCross() { return cross; } ... } @Entity @Table(name = "cross") public class Cross extends Equipement { protected Nod nod; @OneToOne(mappedBy = "cross") public Nod getNod() { return nod; } ... }
score: 0
has comment: http://stackoverflow.com/comment/41860661
has comment: http://stackoverflow.com/comment/41844952
has comment: http://stackoverflow.com/comment/41836225
has comment: http://stackoverflow.com/comment/41847040
answers question: http://stackoverflow.com/q/26611181
has comment: http://stackoverflow.com/comment/41836689

http://stackoverflow.com/comment/41890917
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26642077
has text: Its open source. The issue is that to use the gradle wrapper requires a project to include a binary gradle-wrapper.jar. This is not allowed in Apache; only source is allowed.

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/26617694
tags question: http://stackoverflow.com/q/26528554
tags question: http://stackoverflow.com/q/26596285
tags question: http://stackoverflow.com/q/26528765
tag name: android-actionbar
tags question: http://stackoverflow.com/q/26604997
tags question: http://stackoverflow.com/q/26579225

http://stackoverflow.com/a/26659345
has body: You're missing the dependency. Not sure how you're handling dependencies, but just add the JAR in IVY or whatever you use. You must be using something to add Spring 3.2. Maven Central: link IVY Example: &lt;dependency org="org.springframework" name="spring-aop" rev="3.2.11.RELEASE" /&gt; Maven has other dependency information available. If this is a web app, make sure the JAR is in APPNAME/WEB-INF/lib.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26540782

http://stackoverflow.com/comment/41688043
comment on: http://stackoverflow.com/q/26530745
has text: Say your classes ("current location") are located under /Desktop as well the same relative path would appliable since the absolute paths start to differ from Desktop and above only.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26573910
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/41765650
score: 0
has answer: http://stackoverflow.com/a/26574106
tagged with: java
has comment: http://stackoverflow.com/comment/41765781
has comment: http://stackoverflow.com/comment/41765745
tagged with: jersey-2.0
type: UnansweredQuestion
has title: Error:param @param is always null
has comment: http://stackoverflow.com/comment/41765690
has comment: http://stackoverflow.com/comment/41765711
has body: I have a problem with Jersey and Grizzly. The problem could be very basic but I am struggling to solve it. The idea is that I am creating an exercise application that needs to store books. Everything seems to be alright but it does not work as expected. Here is the source code: @Path("/books") public class BooksResource { private BookDao bookDao= new BookDao(); @GET @Produces(MediaType.APPLICATION_JSON) public Collection&lt;Book&gt; getBooks() { return (bookDao.getBooks()); } @Path("/{id}") @GET @Produces(MediaType.APPLICATION_JSON) public Book getBook(@PathParam("id")String id) { Book book = bookDao.getBook(id); return (book); } As can be observed, the path /books is working perfectly but the problem is that id is always null and it shouldn't be. Does anyone know where the problem comes from?
has comment: http://stackoverflow.com/comment/41765589

http://stackoverflow.com/comment/41835718
comment on: http://stackoverflow.com/a/26611875
type: AnswerComment
score: 0
type: Comment
has text: As in JDBC API and Driver manager are two different components of JDBC

http://stackoverflow.com/comment/107909848
type: Comment
has text: Hello from the posterity. Shouldn't it be keyFlags & KeyFlags.ENCRYPT_COMMS == 0 instead of > 0? Thanks.
comment on: http://stackoverflow.com/a/26556232
score: 1
type: AnswerComment

http://stackoverflow.com/q/26515458
has body: Say I have some vectors: v1, v2, v3 Say I also have a vector that holds these vList = {v1, v2, v3} If I synchronized (vList), does this mean that v1, v2, and v3 are also locked or does it just lock vList?
upvote count: 1
type: Question
tagged with: vector
has answer: http://stackoverflow.com/a/26515697
tagged with: synchronized
has title: Does synchronized (vector<vector>) lock all of the Vectors or just the one storing them?
possible better answer: http://stackoverflow.com/a/26515493
answer count: 3
has answer: http://stackoverflow.com/a/26515673
has answer: http://stackoverflow.com/a/26515493
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26515697
has comment: http://stackoverflow.com/comment/41660777
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/26621938
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41854396
downvote count: 0
has comment: http://stackoverflow.com/comment/41854382
type: Answer
has body: Operand1 and Operand2 are String(s). You need to parse them before you can perform arithmetic. Something like, double answer; System.out.println(Operator); switch (Operator) { case "+": answer = Double.valueOf(Operand1) + Double.valueOf(Operand2); break; case "-": answer = Double.valueOf(Operand1) - Double.valueOf(Operand2); break; case "*": answer = Double.valueOf(Operand1) * Double.valueOf(Operand2); break; case "/": answer = Double.valueOf(Operand1) / Double.valueOf(Operand2); break; } Finally, by convention, Java variables should start with a lower case letter; operand1, operand2 and operator.
upvote count: 3
has comment: http://stackoverflow.com/comment/41854524
has comment: http://stackoverflow.com/comment/41854457
score: 3
accepted answer of: http://stackoverflow.com/q/26621905
answers question: http://stackoverflow.com/q/26621905

http://stackoverflow.com/comment/41885978
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26638834
has text: filter mapping? loginFilter /* and servlet mapping LoginServlet /LoginServlet/* ?

http://stackoverflow.com/a/27348476
has comment: http://stackoverflow.com/comment/43168519
has body: According to RebelLabs 2014 java tools and technologies report, Hibernate was having a 67.5% market share, meaning that all other providers combined share less than 1/3 of the whole market. The 2014 Data Access frameworks market share is: Hibernate : 67.5% Plain JDBC : 22% JDBC Template : 19.5% EclipseLink : 13% MyBatis : 6.5% JOOQ : 1.5% Other : 7% In a 2016 survey, the following results have been obtained: Hibernate : 72% EclipseLink : 13% OpenJPA : 2%
answers question: http://stackoverflow.com/q/26672322
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26672322
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/43167756
type: Answer

http://stackoverflow.com/comment/41714140
type: QuestionComment
comment on: http://stackoverflow.com/q/26545439
has text: You should modify your service implementation, so you can deal with the params sended by the query,
score: 0
type: Comment

http://stackoverflow.com/comment/41889521
type: Comment
comment on: http://stackoverflow.com/a/26641162
has text: @user2336315 This remark is not sufficient to make the code to work. See my answer
type: AnswerComment
score: 0

http://stackoverflow.com/q/26518729
tagged with: java
has body: I am parsing the Json and display on list view using gson library. When I insert my input stream I am getting null values. Can you please tell where I am wrong I will give you steps I downloaded 2.3 Gson library. Then I make getter and setter ------------------ package com.firstgroup.webservice; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import com.firstgroup.dto.Holder; import com.firstgroup.webservicecallback.WebserviceCallBack; import com.google.gson.Gson; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; public class RequestTask extends AsyncTask&lt;String, String, String&gt;{ private WebserviceCallBack callBack; private ProgressDialog progressDialog; @Override protected void onPreExecute() { // TODO Auto-generated method stub progressDialog= new ProgressDialog((Context) callBack); super.onPreExecute(); progressDialog.setTitle("Please Wait..."); progressDialog.setMessage("Webservice Call..."); progressDialog.setCancelable(true); progressDialog.show(); } @Override protected String doInBackground(String... uri) { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; String responseString = null; try { response = httpclient.execute(new HttpGet(uri[0])); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK){ // I am getting correct result here ... Reader reader = new InputStreamReader(response.getEntity().getContent()); Gson gson = new Gson(); Holder response1 = gson.fromJson(reader, Holder.class); ByteArrayOutputStream out = new ByteArrayOutputStream(); response.getEntity().writ…
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26519151
accepted answer: http://stackoverflow.com/a/26519151
tagged with: android
has title: Why does Gson library show null value when debugging?
linked to: http://stackoverflow.com/q/26519556
type: Question
type: AnsweredQuestion
tagged with: android-layout

http://stackoverflow.com/comment/41666163
has text: Oh sorry. I didn't see the sample you posted in the meanwhile. I would suggest you add 30 mn to hour if millisSinceHour is less than 30 * 60000
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26517822

http://stackoverflow.com/comment/41706106
comment on: http://stackoverflow.com/a/26540608
score: 0
type: Comment
has text: @arshajii That would come down semantics and the purpose of the design, not saying it's a bad idea, just saying...
type: AnswerComment

http://stackoverflow.com/comment/41848232
comment on: http://stackoverflow.com/q/26618582
has text: But why you want to fill the data in the order class or creating new book objects in the order class?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41970955
score: 0
type: AnswerComment
type: Comment
has text: I am looking for a way to answer this question in code. Is checking the height of the trees sufficient for determining whether it could be the result of a Weighted Quick Union? Also, how could this be done programmatically?
comment on: http://stackoverflow.com/a/26666559

http://stackoverflow.com/a/26709979
has body: You could either use a background image (containing the blank boxes) or you'd have to use a GGrid and place each character in a distinct cell. Using JS, it should be easy to extract the n-th character of the string in the n-th column.
upvote count: 1
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26672189

http://stackoverflow.com/q/26646400
has comment: http://stackoverflow.com/comment/41898148
possible better answer: http://stackoverflow.com/a/26646502
answer count: 3
has comment: http://stackoverflow.com/comment/41898110
tagged with: parsing
has answer: http://stackoverflow.com/a/26646559
has comment: http://stackoverflow.com/comment/41901272
upvote count: 2
has comment: http://stackoverflow.com/comment/41898153
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26646585
has comment: http://stackoverflow.com/comment/41898120
accepted answer: http://stackoverflow.com/a/26646559
has title: how to separate integer numbers from a string?
has comment: http://stackoverflow.com/comment/41898241
type: Question
has comment: http://stackoverflow.com/comment/41898157
has answer: http://stackoverflow.com/a/26646502
has comment: http://stackoverflow.com/comment/41898082
downvote count: 0
favorite count: 0
has body: I have a string String exp = "7 to 10"; now I am keeping a condition that if (exp.contains("to")) { // here I want to fetch the integers 7 and 10 } How to separate 7 and 10 from the string 7 to 10 (parsed as Integer). By using a delimiter I can obviously do it but I want to know how to do it this way?

http://stackoverflow.com/q/26659966
has comment: http://stackoverflow.com/comment/41922853
has comment: http://stackoverflow.com/comment/41922908
has comment: http://stackoverflow.com/comment/41922292
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41922295
has comment: http://stackoverflow.com/comment/41922110
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26660665
favorite count: 0
has title: Changing A Decimal to a whole number (NOT Rounding Off)
linked to: http://stackoverflow.com/q/9898512
has comment: http://stackoverflow.com/comment/41922144
has answer: http://stackoverflow.com/a/26660665
has comment: http://stackoverflow.com/comment/41922155
type: AnsweredQuestion
has body: So I am making an application that can solve problems with Empirical Formulae and I need some code that would do something like: If numbers are 2.5, 1, 3 it should change them to 2.5*2 = 5, 1*2 = 2, 3*2 = 6 so that the number with the decimal is converted to a whole number and the other numbers are adjusted appropriately. I thought of this logic: for(n = 1; (Math.round(simplestRat[0]) * n) != (int)SimplestRat[0]; n++) to increment a counter that would multiply an integer to do what I want it to but I am skeptical about this code even at this phase and do not think it will work. It would be a lot of help if someone could suggest a code for this or improve upon this code or even give me a link to another post for this problem as I was unable to find anything regarding this type of problem. Any help is appreciated. Thanks

http://stackoverflow.com/a/26750122
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26564383
answers question: http://stackoverflow.com/q/26564383
has body: wedak balagena inna moda prashna danne nethuwa
score: 0

http://stackoverflow.com/comment/41720352
score: 0
comment on: http://stackoverflow.com/q/26548294
type: Comment
type: QuestionComment
has text: Thanks, @kha First time I post here.I will detail the process. 1. No exception from the 3 sections. I got no error. 2. Two clients can connect to server and receive another's ip and port from server. 3. I turned off the firewall for Windows. For android, I don't know how to do this. 4. The two clients just can't communicate, no any other exception. 5. I am new for P2P, so I wanna more help with finding the problem.

http://stackoverflow.com/comment/41905232
comment on: http://stackoverflow.com/a/26648446
type: AnswerComment
score: 0
has text: @JoeriHendrickx Personally, I agree with you, but it's a matter of style. The op asked what options he has to rewrite his method with java 8 and this approach is at least worth considering.
type: Comment

http://stackoverflow.com/comment/41907560
type: Comment
type: QuestionComment
has text: Some kind of checksum yes, to check the integrity of the game. Unless the player hacks this too :)
score: 0
comment on: http://stackoverflow.com/q/26521477

extjs
tags question: http://stackoverflow.com/q/26548041
type: Tag
tag name: extjs

http://stackoverflow.com/comment/41734655
comment on: http://stackoverflow.com/q/26556490
type: Comment
has text: Nope, Still the same error java.sql.SQLException: Access denied for user 'admin881Rhs7'@'localhost' (using password: NO)
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41839763
score: 2
comment on: http://stackoverflow.com/q/26614145
type: Comment
has text: Indentation is your friend and will show you where the error is.
type: QuestionComment

http://stackoverflow.com/comment/41842061
type: Comment
comment on: http://stackoverflow.com/q/26615305
score: 2
type: QuestionComment
has text: add error logs for crash

http://stackoverflow.com/comment/41688837
score: 0
comment on: http://stackoverflow.com/q/26530949
has text: @Pshemo thank you!a clarification,how do i solve this kind of problems and what is the simplest approach for the above problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41764919
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26573072
has text: see [this answer](http://stackoverflow.com/a/21747329/180100)

http://stackoverflow.com/comment/41817287
has text: @RonakShah, yes length of "S" is 1, but you are ADDING it to index. There is a + not a comma
comment on: http://stackoverflow.com/a/26601792
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41729202
comment on: http://stackoverflow.com/a/26553651
type: AnswerComment
has text: I don't see the advantage of this. It potentially puts code that should belong to `Stock` in the wrong class, which I believe leads to increased coupling (and may not work if it needs to refer to member fields defined in `Stock`).
score: 0
type: Comment

http://stackoverflow.com/comment/41915692
type: Comment
comment on: http://stackoverflow.com/a/26656473
type: AnswerComment
score: 0
has text: oh wow that was easy. Thanks. So can I ask another queastion? It is said that I shall put a generated class file (i.e. the LookupFieldCelleditor.class) in my Java classpath. How do I do this?

http://stackoverflow.com/a/26516752
type: Answer
has body: Try this code import java.util.Scanner; public class CountVowels { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int countVowel=0; int countVowelA=0; int countVowelE=0; int countVowelI=0; int countVowelO=0; int countVowelU=0; char ch; String str; System.out.println("Please enter the string : "); str = sc.nextLine(); char[] c = str.toCharArray(); for(int i = 0; i&lt;c.length; i ++) { if(c[i] == 'a' || c[i] =='A') { countVowelA++; countVowel++; } else if(c[i] == 'e' || c[i] =='E') { countVowelE++; countVowel++; } else if(c[i] == 'i' || c[i] =='I') { countVowelI++; countVowel++; } else if(c[i] == 'o' || c[i] =='O') { countVowelO++; countVowel++; } else if(c[i] == 'u' || c[i] =='U') { countVowelU++; countVowel++; } //i++; } System.out.println("Occurances of A in given string : " +countVowelA); System.out.println("Occurances of E in given string : " +countVowelE); System.out.println("Occurances of I in given string : " +countVowelI); System.out.println("Occurances of O in given string : " +countVowelO); System.out.println("Occurances of U in given string : " +countVowelU); System.out.println("Number of vowels in strings are : " +countVowel); } }
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41664606
has comment: http://stackoverflow.com/comment/41663391
score: 0
has comment: http://stackoverflow.com/comment/41663544
has comment: http://stackoverflow.com/comment/41663661
answers question: http://stackoverflow.com/q/26516455

http://stackoverflow.com/comment/41887026
score: 0
comment on: http://stackoverflow.com/a/26637957
type: Comment
has text: the app just crashes and it leads to the line of code that says SetContentView(R.layout.activity_my)
type: AnswerComment

http://stackoverflow.com/a/26612733
has body: You don't need to do the zero/one bit, if you aren't using the ${sex} variable anywhere else other than your sql:query. Your problem can collapse from: &lt;c:set var="sex" value="${param.sex}"/&gt; &lt;c:if test="$(param.sex=='male')" &gt; //set the sex to zero &lt;/c:if&gt; &lt;c:if test="$(param.sex=='female')" &gt; //set the sex to one &lt;/c:if&gt; ... &lt;sql:query dataSource="${dbcon}" var="result"&gt; select firstname,lastname from members where sex = ? &lt;sql:param value="${sex}"&gt; &lt;/sql:param&gt; Down to just this: &lt;sql:query dataSource="${dbcon}" var="result"&gt; select firstname,lastname from members where sex = ? &lt;sql:param value="${param.sex == 'male' ? 0 : 1}"&gt; &lt;/sql:param&gt; The point being that you can use param.sex directly in the sql:query statement, and you can use the "ternary operator" instead of using an if statement in this situation. Google for more on the "JSTL ternary operator" or take a look here (scroll down to Ternary Operations): http://davidensinger.com/2014/07/fun-with-jstl-in-jsps/ UPDATE To see the ternary operator in action and make sure the param.sex value is the value you expect you can just type this: ${param.sex == 'male' ? 0 : 1} On a blank line and it should print either a 0 or 1 to your screen.
downvote count: 0
answers question: http://stackoverflow.com/q/26609096
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41913895

http://stackoverflow.com/q/26672332
score: 0
tagged with: shutdown-hook
downvote count: 2
answer count: 1
has body: As far as I know System.exit triggers shutdown hook(if any hook registered) so while shutdown hook thread is waiting for any other thread to join if other thread calls System.exit() I think a deadlock occurs so is there any solution to register a shutdown hook for certain exit codes such as -1? By this way I can prevent a shutdown hook not to work for some specials exit situations. Thanks in advance.
tagged with: java
has title: Calling shutDownHook for certain exit codes?
has answer: http://stackoverflow.com/a/26681981
has comment: http://stackoverflow.com/comment/41962447
accepted answer: http://stackoverflow.com/a/26681981
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1486679
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/41882937
type: Comment
has text: I think selecting between two indices is dumb anyway. Much more intuitive to have a *start* index (inclusive) and a **length** (not an end index).
score: 1
comment on: http://stackoverflow.com/q/26631078
type: QuestionComment

http://stackoverflow.com/comment/41939759
type: Comment
comment on: http://stackoverflow.com/a/26669431
score: 0
type: AnswerComment
has text: @confusedrussian1 You could even consider reading the Javadoc *before* cutting the code ;-)

http://stackoverflow.com/a/26562720
type: Answer
has comment: http://stackoverflow.com/comment/41750681
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26562615
answers question: http://stackoverflow.com/q/26562615
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41745449
downvote count: 0
has body: I believe you have your JSP's inside WEB-INF. We can not access JSP inside WEB-INF by using sendRedirect refer. Place your JSP's in WebContent folder if you use eclipse or in root folder.

http://stackoverflow.com/comment/41898260
type: AnswerComment
score: 0
type: Comment
has text: Thank you, that makes sense. I know my code isn't very pretty, that's something I need to work on. Thanks for the additional optimization suggestions as well.
comment on: http://stackoverflow.com/a/26646369

http://stackoverflow.com/comment/41828915
has text: Are you aware that you are using three different paths to get the icon in different places of your code?
score: 1
comment on: http://stackoverflow.com/q/26608278
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41708714
score: 0
comment on: http://stackoverflow.com/q/26542210
has text: @JavaBond: That sounds like a bad idea to me. Threading can be very subtle indeed; it's possible that the source of `LinkedBlockingDequeue` will depend on some particular aspects of other classes. I don't think the OP needs to implement anything here.
type: QuestionComment
type: Comment

list
type: Tag
tags question: http://stackoverflow.com/q/26530592
tags question: http://stackoverflow.com/q/26621889
tags question: http://stackoverflow.com/q/26606982
tags question: http://stackoverflow.com/q/26604549
tags question: http://stackoverflow.com/q/26668736
tags question: http://stackoverflow.com/q/26570184
tag name: list
tags question: http://stackoverflow.com/q/26567274
tags question: http://stackoverflow.com/q/26589203
tags question: http://stackoverflow.com/q/26660257
tags question: http://stackoverflow.com/q/26634304
tags question: http://stackoverflow.com/q/26514921
tags question: http://stackoverflow.com/q/26528450
tags question: http://stackoverflow.com/q/26579853
tags question: http://stackoverflow.com/q/26654487
tags question: http://stackoverflow.com/q/26531794
tags question: http://stackoverflow.com/q/26656481
tags question: http://stackoverflow.com/q/26619996

http://stackoverflow.com/comment/41918412
has text: No, I have this error : java.lang.IllegalArgumentException: Could not resolve placeholder 'user' in string value "${user}"
comment on: http://stackoverflow.com/a/26655305
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26634771
type: AnsweredQuestion
has title: AngularJS CORS with Authorization header
tagged with: java
has body: Sorry for yet another question about Angular and CORS but I just can't pin down where the issue lies. My basic setup is a pure angular standalone website, so no Express or any server-side component, that talks to a Java based API on another server. The API is built using JAX-RS and lives in a JBoss 7.1.3 application server. I have access to the code for both the angular and the java. On the API side, CORS is enabled using the popular thetransactioncompany CORS filter shown below. CORS com.thetransactioncompany.cors.CORSFilter cors.supportedMethods GET, POST, HEAD, PUT, DELETE, OPTIONS cors.supportedHeaders Origin, Accept, Content-Type, X-Requested-With, Cookie,content-type CORS /* The way the API works is by providing a username and password to an endpoint that returns a token, this token is then included in the Authorization header in every subsequent request. The first part of the process works fine, I can provide valid credentials and receive a token, but then any subsequent request never works. So in my Angular service I have the following login method that fetches me a token then attempts to get the current logged in user. login: function(username, password){ var deferred = $q.defer(); $http({ method: 'POST', url: 'http://localhost:8080/website-api/rest/account/token', headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json'}, transformRequest: function(obj) { var str = []; for(var p in obj){ str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); } return str.join('&'); }, data: {username: username, password: password } }) .success(function(token) { $log.info(token.jwt); var requestConfig = { headers: { 'Authorization': token.jwt, 'Accept': 'application/json', 'X-Testing': 'Testing' } }; $http.get('http://localhost:8080/website-api/rest/users/current', requestConfig) .success(function(user) { $log.info('Retrieved User'); user.sessionToken = token.jwt; deferred.resolve(user); }) .error(function(data, status, header…
type: Question
accepted answer: http://stackoverflow.com/a/26651744
tagged with: cors
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jax-rs
tagged with: web.xml
tagged with: angularjs
has answer: http://stackoverflow.com/a/26651744
upvote count: 2
linked to: http://stackoverflow.com/q/21792759
score: 2

http://stackoverflow.com/q/26626199
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41861752
has answer: http://stackoverflow.com/a/26627124
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26627205
tagged with: desktop
has comment: http://stackoverflow.com/comment/41862573
tagged with: windows
has comment: http://stackoverflow.com/comment/41861771
favorite count: 0
score: -1
has body: Using java how to find out an application is not used for sometime? I am having some third party application for example we can take 'Skype'. If there is no action (mouse/keyboard input)is given to skype for 5min, then my code through some popup to user. So how to check whether the application is getting input from user? I gone through internet i found the below code which is giving output if the entire desktop is idle. but i need for specific application like skype. do how to do that? import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import com.sun.jna.*; import com.sun.jna.win32.*; /** * Utility method to retrieve the idle time on Windows and sample code to test it. * JNA shall be present in your classpath for this to work (and compile). * @author ochafik */ public class Win32IdleTime { public interface Kernel32 extends StdCallLibrary { Kernel32 INSTANCE = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class); /** * Retrieves the number of milliseconds that have elapsed since the system was started. * @see http://msdn2.microsoft.com/en-us/library/ms724408.aspx * @return number of milliseconds that have elapsed since the system was started. */ public int GetTickCount(); }; public interface User32 extends StdCallLibrary { User32 INSTANCE = (User32)Native.loadLibrary("user32", User32.class); /** * Contains the time of the last input. * @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputstructures/lastinputinfo.asp */ public static class LASTINPUTINFO extends Structure { public int cbSize = 8; /// Tick count of when the last input event was received. public int dwTime; } /** * Retrieves the time of the last input event. * @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/getlastinputinfo.asp * @ret…
has comment: http://stackoverflow.com/comment/41903533
upvote count: 2
type: UnansweredQuestion
has title: Using java how to find out an application is not used for sometime?

http://stackoverflow.com/comment/41881593
comment on: http://stackoverflow.com/q/26636947
score: 0
has text: How do I verify that the injection is not working? Please excuse my lack of knowledge. :) This class is used to draw a Gannt chart : public class GanttFrame extends ApplicationFrame implements MouseWheelListener, ChangeListener, AxisChangeListener,ActionListener{ . Then added to the view composite via an AWT frame Composite composite = new Composite(scrolledComposite, SWT.EMBEDDED | SWT.NO_BACKGROUND); frame = SWT_AWT.new_Frame(composite);
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41938512
type: AnswerComment
comment on: http://stackoverflow.com/a/26668615
score: 0
has text: Thank you! That makes total sense and helps immensely.
type: Comment

http://stackoverflow.com/a/26550129
type: Answer
has body: You need to register your protfolios after their creation, and before calling setPrices(), as required by the observer pattern: Your program should be like : import java.util.ArrayList; import java.util.HashMap; import java.util.Map; interface DisplayElement { void display(); } interface Observer { void update (Map&lt;String,Double&gt; priceMap); } class PricesDisplay implements Observer, DisplayElement { private String ticker; private double price; private Subject PriceData; Map&lt;String,Double&gt; priceMap; PricesDisplay(Subject PriceData) { this.PriceData = PriceData; } PricesDisplay(String ticker, Subject PriceData) { this.ticker = ticker; this.PriceData = PriceData; } public void update(Map&lt;String,Double&gt; priceMap) { this.priceMap = priceMap; display(); } public void display() { for (Map.Entry&lt;String, Double&gt; entry : priceMap.entrySet()) { System.out.printf("\nPortfolio #%s, " + "%s = " + "%.2f, ", ticker, entry.getKey(), entry.getValue()); } } } interface Subject{ void registerObserver(Observer o); void removeObserver(Observer o); void notifyObservers(); void measurementsChanged(); void setPrices(Map&lt;String,Double&gt; priceMap); } class PriceData implements Subject { private ArrayList observers; PriceData priceData; private Map&lt;String,Double&gt; priceMap = new HashMap&lt;String,Double&gt;(); PriceData() { observers = new ArrayList(); } public void registerObserver(Observer o) { observers.add(o); } public void removeObserver(Observer o) { int i = observers.indexOf(o); if (i &gt;= 0) { observers.remove(i); } } public void notifyObservers() { for (int i = 0; i &lt; observers.size(); i++) { Observer observer = (Observer)observers.get(i); observer.update(priceMap); } } public void measurementsChanged() { notifyObservers(); } public void setPrices(Map&lt;String,Double&gt; priceMap) { this.priceMap = priceMap; measurementsChanged(); } } class Test { private static Map&lt;String,Double&gt; priceMap = new HashMap&lt;String,Double&gt;(); private stati…
score: 0
has comment: http://stackoverflow.com/comment/41723640
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26549927
answers question: http://stackoverflow.com/q/26549927

http://stackoverflow.com/q/26590405
favorite count: 0
accepted answer: http://stackoverflow.com/a/26590512
has title: Understanding the relationship between the Iterator interface and the “foreach” statement
tagged with: foreach
has answer: http://stackoverflow.com/a/26590512
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: Why does implementing the Iterator interface allow an object to be the target of the “foreach” statement in java? I mean what is the relationship between for-each and the Iterable interface in java. for(Object:Iterable&lt;T&gt;) { //code here }
has answer: http://stackoverflow.com/a/26590496
type: Question
score: -2
has answer: http://stackoverflow.com/a/26590528
downvote count: 2
answer count: 3
possible better answer: http://stackoverflow.com/a/26590496

http://stackoverflow.com/comment/41698091
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26536117
has text: Typo: `strPiece.ToString()` should be `strPiece.toString()`

http://stackoverflow.com/a/76516764
has body: If you are not able to find App Password.. First turn on two step authentication. Go to Link https://myaccount.google.com/apppasswords and set up the app password.
upvote count: 1
answers question: http://stackoverflow.com/q/26594097
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26681979
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/114217532
accepted answer of: http://stackoverflow.com/q/26639999
has body: I ultimately ended up abandoning AOP and converting my former Aspect into a StepListener, which worked fine.
answers question: http://stackoverflow.com/q/26639999

http://stackoverflow.com/comment/41931382
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26664787
has text: @MiltoxBeyond that's just another way to initialize an array. But this answer tries to use OP's code.
score: 0

http://stackoverflow.com/a/26624952
type: Answer
accepted answer of: http://stackoverflow.com/q/26525324
answers question: http://stackoverflow.com/q/26525324
has body: It was not the problem of JavaCpp i suppose, When we make video using MediaRecorder in android device, the audio and video are not exactly the same... Audio is bit larger i.e. 0.1s to 0.25s So when we append the videos using JavaCpp which at the end bring together the audio video stream, first appending them seperately gives a huge difference. In my case i appended 30 to 40 videos and sometimes video audio difference went to 14 seconds, which was very distrubing... So another approach i used was to trim every video from the end (approx 0.5s), that makes audio video stream equal. Here you can find what i did. I hope i helped you people.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41866824
comment on: http://stackoverflow.com/a/26612775
score: 0
type: Comment
type: AnswerComment
has text: Please see my update. Hope you can solve your problem now :) @jim

http://stackoverflow.com/q/26515251
type: Question
has comment: http://stackoverflow.com/comment/41661877
answer count: 2
has answer: http://stackoverflow.com/a/26516486
score: 0
has title: transform Scala case class to org.apache.solr.common.SolrInputDocument
linked to: http://stackoverflow.com/q/1226555
has answer: http://stackoverflow.com/a/26516588
has comment: http://stackoverflow.com/comment/41661969
tagged with: scala
type: UnansweredQuestion
tagged with: case-class
has body: Are there any generic implementations out-there which can transform a Scala case class to SolrDocument ? Since I could not find any such mapper utility that I can reuse, I took the below approach: Create the case class object Get non-empty fields by transforming case class object to Map Add fields to the mutable document one-by-one. This approach works for me, but I would have to create the intermediate Map object. I want to avoid this for verbosity and complexity reasons. Is there a better way of doing it?
tagged with: datamapper
tagged with: java
tagged with: solr

http://stackoverflow.com/comment/41711192
comment on: http://stackoverflow.com/q/26543686
has text: @viviano I am not Android expert but can you explain this line myView.setRotation(myView.getRotation() + size);? why u did not use variable i in it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41934997
type: QuestionComment
score: 0
has text: It's posted, you just need to scroll down
comment on: http://stackoverflow.com/q/26666688
type: Comment

http://stackoverflow.com/comment/74656550
type: Comment
has text: ... none of which make a lot of sense in the scenarios that executors are designed for.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26570153

http://stackoverflow.com/q/26519462
has body: I am trying to convert \U0001f618 to the symbol that expresses face (I think it's called emoji ?) My code is import org.apache.commons.lang3.StringEscapeUtils; public class Test{ public static void main(String args[]){ try{ String unicode = "\\U0001f618"; String Title = unicode; System.out.println(new String(unicode.getBytes(),"UTF-8")); String Title = StringEscapeUtils.unescapeJava(unicode); System.out.println(Title); }catch(Exception E){System.out.println(E);} } } However I can not do it. This code just prints out plain text "\U0001f618" I have a bunch of such codes that I need to convert. Any idea?
score: 1
tagged with: java
type: Question
tagged with: encoding
downvote count: 0
tagged with: unicode
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: print string encoding wired unicode in Java
upvote count: 1
tagged with: emoji
tagged with: utf
has answer: http://stackoverflow.com/a/26519500

http://stackoverflow.com/a/26640952
type: Answer
answers question: http://stackoverflow.com/q/26640800
score: 2
upvote count: 2
has body: In words: DerpRandom(); = "Call the method named DerpRandom which has no parameters, and is in the current class". DerpResult(result); = "Call the method named DerpResult that takes one parameter assignment-compatible with int, and is in the current class, and pass it the value of result as an argument". When I say "in the current class" I mean "defined in the current class, or defined in one of its superclasses and accessible from the current class".
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26640800

http://stackoverflow.com/comment/41710875
type: QuestionComment
comment on: http://stackoverflow.com/q/26543437
score: 0
has text: General null should be checked first, and this is first type of test that should be written to coverage that. But form my experience this notation is better:) Saved my life in few places.
type: Comment

http://stackoverflow.com/a/26551712
has body: NOTE: This is true for the version mentioned in the question, 4.1.1.RELEASE. Spring MVC handles a ResponseEntity return value through HttpEntityMethodProcessor. When the ResponseEntity value doesn't have a body set, as is the case in your snippet, HttpEntityMethodProcessor tries to determine a content type for the response body from the parameterization of the ResponseEntity return type in the signature of the @RequestMapping handler method. So for public ResponseEntity&lt;Void&gt; taxonomyPackageExists( @PathVariable final String key ) { that type will be Void. HttpEntityMethodProcessor will then loop through all its registered HttpMessageConverter instances and find one that can write a body for a Void type. Depending on your configuration, it may or may not find any. If it does find any, it still needs to make sure that the corresponding body will be written with a Content-Type that matches the type(s) provided in the request's Accept header, application/xml in your case. If after all these checks, no such HttpMessageConverter exists, Spring MVC will decide that it cannot produce an acceptable response and therefore return a 406 Not Acceptable HTTP response. With ResponseEntity&lt;String&gt;, Spring will use String as the response body and find StringHttpMessageConverter as a handler. And since StringHttpMessageHandler can produce content for any media type (provided in the Accept header), it will be able to handle the application/xml that your client is requesting. Spring MVC has since been changed to only return 406 if the body in the ResponseEntity is NOT null. You won't see the behavior in the original question if you're using a more recent version of Spring MVC. In iddy85's solution, which seems to suggest ResponseEntity&lt;?&gt;, the type for the body will be inferred as Object. If you have the correct libraries in your classpath, ie. Jackson (version > 2.5.0) and its XML extension, Spring MVC will have access to MappingJackson2XmlHttpMessageConverter which…
answers question: http://stackoverflow.com/q/26550124
type: Answer
accepted answer of: http://stackoverflow.com/q/26550124
score: 59
upvote count: 61
has comment: http://stackoverflow.com/comment/41794860
has comment: http://stackoverflow.com/comment/64917538
has comment: http://stackoverflow.com/comment/55936296
has comment: http://stackoverflow.com/comment/64916716
downvote count: 2
has comment: http://stackoverflow.com/comment/41786719
type: AcceptedAnswer

http://stackoverflow.com/comment/41734718
type: AnswerComment
has text: Each algorithm has rules. and my understanding is you should have one initiator . upon receipt of request he should send to his neighbor or decides ( as long as he already sent he can decides) . But each node should sent atleast one message . Each node can receive multiple message
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26556052

http://stackoverflow.com/comment/41742042
type: Comment
type: QuestionComment
has text: how can i traverse the checked values?
comment on: http://stackoverflow.com/q/26560733
score: 0

git
tags question: http://stackoverflow.com/q/26514350
tags question: http://stackoverflow.com/q/26534382
tag name: git
tags question: http://stackoverflow.com/q/26573044
type: Tag
tags question: http://stackoverflow.com/q/26527815
tags question: http://stackoverflow.com/q/26533483
tags question: http://stackoverflow.com/q/26644373
tags question: http://stackoverflow.com/q/26633782
tags question: http://stackoverflow.com/q/26546481

http://stackoverflow.com/a/26530267
has body: you might want to use this form: int doSomething(String... arguments) { int sum = 0; for (int i = 0; i &lt; arguments.length; i++) { sum += Integer.parseInt(arguments[i]); } return sum; } then you can call: doSomething( "aa" ); doSomething( "aa", "bb" ); doSomething();
score: 1
answers question: http://stackoverflow.com/q/26530108
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/41722147
answers question: http://stackoverflow.com/q/26663060
type: Answer
score: 0
has body: If anyone else comes across a similar problem (Printing blank in Windows 7 but working in Windows 10 in my case), but the DocFlavor is set correctly (i.e. One supported by a chosen print service)... I was able to solve my issue by updating the JRE from 32-bit 8u101 to 64-bit 8u121.

http://stackoverflow.com/comment/41777550
type: QuestionComment
comment on: http://stackoverflow.com/q/26580196
score: 0
has text: @Renren29 I have no doubt you're on the right track, but have no context to go by ;)
type: Comment

http://stackoverflow.com/comment/41807304
type: Comment
has text: What is `ClientApplicationWindow`? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
comment on: http://stackoverflow.com/q/26596270
score: 4
type: QuestionComment

http://stackoverflow.com/comment/41669759
has text: No, they're not all constants. In fact, the CPU instructions are added as a List of anonymous classes, because Instruction is an interface with two methods: boolean validate(opCode) and void execute(). In this case it wouldn't make any sense to have them in a file.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26520181
type: AnswerComment

http://stackoverflow.com/comment/41669564
comment on: http://stackoverflow.com/q/26520173
type: Comment
type: QuestionComment
has text: Have you heard of our mvce? http://stackoverflow.com/help/mcve It's makes questions like these much easier for us to help you with, right now, it's hard to dig through all this code without getting lost. I recommend editing your code.
score: 1

http://stackoverflow.com/q/26624455
downvote count: 0
has title: java.util.ConcurrentModificationException on htmlunit
score: 1
has answer: http://stackoverflow.com/a/26624522
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: import
type: Question
tagged with: java
has body: //Below code to hit web page continuously .In this time we are getting the java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:782) at java.util.ArrayList$Itr.remove(ArrayList.java:768) at com.gargoylesoftware.htmlunit.WebWindowImpl.destroyChildren(WebWindowImpl.java:185) at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImpl.java:110) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:209) at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:187) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:434) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:359) at sample.ShareScraper.getHtmlPage(ShareScraper.java:303) at sample.ShareScraper.GetData(ShareScraper.java:116) Exception in getHtmlPagemethod. package sample; import java.io.IOException; import java.net.MalformedURLException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.ConcurrentModificationException; import java.util.Vector; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell; import com.jls.library.JLStructure; public class ShareScraper { private WebClient wc1,wc2,wc3,wc4,wc5; private JLStructure JLSObj = null; HtmlPage details_page1 = null , details_page2 = null , details_page3 = null , details_page4 = null , details_page5 = null; //Object[] share…
answer count: 1

http://stackoverflow.com/a/26560860
upvote count: 168
has comment: http://stackoverflow.com/comment/52114946
type: Answer
has comment: http://stackoverflow.com/comment/64443158
has comment: http://stackoverflow.com/comment/116428233
has comment: http://stackoverflow.com/comment/110671661
has comment: http://stackoverflow.com/comment/65341165
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26549010
score: 167
has comment: http://stackoverflow.com/comment/108858346
answers question: http://stackoverflow.com/q/26549010
has body: The short answer is 'both'. XMPP is a set of application protocol for doing real-time chat (and many other things, for that matter) - it then has to be transported across the network somehow, so you need a transport binding. There are three main transport bindings for XMPP - TCP/IP, which is what one usually uses on the Internet with native clients on devices HTTP (called BOSH), which is what one has traditionally used when using XMPP in the browser (as TCP-IP isn't available to Javascript apps in the browser) Websockets, which is one one uses when doing XMPP in a modern browser. So if you're developing a chat application in a browser, you'd choose XMPP as the application protocol and you'd use websockets (in a modern browser) or BOSH (in an older browser) as the network transport. If you use an XMPP library for Javascript like Stanza.io (https://github.com/otalk/stanza.io), it'll support both and you'll just be thinking about 'XMPP' rather than the transport layer, other than at setup when you have to tell it what endpoint to connect to. (You can't use 'just websockets' for chat - you can use websockets without XMPP, but what this really means is that you're inventing your own application-layer protocol for chat, and the odds are you're going to save a lot of time and headaches by taking advantage of the work that's already gone into writing one with useful properties (security, identity, extensibility etc.) and for which there are existing libraries and servers by going XMPP instead.)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/115743812

http://stackoverflow.com/a/26644025
has body: You must implement OnFragmentInteractionListener inside your main activity. change public class Main extends Activity implements ActionBar.TabListener to public class Main extends Activity implements ActionBar.TabListener, OnFragmentInteractionListener Then make sure your implement public void onFragmentInteraction(Uri uri); inside your main activity. A little info on the new instance method. This is a common practice not a special method you are implementing. You can call it anything that you want but the idea is that new instance method takes your parameters and adds them to a bundle. when android destroys your fragment it gets recreated using its default constructor which does not have your data. The solution is to use a new instance method and put your data in a bundle because when android recreates your fragment its bundle sticks around. The only time you would not care about new instance is when you are not passing anything into your fragment.
type: Answer
answers question: http://stackoverflow.com/q/26620031
score: 0

http://stackoverflow.com/comment/41862284
type: Comment
type: QuestionComment
score: 0
has text: I think that spring boot configures transaction manager for spring data jpa. I can autowire it, but when I invoke `entityManager.flush()` after save in `scheduleCrawlerJob()` with `@Transactional` annotation I get `javax.persistence.TransactionRequiredException: no transaction is in progress`
comment on: http://stackoverflow.com/q/26625793

http://stackoverflow.com/comment/41704205
score: 0
comment on: http://stackoverflow.com/a/26539324
type: AnswerComment
has text: See my comment above. You can't use `reduce` on mutable types in parallel streams, and therefore you shouldn't use it with sequential ones either. The API isn't clear on this point, and a lot of people will make this error. The way to go is with `collect`.
type: Comment

http://stackoverflow.com/q/26569203
possible better answer: http://stackoverflow.com/a/26569443
has answer: http://stackoverflow.com/a/26569443
score: 0
accepted answer: http://stackoverflow.com/a/26569406
has body: public Link insert(String data, int where) { Link temp = first; //If list is empty, insert as first if (first == null) { first = new Link(data, where); return first; } //List is not empty else { while (temp != null) { //If data is less than first, then insert as first if (data.compareTo(temp.getdData()) &lt; 0 &amp;&amp; temp == first) { Link newLink = new Link(data, where); newLink.setNext(first); first.setPrevious(newLink); first = newLink; return newLink; } //If data is less than current, then insert before current else if (data.compareTo(temp.getdData()) &lt; 0) { Link newLink = new Link(data, where); newLink.setNext(temp); newLink.setPrevious(temp.getPrevious()); temp.getPrevious().setNext(newLink); temp.setPrevious(newLink); return newLink; } //If data is more, but your at the end of the list. else if (data.compareTo(temp.getdData()) &gt; 0 &amp;&amp; temp.getNext() == null) { Link newLink = new Link(data, where); temp.setNext(newLink); newLink.setPrevious(temp); newLink.setNext(null); last = newLink; return newLink; } //Else keep going forward else temp = temp.next; } } return temp; } I can insert into the list, but for some reason it won't insert in order. For example, if a link's data is "Hello" and I want to insert a link with "aaa", it won't insert the new link before the "Hello" link.
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 2
has title: Having trouble inserting into a doubly linked, double ended list with Java
has answer: http://stackoverflow.com/a/26569406
tagged with: doubly-linked-list

http://stackoverflow.com/q/26608967
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26609354
favorite count: 0
has answer: http://stackoverflow.com/a/26609402
possible better answer: http://stackoverflow.com/a/26609359
has comment: http://stackoverflow.com/comment/41829813
has answer: http://stackoverflow.com/a/26609359
tagged with: regex
score: -2
has comment: http://stackoverflow.com/comment/41830071
has title: Delete characters between other
type: AnsweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/41829822
type: Question
accepted answer: http://stackoverflow.com/a/26609402
has body: I have one String with a lot of sentences and this string has words like "ga- te", "ga - te" etc. I need to convert all words like "ga- te" to "gate" and don't touch each other. I tried to use regexp but it's unsuccessfully. Can you help me with it? P.S. Sorry for my bad english.
tagged with: java

http://stackoverflow.com/a/26522506
answers question: http://stackoverflow.com/q/26522440
score: 0
type: Answer
has body: Java has pass-by-value and only pass-by-value. At the same time Java has pointers (officially called references); so when't your passing an object to a method you're basically passing by value the variable that references that object. If you modify the object then the object is seen to be modified at the called site. If you modify the reference to that the object in the called method, then this is not seen at the called site. In your second case you create new objects with .clone() and pass them. Since there are no other references only in the called site, the changes can only be seen there.

ejb-3.1
tags question: http://stackoverflow.com/q/26567893
tag name: ejb-3.1
tags question: http://stackoverflow.com/q/26591991
tags question: http://stackoverflow.com/q/26654634
tags question: http://stackoverflow.com/q/26578890
type: Tag

http://stackoverflow.com/comment/41937678
type: Comment
comment on: http://stackoverflow.com/a/26668276
has text: you are 25 sec faster
type: AnswerComment
score: 0

http://stackoverflow.com/a/26614733
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26614593
answers question: http://stackoverflow.com/q/26614593
has body: Define your own JSONObject : JSONObject input = new JSONObject(); input.put("username", "hi"); input.put("password", "hi"); And execute your task like this : new UserREST.AuthUser(this).execute(input); The task should look like this : public static class AuthUser extends AsyncTask&lt;JSONObject, Void, User&gt; { // [...] @Override protected User doInBackground(JSONObject... params) { User user = null; String url = ROUTE_USER_AUTH; HttpPost httppost = new HttpPost(url); HttpClient httpclient = new DefaultHttpClient(); String UserJSONResponse = null; try { StringEntity m_stringEntity = new StringEntity(params[0].toString()); // [...]
type: AcceptedAnswer
downvote count: 0
type: Answer

fest
tags question: http://stackoverflow.com/q/26572023
type: Tag
tag name: fest

http://stackoverflow.com/comment/41724868
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26551358
type: QuestionComment
has text: for better help soner post an SSCCE/MCVE , short, runnable, compilable

http://stackoverflow.com/q/26611635
linked to: http://stackoverflow.com/q/219881
has comment: http://stackoverflow.com/comment/41835180
has title: How to determine obj can be used in for loop
type: Question
has answer: http://stackoverflow.com/a/26612157
has comment: http://stackoverflow.com/comment/41835890
has comment: http://stackoverflow.com/comment/41835097
linked to: http://stackoverflow.com/q/12806739
has comment: http://stackoverflow.com/comment/41835816
has comment: http://stackoverflow.com/comment/41835521
score: 0
tagged with: java
has body: I have try following code, but it return false. package ro.idea.ex; import java.lang.reflect.Array; import java.util.Collection; /** * Created by roroco on 10/28/14. */ public class Ex { public &lt;T&gt; boolean canWorkInForLoop(T o) { return o instanceof Collection || o instanceof Iterable || o instanceof Array; } public static void main(String[] args) { int[] arr = {1, 2}; Object r = new Ex().canWorkInForLoop(arr); System.out.println("r:" + r + "\t\t" + new Exception().getStackTrace()[0].getFileName() + ":" + new Exception().getStackTrace()[0].getLineNumber()); } } my question is: How to determine all obj which can be used in for loop, like new int[], instance of ArrayList and other obj?
answer count: 1
has comment: http://stackoverflow.com/comment/41835577
has comment: http://stackoverflow.com/comment/41835666
accepted answer: http://stackoverflow.com/a/26612157
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41838107
type: AnsweredQuestion

http://stackoverflow.com/comment/41896328
comment on: http://stackoverflow.com/a/26633126
type: AnswerComment
score: 1
type: Comment
has text: You are damn right. My point is that you can achieve the same only setting one key to `conf` without adding those files to classpath or to conf. However, you will need them when submitting MR jobs.

http://stackoverflow.com/comment/41691293
comment on: http://stackoverflow.com/q/26532283
score: 1
type: Comment
type: QuestionComment
has text: @KickButtowski I forgot to add that in my comment, out of space. Anyways, I also have issues with text box controls. Do not even get me started on the tree control. I am being punished there, because one cannot set the foreground, selected, or other colors. My hope of a color scheme to match Windows File Explorer is dashed, because tree controls look HORRIBLE on GNOME 3 (CENTOS 7). The list goes on, and on. I am hoping the Table SWT control has a trick. Yes, I do not "question", but take offense to the write once run anywhere, because it is not true, not yet.

http://stackoverflow.com/a/34440975
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26664544
has body: Just add content-type and accept in headers. Like: headers = {"Content-Type": "application/json", "Accept": "application/json"} r = requests.get("http://localhost:8080/StudentService/rest/insert/get1", data=title, headers=headers)

http://stackoverflow.com/q/26551513
type: Question
possible better answer: http://stackoverflow.com/a/26551638
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26551695
has answer: http://stackoverflow.com/a/26561512
has body: Why can't I switch input language in jtextfield and JOptionPane.showInputDialog()? On my computer I can, but on other computer I can write only system locale language symbols. Ctrl+Shift or Ctrl+Alt+Shift is not working in application, but it is working when app is not focus Locale.setDefault(Locale.ENGLISH); //tried it System.setProperty("user.language", "en"); // and it private void showPasswordWindow() { String pass = JOptionPane.showInputDialog(null, "Enter password", "Secure", JOptionPane.WARNING_MESSAGE); if (pass == null) System.exit(0); if (!pass.contains("somepassword")) showPasswordWindow(); } Not working (( password contain English symbols and I can't to enter password (only Russia symbols working) JRE 8; PS: I want to enter English symbols, but I can type only Russian symbols...NOT WORKING ONLY DIALOG TEXTFIELDS
linked to: http://stackoverflow.com/q/14814336
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26551638
tagged with: java
accepted answer: http://stackoverflow.com/a/26561512
tagged with: swing
tagged with: jtextfield
has title: Cannot change input language in jTextField

http://stackoverflow.com/comment/41755051
comment on: http://stackoverflow.com/a/26565205
type: Comment
has text: The thing about IntentService is they run in a queue. Meaning one won't start until one before it finishes. They are not intended to run for 10 minutes long. An IntentService would be the preferred way if you needed to be gathering statistics from within the Activity. If it's completely fine to gather them from a Service, then you may be better off just starting a Service and running a generic Thread from that.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41944842
type: Comment
type: QuestionComment
has text: I am sorry for the links, but i am writing from my phone.. i cant press CTRL+K and i cant use the editor.... :/
score: 0
comment on: http://stackoverflow.com/q/26665197

http://stackoverflow.com/comment/41943705
comment on: http://stackoverflow.com/a/26671695
type: AnswerComment
has text: Nope, my properties mostly in another table, so a.property.name - it won't chose anything, i don't use foreign keys
score: 0
type: Comment

http://stackoverflow.com/comment/41728838
comment on: http://stackoverflow.com/q/26553443
has text: try printing the index at both inside the if condition and next to your log
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26558741
linked to: http://stackoverflow.com/q/10786042
tagged with: java
has comment: http://stackoverflow.com/comment/41738375
has answer: http://stackoverflow.com/a/60315214
has body: I have a question that what does str[newLength] = '\0' mean? because I think the last character should be str[newLength-1], so I don't know the meaning of this line. Write a method to replace all spaces in a string with '%20'. Assume string has sufficient space at end of string to hold additional characters, and that you're given a true length of a string. I used the books code, implementing the solution in Java using a character array (given the fact that Java Strings are immutable): public class Test { public void replaseSpaces(char[] str, int length) { int spaceCount = 0, newLength = 0, i = 0; for(i = 0; i &lt; length; i++) { if (str[i] == ' ') spaceCount++; } newLength = length + (spaceCount * 2); str[newLength] = '\0'; for(i = length - 1; i &gt;= 0; i--) { if (str[i] == ' ') { str[newLength - 1] = '0'; str[newLength - 2] = '2'; str[newLength - 3] = '%'; newLength = newLength - 3; } else { str[newLength - 1] = str[i]; newLength = newLength - 1; } } System.out.println(str); }
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/41738428
linked to: http://stackoverflow.com/q/3799130
has answer: http://stackoverflow.com/a/26558775
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26558831
answer count: 3
has comment: http://stackoverflow.com/comment/41738442
score: 8
downvote count: 0
type: UnansweredQuestion
has title: What does str[newLength] = '\0' mean?

http://stackoverflow.com/q/26616108
type: UnansweredQuestion
tagged with: java
tagged with: filewriter
has answer: http://stackoverflow.com/a/26616577
has title: Name files for filewriter on mac
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41844345
has answer: http://stackoverflow.com/a/39558385
has body: import java.io. * ; import java.util.Scanner; public class Filewrite1 { public static void main(String[] args) throws IOException { Scanner kb = new Scanner (System.in); FileWriter fwriter = new FileWriter ("/Users/StudentFile.txt"); PrintWriter StudentFile = new PrintWriter (fwriter); String name = " "; String next = " "; int age = 0; double gpa = 0.0; I am getting a permission denial on my /Users/StudentFile.txt, I am doing this on a mac with netbeans - this is for CSIS 1340 intro to Java. I think I have a good understanding of the idea - you have to write to and read from files to program - I just don't seem to be understanding my file name? The rest of my program works. Everyone else is using a pc and they start their file path with C:, etc. Any help would be appreciated.
score: 0
tagged with: macos

http://stackoverflow.com/q/26533263
has body: I started using Java 1.7 and I'm still using Eclipse. In my Project I add extra data to the thrown exception, with handledException.addSuppressed(additionalException); and it was working so far. But according to my crash reports, some old OS installed devices(Android 2.3.4) are crashing with StackTrace below. But it doesn't occur in my Nexus 5 which has Android 4.4.4. java.lang.NoSuchMethodError: java.lang.Exception.addSuppressed I'm not really sure if there is some additional steps needed to update it to Java 1.7.
tagged with: java
has comment: http://stackoverflow.com/comment/41694232
answer count: 2
accepted answer: http://stackoverflow.com/a/26533577
possible better answer: http://stackoverflow.com/a/26533608
tagged with: java-7
has title: NoSuchMethodError: java.lang.Exception.addSuppressed : Updating from Java 1.6 to 1.7
has answer: http://stackoverflow.com/a/26533608
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41692833
score: 0
has answer: http://stackoverflow.com/a/26533577
type: Question

http://stackoverflow.com/q/26544302
type: Question
has answer: http://stackoverflow.com/a/33233697
has comment: http://stackoverflow.com/comment/53518583
has body: I am trying to compile and run the project https://github.com/jitsi/jitsi-android on Eclipse by Importing. I have imported the project successfully,Added External Jar files and Fix some of compilation errors. When I try to run app, It is giving Conversion to Dalvik format failed with error 1 Error on the console.So that I Clean the project, checked the all the jar files from Order and Export tab and build it again. but it doesn't work for me. Finally, I uncheck the all the libraries from Order and Export tab,build and run it again. This time it worked for me, but throws noclassdeffounderror Error and App crashed. I want to compile and run this app. Please help, Thanks !!!
has comment: http://stackoverflow.com/comment/53518825
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/53519205
score: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/53518881
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/54144334
has title: jitsi-android unable to compile and build
tagged with: java
tagged with: noclassdeffounderror
upvote count: 7
tagged with: eclipse

http://stackoverflow.com/q/26587188
linked to: http://stackoverflow.com/q/26603496
has comment: http://stackoverflow.com/comment/41791880
has comment: http://stackoverflow.com/comment/41791568
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jpa-2.0
has comment: http://stackoverflow.com/comment/41821494
has comment: http://stackoverflow.com/comment/41790175
has body: I am getting the following Error When I try to execute the below query- Error ERROR [2014-10-27 11:17:24,264] org.hibernate.hql.internal.ast.ErrorCounter: line 1:33: unexpected token: ( ERROR [2014-10-27 11:17:24,304] org.hibernate.hql.internal.ast.ErrorCounter: line 1:33: unexpected token: ( ! antlr.NoViableAltException: unexpected token: ( ERROR [2014-10-27 11:17:24,306] org.hibernate.hql.internal.ast.ErrorCounter: line 1:68: unexpected token: MAX ERROR [2014-10-27 11:17:24,312] org.hibernate.hql.internal.ast.ErrorCounter: line 1:68: unexpected token: MAX ! antlr.NoViableAltException: unexpected token: MAX Query String sSubQuery = "SELECT om.path, om.originalSize, MAX(om.lastModified) "+ "FROM "+ "ObjectMetadata om "+ "WHERE om.informationStoreId = '"+informationStoreDefinitionID+"' "+ "GROUP BY om.path, om.originalSize"; String sQuery = "SELECT SUM(o.originalSize) "+ "FROM "+ "("+ " "+sSubQuery+ " ) "+ "o"; Query q = getEm().createQuery(sQuery); Please Help.
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has title: org.hibernate.hql.internal.ast.ErrorCounter: unexpected token: (
upvote count: 1
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/26587525

http://stackoverflow.com/comment/41832645
comment on: http://stackoverflow.com/a/26609962
type: AnswerComment
has text: In `ConnectDevices()` assign `mBluetoothdevice` to `device`. If you never assign `mBluetoothdevice` to a value, it will always be `null` and always give you the `NullPointerException`
type: Comment
score: 1

http://stackoverflow.com/a/27127162
answers question: http://stackoverflow.com/q/26621838
has body: Yes, what dropwizard-client provides is only to be used by the service itself, most likely to communicate other services. It doesn't provide anything for client applications directly. It doesn't do much magic with HttpClients anyway. It simply configures the client according to the yml file, assigns the existing Jackson object mapper and validator to Jersey client, and I think reuses the thread pool of the application. You can check all that on https://github.com/dropwizard/dropwizard/blob/master/dropwizard-client/src/main/java/io/dropwizard/client/JerseyClientBuilder.java I think I'd go about and structure my classes as you did using Jersey Client. Following is an abstract class I've been using for client services: public abstract class HttpRemoteService { private static final String AUTHORIZATION_HEADER = "Authorization"; private static final String TOKEN_PREFIX = "Bearer "; private Client client; protected HttpRemoteService(Client client) { this.client = client; } protected abstract String getServiceUrl(); protected WebResource.Builder getSynchronousResource(String resourceUri) { return client.resource(getServiceUrl() + resourceUri).type(MediaType.APPLICATION_JSON_TYPE); } protected WebResource.Builder getSynchronousResource(String resourceUri, String authToken) { return getSynchronousResource(resourceUri).header(AUTHORIZATION_HEADER, TOKEN_PREFIX + authToken); } protected AsyncWebResource.Builder getAsynchronousResource(String resourceUri) { return client.asyncResource(getServiceUrl() + resourceUri).type(MediaType.APPLICATION_JSON_TYPE); } protected AsyncWebResource.Builder getAsynchronousResource(String resourceUri, String authToken) { return getAsynchronousResource(resourceUri).header(AUTHORIZATION_HEADER, TOKEN_PREFIX + authToken); } protected void isAlive() { client.resource(getServiceUrl()).get(ClientResponse.class); } } and here is how I make it concrete: private class TestRemoteService extends HttpRemoteService { protected TestRemoteService(Client client)…
score: 0
type: Answer

http://stackoverflow.com/comment/41744935
comment on: http://stackoverflow.com/q/26562212
score: 0
has text: to display events in calender am going with javascript in jsp page.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41747198
score: 0
type: Comment
type: QuestionComment
has text: @lehermj Override is just an indication if you are actually overriding or just creating another method in Java right ? , how could that be a cause of error , or does it serve any other purpose when it comes to android ?
comment on: http://stackoverflow.com/q/26563725

http://stackoverflow.com/q/26664417
has comment: http://stackoverflow.com/comment/41930896
tagged with: collision
score: 2
has answer: http://stackoverflow.com/a/26697808
downvote count: 0
tagged with: rendering
type: UnansweredQuestion
has body: Situation: I am programming a 2D isometric styled Java game with libGDX. Right now I have a moveable player that properly collides with tiles of solid objects. Problem: Now it comes to the renderorder of tiles. By default the library code renders from the bottom maplayer to the top layer. (Ground is layer 0, object layer is layer 1) Which makes sense. I draw the player on top of that. This means that the player is always on top of everything which doesn't make sense in some situations. Goal: Since an isometric look means to have a kind of a 3D perspective, the player can be behind or in front of objects. So I have to come up with some code that decides whether the player is rendered behind or in front of it. I have this fridge as an example: I hope it is comprehensible what I mean with "logical collision". I have some glimpses of ideas how to achieve that but that would be a mess in the code. So I wanted to ask if anyone has experiences with that or can hand me some nice sources that can help me. Thanks for reading!
tagged with: java
has answer: http://stackoverflow.com/a/75460199
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41943180
has comment: http://stackoverflow.com/comment/133141564
has title: How to implement a logical render order of isometric tiles?
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41942188
tagged with: isometric
favorite count: 0

http://stackoverflow.com/comment/41837269
comment on: http://stackoverflow.com/a/26611309
type: AnswerComment
score: 0
type: Comment
has text: That actually seems to work for me (though the mouse location is wrong). JDK 1.8.0_20 on Mac OS X 10.9.5. Once you start dealing with DnD outside the bounds of the JavaFX window, it is probably invoking native code and may be platform dependent.

http://stackoverflow.com/comment/41945126
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26557659
type: QuestionComment
has text: ...also, your "grayscale# sample file has `PhotometricInterpretation` 3, which means it is indexed color (palette), not really a grayscale image. It contains a 256 color `ColorMap`.

http://stackoverflow.com/comment/51140073
type: Comment
has text: Clarification: "(which is guaranteed to be assigned and initialized per the requirements of synchronized)", means that by the time the lock is released, the object is guaranteed to be assigned and initialized. The order of which that happens inside of the synchronized block is non-deterministic, per the JMM. To further clarify, your example does fall prey to that, but also falls prey to my initial example (which is irrelevant of the the JMM, but knowing how the JMM handles this will alleviate your 'solution' to that problem, which the link I posted details why it won't work).
comment on: http://stackoverflow.com/q/26647814
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41683395
comment on: http://stackoverflow.com/a/26524722
score: 0
type: AnswerComment
has text: There's nothing to share really, that's all. This code is part of [activiti explorer](http://activiti.org/).
type: Comment

http://stackoverflow.com/q/26638162
answer count: 1
score: 0
has title: Spring: Save Logged In User Session
has comment: http://stackoverflow.com/comment/41949033
has body: I don't understand where the current logged in user is saved in the application. I want to save the user (after his login) in my spring application. I use Spring Security and already read about the SecurityContextHolder but the problem is I have a custom user class, which is saved in a mongodb. I could query the user from the database after login (check the password and so on), but what are the next steps? Greetings Chryb EDIT: My bigger question is how I should combine my user repository with my login? EDIT: Look at my other question for more details here
tagged with: authentication
tagged with: spring
accepted answer: http://stackoverflow.com/a/26678578
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26678578
type: Question
tagged with: mongodb
linked to: http://stackoverflow.com/q/20349594

http://stackoverflow.com/q/26655820
type: Question
has body: How can I split string by this sequence of characters ".."? string.split("\\..") does not work and neither does string.split("\\.\\.")
accepted answer: http://stackoverflow.com/a/26655863
tagged with: java
tagged with: split
upvote count: 0
has comment: http://stackoverflow.com/comment/41914205
answer count: 1
favorite count: 0
score: -3
has answer: http://stackoverflow.com/a/26655863
has comment: http://stackoverflow.com/comment/41914223
tagged with: regex
has comment: http://stackoverflow.com/comment/41914235
type: AnsweredQuestion
has title: Split string by double dot ".." in java
downvote count: 3

http://stackoverflow.com/comment/41703368
has text: @EJP: I was five years old in 1960; I started programming a little before Algol-68, which was my first exposure to Algol. I'm pretty sure that was typeset; I can't vouch for Algol-60. But I do remember when manpages did bolding by overtyping twice, so typewriters and bold are not incompatible. Italics, on the other hand, require a replaceable typeball. Or a pair of pliers.
comment on: http://stackoverflow.com/q/26537890
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26521350
type: UnansweredQuestion
has body: I have test class which ends with IT i.e SampleClassIT.java. I have added this class in testng.xml file and used maven-failsafe plugin in pom.xml file. Plugin used :- org.apache.maven.plugins maven-failsafe-plugin 2.17 integration-test verify Is there any way ,so that all the classes which are not extended with IT can also run as a part of integration tests because i have more that 100 classes that i need to refactor them.I dont need to extend my classes with **/*IT.java and make them run as integration tests using failsafe plugin.
has comment: http://stackoverflow.com/comment/41675616
tagged with: pom.xml
score: -1
tagged with: testng
favorite count: 0
has title: How to do integration tests which do not ends with **/**IT
type: Question
tagged with: maven
tagged with: java
downvote count: 1
upvote count: 0
has answer: http://stackoverflow.com/a/26521440
answer count: 1

http://stackoverflow.com/comment/41866967
has text: Hi @khmarbaise I have found the problem. I'm posting it. Thanks for trying to help.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26620165
type: QuestionComment

http://stackoverflow.com/comment/41955337
type: AnswerComment
comment on: http://stackoverflow.com/a/26633016
has text: Note that sufficient proof is present even without looking at the actual bytecodes. The `stack=2, locals=1, args_size=1` statement changes to `stack=2, locals=2, args_size=1` in the second case. The Java interpreter will allocate a stack frame based on the number of locals specified. Clearly, one more local is allocated in the second case.
type: Comment
score: 0

http://stackoverflow.com/comment/41927092
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26662251
score: 0
has text: Sorry, I don't understand the question... Two points cannot "intersect". But the path that the spaceship takes could intersect with the planet's orbit--is that what you mean? What is the "circle" you're referring to?

http://stackoverflow.com/a/26650479
type: Answer
has body: I've split the statement into multiple lines, improving the readability // First, the array is created, then it is stored into a variable. // At last, store the result of code below into a String[]. String str[] = // Create a two-dimensional array new String[][] { // Add the first element to the two-dimensional array, // which is in fact a String[] with one null element in it. /* element #0 */ new String[] { null }, // Add the second element to the two-dimensional array: // it's a String[] containing three strings /* element #1 */ new String[] { "a", "b", "c" }, // Then add the third element to the two-dimensional array, // which is an empty string. /* element #2 */ new String[] { new String() } } // Then get the first element of our two-dimensional array, // which returns a String[] with one null element in it. [0]; So in fact, variable str now contains a String[] with index 0 being null. At last, str[0] is printed on the screen, which was null. To answer your questions: Variable str is a one-dimensional array. The notation String str[] is very ugly and confusing; it should be String[] str. And then you can see more easily that our variable is one-dimensional. [0] means get the first element of the array (arrays always start with index 0). A certain element of a two-dimensional array is always a one-dimensional array; with other words, a two-dimensional array is an array containing arrays. So that's why String[] str = new String[][] { ... }[0] is perfectly valid. new String[] { "a", "b", "c" } creates a string array containing three strings: "a", "b" and "c". So new String[] { "a", "b", "c" }[2] would return "c". EDIT Let me explain it step by step. Step 1 — This is how we declare a String[] (a String array): String[] myArray = new String[numberOfElements]; Step 2 — We can also immediately initialize the array with values: String[] myArray = new String[] { "some value", "another value", "et cetera" }; Step 2b — We do not need to mention the number of elements, beca…
answers question: http://stackoverflow.com/q/26649327
has comment: http://stackoverflow.com/comment/41912546
score: 2
has comment: http://stackoverflow.com/comment/41911729
has comment: http://stackoverflow.com/comment/41910377
accepted answer of: http://stackoverflow.com/q/26649327
has comment: http://stackoverflow.com/comment/41919471
has comment: http://stackoverflow.com/comment/41919234
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/26553873
score: 2
tagged with: batch-processing
downvote count: 0
has title: Spring Batch configuration for running multiple jobs
favorite count: 0
tagged with: spring
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
has body: I am trying to run multiple jobs for reading from several databases and write into our Db. We just have one job now which is working fine and we have transaction manager configured to that particular datasource. Now, for running multiple jobs for reading from different Db's, how do we go about configuring job-launcher.xml as we now have multiple datasources? How would it know how these jobs should be executed and call the appropriate Transaction manager? I am new to spring batch and would appreciate any help in this regards. Thanks in advance!
type: Question
has comment: http://stackoverflow.com/comment/41730640

http://stackoverflow.com/comment/41758787
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26545530
has text: apparently `setVisible(true)` was the missing ingredient. i tried it in a small program and it worked, regardless of the panel layout :) ... it still didnt work when reading from a file. i will figure something out.. thanks a lot @TerryStorm :)
type: Comment

http://stackoverflow.com/a/26659627
type: Answer
has comment: http://stackoverflow.com/comment/62139102
has body: Deleting a file usually just involves removing its directory entry from the file system. The File delete method returns true or false based on whether you're allowed to delete a file or not. This is different from the Files.delete method which throws an IOException if it can't delete a file. Since you're not checking this return value, you don't know if the file has been deleted or not. This is important as different OSes have different rules on file deletion. For instance, Linux is perfectly happy to remove a directory entry for a file that is currently open. Hence you can still read/write a deleted file. On the other hand, Windows enforces mandatory file locking and will simply refuse to delete the file.
score: 0
answers question: http://stackoverflow.com/q/26659238

http://stackoverflow.com/comment/41719511
score: 0
comment on: http://stackoverflow.com/q/26541450
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63585/discussion-between-shruti-and-kalyan-pvs).
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26559153
answers question: http://stackoverflow.com/q/26559098
type: AcceptedAnswer
has body: An example is this: import java.util.Scanner; public class Junk { public static void main(String[] args) { Scanner Keyboard = new Scanner(System.in); System.out.print("Enter a String: "); String str = Keyboard.nextLine(); for (int i = 0; i &lt; str.length(); i++){ if (str.substring(i, i+1).equalsIgnoreCase("a")){ count++; } } System.out.println("Number of A: "+count);
type: Answer
accepted answer of: http://stackoverflow.com/q/26559098
score: 0

http://stackoverflow.com/comment/41767372
comment on: http://stackoverflow.com/a/26570426
score: 0
type: AnswerComment
type: Comment
has text: @Marco13 As I wrote in the question, `setColor`+`fillRect` does nothing (at least in my case) if you set the color to something fully transparent, so that's **not** an option, but `setBackground`+`clearRect` **does** work! Awesome! +1

http://stackoverflow.com/comment/41804786
type: QuestionComment
comment on: http://stackoverflow.com/q/26595051
has text: your setVisibility method should be outside if(convertView == null) body.
score: 1
type: Comment

http://stackoverflow.com/a/26596435
has comment: http://stackoverflow.com/comment/41808129
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26596285
accepted answer of: http://stackoverflow.com/q/26596285
has comment: http://stackoverflow.com/comment/41807961
has body: You should have custom ActionBar style in your theme. I think ActionBar Style Generator also creates a theme already. What you should do is to add something like below into your theme.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26557185
type: Question
has comment: http://stackoverflow.com/comment/41736141
has body: My program is suppose to check one word per line for vowels; however It does not count the the vowel if it is the last letter in the word or if the vowel is 'o' I have been staring at this for hours. Any help would be great. import java.util.*; public class Vowel { public static void main(String[] args) { String word; int len; int position; int vowelCount; char ch; Scanner kbd = new Scanner(System.in); word = kbd.next(); while (!word.equals("the_end")) { len = word.length() - 1; vowelCount = 0; for (position = 0; position &lt; len-1; position++) { ch = word.charAt(position); if ((ch == 'a') || (ch == 'e') || (ch == 'i') || (ch == 'o') || (ch == 'u')) vowelCount++; } System.out.print("There "); if (vowelCount == 1) System.out.print ("is 1 vowel in "); else System.out.print("are " + vowelCount + " vowels in "); System.out.println(word); word = kbd.next(); } } } I'm now trying with for (position = 0; position &lt; word.length(); position++)
tagged with: if-statement
score: -2
has comment: http://stackoverflow.com/comment/41736064
has comment: http://stackoverflow.com/comment/41736150
has comment: http://stackoverflow.com/comment/41736024
downvote count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41736007
answer count: 3
has comment: http://stackoverflow.com/comment/41736088
has answer: http://stackoverflow.com/a/26557207
tagged with: string
has answer: http://stackoverflow.com/a/26557296
has comment: http://stackoverflow.com/comment/41736279
favorite count: 0
has title: 'o' and last vowel in user input are not found
tagged with: while-loop
has comment: http://stackoverflow.com/comment/41736023
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26557210
upvote count: 0
has comment: http://stackoverflow.com/comment/41735960
has comment: http://stackoverflow.com/comment/41735721
tagged with: java
has comment: http://stackoverflow.com/comment/41735959
has comment: http://stackoverflow.com/comment/41736376

http://stackoverflow.com/comment/41857887
comment on: http://stackoverflow.com/q/26624036
type: Comment
type: QuestionComment
score: 0
has text: is it showing some error or you just don't know where to deploy?

http://stackoverflow.com/a/26608610
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26608232
has body: Here the code, try this public class arrayformat { public static void main(String[] s) { int[] array = {1,2,3,4,5}; int temp = array[4]; for(int i=array.length-1;i&gt;0;i--) { array[i]=array[i-1]; } array[0]= temp; for(int i=0;i&lt;array.length;i++) { System.out.println(array[i]); } } }
answers question: http://stackoverflow.com/q/26608232

http://stackoverflow.com/comment/41667555
comment on: http://stackoverflow.com/a/26519047
has text: Thanks! Any way to have it so that a `getResource` call still has to include the "/resources/xxxxxx.png" because this method seems to simply put it at "root" (i.e. `getResource("xxxx.png")` instead of `getResource("/resources/xxxx.png")`)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41683169
has text: Sorry, I meant set! :)
type: AnswerComment
comment on: http://stackoverflow.com/a/26526114
score: 0
type: Comment

http://stackoverflow.com/q/26536599
favorite count: 0
has body: So I have this HashMap: HashMap&lt;String,HashMap&lt;Float,HashMap&lt;Float,String&gt;&gt;&gt; But I'm not to sure how to add and remove elements from the most deeply nest structure. Can someone give an example? Thanks :) Update: Thanks for the help, But how can I just put on the first level of the HashMap? I have tried .put and I am getting an error. Thanks
upvote count: 2
answer count: 5
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41699036
tagged with: hashmap
tagged with: java
possible better answer: http://stackoverflow.com/a/41618961
has comment: http://stackoverflow.com/comment/41699088
has answer: http://stackoverflow.com/a/41618961
type: Question
has answer: http://stackoverflow.com/a/26536642
has answer: http://stackoverflow.com/a/26536648
downvote count: 0
has answer: http://stackoverflow.com/a/26552975
has title: Accessing Deeply nested HashMaps in Java
accepted answer: http://stackoverflow.com/a/26552975
has answer: http://stackoverflow.com/a/26536667

http://stackoverflow.com/q/26553921
answer count: 1
has title: hide state parameter across recursive methods in different classes
has comment: http://stackoverflow.com/comment/41732402
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26554921
has comment: http://stackoverflow.com/comment/41730253
tagged with: java
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/41731648
type: Question
tagged with: recursion
tagged with: oop
score: 0
has body: I have a method "doA" in class A that calls method "doB" in class B, which calls again "doA". A map is passed as an argument in every call, which changes in "doB". That map is needed through all recursive calls, but that's part of the state of a particular implementation, although I actually want class A to be agnostic of that state, since it won't be needed for other implementations, and surely I don't want to just move the exact same problem somewhere else. class A { public void doA(Map state) { b.doB(state) } } class B { public void doB(Map state) { if (someCondition) { a.doA(processState(state)) } } }

http://stackoverflow.com/comment/41809094
score: 0
type: Comment
type: QuestionComment
has text: You want to write "percent is"+answer into a file?
comment on: http://stackoverflow.com/q/26597347

http://stackoverflow.com/comment/41843261
has text: Okay maybe I should rephrase this I need a timer to run but with no code. so literaly just a timer block with no code I cant figure it out.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26615759

http://stackoverflow.com/q/26595887
has title: REST Error Responses and Client-Server POJO Serialization
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
tagged with: jackson
has body: Given the following POJOs: public class BaseEntity { public Long id; // ctor, getter &amp; setter } public class Widget extends BaseEntity { public String fizz; public Boolean isBuzz; // ctor, getters &amp; setters } I have the following client API for CRUDding Widget instances against a remote REST service: public class WidgetServiceClient { public void createWidget(Widget w) { // RESTful call: POST localhost/widgets } public Widget getWidgetById(Long id) { // RESTful call: GET localhost/widgets/{id} } } And the following RESTful service endpoints exposed: public class WidgetService { // Web server passes POST localhost/widgets/ calls to this method. public Widget createWidget(Widget w) { // Create the 'w' widget in the DB and return it with its DB-generated ID. } // Web server passes GET localhost/widgets/{id} calls to this method. public Widget getWidgetById(Long id) { // Ask the DB for the Widget with the passed-in 'id'. If it exist return it. // Otherwise return NULL. } } Let's pretend I've already figure out the "magic" of serializing/deserializing Widget instances to/from JSON. This design is great, except when there is a server-side Exception that I want to communicate back to the client, RESTfully. My first inclination was to modify BaseEntity to have a Throwable that could be used to communicate server-side errors back to the client-side: public class BaseEntity { public Long id; public Throwable error; // ctor, getters &amp; setters } So then: public class WidgetService { // Web server passes POST localhost/widgets/ calls to this method. public Widget createWidget(Widget w) { try { // Create the 'w' widget in the DB and return it with its DB-generated ID. } catch(Throwable t) { w.setError(t); } return w; } // Web server passes GET localhost/widgets/{id} calls to this method. public Widget getWidgetById(Long id) { Widget w = new Widget(); try { // Ask the DB for the Widget with the passed-in 'id'. If it exist return it. // Otherwise return NULL. } catch(Th…
has answer: http://stackoverflow.com/a/26601477
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26596012
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26596012
accepted answer: http://stackoverflow.com/a/26601477
favorite count: 0
tagged with: serialization
tagged with: rest
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/15185299

http://stackoverflow.com/a/26533062
has comment: http://stackoverflow.com/comment/41795396
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41797703
answers question: http://stackoverflow.com/q/26531280
has comment: http://stackoverflow.com/comment/41804904
has comment: http://stackoverflow.com/comment/41797923
accepted answer of: http://stackoverflow.com/q/26531280
score: 2
has comment: http://stackoverflow.com/comment/41797598
has comment: http://stackoverflow.com/comment/138295503
has body: Spring SAML currently doesn't support sending of encrypted AuthnRequests (or other messages sent from SP to IDP), but is by default able to decrypt messages encrypted using AES-256 sent from IDP to SP.
has comment: http://stackoverflow.com/comment/41804079
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41796333

http://stackoverflow.com/a/26581712
has body: You could make these changes to your code so you can see the panels. Change the values ​​to your requirement. mainp.getContentPane().setLayout(null); //&lt;=== New line p.setLayout(new GridLayout(10, 10)); p.setBounds(10,10,390,1300); //&lt;=== position of panel1 p.setBorder(BorderFactory.createTitledBorder("Panel1")); // border mainp.add(p); .... p2.setLayout(new GridLayout(10, 10)); p2.setBounds(400,10,380,1300); //&lt;=== position of panel2 p2.setBorder(BorderFactory.createTitledBorder("Panel2")); //border mainp.add(p2);
answers question: http://stackoverflow.com/q/26581332
type: Answer
upvote count: 0
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/41779877

http://stackoverflow.com/comment/41841090
has text: I understand your Comments. But I need to the socket to be open for sending other informations. That is the main problem. If Close the outputstream it will close the socket.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26614822

http://stackoverflow.com/comment/62324824
type: AnswerComment
has text: I appreciate your opinion but there currently is no other way and I guess we can't change the rules for default methods ;). You can have all of that in a single source file though. As it's only type declarations actually, I'd also argue that it's basically in the ballpark of tow additional methods, not types. On top of that, in a real world application you usually have quite a few query methods in the repo so that the additional code required is negligible.
type: Comment
comment on: http://stackoverflow.com/a/26563841
score: 0

http://stackoverflow.com/q/26645170
score: 0
answer count: 1
has title: Source folder in eclipse
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26645338
has body: I have imported the hadoop source code as Java project in Eclipse and in that package names are treated as folders. But when I tried it to run it, it throws "could not find main class". How to change the structure or how to run it?
type: Question
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/26554892
accepted answer of: http://stackoverflow.com/q/26538704
upvote count: 12
downvote count: 0
answers question: http://stackoverflow.com/q/26538704
has comment: http://stackoverflow.com/comment/41764788
has comment: http://stackoverflow.com/comment/61737906
score: 12
type: AcceptedAnswer
type: Answer
has body: I used this code and now it's working: Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.chicken);//your image ByteArrayOutputStream bYtE = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, bYtE); bmp.recycle(); byte[] byteArray = bYtE.toByteArray(); String imageFile = Base64.encodeToString(byteArray, Base64.DEFAULT);

http://stackoverflow.com/comment/41842742
has text: Do you specifically want the terminal window? If so you will probably want to launch it with an argument which specifies an initial command to run. Otherwise, you can more efficiently just launch the command directly.
comment on: http://stackoverflow.com/q/26615659
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26670997
has answer: http://stackoverflow.com/a/26671435
has answer: http://stackoverflow.com/a/26671232
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41942499
has comment: http://stackoverflow.com/comment/41942593
has body: I have this object Date in this format : 2014-05-20 18:17:26.337 I try to do this: Calendar c = Calendar.getInstance(); c.setTime(myDate); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); int dayOfMonth = c.get(Calendar.DAY_OF_MONTH); int Month = c.get(Calendar.MONTH); int year = c.get(Calendar.YEAR); But the information are wrong.. How I can resolve it?
tagged with: java
has comment: http://stackoverflow.com/comment/41942838
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/41942418
tagged with: date
possible better answer: http://stackoverflow.com/a/26671435
has title: How to Extrapolate information by date in Java
has comment: http://stackoverflow.com/comment/41942466
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26671427
has answer: http://stackoverflow.com/a/26671427
has comment: http://stackoverflow.com/comment/41942837

http://stackoverflow.com/a/59638092
upvote count: 15
downvote count: 0
answers question: http://stackoverflow.com/q/26637550
score: 15
has body: On Amazon Linux 2 AMI: List extra packages (you will see tomcat8 versions): $ amazon-linux-extras list Install extra packages: $ sudo amazon-linux-extras install tomcat8.5 Start tomcat service: $ sudo systemctl start tomcat Create index file: $ cd /usr/share/tomcat/webapps $ sudo mkdir ROOT $ cd ROOT/ $ sudo vi index.html #add some HTML content Next you could view your site at localhost:8080
type: Answer

http://stackoverflow.com/q/26602593
has body: I have hibernate which goes something like this. String queryString = "from MFunction as mFunction where mFunction.functionKey in " + "((select mRole.enterprise from MRole as mRole where mRole.roleKey=:role), " + "(select mRole2.project from MRole as mRole2 where mRole2.roleKey=:role ), " + "(select mRole3.technology from MRole as mRole3 where mRole3.roleKey=:role ))"; But the hibernate query takes in only the first value. Hibernate: select mfunction0_.FunctionKey as Function1_73_, mfunction0_.`Add` as Add2_73_, mfunction0_.`Audit` as Audit3_73_, mfunction0_.ClientKey as ClientKey73_, mfunction0_.CreatedBy as CreatedBy73_, mfunction0_.CreatedTs as CreatedTs73_, mfunction0_.`Delete` as Delete7_73_, mfunction0_.`Edit` as Edit8_73_, mfunction0_.`Financial` as Financial9_73_, mfunction0_.FunctionName as Functio10_73_, mfunction0_.`General` as General11_73_, mfunction0_.Level as Level73_, mfunction0_.LevelKey as LevelKey73_, mfunction0_.LogicalDeleteTms as Logical14_73_, mfunction0_.UpdatedBy as UpdatedBy73_, mfunction0_.UpdatedTs as UpdatedTs73_, mfunction0_.`View` as View17_73_ from appanalytixdb.M_Function mfunction0_ where mfunction0_.FunctionKey in (select mrole1_.Enterprise from appanalytixdb.M_Role mrole1_ where mrole1_.RoleKey=?) Hibernate version: 4.1.8.Final
type: Question
answer count: 1
has title: HQL not working "in" with multiple values
score: 0
accepted answer: http://stackoverflow.com/a/26602708
has comment: http://stackoverflow.com/comment/41821189
linked to: http://stackoverflow.com/q/201023
has answer: http://stackoverflow.com/a/26602708
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/26522123
has body: I'm not yet sure why you're getting that particular error, but the problem is that your method declares that it will return Collection&lt;T&gt;, but you're trying to assign the result to a List&lt;T&gt;. If you change the declaration of filter to: public static &lt;T&gt; List&lt;T&gt; filter(Collection&lt;T&gt; collection, Filter&lt;T&gt; filter) ... then it compiles with no problems.
has comment: http://stackoverflow.com/comment/41673152
answers question: http://stackoverflow.com/q/26522005
downvote count: 0
has comment: http://stackoverflow.com/comment/41672992
accepted answer of: http://stackoverflow.com/q/26522005
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41673023
type: Answer
has comment: http://stackoverflow.com/comment/41673387
score: 7
upvote count: 7

http://stackoverflow.com/comment/41747971
has text: Your right. But how can i do this. Im trying to figured out, but no luck.
comment on: http://stackoverflow.com/q/26564144
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41929245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26663399
score: 0
has text: It is in this case. A stream can only consist of one type, so in this case the type must be `R[]`. There is no exception.

http://stackoverflow.com/comment/79440016
type: Comment
comment on: http://stackoverflow.com/q/26528360
score: 0
has text: You're misunderstanding what is meant by "multiple inheritance". Multiple inheritance means a class directly extends multiple classes. This can lead to issues like the diamond issue, which cannot occur with single inheritance.
type: QuestionComment

http://stackoverflow.com/q/26552848
tagged with: maven
accepted answer: http://stackoverflow.com/a/26553546
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26553546
has body: I want to install an artifact to ~/.m2 and use that in another repo, but failing on latter. 1) I build apache-spark with command mvn clean install which gives me a jar spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar inside their spark/assembly/target/scala2.10 folder $ ls -l assembly/target/scala2.10/ total 12 drwxrwxr-x 2 prayagupd prayagupd 4096 Oct 24 16:52 ./ drwxrwxr-x 6 prayagupd prayagupd 4096 Oct 24 16:52 ../ -rw-rw-r-- 1 prayagupd prayagupd 3117 Oct 24 16:52 spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar Looks there are no classes within the jar, $ jar tvf spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar 0 Sat Oct 25 03:31:14 NPT 2014 META-INF/ 133 Sat Oct 25 03:31:14 NPT 2014 META-INF/MANIFEST.MF 0 Sat Oct 25 03:31:14 NPT 2014 org/ 0 Sat Oct 25 03:31:14 NPT 2014 org/apache/ 0 Sat Oct 25 03:31:14 NPT 2014 org/apache/spark/ 0 Sat Oct 25 03:31:14 NPT 2014 org/apache/spark/unused/ 318 Sat Oct 25 03:31:14 NPT 2014 org/apache/spark/unused/UnusedStubClass.class 0 Sat Oct 25 03:31:14 NPT 2014 META-INF/maven/ 0 Sat Oct 25 03:31:14 NPT 2014 META-INF/maven/org.spark-project.spark/ 0 Sat Oct 25 03:31:14 NPT 2014 META-INF/maven/org.spark-project.spark/unused/ 2356 Sat Oct 25 03:31:14 NPT 2014 META-INF/maven/org.spark-project.spark/unused/pom.xml 114 Sat Oct 25 03:31:14 NPT 2014 META-INF/maven/org.spark-project.spark/unused/pom.properties 0 Sat Oct 25 03:31:14 NPT 2014 META-INF/NOTICE 2) Now, I want to use that spark-assembly-1.2.0-SNAPSHOT jar as mvn dependency to another project. So, I installed that file in local maven as $ mvn -X install:install-file -Dfile=spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar -DgroupId=org.apache.spark -DartifactId=spark-assembly -Dversion=1.2.0-SNAPSHOT -Dclassifier=javadoc -Dpackaging=jar -DgeneratePom=true That gave me ~/.m2/repository/org/apache/spark/spark-assembly as $ ll ~/.m2/repository/org/apache/spark/spark-assembly/1.2.0-SNAPSHOT/ total 24 drwxrwxr-x 2 prayagupd prayagupd 4096 Oct 24 23:14 ./ drwxrwxr-x 3 prayagupd prayagupd 4096 Oct …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41728637
has comment: http://stackoverflow.com/comment/41727951
has title: Could not find artifact after mvn install:install-file
type: Question

http://stackoverflow.com/q/26590234
has body: I have and array where I create few swords on the tiled map and when i step on them they need to be deleted but when I step on them game chrashes. at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) MY CODE: I guess the loop is looking for the object even if its deleted? private List&lt;Sword&gt; swords = new ArrayList&lt;Sword&gt;(); I create them one time: public GameRender(GameWorld world, int gameHeight) { for (int i = 0; i&lt;100 ; i++ ) { swords.add(new Sword()); } When i step on it: for (Sword sword : swords) { if(playery+7&gt;=sword.position.y &amp;&amp; playery+7&lt;=sword.position.y+tilesize &amp;&amp; playerx+7&gt;=sword.position.x &amp;&amp;playerx+7&lt;=sword.position.x+tilesize) { sword.pickMe(); swords.remove(sword); } } There is other loop in render(): for (Sword sword : swords) { sword.createMe(); } I dont think you need to see the Sword class. If you do i'll put it in here. How do i fix it so I dont get the error?
answer count: 1
has comment: http://stackoverflow.com/comment/41795454
has comment: http://stackoverflow.com/comment/41795415
has answer: http://stackoverflow.com/a/26590326
accepted answer: http://stackoverflow.com/a/26590326
type: AnsweredQuestion
tagged with: java
has title: Removing something from array but game crashes
type: Question
has comment: http://stackoverflow.com/comment/41795229
tagged with: libgdx
tagged with: arrays
score: 0

http://stackoverflow.com/comment/41943896
type: Comment
comment on: http://stackoverflow.com/a/26671628
has text: Yes, that's the general idea of unit testing : you get a unit of code to execute with known inputs, and you compare the "actual" result (what your code under test returns) to the "expected" result (the one you know.) In case of Strings, it is actually pretty easy, since Java has comparison built-in. Mocks are helpfull when it's difficult to build the inputs, or when you need to test code that has side-effects that can not be simulated. When you're a bit more confortable with unit tests, see http://martinfowler.com/articles/mocksArentStubs.html for *much* more details.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26588005
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
tagged with: testng
accepted answer: http://stackoverflow.com/a/26588272
has comment: http://stackoverflow.com/comment/41791062
tagged with: annotations
has body: i don't know if my question was clear, but i am using testNG and i have this: @Test public void passengerServiceTest() { ... } @AfterTest public void deleteCreatedPassenger() { ... } I want to execute my deleteCreatedPassenger() method after passengerServiceTest, also, i want that in case of deleteCreatedPassenger fails, passengerServiceTest fails too, in other words, i want that both of them be the same test, so if one them fails, test fails. So i tried with the annotations @AfterTest, @AfterMethod, @AfterClass and all make two tests as "separated" tests. Do you know how to do this? Regards
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/74893799
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/74893799
tagged with: testing
has title: testNG annotation which would equal to "finally" in java?
has answer: http://stackoverflow.com/a/26588272
score: 4

http://stackoverflow.com/a/26672602
type: Answer
score: 8
has body: Finally I solved my issue with the help of apache commons library. First I added the following dependency. commons-codec commons-codec 1.6 jar The technique that I was using previously was wrong for me (Not sure for other). Following is the solution how I solved my problem. Solution: I added byte array value previously on JSONObject and stored as String. When I tried to get from JSONObject to my byte array it returned String not my original byte array. And did not get the original byte array even I use following: byte[] bArray=jSONObject.getString(key).toString().getBytes(); Now, First I encoded my byte array into string and kept on JSONObject. See below: byte[] bArray=(myByteArray); //Following is the code that encoded my byte array and kept on String String encodedString = org.apache.commons.codec.binary.Base64.encodeBase64String(bArray); jSONObject.put(JSONConstant.BYTE_ARRAY_LIST , encodedString); And the code from which I get back my original byte array: String getBackEncodedString = jSONObject.getString(JSONConstant.BYTE_ARRAY_LIST); //Following code decodes to encodedString and returns original byte array byte[] backByte = org.apache.commons.codec.binary.Base64.decodeBase64(getBackEncodedString); //Creating pdf file of this backByte FileCreator.createPDF(backByte, "fileAfterJSONObject.pdf"); That's it.
answers question: http://stackoverflow.com/q/26650225
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26650225
upvote count: 8

http://stackoverflow.com/q/26634926
has answer: http://stackoverflow.com/a/26634975
tagged with: java
has body: Lots of times I see people naming their methods a(), b(), c(), etc. instead of giving them names that describe what the method actually does. What is the point of this?
has comment: http://stackoverflow.com/comment/41877763
has answer: http://stackoverflow.com/a/26634961
score: 0
has answer: http://stackoverflow.com/a/26635081
has answer: http://stackoverflow.com/a/26634967
has answer: http://stackoverflow.com/a/26635272
favorite count: 0
has comment: http://stackoverflow.com/comment/41877424
has title: Naming methods a, b, c, etc
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41877814
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41877585
has comment: http://stackoverflow.com/comment/41877447
type: Question
has comment: http://stackoverflow.com/comment/41878360

http://stackoverflow.com/comment/41757746
comment on: http://stackoverflow.com/a/26569397
score: 0
type: Comment
has text: YUp i edited the code.See the problem is it is not taking the determined number of strings.
type: AnswerComment

http://stackoverflow.com/a/26615324
type: AcceptedAnswer
downvote count: 0
has body: You cannot reliably prevent other applications from reading a row locked by one application. Queries running with the uncommitted read isolation level will be able to access even exclusively locked rows. Queries running with the cursor stability isolation level using the currently committed semantics will access the previous version of the exclusively locked row. I think your best choice is to use a special value (like 'processing') in the status column to prevent other sessions from processing the same row.
accepted answer of: http://stackoverflow.com/q/26583927
answers question: http://stackoverflow.com/q/26583927
type: Answer
score: 2
upvote count: 2

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/26580335

http://stackoverflow.com/a/26543022
type: Answer
answers question: http://stackoverflow.com/q/26542716
score: 2
accepted answer of: http://stackoverflow.com/q/26542716
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You need a loop: List&lt;String&gt; names = new ArrayList&lt;&gt;(); for (ClassTwo c2 : contactList) { names.add(c2.getName()); } or, in Java 8: List&lt;String&gt; names = contactList.stream() .map(ClassTwo::getName) .collect(Collectors.toList());

http://stackoverflow.com/a/26619453
has comment: http://stackoverflow.com/comment/41851160
has comment: http://stackoverflow.com/comment/41850186
has comment: http://stackoverflow.com/comment/41850627
has comment: http://stackoverflow.com/comment/41850160
has comment: http://stackoverflow.com/comment/41864510
upvote count: 9
has comment: http://stackoverflow.com/comment/100226921
has comment: http://stackoverflow.com/comment/41851553
has comment: http://stackoverflow.com/comment/41850420
has comment: http://stackoverflow.com/comment/41850009
type: Answer
has body: The following pattern in utility classes also provides ironclad guarantee that there can be no instances: public abstract class Util { private Util() { throw new Error(); } ... // static methods } Besides, you have no additional irrelevant static methods, provided by enums.
has comment: http://stackoverflow.com/comment/41865563
answers question: http://stackoverflow.com/q/26618890
downvote count: 0
has comment: http://stackoverflow.com/comment/41849857
score: 9
has comment: http://stackoverflow.com/comment/41856123
has comment: http://stackoverflow.com/comment/41852755

http://stackoverflow.com/comment/41897478
has text: You just said, you are downvoter.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26629347

http://stackoverflow.com/comment/41727254
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your answer, but after i paste this code into my code. I have to override 1 method (connect). Am i supposed to add ucon.addRequestProperty("x-api-key", apiKey); inside this method? or is it to late and has there already been an connection established?
comment on: http://stackoverflow.com/a/26552466

http://stackoverflow.com/q/26633447
score: 0
has body: i want to make a JSONObject in java. But when i do this : this.client.put("applicationid", "MOBEGUARD" + '/' + "ANDROID"+ '/'+ android.os.Build.VERSION.RELEASE); but the result is : "MOBEGUARD\/ANDROID\/4.4.2" and i want : "MOBEGUARD/ANDROID/4.4.2" Plz let me know if there is an easy solution to do that. Thanks.
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41874695
answer count: 0
has comment: http://stackoverflow.com/comment/41874763
tagged with: java
has comment: http://stackoverflow.com/comment/41875047
has comment: http://stackoverflow.com/comment/41874691
has title: JAVA add a \ before all my /
type: Question
has comment: http://stackoverflow.com/comment/41874771

decimal
tags question: http://stackoverflow.com/q/26621632
tag name: decimal
tags question: http://stackoverflow.com/q/26557213
type: Tag

http://stackoverflow.com/comment/41904688
comment on: http://stackoverflow.com/q/26641489
type: Comment
type: QuestionComment
has text: @iforce2d having private ContactListener is no problem, it is the interface. I read your comment as "use private MyContanctListener" and it would work.
score: 0

http://stackoverflow.com/a/29460107
answers question: http://stackoverflow.com/q/26620765
downvote count: 0
score: 21
type: Answer
has body: In Android Studio: Open Avd manager Edit the settings for the AVD configuration Click in the "Show Advanced Settings" In the "Memory and Storage" section reduce the RAM size
upvote count: 21

http://stackoverflow.com/comment/41764244
type: Comment
type: QuestionComment
has text: thanks for the prompt response. I added use-default-filters="false" to context:component-scan base-package="package to scan" , but I still see the same initialization twice in the log.
comment on: http://stackoverflow.com/q/26571262
score: 0

http://stackoverflow.com/comment/41787521
has text: Just an off-note: I suggest doing `Integer.parseInt(scannerObj.nextLine())` instead of `scannerObj.nextInt()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26586114
score: 2

http://stackoverflow.com/comment/41782464
comment on: http://stackoverflow.com/a/26582553
has text: @Sergey I assume it is necessary to wait when queue is empty or full.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/26563008
type: Question
upvote count: 1
tagged with: sqlite
answer count: 1
has title: Converting SQLite database to csv
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv
tagged with: android
tagged with: android-sqlite
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26563136
accepted answer: http://stackoverflow.com/a/26563136
has body: I have been trying to export the SQLite database column values to a log.csv file. So far I have come to a point where, file is exported however without any kind of data. After the method is executed I recieve a java.lang.NullPointerException on a row where rawQuery is executed. Can somebody please assist me on this matter. thank you for your time, view, and answer on this issue in advance. Code for database: public class happinessDb extends SQLiteOpenHelper { public static final String KEY_ROWID = "_id"; public static final String KEY_DATE = "date"; public static final String KEY_TIME = "time"; public static final String KEY_HAPPY = "happy"; public static final String KEY_NORMAL = "normal"; public static final String KEY_SAD = "sad"; public static final String DATABASE_NAME = "happinesMeter"; public static final String DATABASE_TABLE = "practiceReport"; public static final int DATABASE_VERSION = 2; private DbHelper ourHelper; private final Context ourContext; private SQLiteDatabase ourDatabase; private static class DbHelper extends SQLiteOpenHelper{ public DbHelper (Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_DATE + " TEXT NOT NULL, " + KEY_TIME + " TEXT NOT NULL, " + KEY_HAPPY + " TEXT NOT NULL, " + KEY_NORMAL + " TEXT NOT NULL, " + KEY_SAD + " TEXT NOT NULL);" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE); onCreate(db); } } public happinessDb(Context c){ //Error ourContext = c; } public happinessDb open() throws SQLException{ ourHelper = new DbHelper(ourContext); ourDatabase = ourHelper.getWritableDatabase(); return this; } public void close(){ ourHelper.close(); } method for converting the database: public boolean convertHappiness() { String FILENAME = "log.csv"; File directoryD…
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26577575
has answer: http://stackoverflow.com/a/26584032
tagged with: java
tagged with: javadoc
accepted answer: http://stackoverflow.com/a/26605900
has comment: http://stackoverflow.com/comment/41785695
type: Question
has answer: http://stackoverflow.com/a/26598942
downvote count: 0
has body: My project can generate some additional help files automatically from the source code. How do I have maven install these files into the generated JavaDoc package? I couldn't fingure out how to have Maven: run some class to generate the additional documentation, e.g. compile and launch src/main/java/mypackage/ListOptions.java aka mypackage.ListOptions to produce a list of all available options/modules/examples/etc. . install the output files (I only could get Maven to install files from src/main/javadoc/resources into the site/apidocs/resources subfolder; but I want this documentation to live in the top level site/apidocs folder; more precisely I don't care about the site part at all, but about having a complete documetation in mypackage-0.1.0-SNAPSHOT-javadoc.jar; including non-Javadoc-generated auxillary information linked from javadoc). Minimal example - Plugin configuration for maven: org.apache.maven.plugins maven-javadoc-plugin 2.9.1 attach-javadocs jar true Directory layout: ./pom.xml ./src/main/java/foobar/GenerateNonstatic.java ./src/main/javadoc/staticfile.js ./src/main/javadoc/resources/insubfolder.png mvn package produces: javadoc in ./target/apidocs and ./target/foobar-0.0.1-SNAPSHOT-javadoc.jar. The file target/apidocs/resources/insubfolder.png ends up in folder target/apidocs/resources (and the .jar), but the staticfile.js is not installed. How to run GenerateNonstatic.java to have the output included in the javadoc .jar is unclear to me. I don't see a hook to have exec:exec it run after javadoc, and before ./target/foobar-0.0.1-SNAPSHOT-javadoc.jar is built...
has comment: http://stackoverflow.com/comment/41802964
possible better answer: http://stackoverflow.com/a/26603555
has answer: http://stackoverflow.com/a/26605900
favorite count: 0
has answer: http://stackoverflow.com/a/26603555
has title: Maven and JavaDoc: install additional (generated) files
score: 6
tagged with: maven
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/41785291
type: AnsweredQuestion

http://stackoverflow.com/comment/41844123
type: Comment
score: 0
has text: @Mr.Polywhirl yes, you are right, minor change, just did it
type: AnswerComment
comment on: http://stackoverflow.com/a/26616414

http://stackoverflow.com/a/26615407
downvote count: 0
answers question: http://stackoverflow.com/q/26579820
type: Answer
has body: Just found a solution how you can tap into the lifecycle of the ConstraintValidator. See: http://beanvalidation.org/1.0/spec/#constraintsdefinitionimplementation-validationimplementation Chapter 2.5. The ConstraintValidatorFactory might help you. If you register a ConstraintValidatorFactory in e.g. your Activator then you can supply it with the SlingRepository. The factory can then forward the SlingRepository to the Validator it creates. So you can keep the OSGi logic out of the Validator.
score: 1
upvote count: 1

http://stackoverflow.com/q/26575669
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26575715
has answer: http://stackoverflow.com/a/26577171
accepted answer: http://stackoverflow.com/a/26577171
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41768988
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/26575697
score: 0
has comment: http://stackoverflow.com/comment/41769009
answer count: 3
has body: I have a simple code that needs to connect to a mysql DB and execute a query. try { conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&amp;password=1234"); Statement stm = conn.createStatement(); stm.executeQuery(query); return true; This code works like a charm in a test project with only a class with void main. But in my project that is a web application, I'm using apache tomcat and the same code displays the error: SQLException: No suitable driver found for jdbc:mysql://localhost/test?user=root&amp;password=1234 I've added the jar, the classpath the everything. Is there something special that I need to do because I'm using tomcat? Thanks, Dragos
linked to: http://stackoverflow.com/q/22384710
has answer: http://stackoverflow.com/a/26575697
has comment: http://stackoverflow.com/comment/41768991
has title: Connecting to a MySQL DataBase with JDBC
tagged with: jdbc

http://stackoverflow.com/a/26624599
has body: First and foremost, you need to configure a datasource (I used mysql database). My JBoss was installed under C:\jboss-eap-6.3\ and I used windows operating system. Steps: 1. Create a directory structure com\mysql\main under C:\jboss-eap-6.3\modules. You will end up with C:\jboss-eap-6.3\modules\com\mysql\main directory structure. 2. Create an xml file module.xml in this main directory. Additionally drop mysql driver jar mysql-connector-java-5.1.23-bin.jar in the same directory. In the the end you will have module.xml and mysql-connector-java-5.1.23-bin.jar in C:\jboss-eap-6.3\modules\com\mysql\main. 3. Copy the following xml content to module.xml <?xml version="1.0" encoding="UTF-8"?> <resource-root path="mysql-connector-java-5.1.23-bin.jar"/> 4. Locate the file standalone.xml in C:\jboss-eap-6.3\standalone\configuration directory. Open this file with your favorite text editor. Locate the datasource subsystem i.e. this line <subsystem xmlns="urn:jboss:domain:datasources:1.2">. Add the xml fragment below under the drivers element. com.mysql.jdbc.Driver Add the xml fragment below under datasources element: jdbc:mysql://localhost:3306/databaseName mysqlDriver root databasepassword At this point you are done with datasource configuration. Next is to configure your persistence.xml and applicationContext.xml. persistence.xml .. applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.…
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/26624036
accepted answer of: http://stackoverflow.com/q/26624036
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/comment/41847005
has text: the whole `With what letter do you wish to replace it?` does not need to be in the loop
comment on: http://stackoverflow.com/a/26617826
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41915990
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26656439
has text: user489041, could you be more precisely and write answer?
type: Comment

http://stackoverflow.com/comment/41682683
has text: Suppose you gave them a different value. Now take some other pair of numbers, and do the same, and so on. Clearly you'd end up needing more than 256 different bytes, which is by definition impossible.
comment on: http://stackoverflow.com/q/26521150
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41808836
type: AnswerComment
comment on: http://stackoverflow.com/a/26596500
score: 0
type: Comment
has text: Runnable method: while (running) { render();

http://stackoverflow.com/q/26609356
answer count: 2
has title: Is "class" is predefined class in Java?
possible better answer: http://stackoverflow.com/a/26609435
favorite count: 0
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/26609451
score: -1
accepted answer: http://stackoverflow.com/a/26609451
tagged with: class
has body: Can we say that java.lang.Class is predefined class in Java? I am really confused on this.. I am new to Java so I am not sure. So please let me know the correct answer.
has answer: http://stackoverflow.com/a/26609435

http://stackoverflow.com/comment/41879356
has text: How are you calling that AsyncTask? strictmode error usually means android is trying to execute a network requets in its main thread.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26635649
score: 0

http://stackoverflow.com/comment/41859111
comment on: http://stackoverflow.com/a/26618485
type: AnswerComment
score: 0
type: Comment
has text: Expanded on my answer.

wear-os
tags question: http://stackoverflow.com/q/26610636
tags question: http://stackoverflow.com/q/26597486
tags question: http://stackoverflow.com/q/26562840
tags question: http://stackoverflow.com/q/26619770
type: Tag
tag name: wear-os

http://stackoverflow.com/a/28887664
has body: I am getting the same error since JRE 1.8.0_31 on a single Win7 machine using PDFRenderer. The suggestions with Class.forName did not fix it. However I could find another trick: By placing the following code at the top of the main method, the error did vanish: try { ColorSpace.getInstance(ICC_ColorSpace.CS_sRGB).toRGB(new float[]{0, 0, 0}); } catch (Exception e) { e.printStackTrace(); } Hopefully, this will help others as well. So far I cannot confirm, if this hack solves the problem in any case. The problem seems to be related with lazy instantion in the current versions of OpenJDK.
upvote count: 3
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26535842

http://stackoverflow.com/q/26533802
tagged with: android
has answer: http://stackoverflow.com/a/26533907
score: -1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26533901
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26533907
possible better answer: http://stackoverflow.com/a/26533901
tagged with: java
answer count: 2
upvote count: 0
has title: Create a list when clicked on an imagebutton
favorite count: 0
has body: hey guys this is arjun narahari i m experiencing a problem while creating a list when clicked on an imagebutton need some assistance from u guys posting the code down here This is my homepage.java where my imagebutton is at the topright package com.nb.list; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageButton; import android.widget.ListView; public class HomePage extends Activity { ImageButton stats; ListView lv; String[] info = { "Mary(Wife)", "Alex(child-1)", "Steven(child-2)", "Robert(Father)", "Diana(Mother)" }; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.homepage); stats = (ImageButton) findViewById(R.id.imgstts); stats.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( getBaseContext(), android.R.layout.simple_list_item_1, info); lv.setAdapter(adapter); } }); } } my list.xml file &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/RelativeLayout&gt; i m getting an error when clicked on the imagebutton , the app stops and in eclipse it shows 10-23 17:23:30.914: E/AndroidRuntime(1296): FATAL EXCEPTION: main 10-23 17:23:30.914: E/AndroidRuntime(1296): java.lang.NullPointerException 10-23 17:23:30.914: E/AndroidRuntime(1296): at com.nb.vaultHR.HomePage$5.onClick(HomePage.java:88) 10-23 17:23:30.914: E/AndroidRuntime(1296): at android.view.View.performClick(View.java:4204) 10-23 17:23:30.914: E/A…

http://stackoverflow.com/a/26598761
upvote count: 1
type: Answer
downvote count: 0
has body: It doesn't matter which class the list is contained in - the synchronization is for controlling access to reads and writes to that list from multiple threads (again, regardless of the class it's contained in). Once you've wrapped it in a call to Collections.synchronizedList, there's no point in doing it again. For clarity (based on your question), your code would look like this: class OtherClass { public static List mainList = Collections.synchronizedList(new ArrayList()); } class RandomClass { public static List referenceToList = OtherClass.mainList; } Here, referenceToList is just a pointer to the same list that mainList points to, which has read/write access synchronized. As a note, there are other List implementations that are designed for concurrent access situations, such as CopyOnWriteArrayList.
score: 1
answers question: http://stackoverflow.com/q/26579436

http://stackoverflow.com/comment/41726768
comment on: http://stackoverflow.com/q/26514173
type: Comment
type: QuestionComment
has text: OK no problem - done!
score: 0

http://stackoverflow.com/a/26598208
has comment: http://stackoverflow.com/comment/41811117
upvote count: 1
answers question: http://stackoverflow.com/q/26597946
has comment: http://stackoverflow.com/comment/41810785
type: Answer
has body: You're trying to reindex the class methods in a way that is incompatible with the java standards. I don't think there is a workaround for this; your code should reflect the way things are structured; i.e. populate your map with the class returned by getDeclaringClass().
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41810705
has comment: http://stackoverflow.com/comment/41810854

http://stackoverflow.com/q/26662365
has title: Why doesn't my stackSize method work?
has comment: http://stackoverflow.com/comment/41926854
answer count: 0
has comment: http://stackoverflow.com/comment/41926943
type: UnansweredQuestion
has body: My objective is to provide a class Stacker that contains a method stackSize that takes an int called extension as its parameter. It should return the smallest long n such that the sum of the sequence 1/2 + 1/4 + 1/6 + 1/8 + ... + ... + 1/2n is greater than or equal to extension. Assuming my Rat class (Rational Number) correctly adds up two fractions using the first parameter as a numerator and the second parameter as a denominator, any ideas why this code isn't working for me? The default Rat() constructor simply makes the Rational number (0/1) and the Rat(extension) constructor makes the Rational number (extension/1). public class StackerTest { @Test public void test1() { assertEquals(4, Stacker.stackSize(1)); } } When I run the test case: @Test public void test1() { assertEquals(4, Stacker.stackSize(1)); } It runs for a solid 30 seconds before giving an IllegalArgumentException Here is the constructor for Rat class as well as the add method /** * If d is zero, throws an IllegalArgumentException. Otherwise creates the * rational number n/d */ public Rat (int n, int d) { // Check parameter restriction if (d == 0) { throw new IllegalArgumentException(); } // Adjust sign of denominator num = n; den = d; if (den &lt; 0) { num = -num; den = -den; } // Zero has a standard representation if (num == 0) { den = 1; } // Factor out common terms int g = gcd(Math.abs(num), den); num = num / g; den = den / g; } /** * Returns the sum of this and r */ public Rat add (Rat r) { int firstNum = this.num*r.den; int firstDen = this.den*r.den; int secondNum = r.num*this.den; int secondDen = r.den*this.den; Rat x = new Rat(firstNum+secondNum, firstDen); return x; }
tagged with: java
tagged with: eclipse
type: Question
score: 0
tagged with: stack-size

http://stackoverflow.com/a/26624732
downvote count: 0
has body: (<img\s+[^>]*>) You can try this.Replace with $1</centre>.See demo. http://regex101.com/r/sU3fA2/38 Something like var re = /(<img\s+[^>]*>)/g; var str = ' test \n \n '; var subst = ' $1</centre>'; var result = str.replace(re, subst);
has comment: http://stackoverflow.com/comment/42173563
has comment: http://stackoverflow.com/comment/41861675
has comment: http://stackoverflow.com/comment/41859092
has comment: http://stackoverflow.com/comment/41896485
score: 1
has comment: http://stackoverflow.com/comment/41861499
has comment: http://stackoverflow.com/comment/42174515
has comment: http://stackoverflow.com/comment/41896506
answers question: http://stackoverflow.com/q/26624627
upvote count: 1
has comment: http://stackoverflow.com/comment/42245429
type: Answer
has comment: http://stackoverflow.com/comment/41860078
has comment: http://stackoverflow.com/comment/41862095
has comment: http://stackoverflow.com/comment/41859307

http://stackoverflow.com/q/26654634
tagged with: web-services
tagged with: ejb-3.1
has comment: http://stackoverflow.com/comment/41916519
tagged with: jakarta-ee
type: AnsweredQuestion
has title: JAVA-EE7/javax.ws.rs: Injection of EJB in REST-Resource
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41913913
type: Question
has comment: http://stackoverflow.com/comment/41915496
accepted answer: http://stackoverflow.com/a/26660018
answer count: 1
has body: I'm trying to inject a Stateless EJB into my JAX-RS webservice via Annotation @EJB. Unfortunately the EJB being injected is null and throws a NullPointerException when it is being called, see the class "RegistrationRest": @Path("/database") @Stateless public class RegistrationRest { @EJB private DbDao dbDao; @Path("getInfo/{name}") @GET @Produces(MediaType.TEXT_PLAIN) public String getInfoByName(@PathParam("name") String name { TreeSet &lt;String&gt; ts = new TreeSet&lt;String&gt;(); JsonGenerator json = new JsonGenerator().writeStartArray(); // Lesen Info aus Datenbank for(Persons person : dbDao.findInfoByName(name) { ts.add(person.getName()); } // Schreiben der gefundenen Staedte in ein JSON for(String name : ts) { json.write(name); } // Rueckgabe der Daten als JSON return json.writeEnd().toString(); } } My Webservice is registered as part and via javax.ws.rs.core.Application, see code of "RestConfiguration": package net.service.rest; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; // other imports @ApplicationPath("/rest") public class RestConfiguration extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { return new HashSet&lt;Class&lt;?&gt;&gt;(Arrays.asList(RegistrationRest.class)); } } As the injected EJB implements an interface that could be the fact that prevents the EJB being injected into the webservice/resource, as I understood reading this article: http://netbeans.dzone.com/articles/how-to-combine-rest-and-ejb-31 As the EJB with the name "DbDao" is a DAO which implements an interface I would like to keep: @Stateless(name = "DbDao") @Local public class DbDaoImpl implements DbDao { private final String ENTITY_MANAGER = "mouPU"; @PersistenceContext(unitName = ENTITY_MANAGER) protected EntityManager em; @Override public List&lt;Address&gt; findInfoByName(final String name) { @SuppressWarnings("unchecked") List&lt;Person&gt; persons = em.createNamedQuery("findInfoByName").setParameter("name", name)).getResul…
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/26660018
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41916626

http://stackoverflow.com/a/26707431
has body: I finally get the answer (thanks to pskink)! To get the exact tag position on image, all we have to do is to use Matrix.mapPoints(). But that alone will not give the new X &amp; Y position after zoom. We have to multiply the current X &amp; Y position with the current zoom level to get the "after zoom position". In other words: Matrix matrix = mImageView.getImageMatrix(); float[] pts = {0, 0}; matrix.mapPoints(pts); float newTagX = (tagX * currentZoom) + pts[0]; float newTagY = (tagY * currentZoom) + pts[1];
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42011723
has comment: http://stackoverflow.com/comment/42012017
accepted answer of: http://stackoverflow.com/q/26650315
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26650315
type: Answer

http://stackoverflow.com/a/26668802
has comment: http://stackoverflow.com/comment/41939954
score: 0
has body: You need to implement OnItemClickListener And call getListView().setOnItemClickListener(this) Finally, do what you want in overrided onItemClick method.
type: Answer
answers question: http://stackoverflow.com/q/26668772
has comment: http://stackoverflow.com/comment/41940059

http://stackoverflow.com/q/26577175
type: AnsweredQuestion
downvote count: 1
has body: I am trying to find the number of permutations of length n that sum to a value s. This is what I have so far: StringBuilder sb = new StringBuilder(); for(int i=0; i&lt;x+1; i++) { for(int j=s+1; j&gt;0; j--) { sb.append(i); //sb.append(j); //sb.append(shares-i-j); } } System.out.println(sb); Obviously, this doesn't work correctly. How do I change the code to return a string of all combinations of length x that sum to n? So eventually, I will need a string that reads something like this for (3,3): 003 030 300 102 120 111 etc. I have listed all possible values like so: 003 012 021 030 102 111 121 201 210 300 The order doesn't matter. Thanks in advance for the help.
type: Question
has answer: http://stackoverflow.com/a/26577414
has comment: http://stackoverflow.com/comment/41772051
tagged with: java
has answer: http://stackoverflow.com/a/26578492
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41772035
possible better answer: http://stackoverflow.com/a/26578492
tagged with: permutation
accepted answer: http://stackoverflow.com/a/26577414
favorite count: 0
has comment: http://stackoverflow.com/comment/41772149
has comment: http://stackoverflow.com/comment/41772108
has title: Find all permutations of length x that sum to s
score: -1

http://stackoverflow.com/comment/41749579
has text: @user3249477 See Bloch Effective Java (2nd edition) Ch 9, Item 57.
score: 1
comment on: http://stackoverflow.com/a/26564340
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41936516
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26667590
score: 0
has text: What's weird about it?

http://stackoverflow.com/q/26653968
tagged with: conditional-statements
upvote count: 3
has answer: http://stackoverflow.com/a/26660035
tagged with: java
accepted answer: http://stackoverflow.com/a/26653980
linked to: http://stackoverflow.com/q/15989618
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26654086
answer count: 8
has title: What is the condition for this "for(;;)" loop?
tagged with: for-loop
duplicate of: http://stackoverflow.com/q/15989618
has answer: http://stackoverflow.com/a/26654177
possible better answer: http://stackoverflow.com/a/26654010
has answer: http://stackoverflow.com/a/26654012
has answer: http://stackoverflow.com/a/26654010
has answer: http://stackoverflow.com/a/26655479
has answer: http://stackoverflow.com/a/26654034
has comment: http://stackoverflow.com/comment/41911868
has answer: http://stackoverflow.com/a/26653980
favorite count: 0
has comment: http://stackoverflow.com/comment/41910915
has body: Can someone explain what is the condition for this for loop? for(;;) { //do sth. }
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26660808
has body: Strangely, your error message. org.eclipse.jetty.websocket.api.InvalidWebSocketException: Unable to instantiate websocket: class java.lang.Class Means that the websocket implementation was handed a raw java.lang.Class to instantiate. That's not going to work. It also means no attempt was made to connect, as the WebSocket class itself was so bad that a connect was impossible. Here's a short (valid and working) example showing its use. package jetty.jsr356; import java.io.IOException; import java.net.URI; import java.util.concurrent.CountDownLatch; import javax.websocket.ClientEndpoint; import javax.websocket.CloseReason; import javax.websocket.CloseReason.CloseCodes; import javax.websocket.ContainerProvider; import javax.websocket.OnClose; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.WebSocketContainer; @ClientEndpoint public class TestClientAnnotatedClass { private static CountDownLatch closeLatch = new CountDownLatch(1); @OnOpen public void onOpen(Session session) { System.out.println("@OnOpen - " + session); try { session.getBasicRemote().sendText("Rock it with Java WebSocket"); } catch (IOException e) { e.printStackTrace(); } } @OnMessage public void onMessage(Session session, String msg) { System.out.println("@OnMessage - ["+msg+"]"); try { session.close(new CloseReason(CloseCodes.NORMAL_CLOSURE,"Thanks")); } catch (IOException e) { e.printStackTrace(); } } @OnClose public void onClose(CloseReason close) { System.out.println("@OnClose - " + close); closeLatch.countDown(); } public static void main(String[] args) { try { WebSocketContainer ws = ContainerProvider.getWebSocketContainer(); ws.connectToServer(TestClientAnnotatedClass.class,new URI("ws://echo.websocket.org/?encoding=text")); closeLatch.await(); } catch (Throwable t) { t.printStackTrace(); } } } You'll see output similar to this 2014-10-30 11:34:19.197:INFO::main: Logging initialized @71ms @OnOpen - WebSocketSession[websocket=Js…
has comment: http://stackoverflow.com/comment/41930106
type: Answer
answers question: http://stackoverflow.com/q/26658614
upvote count: 2
has comment: http://stackoverflow.com/comment/41932542
score: 2
downvote count: 0

http://stackoverflow.com/a/26614823
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26614721
has comment: http://stackoverflow.com/comment/41841269
score: 6
type: Answer
answers question: http://stackoverflow.com/q/26614721
upvote count: 6
has body: Yes you would have create a new object each time since the java.net.URI is immutable. You may use a third-party class like Apache HttpComponents' URIBuilder. Example from the official tutorial: URI uri = new URIBuilder() .setScheme("http") .setHost("www.google.com") .setPath("/search") .setParameter("q", "httpclient") .setParameter("btnG", "Google Search") .setParameter("aq", "f") .setParameter("oq", "") .build(); // the build method creates a new URI instance behind the scenes
has comment: http://stackoverflow.com/comment/41841496

http://stackoverflow.com/comment/41786553
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26584579
has text: @user1803551, sorry but the MCVE takes more time than I thought.. anyway you were right, I mixed them, sorry. Basically what the program is doing is instantiating a new jDialog, then a new jPanel and add the jPanel to the jDialog. The jDialog is created by passing the jFrame as owner, and when the jDialog is closed, the dispose() on the jDialog is called. So jPanel plays no role in this.

http://stackoverflow.com/q/26532570
score: 1
tagged with: logging
type: Question
has body: I'm having this issue where my logger keeps writing to a new file Logger logger = Logger.getLogger("NewLogger"); FileHandler fh; //create log file string Date date = new Date(); String yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd").format(date); String logFileName = "retrieveproductstracking_" + yyyyMMdd; fh = new FileHandler("./" + logFileName + ".log"); logger.addHandler(fh); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logger.setUseParentHandlers(false); logger.info(request.getRemoteAddr() + ", " + url + ", " + "timestamp" ); This code is being used in a JSP where it's called and the logger logs the URL, IP. The problem is that the logger writes to a new file every time, but not only that...it writes to all of the previous files before it too. Not exactly what I had in mind for rotating logs. See image: http://puu.sh/cnu39/8b814e9f3f.png http://puu.sh/cnvKw/8c0e5dce11.png
tagged with: java
has comment: http://stackoverflow.com/comment/41691685
has title: Java.util.logger Keeps writing to a new log file
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/26532753
downvote count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26533497
has answer: http://stackoverflow.com/a/26532753
has comment: http://stackoverflow.com/comment/41693236
favorite count: 0
has comment: http://stackoverflow.com/comment/41692121
has answer: http://stackoverflow.com/a/26533497
type: AnsweredQuestion

http://stackoverflow.com/comment/41736096
has text: http://stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator
score: 1
comment on: http://stackoverflow.com/q/26557375
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41884465
has text: Make `Shapes`, an `abstract class` and override your `draw(g)` method in its children.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26638620

struts-1
tags question: http://stackoverflow.com/q/26652224
tags question: http://stackoverflow.com/q/26671527
type: Tag
tags question: http://stackoverflow.com/q/26589018
tags question: http://stackoverflow.com/q/26667646
tag name: struts-1
tags question: http://stackoverflow.com/q/26541756
tags question: http://stackoverflow.com/q/26630927

http://stackoverflow.com/comment/41866240
type: Comment
score: 0
has text: Agreed but PO wanted to know why and how to overcome. So yes that could be one of the possibility.
type: AnswerComment
comment on: http://stackoverflow.com/a/26628722

http://stackoverflow.com/a/26529228
score: 1
has comment: http://stackoverflow.com/comment/41687751
has comment: http://stackoverflow.com/comment/41685001
has comment: http://stackoverflow.com/comment/41685384
has comment: http://stackoverflow.com/comment/41685296
downvote count: 0
type: Answer
has body: As far as I know there is no such function. It may be worth noting that it could actually take no more time to sort it than to determine whether it is sorted or not. You could always wrap it in an object that maintains a sorted flag for you. You could implement the function yourself quite efficiently using: /** * Bridge function to the isSorted(Iterable&lt;Comparable&gt;) below * allowing arrays to tested too. * * @param &lt;T&gt; - The elements in the array. * @param a - The array. * @return - true if the Array is sorted - false otherwise. */ public static &lt;T extends Comparable&lt;T&gt;&gt; boolean isSorted(T[] a) { return isSorted(Arrays.asList(a)); } /** * Checks sortedness of any Iterable of Comparables. * * @param &lt;I&gt; - The type of the Iterable. * @param &lt;T&gt; - The type of the Comparable. * @param a - The Iterable&lt;Comparable&gt; to test. * @return - true if the Iterable is sorted - false otherwise. */ public static &lt;T extends Comparable&lt;T&gt;&gt; boolean isSorted(Iterable&lt;T&gt; a) { // Remember the previous element. T prev = null; for (T it : a) { if (prev != null &amp;&amp; it.compareTo(prev) &lt; 0) { // This should be before prev! Not sorted!! return false; } prev = it; } // All in order. return true; }
upvote count: 1
answers question: http://stackoverflow.com/q/26529089

oracle-agile-plm
type: Tag
tags question: http://stackoverflow.com/q/26667565
tag name: oracle-agile-plm

http://stackoverflow.com/comment/41807566
has text: You need to open a new question about this, explain the background, show the code that you implemented, and what errors you get. You can check the documentation for each of the classes to see whether you imported it correctly, and try to eliminate as many errors as possible before posting your question.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26595396

http://stackoverflow.com/a/26568773
type: Answer
answers question: http://stackoverflow.com/q/26568712
has comment: http://stackoverflow.com/comment/41756770
has body: You are not escaping special characters in your command string. If the command needs double quotes, it should be: command = "ldapwhoami -D \"cn=admin,dc=example,dc=com\" -w password" Note the \" to insert double quotes inside string. Also try in this way: Process p = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); } Other option is to use java.util.Scanner.
has comment: http://stackoverflow.com/comment/41757006
has comment: http://stackoverflow.com/comment/41756874
has comment: http://stackoverflow.com/comment/41756833
has comment: http://stackoverflow.com/comment/41756784
score: 0

http://stackoverflow.com/q/26515700
has answer: http://stackoverflow.com/a/61254474
has answer: http://stackoverflow.com/a/56238174
accepted answer: http://stackoverflow.com/a/27276523
linked to: http://stackoverflow.com/q/50066795
has answer: http://stackoverflow.com/a/67478909
has answer: http://stackoverflow.com/a/55401802
has answer: http://stackoverflow.com/a/62353189
linked to: http://stackoverflow.com/q/930900
has body: Some background: I have a Java 1.6 webapp running on Tomcat 7. The database is MySQL 5.5. Previously, I was using Mysql JDBC driver 5.1.23 to connect to the DB. Everything worked. I recently upgraded to Mysql JDBC driver 5.1.33. After the upgrade, Tomcat would throw this error when starting the app. WARNING: Unexpected exception resolving reference java.sql.SQLException: The server timezone value 'UTC' is unrecognized or represents more than one timezone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc timezone value if you want to utilize timezone support. Why is this happening?
has answer: http://stackoverflow.com/a/38296891
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/41662729
has answer: http://stackoverflow.com/a/53536058
has answer: http://stackoverflow.com/a/51073220
has answer: http://stackoverflow.com/a/55742365
has answer: http://stackoverflow.com/a/40245885
has answer: http://stackoverflow.com/a/45732766
has answer: http://stackoverflow.com/a/56160360
tagged with: timezone
upvote count: 472
has title: MySQL JDBC Driver 5.1.33 - Time Zone Issue
tagged with: jdbc
has answer: http://stackoverflow.com/a/65647361
has answer: http://stackoverflow.com/a/60570557
possible better answer: http://stackoverflow.com/a/40245885
has answer: http://stackoverflow.com/a/56424716
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/44720416
has answer: http://stackoverflow.com/a/70723186
score: 472
has answer: http://stackoverflow.com/a/51911047
has answer: http://stackoverflow.com/a/56240156
has answer: http://stackoverflow.com/a/27276523
answer count: 35
tagged with: java
has answer: http://stackoverflow.com/a/56841621
tagged with: mysql
has answer: http://stackoverflow.com/a/54386284
has answer: http://stackoverflow.com/a/56754956
has answer: http://stackoverflow.com/a/59774392
has answer: http://stackoverflow.com/a/50705619
has answer: http://stackoverflow.com/a/60127304
has answer: http://stackoverflow.com/a/57518022
has answer: http://stackoverflow.com/a/38005969
type: Question
has answer: http://stackoverflow.com/a/63408019
has answer: http://stackoverflow.com/a/54256150
linked to: http://stackoverflow.com/q/50493398
linked to: http://stackoverflow.com/q/19903610
has answer: http://stackoverflow.com/a/61791286
has answer: http://stackoverflow.com/a/61668814
has answer: http://stackoverflow.com/a/55815322
has answer: http://stackoverflow.com/a/53562666
has answer: http://stackoverflow.com/a/33893008

http://stackoverflow.com/q/26665118
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26665154
type: Question
possible better answer: http://stackoverflow.com/a/26665153
tagged with: comparison-operators
has answer: http://stackoverflow.com/a/26665153
has title: Safety of comparison operators with Integer objects in Java
has answer: http://stackoverflow.com/a/26665139
score: 0
answer count: 3
has body: When is it safe to use comparison operators e.g. ==, >=, &lt; in Java when using Integer objects and not primitive ints? http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html I know == is dangerous with references, and you should use .equals instead, but what about the other operators? e.g. int x = 7; int y = 7; Integer a = new Integer(7); Integer b = new Integer(7); System.out.println(x == y); System.out.println(a == b); System.out.println(a.equals(b)); System.out.println(a &lt;= b); prints true false // Why you should use .equals true true // Seemed dangerous but it worked? Is it okay to use anything other than double equals (So >, &lt;, >= and &lt;= are safe?), or should I be using the .compareTo() method?
tagged with: integer
accepted answer: http://stackoverflow.com/a/26665139
tagged with: reference

http://stackoverflow.com/comment/41706594
type: Comment
comment on: http://stackoverflow.com/a/26533841
type: AnswerComment
has text: I understand its a logic error, it wouldnt compile otherwise. Right click and set a breakpoint in the method the issue occurs in. Instead of "Run..", click debug. Use the buttons on the top to step through the code and hover over variables to view their values. Debugging is a valuable skill. Read a tutorial on debugging in eclipse.
score: 0

http://stackoverflow.com/comment/41750437
has text: what is the contents of NerdData.txt. It seems that your file doesn't contain any "The"'s
comment on: http://stackoverflow.com/q/26565586
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26660018
has comment: http://stackoverflow.com/comment/41949613
has body: Try this: @ApplicationPath("/rest") public class RestConfiguration extends Application { private Set<Class<?>> resources = new HashSet<Class<?>>(); public RestConfiguration () { resources.add(RegistrationRest.class); } @Override public Set<Class<?>> getClasses() { return resources; } } Make sure your web.xml has this: org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap Finally, make sure you have beans.xml in your WEB-INF folder <?xml version="1.0" encoding="UTF-8"?>
upvote count: 5
has comment: http://stackoverflow.com/comment/41943072
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26654634
answers question: http://stackoverflow.com/q/26654634
type: Answer

http://stackoverflow.com/q/26668375
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26668422
has title: Android GridView layout and optimization
type: Question
has body: I have two questions, the first one is that I am creating a bunch of gridviews and the gridview items is just one imageview, when I put a 500 * 1000 image in the items(I only have four items) it lags like crazy but if I insert a lower res pic(100*200) it works fine. So can android not handle this?(I used view recycling too) The second one is that I want my gridview items to be 125dp wide and have exactly 2dp vertical and horizontal spacing, if there is extra space I would want it to stretch the gridview items, I'm using this code in my xml for my grid view item: <?xml version="1.0" encoding="utf-8"?> and my gridview: this is what i want: and this is what im getting:
accepted answer: http://stackoverflow.com/a/26668705
has answer: http://stackoverflow.com/a/26668448
answer count: 3
has answer: http://stackoverflow.com/a/26668705
downvote count: 0
possible better answer: http://stackoverflow.com/a/26668422
favorite count: 0

http://stackoverflow.com/comment/41914352
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26655769
has text: Thanks @Grimbode, that article looks like a good overview of threads but I don't think it addresses by question.
score: 0

http://stackoverflow.com/comment/41899969
has text: I can not use an array list for this assignment. However inneficient my for loops were, that is a requirement. :/
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26647330
type: QuestionComment

http://stackoverflow.com/a/26570564
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26555672
upvote count: 2
has comment: http://stackoverflow.com/comment/41816032
type: Answer
answers question: http://stackoverflow.com/q/26555672
score: 2
has body: Login to the DocuSign Console, go to Preferences -> Branding, then download one of your brand profiles (create one if you do not have any yet). Once you download you'll see it's an xml file and it will show you the content of a brand profile.
has comment: http://stackoverflow.com/comment/41759633
has comment: http://stackoverflow.com/comment/41794280

http://stackoverflow.com/comment/41824259
has text: my url is-http://172.128.11.156:8880/VFG/LoginAccess.jsp?userID=admin&password=password&userGroup=1 but i directly jump to the :- http://172.128.11.156:8880/VFG/AP_ReceiptsWisePaymentSummaryReportpdf.jsp?FromDate=28/10/2014&ToDate=28/10/2014&CostCentre=-1|ALL&ReportType=.pdf&collectionAgent=ALL&Summary=1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26605791
score: 0

http://stackoverflow.com/a/26633515
answers question: http://stackoverflow.com/q/26633379
type: Answer
upvote count: 2
has body: You don't return the result of your recursing. You should return it, or set the result. return searchNode(childrens.item(i), node, nodeResult); or nodeValue = searchNode(childrens.item(i), node, nodeResult);
has comment: http://stackoverflow.com/comment/41880972
has comment: http://stackoverflow.com/comment/41876058
has comment: http://stackoverflow.com/comment/41874782
score: 2
downvote count: 0

http://stackoverflow.com/a/26570007
upvote count: 1
has comment: http://stackoverflow.com/comment/41787963
accepted answer of: http://stackoverflow.com/q/26546618
has comment: http://stackoverflow.com/comment/41795670
type: AcceptedAnswer
downvote count: 0
has body: The code you posted works fine. The error you have is due to a mismatch between "someValue" and "some value" in the code you're running locally. Upgrade to Hamcrest 1.3 and you'll get a clearer error message: Expected: a collection containing hasProperty("bar", "someValue") but: property 'bar' was 'some value' Since you may be getting different results, here's a full example that passes, with JUnit 4.11 and Hamcrest 1.3. In Foo.java: public class Foo { public String getBar() { return "some value"; } } And in FooTest.java: import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.List; import org.hamcrest.Matchers; import org.junit.Test; public class FooTest { @Test public void test() { List&lt;Foo&gt; foos = Arrays.asList(new Foo()); assertThat(foos, Matchers.&lt;Foo&gt;hasItem(Matchers.hasProperty("bar", Matchers.equalTo("some value")))); } } If I intentionally break this test by changing the property name in the test to "notbar" then I get: java.lang.AssertionError: Expected: a collection containing hasProperty("notbar", "some value") but: No property "notbar" If, instead, I break it by expecting "some other value", then I get: java.lang.AssertionError: Expected: a collection containing hasProperty("bar", "some other value") but: property 'bar' was "some value" If you're getting different, or less clear, errors, you may have a separate issue.
type: Answer
has comment: http://stackoverflow.com/comment/66860829
answers question: http://stackoverflow.com/q/26546618
score: 1

http://stackoverflow.com/a/26577469
type: Answer
score: 1
upvote count: 1
has body: You always check one element ahead (i+1) so you'll want to stop one element before you usually do. First you check whether the next element is greater than the current, if it is, increase the count. If it isn't, reset the count, unless you've already reached 3 consecutive increasing numbers, in which case you're done. Try; for(int i = 0; i &lt; anArray.length-1; i++) { if(anArray[i+1] &gt; anArray[i]) { count++; } else if(count == 3) break; else count = 0; } if(count == 3) System.out.println("true"); else System.out.println("false");
answers question: http://stackoverflow.com/q/26577329
downvote count: 0

http://stackoverflow.com/comment/41866687
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26628935
has text: I don't understand your question.... what problem do you have? You should know that a subclass instance **is a** super class instance too.
type: Comment

http://stackoverflow.com/comment/41893573
type: QuestionComment
comment on: http://stackoverflow.com/q/26643492
score: 0
type: Comment
has text: input.txt structure: SCI2000/Science/1200/10/C --> There are 23 rows and 5 columns. I'd also like to have a title made for each column.

http://stackoverflow.com/comment/41851060
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26598938
type: Comment
has text: ive edited it so it will compile and run.. string to char[] is the only conversion to do exactly what you want. As it is i hope it gives you ideas about character manipulations. The code is compiled and running here: http://www.browxy.com/SavedCode/22195

http://stackoverflow.com/q/26627083
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41863418
has answer: http://stackoverflow.com/a/26627128
has comment: http://stackoverflow.com/comment/41863536
linked to: http://stackoverflow.com/q/17874717
tagged with: null-layout-manager
tagged with: java
tagged with: swing
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/41863389
score: -1
has title: Display arrays of JLabel
has comment: http://stackoverflow.com/comment/41863608
upvote count: 0
tagged with: arrays
answer count: 1
tagged with: layout-manager
has body: For displaying 10 labels in a JPanel I used the following code using Netbeans, for Java. Not getting the any output. JPanel layout set as null layout. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JLabel[] labels = new JLabel[10]; for(int i=0; i&lt;9; i++){ labels[i] = new JLabel("Label Name " + i); p1.add(labels[i]);} }

http://stackoverflow.com/q/26536194
tagged with: android-activity
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26536575
type: Question
has body: I want to check for email completion, then start another activity. So my question is really how do I check i for completion? EDIT: Or is there a way to close the intent upon completion (regardless of email sent) and check for that event? I'm using: Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); i.putExtra(Intent.EXTRA_TEXT , "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); }
tagged with: java
has title: How can I check sent emails from my Android application? Or intent upon completion (regardless of email sent)?
score: 0
answer count: 2
tagged with: email
has answer: http://stackoverflow.com/a/26536575
possible better answer: http://stackoverflow.com/a/26536245
has answer: http://stackoverflow.com/a/26536245
tagged with: android

ibm-mq
tags question: http://stackoverflow.com/q/26672519
type: Tag
tag name: ibm-mq

http://stackoverflow.com/a/26594982
answers question: http://stackoverflow.com/q/26555066
score: 2
downvote count: 0
upvote count: 2
has body: I'm leaning towards it being an issue with the number of channels and the channel cache size. Does anyone know if there's a limit on the number of channels on a queue? It seems like specifying connections rather than channels might help here. If anyone has any information it would really help, getting stuck for time :)
type: Answer

http://stackoverflow.com/a/26605907
type: Answer
answers question: http://stackoverflow.com/q/26605826
has comment: http://stackoverflow.com/comment/41824427
score: 0
has body: You may introduce communications between the client side applet and the server side program. We do this with a TCP socket connection from the Java applet to a Windows Service. Having Java call a web service on your server would also work. You might alternatively interact with the applet using JavaScript and have the JS send data back to the server. To call JavaScript on the hosting page from a Java applet, call JSObject.getWindow. On the returned object, call calls a JavaScript method. Syntax for call: public abstract java.lang.Object call(java.lang.String methodName, java.lang.Object[] args) throws JSException Calls a JavaScript method. Equivalent to "this.methodName(args[0], args1, ...)" in JavaScript.

http://stackoverflow.com/comment/41806509
type: QuestionComment
has text: Why did you mark that duplicate? My question has nothing to do with that!
comment on: http://stackoverflow.com/q/26595133
score: 0
type: Comment

http://stackoverflow.com/comment/41753612
type: QuestionComment
type: Comment
has text: What do you mean by 'cleanest way'? I think there is only one way to add an new Item to a `List` in Java.
score: 0
comment on: http://stackoverflow.com/q/26567274

http://stackoverflow.com/a/26517047
has comment: http://stackoverflow.com/comment/41663990
has comment: http://stackoverflow.com/comment/41666229
downvote count: 0
has comment: http://stackoverflow.com/comment/41664112
has comment: http://stackoverflow.com/comment/41664726
has body: public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader( new DataInputStream(new FileInputStream("HelloWorld.java")))); // Reading // the // test // file String line; int lineNum = 1; while ((line = br.readLine()) != null) { balanceChecker(line, lineNum); lineNum++; } br.close(); if (symbolStack.isEmpty()) { System.out.println("Success"); } else { System.out.println("Failure"); } } public static void balanceChecker(String line, int lineNum) { int charNum = 1; Symbol top; for (char chr : line.toCharArray()) { switch (chr) { case '{': case '(': case '[': symbolStack.push(new Symbol(chr, lineNum, charNum)); break; case ']': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.pop(); if (top.symbol != '[') { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); } } break; case ')': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.pop(); if (top.symbol != '(') { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); } } break; case '}': if (symbolStack.isEmpty()) System.err.println("Unmatched parentheses "); else { top = symbolStack.pop(); if ((top.symbol != '{')) { System.err.println("Fail at line: " + top.lineFound + " Column: " + top.colFound); } } break; } charNum++; } } }
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26516789
accepted answer of: http://stackoverflow.com/q/26516789
has comment: http://stackoverflow.com/comment/41665148
type: Answer
has comment: http://stackoverflow.com/comment/41664083
score: 2

http://stackoverflow.com/a/44920001
answers question: http://stackoverflow.com/q/26655541
score: 7
upvote count: 7
type: Answer
has body: if everything looks OK, but this error appears, try to disable instant run!!! when I disabled it all the classes were loaded properly.
downvote count: 0

http://stackoverflow.com/q/26564796
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41749153
has title: JAVA I keep getting arraynextoutofboundsexception can someone tell me why?
answer count: 1
has comment: http://stackoverflow.com/comment/41749011
has comment: http://stackoverflow.com/comment/41748976
type: UnansweredQuestion
has body: I cant seem to figure it out is it possible that someone can tell me why? public class Display { private int width,height; public int [] pixels; public int [] tiles = new int[64 * 64]; private Random random = new Random(); public Display(int width, int height) { this.width = width; this.height = height; pixels = new int [width*height]; // 50400 for (int i = 0; i &lt; 64 * 64; i++) { tiles[i] = random.nextInt (0xffffff); } } public void clear() { for (int i = 0; i &lt; pixels.length; i++) { tiles[i] = random.nextInt (0xffffff); } } public void render() { for (int y = 0; y &lt;height; y++) { if (y &lt; 0 || y &gt;= height) break; for (int x = 0; x &lt; width; x++) { if (x &lt; 0 || x &gt;=width) break; int tileIndex = (x / 16) + (y / 16) * 64; pixels[x+y*width] = tiles[tileIndex]; } } } }
score: -3
has comment: http://stackoverflow.com/comment/41749139
upvote count: 0
has answer: http://stackoverflow.com/a/26564902
has comment: http://stackoverflow.com/comment/41749305
has comment: http://stackoverflow.com/comment/41749173
favorite count: 0
has comment: http://stackoverflow.com/comment/41749107
type: Question
has comment: http://stackoverflow.com/comment/41748948
has comment: http://stackoverflow.com/comment/41749199

http://stackoverflow.com/comment/41911195
type: Comment
comment on: http://stackoverflow.com/q/26654031
score: 4
has text: Just because you need it doesn't mean that it's possible...
type: QuestionComment

http://stackoverflow.com/comment/41714546
type: Comment
has text: The ;jsessionid sufix is normal: the server appends it to be able to track sessions even if the browser doesn't accept cookies. But the original path to which the server redirects (before the server appends `;jsessionid`) should probably be `https://path.domain.com/`, and not `https://path.domain.com`.
comment on: http://stackoverflow.com/q/26545406
score: 1
type: QuestionComment

http://stackoverflow.com/comment/41680731
has text: Name [persistence/MyMyPersistenceUnitName] is not bound in this Context. Unable to find [persistence]. same error with jdbc/LCDS :(
comment on: http://stackoverflow.com/q/26526261
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41759809
comment on: http://stackoverflow.com/q/26570645
type: QuestionComment
type: Comment
score: 0
has text: 10-26 09:16:15.831: E/AndroidRuntime(280): at android.os.Handler.dispatchMessage(Handler.java:92) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.os.Looper.loop(Looper.java:123) 10-26 09:16:15.831: E/AndroidRuntime(280): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-26 09:16:15.831: E/AndroidRuntime(280): at java.lang.reflect.Method.invokeNative(Native Method) 10-26 09:16:15.831: E/AndroidRuntime(280): at java.lang.reflect.Method.invoke(Method.java:521)

http://stackoverflow.com/comment/41856325
type: QuestionComment
score: 0
has text: other than give to full path ex "file:///home/reegan/temp/serialObservable/trunk/src/main/java/main/2-user-group-icon.png"
comment on: http://stackoverflow.com/q/26623064
type: Comment

http://stackoverflow.com/comment/41870708
type: Comment
has text: @shinjw if the start index is inclusive and the end index is exclusive, you can see at a look what the length of the new string is. endindex minus startindex.
score: 2
comment on: http://stackoverflow.com/a/26631130
type: AnswerComment

http://stackoverflow.com/comment/42280170
type: QuestionComment
comment on: http://stackoverflow.com/q/26623936
has text: suppose if the json object having multiple employee objects so, how can i parse by javascript
score: 0
type: Comment

http://stackoverflow.com/q/26645940
tagged with: java
has comment: http://stackoverflow.com/comment/41897468
type: Question
has body: I'm not sure how to output the reversed StringBuffer to a file, and have searched online but still been unable to determine what to do. Would appreciate any advice. I know I'm going wrong with the bwr flush at the end import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; import java.io.BufferedWriter; import java.io.FileWriter; /** This program reads a file with numbers, and writes the numbers to another file, lined up in a column and followed by their total. */ class FileClass{ public static void main(String[] args) throws FileNotFoundException { // Prompt for the input and output file names Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); System.out.print("Output file: "); String outputFileName = console.next(); // Construct the Scanner and PrintWriter objects for reading and writing File inputFile = new File(inputFileName); Scanner in = new Scanner(inputFile); in.useDelimiter(""); // To recognize spaces in the text PrintWriter out = new PrintWriter(outputFileName); // Read the input and write the output String s; StringBuffer sb = new StringBuffer(s); while (in.hasNext()) { String input = in.next(); sb.append(input); } sb.reverse(); //out.printf(sb); BufferedWriter bwr = new BufferedWriter(new FileWriter(new Filefinal.txt")); bwr.write(sb.toString()); bwr.flush(); bwr.close(); in.close(); out.close(); } }
has answer: http://stackoverflow.com/a/26646140
has title: Java i/o outputting a StringBuffer to a file
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41897459
accepted answer: http://stackoverflow.com/a/26646140
tagged with: io
type: AnsweredQuestion

http://stackoverflow.com/q/26559444
has answer: http://stackoverflow.com/a/26559493
has comment: http://stackoverflow.com/comment/41739568
accepted answer: http://stackoverflow.com/a/26559493
answer count: 1
has comment: http://stackoverflow.com/comment/41739546
has body: We have 4 ways to implement listener: - An inner class - An anonymous class - A class inside a method - Make the container of the GUI component a listener My question is: Which ones are the most commonly used? Why? And when should we use an anonymous class to implement a listener and when we may prefer a different implementation? Why?
type: AnsweredQuestion
tagged with: java
has title: when should we use an anonymous class to implement a listener and when we may prefer a different implementation
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41739529
score: 0

http://stackoverflow.com/a/26544891
type: Answer
accepted answer of: http://stackoverflow.com/q/26539405
has comment: http://stackoverflow.com/comment/41718569
has comment: http://stackoverflow.com/comment/41718656
has comment: http://stackoverflow.com/comment/41718388
has comment: http://stackoverflow.com/comment/41718488
has comment: http://stackoverflow.com/comment/41718131
has comment: http://stackoverflow.com/comment/41717983
upvote count: 1
has comment: http://stackoverflow.com/comment/41717945
has comment: http://stackoverflow.com/comment/41718266
has body: Your configuration should look something like this. @Configuration @PropertySource("classpath:persistence-${envTarget:default}.properties") @EnableJpaRepositories(basePackages = {"dk.fitfit.campusfood.model", "dk.fitfit.campusfood.repository"}) public class PersistenceConfig { private static final Logger logger = LoggerFactory.getLogger(PersistenceConfig.class); @Autowired private DataInitializer dataInitializer; @Autowired private Environment env; private final String packagesToScan = "dk.fitfit.campusfood"; public PersistenceConfig() { logger.info("PersistenceConfig loaded!"); } @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) .build(); } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setDataSource(dataSource); factory.setPackagesToScan(packagesToScan); factory.setJpaVendorAdapter(jpaVendorAdapter()); return factory; } @Bean public JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter(); hibernateJpaVendorAdapter.setShowSql(true); hibernateJpaVendorAdapter.setGenerateDdl(true); hibernateJpaVendorAdapter.setDatabasePlatform( env.getRequiredProperty("jdbc.hibernate.dialect")); return hibernateJpaVendorAdapter; } @Bean public PlatformTransactionManager transactionManager(EntityManagerFactory emf) { JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory(emf); return transactionManager; } @Profile("!openshift") @Configuration public static class DefaultPersistenceConfig { @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) .bui…
has comment: http://stackoverflow.com/comment/41718496
has comment: http://stackoverflow.com/comment/41718312
has comment: http://stackoverflow.com/comment/41718090
has comment: http://stackoverflow.com/comment/41718432
has comment: http://stackoverflow.com/comment/41718032
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41717514
answers question: http://stackoverflow.com/q/26539405
has comment: http://stackoverflow.com/comment/41716788

meteor
tags question: http://stackoverflow.com/q/26537913
type: Tag
tag name: meteor

http://stackoverflow.com/q/26565468
favorite count: 0
type: UnansweredQuestion
has title: .equal in strings from json?
has comment: http://stackoverflow.com/comment/41750362
has answer: http://stackoverflow.com/a/26565587
has body: I'm trying some code where I want to compare strings i've grabbed from json to certain values. However the if statements never trigger. I have confirmed the values of the instances are set properly, and can be printed out. //MAKING CLASSES Collection collection = new ArrayList(); Event ev = new Event(); ev.name = "sven"; ev.source = "src10"; Event2 ev2 = new Event2(); ev2.name = "type"; ev2.data = "somedata"; collection.add(ev); collection.add(ev2); //MAKING A BUNCH OF CLASSES TO JSON Gson gson = new Gson(); String json = gson.toJson(collection); JsonParser parser = new JsonParser(); JsonArray array = parser.parse(json).getAsJsonArray(); //JSON TO JAVA for (int i = 0; i &lt; array.size(); i++) { JsonObject nameObject = array.get(i).getAsJsonObject(); String nameString = nameObject.get("name").toString(); if (nameString.equals("sven")) { System.out.println("this is sven"); Event event = gson.fromJson(array.get(i), Event.class); } else if (nameString.equals("type")) { System.out.println("this is type"); Event2 event2 = gson.fromJson(array.get(i), Event2.class); } else{ System.out.println("nothing"); } }
upvote count: 1
has answer: http://stackoverflow.com/a/41225104
type: Question
linked to: http://stackoverflow.com/q/16639482
score: 1
has comment: http://stackoverflow.com/comment/41765912
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
downvote count: 0
tagged with: deserialization

http://stackoverflow.com/comment/41852495
type: QuestionComment
has text: If you cannot meaningfully say "a planet is a Sun" in the real world, you should not use inheritance in your program.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26620934

http://stackoverflow.com/q/26606153
has title: What is the difference between @Entity in Hibernate and JPA
type: Question
upvote count: 15
has answer: http://stackoverflow.com/a/30915761
has comment: http://stackoverflow.com/comment/41826970
tagged with: jpa
downvote count: 0
score: 15
has answer: http://stackoverflow.com/a/26607428
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26606363
linked to: http://stackoverflow.com/q/955515
type: UnansweredQuestion
tagged with: hibernate-mapping
linked to: http://stackoverflow.com/q/9881611
has body: When i am doing sample Hibernate standalone program, little bit confusing was created in my mind with the usage of @Entity annotation. Here my question is, I have one persisted class with @Entity from javax.persistence package then it's working fine but when i replaced @Entity annotation with Hibernate API(i.e from org.hibernate.annotations package) then it's giving org.hibernate.MappingException: Unknown entity: com.jetti.test.Employee Give some more explanation are highly appreciated.
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41825042
tagged with: orm

http://stackoverflow.com/q/26604841
answer count: 0
downvote count: 0
score: 1
tagged with: spring-security
favorite count: 0
tagged with: security
type: Question
has comment: http://stackoverflow.com/comment/41826826
has title: Spring security remember me failing on IE10
upvote count: 1
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: UnansweredQuestion
has body: Spring security was working fine in all terms except for remember-me feature(simple remember me approach not using persistent approach). If I log in as a user with the remember me checked and if I close the browser (Chrome) and reopen and hits the same , The app was redirected to the login screen which shouldn't have been the case. My config xml for spring security had just &lt;security:remember-me&gt; initially. Then later I added &lt;security:remember-me use-secure-cookie="false"/&gt; and it worked like a charm in CHROME. So now if the user logs in with the remember me checked and closes the browser and reopens the browser , then the app is redirected with the logged on user to the home page. But now the same piece of code seems not to work in IE10. And I need it to get done from versions of 9 (IE9 and above). Tried a lot scenarios. But cant get to the root cause. Any help would be appreciated.

http://stackoverflow.com/comment/41764290
type: Comment
type: QuestionComment
has text: Christian, It is very clear, There is no problem with xml configuration, Its an OSGI problem, Anywaz, I will add it <data-serializable-factories> <data-serializable-factory factory-id="1">com.test.beans.SerializableFactory </data-serializable-factory> </data-serializable-factories>
score: 1
comment on: http://stackoverflow.com/q/26571035

button
tags question: http://stackoverflow.com/q/26615305
tags question: http://stackoverflow.com/q/26546931
tags question: http://stackoverflow.com/q/26524583
tags question: http://stackoverflow.com/q/26586904
tags question: http://stackoverflow.com/q/26574891
tags question: http://stackoverflow.com/q/26626762
tags question: http://stackoverflow.com/q/26544274
tags question: http://stackoverflow.com/q/26518720
type: Tag
tags question: http://stackoverflow.com/q/26649597
tags question: http://stackoverflow.com/q/26554764
tags question: http://stackoverflow.com/q/26594852
tags question: http://stackoverflow.com/q/26565166
tag name: button
tags question: http://stackoverflow.com/q/26599497
tags question: http://stackoverflow.com/q/26610975

http://stackoverflow.com/comment/41897232
type: AnswerComment
type: Comment
has text: Thanks @Stuart Marks - you've restored my faith in Stack Overflow. The interesting think about your program is that it gives me the same on Java 7 and Java 8. My issue only appeared when we switched to Java 8. Your analysis makes sense though, and further inspires me to remove `finalize()` from our code base.
comment on: http://stackoverflow.com/a/26645534
score: 7

http://stackoverflow.com/q/26558199
has comment: http://stackoverflow.com/comment/41737849
answer count: 1
has title: How to manage lots of incoming packets
tagged with: packet
tagged with: sockets
tagged with: client
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26558314
has comment: http://stackoverflow.com/comment/41737636
type: Question
tagged with: server
has body: I have a socketserver set up with a remote client, and it is functional. Upon opening the client and logging in, I noticed that sometimes, there is an error that seems to be due to the client reading an int when it shouldn't be. Upon logging on, the server sends a series of messages/packets to the client, and these are anything from string messages to information used to load variables on the client's side. Occasionally, while logging in, an error gets thrown showing that the client has read a packet of size 0 or a very large size. Upon converting the large-sized number into ascii I once found that it was a bit of a string "sk." (I located this string in my code so it's not entirely random). Looking at my code, I'm not sure why this is happening. Is it possible that the client is reading an int at the wrong time? If so, how can I fix this? InetAddress address = InetAddress.getByName(host); connection = new Socket(address, port); in = new DataInputStream(connection.getInputStream()); out = new DataOutputStream(connection.getOutputStream()); String process; System.out.println("Connecting to server on "+ host + " port " + port +" at " + timestamp); process = "Connection: "+host + ","+port+","+timestamp + ". Version: "+version; write(0, process); out.flush(); while (true) { int len = in.readInt(); if (len &lt; 2 || len &gt; 2000) { throw new Exception("Invalid Packet, length: "+len+"."); } byte[] data = new byte[len]; in.readFully(data); for (Byte b : data) { System.out.printf("0x%02X ",b); } try { reader.handlePackets(data); } catch (Exception e) { e.printStackTrace(); //connection.close(); //System.exit(0); //System.out.println("Exiting"); } } //Here is code for my write function (Server sided): public static void write(Client c, Packet pkt) { for (Client client : clients) { if (c.equals(client)) { try { out.writeInt(pkt.size()); out.write(pkt.getBytes()); out.flush(); } catch (IOException ex) { ex.printStackTrace(); } } } } So looking at the write function, I don't r…
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/26558314

http://stackoverflow.com/comment/41801785
score: 0
type: Comment
has text: why cant it still find the action abc when the struts.xml file is in the src folder ?
comment on: http://stackoverflow.com/a/26592952
type: AnswerComment

http://stackoverflow.com/a/26560385
has comment: http://stackoverflow.com/comment/126362350
has body: First of all check whether the map is null or not by map != null Then check map contains that key by, map.containsKey("A") Totally you can check as follows, if(map!=null &amp;&amp; map.containsKey("A")){ if(map.get("A") != null){ System.out.println(map.get("A")); \\ value corresponding to key A } }
score: 0
answers question: http://stackoverflow.com/q/26559768
type: Answer

http://stackoverflow.com/comment/41875447
type: AnswerComment
comment on: http://stackoverflow.com/a/26633067
type: Comment
has text: It'l already in the code, on the line which declares unsignedSample.
score: 0

http://stackoverflow.com/a/26572229
type: Answer
answers question: http://stackoverflow.com/q/26572116
has comment: http://stackoverflow.com/comment/41763611
has comment: http://stackoverflow.com/comment/41762627
has body: If you create empty Dynamic Web Project from Eclipse it will produce no result as it have no code your scr and WEB-INF folders will be emplty Did you stop tomcat wich you run manually before start it from Ecliple? By default when you start your tomcat from Eclipse you not able to see welcome Tomcat page. Please post link with your tutorial here.
score: 0
has comment: http://stackoverflow.com/comment/41763102

http://stackoverflow.com/q/26547706
linked to: http://stackoverflow.com/q/25531688
accepted answer: http://stackoverflow.com/a/26547867
has comment: http://stackoverflow.com/comment/41722243
linked to: http://stackoverflow.com/q/19908476
has comment: http://stackoverflow.com/comment/41718526
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26547867
tagged with: swing
has body: I am working on a Swing GUI, which consists of several panels, tables and table models which are connected to an underlying MySQL database using Hibernate. My current aim is to store information about the current user, id and table name, in a kind of History/Log table. The problem I'm facing is that I have to pass the user name to all panels to the table model, because this last one is the responsible to create a new log record in case of UPDATE, SAVE, DELETE events. I am thinking about a way to separate user variable from panels/table models. This at least would spare the pass-through of user variable through panels. Any ideas or suggestions?
tagged with: tablemodel
type: AnsweredQuestion
has title: How to separate User data from my Swing components?
tagged with: java
has comment: http://stackoverflow.com/comment/41718361
type: Question

localization
tags question: http://stackoverflow.com/q/26646944
type: Tag
tags question: http://stackoverflow.com/q/26614394
tag name: localization
tags question: http://stackoverflow.com/q/26642720
tags question: http://stackoverflow.com/q/26671527

http://stackoverflow.com/q/26570738
has comment: http://stackoverflow.com/comment/41760538
score: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41760081
type: Question
has comment: http://stackoverflow.com/comment/41760869
has title: How to close Threads before opening new Threads in Java?
tagged with: java
has body: I have problems with Java's Multi-Threading feature, so hopefully somebody can help me.... Here is my problem: In the JPanel ExamplePanel which is located in the JFrame ExampleFrame I've added a ComponentListener which invokes the startPaint()-Method. This method should work in a new Thread. My Problem is that by resizing the window "former" Threads aren't closed, meanwhile new Threads are added.... So is there a way to resize the JPanel and to close at the same time the "old" threads, so that the number of threads is not growing, when I resize the JPanel? I have tried something with a boolean exiter-variable, but it do not seemed to work... here is the code: package example; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.ArrayList; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Example2 { public static void main(String[] args) throws InterruptedException { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new ExampleFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } class ExampleFrame extends JFrame { private static final long serialVersionUID = 1L; ExamplePanel examplePanel = new ExamplePanel(); private Thread t=null; private class ExamplePanel extends JPanel implements ComponentListener { private static final long serialVersionUID = 1L; @Override public void componentHidden(ComponentEvent e) { } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentResized(ComponentEvent e) { startPaint(); } @Override public void componentShown(ComponentEvent e) { } private void startPaint() { t=new Thread(new Runnable() { @Override public void run() { //System.out.println(Thread.currentThread().getName()); while (true) { //System.out.println(Thread.activeCount()); } } }); t.start(); } } public ExampleFrame() { examplePanel.addComponentListener((ComponentList…
has comment: http://stackoverflow.com/comment/41760770
has comment: http://stackoverflow.com/comment/41760948
has comment: http://stackoverflow.com/comment/41761047
has comment: http://stackoverflow.com/comment/41760559
has comment: http://stackoverflow.com/comment/41760848
has comment: http://stackoverflow.com/comment/41763058
has comment: http://stackoverflow.com/comment/41762556
answer count: 1
has answer: http://stackoverflow.com/a/26571945
has comment: http://stackoverflow.com/comment/41761479
accepted answer: http://stackoverflow.com/a/26571945
has comment: http://stackoverflow.com/comment/41760703
type: AnsweredQuestion

http://stackoverflow.com/a/26543848
downvote count: 0
upvote count: 3
has body: You don't get the EntityManager in an interface, although you might be able to work around it by doing a lookup. But why are you even doing this? Spring Data JPA already supports the Optional return type so you don't need to implement it. Spring Data will do it for you. public interface UserRepository extends JpaRepository&lt;User, UUID&gt; { Optional&lt;User&gt; findByLoginIgnoreCase(String login) { } The code above should be all you need. You could even specify a query with @Query if you would need it. A Sample can be found here.
type: Answer
has comment: http://stackoverflow.com/comment/41712641
answers question: http://stackoverflow.com/q/26543612
has comment: http://stackoverflow.com/comment/41712555
score: 3

http://stackoverflow.com/comment/41695489
score: 0
type: AnswerComment
type: Comment
has text: Great! If you experience further issues, ping us at support@pubnub.com!
comment on: http://stackoverflow.com/a/26522284

http://stackoverflow.com/comment/41931228
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26664609
has text: Ah I meant that "Unfortunately xxx has stopped" dialog box.

http://stackoverflow.com/comment/41731414
type: QuestionComment
has text: @sln is right. If you look closely at the image you posted, you'll see that it's matching `horario`, not `horarios`. The regex engine tries the alternatives in the order they're listed, so if one of the alternatives is a prefix of another, you have to list the longer one first.
score: 0
comment on: http://stackoverflow.com/q/26553567
type: Comment

http://stackoverflow.com/a/26594430
has comment: http://stackoverflow.com/comment/41804208
type: Answer
has comment: http://stackoverflow.com/comment/41805691
downvote count: 0
has comment: http://stackoverflow.com/comment/41805383
score: 1
has comment: http://stackoverflow.com/comment/41805825
has body: One of the options is to use is Open Session in View but it had few drawbacks and is considered as a bad practice by several people. I would suggest reading the following SO posts to make an informed choice. Open Session In View Pattern Why is Hibernate Open Session in View considered a bad practice? http://java.dzone.com/articles/open-session-view-design
has comment: http://stackoverflow.com/comment/41804102
answers question: http://stackoverflow.com/q/26594328
upvote count: 1

http://stackoverflow.com/comment/41735873
type: Comment
type: QuestionComment
score: 0
has text: @JaredBurrows Unfortunately the solution doesn't work.
comment on: http://stackoverflow.com/q/26557090

http://stackoverflow.com/comment/41812194
comment on: http://stackoverflow.com/q/26598869
type: Comment
type: QuestionComment
has text: It is convention to start a class name, in Java, with an uppercase letter. Please review the Java Tutorials: [Variables and Naming](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html).
score: 1

c3p0
tags question: http://stackoverflow.com/q/26583120
tags question: http://stackoverflow.com/q/26523313
tag name: c3p0
type: Tag
tags question: http://stackoverflow.com/q/26605717

http://stackoverflow.com/comment/41694109
has text: {"address":"Babbrruu","fullName":"Test User","phone":"+3556060231","photoURL":"http://www.ipizza.al/testuser.jpg"} this is the content of the file
comment on: http://stackoverflow.com/q/26533131
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41741471
type: Comment
type: QuestionComment
has text: Thanks. Yes I wil do. Goog Weekend !
comment on: http://stackoverflow.com/q/26560370
score: 0

semaphore
type: Tag
tags question: http://stackoverflow.com/q/26576470
tags question: http://stackoverflow.com/q/26562363
tags question: http://stackoverflow.com/q/26570338
tag name: semaphore

http://stackoverflow.com/comment/41738460
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26558314
type: AnswerComment
has text: Could you say more? I have printed the packet size before and after it is sent/received and the size doesn't seem to get changed. However, the problem persists and occasionally I still receive a packet of size 0 (at login).

http://stackoverflow.com/comment/41812018
comment on: http://stackoverflow.com/q/26598472
type: QuestionComment
score: 0
has text: *"And at the end of the "TablePrintable" method, you say?"* - No, at the end of the `jButton4ActionPerformed` method
type: Comment

http://stackoverflow.com/q/26618618
tagged with: osgi
has comment: http://stackoverflow.com/comment/41883623
accepted answer: http://stackoverflow.com/a/26662297
tagged with: spring
has comment: http://stackoverflow.com/comment/41922524
has comment: http://stackoverflow.com/comment/41883804
has comment: http://stackoverflow.com/comment/41875696
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41923090
upvote count: 1
tagged with: confluence
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41872885
has comment: http://stackoverflow.com/comment/41922966
has comment: http://stackoverflow.com/comment/41922948
has answer: http://stackoverflow.com/a/26662297
has comment: http://stackoverflow.com/comment/41923085
has comment: http://stackoverflow.com/comment/41913143
has comment: http://stackoverflow.com/comment/41922069
answer count: 1
has body: I'm working on writing a plugin for Atlassian Confluence. I've had it working in a development environment for quite some time. But, when I package the plugin and deploye it into a test system the plugin fails to enable. I see the following cause / error message in the stack trace (included in entirety at the end of this question). I've formatted it for slightly easier reading: Caused by: org.osgi.framework.BundleException: Constraint violation for package 'org.springframework.transaction' when resolving module 200.0 between existing import 0.org.springframework.transaction BLAMED ON [ [200.0] package; (&(package=org.springframework.transaction)(version>=0.0.0)(version<=0.0.0)) ] and uses constraint 4.0.org.springframework.transaction BLAMED ON [ [200.0] package; (package=org.springframework.jms.connection) ] I'm having trouble understanding what this is trying to tell me. The Confluence OSGi container debugging information indicates the following for the packages mentioned: 0 - System Bundle 4 - Spring Framework 200 - com.foo.ConflunceJMSIntegration (my plugin) I am suspect this has something to do with class loaders used by the various modules, but I just don't know how to interpret the message or what to do to resolve the problem. New information: The plugin works with Confluence 5.5.4 but fails with 5.6.4. I made a new empty generated plugin (atlas-create-confluence-plugin) and carefully added each of my dependencies to the pom.xml until I was able to produce the failure. The failure is clearly caused when I add this dependency: com.foo JMSTools 1.0-SNAPSHOT org.slf4j slf4j-api javax.mail mail log4j log4j This is a library I wrote. While it doesn't use Spring for configuration itself, some objects implement org.springframework.beans.factory.DisposableBean and use org.springframework.util.StringUtils, so Spring is a legitimate requirement. This is the dependency in JMSTools: org.springframework spring-beans 2.5.6.SEC02 provided And.... now that I type this out I …
downvote count: 0
has title: Adding a <dependency> to my Atlassian plugin's pom.xml causes a Spring BundleException with a Constraint violation
favorite count: 0
has comment: http://stackoverflow.com/comment/41922312

http://stackoverflow.com/a/54224138
type: Answer
answers question: http://stackoverflow.com/q/26649018
score: 0
has body: Authorize.net now works with JSON. Following is a valid JSON string that you could send to Authorize using whatever platform you use and your own login and secret key. I should note that even though JSON normally doesn't care which order the values are sent in, Authorize uses a kludgy method to internally convert JSON to XML, so order is in fact, important. { "createTransactionRequest": { "merchantAuthentication": { "name": "yourLoginKey", "transactionKey": "yourSecretKey" }, "refId": "12345", "transactionRequest": { "transactionType": "authCaptureTransaction", "amount": "3.99", "payment": { "creditCard": { "cardNumber": "4111111111111111", "expirationDate": "0522", "cardCode": "123" } }, "customer": { "id": "John Doe" }, "billTo": { "firstName": "John", "lastName": "Doe", "address": "123 My Street", "city": "Chicago", "state": "IL", "zip": "60007", "country": "USA" } } } }

http://stackoverflow.com/comment/41912092
has text: you need to provide `setbounds` to `JScrollPane` not to `JTable`. And avoid using `null` layouts
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26654654

http://stackoverflow.com/q/26555773
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26556027
tagged with: properties-file
score: 0
has comment: http://stackoverflow.com/comment/41733386
linked to: http://stackoverflow.com/q/4548699
has answer: http://stackoverflow.com/a/26556027
answer count: 1
tagged with: jar
has body: I´ve included a jar (I built it: MyJar.jar) that i use to authenticate, in that jar I have to read some properties that I have in a package (e.g com.myproject.properties) inside a property file of my project. I have a method in MyJar.jar which receive the name of the property and the path for the property file something like this: public String getValueOfProperty(String property,String pathToPropertyFile){ BasicTextEncryptor encryptor = new BasicTextEncryptor(); Properties props = new EncryptableProperties(encryptor); props.load(new FileInputStream(pathToPropertyFile)); .... } I got the following error: System can't find the specified path The path is: com/myproject/properties/conf.properties What am I doing wrong?
has comment: http://stackoverflow.com/comment/41733221
has comment: http://stackoverflow.com/comment/41733470
has comment: http://stackoverflow.com/comment/41733350
has title: Call Property file from a jar included in my project

http://stackoverflow.com/a/50537959
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26613035
has body: Use this for downloading an JPEG image using exchange. This works perfect. URI uri = new URI(packing_url.trim()); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.IMAGE_JPEG)); HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;("parameters", headers); // Send the request as GET ResponseEntity&lt;byte[]&gt; result= template.exchange(uri, HttpMethod.GET, entity, byte[].class); out.write(result.getBody());

http://stackoverflow.com/comment/41703007
score: 0
has text: @AndrewThompson I understand but I am supposed to remain restricted to using the drawstring since there is processing involved on those strings, which is drawn anywhere on the JPanel.
comment on: http://stackoverflow.com/q/26538726
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41839016
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26613212
has text: @tacoman50 Post as edit to your question. But judging from it, I guess you called finish in onKeyDown().

http://stackoverflow.com/q/26646736
has comment: http://stackoverflow.com/comment/41898807
possible better answer: http://stackoverflow.com/a/26646962
has comment: http://stackoverflow.com/comment/41898657
linked to: http://stackoverflow.com/q/3038392
downvote count: 2
has comment: http://stackoverflow.com/comment/41898658
upvote count: 1
has comment: http://stackoverflow.com/comment/41898849
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41898629
has title: Maximum length of String[]
has answer: http://stackoverflow.com/a/26646962
has answer: http://stackoverflow.com/a/26646889
tagged with: java
accepted answer: http://stackoverflow.com/a/26646855
score: -1
type: Question
has body: I have a long String and I want to parse it using array of strings like this: String data = ... very long String delimited by spaces... String[] parse = data.split(" "); But I get the following error: java.lang.ArrayIndexOutOfBoundsException: 4617 Is it possible, that maximum length of String array is 4617 ?
has comment: http://stackoverflow.com/comment/41899100
has comment: http://stackoverflow.com/comment/41898649
has answer: http://stackoverflow.com/a/26646855
has comment: http://stackoverflow.com/comment/41898797
tagged with: string
favorite count: 0
answer count: 3

http://stackoverflow.com/a/26556610
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26556317
has comment: http://stackoverflow.com/comment/41735464
type: Answer
has comment: http://stackoverflow.com/comment/41734902
accepted answer of: http://stackoverflow.com/q/26556317
has comment: http://stackoverflow.com/comment/41735186
downvote count: 0
has comment: http://stackoverflow.com/comment/41736387
score: 1
has comment: http://stackoverflow.com/comment/41735169
has body: As far as I know you can't access that field, however you can use a string resource: values/strings.xml: com.example.some_authority Manifest: <provider android:authorities="@string/my_authority" </provider> And in your code: getString(R.string.my_authority)

http://stackoverflow.com/q/26525612
favorite count: 0
has body: import java.util.ArrayList; public class LengthsOfStrings { public static ArrayList&lt;Integer&gt; lengths(ArrayList&lt;String&gt; list) { ArrayList&lt;Integer&gt; lengthList = new ArrayList&lt;Integer&gt;(); list.length(); return lengthList; } public static void main(String[] args) { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Ciao"); list.add("Moi"); list.add("Benvenuto!"); list.add("badger badger badger badger"); ArrayList&lt;Integer&gt; lengths = lengths(list); System.out.println("The lengths of the Strings: " + lengths); } } I was thinking something like this, but I don't know what to fill in the list.length(); with.
has answer: http://stackoverflow.com/a/26525825
upvote count: 1
answer count: 4
possible better answer: http://stackoverflow.com/a/26525637
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26525637
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26525672
tagged with: arraylist
has title: Finding lengths of a string in an ArrayList using ArrayList as a return value of a method
has answer: http://stackoverflow.com/a/26525654
downvote count: 0
accepted answer: http://stackoverflow.com/a/26525672

http://stackoverflow.com/comment/41666601
has text: possible duplicate of [How to select a frame using selenium?](http://stackoverflow.com/questions/18366689/how-to-select-a-frame-using-selenium)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26514305

http://stackoverflow.com/comment/41677045
has text: The name itself is irrelevant, the fields are the components of the primary key
score: 0
comment on: http://stackoverflow.com/a/26524473
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26533497
has body: You need to close the file handler with fh.close() once you've finished. Otherwise, you leave the files locked. That's why your image is showing so many lock files open!
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26532570
answers question: http://stackoverflow.com/q/26532570
type: Answer
downvote count: 0
score: 7

http://stackoverflow.com/a/26619470
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26537539
type: Answer
answers question: http://stackoverflow.com/q/26537539
has body: The problem I'm having is that not all attributes get set. This problem does not happen in an ant build from a command line or eclipse. It happens during ant builds using the IBM Rational Team Concert Jazz Build Engine. I don't know what the problem is but I have found a workaround using dynamic ant tasks without setters. See here for a simple description. This worked for me.

http://stackoverflow.com/comment/41964068
has text: @HovercraftFullOfEels The other question is, what would be worth putting into it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26672007
type: Comment

http://stackoverflow.com/a/26579435
score: 2
downvote count: 0
has body: Both of your switch statements are setting cardClas. You need one of them to set cardType instead. Also, your two getters are very confusing. You seem to have swapped the names over somehow; so you have getClasses returning cardType and getType returning cardClas. You might want to fix this.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26579411

http://stackoverflow.com/comment/41948665
type: QuestionComment
type: Comment
has text: Okay, see this link (http://stackoverflow.com/questions/4191492/launch-facebook-app-from-other-app). It might help you.
comment on: http://stackoverflow.com/q/26647912
score: 0

http://stackoverflow.com/comment/41746272
comment on: http://stackoverflow.com/q/26563202
score: 1
type: Comment
type: QuestionComment
has text: O.K., now what do you want us to do?

http://stackoverflow.com/q/26576580
tagged with: contains
has title: Contains method case-insensitive without major code changes?
tagged with: string
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/14018478
has answer: http://stackoverflow.com/a/26576943
answer count: 1
has comment: http://stackoverflow.com/comment/41770845
has comment: http://stackoverflow.com/comment/41776872
has comment: http://stackoverflow.com/comment/41770766
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41771532
has comment: http://stackoverflow.com/comment/41771512
has comment: http://stackoverflow.com/comment/41771491
tagged with: case-insensitive
tagged with: java
has comment: http://stackoverflow.com/comment/41772462
has body: Is there a way to ignore the case for the contains() method but at the same time leave the code snippet more or less the same? /** * This method returns a list of all words from the dictionary that include the given substring. * */ public ArrayList&lt;String&gt; wordsContaining(String text) { int index = 0; ArrayList&lt;String&gt; wordsContaining = new ArrayList&lt;String&gt;(); while(index&lt;words.size()) { if((words.get(index).contains(text))) { wordsContaining.add(words.get(index)); } index++; } return wordsContaining; } here is the whole SpellChecker Class: public class SpellChecker { private ArrayList&lt;String&gt; words; private DictReader reader; /** * Constructor for objects of class SpellChecker */ public SpellChecker() { reader = new DictReader("words.txt"); words = reader.getDictionary(); } /** * This method returns the number of words in the dictionary. * */ public int numberOfWords() { return words.size(); } /** * This method returns true, if (and only if) the given word is found in the dictionary. * */ public boolean isKnownWord(String word) { int index =0; while(index &lt; words.size()) { if(words.get(index).equals(word)) { return true; } index++; } return false; } /** * This method returns true if (and only if) all words in the given wordList are found in the dictionary. */ public boolean allKnown(ArrayList&lt;String&gt; wordList) { for(String word : wordList) { if(isKnownWord(word)) { return true; } } return false; } /** * This method tests the allKnown method. */ public boolean testAllKnown() { ArrayList&lt;String&gt; testWords = new ArrayList&lt;String&gt;(); testWords.add("Abu"); testWords.add("Chou"); if(allKnown(testWords)) { return true; } else { return false; } } /** * This method returns a list of all words from the dictionary that start with the given prefix. * */ public ArrayList&lt;String&gt; wordsStartingWith(String prefix) { int index = 0; ArrayList&lt;String&gt; wordsStartingWith = new ArrayList&lt;String&gt;(); while(index&lt;words.s…
has comment: http://stackoverflow.com/comment/41770832
has comment: http://stackoverflow.com/comment/41770857
type: Question
linked to: http://stackoverflow.com/q/86780

http://stackoverflow.com/q/26617304
has comment: http://stackoverflow.com/comment/41846220
has comment: http://stackoverflow.com/comment/41845979
score: 0
has comment: http://stackoverflow.com/comment/41845942
has title: Printing out a .txt file
has comment: http://stackoverflow.com/comment/41846079
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26618502
has body: I have a quick question I have a program I am writing in java, it takes a .txt file reads what is inside it(this case it being a bunch of numbers) the program stores it in an array, then it sorts it from least to greatest it also finds the average as well as it tells me how many numbers in the array are bigger than the average. I have managed to do all of that but what I am having trouble with is now I want the program to print out another .txt file but this time with the results of my program. I want it to print out the sorted array the average the number of how many elements are in the array as well as the number of numbers bigger than the average. here is my code that i have: import java.util.Scanner; import java.util.Arrays; class numberSorter{ public static void main (String[]args)throws Exception{ //calling the .txt file java.io.File file= new java.io.File("numTestData.txt"); java.io.File file2=new java.io.File("dataOut.txt"); Scanner input = new Scanner(file); //getting the numbers from the file int num=input.nextInt(); //starting variables int ct=0; int bigger=0; double average; double track=0; double[]numberArray=new double[num]; //filling in the rest of the numbers in the array for(int i =0; i &lt; numberArray.length; i++){ numberArray[i] = input.nextInt(); } input.close(); //calling the sort method to sort the array sort(numberArray); //tracking how many elements are in the array for(int i=0;i&lt;numberArray.length;i++){ track+=numberArray[i]; } //finding the average of the sorted array average=track/numberArray.length; //looking through the array to find which number is bigger than the average for(int i=0;i&lt;numberArray.length;i++) { if(numberArray[i]&gt;average) bigger++; } //checking to see of the .txt file exists if(file2.exists()){ System.out.println("file exists"); System.exit(0); } //creating a file try( java.io.PrintWriter output=new java.io.PrintWriter(file2); ){ //printing out to the .txt file output.println("Number of slots:"); output.println…
has comment: http://stackoverflow.com/comment/41845973
tagged with: arrays
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/41847383
has comment: http://stackoverflow.com/comment/41846198

http://stackoverflow.com/q/26650653
tagged with: swing
tagged with: jbutton
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16799624
duplicate of: http://stackoverflow.com/q/16799624
answer count: 0
has body: I have a JxTreeTable with four columns . First column has laboratory test names. Second column status of tests ie initially "pending". I need a buttons namely "send" and "complete" in third and fourth column respectively. When i click "send" button against a test ,status must change from "pending" to "waiting" and when i click "complete" button status must change from "waiting" to "complete". I created a JxTreeTable programmatically and added test name and status "pending" to JxtreeTable. Now, how can I add Jbutton to third and fourth cell of JxtreeTable and how to change status by clicking thos buttons in cell. Help me to sort this problem.
tagged with: swingx
has comment: http://stackoverflow.com/comment/41905920
type: Question
has comment: http://stackoverflow.com/comment/41905701
tagged with: java
score: 0
tagged with: jxtreetable
has title: Add jButton to JxTreeTable cell

http://stackoverflow.com/comment/41739547
has text: This is implementation detail the VM does not necessarily expose, ie, your belief about how an object is stored is not necessarily true, and in this case appears to be untrue.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26559013
type: Comment

http://stackoverflow.com/q/26517658
has answer: http://stackoverflow.com/a/26549817
type: Question
tagged with: c#
tagged with: network-programming
has comment: http://stackoverflow.com/comment/41683956
has body: I am consuming a web service (which was written in Java) in C#. The web service is available in LAN but at compile time I don't know the address of the server. I need to scan the network to find the IP address of the computer where the web service is hosted. I do know the port though. At the moment, I have the following code, which is supposed to give me a list of all active IP address and then I am planning trying to find out if the write port is open, and as soon as I find a computer where the right port is open, I will know the IP address of the server, am I thinking along the correct lines? List&lt;IPAddress&gt; ipList = new List&lt;IPAddress&gt;(); IPGlobalProperties network = IPGlobalProperties.GetIPGlobalProperties(); TcpConnectionInformation[] connections = network.GetActiveTcpConnections(); foreach (TcpConnectionInformation ipEnds in connections) { ipList.Add(ipEnds.LocalEndPoint.Address); Console.WriteLine(ipEnds.LocalEndPoint.Address.ToString()); }
has comment: http://stackoverflow.com/comment/41665929
has comment: http://stackoverflow.com/comment/41665389
has answer: http://stackoverflow.com/a/26548155
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41665461
has comment: http://stackoverflow.com/comment/41665952
has title: How to automatically discover Web Service by scanning LAN C#
has comment: http://stackoverflow.com/comment/41665680
favorite count: 0
has comment: http://stackoverflow.com/comment/41666000
type: UnansweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41665590
tagged with: java
tagged with: web-services
has comment: http://stackoverflow.com/comment/41666167

http://stackoverflow.com/comment/41785505
comment on: http://stackoverflow.com/a/26584876
score: 0
type: AnswerComment
has text: /^[\w!#$'*+=?^\/~-]+(\.[\w!#$'*+=?^\/~-]+)*@([a-zA-Z0-9-]+\.)+[A-Z]{2,4}$/.test("raju.rathi@gmail.com") - still i'm getting false when i ran this in java script console
type: Comment

http://stackoverflow.com/comment/41859794
comment on: http://stackoverflow.com/q/26625202
has text: Don't mark the association as eager fetched. You posted no code at all, so we can't point you to where the error is.
score: 0
type: Comment
type: QuestionComment

batch-processing
tags question: http://stackoverflow.com/q/26646843
tag name: batch-processing
tags question: http://stackoverflow.com/q/26553873
tags question: http://stackoverflow.com/q/26606636
tags question: http://stackoverflow.com/q/26585485
tags question: http://stackoverflow.com/q/26560556
type: Tag
tags question: http://stackoverflow.com/q/26529995

http://stackoverflow.com/comment/41725152
comment on: http://stackoverflow.com/q/26551416
has text: `@Override public int getCount(){ return 0; }`... why??
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26562320
upvote count: 1
has body: Your problem is right here: public void addToInnerArray(int index, int index2, T element) { while (index &gt;= this.size()) { this.add(new ArrayList&lt;T&gt;()); } ArrayList&lt;T&gt; inner = this.get(index); while (index2 &gt;= inner.size()) { inner.add(null); } inner.set(index2, element); // &lt;- this line } You're removing the old element from the inner array list by using setToInnerArray and removeFromInnerArray, but instead of adding the new element, you're overwritting an existing element. Therefore the inner list remains at 2 instead of 3 elements. Change that mentioned line to: inner.add(index2, element); // "add" instead of "set" You might try to get familiar with using debuggers, because they could help you in situations like this.
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26562107
accepted answer of: http://stackoverflow.com/q/26562107

http://stackoverflow.com/q/26531200
possible better answer: http://stackoverflow.com/a/26531857
downvote count: 1
type: Question
tagged with: tostring
has body: I have done the assignment as best as I could but I am still stuck. Apparently, some things are not okay with the code. Could someone please give me advice about what might be wrong with it? It works fine up until some point, but then I am not able to print out the details of the Course using the toString() method along with the details of the schedule, also using the toString() method. //package declaration package assignment2app; import javax.swing.JOptionPane; public class Assignment2App { public static void main(String[] args) { Schedule s1=new Schedule(); String r=JOptionPane.showInputDialog(null, "Please enter the semester", "Information", JOptionPane.INFORMATION_MESSAGE); s1.setSemester(r); String t=JOptionPane.showInputDialog(null, "Please enter the year", "Information", JOptionPane.INFORMATION_MESSAGE); int g=Integer.parseInt(t); s1.setYear(g); String u=JOptionPane.showInputDialog(null, "Please enter the number of courses taken", "Information", JOptionPane.INFORMATION_MESSAGE); int w=Integer.parseInt(u); while(w!=0){ String y=JOptionPane.showInputDialog(null, "Please list the courses you have taken.Enter 'none' when you are done", "Information", JOptionPane.INFORMATION_MESSAGE); Course c2=new Course(y, 3); if(!y.equalsIgnoreCase("none")) s1.AddCourse(c2); else w=0; } JOptionPane.showMessageDialog(null, s1.toString() , "Schedule", JOptionPane.INFORMATION_MESSAGE); if(w&gt;5){ JOptionPane.showMessageDialog(null, "Sorry you cannot take more than 5 courses", "Information", JOptionPane.INFORMATION_MESSAGE); } while(w&gt;5){ String j=JOptionPane.showInputDialog(null, "Please enter the name of the course that you would like to remove", "Information", JOptionPane.INFORMATION_MESSAGE); s1.RemoveCourse(j); w--; } Schedule s2=new Schedule(); s2.setSemester("Summer1"); s2.setYear(2014); int count=0; while(count&lt;3){ String f=JOptionPane.showInputDialog(null, "Please enter the Course Code", "Data Entry", JOptionPane.INFORMATION_MESSAGE); String h=JOptionPane.showInput…
score: -1
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/26531562
answer count: 2
has title: 2 classes and one MainApp
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26531857
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26531562
tagged with: java

http://stackoverflow.com/a/26538610
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26538582
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26538582
type: Answer
downvote count: 0
score: 1
has body: You're doing: a = userNum; //compiler: "WTF is a?? I dunno... Exception!!!!!!" b = userNum2; //compiler: "WTF is b?? Exception!!!!" //...THEN: double a; //compiler: "I didn't read this far, I stopped at the first exception." int b; You need to do: double a; //compiler: "okay, a is going to refer to a double" int b; //compiler: "okay, b is going to refer to an int" //...THEN: a = userNum; //compiler: "cool, a refers to THAT double" b = userNum2; //compiler: "cool, b refers THAT int" i.e. you have to declare your variables before you do anything with them.

http://stackoverflow.com/comment/41962725
score: 0
type: AnswerComment
has text: This made no difference. I have added the error I get to the opening post.
type: Comment
comment on: http://stackoverflow.com/a/26670978

http://stackoverflow.com/comment/41682582
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26527815
has text: @Kuba That sounds like an entirely different question, but have a look at `git clean`.

http://stackoverflow.com/q/26555346
has comment: http://stackoverflow.com/comment/41732441
has answer: http://stackoverflow.com/a/26572517
accepted answer: http://stackoverflow.com/a/26556249
has comment: http://stackoverflow.com/comment/41732647
tagged with: regex
favorite count: 0
has comment: http://stackoverflow.com/comment/41809105
has answer: http://stackoverflow.com/a/26555515
has answer: http://stackoverflow.com/a/26555763
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41732481
has comment: http://stackoverflow.com/comment/41732445
tagged with: java
score: 10
upvote count: 10
has body: I have this problem: I have a String, but I need to make sure that it only contains letters A-Z and numbers 0-9. Here is my current code: boolean valid = true; for (char c : string.toCharArray()) { int type = Character.getType(c); if (type == 2 || type == 1 || type == 9) { // the character is either a letter or a digit } else { valid = false; break; } } But what is the best and the most efficient way to implement it?
has answer: http://stackoverflow.com/a/26556249
possible better answer: http://stackoverflow.com/a/26555436
has answer: http://stackoverflow.com/a/34811759
answer count: 8
tagged with: char
has title: Java - what is the best way to check if a STRING contains only certain characters?
has answer: http://stackoverflow.com/a/26555436
has answer: http://stackoverflow.com/a/26602260
downvote count: 0
has answer: http://stackoverflow.com/a/26555372
tagged with: string

http://stackoverflow.com/comment/41742970
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26561242
has text: So tools and libraries could instantiate bean instances with no user intervention or default values required.
type: Comment

http://stackoverflow.com/a/26515216
score: 0
upvote count: 1
has body: I think your approach is correct. This is not a GWT issue - once a browser makes a call to the server, the server is going to respond - whether you need this response or not. So you have to have a flag someone to decide which response is unwanted.
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26514743

http://stackoverflow.com/comment/41806852
has text: Any way we can get you to tidy up your code a bit so that it's easier to follow? Also, you're using an odd mixture of double and float to do things... try to stick with BigDecimal for monetary transactions so that you don't lose precision. Some of your problems may be due to mixing and matching of data types.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26595783

http://stackoverflow.com/comment/131544701
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/59693641
has text: Sure @ArthurKazemi. Still nothing to do with my comment. Different data source for save database vendor is not same as different data sources for different database vendors

http://stackoverflow.com/a/26529432
score: 0
has body: The file 'ServiceDisplay\db.properties' is in your resources directory, to load this file is necessary to use the getResoursceAsStream. Code example below: ServletContext context = request.getSession().getServletContext(); InputStream is = context.getResourceAsStream("/db.properties");
type: Answer
answers question: http://stackoverflow.com/q/26529328

http://stackoverflow.com/a/26567045
has body: You're trying to find the footer view on the wrong parent view. At the moment the code you posted is trying to find the "contactCounter" on your base view, which is not what you want. You want to find the "contactCounter" view on your footer view. Change this line: contactCounter = (TextView)findViewById(R.id.contactCounter); to contactCounter = (TextView)footer.findViewById(R.id.contactCounter); And it should work as you want it to.
accepted answer of: http://stackoverflow.com/q/26566659
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26566659
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41753161

http://stackoverflow.com/a/26636506
has body: That worked but if I give the values {-3, -5, -4} I receive this: -3.0x^2-5.0-4.0 It's missing the x from the second term(-5.0x). That is happining only if the second value is a negative one. For positive values it's working fine.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26636018
has comment: http://stackoverflow.com/comment/41881204

http://stackoverflow.com/comment/53837610
type: AnswerComment
has text: Postgres uses the question mark as an operator on jsonb types. See: http://www.postgresql.org/docs/9.4/static/functions-json.html
type: Comment
comment on: http://stackoverflow.com/a/26555612
score: 13

http://stackoverflow.com/a/26535775
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26535707
answers question: http://stackoverflow.com/q/26535707
has body: You need to change if(values[i]==number[i]) to if(values[i]==number[j]) Furthermore I would use a boolean so that you don't output a line at every iteration of the loop, but just at the end of the analysis of each value in args. It would end up to be something like : boolean found; for(int i=0; i&lt;values.length; i++){ found = false; for(int j=0; j&lt;number.length; j++){ if(values[i]==number[j]){ found = true } } if(found){ System.out.println("Number is found"); } else { System.out.println("Number is not found"); } }
type: Answer
has comment: http://stackoverflow.com/comment/41697958
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41697945
has comment: http://stackoverflow.com/comment/41697779
has comment: http://stackoverflow.com/comment/41697828

http://stackoverflow.com/q/26672826
answer count: 1
accepted answer: http://stackoverflow.com/a/26711302
tagged with: postgresql
has body: I have following query in my sql mapping file, it is using OR in the generated SQL query for FIELD3. It is a List of Integer select * from MY_TABLE where MY_TABLE.FIELD1 = 1 MY_TABLE.FIELD2 = $field2$ MY_TABLE.FIELD3= $field3_list[]$ If I want to use IN instead of OR , iterate is removed, the below will work? select * from MY_TABLE where MY_TABLE.FIELD1 = 1 MY_TABLE.FIELD2 = $field2$ MY_TABLE.FIELD3 IN $field3_list[]$
tagged with: ibatis
has title: ibatis use IN instead of OR
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/26711302

http://stackoverflow.com/q/26596839
tagged with: boxlayout
has comment: http://stackoverflow.com/comment/41813170
type: AnsweredQuestion
score: 3
has body: I'm trying to build a simple panel which I will throw some fields onto and capture some user data. I typically use a combination of GridBagLayouts (thanks to trashgod) and BoxLayouts to achieve the layout I want. I normally don't have any issues with using them and they just do what makes intuitive sense 99% of the time, but I can't seem to make this rather simple panel function properly. Can anyone tell me why? The panel class: import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class EmailPanel extends JPanel { private JButton m_OkButton; private JPanel m_MainPanel; private JTextField m_ServerIPTF; private JTextField m_ServerPortTF; private JTextField m_DomainNameTF; private JTextField m_UnitNameTF; private JTextField m_Recipient1TF; private JTextField m_Recipient2TF; private final Dimension LARGE_TEXTFIELD_SIZE = new Dimension(125, 25); public EmailPanel() { init(); } private void init() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel tPanel; JLabel tLabel; Header: { tPanel = new JPanel(); tPanel.setLayout(new BoxLayout(tPanel, BoxLayout.X_AXIS)); tPanel.add(Box.createHorizontalGlue()); tLabel = new JLabel("Email Settings"); tPanel.add(tLabel); tPanel.add(Box.createHorizontalGlue()); tPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 3, 0, Color.red)); this.add(tPanel); } MainPanel: { m_MainPanel = new JPanel(); m_MainPanel.setLayout(new BoxLayout(m_MainPanel, BoxLayout.Y_AXIS)); m_MainPanel.add(Box.createVerticalStrut(5)); tPanel = new JPanel(); tPanel.setLayout(new BoxLayout(tPanel, BoxLayout.X_AXIS)); tPanel.add(Box.createHorizontalStrut(3)); tLabel = new JLabel("Server IP Address:"); tPanel.add(tLabel); tPanel.add(Box.createHorizontalStrut(3)); m_ServerIPTF = new JTextField(); m_ServerIPTF.setMinimumSize(LARGE_TEXTFIELD_SIZE); m_ServerIP…
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26605310
has title: How to use VerticalGlue in box layout
downvote count: 0
tagged with: layout-manager
linked to: http://stackoverflow.com/q/8492065
has comment: http://stackoverflow.com/comment/41831338
answer count: 1
has comment: http://stackoverflow.com/comment/41823329
favorite count: 0
has comment: http://stackoverflow.com/comment/41831434
has answer: http://stackoverflow.com/a/26605310
tagged with: swing

http://stackoverflow.com/q/26657634
has answer: http://stackoverflow.com/a/26657694
tagged with: java
score: -1
type: Question
upvote count: 0
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/26657694
has comment: http://stackoverflow.com/comment/41926466
has title: How to pass parameter through array objects?
favorite count: 0
downvote count: 1
tagged with: parameters
tagged with: object
type: AnsweredQuestion
has body: The issue I'm having is that when I create the 5 OutgoingPhoneCall objects, the second parameter does not pass. I can't figure out why though. Any help would be appreciated. public class PhoneCallArray { public static void main(String[] args) { PhoneCall [] phoneArray = new PhoneCall[10]; for(int x = 0; x &lt; 5; x++) { phoneArray[x] = new IncomingPhoneCall("1-800-555-789" + x); } for(int y = 5; y &lt; 10; y++) { phoneArray[y] = new OutgoingPhoneCall("1-800-555-789" + y, y * 5); } for(int a = 0; a &lt; 10; a++) { phoneArray[a].displayInfo(); } public abstract class PhoneCall { //Declare variables. String phoneNumber; double callPrice; //Constructor. public PhoneCall(String phoneNumber){ this.phoneNumber = phoneNumber; callPrice = 0.0; } public void setCallPrice(double callPrice) { this.callPrice = callPrice; } public abstract String getPhoneNumber(); public abstract double getPrice(); public abstract void displayInfo(); } public class OutgoingPhoneCall extends PhoneCall { int callTime; public OutgoingPhoneCall(String phoneNum, int time){ super(phoneNum); time = callTime; callPrice = 0.04; } @Override public String getPhoneNumber(){ return phoneNumber; } @Override public double getPrice(){ callPrice = callTime * callPrice; return callPrice; } public int getCallTime(){ return callTime; } @Override public void displayInfo() { JOptionPane.showMessageDialog(null, "Phone number: " + getPhoneNumber() + "\nRate: " + callPrice + "\nTotal duration: " + getCallTime() + " min"+ "\nPrice of call: $" + getPrice(),"Call Summary", JOptionPane.INFORMATION_MESSAGE); } }

http://stackoverflow.com/a/26526810
answers question: http://stackoverflow.com/q/26526676
score: 0
type: Answer
has body: You are only ever assigning one character as bConWin's data. Here's a fix as well as some tidying: public static void main(String args[]) { String value = "HaaaOppSaN"; if(value != null) { StringBuilder newValue = new StringBuilder(); for(int i = 0; i &lt; value.length(); i++) { char x = value.charAt(i); if(Character.isLowerCase(x)) { x = Character.toUpperCase(x); } else { x = Character.toLowerCase(x); } newValue.append("" + x); } bConWin.setData(newValue.toString()); } }

http://stackoverflow.com/comment/41892504
type: Comment
type: QuestionComment
has text: I have also posted it at Network Engineering because I think it fits better there.
comment on: http://stackoverflow.com/q/26636809
score: 0

http://stackoverflow.com/a/26619405
has body: The only difference is that you can still call the constructor inside your class: public final class UtilityClass { public static final UtilityClass Instance = new UtilityClass(); private UtilityClass () {} public static int Foo (int a, int b) { return a+b; } } But since you're the designer of that class, it wouldn't make any sense to break your own code contracts. In general, most software design books I've ever read, are against using static methods. Unless they are really utility methods: in the sense they will never ever require any state. And even then, it's only a small effort to implement a Singleton pattern such that, when the time would come, you can assign state to it: public final class UtilityClass { public static final UtilityClass Instance = new UtilityClass(); private UtilityClass () {} public int Foo (int a, int b) { return a+b; } } And calling it with UtilityClass.Instance.Foo(2,5);. It would be way harder to perform an introduce state transformation later on in the coding process. Thus static methods are harder to maintain. The reason why instances are useful is that you can use them in a lot of patterns like Strategy if at one occasion it depends on something what should be done,... By using static methods, one makes the methods less dynamic because Java doesn't support method pointers (for good reasons). Thus non-static methods are more dynamic and useful. Furthermore some security researchers argue that it is harder to analyze code with static modifiers since they can be accessed from anywhere and the side effects are less predictable (for instance in an automatic security analysis tool): say you have an class that is not fully implemented, then you can still analyze the fields to know which methods it can access and thus analyze the possible side effects (network usage, file IO,...). This can generate a list of possible hazards per class that should be verified. At least if I understood the PhD dissertation of one of my fellow researchers corre…
upvote count: 6
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41850369
answers question: http://stackoverflow.com/q/26618890
score: 5

datagram
tags question: http://stackoverflow.com/q/26578692
type: Tag
tag name: datagram
tags question: http://stackoverflow.com/q/26565665

nutiteq
tag name: nutiteq
tags question: http://stackoverflow.com/q/26669633
type: Tag

http://stackoverflow.com/a/26576535
downvote count: 0
answers question: http://stackoverflow.com/q/26573424
type: Answer
has comment: http://stackoverflow.com/comment/41771057
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26573424
has body: Just remember there is no magic to make the server aware of anything you could have done in javascript client side. The only way you can send data from client to server (except using Ajax calls) is to send what is contained is a single form. How the hell could the server guess what are the other values since the form contains only one field and there is no reference to the question in URL ? As you opened the popup with javascript, you should use javascript to modify the DOM of the div id="popupWindow". You can : either add a hidden field in the form for the questionId and use a custom update query to modify only the appropriate attributes (more exactly : add the field in the jsp and modify the value in the DOM via javascript) or add the questionId in the action URL and use it server side as a @PathVariable to automatically retrieve the selected question I know there is a good deal of work remaining, but this is enough to understand why it doesn not work and how to change your application to make it work.
type: AcceptedAnswer

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/26650617

http://stackoverflow.com/comment/41821340
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26604184
type: Comment
has text: (1) Is your `Pas` class Serializable? (2) What is happening when you run the code? Do you get any errors?

http://stackoverflow.com/comment/41932125
type: AnswerComment
comment on: http://stackoverflow.com/a/26665171
type: Comment
score: 0
has text: @Trejkaz Right, I thought that lambdas were shorthands for anonymous classes, so I was rather surprised to find that `isAnonymousClass` returned `false`.

http://stackoverflow.com/q/26659912
type: Question
tagged with: sockets
upvote count: 1
answer count: 1
has title: How to use a server for redirecting clients to direct connecting to each other
has answer: http://stackoverflow.com/a/26660460
tagged with: java
has body: I want to be able to connect (java)clients to each other without opening ports in their router or forwarding on their local network. I want to mimic the behavior of webtrc but in java, using a server for signaling. The server will have to receive session keys from both clients that wants to connect to each other, sending the first clients key to the second client and vice versa. After the signaling, the both clients can connect to each other using this key, and the packets will find their way through the router without opening ports and forwarding. The goal is to make a framework out of this to be able to write applications that don't require a server with huge bandwidth that can read from one client and write to the other, for every pair of clients that wants to send data to each other. What I'm asking for is simply guidelines for this could be implemented. TLDR: I want to be able to directly connect two clients, in two completely different networks, with the help of a public server and without any router configuration for the clients.
tagged with: server
downvote count: 0
accepted answer: http://stackoverflow.com/a/26660460
type: AnsweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/a/27083305
has body: Have a look at https://web.archive.org/web/20110925093759/https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/alfresco-jlan/ Here you will find a runsrv.bat (and runsrv.sh) script to bootstrap a JLANServer using the provided XML config: jlanConfig.xml Since the provided files (jlanConfig.xml and JLANServer) are not part of the provided binaries (e.g. not part of alfresco-jlan-embed v5.0.b), you need to provide a similar setup yourself. For example: ServerConfiguration cfg = new JLANFileServerConfiguration(); NetBIOSNameServer netBIOSNameServer = new NetBIOSNameServer(cfg); cfg.addServer(netBIOSNameServer); SMBServer smbServer = new SMBServer(cfg); cfg.addServer(smbServer); // start servers for (int i = 0; i &lt; cfg.numberOfServers(); i++) { NetworkServer server = cfg.getServer(i); server.startServer(); } The ServerConfiguration can be read from XML file, or constructed using Java code: private static final String HOSTNAME = "JLANHOST"; private static final int DefaultThreadPoolInit = 25; private static final int DefaultThreadPoolMax = 50; private static final int[] DefaultMemoryPoolBufSizes = { 256, 4096, 16384, 66000 }; private static final int[] DefaultMemoryPoolInitAlloc = { 20, 20, 5, 5 }; private static final int[] DefaultMemoryPoolMaxAlloc = { 100, 50, 50, 50 }; public JLANFileServerConfiguration() throws InvalidConfigurationException, DeviceContextException { super(HOSTNAME); setServerName(HOSTNAME); // DEBUG DebugConfigSection debugConfig = new DebugConfigSection(this); final GenericConfigElement debugConfigElement = new GenericConfigElement("output"); final GenericConfigElement logLevelConfigElement = new GenericConfigElement("logLevel"); logLevelConfigElement.setValue("Debug"); debugConfig.setDebug("org.alfresco.jlan.debug.ConsoleDebug", debugConfigElement); // CORE CoreServerConfigSection coreConfig = new CoreServerConfigSection(this); coreConfig.setMemoryPool( DefaultMemoryPoolBufSizes, DefaultMemoryPoolInitAlloc, DefaultMemo…
upvote count: 6
has comment: http://stackoverflow.com/comment/42806782
has comment: http://stackoverflow.com/comment/42798056
answers question: http://stackoverflow.com/q/26631989
downvote count: 0
has comment: http://stackoverflow.com/comment/42798042
has comment: http://stackoverflow.com/comment/42797319
type: Answer
score: 6

http://stackoverflow.com/q/26611084
has answer: http://stackoverflow.com/a/26611125
accepted answer: http://stackoverflow.com/a/26611125
has title: replaceAll() not working as expected and passing value outside a helper thread to main thread
type: AnsweredQuestion
tagged with: java
has body: Two problem: Solved Replaced $ with another special character @ and it solved the problem. Problem 1 I have a variable String strVar which contains below text (which it has read from a file). Now I am trying to use replaceAll() to replace texts (e.g. $pixeltrackers$ with "sampletext") but it is not replacing this particular string at all, maybe due to quotes and spaces etc. What can be a possible solution? $pixeltrackers$ $headlinetext$ $descriptiontext$ Rating: $ratingtext$ by: $advertisertext$ Problem 2 I have a thread with a try-catch block. Inside the try block I have the HTML stored in a variable which I want to load into a webview. Now Android/Java doesn't allow Webview to be called any other place apart from main thread. How can I pass this String variable value outside the scope of thread?
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41835739
tagged with: android
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: multithreading

http://stackoverflow.com/q/26607044
possible better answer: http://stackoverflow.com/a/26607647
accepted answer: http://stackoverflow.com/a/26607419
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41826701
tagged with: methods
tagged with: design-patterns
tagged with: java
has answer: http://stackoverflow.com/a/26607419
has body: I was wondering if defining a callback for a operation in a method parameter is worse than defining it in the object and setting via setters, concerning about design patterns. I'm not sure if exists a design pattern regarding callback creations. For example, let's say that there is some class A, and I want to execute a methodM with some callback. public class A { public interface Callback { void onEvent(); } public static methodM(...) { // ... } } May I do this: public static void methodM(Callback c) { c.onEvent(); } // ... A.method(this); // The class that calls the method is the callback! Instead of: public static void setCallback(Callback callback) { this.callback = callback; } public static void methodM() { this.callback.onEvent(); } // ... A.setCallback(this); // The class that calls the method is the callback! A.method(); Note that the fact of the method be static is just to easy the scenario understanding. So, can I use the first approach as a valid design? The reason about using the first scenario is to avoid memory leaks as to easy the definition of simple callbacks for multiple execution, since I would have to control a list of callbacks using either lists, observers, etc.
score: 2
type: AnsweredQuestion
downvote count: 0
has title: Design Patterns: Callback as a method parameter
tagged with: callback
favorite count: 0
has comment: http://stackoverflow.com/comment/41827359
has answer: http://stackoverflow.com/a/26607647
type: Question
tagged with: method-parameters

http://stackoverflow.com/q/26541503
tagged with: arraylist
answer count: 2
has answer: http://stackoverflow.com/a/26541541
tagged with: arrays
downvote count: 0
favorite count: 0
has title: Alter final array based on line length
accepted answer: http://stackoverflow.com/a/26541541
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26541596
upvote count: 1
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26541596
has body: I have a textfile with 3 headings like serviceid, jobid, serviceNumber 001, 5, 280 This stores mechanics jobs for the week. There can only be one jobid/serviceid but there can be more than one service number. I have a String[] which holds the split then assigns these values. But, the trick is some lines have more than one serviceNumber like serviceid, jobid, serviceNumber 002, 8, 250,280,290 How do I expand my array to hold any extra codes encountered along the way to the int[] serviceNumberArray? And, I'm not allowed to use ArrayList. Here's my current code: String jobs; //holds extracted textfile values int jobID; //holds job id int serviceID; //holds service id int[] serviceNumber; //holds all service numbers String[] splitJobs = new String[2]; //holds all split jobs splitJobs = jobs.split(","); //splits jobs and sets delimiter as comma this.serviceid = Integer.parseInt(splitJobs[0]); this.jobID = Integer.parseInt(splitJobs[1]); this.serviceNumber = Integer.parseInt(splitJobs[2]);

http://stackoverflow.com/a/26581636
type: Answer
accepted answer of: http://stackoverflow.com/q/26581426
answers question: http://stackoverflow.com/q/26581426
type: AcceptedAnswer
has body: First, using the scanner class you ask for the number of tickets. Second, you need to make a method for the code generating the ticket. Third, loop the getticket with printing. and thats it. Here is the (working) code: import java.io.*; import java.util.Scanner; public class test{ public static void main(String[] args) { System.out.print("Enter number of tickets: "); Scanner numReader= new Scanner(System.in); int num = numReader.nextInt(); System.out.println("Lottery Numbers: "); System.out.println(); for(int i=0; i&lt;num; i++) { int[] lottoNumber = getTicket(); System.out.print(lottoNumber[0] + " " ); System.out.print(lottoNumber[1] + " " ); System.out.print(lottoNumber[2] + " " ); System.out.print(lottoNumber[3] + " " ); System.out.print(lottoNumber[4] + " " ); System.out.print("MEGA:(" + lottoNumber[5] + ")"); System.out.println(); } } public static int[] getTicket() { int[] lottoNumber = new int[6]; { lottoNumber[0] = (int) ((47 * Math.random()) + 1); lottoNumber[1] = (int) ((47 * Math.random()) + 1); lottoNumber[2] = (int) ((47 * Math.random()) + 1); lottoNumber[3] = (int) ((47 * Math.random()) + 1); lottoNumber[4] = (int) ((47 * Math.random()) + 1); lottoNumber[5] = (int) ((27 * Math.random()) + 1); } return lottoNumber; } }
score: 0

http://stackoverflow.com/a/26643203
type: Answer
has body: for(int x = 0; x &gt;= scores.length; ++x) Try x&lt; scores.length instead. The way you've written it, x starts at zero and the loop repeats while x>scores.length, which it never is, so nothing ever happens.
score: 0
answers question: http://stackoverflow.com/q/26643175
has comment: http://stackoverflow.com/comment/41893020

http://stackoverflow.com/q/26632229
possible better answer: http://stackoverflow.com/a/26632314
has answer: http://stackoverflow.com/a/26632270
has comment: http://stackoverflow.com/comment/41872771
has answer: http://stackoverflow.com/a/26632314
answer count: 6
has answer: http://stackoverflow.com/a/26632297
has answer: http://stackoverflow.com/a/26632273
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26632424
downvote count: 0
has title: Java Path.startswith() broken?
accepted answer: http://stackoverflow.com/a/26632270
has answer: http://stackoverflow.com/a/26632311
favorite count: 0
type: Question
upvote count: 3
tagged with: java
has body: I have to be misunderstanding this. Given the following code, I expect a "they match" printout. I get "oops. no match." Path p = Paths.get("C:\\fakename"); Path q = Paths.get("C:\\fake"); if(p.startsWith(q)) { System.out.println("they match"); } else { System.out.println("oops. no match."); } What am I misunderstanding? The documentation seems pretty clear.

http://stackoverflow.com/a/26540141
type: Answer
answers question: http://stackoverflow.com/q/26538804
has body: There are two options: 1) polling or 2) pushing which would allow your server (in the servlet handling the GWT request) to notify you (after the order is successfully placed). In 1) polling, the client (meaning the browser you are using to monitor the app) will periodically call the server to see if there is data waiting. It may be more resource intensive as many calls are made for infrequent data. It may also be slower due to the delay between calls. If only your monitoring client is calling though it wouldn't be so resource intensive. In 2) pushing, the client will make a request and the request will be held open until there is data. It is less resource intensive and can be faster. Once data is returned, the client sends another request (this is long polling). Alternatively, streaming is an option where the server doesn't sent a complete request and just keeps sending data. This streaming option requires a specific client-/browser-specific implementation though. If it's just you monitoring though, you should know the client and could set it up specifically for that. See the demo project in GWT Event Service Here is the documentation (user manual) for it. Also see GWT Server Push FAQ There are other ways of doing it other than GWT Event Service of course. Just google "GWT server push" and you'll find comet, DWR, etc., and if you are using Google's App Engine the Channel API
score: 0

http://stackoverflow.com/q/26532473
has comment: http://stackoverflow.com/comment/41692664
type: Question
has comment: http://stackoverflow.com/comment/41692504
accepted answer: http://stackoverflow.com/a/26534441
has title: Multiple Configurations of a Bean with Spring Annotations
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41691390
has answer: http://stackoverflow.com/a/26534441
tagged with: annotations
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: In my example here, I have a "Hero" bean which can be injected with a "Weapon" bean. Both Heros and Weapons are prototype-scoped (we can have multiple heroes, and they won't share weapons). What I want to have is a Hero configuration called "Warrior" which is injected with a "Sword" weapon, and a Hero configuration called "Archer" which is injected with a "Bow" weapon. Then in my application I would call context.getBean("Warrior"); each time I want to get a new warrior. I know how to do this with XML, but I was wondering if it is possible to do this with annotations? If so, how do I do it? I am using Spring 4.
has comment: http://stackoverflow.com/comment/41691447
has comment: http://stackoverflow.com/comment/41692654

http://stackoverflow.com/comment/41751489
type: Comment
score: 0
type: AnswerComment
has text: Thank you for the answer, it did work but the problem is that I want the users to start the app normally without having to use a terminal. That means that the path should be added to the application before exporting to .jar, which I am unable to do. I found another solution to put the dlls inside [...]/jre7/bin/ but that also needs manipulations from the end users.
comment on: http://stackoverflow.com/a/26557415

http://stackoverflow.com/a/26667576
answers question: http://stackoverflow.com/q/26667453
has body: Your other for loop would throw ArrayIndexOutOfBoundsException when i==array2.length-1, because the following condition is evaluated from left to right, so array2[i+1] would be aveluated before i != array2.length-1 is evaluated. if (array2[i] == 0 &amp;&amp; array2[i+1] != 0 &amp;&amp; i != array2.length-1) { System.out.println("apple"); array2[i] = array2 [i+1]; result = true; } You should change it to : if ( i != array2.length-1 &amp; array2[i] == 0 &amp;&amp; array2[i+1] != 0) { System.out.println("apple"); array2[i] = array2 [i+1]; result = true; } Your second if condition avoids a similar exception, since you check that i != 0 before checking that array2[i-1] == array2[i].
type: Answer
score: 0

http://stackoverflow.com/comment/42447456
type: Comment
comment on: http://stackoverflow.com/a/26553289
has text: ![this is my original image for encryption][1] ![after decryption i got this image which is flipped][2] [1]: https://i.sstatic.net/Rc8Na.jpg [2]: https://i.sstatic.net/fsflM.png can i know why this is happening
type: AnswerComment
score: 0

http://stackoverflow.com/a/26666181
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26666161
has body: Haven't tried to compile these, but usually you don't use a type parameter on the class you declare in these cases: public class FooClass implements Map.Entry&lt;String, List&lt;String&gt;&gt; or public class FooMap extends HashMap&lt;String, List&lt;String&gt;&gt;
type: Answer

http://stackoverflow.com/a/26517279
score: 1
accepted answer of: http://stackoverflow.com/q/26517100
has comment: http://stackoverflow.com/comment/41665442
answers question: http://stackoverflow.com/q/26517100
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41664718
has comment: http://stackoverflow.com/comment/41664806
has comment: http://stackoverflow.com/comment/41664751
has body: Your main() has some extra calls. I think you just wanted something like public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter a letter: "); String letter = keyboard.nextLine(); System.out.println("Please enter an integer: "); int digit = keyboard.nextInt(); System.out.println(isVowel(letter)); System.out.println("The reversed digits are: " + reverseDigit(digit)); } To test if it's a vowel, let's trim the output and switch on the uppercase character like - private static boolean isVowel(String line) { line = (line != null) ? line.trim() : ""; if (line.length() == 1) { switch (Character.toUpperCase(line.charAt(0))) { case 'A': case 'E': case 'I': case 'O': case 'U': return true; } } return false; } To reverse the number, convert it to a String add it to a StringBuilder and then reverse() that, private static String reverseDigit(int val) { StringBuilder sb = new StringBuilder(String.valueOf(val)); return sb.reverse().toString(); }
upvote count: 1

http://stackoverflow.com/comment/41724463
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26550559
has text: I hope this blog will give you some idea how it's been set up and used. http://kevindoran1.blogspot.com/2013/02/solr-tutorial.html

http://stackoverflow.com/comment/80644678
type: QuestionComment
has text: resolved by adding registration.setMessageSizeLimit(102400* 1024);
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26543904

http://stackoverflow.com/comment/41949549
comment on: http://stackoverflow.com/q/26670434
type: Comment
type: QuestionComment
has text: You added `import oracle.jdbc.OracleTypes` and still get the same error? How about fully specifying `oracle.jdbc.OracleTypes.VARCHAR` in the call instead? I think you want an `OracleCallableStatement` here though really, with `registerOutParameter()`. What you have is for the DML `returning` clause.
score: 0

http://stackoverflow.com/comment/42110543
comment on: http://stackoverflow.com/q/26571944
has text: Hello, have you solved this issue. I need the same thing, selected item should be bigger and a little above other elements, like it is floating a little above.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26575676
answer count: 1
has comment: http://stackoverflow.com/comment/41771022
has comment: http://stackoverflow.com/comment/41770544
favorite count: 0
has answer: http://stackoverflow.com/a/26576930
has comment: http://stackoverflow.com/comment/41770100
score: 6
has title: Spring does not use annotated constructor (@JsonCreator) for instantiation
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41770497
has body: I am using Spring 4.1.1 with JavaConfig and Jackson 2.4.3. My controller looks like this: @RestController public interface PatientWebService { @RequestMapping(value = "/patients", method = POST) PatientResource createPatient(@RequestBody PatientResource resource); } The json I am sending looks like this: { "firstName": "Max", "lastName": "Mustermann", "birthDate": "1964-04-14", "sex": "MAN" } and I want it to be parsed into this class: package at.landsteiner.patient.web; import at.landsteiner.patient.Patient; import at.landsteiner.patient.Sex; import at.landsteiner.web.EntityResource; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.LocalDate; public class PatientResource extends EntityResource { private String firstName; private String lastName; private LocalDate birthDate; private Sex sex; @JsonCreator public PatientResource(@JsonProperty("firstName") String firstName, @JsonProperty("lastName") String lastName, @JsonProperty("birthDate") LocalDate birthDate, @JsonProperty("sex") Sex sex) { this.firstName = firstName; this.lastName = lastName; this.birthDate = birthDate; this.sex = sex; } // getter } This is the output I am getting: 19:43:41,842 INFO [stdout] (default task-1) 19:43:41 DEBUG o.s.w.s.DispatcherServlet.doService - DispatcherServlet with name 'DispatcherServlet' processing POST request for [/questionnaire-api/patients] 19:43:41,846 INFO [stdout] (default task-1) 19:43:41 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping.getHandlerInternal - Looking up handler method for path /patients 19:43:41,850 INFO [stdout] (default task-1) 19:43:41 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping.getHandlerInternal - Returning handler method [public at.landsteiner.patient.web.PatientResource at.landsteiner.patient.web.PatientWebServiceImpl.createPatient(at.landsteiner.patient.web.PatientResource)] 19:43:41,850 INFO [stdout] (default task-1) 19:43:41 DEBUG o.s.b.f.s.DefaultListableBeanFactory…
has comment: http://stackoverflow.com/comment/41771185
upvote count: 7
accepted answer: http://stackoverflow.com/a/26576930
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41771467
has comment: http://stackoverflow.com/comment/41770306
has comment: http://stackoverflow.com/comment/41771059
tagged with: jackson
has comment: http://stackoverflow.com/comment/41770872
has comment: http://stackoverflow.com/comment/41771141
has comment: http://stackoverflow.com/comment/41770560
has comment: http://stackoverflow.com/comment/41770916
has comment: http://stackoverflow.com/comment/41770768

http://stackoverflow.com/comment/41876811
type: QuestionComment
comment on: http://stackoverflow.com/q/26634324
has text: @Pimgd, the result of that is 999999999.9999999999. However The above code is part of a bigger validation logic and that's why I need to resolve that rounding issue without having to modify the entire way of how we do things.
score: 0
type: Comment

http://stackoverflow.com/q/26611367
answer count: 1
has body: I am running parallel automated tests against a Selenium Grid. Sometimes, a test with fail with; Session [c1d99cc1-c689-4053-b68d-51c3682c13c4] was terminated due to CLIENT_STOPPED_SESSION (org.openqa.grid.common.exception.GridException) [remote server] org.openqa.grid.internal.ActiveTestSessions(ActiveTestSessions.java):105:in `getExistingSession' The Selenium documentation says; CLIENT_STOPPED_SESSION The session was stopped using an ordinary call to stop/quit on the client. Why are you using it again?? However, I know that the client has not attempted to stop/quit. I am using parallel rspec so each thread is actually it's own Ruby instance, so there is no issue test side. Also, if I directly query the Node using http://{node_ip}:5556/wd/hub/static/resource/hub.html, I can see the session is still open. If quit/stop had been issued then, this session would have been deleted. It would appear that it is only the Session Registry in the Selenium Grid Hub that thinks this session has been stopped. There is no evidence of the session being stopped anywhere else. Is there a known issue with Grid where the incorrect session has been marked as stopped?
has comment: http://stackoverflow.com/comment/129862995
favorite count: 0
has comment: http://stackoverflow.com/comment/64403853
has answer: http://stackoverflow.com/a/39624697
type: UnansweredQuestion
has title: Selenium Hub incorrectly believes CLIENT_STOPPED_SESSION has happened
has comment: http://stackoverflow.com/comment/48743572
tagged with: java
tagged with: selenium
score: 6
upvote count: 7
downvote count: 1
type: Question
tagged with: selenium-grid
has comment: http://stackoverflow.com/comment/129839467
has comment: http://stackoverflow.com/comment/64185874
has comment: http://stackoverflow.com/comment/48737634

http://stackoverflow.com/q/26640572
has title: Border around Images when making PDF in PDFBox
tagged with: java
has answer: http://stackoverflow.com/a/26659374
type: Question
type: AnsweredQuestion
score: 3
tagged with: pdfbox
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf
possible better answer: http://stackoverflow.com/a/26659374
downvote count: 0
favorite count: 0
has body: I have been using PDFBox to generate pdf files and was wondering if it is possible to add a border around images. If not, is there some algorithm that allows you to efficiently draw lines precisely around the image? I have the following code that allows myself to add an image to a pdf page: //image for page 2 public File processPDF() { //creating pdf PDDocument document = new PDDocument(); File file = new File("NWProofReference.pdf"); //adding first page to pdf, blank PDPage page = new PDPage(); PDPageContentStream contentStream; try { BufferedImage awtImage = ImageIO.read(new File(PDFProcessing.image)); PDXObjectImage ximage = new PDPixelMap(document, awtImage); float scale = 1.0f; // alter this value to set the image size contentStream.drawXObject(ximage,100,400, (ximage.getWidth()*scale,ximage.getHeight()*scale); contentStream.close(); document.save(file); document.close(); } catch (Exception e) { e.printStackTrace(); } return file; } Using this or any code, is there any way to actually add a border around the image itself that is made available through the PDFBox API?
has answer: http://stackoverflow.com/a/26659681
accepted answer: http://stackoverflow.com/a/26659681
upvote count: 3

http://stackoverflow.com/q/26585874
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41793521
has comment: http://stackoverflow.com/comment/41787250
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41792728
has body: I am trying to generate a certificate using keytool with the following command: keytool.exe -genkeypair -alias myalias -keyalg RSA -dname CN=www.some-thing.aaa.bbb.ccc.com -sigalg SHA1withRSA -validity 3650 -keystore D:\path\Path\keystore The certificate gets generated and placed in the keystore. However after I open my browser it doesn't accept the certificate because the certificate has following properties: issued to: *.aaa.bbb.ccc.com issued by: *.aaa.bbb.ccc.com The above is problematic because "*.aaa.bbb.ccc.com" is not equal to "www.some-thing.aaa.bbb.ccc.com " thus the certificate is not seen as issued by correct authority. How do I generate a certificate so that it contains full address in "issued to" and "issued by"? Thanks, M.
tagged with: keystore
tagged with: x509certificate
has title: java keytool too long address
has comment: http://stackoverflow.com/comment/41792950
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41811124
type: Question
has comment: http://stackoverflow.com/comment/41792680
has comment: http://stackoverflow.com/comment/42368148
tagged with: ssl-certificate
has comment: http://stackoverflow.com/comment/41807006
has comment: http://stackoverflow.com/comment/41787179
has comment: http://stackoverflow.com/comment/41788203

http://stackoverflow.com/comment/41892303
comment on: http://stackoverflow.com/q/26642815
has text: Obviously `SqlConnector.ConnectDb()` is for getting a database connection object. None of the other fields is being set to anything other than `null`, this is why they are `null`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26651390
has answer: http://stackoverflow.com/a/26651597
answer count: 1
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xpath
type: Question
upvote count: 1
linked to: http://stackoverflow.com/q/16235957
has title: How to get attribute value of node in xml using xpath?
tagged with: java
duplicate of: http://stackoverflow.com/q/16235957
downvote count: 0
has comment: http://stackoverflow.com/comment/41909106
type: UnansweredQuestion
has body: I want to get the value of attribute name of all the nodes. my xml is xyz Street pqr jkl for that i am using below code String xpathExpression = "//branch-area[@name]"; NodeList list = (NodeList) XPathFactory.newInstance().newXPath().evaluate(xpathExpression,inputSource, XPathConstants.NODESET); for(int i=0; i<list.getLength();i+=1) { System.out.println(list.item(i).getFirstChild().getNodeValue()); } but i am getting an empty string can you please tell me where i am wrong ?

jsp
tags question: http://stackoverflow.com/q/26569907
tags question: http://stackoverflow.com/q/26615426
tags question: http://stackoverflow.com/q/26564881
tags question: http://stackoverflow.com/q/26572034
tags question: http://stackoverflow.com/q/26550185
tags question: http://stackoverflow.com/q/26563332
tags question: http://stackoverflow.com/q/26554015
tags question: http://stackoverflow.com/q/26584939
tags question: http://stackoverflow.com/q/26570435
tags question: http://stackoverflow.com/q/26527774
tags question: http://stackoverflow.com/q/26561771
tags question: http://stackoverflow.com/q/26642870
tags question: http://stackoverflow.com/q/26623936
tags question: http://stackoverflow.com/q/26590332
tags question: http://stackoverflow.com/q/26573424
tags question: http://stackoverflow.com/q/26532870
tags question: http://stackoverflow.com/q/26534400
tags question: http://stackoverflow.com/q/26638974
tags question: http://stackoverflow.com/q/26662066
tags question: http://stackoverflow.com/q/26525073
tags question: http://stackoverflow.com/q/26547298
tags question: http://stackoverflow.com/q/26529328
tags question: http://stackoverflow.com/q/26657795
tags question: http://stackoverflow.com/q/26562615
tags question: http://stackoverflow.com/q/26651855
tags question: http://stackoverflow.com/q/26556456
tags question: http://stackoverflow.com/q/26656398
tags question: http://stackoverflow.com/q/26637836
tags question: http://stackoverflow.com/q/26652712
tags question: http://stackoverflow.com/q/26571590
tags question: http://stackoverflow.com/q/26573886
tags question: http://stackoverflow.com/q/26553984
tags question: http://stackoverflow.com/q/26624257
tags question: http://stackoverflow.com/q/26518983
tags question: http://stackoverflow.com/q/26546856
tags question: http://stackoverflow.com/q/26560174
tags question: http://stackoverflow.com/q/26653103
tags question: http://stackoverflow.com/q/26648004
tags question: http://stackoverflow.com/q/26637261
tags question: http://stackoverflow.com/q/26572863
tags question: http://stackoverflow.com/q/26616239
tags question: http://stackoverflow.com/q/26515733
type: Tag
tags question: http://stackoverflow.com/q/26579686
tags question: http://stackoverflow.com/q/26524067
tags question: http://stackoverflow.com/q/26543014
tags question: http://stackoverflow.com/q/26630095
tags question: http://stackoverflow.com/q/26539073
tags question: http://stackoverflow.com/q/26554521
tags question: http://stackoverflow.com/q/26552700
tags question: http://stackoverflow.com/q/26532112
tags question: http://stackoverflow.com/q/26580442
tags question: http://stackoverflow.com/q/26605297
tags question: http://stackoverflow.com/q/26614845
tags question: http://stackoverflow.com/q/26610350
tags question: http://stackoverflow.com/q/26548028
tags question: http://stackoverflow.com/q/26651638
tags question: http://stackoverflow.com/q/26601454
tags question: http://stackoverflow.com/q/26649752
tags question: http://stackoverflow.com/q/26589706
tags question: http://stackoverflow.com/q/26588667
tags question: http://stackoverflow.com/q/26585804
tags question: http://stackoverflow.com/q/26550472
tag name: jsp
tags question: http://stackoverflow.com/q/26562212
tags question: http://stackoverflow.com/q/26583363
tags question: http://stackoverflow.com/q/26602095
tags question: http://stackoverflow.com/q/26671316
tags question: http://stackoverflow.com/q/26530485
tags question: http://stackoverflow.com/q/26532570
tags question: http://stackoverflow.com/q/26587598
tags question: http://stackoverflow.com/q/26570593
tags question: http://stackoverflow.com/q/26602219
tags question: http://stackoverflow.com/q/26640837
tags question: http://stackoverflow.com/q/26584224
tags question: http://stackoverflow.com/q/26630034
tags question: http://stackoverflow.com/q/26669206
tags question: http://stackoverflow.com/q/26599657
tags question: http://stackoverflow.com/q/26612925
tags question: http://stackoverflow.com/q/26619938

http://stackoverflow.com/q/26665161
favorite count: 0
tagged with: android
has body: I need to duplicate an ArrayList from one activity from another. This is an ArrayList of an object that I named Dias, and it contains a String and a boolean: Arraylist {Dias} // Dias contains(String Dias, boolean estado) And I have to pass this ArrayList to other activity. My Dias class: public class Dias { private String Dia; private boolean estado; //CONSTRUCTOR DE LA CLASE// public Dias(String Dia, boolean estado) { this.Dia = Dia; this.estado = estado; } //GETTERS Y SETTERS DE LA CLASE// public String getDia() { return Dia; } public void setDia(String dia) { Dia = dia; } public boolean isChekeado() { return estado; } public void setChekeado(boolean chekeado) { estado = chekeado; } } My Primary Class: public class Primera extends Activity { ArrayList&lt;Dias&gt; dias = new ArrayList&lt;Dias&gt;(); //OnClick Method public void lanzar2(View view){ dias.add(new Dias("Lu", false)); dias.add(new Dias("MAr", false)); Intent i = new Intent(); Bundle b = new Bundle(); b.putParcelableArrayList("arreglo", (ArrayList&lt;? extends Parcelable&gt;) dias); i.putExtras(b); i.setClass(this, ListasActivity.class); startActivity(i); } } How can I send my Arraylist to another activity?, I just don't understand how does it work(parcelable) and also I don't know the syntax to use it. Thank you!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26679899
accepted answer: http://stackoverflow.com/a/26679899
tagged with: java
has title: Send an Arraylist of an object from one activity to another
has answer: http://stackoverflow.com/a/26665247
type: Question
tagged with: arraylist
has answer: http://stackoverflow.com/a/26665321
score: 0
answer count: 3
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/26665247

http://stackoverflow.com/comment/41895839
type: Comment
has text: @RomanC from the initial JSP page I am submitting a form through which "login" action is getting called. So any how execute method of LoginAction will get called.
comment on: http://stackoverflow.com/q/26630034
score: 0
type: QuestionComment

http://stackoverflow.com/q/26588483
answer count: 2
possible better answer: http://stackoverflow.com/a/26592143
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26592143
favorite count: 0
tagged with: binary
accepted answer: http://stackoverflow.com/a/26588802
has body: I have a Base64 String, which is 'AAAC', which in binary is equivalent to 3 bytes (00000000 00000000 00000010). I would like to convert 'AAAC' to a ASCII Hex Byte String to output something like '000002'. I have tried below. byte[] test = Base64.decode(data.getBytes()); StringBuilder sb = new StringBuilder(); for (byte b : test) { sb.append(String.format("%02X ", b)); } System.out.println(sb.toString()); //Output: 00 00 02 This works, but is there a more effient way to do this? Any help would be appreciated. Thanks in advance.
score: 1
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26588802
tagged with: base64
has title: Convert Base64 String to Byte Value String in Java
type: Question
tagged with: ascii

http://stackoverflow.com/comment/41985813
score: 0
type: Comment
has text: how to disable it??? so that I will never get join to any of my other ports in the network
type: AnswerComment
comment on: http://stackoverflow.com/a/26659366

http://stackoverflow.com/q/26611725
type: Question
score: -1
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/26612218
tagged with: selenium
answer count: 1
downvote count: 1
tagged with: java
has title: How i can get the parent id in html code. In selenium webdirver using java
has body: how i can get the parent id in following html code. using description class name i want to fetch id of that div.there is card-box class name is common for all the div and id is generated at run time. From to for this i m tried this code String val1 = "Final"; List<WebElement> resultList1 = card1.findElements(By.className("description")); for (WebElement resultItem : resultList1){ String tabname=resultItem.getText(); if(tabname.contentEquals(val1)) { System.out.println(description.getAttribute("id")); resultItem.click(); break; } }
type: UnansweredQuestion
upvote count: 0
favorite count: 0

http://stackoverflow.com/q/26598481
has comment: http://stackoverflow.com/comment/41811287
score: 9
has comment: http://stackoverflow.com/comment/41893269
has comment: http://stackoverflow.com/comment/41811331
has comment: http://stackoverflow.com/comment/41893204
upvote count: 9
tagged with: java
answer count: 3
has title: Why does foo+=foo+1 in a loop result in -1?
has answer: http://stackoverflow.com/a/26598541
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26598610
possible better answer: http://stackoverflow.com/a/26598502
accepted answer: http://stackoverflow.com/a/26598541
has answer: http://stackoverflow.com/a/26598502
has body: While reviewing for an exam I noticed I had written a logical error and I believe it is because of the compound assignment += because the Increment ++ executes as intended but it only occurs when assigning the value of foo to foo +1 or foo += foo + 1; Here is the code. //Break Statement Boolean exit = false; int foo = 1, bar = 60; while (!exit) { foo+=foo+1; //Bad Code //foo++; //Good Code //foo=foo+1; // Good Code //foo+=1; // Good Code //System.out.println(foo); //Results in -1 (Infinite Loop) if (foo == bar) { break; } System.out.println("stuff"); } My question is why does foo+=foo+1 result in -1? Please Note: I am new to Stackoverflow and unable to vote up your answer so know that I am thankful for any help and thank you in advance!

http://stackoverflow.com/comment/41792883
type: Comment
comment on: http://stackoverflow.com/q/26586661
type: QuestionComment
has text: or the frameworks wants to handle the whole app from the root path. A look inside your web.xml might help.
score: 0

http://stackoverflow.com/comment/41911925
has text: @clopotziel If you just changed the part I posted it will always display the content the file had at startup. You will have to move the reading into the action listener as only the code in the listener is run when you press the button. I updated the answer to reflect this.
comment on: http://stackoverflow.com/a/26638859
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41746668
has text: This fixed The R problem, but it caused this "getMenuInflater().inflate(R.menu.activity_main, menu);" to have an red error under activity_main" that says activity_main cannot be resolved or is not a field
comment on: http://stackoverflow.com/a/26563356
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26612804
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/41839267
has comment: http://stackoverflow.com/comment/41837506
type: Answer
has body: Are you trying to do @RequestMapping(value = "/getItem", method = RequestMethod.GET) public ServiceRequest&lt;List&lt;SomeModel&gt;&gt; getClaimStatuses(@ModelAttribute RequestParamsModel requestParamModel) { ... }
score: 2
answers question: http://stackoverflow.com/q/26612404

http://stackoverflow.com/a/26641279
score: 0
has body: There are two problems: You need to check next.hasNext() when terminating You need to fix the recursion: Currently you methid will always return 0 because you are ignoring the recursive return value Try this: public static int countsize(int somevalue) { Iterator next = ll.listIterator(somevalue); if (!next.hasNext()) return someValue; System.out.println(somevalue); return countsize(somevalue + 1); }
type: Answer
answers question: http://stackoverflow.com/q/26641098

http://stackoverflow.com/comment/41838650
has text: My class is not in package java.lang. It is in my custom package. This issue is resolved by skipping classes which start with java. as suggested by David. My purpose is to load new class in tomcat so that other classes loaded by tomcat can also access new class. My approach is to create custom classloader which loads new class by byte array but unfortunately existing classes cannot see new class because it is loaded by child classloader. But this approach is wrong. I am loading new class by calling definesClass method on WebappClassLoader object through reflection.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26521016
type: AnswerComment

http://stackoverflow.com/q/26668669
has comment: http://stackoverflow.com/comment/41938727
answer count: 2
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26669048
tagged with: spring
possible better answer: http://stackoverflow.com/a/26669006
tagged with: spring-mvc
has body: In my project i dynamically generate the text box in table like below project Name Date1 Date2 Date3 Date4 Date5 Activity java Development Addnew C++ Development Addnew i display tables for one week.if user clicks addnew i generate the dynamic text box below the row where user clicked addnew button. My problem is how to get all the textbox value in my spring controller as bean class.Because i am not sure abut how many text boxes are come in page load and submit. Any Idea will be greatly appreciated!!!
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41938818
linked to: http://stackoverflow.com/q/5399347
has comment: http://stackoverflow.com/comment/41938849
accepted answer: http://stackoverflow.com/a/26669048
has title: How to receive dynamically generated input value in spring as bean
has comment: http://stackoverflow.com/comment/41938851
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41938948
has answer: http://stackoverflow.com/a/26669006
type: Question

http://stackoverflow.com/q/26631539
favorite count: 0
has answer: http://stackoverflow.com/a/26638378
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/41871439
has answer: http://stackoverflow.com/a/26631705
score: 2
type: AnsweredQuestion
has body: I've been trying to create a bar chart/ loading bar where the text is half one colour and half one another and have been struggling to come up with a simple way to tackle this. My ideas thus far have revolved around creating both bars in their complete state and then having a pair of 'selective transparency' views which would show the respective halves to create the effect. I've been unable to find how to do this selective transparency/ opacity view. Is this possible? Is there some other blindingly obvious way to achieve this effect? Here's a quick drawing of what I'm trying to achieve.
downvote count: 0
tagged with: java
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/26638378
has comment: http://stackoverflow.com/comment/41883368
has title: Android: How to create a loading bar with text half one colour and half another
possible better answer: http://stackoverflow.com/a/26631705
has answer: http://stackoverflow.com/a/26638433

http://stackoverflow.com/comment/41688344
has text: Thank you very much. There was a problem , that I did wrong report.I did `import javax.management.Query;` but needed `import twitter4j.Query;` If you didn't give me your code, will never noticed my attention on it
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26530873
type: AnswerComment

http://stackoverflow.com/comment/41715112
has text: check your own question right on **switch case**. `int id = v.getId();` That result is an int of the button, imagebutton or whatever you clicked. if that matches with the correctAnswer ID (previously stored), is correct!
type: AnswerComment
comment on: http://stackoverflow.com/a/26544772
score: 0
type: Comment

http://stackoverflow.com/comment/41853873
comment on: http://stackoverflow.com/a/26550456
score: 0
type: AnswerComment
type: Comment
has text: How do I know if View.OnClickListener has definitely been implemented? The code is exactly as you said, if that's what you mean... On my logcat, it says, "Skipped 136 frames! The application may be doing too much work on its main thread." Do you think this could be the source of my error, and if so, do you know how to fix this? Thank you!

http://stackoverflow.com/a/26593818
has comment: http://stackoverflow.com/comment/42412667
has comment: http://stackoverflow.com/comment/42334629
has comment: http://stackoverflow.com/comment/42413458
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41804499
answers question: http://stackoverflow.com/q/26593750
has comment: http://stackoverflow.com/comment/41927803
type: Answer
accepted answer of: http://stackoverflow.com/q/26593750
has comment: http://stackoverflow.com/comment/41872832
has body: In my RCP application, I have a View class which is extended by all others. In this View I have : abstract void refresh(); Now, you have to use the refresh method of the view with the TableViewer. @Override public void refresh() { tableViewer.setInput(...); tableViewer.refresh(); } And you have to call the refresh method from the button How to access a view from anotherone. final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); final IWorkbenchPage page = window.getActivePage(); try { if (page.getActivePart() != null) { viewTitle = page.getActivePart().getTitle(); IViewPart view = page.showView(MainView.ID) //id de la view in plugin.xml page.hideView(page.findView(SitesView.ID)); }
has comment: http://stackoverflow.com/comment/41803997
downvote count: 0
score: 1

http://stackoverflow.com/q/26554918
tagged with: java
tagged with: gnupg
type: Question
accepted answer: http://stackoverflow.com/a/26556232
answer count: 1
downvote count: 0
favorite count: 0
has body: It appears that while the PGPPublicKey class offers an isEncryptionKey() method to determine if a public key's algorithm is acceptable for encryption purposes (RSA_GENERAL, RSA_ENCRYPT, ELGAMAL_GENERAL, ELGAMAL_ENCRYPT) this alone is not sufficient for selecting a valid encryption subkey. There is information regarding the intended usage of the public key stored within the packet, as seen in GnuPG packet.h: 41 /* Usage flags */ 42 #define PUBKEY_USAGE_SIG GCRY_PK_USAGE_SIGN /* Good for signatures. */ 43 #define PUBKEY_USAGE_ENC GCRY_PK_USAGE_ENCR /* Good for encryption. */ 44 #define PUBKEY_USAGE_CERT GCRY_PK_USAGE_CERT /* Also good to certify keys.*/ 45 #define PUBKEY_USAGE_AUTH GCRY_PK_USAGE_AUTH /* Good for authentication. */ 46 #define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN /* Unknown usage flag. */ 47 #define PUBKEY_USAGE_NONE 256 /* No usage given. */ My question is, given that Bouncy Castle does not expose these flags, what is the suggested way to extract this key usage information from a PublicKeyPacket in Java?
has title: Extracting GPG Key Usage Flags via Bouncy Castle
tagged with: bouncycastle
upvote count: 3
has answer: http://stackoverflow.com/a/26556232
tagged with: pgp
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/41836875
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26612157
has text: Look at the [javadoc for `java.lang.reflect.Array`](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Array.html) for more details - you'll see it's a utility class (all methods are static), not a class you are meant to instantiate. The name of the class is a tad confusing, I'll warrant, but the package name tells the story, that this is for reflection. It's not in `java.util`, after all.

http://stackoverflow.com/comment/41851037
type: QuestionComment
comment on: http://stackoverflow.com/q/26620120
has text: Please edit your question to more explicitly state what you are trying to achieve.
score: 1
type: Comment

http://stackoverflow.com/a/36824793
score: 2
downvote count: 0
has body: I tried something like this too, for mongo db I had to use the import org.springframework.data.annotation.Id; version of @Id whereas JPA I used import javax.persistence.Id;
answers question: http://stackoverflow.com/q/26574409
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41706351
comment on: http://stackoverflow.com/q/26540772
score: 1
has text: Maybe using [`ArrayList#contains`](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#contains(java.lang.Object))
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41815409
score: 0
has text: Lots of new concepts in it that i do not not know that well, but i guess i better get to studying the, Thanks.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26600240

http://stackoverflow.com/comment/67005371
has text: Well that's kind of the point of Java EE though. You write code to a specification rather than an implementation. The vendors are responsible for providing an implementation that works correctly with the API.
comment on: http://stackoverflow.com/q/26650366
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41926653
score: 0
has text: @Henry bouth stdout and stderr
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26659457

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/26587085

http://stackoverflow.com/a/26579243
has comment: http://stackoverflow.com/comment/41854043
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41776906
has comment: http://stackoverflow.com/comment/41776927
has comment: http://stackoverflow.com/comment/41854077
answers question: http://stackoverflow.com/q/26578325
type: Answer
has comment: http://stackoverflow.com/comment/41854157
has comment: http://stackoverflow.com/comment/41775788
has comment: http://stackoverflow.com/comment/41776890
has comment: http://stackoverflow.com/comment/41777200
has body: Honestly, setAlignmentX probably isn't going to do much for your, setHorizontalAlignment would be a better choice, but having said that, there are other things you can do with the GridBagConstraints To start with, you could use the anchor and weightx properties... phyConstraint.anchor = GridBagConstraints.WEST; phyConstraint.weightx = 1; The anchor will determine the position within the given cell the component will want to align to, this defaults to CENTER. The weightx property describes the amount of space that will given to, based on the remaining space left over after the layout has been calculated, in this case, we're asking for all the remaining space. Next, you can use the insets properties to determine the amount of internal spacing or margin a cell will have, this will affect the position the component when it's laid out... phyConstraint.insets = new Insets(0, 20, 0, 0); Finally, for the optionConstraint, we can also use the fill property, which will determine how a component will size depending on the amount of available space within there cell, in this case, you'll want the component to expand to fill all the available space, for example... optionConstraint.weightx = 1; optionConstraint.fill = GridBagConstraints.HORIZONTAL; Have a look at How to Use GridBagLayout for more details. I'd also consider having a look at How to Use Trees, which might save you some trouble...
has comment: http://stackoverflow.com/comment/41776846
has comment: http://stackoverflow.com/comment/41854105
accepted answer of: http://stackoverflow.com/q/26578325
score: 4
has comment: http://stackoverflow.com/comment/41854132
upvote count: 4
has comment: http://stackoverflow.com/comment/41775841
has comment: http://stackoverflow.com/comment/41775776

http://stackoverflow.com/comment/41846586
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26614932
score: 0
has text: @Bartvbl that works great however, now when I try to change the userChoicePanel icon to the Rock.jpg icon for example, it simply keeps it to the default panel icon. The error is now gone.

http://stackoverflow.com/q/26617186
has title: Java Event Generation
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41846537
has comment: http://stackoverflow.com/comment/41845563
has answer: http://stackoverflow.com/a/26617302
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41862403
favorite count: 0
has comment: http://stackoverflow.com/comment/41845577
type: UnansweredQuestion
has body: I want to design a system which will generate a specific event at a constant rate and this will continue doing in the background. In the foreground it give output of some other events if I want. But the background event will not stop. What is the best way to achieve it in java?

http://stackoverflow.com/q/26566420
has comment: http://stackoverflow.com/comment/41751903
accepted answer: http://stackoverflow.com/a/26566461
possible better answer: http://stackoverflow.com/a/26566563
has title: How to Declare and read values into integer variables?
linked to: http://stackoverflow.com/q/26565347
has body: I'm really new to java and i'm taking an introductory class to computer science. I need to know how to Prompt the user to user for two values, declare and define 2 variables to store the integers, and then be able to read the values in, and finally print the values out. But im pretty lost and i dont even know how to start i spent a whole day trying.. I really need some help/guidance. I need to do that for integers, decimal numbers and strings. Can someone help me? this is what ive tried import java.util.Scanner; class VariableExample { Scanner scan = new Scanner(System.in); System.out.println("Please enter an integer value"); int a = scan.nextInt(); int b = scan.nextInt(); System.out.println("Please enter an integer value"); double c = scan.nextDouble(); double d = scan.nextDouble(); System.out.println("Please enter an integer value"); string e = scan.next(); string f = scan.next(); System.out.println("Your integer is: " + intValue + ", your real number is: " + decimalValue + " and your string is: " + textValue); } i told you... im really new
has answer: http://stackoverflow.com/a/26566461
has answer: http://stackoverflow.com/a/26566563
has comment: http://stackoverflow.com/comment/41752112
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41752058
answer count: 2
has comment: http://stackoverflow.com/comment/41751915

http://stackoverflow.com/comment/41774900
type: QuestionComment
comment on: http://stackoverflow.com/q/26544433
score: 0
has text: Did you clean and build your project before redeploying it?
type: Comment

http://stackoverflow.com/comment/41728328
type: AnswerComment
comment on: http://stackoverflow.com/a/26552775
score: 0
type: Comment
has text: @JBNizet that's fair, but nor do I adhere to the cargo cult that says you should always use an `ArrayList<foo>` instead of a `foo[]` regardless. If, for example, I'm manipulating an image bitmap, then I'm certainly _not_ going to use an `ArrayList<>`.

http://stackoverflow.com/comment/41865744
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26627878
has text: ok i was sent link of picture demo. can u understand what i means?
score: 0

http://stackoverflow.com/q/26570752
answer count: 2
has title: How to parse json java object in javascript
tagged with: jsp
tagged with: jquery
linked to: http://stackoverflow.com/q/4803906
score: 0
has comment: http://stackoverflow.com/comment/41760697
has comment: http://stackoverflow.com/comment/41760720
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26570778
has comment: http://stackoverflow.com/comment/41759939
has comment: http://stackoverflow.com/comment/41857532
has comment: http://stackoverflow.com/comment/41760616
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26570794
has body: Here is my code : Display.jsp: &lt;% response.setContentType("application/json"); JSONObject json = new JSONObject(); Employee employee = new Employee("RAM","ram@gmail.com"); json.put("employee",employee); out.println(json); %&gt; how can i parse employee name and email using js, i want to set those values into a table Any ideas...
type: Question

http://stackoverflow.com/comment/41872989
score: 0
has text: Thank you, which section of my code should I remove to ensure that I only have the matching set methods present?
type: AnswerComment
comment on: http://stackoverflow.com/a/26631991
type: Comment

http://stackoverflow.com/a/26658395
has comment: http://stackoverflow.com/comment/41923887
upvote count: 3
answers question: http://stackoverflow.com/q/26658272
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41923763
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41920206
has comment: http://stackoverflow.com/comment/41920189
score: 3
has body: The second one is the best practice (your DAO could be a CDI bean: it doesn't have to be an EJB). Dependency injection is what makes the code testable: you can inject a mock DAO in the service when unit-testing the service. BTW, the DAO will also need to have a DataSource or an EntityManager injected to be able to get data from the database. This is only possible if the DAO instance is managed by the container.
accepted answer of: http://stackoverflow.com/q/26658272

http://stackoverflow.com/comment/41703692
type: Comment
comment on: http://stackoverflow.com/a/26539180
score: 0
type: AnswerComment
has text: Well LOL there are a lot but ill take the mongo the following classpath entry mongodb path will not be available on the server's classpath i checked the war\WEB-INF\lib and jars are there.

http://stackoverflow.com/comment/105712939
has text: For doing this in a static method, @DilipMuthukurussimana 's didn't work for me. You need <ClassName>.class.getClassLoader().getResourceAsStream("project.properties")
comment on: http://stackoverflow.com/a/26573884
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26636940
type: Answer
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/26636910
answers question: http://stackoverflow.com/q/26636910
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41882144
has body: I suspect you need to cast the Employee to a Full_Time employee before executing the method: ((Full_Time)a_r_Employee[i]).display_Full(); It is safe to do so as you have already confirmed that the employee is of type Full_Time Alternatively, you can make the Employee super class an abstract class and then define an abstract method in Employee: e.g. public abstract void display(); This then wouldnt need the cast, but you would need to implement the method in every subclass of Employee

http://stackoverflow.com/q/26530317
tagged with: java
has answer: http://stackoverflow.com/a/26530359
accepted answer: http://stackoverflow.com/a/26530359
type: Question
has comment: http://stackoverflow.com/comment/41687077
has title: Range for loop not working
answer count: 2
has answer: http://stackoverflow.com/a/26530356
has comment: http://stackoverflow.com/comment/41687044
has body: I have a Double[] foo and I need to transform every element in the array: I tried for (Double p : foo){ p = p * m + o; } where m and o are scaling factors. I also tried for (Double p : foo){ p *= m; p += o; } but neither of these are working. What am I doing wrong? I thought that all non-primitives are references in Java.
has comment: http://stackoverflow.com/comment/41688067
downvote count: 1
has comment: http://stackoverflow.com/comment/41687115
has comment: http://stackoverflow.com/comment/41687043
favorite count: 0
has comment: http://stackoverflow.com/comment/41686966
upvote count: 4
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/26530356

http://stackoverflow.com/a/26561060
type: AcceptedAnswer
has body: All column defined in the fxml will be automatically added in the menuButtons list, just the same as if they were defined in code. To show the menuButton of the table, set its attribute &lt;TableView fx:id="tableView" tableMenuButtonVisible = "true"&gt; To control the visibility state of a column, set its visible attribute (nothing special compared to other attributes :) &lt;TableColumn text="Artist" visible="false"&gt;
type: Answer
answers question: http://stackoverflow.com/q/26557694
accepted answer of: http://stackoverflow.com/q/26557694
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/26590512
has body: Because that is the way the enhanced for statement is defined in jls-14.14.2. Specifically: The enhanced for statement is equivalent to a basic for statement of the form: for (I #i = Expression.iterator(); #i.hasNext(); ) { VariableModifiersopt TargetType Identifier = (TargetType) #i.next(); Statement }
has comment: http://stackoverflow.com/comment/41800129
has comment: http://stackoverflow.com/comment/41799604
has comment: http://stackoverflow.com/comment/41799305
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26590405
has comment: http://stackoverflow.com/comment/41800191
type: Answer
accepted answer of: http://stackoverflow.com/q/26590405
downvote count: 0
score: 1

http://stackoverflow.com/q/26606450
tagged with: java
favorite count: 0
has body: I want to do the following: try { Class.forName("MyClass"); } catch(ClassNotFoundException e) { ClassPool pool = ClassPool.getDefault(); CtClass cc = pool.makeClass("MyClass"); Class.forName("MyClass"); } I have tried it, but it doesn't seem to work always... It works in one context, but in the other the same code is crashing on the second "Class.forName("MyClass")"... Calling cc.toClass() always brings the correct class, and have tried cc.writeFile() but it makes no difference. Somehow, in some cases the second Class.forName finds the class, and in other cases it just breaks... Am I missing something?
answer count: 2
upvote count: 1
tagged with: javassist
accepted answer: http://stackoverflow.com/a/26607955
possible better answer: http://stackoverflow.com/a/26606654
has answer: http://stackoverflow.com/a/26606654
type: AnsweredQuestion
downvote count: 0
tagged with: classloader
has answer: http://stackoverflow.com/a/26607955
has title: Create class with javassist and make it available
type: Question
score: 1

http://stackoverflow.com/comment/41821582
has text: Okay, but how can I do this?
comment on: http://stackoverflow.com/a/26604362
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26518142
has body: You have two issues in your code snippet The fist one is with the argument of your method, lets look on this example void simple(Comparable&lt;Object&gt; input) {} This simple method expect a instance of Comparable&lt;Object&gt;. To create a instance for that you could implement class like: class MyComparable implements Comparable&lt;Object&gt; {} What you must by aware is that genericType ( className ), assure your type safety. This mean that: Comparable&lt;String&gt; can compare only String objects Comparable&lt;Object&gt; can compare only Object objects You can not really on class hierarchy in term of generic parameters. The class Integer implements Comparable&lt;Integer&gt; so to be able to use that you can do this: void simple(Comparable&lt;Integer&gt; input) {} The you will be able pass everything that implements Comparable&lt;Integer&gt;. With arrays is the same rule, void array(Comparable&lt;Integer&gt;[] input) {} but what you should keep in mind is that int[] is not the same as Integer[] JVM use different operations for those types. An int[] stores primitive integer values. And Integer[] stores references to Integer class. Comparable&lt;Integer&gt;[] array = {1,2,3,4}; is not allowed Comparable&lt;Integer&gt;[] array = new Integer[] {1,2,3,4}; is valid statement
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26517632
type: Answer

http://stackoverflow.com/q/26602098
has body: Is there a connection between filrering in .htaccess and SocketException? Suppose that in .htaccess were made deny for host.are.everywhere.in.the.net What if I from that denied host... will I recieve SocketException: Connection reset, SocketException: Broken pipe while creating socket and sending some info to it? Or that erros are not connected with limitations in .htaccess? Or what do these errors says in common case?
accepted answer: http://stackoverflow.com/a/26602174
type: AnsweredQuestion
has title: .htaccess and SocketException: Connection reset, SocketException: Broken pipe
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26602174
tagged with: .htaccess

http://stackoverflow.com/comment/41740093
score: 0
type: Comment
type: QuestionComment
has text: Your on to it I think. It may not be static.
comment on: http://stackoverflow.com/q/26559666

http://stackoverflow.com/comment/41662816
score: 0
type: AnswerComment
has text: I am going through that link about menus. Thanks
type: Comment
comment on: http://stackoverflow.com/a/26515943

http://stackoverflow.com/q/26635906
has answer: http://stackoverflow.com/a/26636090
score: 0
accepted answer: http://stackoverflow.com/a/26635944
answer count: 4
has body: I get the following errors: the method getOdometer &amp; getGallons are undefined for the type Object. Here is my code. My issue is in the main method, in the while loop where I'm using my accessor methods. Why isn't this working and how can I fix it? I'm new to programming so don't give me any answers that are too complicated. Thank you for your answers. The program I'm trying to make reads from a file and grabs the odometer and gallons that the car filled up at that odometer. I was told to use a helper method to grab those numbers from the file and calculate the mileage in the main method after I return the arraylist of FillUp objects from my FillUpArray helper method. package lab8; import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; import java.util.ArrayList; public class CheckpointOne { public static void main(String[] args) throws FileNotFoundException { File file = new File("C:/Users/Nick/workspace/project8/mileage.txt"); Scanner scan = new Scanner(file); double mileage=0.0; int i=0; while(i+1&lt;fillUpArray(scan).size()) { mileage=(fillUpArray(scan).get(i+1).getOdometer()-fillUpArray(scan).get(i).getOdometer())/fillUpArray(scan).get(i+1).getGallons(); System.out.println("Mileage: "+mileage); i++; } } private static ArrayList fillUpArray(Scanner scan) { ArrayList&lt;FillUp&gt; list = new ArrayList&lt;FillUp&gt;(); int odometer=0; double gallons=0.0; while(scan.hasNextLine()) { String line = scan.nextLine(); Scanner scans = new Scanner(line); while(scans.hasNext()) { odometer=scans.nextInt(); gallons=scans.nextDouble(); } FillUp fill = new FillUp(odometer, gallons); list.add(fill); } return list; } } And this is my FillUp class that I'm using. package lab8; public class FillUp { private final int odometer; private final double gallons; public FillUp(int givenOdometer, double givenGallons) { odometer = givenOdometer; gallons = givenGallons; } public int getOdometer() { return odometer; } public double getGallons() { return gallo…
possible better answer: http://stackoverflow.com/a/26635929
has answer: http://stackoverflow.com/a/26635929
has title: The method is undefined for the type Object issue
has comment: http://stackoverflow.com/comment/41879439
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26636691
has answer: http://stackoverflow.com/a/26635944
linked to: http://stackoverflow.com/q/26553300
has comment: http://stackoverflow.com/comment/41879194
type: Question

http://stackoverflow.com/q/26558121
downvote count: 4
has comment: http://stackoverflow.com/comment/41737471
answer count: 1
has comment: http://stackoverflow.com/comment/41737759
has comment: http://stackoverflow.com/comment/41737392
favorite count: 0
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/26558183
has title: How to use a FOR loop in the main Method
has comment: http://stackoverflow.com/comment/41737318
tagged with: java
tagged with: loops
has body: I cant seem to figure out how to make a for loop, so after they do the addition (1), it will go back to the menu. I need to use a for loop to do this also. I cut out the rest of the code to save space. So I just need help on the Addition and I can do the rest. (I never used this site, so I dont know how to post code correctly.) public static void main (String args[]) { Scanner userInput = new Scanner(System.in); int add, add2, sub, sub2, multi, multi2, divi, divi2, rema, rema2, power, power2, Conf; System.out.println("(1) Addition~"); System.out.println("(2) Subtraction~"); System.out.println("(3) Multiply~"); System.out.println("(4) Divide~"); System.out.println("(5) Remainder~"); System.out.println("(6) Power~"); System.out.println("(7) Quit~"); Conf = userInput.nextInt(); if(Conf == 1) { System.out.print("Enter first number to add: "); add = userInput.nextInt(); System.out.print("Enter second number to add: "); add2 = userInput.nextInt(); Ansr(); Adder(add, add2); Sp(); } else if(Conf == 7); System.out.println("Exiting Program..."); System.exit(0); userInput.close(); } }
type: Question
tagged with: for-loop
upvote count: 0

http://stackoverflow.com/q/26577820
upvote count: 5
tagged with: http://stackoverflow.com/tag/c
has title: Convert grayscale image to RGB
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26579823
has body: I'm not totally sure this is in the right place, so let me know... Just so I'm being totally transparent, this is part of a coursework for my University course. To that end, please don't post an answer but please DO give me hints &amp; nudges in the right direction. I've been working on it for a few days without much success. I've been tasked with converting a grayscale image into an RGB image. It's been suggested that we must segment the image and add colours to each segment with an algorithm. It'a also noted that we could develop algorithms for both the RGB &amp; HSI colourspace to improve the visualisation. My first thought was that we could segment the image using some threshold technique (on the grayscale intensity values) and then add colours to segments, but I'm not sure if this is right. I'm programming in Java and have use of the OpenCV library. Any thought / ideas / hints / suggestions appreciated :)
tagged with: c++
tagged with: java
tagged with: image-processing
type: Question
tagged with: opencv
score: 5

http://stackoverflow.com/q/26661468
type: Question
accepted answer: http://stackoverflow.com/a/26663218
has title: Cookie based authorization before calling controllers method in Spring
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27237921
tagged with: spring
possible better answer: http://stackoverflow.com/a/27237921
has body: Recently I came accross this issue. Let's say that I want to give different authorizations to different methods within my controller. I would like to do this using the cookie that was send with the request and to do that I would like to use annotations. I tried to figure out how force @PreAuthorize annotation to work but I am missing something here. Does anyone know if it's possible scenario (pseudo-code) @Controller class myController { @SomeAuthorizationAnnotation @RequestMapping("/") void doSth() { //something is done after authorization } } And now i'd like to write my custom method which grants me access to http request sent to this controller where i could let's say write something like HttpServletRequest ht = .... Optional&lt;Cookie&gt; cookie = getCookie(ht.getCookies(), AUTH_TOKEN); if (cookie.isPresent()) { //grant authorization for the method call } I hope that this is somewhat understandable. P.S I don't want to bind filters or sth to url's, i want to bind it to methods.
type: AnsweredQuestion
tagged with: cookies
has answer: http://stackoverflow.com/a/26663218
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/26653836
upvote count: 2
answers question: http://stackoverflow.com/q/26653521
has body: Get the Groovy plugin from the Eclipse marketplace (Help menu). It can format Groovy code but the result isn't as good as the one from the Java formatter (Groovy is a very complex language from a parser's point of view).
has comment: http://stackoverflow.com/comment/41910862
has comment: http://stackoverflow.com/comment/102152212
downvote count: 0
has comment: http://stackoverflow.com/comment/41910649
has comment: http://stackoverflow.com/comment/84055291
has comment: http://stackoverflow.com/comment/41910811
type: Answer
score: 2

http://stackoverflow.com/q/26600757
tagged with: logging
has comment: http://stackoverflow.com/comment/41815699
type: AnsweredQuestion
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/41815626
type: Question
answer count: 2
has title: Standard way to implement a Logger across classes in Java?
score: 5
has answer: http://stackoverflow.com/a/26601037
has comment: http://stackoverflow.com/comment/41815496
has comment: http://stackoverflow.com/comment/41815613
downvote count: 0
has answer: http://stackoverflow.com/a/26600839
possible better answer: http://stackoverflow.com/a/26601037
has body: I'm building a Javafx application with many classes. I'd like to use java logging from all the classes. But all options seem to come with excessive or repetitive code. These are the ones I can think of: declare Logger as a private static final field in each class i.e. private static final Logger LOGGER = Logger.getLogger(MyClass.class.getName()); This option seems kind of annoying having to do this in each class. pass the Logger from the main class to each constructor Again does not seem elegant create a class just for the logger, and then call static methods on that class for each log item. Seems like creating an additional class just for the logger is excessive. So how do you guys deal with this situation ? Is it just a matter of choosing the least bad option ?
favorite count: 0
has comment: http://stackoverflow.com/comment/41815682
accepted answer: http://stackoverflow.com/a/26600839

http://stackoverflow.com/a/26619990
score: 23
upvote count: 23
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26619867
has body: No, it does not work that way. JDBC is just a wrapper around native databases. But either JDBC or database cursors work the same : you send a query (via JDBC) to the database the database analyses the query and initializes the cursor (ResulSet in JDBC) while you fetch data from the ResultSet, the databases software walks in the database to get new rows and populates the ResultSet So there is no limit to the number of rows that a ResultSet can contains, nor to the number of rows that a java client program can process. The only limit comes if you try to load all the rows in memory to populate a list for example and exhaust the client application memory. But if you process rows and do not keep them in memory, there is no limit (exactly like what happens when you read a file).
answers question: http://stackoverflow.com/q/26619867
type: Answer

http://stackoverflow.com/q/26624428
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41858658
has comment: http://stackoverflow.com/comment/41858926
has answer: http://stackoverflow.com/a/26624801
upvote count: 3
tagged with: http
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/41859198
has body: Pretty straight forward: Is there a way to tell if a Volley request is currently pending/ongoing? Of course I can track its state manually through the different callbacks but is there a better way?
has title: Volley: Is there a way to check if a request is pending or in progress?
favorite count: 0
tagged with: android-volley

http://stackoverflow.com/q/26634166
downvote count: 1
tagged with: java
score: -1
tagged with: eclipse
tagged with: class
type: Question
upvote count: 0
answer count: 1
has title: Using eclipse can not get external class folder to work (Java)
has answer: http://stackoverflow.com/a/26634253
has body: I'm using Eclipse on a Mac. I want to write a method that creates a bar chart. To do this I need to use Bar.java class which I have downloaded and added as an external class folder. When I reference the class in my method it it not recognized. I have had this trouble with other classes in the past. This is the error I receive: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Bar cannot be resolved to a type Bar cannot be resolved to a type at TaxChart.main(TaxChart.java:5) Bar.java is in a folder located at /Desktop/class/ I have referenced it using configure build path and add external class folder.
has comment: http://stackoverflow.com/comment/41876114
favorite count: 0
has comment: http://stackoverflow.com/comment/41876081
linked to: http://stackoverflow.com/q/4058155
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41876812

http://stackoverflow.com/a/26596015
downvote count: 0
has comment: http://stackoverflow.com/comment/41806786
has body: The code to send mail must be in run() public void sendMyMail() { Thread sendEmail = new Thread(new SendMail("abc@xyz.com")); sendEmail.start(); } public class SendMail implements Runnable { String sendTo; public SendMail(String sendTo) { this.sendTo = sendTo; } @Override public void run() { //Code to send Email } }
has comment: http://stackoverflow.com/comment/41807073
upvote count: 2
has comment: http://stackoverflow.com/comment/41806918
has comment: http://stackoverflow.com/comment/41807136
type: Answer
has comment: http://stackoverflow.com/comment/41807338
score: 2
has comment: http://stackoverflow.com/comment/41807426
has comment: http://stackoverflow.com/comment/41806546
accepted answer of: http://stackoverflow.com/q/26595952
has comment: http://stackoverflow.com/comment/41807499
answers question: http://stackoverflow.com/q/26595952
has comment: http://stackoverflow.com/comment/41807193
has comment: http://stackoverflow.com/comment/41807217
has comment: http://stackoverflow.com/comment/41807190
has comment: http://stackoverflow.com/comment/41807598
type: AcceptedAnswer

http://stackoverflow.com/comment/41940510
has text: Hi! I attempted the shortcuts, but they only apply to the current run configuration, and not the currently open file.
score: 7
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26669876

http://stackoverflow.com/comment/41817427
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26601749
score: 0
has text: I converted answer to radians and degrees. I checked the algorithm several times but I am still having the same issue :/

http://stackoverflow.com/q/26664176
type: Question
answer count: 2
score: 5
has title: Run Java application as administrator on Windows
tagged with: uac
has comment: http://stackoverflow.com/comment/41930826
tagged with: java
has body: I am writing an installer in Java that will accordingly require elevated privileges to access the Program Files directory. Based on information that I've found online, I've written an implementation as follows: public static void main(String args[]) { if (!checkPrivileges()) { // spawn a copy w/ elevated privileges Runtime runtime = Runtime.getRuntime(); try { Process p = runtime.exec( "runas /profile /user:Administrator \"java -cp . main.Main\""); } catch (IOException e) { ... } } else { // Run with elevated privileges } } The test that I'm using to check for privileges is modified slightly from an answer found here and looks like this: private static boolean checkPrivileges() { File testPriv = new File("C:\\Program Files\\"); if (!testPriv.canWrite()) return false; File fileTest = null; try { fileTest = File.createTempFile("test", ".dll", testPriv); } catch (IOException e) { return false; } finally { if (fileTest != null) fileTest.delete(); } return true; } When I run this, it fails the privileges test--as expected--and makes the call to exec. Checking if the call worked by looking at p.isAlive() shows that the process is, in fact, alive; however, I'm not seeing any evidence of the new process and Windows isn't prompting me to grant permissions. I'm not familiar with using exec() in Java, so it's quite possible that I've misunderstood its usage somehow. For that matter, is what I'm attempting to do here even possible? If not, is there a straightforward alternative that will actually get me the results that I'm looking for?
has answer: http://stackoverflow.com/a/26672143
possible better answer: http://stackoverflow.com/a/26672143
upvote count: 5
linked to: http://stackoverflow.com/q/18631597
has answer: http://stackoverflow.com/a/26706333
type: AnsweredQuestion
tagged with: windows
downvote count: 0
has comment: http://stackoverflow.com/comment/41930217
accepted answer: http://stackoverflow.com/a/26706333
favorite count: 0
has comment: http://stackoverflow.com/comment/41930619
tagged with: elevated-privileges
linked to: http://stackoverflow.com/q/11041509

http://stackoverflow.com/comment/41933810
score: 0
type: QuestionComment
type: Comment
has text: Ok, thx for the quick answer. When I add System.out.println(javax.swing.SwingUtilities.isEventDispatchThread()); to the Constructor I get false on the console. How can I make my Thread the EventDispatchThread?
comment on: http://stackoverflow.com/q/26665955

http://stackoverflow.com/q/26532691
answer count: 1
favorite count: 0
has title: making a full size panel, with grid bag layout
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26532789
tagged with: java
downvote count: 2
upvote count: 1
type: Question
tagged with: gridbaglayout
has body: I am making a program with 3 JSliders, for r,g,b and i want to add a panel that will change it's color for the chosen color in the sliders, everything works for me except one thing, I don't know how to make the panel in the full size of the screen, this is the best I could do, but this is still kind of small and I want to make the panel full size. can any one show me how to do it? The program is kind of long so I will only send the part of the gridbaglayout and the panel. private JPanel panel; public delta(){ setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); panel = new JPanel(); panel.setBackground(new Color(0 ,0 ,0)); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 2; c.gridy = 6; c.gridwidth = 3; c.gridheight = 3; add(panel ,c);
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/41692733

http://stackoverflow.com/comment/41735803
type: AnswerComment
type: Comment
has text: @Jengo [Works for me.](http://ideone.com/ALrwMa) You must not be doing the change as I suggested it.
comment on: http://stackoverflow.com/a/26557210
score: 0

postorder
type: Tag
tags question: http://stackoverflow.com/q/26581380
tag name: postorder

http://stackoverflow.com/comment/42287805
has text: That project is seriously missing some screenshots/samples on the webpage
comment on: http://stackoverflow.com/a/26736109
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41763535
type: Comment
has text: or make clean build?
score: 0
comment on: http://stackoverflow.com/q/26572655
type: QuestionComment

http://stackoverflow.com/comment/41710033
score: 0
type: QuestionComment
has text: Please update your question and introduce the code, do not put it in the comments.
type: Comment
comment on: http://stackoverflow.com/q/26542892

http://stackoverflow.com/comment/41891691
type: Comment
score: 1
type: AnswerComment
has text: Being new to Java programming I did not know that "Java Universe" was a general English term being used there. So, I clearly explained the situation and asked my doubt. I did not know why people down voted the question.Please provide a detailed genuine explanation I will definitely accept the down votes. Behaviors like this makes new users like me to leave stack overflow with a bad experience.
comment on: http://stackoverflow.com/a/26642310

http://stackoverflow.com/comment/41905740
score: 0
type: Comment
has text: Yes R.java is there now and no errors in problem or console taps BUT When I try to make target 20, the console shows the same error in image above I do not know whats the problem
comment on: http://stackoverflow.com/a/26650655
type: AnswerComment

http://stackoverflow.com/q/26651475
has title: ArrayIndexOutOfBoundsException
favorite count: 0
has answer: http://stackoverflow.com/a/26651733
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26651505
upvote count: 0
has body: I want to create an ordered array to study about complexity.I know this a very basic code. I am getting an error saying...... Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10 at myWork.orderedArray.&lt;init&gt;(orderedArray.java:20) at myWork.mainClass.main(mainClass.java:6) my code is package myWork; public class orderedArray { int j; int arr[]=new int[10]; orderedArray(int n){ for(int i=0;i&lt;arr.length;i++){ arr[i]=0; } for(int i=0;i&lt;arr.length;i++){ if(arr[i]&lt;=n){ for(int j=arr.length;j&gt;i+1;j--){ arr[j]=arr[j-1]; } arr[i]=n; } } } void dispaly(){ for(int i=0;i&lt;arr.length;i++){ System.out.println(arr[i]); } } } and I created an object in main class and just ran the main class which i think its not relevant to the error package myWork; public class mainClass { public static void main(String[] args) { orderedArray obj1= new orderedArray(5); } } Thank you for your time reading this. Please accept my apoligies if you find some minor mistakes in my English and for the way i putted the code in this question (first time in stackoverflow so i dont know how to put a question with code properly :D)
tagged with: java
linked to: http://stackoverflow.com/q/32568261
type: Question
linked to: http://stackoverflow.com/q/5554734
answer count: 2
score: -2
duplicate of: http://stackoverflow.com/q/32568261
downvote count: 2

http://stackoverflow.com/comment/41911192
type: AnswerComment
comment on: http://stackoverflow.com/a/26652999
has text: The opacity can be set easily with two more digits for the alpha channel: #007FC3FF means opacity 100%, #007Fc37F means 50%, #007FC300 gives 0%...
type: Comment
score: 0

http://stackoverflow.com/q/26640564
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/41888153
type: Question
has comment: http://stackoverflow.com/comment/41888972
has comment: http://stackoverflow.com/comment/41888049
has comment: http://stackoverflow.com/comment/41888348
has comment: http://stackoverflow.com/comment/41888361
answer count: 1
favorite count: 0
has body: Can you help me with my assignment please Write a program to test the Person class defined below. Your test program should create two instances of the class (each to test a different constructor) and test each of the methods. You are also required to illustrate the error in trying to access private data members from the client class (for clarity temporarily change the private modifier to public and test again). See screenshots below for sample output. The screen shots are displayed as: p1 name = Not Given Age = 0 Gender = U p2 name = Jane Doe Age = 0 Gender = F p1 name = John Doe Age = 25 Gender = M and PersonTester.jave:20: name has private access in Person System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender); PersonTester.jave:20: age has private access in Person System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender); PersonTester.jave:20: gender has private access in Person System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender); 3 errors Here is the class given class Person { // Data Members private String name; // The name of this person private int age; // The age of this person private char gender; // The gender of this person // Default constructor public Person() { name = "Not Given"; age = 0; gender = 'U'; } // Constructs a new Person with passed name, age, and gender parameters. public Person(String personName, int personAge, char personGender) { name = personName; age = personAge; gender = personGender; } // Returns the age of this person. public int getAge( ) { return age; } // Returns the gender of this person. public char getGender( ) { return gender; } // Returns the name of this person. public String getName( ) { return name; } // Sets the age of this person. public void setAge( int personAge ) { age = personAge; } // Sets the gender of this person. public void setGender(char personGender) { gender = gender; } // Sets the name of this person. publi…
type: UnansweredQuestion
has title: Java Program Class and Tester
has comment: http://stackoverflow.com/comment/41889418
has comment: http://stackoverflow.com/comment/41888181
score: -2
has answer: http://stackoverflow.com/a/26640995
tagged with: java

http://stackoverflow.com/comment/90145454
type: AnswerComment
score: 0
type: Comment
has text: This works in Glassfish or Payara in the specification of a JDBC data source as well when putting each URL parameter and value above in a connection property.
comment on: http://stackoverflow.com/a/27276523

http://stackoverflow.com/comment/41838327
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26585250
has text: @Raedwald - If a field that is used in some instances were to be eliminated in instances that do not use it, the JVM/JITC would have to maintain two versions of code for that class, since the offsets of other instance fields would be displaced by the missing field.

http://stackoverflow.com/comment/41788356
score: 0
comment on: http://stackoverflow.com/q/26582482
type: Comment
has text: The application requires the web service to during start up. Now if I want that instead of just stopping the start-up, I wait for the service to start then what other way do I have? If I don't have to restart the app in case of a failure then isn't it good?
type: QuestionComment

http://stackoverflow.com/comment/41743257
comment on: http://stackoverflow.com/a/26558395
has text: Thank you so much! That fixed it perfectly, now I just have to fix a few minor things, but there is indeed a database now! :)
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26585265
type: Answer
has body: Yes. In your class level variables will assign to its default value even if you don't initialize them. In this case you int variables will assign to 0 and will occupied 4 bytes per each.
answers question: http://stackoverflow.com/q/26585220
score: 6
upvote count: 7
downvote count: 1

http://stackoverflow.com/a/26648904
downvote count: 0
upvote count: 2
has body: You can't simple convert byte array to PrivateKey instance. You can generate keys by KeyFactory
answers question: http://stackoverflow.com/q/26648469
has comment: http://stackoverflow.com/comment/41903493
type: Answer
score: 2

http://stackoverflow.com/a/26562952
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41745895
accepted answer of: http://stackoverflow.com/q/26562846
type: Answer
answers question: http://stackoverflow.com/q/26562846
has comment: http://stackoverflow.com/comment/41746026
upvote count: 1
score: 1
has body: What it means is that your project can have multiple packages inside of it. Java documentation explains them nicely: To make types easier to find and use, to avoid naming conflicts, and to control access, programmers bundle groups of related types into packages.

http://stackoverflow.com/comment/41830385
type: AnswerComment
type: Comment
has text: @DavidtenHove Probably goes against the site guidelines, but I've seen it done before. Again, I'd love to be able to accept both, but it would probably take more effort than it would provide rewards.
comment on: http://stackoverflow.com/a/26608669
score: 0

http://stackoverflow.com/comment/41703840
type: Comment
score: 0
has text: @Melody When I run your code against a file with 18 lines, each with a number on it, I get the table format you are expecting, along with a `java.util.NoSuchElementException` at the end. I expect that your extra 0 is a BlueJ artifact. Try commenting out `sc.nextLine();` and your program should work as intended.
type: QuestionComment
comment on: http://stackoverflow.com/q/26539232

http://stackoverflow.com/comment/41910478
type: QuestionComment
comment on: http://stackoverflow.com/q/26653572
score: 2
has text: `"cfg\\pirates-wp8.cfg".matches(".*pirates\\-wp8\\.cfg")` returns `true`...
type: Comment

http://stackoverflow.com/a/26542981
has comment: http://stackoverflow.com/comment/41738578
answers question: http://stackoverflow.com/q/26541493
score: 0
has comment: http://stackoverflow.com/comment/41734632
type: Answer
has comment: http://stackoverflow.com/comment/41734542
has body: To your DAO method you are just passing a new instance of Recipe object and this object has parameters as mentioned in your question: Recipe [id=0, name=Burger, cuisine=Cuisine [id=0, name=American] Now in DAO method you are getting the max id from database and updating your Recipe instance with the new id value, so the properties of your recipe instance will become like this (assuming the max(id) in database is 100): Recipe [id=101, name=Burger, cuisine=Cuisine [id=0, name=American] You have CASCADE TYPE set to ALL between your Recipe entity and Cuisine entity, so when you try to save the recipe instance using the below line: getSession().save(recipe); what hibernate will do is it will try to hit the database to get an instance of cuisine with id as 0 since your recipe has an instance of cuisine whose id is 0. select cuisine_.cuisine_id, cuisine_.name as name2_0_ from cuisine cuisine_ where cuisine_.cuisine_id=0 If there is no record in database for cuisine table with id as 0 then hibernate assumes that you are trying to save a new record for cuisine in database, so it will generate an insert query for cuisine also. To avoid this insert query on cuisine table, make sure you are assigning the correct id to cuisine instance that is assigned to recipe object before calling your DAO method.

http://stackoverflow.com/q/26668766
tagged with: android
has comment: http://stackoverflow.com/comment/41939060
answer count: 0
has comment: http://stackoverflow.com/comment/41939074
tagged with: java
type: Question
has body: I've got a semi-complex method to delete 3 different kinds of ParseObjects on my Parse.com backend. Here's the block of code: ParseQuery&lt;ParseObject&gt; findQuestions = new ParseQuery&lt;ParseObject&gt;(ParseConstants.CLASS_QUESTIONS); findQuestions.whereEqualTo(ParseConstants.KEY_QUESTIONS_BELONGS_TO, quiz.getObjectId()); Log.d("KMH", "findQuestions Query starting for quiz: " + quiz.getObjectId()); findQuestions.findInBackground(new FindCallback&lt;ParseObject&gt;() { @Override public void done(List&lt;ParseObject&gt; questions, ParseException e) { if (e == null) { Log.d("KMH", "findQuestions Query returned..."); for (ParseObject question : questions) { ParseQuery&lt;ParseObject&gt; findAnswers = new ParseQuery&lt;ParseObject&gt;(ParseConstants.CLASS_ANSWERS); findAnswers.whereEqualTo(ParseConstants.KEY_ANSWER_BELONGS_TO, question.getObjectId()); Log.d("KMH", "findAnswers Query starting for question: " + question.getObjectId()); findAnswers.findInBackground(new FindCallback&lt;ParseObject&gt;() { @Override public void done(List&lt;ParseObject&gt; answers, ParseException e) { if (e == null) { Log.d("KMH", "findAnswers Query returned..."); for (ParseObject answer : answers) { answer.deleteInBackground(); } Log.d("KMH", "findAnswers Query done!"); } else { Log.d("KMH", "Parse error: " + e.getMessage()); } } }); question.deleteInBackground(); } Log.d("KMH", "findQuestions Query done!"); } else { Log.d("KMH", "Parse error: " + e.getMessage()); } quiz.deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { if (e == null) { Log.d("KMH", "Quiz deleted!"); getQuizzes(); } else { Log.d("KMH", "Parse error: " + e.getMessage()); } } }); } }); Now, the logic behind this is that, given a quiz object ID, it runs a query and gets the questions related to that quiz. And then, after finding that List of questions, for each question in the list, it runs a query to find it's associated answers. For each answer in the list, it deletes the answer obje…
has comment: http://stackoverflow.com/comment/41938871
has comment: http://stackoverflow.com/comment/41938934
score: 0
has title: Deleting multiple objects on Parse
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/41939256
type: UnansweredQuestion

http://stackoverflow.com/q/26670773
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26670858
score: 10
has title: hashCode(): Objects.hash() And Base Class?
has body: Let's say I have two classes class A { private String aStr; @Override public int hashCode() { return Objects.hash(aStr); } } and class B extends A { private String bStr; @Override public int hashCode() { return Objects.hash(bStr); } } As the fields of class A are still fields in B that need to be hashed, how do I properly include the hash code of the fields in A in B.hashCode()? Any of these? Objects.hash(bStr) + super.hashCode(); // these generate a StackOverflowError: Objects.hash(bStr, (A) this); Objects.hash(bStr, A.class.cast(this));
upvote count: 10
has answer: http://stackoverflow.com/a/26670858
tagged with: java-7
answer count: 1
favorite count: 0
tagged with: hash
type: AnsweredQuestion
downvote count: 0
tagged with: hashcode

http://stackoverflow.com/comment/41774035
comment on: http://stackoverflow.com/q/26578368
type: Comment
type: QuestionComment
has text: You can use thread.join() to wait for a thread to complete running, before continuing execution.
score: 0

http://stackoverflow.com/a/26645095
score: 5
answers question: http://stackoverflow.com/q/26644564
type: AcceptedAnswer
has body: The Ear plugin doesn't override the War plugin, it simply doesn't execute the war task by default. Anyway, what you are trying to do is certainly possible. Instead of adding a dependency to a separate war project (as is described in the documentation you can simply depend on the war task itself. apply plugin: 'war' apply plugin: 'ear' dependencies { deploy files(war) }
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26644564
downvote count: 1

http://stackoverflow.com/q/26661515
type: UnansweredQuestion
tagged with: eclipse-juno
has comment: http://stackoverflow.com/comment/41925459
tagged with: java
has answer: http://stackoverflow.com/a/26662996
tagged with: eclipse
type: Question
has body: Hi Is Tomcat 8 available for Eclipse Juno? If yes then how can I configure tomcat 8 with eclipse Juno? I have tried and found this solution: How to use tomcat8 in Eclipse? But its also not working for me. I tried all the answers of this above question. But none of them worked. Any Solutions please?
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41925104
score: 0
answer count: 1
tagged with: tomcat8
has title: How to use tomcat 8 in eclipse Juno?

http://stackoverflow.com/a/36846508
has body: This is yet another case of "Pixels do not exist in your game world", they are only there to represent you game world to your client. A camera man for TV need to know as much about your TV as you need to know about your clients screens. Just capture what you want to show and let LibGDX do the rest. So, you should never, ever work with pixels. In the case you want pixel perfect drawing you might want to setup your camera to the amount of pixels of the screen you are targeting but after that you treat these "pixels" as units. Box2D does not work with pixel per meter. It works with 1 unit == 1 meter and you should stick to that. But how much meters a pixel should represent is still up to you. If you want to draw a 1m x 1m box you should not multiply by some number you create based of screen pixels like you do now, you should just give it 1 x 1 to represent the box. shape.setAsBox(1, 1); Your sprite should be exactly the same xeonSprite.setSize(1, 1); And you should position them on the same position. It's really that simple, 1 UNIT == 1m and there is nothing more to it, the camera does the rest. If you want to show 9m x 16m of your game world you setup your camera like this. camera = new OrthographicCamera(9, 16); If you want to represent the empire state building you would give the body and sprite a size of 57, 443 and then your camera needs to represent a much larger area, if you don't want to render a small portion of it. If you want to fit the height exactly on screen without stretching you need your own conversion. float camHeight = 443; float aspectRatio = Gdx.graphics.width / Gdx.graphics.height float camWidth = aspectRatio * 443; Although those Gdx calls give the pixels your clients are running you should still not treat these as pixels about these since you don't know at what screen I will be playing your game. Now forget about the empire state building example and your camera's center is positioned at 0, 0 world space so bottom left is at -4.5, -8 so you migh…
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26656088
upvote count: 1
type: Answer

http://stackoverflow.com/a/26576960
type: Answer
has body: FileWriter is for writing character data. If you want to write binary data use DataOutputStream.
answers question: http://stackoverflow.com/q/26576937
score: 0

http://stackoverflow.com/comment/41776989
has text: Using stack traces is very expensive compared to any other kind of logic.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26579854
type: AnswerComment

http://stackoverflow.com/comment/41868583
type: Comment
has text: Mark and upvote if useful people might get the same thing and come here for answers
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26629279

http://stackoverflow.com/comment/41796201
has text: Sorry for not being explicit. In fact i'm working just with numbers, I have the control in another part of code, so I shouldn't have to check it. So both GameDroids and Bohemian answers are really perfect for me. I don't know which to choose. I think i'll go with GameDroids because its explanation, but both are really perfect for me. Thanks
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26590436
score: 0

http://stackoverflow.com/a/46695195
type: Answer
has body: Please provide Thread sleep in your code. It will run concurrently between both the threads. System.out.println("counting"+i) Thread.sleep(500) Please Insert these code in the run method.IT will work as you want
score: 0
answers question: http://stackoverflow.com/q/26667803

http://stackoverflow.com/q/26650748
has comment: http://stackoverflow.com/comment/41912798
has comment: http://stackoverflow.com/comment/41909735
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26633627
answer count: 0
has comment: http://stackoverflow.com/comment/41908731
tagged with: java
type: Question
has body: Summary I'm developing a Java application within Eclipse Luna. I've been trying to develop an Ant script that will increment my project's version number whenever I recompile the source code. However, my script is not being invoked when the source files change. Details As a follow-on to this problem I was having yesterday, I tried to solve the issue by enabling Specify working set of relevant resources under Properties -> Builders -> {Ant builder} -> Edit -> Build Options and setting the working set to include all of my source files. Eclipse's documentation says that this will cause the Ant script to be invoked if any of those files are modified. After doing that, I removed all target calls from Auto Build under Targets. For all of 60 seconds, this seemed to work; my Ant script would be invoked and increment the version number whenever I made a change to a source file and hit save, and it didn't cause a feedback loop as when I had it invoked within Auto Build. I then tried unchecking Allocate Console under Build Options to see if I could get the script to run silently. This stopped it from working, so I re-enabled it. However, it still didn't work after doing that, and even closing and re-opening Eclipse hasn't solved that. This is pretty annoying and unintuitive behaviour. Is it a bug or am I missing something? I would like Eclipse to invoke my Ant script whenever I modify the source files, but not in a way that causes it to enter a feedback loop where modifying files leads to a recompilation which modifies my build_info.properties file, which leads to further recompilation, ad nauseum. I'd be happy to provide any additional information should it be required. EDIT I tried creating a new test project with a copy of the build script and configuring it to run for that. It did not work in the new project either. My test project structure: My build configuration: The working set of relevant resources for my ant script: My complete build script: <?xml version="1.0" encodi…
has comment: http://stackoverflow.com/comment/42745813
has comment: http://stackoverflow.com/comment/42023041
has comment: http://stackoverflow.com/comment/41940907
has comment: http://stackoverflow.com/comment/41909131
tagged with: ant
has title: Ant script no longer invoked when source files modified in Eclipse
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/41917747

http://stackoverflow.com/comment/41776762
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26579458
has text: As for the vote to close because question is "too broad" - Perhaps the downvoter is not familiar with Vaadin theming in general and Valo specifically. The Valo theme is built to be customized, with various parameters for changing colors, fonts, roundedness of corners, puffiness or flatness, animations, opacity, borders, and more. See this [wiki tutorial](https://vaadin.com/wiki/-/wiki/Main/Valo+theme+-+Getting+started). Before attempting my own, I’m asking if anyone has already started building a set of customization code to approximate the size and perhaps look of the previous Reindeer theme.
type: Comment

http://stackoverflow.com/comment/41934187
comment on: http://stackoverflow.com/q/26666256
score: 0
type: Comment
type: QuestionComment
has text: try { for(i=0;i<2;i++) array[i] = inputFile.nextInt(); nodes=array[0]; edges=array[1]; break; for(i=2;i<5;i++) { array1[i] = inputFile.nextInt(); System.out.println(array1[i]); } }

http://stackoverflow.com/comment/41835212
type: QuestionComment
has text: @Xstian i have tried it but i get error that:"Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: model.bl.IdeaManagerImple" so ithink i can not use it in this way but thank you for your attention :)
comment on: http://stackoverflow.com/q/26586226
score: 0
type: Comment

http://stackoverflow.com/comment/41924777
comment on: http://stackoverflow.com/a/26660643
type: AnswerComment
has text: uh.. crap... i didn't take a look at your else block.. i just saw first = tail; tail=first; and presumed wrongly... my bad buddy..
score: 0
type: Comment

http://stackoverflow.com/comment/41704754
type: QuestionComment
has text: A couple quick things to check: is app_id defined somewhere (such as res/values/ids.xml? Does the value match the id from the games console?
comment on: http://stackoverflow.com/q/26538748
score: 0
type: Comment

compare
tags question: http://stackoverflow.com/q/26645284
tags question: http://stackoverflow.com/q/26631605
tags question: http://stackoverflow.com/q/26519440
tag name: compare
tags question: http://stackoverflow.com/q/26553889
tags question: http://stackoverflow.com/q/26621889
tags question: http://stackoverflow.com/q/26604875
tags question: http://stackoverflow.com/q/26605266
tags question: http://stackoverflow.com/q/26572562
tags question: http://stackoverflow.com/q/26538936
tags question: http://stackoverflow.com/q/26578353
tags question: http://stackoverflow.com/q/26609138
type: Tag
tags question: http://stackoverflow.com/q/26593580

http://stackoverflow.com/q/26646628
has comment: http://stackoverflow.com/comment/41898448
upvote count: 0
has comment: http://stackoverflow.com/comment/41898487
has answer: http://stackoverflow.com/a/26673282
tagged with: android
answer count: 1
has body: Is it possible to access an arraylist from another void then it is generated in in Java? (I'm making an android app, i did cut down the code massively) package com.example.example; import ...; public class Example { @Override protected void onCreate(Bundle savedInstanceState) { //android things here... ArrayList&lt;String&gt; questionid = new ArrayList&lt;String&gt;(); questionid.add("1"); questionid.add("2"); questionid.add("3"); questionid.add("4"); questionid.add("5"); questionid.add("6"); questionid.add("7"); questionid.add("8"); questionid.add("9"); questionid.add("10"); Collections.shuffle(questionid, new Random(System.nanoTime())); } private void newQuestion() { questionid.get(0); //&lt;-- It doesn't find the arraylist questionid } } private void setNewQuestion() { TextView questionnumberlabel; questionnumberlabel = (TextView) findViewById(R.id.questionnumber); if (questionnumberlabel.getText().equals("1")) { } } } Is there a way to make the arraylist accessible everywhere in the class? Again, i'm developing an app for android, so i did cut down the code a bit.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26673282
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41946372
tagged with: java
downvote count: 3
has title: How to access arraylist from an other void then it is generated in in Java?
type: Question

http://stackoverflow.com/a/26671232
upvote count: 1
downvote count: 0
has body: You need to read Java doc first Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0; the last depends on the number of months in a year. So you will get month as 4 int month = c.get(Calendar.MONTH);
type: Answer
answers question: http://stackoverflow.com/q/26670997
score: 1

http://stackoverflow.com/a/26603723
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26603651
has body: It seem that it should be if (arguments.length == 1 || arguments.length == 2) { throw new IllegalArgumentException("Wrong number of arguments in " + string); }
score: 3
accepted answer of: http://stackoverflow.com/q/26603651

http://stackoverflow.com/comment/41686532
score: 0
type: Comment
has text: You are weolcome. However that implementation is wrong. Swing components must not be updated within `doInBackground` method. I'll add a snippet to illustrate my suggestions. @garlicDoge
comment on: http://stackoverflow.com/a/26528169
type: AnswerComment

http://stackoverflow.com/a/26515843
has comment: http://stackoverflow.com/comment/41661619
type: Answer
has comment: http://stackoverflow.com/comment/41661988
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26515357
has comment: http://stackoverflow.com/comment/41661509
has body: You have to cancel the first task and reschedule again t.cancel(); t = new MyTimerTask(); t.schedule(t, yournewdelay); From the Docs "Cancels the Timer and all scheduled tasks. If there is a currently running task it is not affected. No more tasks may be scheduled on this Timer. Subsequent calls do nothing." You'll need to initialize a new Timer when you are rescheduling.
answers question: http://stackoverflow.com/q/26515357
score: 0

http://stackoverflow.com/comment/41782678
type: Comment
type: QuestionComment
has text: Have you specified the character encoding in both your text editor and your compiler settings? It needs to be a value that is supported on both platforms, such as UTF-8. Windows defaults to CP-1252, which may not be available on other platforms
comment on: http://stackoverflow.com/q/26582727
score: 0

http://stackoverflow.com/a/26597183
has body: Just provide the String resource ID as a parameter to your Enum: public enum OrderType { ONE(R.string.order_type_one), TWO(R.string.order_type_two) private final int mTextResourceId; OrderType(int resourceId) { mTextResourceId = resourceId; } public int getTextResourceId() { return mTextResourceId; } } Provide these strings in each desired resource folder, e.g.: res/values/strings.xml res/values-es/strings.xml res/values-fr/string.xml Then, when you want to consume this in a TextView somewhere: myTextView.setText(myOrderType.getTextResourceId()); No Context passing required, and it is determined at runtime based on the current locale.
type: Answer
has comment: http://stackoverflow.com/comment/41840203
has comment: http://stackoverflow.com/comment/41835778
has comment: http://stackoverflow.com/comment/41844798
has comment: http://stackoverflow.com/comment/41810850
has comment: http://stackoverflow.com/comment/41835568
has comment: http://stackoverflow.com/comment/41810873
answers question: http://stackoverflow.com/q/26594271
has comment: http://stackoverflow.com/comment/41810572
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/41840570
has comment: http://stackoverflow.com/comment/41887471

http://stackoverflow.com/comment/41754850
type: QuestionComment
score: 5
has text: Pipe, `|`, is a **regex reserved character**. Use `\\|`.
comment on: http://stackoverflow.com/q/26567964
type: Comment

http://stackoverflow.com/a/26642114
answers question: http://stackoverflow.com/q/26641878
has body: Try This... File file=(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath())); the file object represent the directory where your main.class file is located at runtime. after that create new file as: File txtFile=new File(file,"myText.txt");
score: 0
type: Answer

http://stackoverflow.com/a/26622095
type: Answer
has body: You can use Google's speech API, demonstrate here. Here is a reverse engineering of this API, you can get your speech API key here.
upvote count: 1
answers question: http://stackoverflow.com/q/26622001
downvote count: 1
score: 0

http://stackoverflow.com/a/26634489
type: Answer
score: 1
upvote count: 1
has body: In general, no. The purpose of the XSD is to specify the rules that the document must meet, in order to be valid. You can't ignore or skip some of those rules. If you could, you'd probably have other problems. For example, if required elements were really optional (or could be) then technically any element that was supposed to contain a bunch of other elements could be empty (and still valid) under that more lax validation. In your situation, you probably have two options: Change your workflow - make sure the first component populates the XML with the empty tax_id. Then it will validate. Introduce a second schema - one earlier in the "pipeline" of processing, that doesn't require tax_id. Then validate against that.
downvote count: 0
answers question: http://stackoverflow.com/q/26631266

http://stackoverflow.com/comment/41795873
type: AnswerComment
has text: Can I do anything like that with a String too?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26587633

http://stackoverflow.com/q/26578278
tagged with: queue
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26578322
has comment: http://stackoverflow.com/comment/41774220
type: Question
has comment: http://stackoverflow.com/comment/41773879
score: 0
answer count: 1
has body: I am trying to get a program to print out an answer to an equation x times based on two range variables. I created a queue variable that will hold an equation before it enters my for loop. In my for loop I created a backup version of the queue because when I send it to another method it removes values from that queue, eventually leaving me with an empty queue. I use that backup in the method and then just redeclare it to the original queue at the top of the for loop. My problem is, it works once giving me the desired output, however, each time after, it prints out null. My guess is because it thinks the queue is empty but I dont understand why. Below is my code of my main file, should be enough. public class Main { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Infix Expression: "); String expression = keyboard.nextLine(); GenericQueue&lt;Token&gt; result = new GenericQueue&lt;Token&gt;(); Scanner keyboard2 = new Scanner(System.in); System.out.print("Range: "); String range = keyboard2.nextLine(); int start = 0; int end = 5; String var = "x"; Process.toPostfix(expression, result); for (int i=start; i&lt;=end; i++) { GenericQueue&lt;Token&gt; backup_result = result; System.out.println(backup_result.toString()); Rational answer = Process.evaluate(backup_result, i, var); System.out.println(i + " " + answer); } keyboard.close(); keyboard2.close(); } } and here is my output: Infix Expression: (5+x) Range: f 5 x + 0 5 1 null 2 null 3 null 4 null 5 null
tagged with: java
has title: Why is my output printing null when the Queue has data?

http://stackoverflow.com/comment/41782207
type: Comment
type: QuestionComment
has text: My apologies if I've missed something, but my query isn't parameterised which is partly why Im surprised by the error - I'll update the question
comment on: http://stackoverflow.com/q/26582744
score: 0

http://stackoverflow.com/comment/41734367
type: AnswerComment
has text: My manifest is auto generated by maven. So what options do I have?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26556128

http://stackoverflow.com/q/26580078
possible better answer: http://stackoverflow.com/a/26580095
has answer: http://stackoverflow.com/a/26580095
has comment: http://stackoverflow.com/comment/41777301
has comment: http://stackoverflow.com/comment/41777265
upvote count: 0
favorite count: 0
has title: JAVA Error in Input I/O homework (beginner)
has answer: http://stackoverflow.com/a/26580207
tagged with: io
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26580167
tagged with: java
tagged with: file
tagged with: printwriter
downvote count: 1
has body: I have to write a program that estimates the number of bottles of a drink someone would have to drink to win a prize, if there is a 1 in 5 chance that a bottle cap will have a prize. The user inputs the number of trials of opening bottles, and the program outputs the average number of bottles taken to win a prize, and stores how many drinks each individual trial took to win, in a separate text file. import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import java.io.File; public class BottleCapPrize2 { public static void main (String[] args) throws IOException { Scanner in = new Scanner (System.in); System.out.print("Number of Trials: "); int trials = in.nextInt(); int trialNumber = 0; int total = 0; int average = 0; for (int x = 0; x &lt; trials; x++){ int counter = 0; double randNum = Math.random(); trialNumber++; while (randNum &lt; 0.8){ counter ++; randNum = Math.random(); } total += counter; average = (int) total/trials; PrintWriter outFile = new PrintWriter (new File ("bottleCap.txt")); outFile.println("Trial " + trialNumber + " took " + counter + " drinks."); outFile.close(); if (trialNumber == trials){ System.out.println("The average was " + average); } } } The part of the program that outputs to the compiler works fine, but the part that outputs to the text file (bottleCap.txt) does not work correctly. When I open bottleCap.txt, something along the lines of "Trial 1 took 3 drinks.", "Trial 2 took 5 drinks.", .... "Trial 10 took 9 drinks." should be written. Instead, I only see the output for the last Trial of the program. (If the user entered 10 trials, then the text file only has written "Trial 10 took 3 drinks", and nothing for Trials 1-9). Can someone help me figure out the problem? I have looked at this for a few hours now, and have not gotten any further. Thank You! **Thank you everyone for your help! This was very helpful! **
type: Question
has comment: http://stackoverflow.com/comment/41777225
accepted answer: http://stackoverflow.com/a/26580167
score: -1
has answer: http://stackoverflow.com/a/26580136

http://stackoverflow.com/a/44213630
type: Answer
score: 0
has body: jdk1.6 java.lang.ClassLoader's loadClass is synchonized, protected synchronized Class&lt;?&gt; loadClass(String name, boolean resolve) throws ClassNotFoundException jdk1.7 makes it each lock per className,which is more efficient protected Class&lt;?&gt; loadClass(String name, boolean resolve)throws ClassNotFoundException{ synchronized (getClassLoadingLock(name))
answers question: http://stackoverflow.com/q/26608973

http://stackoverflow.com/comment/41797598
has text: Thank you for the response. One thing I'd like to solidly confirm is whether or not we can override the SP -> IDP communication to make it encrypted. As in overriding specific Spring classes instead of playing around with the configuration file.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26533062

http://stackoverflow.com/q/26569408
has body: I'm pretty new to the Big-O field, so bear with me here. I have been searching about it as much as I could but I still need a lot of work to fully understand it. I came across these nested for loops in a practicing exercises and there wasn't any solutions and they seem complicated. So, any help would be appreciated. 1) int sum=0; for(int i=0; i &lt; n^2; i++) { // n+1 for(int j = n-1; j &gt;= n-1-i; j–-) { // n(n+1)/2 ? sum = i+j; // n(n+1)/2 ? System.out.println(sum); // n(n+1)/2 ? } } Big-O = ? 2) int sum=0; for(int i=1; i &lt;= 2^n; i=i*2) { // log(n) for(int j=0; j &lt;= log(i); j++) { // log(n(n+1)/2) ? sum = i+j; // log(n(n+1)/2) ? System.out.println(sum); // log(n(n+1)/2) ? } } Big-O = ? 3) int sum = 0; int k = 23; for(int i=k; i &lt;= 2^(n−k); i=i*2) { // log(n) for(int j=2^(i−k); j &lt; 2^(i+k); j=j*2) { // log(log(n)) ? sum = i+j; // log(log(n)) ? System.out.println(sum); // log(log(n)) ? } } Big-O = ? 4) int sum=0; for(int i=2n; i&gt;=1; i=i/2) { for(int j=i; j&gt;=1; j=j/2) { sum = i+j; System.out.println(sum); } } Big-O = ? EDIT: - Corrected #4. Sorry for the mess up. - Base of the log is 2. - The ^ here means "to the power", not xor.
upvote count: 3
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/41846879
type: Question
linked to: http://stackoverflow.com/q/14510701
answer count: 2
has title: Big-O of These Nested Loops
has answer: http://stackoverflow.com/a/26618423
has comment: http://stackoverflow.com/comment/41847800
tagged with: time-complexity
downvote count: 0
tagged with: big-o
favorite count: 0
type: UnansweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26579913
tagged with: performance

http://stackoverflow.com/comment/41861128
comment on: http://stackoverflow.com/q/26625777
score: 0
has text: Did you see that jar file is in your class path ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42035994
has text: You only have to update the `imagePosition` accordingly. In doubt, you may try to formulate this as a new (follow-up) question.
comment on: http://stackoverflow.com/a/26613682
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26672595
has body: It might be possible (from serialization side) but I wouldn't recommend it to be done.
answers question: http://stackoverflow.com/q/26671919
type: Answer
has comment: http://stackoverflow.com/comment/41949496
accepted answer of: http://stackoverflow.com/q/26671919
has comment: http://stackoverflow.com/comment/42029222
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26556011
score: 0
answer count: 1
tagged with: executable-jar
has comment: http://stackoverflow.com/comment/41733938
has comment: http://stackoverflow.com/comment/41734231
has comment: http://stackoverflow.com/comment/41734295
linked to: http://stackoverflow.com/q/944610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26557415
tagged with: deployment
has comment: http://stackoverflow.com/comment/41733763
tagged with: java
has comment: http://stackoverflow.com/comment/41734486
has comment: http://stackoverflow.com/comment/41734313
tagged with: classpath
type: Question
has body: I am finishing a project that I have to deploy as a jar file, in eclipse it works fine, my project depends on two libraries which also both depends on dll files. I have added the path to these dlls to the native library location of each one of the external jars. Then I export project as a jar file using the eclipse runnable jar file export wizard I get the jar file in the specified location, it runs but when I click on a button that calls one of the libraries I get I get java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path on the console. Edit : When I copy the dlls in [...]/jre7/bin/ folder my application works, but I want that my application runs without having to do this manipulation. Regards.
has title: deploy jar file with external libraries
has comment: http://stackoverflow.com/comment/41734434
has comment: http://stackoverflow.com/comment/41734368
tagged with: eclipse

http://stackoverflow.com/q/26561025
possible better answer: http://stackoverflow.com/a/26561144
has comment: http://stackoverflow.com/comment/41742651
has answer: http://stackoverflow.com/a/26561142
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/26561142
has body: I have the following JSON Content: { "query": { "pages": { "7931046": { "pageid": 7931046, "ns": 0, "title": "Tang Aidi", "revisions": [ { "contentformat": "text/x-wiki", "contentmodel": "wikitext", "*": "SOME TEXT" } ] } } } } I try to read the "SOME TEXT" String from it. I am stuck already when trying to read the "pages" object. I guess it should be a JSONObject but it throws me JSONObject["pages"] not found with following code: JSONObject obj = new JSONObject(sEntireContent); JSONObject oParse=(JSONObject) obj.get("query"); //JSONArray oPages=oParse.getJSONArray("pages"); &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; JSONObject oPages=(JSONObject) obj.get("pages"); JSONObject firstPage=(JSONObject) oPages.get(0); JSONObject oRevisions=(JSONObject) firstPage.get("revisions"); sWikitext=oRevisions.getString ("*"); I then firther don't know how to read a childobject, from which I don't know the name. In my example the "7931046" is a random/sequence number
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26561144
favorite count: 0
tagged with: parsing
has title: Reading JSON child object

http://stackoverflow.com/q/26583824
upvote count: 2
has comment: http://stackoverflow.com/comment/41785959
has body: I can visit mysql by the command line and I have seen several questions about this,but it doesn't work. I have tried: 1.mysql> grant all privileges on . to root@localhost identified by 'password' with grant option; 2.Create a new user; 3.modify the password; This is my users' info. mysql> select user,host,password from mysql.user; +------+-----------+-------------------------------------------+ | user | host | password | +------+-----------+-------------------------------------------+ | root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | root | 127.0.0.1 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | +------+-----------+-------------------------------------------+ /* 15 */ String driver = ""; /* 16 */ String url = ""; /* 17 */ driver = "com.mysql.jdbc.Driver"; /* 18 */ url = "jdbc:mysql://localhost:3306/demo?characterEncoding=utf-8"; /* 19 */ Connection con = null; /* 20 */ String user = "root"; /* 21 */ String pwd = "root"; /* */ try { /* */ try { /* 25 */ Class.forName(driver); /* */ } catch (ClassNotFoundException ex) { /* 27 */ ex.printStackTrace(); /* */ } System.out.println("url:"+url+" user="+user+" pwd="+pwd); /* 29 */ con = DriverManager.getConnection(url, user, pwd); /* */ } catch (SQLException ex) { /* 31 */ ex.printStackTrace(); /* */ }
has comment: http://stackoverflow.com/comment/41784770
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41788994
has comment: http://stackoverflow.com/comment/41796044
has comment: http://stackoverflow.com/comment/41783859
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41783623
has title: Access denied for user 'root'@'localhost' (using password: YES)
tagged with: java
has comment: http://stackoverflow.com/comment/41789234
has comment: http://stackoverflow.com/comment/41790406
has comment: http://stackoverflow.com/comment/41790321
accepted answer: http://stackoverflow.com/a/26600372
type: Question
has comment: http://stackoverflow.com/comment/41796079
has comment: http://stackoverflow.com/comment/41784318
has comment: http://stackoverflow.com/comment/41784495
has comment: http://stackoverflow.com/comment/41784322
has answer: http://stackoverflow.com/a/26600372

http://stackoverflow.com/comment/41664126
comment on: http://stackoverflow.com/q/26514995
has text: You must NOT subclass Thread if you don't want to implement a custom thread! Implementing Runnable is sufficient in your case!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41955615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26667039
has text: I'm done with that. Thank you MadProgrammer for your continuous help. I shared it below.
score: 0

http://stackoverflow.com/a/26589241
score: 1
answers question: http://stackoverflow.com/q/26587450
upvote count: 1
type: Answer
downvote count: 0
has body: You need to decide on the business rules. If there is less than a day difference, for example 23 hours, do you want to count that as 0 or round up to 1? You strAppDate is "2014-10-28 15:11:30.0", and depnding on your timezone, currentDate is the 27th, so the difference between appDate.getTime() and currentDate.getTime() is less than 24 hours, and long diffDays = diff / (24 * 60 * 60 * 1000); will be zero. You can use doubles and always round up, or you can have some rules that determine the days difference depending on the hours difference. It really depends on how much precision you need.

http://stackoverflow.com/a/26637307
has body: According to Doppelganger's comment on the answer to Using Mockito's generic "any()" method, you've got a conflict between hamcrest's any() and mockito's any().
type: Answer
has comment: http://stackoverflow.com/comment/41977649
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26629051
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26629051

http://stackoverflow.com/comment/41886759
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26639760
type: Comment
has text: Thanks so much RealSkeptic, I appreciate your help doubly as I am aware I didn't make it easy to understand the problem (because I couldn't), I'll adjust my code, test it tomorrow and pray to god it works!

http://stackoverflow.com/comment/66362511
score: 1
comment on: http://stackoverflow.com/a/26541624
type: AnswerComment
has text: Is it closed when if it is local variable and method returns? Ofcourse assuming that we only have used ClassPathResource of spring.
type: Comment

http://stackoverflow.com/comment/41762893
type: Comment
type: QuestionComment
has text: See also [`android.hardware.action.NEW_PICTURE`](http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_PICTURE), but remember that 3rd party Camera applications are no guaranteed to perform this broadcast, see [_where is android.camera.NEW_PICTURE defined?_](http://stackoverflow.com/questions/3015448/where-is-android-camera-new-picture-defined)
comment on: http://stackoverflow.com/q/26567291
score: 0

http://stackoverflow.com/q/26607949
has answer: http://stackoverflow.com/a/26618313
accepted answer: http://stackoverflow.com/a/26618313
tagged with: spring
has comment: http://stackoverflow.com/comment/41835661
score: 2
type: AnsweredQuestion
tagged with: java
has title: No suitable Driver found in production and not in eclipse
tagged with: mysql
tagged with: eclipse
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41828778
has body: As many of you i well know this exception and i've fixed it many times. But this time, i've spent 2 week to search and try things, required the help of high-level people without any success. I've created a java website with a service oriented architecture entity/dao/service/controller... I use Maven2/Hibernate/Spring (DI & AoP) and Spring MVC. The database is MySql. Development environment : - Windows - Mysql 5.6.1 - Tomcat 7 Production environment : - Debian - Mysql 5.6.1 - Tomcat 7 When i deploy my app in tomcat7 from eclipse => No rpoblem everything is fine When i deploy my app in the production debian environment => No suitable driver found for jdbc:mysql://127.0.0.1:3306/synapse Obviously, the database is ok in production with the same users than development environment(for now, it will change when it will work) with full Grant options. I can connect to the database and interact with it with those identifiers. Here is my datasource.xml classpath:properties/database.properties and here, my database.properties jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://127.0.0.1:3306/synapse jdbc.username=user jdbc.password=password The pom.xml 4.0.0 fr.synapsegaming synapse 1.0.0 war synapse Synapse gaming website and application maven-compiler-plugin 3.1 1.7 1.7 maven-war-plugin 2.3 src/main/webapp false junit junit 4.8 test mysql mysql-connector-java 5.1.30 org.springframework spring-core 3.2.2.RELEASE org.springframework spring-test 3.2.2.RELEASE org.springframework spring-webmvc 3.2.2.RELEASE org.springframework spring-context 3.2.2.RELEASE org.springframework spring-context-support 3.2.2.RELEASE org.springframework spring-beans 3.2.2.RELEASE org.springframework spring-expression 3.2.2.RELEASE org.springframework spring-hibernate 1.2.9 org.hibernate hibernate-core 3.3.1.GA org.hibernate hibernate-annotations 3.3.1.GA dom4j dom4j 1.6.1 commons-logging commons-logging 1.1.1 commons-collections commons-collections 3.2.1 antlr antlr 2.7.7 log4j log4j 1.2.12…
downvote count: 0
has comment: http://stackoverflow.com/comment/41828577
has comment: http://stackoverflow.com/comment/41837540
tagged with: tomcat
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26545530
has comment: http://stackoverflow.com/comment/41714446
has comment: http://stackoverflow.com/comment/41750072
score: 0
accepted answer: http://stackoverflow.com/a/26570072
answer count: 1
tagged with: user-interface
has title: populate check boxes dynamically from text in java
has answer: http://stackoverflow.com/a/26570072
has comment: http://stackoverflow.com/comment/41741487
has comment: http://stackoverflow.com/comment/41758787
tagged with: checkbox
has comment: http://stackoverflow.com/comment/41745623
type: AnsweredQuestion
tagged with: java
tagged with: populate
type: Question
has comment: http://stackoverflow.com/comment/41748974
has body: i am working on a project where i have to display a set of records then the user can select 1 or more of these records to move them to another set. i think the most appropiate componenet to use is Checkboxes. my probelm is that i cant add the check boxes to the frame automatically while reading the file. i added a panel, and added the check box but it still doesnt appear after using paint, or updateUI. this is my code: BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath()), "UTF-8")); String line = reader.readLine(); String text = ""; while (line != null) { text += line; line = reader.readLine(); } ArrayList&lt;String&gt; records = new ArrayList&lt;String&gt;(Arrays.asList(text.split(""))); for(String rec: records){ resPanal.add(new JCheckBox(rec)); } resPanal.updateUI(); the number of records is not constant, so i need a way to add the components = to the number of records found. i am open to other suggestions that can help other than check boxes

http://stackoverflow.com/comment/41754979
has text: Read the linked article, then implement it, then realize that `ProcessBuilder` does part of the recommendations for you (or at least makes it easy).
comment on: http://stackoverflow.com/q/26562502
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41791145
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26587180
type: AnswerComment
has text: as per `executor` documentation "An Executor is normally used instead of explicitly creating threads". But my problem is to create a queue that stores all request files, and give it to `thread` process.

http://stackoverflow.com/a/26611856
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26611780
type: Answer
score: 1
upvote count: 1
has body: Only change the source of the player to next media. one.start(); one.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { one.setDataSource(loopthroughSources); //may be an array or list of files path one.start(); } }); } });
accepted answer of: http://stackoverflow.com/q/26611780
has comment: http://stackoverflow.com/comment/41835548

http://stackoverflow.com/comment/54255368
has text: This is just to make sure your IDE works correctly. Where to set this up will depend on your IDE.
type: AnswerComment
comment on: http://stackoverflow.com/a/26618193
score: 0
type: Comment

http://stackoverflow.com/comment/41908325
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26652141
score: 0
has text: It is just a normal xml file. How to get the path of that file during plug-in runtime? Please help

http://stackoverflow.com/q/26624211
type: Question
has comment: http://stackoverflow.com/comment/41865761
upvote count: 3
has body: I have following code String templateString = "Some Text $attribute1$ more text $attribute2$ more text"; ST stringTemplate = new ST(templateString ,'$','$');` How can I iterate over all attributes i.e. attribute1, attribute2 etc? I want to get all list of attributes in template.
answer count: 1
has comment: http://stackoverflow.com/comment/41865872
favorite count: 0
has answer: http://stackoverflow.com/a/26983103
type: UnansweredQuestion
tagged with: stringtemplate-4
score: 3
downvote count: 0
has title: How to get Attributes in StringTemplate v4
tagged with: java

http://stackoverflow.com/comment/41876629
comment on: http://stackoverflow.com/a/26634130
type: Comment
has text: @dkatzel I wouldn't even be that prescriptive. As I mentioned near the end, one should think about what conceptual operations/functions that you want this class to provide - and then do whatever is necessary to provide those. So if it makes sense to expose some property through a getter, then you should define a getter. But I don't think one should do this willy-nilly, if it's not actually necessary.
score: 1
type: AnswerComment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/26530975
tag name: instantiation

http://stackoverflow.com/q/26558327
has comment: http://stackoverflow.com/comment/41737787
has comment: http://stackoverflow.com/comment/41737661
has comment: http://stackoverflow.com/comment/41737679
favorite count: 0
has body: New to the programming world and am even wondering if I am asking the question correctly so ill try to describe what I am doing as well as I can. I have a user defined class/object that I put values into one method. can I then use those same values in another method? Every time I try and do this I either get stack overflow errors or null's for the values that I am putting in private void foo(){ Bar bar1 = new Bar("value"); //value sent to class Bar } private void viewBar(){ System.out.println(bar1.toString()); } I know that this is wrong because bar1 isn't defined in the method but this is what my mind is telling me to do. If I but bar1 in the class then i get a stack overflow and if I instantiate it again, it will show up null. Please help. ok full program sort of* private void enterGuest() { Guest guest1 = new Guest("bob", "arktor", "bob@arktor.com", Calendar.getInstance().getTime(), 5 , "suite"); System.out.println(guest1.toString()); //overridden toString to show in nice format data } private void viewGuest() { Guest guest = new Guest(); // &lt;--will give null(basically this but without the new) System.out.println(guest.toString()); } globally i get a stack overflow, locally no other method sees it.
has title: Can I get the same object with its vales and use it in a different method?
has answer: http://stackoverflow.com/a/26558342
upvote count: 1
has comment: http://stackoverflow.com/comment/41737657
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41737672
accepted answer: http://stackoverflow.com/a/26558342
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26613890
accepted answer: http://stackoverflow.com/a/26614276
type: Question
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/26614276
score: 2
upvote count: 2
has body: I have already read Lars Vogel's tutorial on creating dynamic help in Eclipse RCP. However, it does not cover one topic - how to create side-pop-up help for dialog's (Like the one in screenshot) and integrate it with the rest of the help mechanism. Surprisingly, I could not find any materials describing this matter.
type: AnsweredQuestion
has title: How to implement context sensite help for dialogs in Eclipse RCP?
tagged with: java

http://stackoverflow.com/comment/41721158
type: Comment
type: QuestionComment
has text: Please, do not use Vector collection in a single threaded scenario. Use ArrayList.
score: 0
comment on: http://stackoverflow.com/q/26549302

http://stackoverflow.com/comment/41745866
has text: I doubt it. Though it might be a security risk or make harder what is your intended interface.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562992

http://stackoverflow.com/comment/41807090
comment on: http://stackoverflow.com/a/26595131
score: 0
type: AnswerComment
has text: Yes, I would copy the files into WEB-INF /lib, and then update the reference in my project (right click>properties>Java build path).
type: Comment

http://stackoverflow.com/q/26630871
has comment: http://stackoverflow.com/comment/41870941
has comment: http://stackoverflow.com/comment/41870788
score: 0
has body: I am developing an android app for online payment for which I want to display Lists of restaurants under the tab named Restaurants. Same as this some other tabs will have list below them and a few tabs will have form under them (if possible and not difficult otherwise I will stay with the lists only) Here is the code I have written. It contains an error in the Adapter class and may be some logical errors which I am not sure about as this is my first ever android app. Main.java File package com.example.tabswithswipe; import com.example.tabsswipe.adapter.TabsPagerAdapter; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.Menu; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; private String[] tabs = { "Retaurants", "Super Store", "Fuel Stations"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override pub…
tagged with: android
has title: Error while using ListFragement
has comment: http://stackoverflow.com/comment/41870920
answer count: 0
type: UnansweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/41871108
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41916618
has text: This is a query, not a java statement. `:id is null` is meaningless in the query world, because `:id` is the variable is passed which is unknown to database.
type: Comment
comment on: http://stackoverflow.com/a/26656683
score: 0
type: AnswerComment

http://stackoverflow.com/a/26661521
upvote count: 8
type: Answer
has body: Theory: You may have to initialize the collection - either eager or lazy. List&lt;TelefonNr&gt; telefonNrs = new LinkedList&lt;TelefonNr&gt;(); Or: public List&lt;Person&gt; getPersons() { if (this.persons == null) { this.persons = new LinkedList&lt;Person&gt;(); } return this.persons; } But see also this question: Help troubleshooting JAXB unmarshalling NPE
has comment: http://stackoverflow.com/comment/41925553
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26661141
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/26661141

http://stackoverflow.com/comment/42222520
type: AnswerComment
comment on: http://stackoverflow.com/a/26811209
type: Comment
has text: Thanks for your tips. I know the page you linked and usually have no problems with code signing. It's just this special app -> java -> jni -> dylib permission problem.
score: 0

http://stackoverflow.com/comment/41941180
has text: Thanks, I'm really impressed with how fast you answered! Working like a bullet.
comment on: http://stackoverflow.com/a/26670264
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26596676
has body: I could not test but I think it will be fine, you have a rectangle if you want to see if it collides with another actor, if so updates its position in the update and draw method, and ramdon method start customizing to see if the coordinates, which colicionan be assigned to another actor rectagulo enemy or bye. public class overFlowEnemy extends Sprite { private final float maxH = Gdx.graphics.getHeight(); private final float maxW = Gdx.graphics.getWidth(); private Rectangle rectangle; private Random random = new Random(); private float inttt = 0; private float randomN = 0; private boolean hasCollided = false; public overFlowEnemy(Sprite sprite) { super(sprite); crearEnemigo(); rectangle = new Rectangle(getX(), getY(), getWidth(), getHeight()); } @Override public void draw(Batch spriteBatch) { super.draw(spriteBatch); } private void crearEnemigo(){ setX(RandomNumber((int)maxW)); setY(RandomNumber((int)maxH)); } private int RandomNumber(int pos) { random.setSeed(System.nanoTime() * (long) inttt); this.randomN = random.nextInt(pos); inttt += randomN; return (int)randomN; } public Rectangle getColliderActor(){ return this.rectangle; } } the class as this should create a random enemy. Edit: rereading your question, is that my English is not very good, and I think you wanted to be drawn only on the sides of the screen if so, tell me or adapts the class because when you create thought, which was across the screen. I just added another class, if you can and want to work as you tell me which is correct, and delete the other. public class overFlow extends Sprite { private final float maxH = Gdx.graphics.getHeight(); private final float maxW = Gdx.graphics.getWidth(); private Rectangle rectangle; private Random random = new Random(); private float inttt = 0; private float randomN = 0; private boolean hasCollided = false; public overFlow(Sprite sprite) { super(sprite); crearEnemigo(); rectangle = new Rectangle(getX(), getY(), getWidth(), getHeight()); } @Override public void dr…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26592524

hibernate
tags question: http://stackoverflow.com/q/26624036
tags question: http://stackoverflow.com/q/26555408
tags question: http://stackoverflow.com/q/26613039
tags question: http://stackoverflow.com/q/26564360
tags question: http://stackoverflow.com/q/26590015
tags question: http://stackoverflow.com/q/26545733
tags question: http://stackoverflow.com/q/26618138
tags question: http://stackoverflow.com/q/26533307
tags question: http://stackoverflow.com/q/26635224
tags question: http://stackoverflow.com/q/26598110
tags question: http://stackoverflow.com/q/26611402
tags question: http://stackoverflow.com/q/26626920
tags question: http://stackoverflow.com/q/26651754
tags question: http://stackoverflow.com/q/26591896
tags question: http://stackoverflow.com/q/26632015
tags question: http://stackoverflow.com/q/26623314
tags question: http://stackoverflow.com/q/26657682
tags question: http://stackoverflow.com/q/26648936
tags question: http://stackoverflow.com/q/26647110
tags question: http://stackoverflow.com/q/26601764
tags question: http://stackoverflow.com/q/26594328
tags question: http://stackoverflow.com/q/26556989
tags question: http://stackoverflow.com/q/26551554
tags question: http://stackoverflow.com/q/26598994
tags question: http://stackoverflow.com/q/26604103
tags question: http://stackoverflow.com/q/26550306
tags question: http://stackoverflow.com/q/26522403
tags question: http://stackoverflow.com/q/26625202
tags question: http://stackoverflow.com/q/26601032
tags question: http://stackoverflow.com/q/26535896
tags question: http://stackoverflow.com/q/26639478
tags question: http://stackoverflow.com/q/26616723
tags question: http://stackoverflow.com/q/26559731
tags question: http://stackoverflow.com/q/26631827
tags question: http://stackoverflow.com/q/26612573
tags question: http://stackoverflow.com/q/26518791
tags question: http://stackoverflow.com/q/26514278
tags question: http://stackoverflow.com/q/26543633
tags question: http://stackoverflow.com/q/26663275
tags question: http://stackoverflow.com/q/26564952
tags question: http://stackoverflow.com/q/26630665
tags question: http://stackoverflow.com/q/26563606
tags question: http://stackoverflow.com/q/26611027
tag name: hibernate
tags question: http://stackoverflow.com/q/26591521
tags question: http://stackoverflow.com/q/26533562
tags question: http://stackoverflow.com/q/26532275
tags question: http://stackoverflow.com/q/26583715
tags question: http://stackoverflow.com/q/26666666
tags question: http://stackoverflow.com/q/26550660
tags question: http://stackoverflow.com/q/26558393
tags question: http://stackoverflow.com/q/26548318
tags question: http://stackoverflow.com/q/26664589
tags question: http://stackoverflow.com/q/26603717
tags question: http://stackoverflow.com/q/26584582
tags question: http://stackoverflow.com/q/26557926
tags question: http://stackoverflow.com/q/26526139
tags question: http://stackoverflow.com/q/26560174
tags question: http://stackoverflow.com/q/26597201
tags question: http://stackoverflow.com/q/26662339
tags question: http://stackoverflow.com/q/26611181
tags question: http://stackoverflow.com/q/26583120
tags question: http://stackoverflow.com/q/26550074
tags question: http://stackoverflow.com/q/26548785
tags question: http://stackoverflow.com/q/26650663
tags question: http://stackoverflow.com/q/26660041
tags question: http://stackoverflow.com/q/26526202
tags question: http://stackoverflow.com/q/26596501
tags question: http://stackoverflow.com/q/26622719
tags question: http://stackoverflow.com/q/26628425
tags question: http://stackoverflow.com/q/26555630
tags question: http://stackoverflow.com/q/26547522
tags question: http://stackoverflow.com/q/26543901
tags question: http://stackoverflow.com/q/26550866
tags question: http://stackoverflow.com/q/26571273
tags question: http://stackoverflow.com/q/26637924
tags question: http://stackoverflow.com/q/26516028
tags question: http://stackoverflow.com/q/26602385
tags question: http://stackoverflow.com/q/26610015
tags question: http://stackoverflow.com/q/26657259

http://stackoverflow.com/comment/41772149
has text: I have added an edit to hopefully provide some clarification. Please see above. i<x does not work because we will have x+1 options where the first digit is 0.
comment on: http://stackoverflow.com/q/26577175
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41905651
type: AnswerComment
type: Comment
has text: i have tried by placing this variable boolean flipped = false; outside for loop also
comment on: http://stackoverflow.com/a/26647189
score: 0

http://stackoverflow.com/a/26570153
has comment: http://stackoverflow.com/comment/41759359
downvote count: 0
has comment: http://stackoverflow.com/comment/74656349
score: 7
has body: The primary difference is that the Executor framework is for intra-program task queueing and execution, whereas JMS is for queuing between different programs (typically) on different machines. Other differences include: JMS queues are (or can be) persistent, where as Executor, etcetera are in-memory only. JMS queues can (I believe) be used in a transactional system, where as Executor, etcetera can't. (In part, that is a consequence of the persistent / non-persistent distinction.) So that means if my app is not distributed I can use Executor framework. Maybe ... For an instance I want to code a fb style notification system &amp; publish subscribe will the use of executor framework be fitting for that? I assume the code will be on the same machine in a single db. Well the problem is that the standard implementations of the Executor framework don't put the task queues into a database. They are just light-weight in-memory data structures. They don't persist if your application is restarted. Now, I suppose you could write your Executor / ExecutorService class that put the queue into a database. But why bother? It would be simpler to use JMS or similar ...
accepted answer of: http://stackoverflow.com/q/26570058
answers question: http://stackoverflow.com/q/26570058
upvote count: 7
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/74656550

http://stackoverflow.com/q/26596408
answer count: 3
possible better answer: http://stackoverflow.com/a/26596462
has answer: http://stackoverflow.com/a/26596462
has title: nullpointerexception when retrieving a rectangle from the array of rectangles
has answer: http://stackoverflow.com/a/26596502
score: 2
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/26596429
type: AnsweredQuestion
tagged with: android
favorite count: 0
type: Question
upvote count: 2
has body: So I have a class dealing with buttons and I have an array of rectangles containing 2 individual rectangular shapes. Now when I make a variable which retrieves say the 0th index of the array it will give me a nullpointerexception I have been scratching my head over this I have clearly declared and initialised the array and made it the appropriate size for 2 rectangles to be contained and have assigned these to the indexes. I must be missing something really small which I can't seem to figure out. Below I have put the relevant code for this: public class MenuButton { private int height; private int width; private float positionX; private float positionY; //private ArrayList&lt;Rectangle&gt; rects; private Rectangle rects[]; private Rectangle play; private Rectangle touchToPlay; private boolean isTouched; public MenuButton(int height, int width, float positionX, float positionY){ this.height = height; this.width = width; this.positionX = positionX; this.positionY = positionY; isTouched = false; Rectangle rects[] = new Rectangle[2]; play = new Rectangle(positionX, positionY, width, height); touchToPlay = new Rectangle(positionX, positionY, width, height); //can clean this up by introducing initButtons() to assign buttons to //indexes of the array rects[0] = play; rects[1] = touchToPlay; } public boolean isClicked(int index,float screenX, float screenY){ //ERROR IS BELOW THIS LINE Rectangle rect = rects[0]; return rect.contains(screenX, screenY); }
has answer: http://stackoverflow.com/a/26596429
tagged with: java

http://stackoverflow.com/a/26612382
answers question: http://stackoverflow.com/q/26596445
score: 0
type: AcceptedAnswer
type: Answer
has body: Well, i ended up using this answer Clear the entire history stack and start a new activity on Android And that do exactly what Im trying to do
accepted answer of: http://stackoverflow.com/q/26596445

http://stackoverflow.com/comment/41684091
has text: Thanks alot. Its now working well. NB - i have added ProductTableGlobal.setColumnFooter("Amount", numberFormat.format(totalSum));
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26527740
type: Comment

http://stackoverflow.com/comment/41858532
type: Comment
has text: @DanielAlexander: Do you understand what *"The directory name is invalid"* means? Have you forgot `r''` to make raw-string literal? Note: `'\n'` and `r'\n'` are different things in Python.
comment on: http://stackoverflow.com/a/26583425
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41721704
score: 0
type: AnswerComment
type: Comment
has text: i use the latest java jdk 1.8_0_25, but finally got it working with port 587 instead of 465. you should add this to your answer then i can mark it
comment on: http://stackoverflow.com/a/26548361

http://stackoverflow.com/q/26635918
has answer: http://stackoverflow.com/a/26636031
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: After login redirect to specific URL using spring security
linked to: http://stackoverflow.com/q/17779366
downvote count: 0
score: 1
has body: I have a case in developing a project. I have some courses link in footer of my application and whenever a user click on the same we will show him the login or sign up pop up(if he is not logged in) or redirect to the course page (If he is logged in). So now what i want that whenever a user click on course before login he/she should be redirected to the course detail page just after login. I am using spring security for authentication. Let me know how can i achieve this using spring security authentication?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/25607154
tagged with: spring-security

http://stackoverflow.com/comment/41870543
type: Comment
type: QuestionComment
has text: That depends on your JVM locale.
comment on: http://stackoverflow.com/q/26631214
score: 4

http://stackoverflow.com/a/26592253
has comment: http://stackoverflow.com/comment/41800103
type: Answer
answers question: http://stackoverflow.com/q/26591706
has body: Just try this: int millis = 9 * 1000; TimeZone tz = TimeZone.getTimeZone("UTC"); SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); df.setTimeZone(tz); String time = df.format(new Date(millis)); Log.i("Duration in seconds: ", time);
score: 0

http://stackoverflow.com/comment/59174088
has text: You can add @EqualsAndHashCode(exclude="foo")
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26648359
type: AnswerComment

http://stackoverflow.com/comment/41673351
has text: why `getEmployees extends MainActivity` ?
comment on: http://stackoverflow.com/q/26522274
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26660237
answers question: http://stackoverflow.com/q/26660147
score: 0
has body: The function you're looking for is nextInt(): stones= Input.nextInt(); Read this tutorial. Also, when you get an error that says the method is undefined, that means there is no method with that name. Make sure you spell the method name correct or referring to the correct method (check out the docs).
type: Answer

http://stackoverflow.com/comment/41840152
has text: Christian, the JavaScript tag was removed from your post, but I just wanted to make sure you took note of that -- if you don't already know that JavaScript has nothing to do with Java, you probably should. (The name is the result of an unfortunate marketing attempt to capitalize on Java's success in the mid 90s.)
score: 0
comment on: http://stackoverflow.com/q/26614305
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41817328
comment on: http://stackoverflow.com/a/26601792
type: AnswerComment
has text: @RonakShah see these voting down as opportunity to get better. You should have done this by yourself at the first place so you can learn how to debug your code in future. I voted you up since it was a good practice for me and I learn. Do not take it personal cuz I did before and trust me it does not help you.
score: 0
type: Comment

http://stackoverflow.com/comment/41704193
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26538866
has text: (MenuItem Item) instead of (View view) fixed it! Thanks!

http://stackoverflow.com/comment/41796413
score: 0
comment on: http://stackoverflow.com/q/26589706
type: Comment
type: QuestionComment
has text: `public void setCompanyName(String companyName) { this.companyName = companyName; }` It's just a simple setter, the value of the fields is not modified

http://stackoverflow.com/a/26545456
downvote count: 0
has comment: http://stackoverflow.com/comment/41714506
has body: Here's what you have done child c = new child(); You created Object of Child class and assigned its reference to c. parent p = c; Here you have copied reference of child object to p. Remember the object is still Child's object not parents's object. p.whatAreYou(); Here you have called whatAreYou method. you are calling this using reference variable p which is pointing to object of child. hence child's method will be called. Another Interpretation
type: Answer
has comment: http://stackoverflow.com/comment/41714232
answers question: http://stackoverflow.com/q/26544952
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26544952
has comment: http://stackoverflow.com/comment/41714331
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26599190
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/41813360
has comment: http://stackoverflow.com/comment/41813324
answers question: http://stackoverflow.com/q/26599094
has body: Try running the batch file directly, for example... ProcessBuilder pb = new ProcessBuilder("C:/Test.bat"); pb.redirectError(); try { Process p = pb.start(); try (InputStream inputStream = p.getInputStream()) { int in = -1; while ((in = inputStream.read()) != -1) { System.out.print((char)in); } } System.out.println("Exited with " + p.waitFor()); } catch (IOException | InterruptedException ex) { ex.printStackTrace(); } This was the batch file... @echo Hello World (I know, massive) and the code outputted... Hello World Exited with 0
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26599094
has comment: http://stackoverflow.com/comment/41813368

http://stackoverflow.com/comment/41920794
comment on: http://stackoverflow.com/a/26658069
type: AnswerComment
type: Comment
has text: Thanks. That sounds interesting. The only unclear point is how to refer in the PlatformAPI class three incompatible classes which cant be compiled together due to different plantform-dependent includes. And the print method in this case can't be defiled as static...
score: 1

http://stackoverflow.com/comment/41772938
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26561291
has text: @MarkoTopolnik, yes the normal case (where the first subclass of Object is already serializable) is invoking of Object c-tor. The need to call the c-tor on non-Externalizable classes arises from the fact that super class fields have to be inited (incl. the final fields) somehow. In the end even in byte code there are no real c-tors, the object is created uninitialzed entirely and then some <init> method is invoked. The verifier ensures no meddling in normal classes but the serialization is sidestepping that part.
score: 0

http://stackoverflow.com/a/28808422
answers question: http://stackoverflow.com/q/26530848
score: 0
type: Answer
has body: I ran into a similar problem recently when indexing geographic objects in two-dimensional tiles. I had to browse the MapDB source code and do some experimenting to understand what's going on. MapDB is storing your objects such that it is easy to iterate over them (or a sub-range of them) in their natural order. That order is not something you can change when iterating over the values, it is something that is taken into consideration as the objects are inserted. It affects the layout of the structure they are stored in (a b-tree). The tuple classes included with MapDB have lexicographical order. That is to say, they are ordered like words in a dictionary: their first elements are compared to see which tuple is greater than the other. If the two first elements are equal, we break the tie by moving on to the second element, then the third. You could also say they behave like a positional number system where all the numbers you're comparing have the same number of digits. As an example, let's look at a case where all of the elements in your tuples are one-digit integers. We begin by inserting all the possible combinations of three one-digit integers. If we filter like this: map.subMap(Fun.t3(2, null, null), Fun.t3(4, Fun.HI, Fun.HI)); we would iterate over the tuples (2,0,0), (2,0,1) (2,0,2) ... (3,9,9). Now, as in your example we change the submap call to use these bounds tuples: map.subMap(Fun.t3(null, 2, null), Fun.t3(Fun.HI, 4, Fun.HI)); Here we will iterate over the tuples (0,2,0), (0,2,1) (0,2,2) ... (9,3,9). The ordering is one-dimensional and the first element is more significant than the second one. What we really want in our cases is: for each value of the first element, pull out a subMap where the second element varies continuously. This involves jumping around inside the tree every time the first element changes -- it's not one long continuous iteration. The best way I've found to express this is to just wrap the subMap calls in a for loop, varying the high-…

http://stackoverflow.com/comment/41730529
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26553072
score: 0
has text: @ Vishal P Thank you. just rephrase the question. :)

http://stackoverflow.com/q/26659160
has comment: http://stackoverflow.com/comment/41920801
has body: I'm trying to use JDBC to connect with SQL but I have a problem. I got the following code from a tutorial. public static Connection getConnection() throws Exception { String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String url = "jdbc:odbc:northwind"; String username = ""; String password = ""; Class.forName(driver); // load JDBC-ODBC driver return DriverManager.getConnection(url, username, password); } On the third line of the code it says String url = "jdbc:odbc:northwind" I want to know what "northwind" means and how can I create one.
tagged with: sql-server
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26659232
tagged with: jdbc
has answer: http://stackoverflow.com/a/26659268
has answer: http://stackoverflow.com/a/26659213
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26659232
possible better answer: http://stackoverflow.com/a/26659213
has title: Understanding the database url in JDBC
tagged with: java
has comment: http://stackoverflow.com/comment/41929050
type: Question

http://stackoverflow.com/a/42640483
answers question: http://stackoverflow.com/q/26574600
score: 0
type: Answer
has body: This is the predefined function in jqgrid which will bind the data to the grid either its come from client or server side no matter. $('#yourGridId')[0].addJSONData(eval("(" + JSON.stringify(yourFormDataObject) + ")"));

http://stackoverflow.com/comment/41749092
has text: The first step of fixing a program is to know what is wrong with it. So, what happens when you execute the program. Tell us your inputs, the expected behavior, and the observed behavior.
comment on: http://stackoverflow.com/q/26564846
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/42292033
has body: Try This Picasso.with(context) .load(services.get(position).getImageInactive()) .into(holder.icon, new Callback() { @Override public void onSuccess() { holder.imageLoad.setVisibility(View.GONE); } @Override public void onError() { holder.icon.setImageResource(R.drawable.ic_error_image_load); } });
answers question: http://stackoverflow.com/q/26548660
score: 0
type: Answer

http://stackoverflow.com/q/26527717
downvote count: 0
possible better answer: http://stackoverflow.com/a/26528216
accepted answer: http://stackoverflow.com/a/26528169
favorite count: 0
has body: I got a problem with setting a value to a JProgressBar which i got from inside a type returning method. I know I have to do multi threading but I´m really new to this topic and really don´t know how to implement this. I try to briefly explain my dilemma in code: This is my data returning method to count lines in a String (e.g. from a JTextArea or whatsoever). public static int countLines(String s) { int count = 0; String[] words = s.split("\n"); for(String i: words) { count++; } return count; } What I want to add is a method inside this method that sets my JProgressBar that I created in my JFrame to the value count. E.g. setProgress(count); Is this even possible? Because i tried several ways of doing this and no matter what, the progressbar only updates AFTER the return value has been sent out. Do I have to run this method in an own Thread or just the progress setting method? or both? Cheers!
has title: Return Values & JProgressbar
answer count: 4
tagged with: return-type
has answer: http://stackoverflow.com/a/26528194
tagged with: multithreading
tagged with: jprogressbar
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/6916398
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26528169
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/24958793
has answer: http://stackoverflow.com/a/26528216
type: Question
has answer: http://stackoverflow.com/a/26528064

http://stackoverflow.com/q/26596461
tagged with: java
has comment: http://stackoverflow.com/comment/42304525
has comment: http://stackoverflow.com/comment/42310190
tagged with: dirichlet
type: Question
has comment: http://stackoverflow.com/comment/42263214
tagged with: anylogic
has comment: http://stackoverflow.com/comment/42350845
answer count: 1
downvote count: 0
has title: AnyLogic: Implementation of a Dirichlet distribution?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: all: Anyone know of a way to implement draws from a Dirichlet distribution in AnyLogic? I have three inter-related probabilities, such that p1 + p2 + p3 = 1, and I want to draw values for each of these. I'm currently implementing this with the following code: p1 = beta(10.0 * c, 10.0 * (1.0 - c)); p2 = min(beta(10.0 * a, 10.0 * (1.0 - a)), 1.0 - p1); p3 = max(0.0, 1.0 - p2 - p2); where a and c are my priors on p1 and p2. Thanks!
has answer: http://stackoverflow.com/a/45982241
score: 1

http://stackoverflow.com/comment/41688714
comment on: http://stackoverflow.com/q/26531065
score: 2
has text: @DreadHeadedDeveloper No. Look at it closer : the code will end at the first iteration with either `return true` or `return false`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/103473466
has text: nice and clean explanation.
type: AnswerComment
comment on: http://stackoverflow.com/a/26586629
score: 0
type: Comment

http://stackoverflow.com/comment/41835843
type: QuestionComment
comment on: http://stackoverflow.com/q/26611999
score: 0
has text: Use sparse boolean array.
type: Comment

http://stackoverflow.com/q/26597987
accepted answer: http://stackoverflow.com/a/26599111
favorite count: 0
has answer: http://stackoverflow.com/a/26598016
possible better answer: http://stackoverflow.com/a/26598016
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41810314
linked to: http://stackoverflow.com/q/18279456
type: Question
has answer: http://stackoverflow.com/a/26599111
has body: I would like help in smoothing my random terrain out to make it look more realistic. At the moment I'm just assigning random values to an array and setting tiles to the values stored in the array. This gives this effect: protected void generateLevel() { for (int y = 0; y &lt; height; y++) { for (int x = 0; x &lt; width; x++) { int rand = random.nextInt(1000); //height if(rand &lt;= 300){ //water level tiles[x + y * width] = 6;//set water }else{ tiles[x + y * width] = 1; //set grass } } } } Please help me in making my terrain look more realistic, I would like someones opinion on how they might implement this into their game or mine. How do I smooth my terrain for a realistic effect?
has title: Smoothing randomly generated terrain in Java for a realistic effect
answer count: 2
tagged with: random
tagged with: terrain
downvote count: 0

http://stackoverflow.com/a/26660923
has comment: http://stackoverflow.com/comment/41924066
type: Answer
has body: You cannot have "different objects of the same instance" because objects and instances are the same thing. Like "humans" and "people", more or less. However, you can have many references to the same instance, which may be helpful in keeping down memory footprint and creation/copy time in appropriate situations. Note that in Java, a variable defined with an object type, like, say: String str; Is not actually holding an object. It is holding a reference to an object. So you can have something like: String originalString = "This in a string". String a = originalString; String b = originalString; String[] arr = new String[10]; for ( int i = 0; i &lt; arr.length; i++ ) { arr[i] = originalString; } In this case, you will have only one object. Every variable in this code example - originalString, a, b, and all the elements of arr - are all references to the same object/instance.
answers question: http://stackoverflow.com/q/26660760
has comment: http://stackoverflow.com/comment/41923859
score: 0

http://stackoverflow.com/q/26625977
accepted answer: http://stackoverflow.com/a/26627273
has title: How to get only year from a date stored in OrientDB
tagged with: orientdb
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: date
upvote count: 2
tagged with: jbake
answer count: 1
has body: I'm working on JBake, and would like to get the year part of the date at which a document was stored. I know I can get the date by doing SELECT date FROM post And OrientDB will return me a java.util.Date. I know I can also add the year as another field, but I find this data duplication unsatistfying. So, is it possible to store the date, and to to have the year extracted through some kind of SQL "function" ? Typically I would love to do SELECT date, {date.getYear()} FROM post
favorite count: 0
has answer: http://stackoverflow.com/a/26627273

http://stackoverflow.com/comment/41712759
score: 0
comment on: http://stackoverflow.com/q/26544433
has text: Check the error message ` Document base {0} does not exist or is not a readable directory at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28575747
type: Answer
answers question: http://stackoverflow.com/q/26579073
upvote count: 0
score: -1
downvote count: 1
has body: public static int findMin(int[] num) { return helper(num, 0, num.length - 1); } public static int helper(int[] num, int endLeft, int endRight) { if (endLeft == endRight) return num[endLeft]; if ((endRight - endLeft) == 1) return Math.min(num[endLeft], num[endRight]); int middleIndex = endLeft + (endRight - endLeft) / 2; int middle = num[middleIndex]; // middle value if (num[endLeft] &lt; num[endRight]) { return num[endLeft]; } else if (middle &gt; num[endLeft]) { // go right side return helper(num, middleIndex, endRight); } else { // go left side return helper(num, endLeft, middleIndex); } } From coding interview.

http://stackoverflow.com/a/26627343
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26626913
has comment: http://stackoverflow.com/comment/41865014
answers question: http://stackoverflow.com/q/26626913
type: Answer
has comment: http://stackoverflow.com/comment/41865734
downvote count: 0
has comment: http://stackoverflow.com/comment/41864447
score: 1
has body: This is almost surely happening because your channel is positioned at the end of the file after reading it in. You should be able to remedy this by doing the following before carrying out the transform: channel.truncate(0); this should truncate the file to a size of 0 and reset the position to 0. http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html#truncate(long)
has comment: http://stackoverflow.com/comment/41865200

http://stackoverflow.com/comment/41944276
type: QuestionComment
has text: But the file is written, but is empty. So in my opinion, if there is a problem with the permissions, the file shouldn't even exist in the target-folder.
comment on: http://stackoverflow.com/q/26671997
score: 1
type: Comment

http://stackoverflow.com/q/26605151
favorite count: 0
has answer: http://stackoverflow.com/a/26605291
has body: I Am not able to read Properties File using Java.It Means In this Properties File Backward Slash is not working.It is showing like ,this destination :C:Usersxxx.a String filename="D://Desktop//xxx.properties"; is = new FileInputStream(filename); Properties prop=new Properties(); prop.load(is); System.out.println("destination :"+prop.getProperty("destination")); Property File is the : destination=C:\Users\xxx.a\ Result is showing destination :C:Usersxxx.a But I want to show destination :C:\Usersxxx.a\ Can You Please suggest Me?
tagged with: properties
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/26605199
tagged with: java
accepted answer: http://stackoverflow.com/a/26605531
has comment: http://stackoverflow.com/comment/94175113
type: Question
upvote count: 2
has title: Not able to read Properties File using Backward Slash
has comment: http://stackoverflow.com/comment/41823180
has comment: http://stackoverflow.com/comment/41828606
has answer: http://stackoverflow.com/a/26605531
has comment: http://stackoverflow.com/comment/41824134
linked to: http://stackoverflow.com/q/5784895
has answer: http://stackoverflow.com/a/26605199
linked to: http://stackoverflow.com/q/6233532
has answer: http://stackoverflow.com/a/26607465
tagged with: string
answer count: 4

http://stackoverflow.com/a/26551191
upvote count: 1
answers question: http://stackoverflow.com/q/26550990
has body: When the condition after if is true, only the first block is executed. The else block is only executed when the condition is false. It doesn't matter what's in the else block, it's not executed. The fact that the else block is another if statement is irrelevant; it won't be executed, so it will never perform the (A &gt; X || B &gt; X) test, and its body will not be executed even if that condition is true.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41858761
type: QuestionComment
has text: possible duplicate of [How to set time zone of a java.util.Date?](http://stackoverflow.com/questions/2891361/how-to-set-time-zone-of-a-java-util-date)
comment on: http://stackoverflow.com/q/26622844
score: 0
type: Comment

http://stackoverflow.com/a/26602310
has comment: http://stackoverflow.com/comment/41818588
answers question: http://stackoverflow.com/q/26602011
has comment: http://stackoverflow.com/comment/41818660
has comment: http://stackoverflow.com/comment/41818094
has comment: http://stackoverflow.com/comment/41818281
score: 0
has body: Call another function inside loop and use txtSee.setText(text1); inside that function. or (int i = 0; i &lt;= 5; i++) { String text1 = "Iteration No " + i + " occured"; call_function(text1,txtSee); } call_function:- call_function(String text1,TextView txtSee;){ txtSee.setText(text1); Thread.sleep(2000); }
type: Answer

http://stackoverflow.com/a/26663356
answers question: http://stackoverflow.com/q/26647840
downvote count: 0
upvote count: 6
has body: I think you have a good start. The only issue is that Thread.interrupt() won't stop the process. If the thread is blocked by in.readLine(), it won't exit until the process produced the output and the thread got a chance to check isInterrupted(). If you want to stop the process, in addition to calling Thread.interrupt() you need to call Process.destroy(): class MyRunnable implements Runnable { private Process pr; public void run() { // ... pr = pb.start(); } public shutdown() { pr.destroy(); interrupt(); } } Instead of registering the thread in the list you'll need to register your MyRunnable and call shutdown() on it. As for thread's behavior on System.exit(), all threads will be destroyed. However, using System.exit() is considered bad form because it terminates the application without giving threads a chance to shutdown gracefully. A sound engineering practice is to think through the graceful shutdown and use System.exit() only as a last resort.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41931049
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/26647840
has comment: http://stackoverflow.com/comment/41931129
has comment: http://stackoverflow.com/comment/41930745

bytecode
tags question: http://stackoverflow.com/q/26668370
tags question: http://stackoverflow.com/q/26637137
tags question: http://stackoverflow.com/q/26627981
type: Tag
tag name: bytecode

http://stackoverflow.com/comment/41734344
has text: @whiskeyspider - So if it stays selected because of the exception, how should bring it back to normal?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26556225
score: 0

http://stackoverflow.com/q/26513957
has body: We are playing around with mouseDragged and multipleObjects. We are trying to create a board game that has 8 pieces that can be individually clicked and dragged to their respective location on the board (without using jpanel, jframe, etc). As of now we have created 8 individual pieces for the board game, however when you go to click/drag piece '2', it causes all of the pieces to come together under the top piece. Our initial solution (not shown) is to use a button to cycle between players pieces, but we would like to try to do this without the use of a button. Any suggestions are welcome. Board: import java.applet.Applet; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.net.MalformedURLException; import java.net.URL; public class GameBoard extends Applet implements ActionListener, MouseListener, MouseMotionListener { GamePiece gp1; GamePiece gp2; GamePiece gp3; GamePiece gp4; GamePiece gp5; GamePiece gp6; GamePiece gp7; GamePiece gp8; Image bg; int xposR; int yposR; @Override public void init() { System.out.println(getCodeBase().getPath().toString()); MediaTracker tracker = new MediaTracker(this); try { bg = getImage(new URL("file:/C:/Backdroptest.png")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } tracker.addImage(bg, 0); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize(d); gp1 = new GamePiece(0, 0, "blue"); gp2 = new GamePiece(40, 0, "red"); gp3 = new GamePiece(80, 0, "yellow"); gp4 = new GamePiece(120, 0, "green"); gp5 = new GamePiece(160, 0, "orange"); gp6 = new GamePiece(200, 0, "cyan"); gp7 = new GamePiece(240, 0, "gray"); gp8 = new GamePiece(280, 0, "magenta"); addMouseListener(this); addMouseMotionListener(this…
has comment: http://stackoverflow.com/comment/41703892
type: Question
has comment: http://stackoverflow.com/comment/41705298
has comment: http://stackoverflow.com/comment/41703888
score: 3
has comment: http://stackoverflow.com/comment/41658141
has comment: http://stackoverflow.com/comment/41705351
tagged with: awt
has comment: http://stackoverflow.com/comment/41658207
has comment: http://stackoverflow.com/comment/41663012
downvote count: 0
tagged with: applet
has title: Trouble with mouseDragged and multiple objects
favorite count: 0
tagged with: java-2d
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6255106
answer count: 0
upvote count: 3
tagged with: mouselistener
tagged with: java

http://stackoverflow.com/q/26545773
tagged with: authentication
type: Question
has comment: http://stackoverflow.com/comment/41714669
score: 0
tagged with: api
answer count: 1
has answer: http://stackoverflow.com/a/26545984
has body: I've done an API and now I want to use it with Android. First of all I want to make a login and the access to the MainActivity but I don't know how to use my API to check if the info introduced in the Android Login is correct compared with the one i've stored. How can I access to the information I've stored in a database through my API? For example, I've a method called getUser in my API which returns an User and it's running in my local tomcat. I'd like to access to this method from Android through the server and get an User and then compare it with the one introduced in the Android Login. For now I've the following in Login Activity: public class LoginActivity extends Activity { private final static String TAG = LoginActivity.class.getName(); private Button btnLogin; private EditText inputUsername; private EditText inputPassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); inputUsername = (EditText) findViewById(R.id.etUsername); inputPassword = (EditText) findViewById(R.id.etPassword); btnLogin = (Button) findViewById(R.id.bLogin); btnLogin.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SharedPreferences prefs = getSharedPreferences("mini-profile", Context.MODE_PRIVATE); String username = prefs.getString("username", null); String password = prefs.getString("password", null); if ((username != null) &amp;&amp; (password != null)) { Intent intent = new Intent(LoginActivity.this, MiniMainActivity.class); startActivity(intent); finish(); } } }); } } Can you explain me more or less how to do it? Or do you know some interesting site where is explained something like this? Thank you.
accepted answer: http://stackoverflow.com/a/26545984
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: Make a Login Activity in Android using my own API

http://stackoverflow.com/q/26569682
has answer: http://stackoverflow.com/a/26569745
upvote count: 1
tagged with: swing
has body: Is there a way to set a JToggleButton as selected or deselected without actually firing the itemevent linked to it. I have a jtogglebutton that I want fired in certain instances, but for ui purposes I would like to occasionally change it's selected state without actually firing the button. Any input would be appreciated, thanks.
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26569745
type: Question
tagged with: jtogglebutton
tagged with: user-interface
downvote count: 0
answer count: 1
favorite count: 0
has title: Using a JToggleButton without firing it.

http://stackoverflow.com/q/26621620
has title: How to find the currently displaying dialog?
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1354254
score: 1
tagged with: java
has body: See the example code below. After clicking the example button a few times, how to find the last dialog opened ? This is a real use-case. A user has opened one or two modal dialogs and has clicked a button starting a long running background task in the last dialog and has then switched to another application during that background task is running. On completion, the task should display a notification window with the correct dialog as the parent so that when switching back to the application, that notification window is shown on top of the correct dialog. import java.awt.FlowLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; public class Example { private JDialog createDialog( final Window parent, final int count ) { final JDialog dialog = new JDialog( parent, "Dialog " + count ); dialog.setModal( true ); dialog.getContentPane().setLayout( new FlowLayout() ); final JButton button = new JButton( "Open Dialog " + ( count + 1 ) ); button.addActionListener( new ActionListener() { @Override public void actionPerformed( final ActionEvent e ) { final JDialog nextDialog = createDialog( dialog, count + 1 ); nextDialog.pack(); nextDialog.setLocationRelativeTo( dialog ); nextDialog.setVisible( true ); } } ); dialog.getContentPane().add( button ); return dialog; } public static void main( final String[] arguments ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { final Example example = new Example(); final JDialog dialog = example.createDialog( null, 1 ); dialog.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE ); dialog.pack(); dialog.setLocationRelativeTo( null ); dialog.setVisible( true ); } } ); } }
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26621653
type: Question

http://stackoverflow.com/comment/41717993
comment on: http://stackoverflow.com/q/26530815
score: 0
type: Comment
type: QuestionComment
has text: ok. ill give it a try.

http://stackoverflow.com/comment/41763401
comment on: http://stackoverflow.com/a/26572598
has text: that makes the inital value for OldPi equal the inital value for pi and the program just outputs nothing... :(
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26606291
score: -1
answers question: http://stackoverflow.com/q/26605981
has body: I'm not sure because you haven't posted a full runnable example, but I think, you simply need to update your model. bird.add(sparrow); bird.add(cuckoo); model.reload(); // your model and tree don't know that you've added some nodes. this.pack(); this.setVisible(true);
upvote count: 0
has comment: http://stackoverflow.com/comment/41825699
type: Answer
downvote count: 1

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/26570412
tag name: tablemodel
tags question: http://stackoverflow.com/q/26646795
tags question: http://stackoverflow.com/q/26547706

http://stackoverflow.com/comment/41934455
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26644173
type: Comment
has text: @user3431327: i don't know where you got this, but the questions test specific objectives, it's not apparent to me what those would be here.

http://stackoverflow.com/q/26589193
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26605581
type: Question
has body: to time i write some junitbenchmark tests. now i want to set warmup and test rounds from a wrapper class. How to set the BenchmarkOptions annotation from wrapper? my wrapper class: import org.junit.runner.JUnitCore; import org.junit.runner.Result; public class Wrapper { public static void main(String[] args) { JUnitCore junit = new JUnitCore(); Result result; result = junit.run(Test.class); } } my test method in Test.class: @BenchmarkOptions(benchmarkRounds = 50, warmupRounds = 10) @Test public void test1() { //something to do }
answer count: 1
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/26605581
favorite count: 0
has title: dynamic annotation for junitbenchmark
tagged with: annotations
upvote count: 1
type: AnsweredQuestion
tagged with: dynamic

http://stackoverflow.com/q/26585817
type: Question
has comment: http://stackoverflow.com/comment/41806040
tagged with: java
tagged with: caching
has body: I'm having trouble to get started with gridgain, i'm using the xml configuration file that come with gridgain examples example-cache.xml (Is there a simpler configuration file?). When I start gridgain as follows I got a GridException: public static void main(String[] args) throws GridException, URISyntaxException { URL url = GridgainCache.class.getClassLoader().getResource("gridgain.xml"); String filename = url.toURI().toString(); System.out.println("Reading gridgain conf from: "+filename); Grid g = GridGain.start(filename); ... } Here is full stack trace: Exception in thread "main" class org.gridgain.grid.GridException: Failed to add no-op logger for Log4j. For more information see: Troubleshooting: http://bit.ly/GridGain-Troubleshooting Documentation Center: http://bit.ly/GridGain-Documentation at org.gridgain.grid.util.GridUtils.addLog4jNoOpLogger(GridUtils.java:7709) at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:714) at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:659) at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:522) at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:492) at org.gridgain.grid.GridGain.start(GridGain.java:314) at com.examples.gridgain.GridgainCache.main(GridgainCache.java:102) Caused by: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.gridgain.grid.util.GridUtils.addLog4jNoOpLogger(GridUtils.java:7706) ... 6 more Do I need to configure log4j? i'm using slf4j.
has comment: http://stackoverflow.com/comment/41875753
answer count: 1
has answer: http://stackoverflow.com/a/28120014
score: 0
tagged with: gridgain
accepted answer: http://stackoverflow.com/a/28120014
has comment: http://stackoverflow.com/comment/41873862
tagged with: log4j
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41820526
has title: GridException Failed to add no-op logger for Log4j on GridGain startup

http://stackoverflow.com/comment/41674024
score: 0
comment on: http://stackoverflow.com/q/26521810
has text: It looks fine to me; does it work? I'd say there's nothing in the description that *demands* an additional class, so it's up to you. I would say you should give the material another look. Asking if arrays require two programs makes me think 2 things, you're not understanding data structures, and you may want to convince yourself that there's a difference between classes and programs.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26529007
accepted answer of: http://stackoverflow.com/q/26528706
answers question: http://stackoverflow.com/q/26528706
score: 2
has body: This is a very brief overview and you'll probably have a bit of reading to do to be able to implement this, the steps are: Create an SQLite database to store all data in. Implement a ContentProvider which provides CRUD access to the database. Add an account authenticator and add an account (can be a dummy account if you don't actually use accounts with your application but it's required for the next step, see http://developer.android.com/training/sync-adapters/creating-authenticator.html). Create a SyncAdapter to keep the database in sync with the web service. Your UI should be displaying data from the database rather than calling the web service. There are various ways you can trigger a sync e.g. manually by the user or automatically when data changes. You can use observers to update the UI when data changes too.
downvote count: 0
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26543064
has answer: http://stackoverflow.com/a/26543096
tagged with: mutex
has comment: http://stackoverflow.com/comment/41710058
upvote count: 7
has body: I have a multi-threaded application where a thread sends a message to another thread. The waiting thread polls for the message and reacts (locks are handled). Like this: Waiting thread code: while(true) { if(helloArrived()) System.out.println("Got hello"); if(byeArrived()) System.out.println("Got bye"); if(stopArrived()) break; } I want to avoid this cpu hogging technique and use something else instead. Any ideas? Edit: The actual code is below: BlockingQueue&lt;Mail&gt; killMeMailbox = new LinkedBlockingQueue&lt;Mail&gt;(); BlockingQueue&lt;Mail&gt; messageMailbox = new LinkedBlockingQueue&lt;Mail&gt;(); public void run() { while(true) { if(killMeMailbox.size() &gt; 0) { break; } if(messageMailbox.size() &gt; 0) { System.out.println(messageMailbox.poll()); } } } public void receiveMail(Mail mail) { //kill if(mail.from == -1) { killMeMailbox.add(0); } else { //other try { messageMailbox.put(mail); } catch(Exception e) { System.out.println(e.getMessage()); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/26543187
accepted answer: http://stackoverflow.com/a/26543187
possible better answer: http://stackoverflow.com/a/26543199
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41710075
downvote count: 0
has title: How to avoid busy spinning in Java
score: 7
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/26543174
has comment: http://stackoverflow.com/comment/41710104
type: Question
has answer: http://stackoverflow.com/a/26543199

http://stackoverflow.com/q/26548399
type: Question
has title: Spring REST - Array inside RequestBody only contains one Element
answer count: 1
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/26549437
has body: This is my first question here, so please do not be too harsh :) Inside my spring-mvc driven REST backend I created two entities like this: @Entity public class ObjectWithParameters implements Serializable { private long id; private String name; private String description; private String content; @OneToMany(fetch = FetchType.EAGER, mappedBy = "service") @JsonManagedReference private Set&lt;Parameter&gt; parameters = new HashSet&lt;Parameter&gt;(); ... public Set&lt;Parameter&gt; getParameters() { return parameters; } public void setParameters(Set&lt;Parameter&gt; parameters) { this.parameters = parameters; } ... and @Entity public class Parameter implements Serializable { private long id; private String key; private String value; @ManyToOne @JsonBackReference private RestService service; ... Inside the @RestController for the ObjectWithParameters-Entity I tried creating a @RequestMapping which takes JSON containing an ObjectWithParameters-Object with the parameters-set inside and create corresponding objects from this (and save it afterwards to the mysql database via hibernate). @RequestMapping(value = "/rest/object-with-parameters", method = RequestMethod.POST) public void create(@RequestBody ObjectWithParameters objectWithParameters) { for (Parameter param : objectWithParameters.getParameters()) { log.debug("Param inside received ObjectWithParameters: {}", param); } ... } The For-Loop only runs one time and if i log or save (or whatever) the parameter set contains only one parameter object... even if the JSON inside the RequestBody looks like this (I checked this with the dev tools in chrome): { "id": 1, "name": "testName", "description": "testDescription", "content": "testContent", "parameters": [ { "value": "foo", "key": "bar" }, { "value": "foo2", "key": "bar2" }, { "value": "foo3", "key": "bar3" } ] } In this case the log output from inside the shown for loop will only be "01:54:52-800 [DEBUG] ParamInside received ObjectWithParameters: ServiceParameter [id=0, …
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26549437
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41721092
tagged with: post

http://stackoverflow.com/comment/41832938
has text: Hi! Thank you for your answer; I tried to use your method but I had the same problem: windowClosed() method is not invoked when I close the jFrame. Do you know why?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26586967

http://stackoverflow.com/comment/41723860
type: AnswerComment
has text: @Kiran: I've already shown you how to fix it. Did you read my whole answer?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26550612

http://stackoverflow.com/comment/41755013
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26566791
has text: What I still don't understand is why you are trying to read stdout from `/bin/ls` twice in a nested loop?

http://stackoverflow.com/comment/41782017
has text: That's sad. I thought using hibernate + the sessionFactory would allow me to use these PostLoad Events - thanks anyway.
type: QuestionComment
comment on: http://stackoverflow.com/q/26576073
score: 0
type: Comment

http://stackoverflow.com/comment/41862063
has text: It's loaded by default if exists. If you have a specific question, please, ask it separately. This answer I have written against your last edit.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26619488

http://stackoverflow.com/a/26516061
answers question: http://stackoverflow.com/q/26516020
downvote count: 1
type: Answer
score: 5
has body: The only difference is that try-resource is adding automatically resource.close(); as you would do in finally block
upvote count: 6

http://stackoverflow.com/comment/41846711
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26617365
type: QuestionComment
has text: In my case the rest of the code is open source, I just want to protect the server from modified clients. If I use something like Excelsior JET and not just obfuscation, a hacker then has to fake the checksum and has to find out how the calculation of the new hash works. This would not be that easy. right?

http://stackoverflow.com/a/26662015
downvote count: 0
upvote count: 2
type: Answer
has body: According to mkyong jersey+jackson tutorial, you need to add com.sun.jersey.api.json.POJOMappingFeature param in your web.xml to integrate them jersey-serlvet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.mkyong.rest com.sun.jersey.api.json.POJOMappingFeature true 1
has comment: http://stackoverflow.com/comment/41928376
score: 2
answers question: http://stackoverflow.com/q/26659668

http://stackoverflow.com/a/26526820
accepted answer of: http://stackoverflow.com/q/26526597
answers question: http://stackoverflow.com/q/26526597
type: AcceptedAnswer
upvote count: 3
has body: First thing is that you do never set this GreenhauseBO in the GreenhouseRunnable public void addGreenhouse(GreenhouseBO g){ if(g == null){ // g refers to the parameter this.g = g; } } should be probably public void addGreenhouse(GreenhouseBO g){ if(this.g == null){ this.g = g; } } Second... In your code you assign the GreenhouseBO to a variable g, but your code only shows an instance variable g. Since you make the assignment in a static context static void main, this should not compile. Is there more code that you have not posted. private GreenhouseBO g; public static void main(String[] args) { //Make greenhouse object g = new GreenhouseBO("192.168.0.100", 1234); // where is the static `g` variable or did you mean private static GreenhouseBO g;
type: Answer
has comment: http://stackoverflow.com/comment/41680929
score: 3
downvote count: 0

http://stackoverflow.com/q/26640781
possible better answer: http://stackoverflow.com/a/26641023
tagged with: java
has answer: http://stackoverflow.com/a/26641023
has title: Hollow NxN square using loops
has answer: http://stackoverflow.com/a/26642012
score: 0
has answer: http://stackoverflow.com/a/26640933
accepted answer: http://stackoverflow.com/a/26640933
answer count: 3
has comment: http://stackoverflow.com/comment/41888696
type: AnsweredQuestion
has body: So I have an exercise in Java where I need to have a user input a number between 1 and 9 and have it output a hollow NxN square based off of the number they entered. I need to use loops and conditionals. The idea would be to have something like this: input number: 5 output: (dots would be replaced by spaces) 55555 5 5 5 5 5 5 55555 I can't seem to get it to output correctly. I have an extra "middle" line tagged on to the beginning of my first line. Here's what I have: import java.util.Scanner ; public class Assignment1Q4 { public static void main (String [] args) { int n, counter1=1, counter2=1 ; Scanner kbd = new Scanner(System.in) ; System.out.print("Please enter a number between 1 and 9: ") ; n = kbd.nextInt() ; if(n&lt;=9) { while(counter1&lt;=n) { //counter1 keeps track of what line it's on if(counter1==1) { //determines if first line while(counter2&lt;=n) { //counter2 keeps track of how many characters printed System.out.print(n); counter2=counter2+1 ; } } if(counter1==n) { //determines if last line counter2=1 ; while(counter2&lt;=n) { //does the same as the while for the first line System.out.print(n); counter2=counter2+1 ; } } else { //is it the lines in between counter2=1 ; while(counter2&lt;=n) { if(counter2==1 || counter2==n) { //is it first or last char System.out.print(n) ; } else { System.out.print(" ") ; } counter2=counter2+1 ; } } System.out.println() ; //makes sure each new line does print on a new line counter1=counter1+1 ; } } else { System.out.print("Error: The number you have entered is not between 1 and 9") ; } } } This is the output: Please enter a number between 1 and 9: 4 44444 4 4 4 4 4 4444
tagged with: loops
type: Question

http://stackoverflow.com/comment/41789270
has text: what is repaint() method. doesn't show up when i press (.) ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26587070
score: 0
type: Comment

http://stackoverflow.com/q/26516204
accepted answer: http://stackoverflow.com/a/26555612
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/29929619
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/41669327
tagged with: jdbc
linked to: http://stackoverflow.com/q/14779896
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41662327
has answer: http://stackoverflow.com/a/26555612
has body: I'd like to create a JDBC PreparedStatement like: SELECT URL,LOCATE ( '?', URL ) pos FROM Links WHERE pageId=? ORDER BY pos ASC Where the 1st ? is a literal and the 2nd ? is a parameter. I could use CHAR(63) in place of the '?' but I think the extra function call would slow down the SQL execution. Is there some way to escape that 1st ?? Edit: The following code tests dkatzel's assertion that the ? character in a string is not considered a marker: public class Test { public static void main(String[] args) throws SQLException { Connection conn = DriverManager.getConnection("jdbc:h2:mem:test"); Statement stmt = conn.createStatement(); stmt.executeUpdate("CREATE TABLE Links(URL VARCHAR(255) PRIMARY KEY,pageId BIGINT)"); stmt.executeUpdate("INSERT INTO Links(URL,pageId) VALUES('http://foo.bar?baz',1)"); stmt.executeUpdate("INSERT INTO Links(URL,pageId) VALUES('http://foo.bar/baz',1)"); stmt.close(); PreparedStatement ps = conn .prepareStatement("SELECT URL,LOCATE ( '?', URL ) pos FROM Links WHERE pageId=? ORDER BY pos ASC"); ps.setLong(1, 1); ResultSet rs = ps.executeQuery(); while (rs.next()) { System.out.println(rs.getString(1) + ":" + rs.getInt(2)); } rs.close(); ps.close(); conn.close(); } } The output: http://foo.bar/baz:0 http://foo.bar?baz:15 It appears that dkatzel is correct. I searched the the JDBC Spec and could not find any mention that the ? parameter marker would be ignored if it's within quotes, but the few implementations of PreparedStatement parsers that I found (MySql,c-JDBC,H2) all appear to exclude text within single quotes from consideration as parameter markers.
has answer: http://stackoverflow.com/a/26516266
score: 17
tagged with: prepared-statement
has title: How do I escape a literal question mark ('?') in a JDBC prepared statement
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/26516281
possible better answer: http://stackoverflow.com/a/35359397
tagged with: java
has answer: http://stackoverflow.com/a/35359397
linked to: http://stackoverflow.com/q/27573778

http://stackoverflow.com/a/35187188
has comment: http://stackoverflow.com/comment/86808081
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/110759018
upvote count: 11
answers question: http://stackoverflow.com/q/26610309
has comment: http://stackoverflow.com/comment/74582351
has comment: http://stackoverflow.com/comment/131250175
has body: Arraycopy is an expensive operation, both time and memory wise. Following would be an efficient way to rotate array without using extra space (unlike the accepted answer where a new array is created of the same size). public void rotate(int[] nums, int k) { // k = 2 k %= nums.length; // {0,1,2,3,4} reverse(nums, 0, nums.length - 1); // Reverse the whole Array // {4,3,2,1,0} reverse(nums, 0, k - 1); // Reverse first part (4,3 -&gt; 3,4) // {3,4,2,1,0} reverse(nums, k, nums.length - 1); //Reverse second part (2,1,0 -&gt; 0,1,2) // {3,4,0,1,2} } public void reverse(int[] nums, int start, int end) { while (start &lt; end) { int temp = nums[start]; nums[start] = nums[end]; nums[end] = temp; start++; end--; } }
has comment: http://stackoverflow.com/comment/87230550
downvote count: 0

http://stackoverflow.com/a/26564063
has body: NO the above database configration cannot be moved to a java file BUT can be moved to dispactcher servelet.Actually that whole hibernate.cfg.xml is not required from spring 2.5 version upwards. You can do the set up of the hibernate properties inside the dispatcher servlet like this. The below code uses mysql dialect so replace it with your requirement also replace name of the database,username and password of the database. <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd"> <context:component-scan base-package="com.c.controllers" /> <context:component-scan base-package="com.c.service" /> <context:component-scan base-package="com.c.dao" /> <mvc:annotation-driven /> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/"your database name" "insert username here" "insert password here" com.c.beans.Employee org.hibernate.dialect.MySQLDialect true true <tx:annotation-driven transaction-manager="transactionManager…
score: 0
answers question: http://stackoverflow.com/q/26563328
type: Answer
has comment: http://stackoverflow.com/comment/127989613
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/26572497
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26572700
accepted answer: http://stackoverflow.com/a/26572700
tagged with: java
possible better answer: http://stackoverflow.com/a/26572679
type: Question
has answer: http://stackoverflow.com/a/26572750
has answer: http://stackoverflow.com/a/26572679
score: 0
answer count: 3
has title: Java code to search for strings and other relating strings
has body: In a text file I have the following Entries 1|002|3|Lubna|M|141021081331| 2|003|3|Rashid|1|141021081431| 3|002|3|Amal|M|141021081340| 4|002|3|Lubna|F|141021081531| I want to create a Java code to check for the existence of |M|; i.e. means Lubna is searching for something. And to check after that if Lubna found what she was searching about, and that will happen if for the same username is followed by |F|. for example : 1|002|3|Lubna|M|141021081331| ---&gt; Lubna is searching 1|002|3|Lubna|F|141021081531| ---&gt; Lubna found what she was searching about 1|002|3|Amal|M|141021081340|----&gt; Amal is searching But because there is no amal record include |F| so that mean she is still searching.. Provide the records might be unlimited , i.e. not only 4 as in the above example.. So what I did is the following: String st; // where 14 is num of columns in record , like in our examle they are 6 String [] subst= new String [14] ; while ((st = inputStream.readLine()) != null) { if (st.contains("|M|")) { for (int i = 0; i &lt; 14; i++) { subst=st.split("[|]"); } System.out.println(subst); n++; } else if (st.contains("|F|")) { // System.out.println(EmailBody[j]); } } In this if I will manage to make this subst not only 1 dimension array of string, but make it 2, I can search for the existence of |F|, but the problem is that I can't initialize such this kind of arrays because I don't know what its second dimension will be.. Any one can help me if finding an easiest way to achieve my need ??

http://stackoverflow.com/comment/41774675
type: QuestionComment
comment on: http://stackoverflow.com/q/26576345
score: 0
has text: I call communicate, but only after the process has been running for about 5 minutes (it takes that long to produce the results I need). In the mean time the app is writing a log message every few seconds.
type: Comment

http://stackoverflow.com/q/26527060
has comment: http://stackoverflow.com/comment/41681392
has comment: http://stackoverflow.com/comment/41681750
tagged with: java
has comment: http://stackoverflow.com/comment/41681113
has comment: http://stackoverflow.com/comment/41681399
has comment: http://stackoverflow.com/comment/41681725
possible better answer: http://stackoverflow.com/a/26527464
has comment: http://stackoverflow.com/comment/41681333
downvote count: 1
has answer: http://stackoverflow.com/a/26527995
type: Question
has comment: http://stackoverflow.com/comment/41681343
has comment: http://stackoverflow.com/comment/41681610
has comment: http://stackoverflow.com/comment/41681669
has comment: http://stackoverflow.com/comment/41681295
upvote count: 4
has comment: http://stackoverflow.com/comment/41687781
has answer: http://stackoverflow.com/a/26527747
has comment: http://stackoverflow.com/comment/41681383
has answer: http://stackoverflow.com/a/26527613
has comment: http://stackoverflow.com/comment/41681315
favorite count: 0
has body: I am looking for a design pattern to handle Exception instances received as method arguments. To put some context into the question, I am using GWT and have various asynchronous handlers that usually come in a form similar to: public interface AsyncCallback&lt;T&gt; { void onFailure(Throwable caught); void onSuccess(T result); } So, the onFailure method receives a Throwable instance that I need to handle. Now, I have a number of exceptions I can receive in this method, for example ConstraintViolationException TimeoutException NoSuchElementException In my handling code I could of course write the following: void handleException(final Exception e) { if(e instanceof TimeoutException) { handleTimeout(); } else if (e instanceof NoSuchElementException) { handleInvalidElement(); } else { stopAndCatchFire(); } } But to my eye, that looks very ugly. The large if..else if chain combined with heavy usage of instanceof seems like something that should be avoided. I thought that maybe I could use the try...catch construct to handle the Exception using something like the following: void handleException(final Exception e) { try { throw e; } catch (TimeoutException te) { handleTimeout(); } catch (NoSuchElementException nsee) { handleInvalidElement(); } catch (Exception ex) { stopAndCatchFire(); } } But this seems like an abuse somehow. Do you see any downsides to the second approach or another approach I could go with to avoid the first case?
tagged with: exception
has comment: http://stackoverflow.com/comment/41681616
tagged with: design-patterns
answer count: 4
accepted answer: http://stackoverflow.com/a/26527747
has answer: http://stackoverflow.com/a/26527464
has comment: http://stackoverflow.com/comment/41681772
type: AnsweredQuestion
has title: Handling an exception as a method argument
score: 3
has comment: http://stackoverflow.com/comment/41681495

http://stackoverflow.com/comment/41738077
comment on: http://stackoverflow.com/a/26556249
score: 2
type: AnswerComment
has text: +1. I like this solution. How did it compare to my solution?
type: Comment

http://stackoverflow.com/comment/41864152
type: AnswerComment
type: Comment
has text: 3, I don't understand. Please give me an example code on how to add on the variable in the constructor.
score: 0
comment on: http://stackoverflow.com/a/26624969

http://stackoverflow.com/q/26637045
has answer: http://stackoverflow.com/a/26637089
tagged with: java
has comment: http://stackoverflow.com/comment/41881496
tagged with: servlets
possible better answer: http://stackoverflow.com/a/26637089
answer count: 3
accepted answer: http://stackoverflow.com/a/27127732
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has body: hey guys i want to display the data from ResultSet in HTML table .. here is my code while(result.next()){ writer.println(" " + " FIRSTNAME LASTNAME " + " "+result.getString("firstname")+" " + " "+result.getString("lastname")+" "); } but it foesnot work well for multiple rows .. so any help ??
type: AnsweredQuestion
has title: displaying data from ResultSet in html table
has answer: http://stackoverflow.com/a/27127732
has comment: http://stackoverflow.com/comment/41881366
upvote count: 1
has answer: http://stackoverflow.com/a/58651337
type: Question

http://stackoverflow.com/a/26574912
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Use the BlobInfo class. BlobInfoFactory blobInfoFactory = new BlobInfoFactory(); BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey); String fileName = blobInfo.getFilename();
accepted answer of: http://stackoverflow.com/q/26574680
type: Answer
answers question: http://stackoverflow.com/q/26574680
upvote count: 2

http://stackoverflow.com/comment/41941997
score: 0
type: Comment
has text: So the user ( if someone else wanted to use this ) would still have to download the Netty.jar, even though it's already inside of 'MyLibrary.Jar' ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26670768

http://stackoverflow.com/a/26525161
answers question: http://stackoverflow.com/q/26520811
score: 4
has body: The JSP contains a select tag returned by the action. When you add an order it should have a list attribute bound to the bean property. It should be a top object in the value stack. In most cases initializing that property in the action class better to implement the preparable interface where you have to write prepare() method and initialize the list. The exception is thrown because the list attribute of the s:select tag couldn't be null. You should properly initialize the variable used for the tag before returning a result that has references to that variable.
type: AcceptedAnswer
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/41745435
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26520811

http://stackoverflow.com/q/26655304
has answer: http://stackoverflow.com/a/26686294
answer count: 1
tagged with: neo4j
tagged with: neo4j-spatial
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41948213
score: 0
tagged with: java
has title: Neo4j Spatial issue : findWithinDistance: ava.lang.IllegalArgumentException: Index with the same name but different config exists
has body: We need to locate a set of objects thanks to the geolocation in a defined radius distance. We try to use Neo4 J spacial library using SpatialRepository class to implement the method “findWithinDistance” Bellow the used code for the implemntation with the the index type POINT to store longitude and latitude of the object : @NodeEntity @TypeAlias(value="MyObject") public class MyObject{ @GraphId Long nodeId; private String label; private String description; private Double lat; private Double lon; @Indexed(indexType = IndexType.POINT, indexName = "locations") String wkt; public void setLocation(float longitude, float latitude) { this.wkt = String.format("POINT( %.2f %.2f )",longitude,longitude); } 1 ) For the first run we don’t have any problem to create the objects in neo4j database ( we can see the objects with the correct data in neo4j) For the second run or the creation of a new Object we have saying : index with the same name but different config exists! java.lang.IllegalArgumentException: Index with the same name but different config exists! org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectRepositoryImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.neo4j.support.Neo4jTemplate fr.spart.is.neo4j.repository.ObjectRepositoryImpl.template; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jTemplate' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.neo4j.support.Neo4jTemplate org.springframework.data.neo4j.config.Neo4jConfiguration.neo4jTemplate() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCrea…
type: Question
tagged with: indexing

http://stackoverflow.com/comment/41721313
type: QuestionComment
comment on: http://stackoverflow.com/q/26548969
has text: @Panther : in the code I have written in comments as '//71' see that .
score: 0
type: Comment

http://stackoverflow.com/a/74775810
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/139434995
answers question: http://stackoverflow.com/q/26591521
has body: I had similar issue and it is resolved when I replace CascadeType.All with {CascadeType.persist, CascadeType.remove}. Let me know if it works.

http://stackoverflow.com/comment/41863077
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26626756
has text: When your say "drawString doens't seem to work", do you mean it gives an error like: expected String-argument but found char? Or you mean the `drawString-method` just doesn't draw even if you put in a String-char? If it's the first case, use: `g.drawString(String.valueOf(yourChar));` instead. If it's the second case, I don't know. PS: Ik zou Engelse en Nederlandse viarbelen niet door elkaar mixen (aangezien ik `woord` en `gok` zie, i.p.v. `word` en `guess`. ;)

http://stackoverflow.com/comment/41870941
type: Comment
type: QuestionComment
has text: ListFragment from support library ...
comment on: http://stackoverflow.com/q/26630871
score: 0

http://stackoverflow.com/q/26661572
has title: How can I run a gradle based Libgdx eclipse project in AIDE on Android?
tagged with: aide-ide
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27313494
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27313494
type: Question
has comment: http://stackoverflow.com/comment/41961797
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41926068
has body: Before Gradle was used with libgdx I could just open my Eclipse project in AIDE and everything worked fine. As of libgdx version 1.0 I now use Gradle in Eclipse but I don't know how to get this to work with AIDE. It's not finding the jar libraries because I get compile errors about unknown libgdx classes. Do I have to add a local Maven repository or is there another way? Thanx!
answer count: 1
has comment: http://stackoverflow.com/comment/41964286
downvote count: 0
linked to: http://stackoverflow.com/q/28124267
favorite count: 0
tagged with: android

http://stackoverflow.com/q/26526793
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41798432
has comment: http://stackoverflow.com/comment/41681109
answer count: 0
has title: maven release component: trunk and tag on different repositories
has comment: http://stackoverflow.com/comment/41680827
type: UnansweredQuestion
has body: Just a little question.. Assuming that we have the trunk of our component on a SVN repo (http://svn1.svn1:9883/svn/test/trunk/component) And I want to release (with maven release plugin) this component, but i want the tag in a different SVN repo in a different environment, like (http://svn2.svn2:8888/svn/test/tags/component) Is it possible using the maven release plugin??? Thank you very much.
tagged with: maven
has comment: http://stackoverflow.com/comment/41697526
tagged with: svn
tagged with: java

http://stackoverflow.com/comment/41868303
comment on: http://stackoverflow.com/q/26629851
has text: When you click on button try to check you database whether that record is already stored by simply using `select`. If `ResultSet` contains records then use `update` query otherwise `insert` record into database.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/26658861
has body: I am working on my first Calculator project on GUI, I get the input and concate it in a String field by using Action Listner. calculation = calculation + " 4 "; calculation = calculation + " * "; calculation = calculation + " 9 "; Taking the first number and the second number by using substring, converting them and putting them in two fields num1 = Integer.parseInt(calculation.substring(0, 1)); num2 = Integer.parseInt(calculation.substring(4, 5)); The problem is that I cannot use substring more than x digits before the operator and y digits after the operator. Can I do that by using subString built-in method? and If I can't, How can I do that by using any other methods?
has title: Is it possible to cut a string before and after operators?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26659098
accepted answer: http://stackoverflow.com/a/26659098
type: Question
linked to: http://stackoverflow.com/q/3422673
has comment: http://stackoverflow.com/comment/41920156
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41920162

forms
tags question: http://stackoverflow.com/q/26605746
tags question: http://stackoverflow.com/q/26525136
type: Tag
tags question: http://stackoverflow.com/q/26574284
tags question: http://stackoverflow.com/q/26639408
tags question: http://stackoverflow.com/q/26614832
tags question: http://stackoverflow.com/q/26609189
tags question: http://stackoverflow.com/q/26604179
tags question: http://stackoverflow.com/q/26538976
tag name: forms
tags question: http://stackoverflow.com/q/26552015

http://stackoverflow.com/a/26662972
has comment: http://stackoverflow.com/comment/98364778
score: 7
has comment: http://stackoverflow.com/comment/132756279
downvote count: 0
answers question: http://stackoverflow.com/q/26645317
has body: Right-click on the root of your project explorer and choose Open Module Settings (it's near the bottom of the menu on my machine). Choose Project on the resulting window and look at your sdk and language level. Choose 1.8 for the project sdk, and 8.0 for the language level.
type: Answer
upvote count: 7

http://stackoverflow.com/q/26629679
answer count: 0
tagged with: abstracttablemodel
tagged with: java
has body: I have a problem with trying to populate a jtable. I have searched all over and cannot seem to find a solution to my code, I would appreciate any kind of help. Here is the method I have to get the information: public class MovieDAO extends Dao implements MovieDAOInterface{ @Override public List&lt;Movie&gt; getAllMovies() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; List&lt;Movie&gt; movies = new ArrayList&lt;&gt;(); try { con = getConnection(); String query = "Select * from Movie"; ps = con.prepareStatement(query); rs = ps.executeQuery(); while (rs.next()) { Movie AllMovies = new Movie(rs.getInt("MovieId"), rs.getString("MovieTitle"), rs.getString("MovieGenre"), rs.getInt("MovieLicence")); movies.add(AllMovies); } } catch (SQLException e) { System.out.println("Exception occured in the getAllMovies() method"); e.getMessage(); } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } if (con != null) { freeConnection(con); } } catch (SQLException e) { System.out.println("Exception occured in the finally section of the getAllMovies() method"); e.getMessage(); } } return movies; } } Here is where I am calling it and having the issue it wont display on the table; private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("Test Find All Movies"); MovieDAO dao = new MovieDAO(); List&lt;Movie&gt; movies = dao.getAllMovies(); if (movies.isEmpty()) { System.out.println("List is empty"); } else { for (Movie m : movies) { DisplayMovies.setModel(m.toString()); } } }
has title: SQL populate Table from Database
type: Question
has comment: http://stackoverflow.com/comment/41868113
has comment: http://stackoverflow.com/comment/41868872
tagged with: jtable
score: 0
tagged with: user-interface
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41867932
tagged with: swing

http://stackoverflow.com/q/26610228
score: 1
tagged with: java
tagged with: stream
type: Question
has answer: http://stackoverflow.com/a/26610583
has answer: http://stackoverflow.com/a/26623013
tagged with: file-processing
has title: For Loop Replacement: For Loops to Filters
possible better answer: http://stackoverflow.com/a/26610565
tagged with: filter
tagged with: for-loop
upvote count: 1
favorite count: 0
has body: I'm working on an assignment for a Computer Science III class (Java programming), and in it we have to encode a file based on Huffman coding. import java.util.Scanner; import java.util.ArrayList; import java.io.*; import java.util.Collections; import java.util.StringTokenizer; public class Client { public static void main(String[] args) throws IOException { // TODO code application logic here Scanner in = new Scanner(System.in); System.out.println("Enter a filename to read from."); String filename = in.nextLine(); File file = new File(filename); Scanner inputFile = new Scanner(file); String line, word; StringTokenizer token; ArrayList&lt;Character&gt; chars = new ArrayList&lt;&gt;(); while(inputFile.hasNext()){ line = inputFile.nextLine(); ArrayList&lt;Character&gt; lineChar = new ArrayList&lt;&gt;(); for (int i=0; i&lt;line.length(); i++){ if (line.charAt(i)!=' '){ lineChar.add(line.charAt(i)); } } chars.addAll(lineChar); } ArrayList&lt;Character&gt; prob = new ArrayList&lt;Character&gt;(); for (int i=0; i&lt;chars.size(); i++){ if (!prob.contains(chars.get(i))){ prob.add(chars.get(i)); } } for (int i=0; i&lt;prob.size(); i++){ System.out.print("Frequency of " + prob.get(i)); System.out.println(": " + ((double)Collections.frequency(chars, prob.get(i)))/chars.size()); } I was working on it in my NetBeans IDE and followed some suggestions. It changed the last two for loops to: chars.stream().filter((char1) -&gt; (!prob.contains(char1))).forEach((char1) -&gt; { prob.add(char1); }); prob.stream().map((prob1) -&gt; { System.out.print("Frequency of " + prob1); return prob1; }).forEach((prob1) -&gt; { System.out.println(": " + ((double) Collections.frequency(chars, prob1)) / chars.size()); }); I am really, really, really intrigued by this, but I find it difficult to trace everything. It obviously operates in the same way as my for loops and after testing I see that it -does- work, but I want to understand why and how. Can anybody give me any insight?
has answer: http://stackoverflow.com/a/26610565
has answer: http://stackoverflow.com/a/26610593
has comment: http://stackoverflow.com/comment/41832691
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26623013
downvote count: 0

http://stackoverflow.com/q/26552679
tagged with: optimization
score: 0
has comment: http://stackoverflow.com/comment/41727768
tagged with: multidimensional-array
type: UnansweredQuestion
has title: Sparse multidimensional array replacement in Java
answer count: 0
tagged with: java
has body: I have a java project in which I'm currently using huge multidimensional arrays of floats (usually 8-12 dimensions with each dimension varying in size from 2-50) to store data that is generated by the program. The program both reads from and writes to the arrays millions of times, so I need a data structure that has extremely fast access times (like the O(1) time for arrays). But the arrays are somewhat sparse and I'm running into RAM constraints, so I'm wondering if there are any other data structure options that would be better for storing sparse data but would not slow down the access/write times much.
has comment: http://stackoverflow.com/comment/41728605
type: Question
tagged with: data-structures
tagged with: sparse-matrix

jdbctemplate
tags question: http://stackoverflow.com/q/26623857
type: Tag
tags question: http://stackoverflow.com/q/26568750
tag name: jdbctemplate

http://stackoverflow.com/q/26551899
has answer: http://stackoverflow.com/a/26551973
tagged with: draw
score: 0
answer count: 2
has title: Android draw out of a class on an activity
has answer: http://stackoverflow.com/a/26551950
tagged with: android-activity
type: UnansweredQuestion
tagged with: android
tagged with: drawing
tagged with: java
type: Question
has body: Good Morning, I just started my first android project (but have knowledge in Java, VB, etc). I'm searching all day long bt untl know I was unable to find an answer to my problem, I find a lot of ways to draw on an empty screen ... But I searching a methode to draw multiple diagramms and so on directly on my MainActivity next to my buttons and other controls. In Java I would have used different drawPanels to get the job down but due to missing swing library I can't proceed that way. Are their good tutorials out there on that topic or do you have an advice? I'm glad for every tipp. Dwon there / you will find an example of my current try, but as said it will just draw the "BAttery" and not the activity components: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DrawBattery draw = new DrawBattery(this, 96); setContentView(draw); } - public class DrawBattery extends View { private int batteryCharge = 0; //battery charge in % public DrawBattery(Context pContext, int pBatteryCharge) { super(pContext); batteryCharge = pBatteryCharge; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); ...

http://stackoverflow.com/comment/41996409
comment on: http://stackoverflow.com/a/26670544
type: AnswerComment
score: 0
type: Comment
has text: Why are you even using the `SessionFactory` in your controller looks like that code is still there... As I stated delete the util class.

http://stackoverflow.com/comment/41734200
type: AnswerComment
has text: Thanks for your suggestion. Removing cascade in the OneToOne annotation, made the code executable. But I landed up in another exception related to validation.. still scratching my head how that can be resolved..
type: Comment
comment on: http://stackoverflow.com/a/26541789
score: 0

http://stackoverflow.com/comment/41670711
type: QuestionComment
has text: you are doing the bulk of the network call on the Main Thread (parsing the input stream), this should be done in doInBackground
score: 1
comment on: http://stackoverflow.com/q/26520776
type: Comment

http://stackoverflow.com/comment/41832341
type: Comment
has text: Sorry, but there is problem in the method in main program not in class. I checked it more time and found no problem in class code. I appreciate for the optimized code.
score: 1
comment on: http://stackoverflow.com/a/26609948
type: AnswerComment

http://stackoverflow.com/comment/41729740
comment on: http://stackoverflow.com/a/26553904
has text: I tend to agree with you.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/53294473
type: QuestionComment
comment on: http://stackoverflow.com/q/26671057
score: 1
type: Comment
has text: Maybe you should spend a little more time on making the question, because this is not very informative

akka
type: Tag
tags question: http://stackoverflow.com/q/26585044
tags question: http://stackoverflow.com/q/26670318
tags question: http://stackoverflow.com/q/26546846
tag name: akka
tags question: http://stackoverflow.com/q/26547078
tags question: http://stackoverflow.com/q/26576386
tags question: http://stackoverflow.com/q/26591683
tags question: http://stackoverflow.com/q/26529097
tags question: http://stackoverflow.com/q/26517332
tags question: http://stackoverflow.com/q/26583659

http://stackoverflow.com/a/26521117
has comment: http://stackoverflow.com/comment/41671277
upvote count: 0
has comment: http://stackoverflow.com/comment/41671543
has comment: http://stackoverflow.com/comment/41692591
has comment: http://stackoverflow.com/comment/41671431
score: -2
has comment: http://stackoverflow.com/comment/41671838
has comment: http://stackoverflow.com/comment/41671724
has comment: http://stackoverflow.com/comment/41671440
has body: You are struck because your program has no exit condition.Look it goes into the loop maxProfit(1), but has no option of exiting from the loop. Update: Once your program gets into this loop there is no way for it to come out.. public void maxProfit(int i) { if (i == n - 1) { if (low != -1 &amp;&amp; a[i - 1] &lt;= a[i]) profit += a[i] - low; System.out.println("i"); return; } if (a[i - 1] &lt; a[i] &amp;&amp; low == -1) { low = a[i - 1]; System.out.println("i"); } if (a[i - 1] &gt; a[i] &amp;&amp; low != -1) { profit += a[i - 1] - low; low = -1; System.out.println("i"); } //System.out.print(i+","); maxProfit(i + 1); }
has comment: http://stackoverflow.com/comment/41671512
downvote count: 2
answers question: http://stackoverflow.com/q/26521044
has comment: http://stackoverflow.com/comment/41692040
has comment: http://stackoverflow.com/comment/41671390
has comment: http://stackoverflow.com/comment/41692629
has comment: http://stackoverflow.com/comment/41671876
has comment: http://stackoverflow.com/comment/41671279
type: Answer

http://stackoverflow.com/comment/41711295
comment on: http://stackoverflow.com/a/26543799
type: Comment
has text: can you please format your post in order to be more readable?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26622422
upvote count: 3
tagged with: java
downvote count: 3
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/41855198
has comment: http://stackoverflow.com/comment/41855165
has comment: http://stackoverflow.com/comment/41855213
has title: What is the maximum length of an array in Go, Java and C#?
tagged with: go
score: 0
has answer: http://stackoverflow.com/a/26622613
answer count: 1
has comment: http://stackoverflow.com/comment/41855199
favorite count: 0
has comment: http://stackoverflow.com/comment/41855244
accepted answer: http://stackoverflow.com/a/26622613
linked to: http://stackoverflow.com/q/3038392
has comment: http://stackoverflow.com/comment/41855222
type: AnsweredQuestion
has body: What is the maximum length of an array that I can declare in Go, Java and C#? Does it relate to the maximum memory at runtime? Or do they have a standard?

http://stackoverflow.com/a/26583434
downvote count: 0
score: 1
has body: Try either of these two options.hope it will helps you 1.remove call back for handler handel.postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub Intent loadSplash = new Intent(Splash.this, MyActivity.class); startActivity(loadSplash); finish(); handel.removeCallbacks(this); } }, 3000); Use thread instead of handler public class Splash extends Activity { protected boolean _active = true; protected int _splashTime = 3000; Thread splashTread; private boolean stop = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splashscreen); splashTread = new Thread() { @Override public void run() { try { int waited = 0; while (_active &amp;&amp; (waited &lt; _splashTime)) { sleep(100); if (_active) { waited += 100; } } } catch (InterruptedException e) { // do nothing } finally { if (!stop) { startActivity(new Intent(Splash.this, MyActivity.class)); finish(); } else finish(); } } }; splashTread.start(); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/41807531
type: Answer
answers question: http://stackoverflow.com/q/26582457
has comment: http://stackoverflow.com/comment/63332764

http://stackoverflow.com/q/26570338
tagged with: java
type: UnansweredQuestion
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41759768
has title: wait for child threads to finish, without having a reference to the thread
has comment: http://stackoverflow.com/comment/41759267
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26570375
type: Question
has comment: http://stackoverflow.com/comment/41759309
has comment: http://stackoverflow.com/comment/41759284
score: 1
tagged with: monitors
tagged with: multithreading
has body: I am working on building an API for an application that already exists, which sometimes uses threads. So one on my methods is like this private SSG theSSG; ... private void doSomething(){ theSSG.loadMenu(); //my code } Now, the loadMenu method could give birth to a thread, but not necessarily. If it does, doSomething will execute the rest of the code, while the new thread is executing other code. What I need is a way to wait for the loadMenu() to finish executing all of its children threads before perceeding to the next line of code. I do not have a reference of the thread that could possibly run, since that is based on the user's choice, so I can't use join(). I also can't edit the application (or what happens in loadMenu).
upvote count: 1
answer count: 1
tagged with: semaphore

http://stackoverflow.com/comment/41781679
type: Comment
has text: Nice answer, but i have a question; Should `dbName` be validated here manually?
comment on: http://stackoverflow.com/a/26582770
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41837128
score: 0
comment on: http://stackoverflow.com/q/26612611
has text: My guess is that @Robin has nailed the problem, but since your descriptions, "it changes every shape" and "the whole vector is changed" are quite vague, I can't tell just what the problem is.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26610001
tagged with: sorting
has answer: http://stackoverflow.com/a/26616592
tagged with: jakarta-mail
answer count: 1
tagged with: james
has body: I have implement pagination in javamail using getMessages(start ,end) method .But this method doesn't take sort term as parameters as getSortedMessages(SortTerm term) method take , also getSortedMessages method doesn't take range numbers as parameters . So how I can implement pagination and sorting both together . I don't want to get all messages and then sort them , this will lead to bad performance in my application. Any help please ...
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has title: Pagination and Sorting with javamail
tagged with: pagination

http://stackoverflow.com/q/26556989
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26578002
tagged with: java
tagged with: hibernate
type: Question
has body: I have an issue with Hibernate: I have a basic DAO that saves an entity the following way: @Override public void save(BaseEntity entity) { Session session = this.sessionFactory.openSession(); Transaction trans = session.beginTransaction(); session.persist(entity); trans.commit(); session.close(); } I've registered a basic event listener for persisting the entity: @Component public class OwlPreSaveListener implements PersistEventListener { @Override public void onPersist(PersistEvent persistEvent) throws HibernateException { Object o = persistEvent.getObject(); if (o instanceof BaseEntity) { BaseEntity entity = (BaseEntity)o; if (entity.getCreated() == null) { entity.setCreated(new Date()); } entity.setUpdated(new Date()); } } } When I try to persist an entity I do NOT set a create date though it is mandatory because I assume that the listener will properly set it before persist. When running in debug mode the EventListener is triggered as expected. And when examining the entity the values are properly set. There are actually logs indicating that the right values are associated with my entity: 23:49:40.545 [main] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 1 insertions, 1 updates, 0 deletions to 1 objects 23:49:40.545 [main] DEBUG o.h.e.i.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections 23:49:40.546 [main] DEBUG o.h.internal.util.EntityPrinter - Listing entities: 23:49:40.546 [main] DEBUG o.h.internal.util.EntityPrinter - com.owl.core.model.User{id=89672b6e-4f8e-4bfc-b24c-3cb3f853cad9, email=v9i0t0sg@dgs88uab.6p8, updated=Fri Oct 24 23:49:40 CEST 2014, created=Fri Oct 24 23:49:40 CEST 2014, name=9v9nduqfpsmn0 fjpufh2c713q2, deleted=null} Note that the 'CREATED' date is NOT empty. Regardless I get the following message time and time again: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'created' cannot be null Spring : 4.1.1.RELEASE Hibernate: 4.3.5.Final I've tri…
has title: Java & Hibernate - PersistEventListener does not set value properly
score: 0
tagged with: jpa

http://stackoverflow.com/comment/41942625
type: QuestionComment
comment on: http://stackoverflow.com/q/26670318
has text: I looks like it can serve them, because you're using `Future`, but that may be redundant work if, for example, you get the same request in a very short period of time. You need a way to tell the subsequent requests that you already have a response in the making. So, yeah, you may need a `Map` from request to future, and when a new request comes, check with the `Map` and if it has a `Future` for that request make it so that you send the `Future` response to this client, too.
score: 0
type: Comment

http://stackoverflow.com/q/26564360
favorite count: 0
accepted answer: http://stackoverflow.com/a/26640960
tagged with: google-app-engine
has body: I'm using Hibernate in combination with GAE and Cloud SQL. Everything works fine, but when an instance is waken up, sometimes it takes a long time to connect to the database (up to 15s) In the log I see that the most time it is Hibernate establishing a connection: I 17:46:35.936 org.hibernate.cfg.Configuration doConfigure: HHH000041: Configured SessionFactory: null W 17:46:36.209 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000402: Using Hibernate built-in connection pool (not for production use!) I 17:46:36.243 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000115: Hibernate connection pool size: 0 I 17:46:36.244 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000006: Autocommit mode: false I 17:46:36.244 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000401: using driver [com.mysql.jdbc.GoogleDriver] at URL [jdbc:google:mysql://database?user=someUser] I 17:46:36.245 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000046: Connection properties: {} I 17:46:45.356 org.hibernate.dialect.Dialect &lt;init&gt;: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect Here is the code producing this: properties.put("hibernate.connection.driver_class", "com.mysql.jdbc.GoogleDriver"); properties.put("hibernate.connection.url", "jdbc:google:mysql://" + SQL_INSTANCE + "/" + DATABASE + "?user=someUser"); // disable schema check properties.put("hibernate.hbm2ddl.auto", ""); // disable properties.put("hibernate.show_sql", false); // single session per request/thread properties.put("hibernate.connection.pool_size", 0); properties.put("hibernate.current_session_context_class", "thread"); Configuration cfg = new Configuration(); cfg.configure("/META-INF/hibernate.cfg.xml"); cfg.addProperties(properties); sessionFactory =…
type: AnsweredQuestion
score: 4
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate connection pool provider for Cloud SQL
has answer: http://stackoverflow.com/a/26640960
tagged with: google-cloud-sql
has answer: http://stackoverflow.com/a/26641107
upvote count: 4
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26641107

http://stackoverflow.com/q/26520564
tagged with: background
has comment: http://stackoverflow.com/comment/41670306
type: Question
tagged with: user-interface
has title: JAVA Set a background on JFrame
has comment: http://stackoverflow.com/comment/41670327
has comment: http://stackoverflow.com/comment/41670394
score: 0
has comment: http://stackoverflow.com/comment/41690504
linked to: http://stackoverflow.com/q/16391680
linked to: http://stackoverflow.com/q/13944795
has comment: http://stackoverflow.com/comment/41670362
answer count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41670451
duplicate of: http://stackoverflow.com/q/16391680
has body: I've been getting the hang of GUI's in java pretty well, but I had not realized that setting a background would be so difficult/complicated. Any ideas on how to set an image as the background to my existing GUI? The image would be exactly the same height/width of my jframe. public class cipher extends JFrame implements ActionListener { private int wHEIGHT = 600; private int wWIDTH = 900; private JTextField userString; private String userWords = ""; private JButton encryptButton; private JButton importPic; private JButton importText; public cipher(){ // JFrame management setSize(wWIDTH, wHEIGHT); setTitle("Camo Cypher"); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); // GridBag management GridBagConstraints c = new GridBagConstraints(); GridBagLayout myLayout = new GridBagLayout(); setLayout(myLayout); // User input bar userString = new JTextField(50); userString.setPreferredSize(new Dimension(700,27)); userString.setVisible(true); c.weightx = 0.5; c.gridx = 1; c.gridy = 1; add(userString,c ); // Blank space JButton blank = new JButton(""); blank.setPreferredSize(new Dimension(0, 10)); c.weightx = 0.5; c.gridx = 1; c.gridy = 2; add(blank, c); // Encypt button encryptButton = new JButton("Encrypt"); encryptButton.addActionListener(this); encryptButton.setPreferredSize(new Dimension(150, 35)); encryptButton.setForeground(Color.BLUE); c.weightx = 0.5; c.gridx = 1; c.gridy = 3; add(encryptButton, c); // Import buttons panel Panel buttonPanel = new Panel(); importText = new JButton("Import Text File"); importText.addActionListener(this); importPic = new JButton("Import Image"); importPic.addActionListener(this); importText.setPreferredSize(new Dimension(200, 60)); importPic.setPreferredSize(new Dimension(200, 60)); buttonPanel.add(importText); buttonPanel.add(importPic); c.weightx = 100; c.gridx = 1; c.gridy = 4; add(buttonPanel, c); }
has comment: http://stackoverflow.com/comment/41670267
tagged with: swing
has comment: http://stackoverflow.com/comment/41694401
has comment: http://stackoverflow.com/comment/41670334
has comment: http://stackoverflow.com/comment/41670326
tagged with: java

http://stackoverflow.com/comment/41740993
type: AnswerComment
comment on: http://stackoverflow.com/a/26560154
has text: Thank you for everything. I am trying out the solution and will update.
type: Comment
score: 0

http://stackoverflow.com/comment/41789838
type: AnswerComment
type: Comment
has text: I request you that provide me some link to learn to use the material you referenced above. I am a new bee in programming so kindly help me to study to use the above alternate for "javax".
score: 0
comment on: http://stackoverflow.com/a/26585840

http://stackoverflow.com/q/26513892
has comment: http://stackoverflow.com/comment/41657633
answer count: 2
has body: Before you say that this question was asked. I want to say that I have read through most of the questions and they give just workarounds for this solution and other ones are out of date. My question is, how create Android library in Android Studio, so I can export it to closed .jar with no sources and distribute it to other developers. When I click New Module -> Android Library, it creates me folder under my current project. I don't want that. I want to create library from the beggining (where is option for this in Android Studio?), so it is standalone project which later I can export to jar.
downvote count: 0
has comment: http://stackoverflow.com/comment/41659012
favorite count: 0
tagged with: android-studio
has answer: http://stackoverflow.com/a/26516007
has title: Creating my own Android library and exporting it to .jar
tagged with: android
has comment: http://stackoverflow.com/comment/41659938
upvote count: 1
possible better answer: http://stackoverflow.com/a/26514397
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26514397
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26516007
has comment: http://stackoverflow.com/comment/41657734
type: Question

http://stackoverflow.com/comment/42005816
comment on: http://stackoverflow.com/a/26644125
has text: *export MAVEN_OPTS=-Xms256m-Xmx512m* have to be changed to *export MAVEN_OPTS="-Xms256m -Xmx512m"*
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41664996
comment on: http://stackoverflow.com/q/26513888
type: QuestionComment
has text: The "mail.transport.protocol" setting is having no effect, you can remove it. You can further simplify your code by removing the Authenticator as described [here](http://www.oracle.com/technetwork/java/javamail/faq/index.html#commonmistakes).
score: 0
type: Comment

http://stackoverflow.com/q/26627328
type: UnansweredQuestion
tagged with: java
tagged with: spannablestring
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26627709
linked to: http://stackoverflow.com/q/16335178
has title: How to keep two different font sizes for two strings in one single text view
has comment: http://stackoverflow.com/comment/41864719
score: 0
has comment: http://stackoverflow.com/comment/41864353
tagged with: android
has answer: http://stackoverflow.com/a/34154206
has body: I have a custom class as follows: public class CustomTypefaceSpan extends TypefaceSpan { private final Typeface newType; public CustomTypefaceSpan(String family, Typeface type) { super(family); newType = type; } @Override public void updateDrawState(TextPaint ds) { applyCustomTypeFace(ds, newType); } @Override public void updateMeasureState(TextPaint paint) { applyCustomTypeFace(paint, newType); } private static void applyCustomTypeFace(Paint paint, Typeface tf) { int oldStyle; Typeface old = paint.getTypeface(); if (old == null) { oldStyle = 0; } else { oldStyle = old.getStyle(); } int fake = oldStyle &amp; ~tf.getStyle(); if ((fake &amp; Typeface.BOLD) != 0) { paint.setFakeBoldText(true); } if ((fake &amp; Typeface.ITALIC) != 0) { paint.setTextSkewX(-0.25f); } paint.setTypeface(tf); } } I apply the span as follows: Spannable spannable = new SpannableString(dispStatsPart1()+"\n"+dispStatswords()+"Months"); spannable.setSpan( new CustomTypefaceSpan("sans-serif",Helv_cond_bold), 0, dispStatsPart1().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan( new CustomTypefaceSpan("sans-serif",helv_light), dispStatsPart1().length(), dispStatsPart1().length() +(dispStatswords()+"Months").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); holder.numberText.setText(spannable); I want a different font size for the first line and a different font size for the second line, How to achieve that? So far I have tried modifying my code to: private static void applyCustomTypeFace(Paint paint, Typeface tf) { int oldStyle; Typeface old = paint.getTypeface(); if (old == null) { oldStyle = 0; } else { oldStyle = old.getStyle(); } int fake = oldStyle &amp; ~tf.getStyle(); if ((fake &amp; Typeface.BOLD) != 0) { paint.setFakeBoldText(true); } if ((fake &amp; Typeface.ITALIC) != 0) { paint.setTextSkewX(-0.25f); } if(flag == 0){ paint.setTextSize(50); }else{ paint.setTextSize(50); } paint.setTypeface(tf); } I pass the flags to the constructor: public CustomTypefaceSpan(String family, Ty…

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26534362
tags question: http://stackoverflow.com/q/26597411
tags question: http://stackoverflow.com/q/26570019
tags question: http://stackoverflow.com/q/26580147
type: Tag
tags question: http://stackoverflow.com/q/26636376
tags question: http://stackoverflow.com/q/26637856
tags question: http://stackoverflow.com/q/26585064
tags question: http://stackoverflow.com/q/26565024

http://stackoverflow.com/comment/41661942
score: 2
has text: @Dan S: Yes i do make a launcher and want to have the best quality so that it looks as good as possible. I also do scaling to bigger sizes.....hope that makes it clear enough ;)
comment on: http://stackoverflow.com/q/26515687
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41810826
has text: any chance i can ask you about another part, im getting some errors on a bit of code that i had to input... its not my own design
comment on: http://stackoverflow.com/a/26597936
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26661454
downvote count: 0
has comment: http://stackoverflow.com/comment/41925039
has title: Is this singleton pattern thread safe?
has answer: http://stackoverflow.com/a/26661608
favorite count: 0
has answer: http://stackoverflow.com/a/26661631
linked to: http://stackoverflow.com/q/6109896
accepted answer: http://stackoverflow.com/a/26661549
tagged with: singleton
linked to: http://stackoverflow.com/q/5307003
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41925304
has comment: http://stackoverflow.com/comment/41925136
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41924993
has answer: http://stackoverflow.com/a/26661549
tagged with: thread-safety
has body: I have a singleton server instance and I'm curious whether my code is thread safe. I've read about different singleton patterns, and I think the way to go generally is the double-checked locking pattern, which goes as follows: public static Singleton getInstance() { if(singleton == null) { synchronized(Singleton.class) { if(singleton == null) { singleton = new Singleton(); } } } return singleton; } This is supposedly an efficient thread-safe way of setting/getting a singleton. The easiest way to get and set a singleton, I've read, is lazy instantiation, which looks like this: public static ClassicSingleton getInstance() { if(instance == null) { instance = new ClassicSingleton(); } return instance; } Now what I want to know is if my variation is thread-safe. My code: public static void startServer(int listeningPortNumber) throws IOException { if (server != null) { throw new IOException("Connection exists"); } server = new Server(listeningPortNumber); } My code is very similar to the lazy instantiation pattern above, but I can't see how my code isn't thread-safe. Is there something I'm not seeing or is this actually valid code? Reference: http://www.javaworld.com/article/2073352/core-java/simply-singleton.html
possible better answer: http://stackoverflow.com/a/26661488
score: 4
has answer: http://stackoverflow.com/a/26661488
has comment: http://stackoverflow.com/comment/41925066
has comment: http://stackoverflow.com/comment/41925090
upvote count: 4
has comment: http://stackoverflow.com/comment/41925015

http://stackoverflow.com/comment/73350605
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26574409
has text: @Neil Stockton When I am adding the annotation **@GeneratedValue** my IDE is throwing an error then and there. I have used **jpa** dependency in my 'pom.xml' file, but even that is not working as what I got is that it searches for a MySQL DB and I am using NoSQL (mongoDB). So if you can help me with something please do. Thanks in advance..
score: 0

http://stackoverflow.com/comment/84974937
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26719666
has text: Yes. I want a way to get the config folder outside the jar without manually copyng or pasting. How did you handle it?
score: 0

http://stackoverflow.com/comment/41792196
type: Comment
comment on: http://stackoverflow.com/q/26588570
type: QuestionComment
has text: I used pastie for ease to the reader because I thought including everything in the question may seem cumbersome and readers would not feel like looking at it.
score: 0

http://stackoverflow.com/a/26643317
answers question: http://stackoverflow.com/q/26643189
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: Using strings split function, you can split the string up by spaces like so: string[] lottoArray = lotto.split(" "); Then, you can loop through the array and put the values into a int array: int[] numbersArray = new int[lottoArray.length]; for (int i = 0; i &lt; lottoArray.length; i++) numbersArray[i] = Integer.parseInt(lottoArray[i]);

http://stackoverflow.com/comment/41847361
type: Comment
type: QuestionComment
has text: You should really fix the spelling of `SchedulledQueue`. Typos in identifiers make life difficult for your colleagues, anyone who's trying to grep through source, etc.
score: 0
comment on: http://stackoverflow.com/q/26611402

http://stackoverflow.com/comment/41937546
comment on: http://stackoverflow.com/q/26667249
type: QuestionComment
type: Comment
score: 0
has text: You would initialize it once. It wouldn't matter after that. So long as the server is running, they should be able to connect to it and use it...If you needed to, you could create new databases like normal...

http://stackoverflow.com/comment/41923688
has text: "but when I test for hiddensingles method, the test said there are something wrong in my hiddensingles method." can you tell us what it says a stack trace perhaps ... Have you tried debugging your code ?
comment on: http://stackoverflow.com/q/26660846
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26555591
score: 0
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41733330
has body: When running my java application from a network folder, I ran into an IllegalArgumentException that states: URI has an authority component. I debugged and discovered the problem was that I was creating a new File by passing in a URI with an authority component. Previously, I had never encountered this problem because I had always run the application locally and there was no authority component. URI uri = new URI("...network path...//myFile"); This throws an error: File file = new File(uri); This works: File file = new File(uri.toString()); I see that inside the File(Uri) constructor it won't allow a URI with an authority component. Can any one explain why? and why I am allowed to create a file for a String? Thanks!
has comment: http://stackoverflow.com/comment/41733129
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41732947
has title: Create new File(URI) with authority component
type: Question
has answer: http://stackoverflow.com/a/36225670
has comment: http://stackoverflow.com/comment/41736466

http://stackoverflow.com/q/26648103
linked to: http://stackoverflow.com/q/5328518
has comment: http://stackoverflow.com/comment/41901053
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41901107
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41901196
has comment: http://stackoverflow.com/comment/41900922
score: 0
has comment: http://stackoverflow.com/comment/41900876
answer count: 1
type: UnansweredQuestion
has body: I have an application that can be browsed into when i go to http://localhost:8080/application name/app/index.html#/home I would like to be able to browse it when i just hit the server name e.g http://localhost:8080 How can it be done ?
has comment: http://stackoverflow.com/comment/41901060
has answer: http://stackoverflow.com/a/26648647
has title: Short url for java web application

http://stackoverflow.com/q/26669742
has answer: http://stackoverflow.com/a/26669779
type: Question
has comment: http://stackoverflow.com/comment/41940159
answer count: 2
has answer: http://stackoverflow.com/a/26670165
type: UnansweredQuestion
has body: after retrive result of : JSONObject data_array = new JSONObject ( received ); i get any null for this strings: String c = data_array.getString ( "count_mobile" ); String o = data_array.getString ( "ok" ); String f =data_array.getString ( "faild" ); o and f values are null and i can not check it for this codes ( all of incorrect return and set null result to variables ) if( data_array.getString ( "ok" ) != null ) o = data_array.getString ( "ok" ); if( data_array.getString ( "ok" ) != "" ) o = data_array.getString ( "ok" ); if( ! TextUtils.isEmpty(data_array.getString ( "ok" ) ) ) o = data_array.getString ( "ok" );
has title: Java check null faile for result of JSONObject
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/41907893
comment on: http://stackoverflow.com/q/26652079
has text: Thank you so much, that stopped the program from crashing. Would you have any idea why my calculation is not working though?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26545186
has comment: http://stackoverflow.com/comment/41714273
has title: Apache tomcat server static files based on header
score: 0
tagged with: apache
tagged with: macos
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41733025
tagged with: static
has comment: http://stackoverflow.com/comment/41731264
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41731800
answer count: 0
has body: I am facing issue with tomcat server. Here is the scenario. I have client running in port 8999 and using apache tomcat to serve static contents. http://hostname1:8999/client/static And server running in another port 9001 and using another tomcat. [http://hostname1:9001/server/][2] i have configured re-routing rules in httpd.conf file to make them work together. Now, my issue is, the static content is served without any authentication. I want to stop that and make sure, the static contents will be served only when request is from server or when it contains any kind of headers. How can i achieve this? I tried adding security contraints in web.xml of tomcat. <web-resource-collection> HTTP-Protected-Resource-1 Description here /scripts/* /styles/* GET POST </web-resource-collection> NOSOUPFORYOU DEFAULT NOACCESSFORANYONE NOSOUPFORYOU It worked, but it is blocking content in all cases even when the call is from server. Can i distinguish request or check for headers in web.xml?
tagged with: java
has comment: http://stackoverflow.com/comment/41731780
has comment: http://stackoverflow.com/comment/41733135
type: Question

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/26581380
tags question: http://stackoverflow.com/q/26554478
tags question: http://stackoverflow.com/q/26561017
tags question: http://stackoverflow.com/q/26638213
tags question: http://stackoverflow.com/q/26591033
tags question: http://stackoverflow.com/q/26598804
tags question: http://stackoverflow.com/q/26641130
tags question: http://stackoverflow.com/q/26620908

http://stackoverflow.com/comment/41902248
type: Comment
comment on: http://stackoverflow.com/a/26648637
type: AnswerComment
has text: Thanks @Aleks G . So It is impossibile to have each application with its door in one TomCat Instance? I got it right? Thanks in advances.
score: 0

http://stackoverflow.com/q/26615759
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41843261
has comment: http://stackoverflow.com/comment/41843592
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26615842
type: Question
has comment: http://stackoverflow.com/comment/41842897
score: -1
tagged with: timer
has body: Can someone just show me the code id need, in the timer class, to sort of pause my program, just have the timer run for a few seconds with nothing happening. Thanks.
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41842870
has title: need to pause my program with a timer in java
tagged with: java

http://stackoverflow.com/q/26519174
has answer: http://stackoverflow.com/a/26519255
tagged with: sockets
type: UnansweredQuestion
has body: I've recently started trying to create a two-way connection between a server and a client using the java Sockets class. Everything works fine (it is a chat) when I use the client socket address as InetAddress.getLocalHost(), but when I type in my public ip address in Socket clientSocket = new Socket(my_public_ip, 80); the client socket shows that a connection is formed by testing clientSocket.isConnected() which returns true. However, in the server side, the code does not seem to advance past Socket clientSocket = server.accept(); Should I provide code or is the issue clear? EDIT: More information. Telnet from my own pc using the external ip address works, whatever the state of my firewall. The java client-side code doesn't work when the firewall is on, throwing java.net.SocketException: Software caused connection abort: recv failed When the firewall is off, using the java client-side code returns the following from the server (still no .accept() on server-side): Connected to server. Input a message Server: HTTP/1.0 503 unknown method Server: Connection: close Server: Content-Length: 119 Server: Date: Thu, 23 Oct 2014 12:40:00 GMT Server: Expires: 0 Server: Server: Server: Error 503: unknown method Server: Server: Error 503: unknown method Server: Server: After which both threads freeze.
has title: Java socket connects on client-side but is not accepted on server
has comment: http://stackoverflow.com/comment/41679074
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/a/34944712
upvote count: 33
has comment: http://stackoverflow.com/comment/97622663
has body: If the objective here is code reduction then try Project Lombok. You then don't even need to declare the logger - just add an annotation and use log instead of logger So your above code will now look like this: import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; // import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import lombok.extern.slf4j.Slf4j; @Slf4j @Controller public class MainController { @RequestMapping("/") public String enterSite(HttpServletResponse response) { log.info("site entered"); return "welcome"; } }
has comment: http://stackoverflow.com/comment/97401401
score: 31
has comment: http://stackoverflow.com/comment/93832109
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26517309
has comment: http://stackoverflow.com/comment/93870321

http://stackoverflow.com/comment/76528648
score: 16
comment on: http://stackoverflow.com/a/26523862
type: AnswerComment
type: Comment
has text: Does not answer to the question and encourages using a bad behavior in DI context.

http://stackoverflow.com/comment/41854663
comment on: http://stackoverflow.com/a/26599111
score: 0
type: AnswerComment
type: Comment
has text: Sure thing. I had to leave somewhere right after I made the comment so I hadn't gotten around to that yet. But it wouldn't quite make sense to /remove/ the comment unless both of us removed our comments :P

http://stackoverflow.com/q/26670889
has answer: http://stackoverflow.com/a/26670978
accepted answer: http://stackoverflow.com/a/26682200
has comment: http://stackoverflow.com/comment/41942436
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41944020
has comment: http://stackoverflow.com/comment/41962909
has comment: http://stackoverflow.com/comment/41942597
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has body: I have existing project in Eclipse for Android that all still run with no issues. It's been a while since I have been on Android and I created a new one from scratch. However, it crashes when testing to a phone (Samsung s3) and I can't figure out why. All the settings seem just the same as my other projects that still work. I get a Source Not Found error. Tried many suggestions on here without luck. Maybe it's a case of I haven't done enough as I have done the bare minimum. Project tree, manifest, java class and xml below: Error: Log Cat text around the time of crash: 10-31 19:28:10.536: I/ActivityManager(2361): Process com.mcsapp (pid 30623) (adj 0) has died. 10-31 19:28:10.536: W/ActivityManager(2361): mDVFSHelper.acquire() 10-31 19:28:10.546: E/ViewRootImpl(2361): sendUserActionEvent() mView == null 10-31 19:28:10.561: D/dalvikvm(30720): Late-enabling CheckJNI 10-31 19:28:10.586: V/WindowManager(2361): Window{42d28228 u0 Keyguard}mOrientationRequetedFromKeyguard=false 10-31 19:28:10.586: D/WindowManager(2361): computeScreenConfigurationLocked() set config.orientation=1 dw=720 dh=1280 Callers=com.android.server.wm.WindowManagerService.updateOrientationFromAppTokensLocked:5171 com.android.server.wm.WindowManagerService.updateOrientationFromAppTokens:5142 com.android.server.am.ActivityStack.realStartActivityLocked:1021 10-31 19:28:10.586: D/PowerManagerService(2361): setKeyboardVisibility: false 10-31 19:28:10.596: V/WindowManager(2361): Window{42d28228 u0 Keyguard}mOrientationRequetedFromKeyguard=false 10-31 19:28:10.621: D/AndroidRuntime(30720): Shutting down VM 10-31 19:28:10.621: W/dalvikvm(30720): threadid=1: thread exiting with uncaught exception (group=0x41c37700) 10-31 19:28:10.626: E/AndroidRuntime(30720): FATAL EXCEPTION: main 10-31 19:28:10.626: E/AndroidRuntime(30720): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mcsapp/com.mcsapp.McsHome}: java.lang.ClassNotFoundException: Didn't find class "com.mcsapp.McsHome" on path: /…
has comment: http://stackoverflow.com/comment/41962703
type: Question
has answer: http://stackoverflow.com/a/26682200
has title: Created a new Android project and it crashes when running on a phone
tagged with: android
has comment: http://stackoverflow.com/comment/41964631
score: -2
has comment: http://stackoverflow.com/comment/41942649
tagged with: http://stackoverflow.com/tag/xml
tagged with: compiler-errors
tagged with: java
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/26670978
has comment: http://stackoverflow.com/comment/41942198
has comment: http://stackoverflow.com/comment/41944065

http://stackoverflow.com/comment/41694613
comment on: http://stackoverflow.com/a/26534011
type: Comment
score: 0
has text: Thanks for your anwer, I have read that after JDK 1.5, it is best practice to use enum instead of interface or classes. Which is better to use in my case?
type: AnswerComment

http://stackoverflow.com/comment/44228822
type: Comment
has text: What about the Compile-time vs Runtime advantage mentioned here: http://stackoverflow.com/questions/25014572/advantage-of-using-jpametamodelentityprocessor ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26594063
score: 0

http://stackoverflow.com/a/26639045
downvote count: 0
has comment: http://stackoverflow.com/comment/41889135
has body: You don't have to press Ctrl+P, you can configure IDEA to always show this information: Go to Settings > Editor > General > Code Completion Select the Show full signatures and Autopopup in (ms:) boxes.
type: Answer
score: 19
upvote count: 19
has comment: http://stackoverflow.com/comment/41889120
answers question: http://stackoverflow.com/q/26627357

http://stackoverflow.com/q/26639983
has answer: http://stackoverflow.com/a/26640433
has body: when i compile my bankSim class, I get the error: non-static method setWhichQ(int) cannot be referenced from a static context. What can I do to reference my Event class methods in the bankSim class? Just below this is processArrival which is where the error occurs. After that is my entire event class. public void processArrival(Arrival arrEvent, Arrival[] inputData, int inputDataIndex, SortedList&lt;Event&gt; eventList, QueueDSVector&lt;Arrival&gt; teller1, QueueDSVector&lt;Arrival&gt; teller2) { boolean atFront1 = teller1.isEmpty(); // am I the only one here? boolean atFront2 = teller2.isEmpty(); if (atFront1) { // if no other customers, then immediately get served Departure newDep = new Departure(arrEvent.getArrTime(), arrEvent); // because this customer's next Event will be a departure eventList.insert(newDep); // put the departure into eventList } // end if else if (atFront2) { // if no other customers, then immediately get served Departure newDep = new Departure(arrEvent.getArrTime(), arrEvent); // because this customer's next Event will be a departure eventList.insert(newDep); // put the departure into eventList } // end if else if ( teller1.size()&lt; teller2.size() ) { //queue of teller 1 is less than teller 2 teller1.enqueue(arrEvent); // put new customer into bank line to wait Event.setWhichQ(1); } else if (teller2.size() &lt; teller1.size()) { teller2.enqueue(arrEvent); Event.setWhichQ(2); } public abstract class Event implements Comparable&lt;Event&gt; { protected int whichQ; public Event() { whichQ = 0; } public int compareTo (Event other) { int thisTime = this.getTime(); int otherTime = other.getTime(); return (thisTime - otherTime); } public int getWhichQ() { return whichQ; } // public void setWhichQ(int q) { if (q &gt;= 2) whichQ = 2; else if (q&lt;=1) // &lt; 0 = 0 whichQ = 1; else whichQ = q; } public abstract int getTime(); public abstract String toString(); } // end Event class
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41887564
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26640433
tagged with: static-methods
has comment: http://stackoverflow.com/comment/41886939
has title: How can I utilize my Event class methods in bankSim class?
answer count: 1
has comment: http://stackoverflow.com/comment/41887701

http://stackoverflow.com/q/26579225
has body: I'm using the NavigationDrawer created by the template (when starting a new project). I'm trying to get Material Design compatibility so I'm using AppCompat v7. I followed these instructions to set a Toolbar as my ActionBar (i.e. using setSupportActionBar on my toolbar) and I get a NPE in my NavigationDrawerFragment at (inside onCreateView) mDrawerListView.setAdapter(new ArrayAdapter&lt;String&gt;( getActionBar().getThemedContext(), android.R.layout.simple_list_item_activated_1, android.R.id.text1, ... now I suspect the issues is with the getActionBar() method inside fragment: private ActionBar getActionBar() { return ((ActionBarActivity) getActivity()).getSupportActionBar(); } but I have no idea why - I called setSupportActionBar(toolbar) in Activity's onCreate before calling setUp() on the NavigationDrawerFragment... If anyone has a clue why this is happening please help!
tagged with: android
score: 6
tagged with: android-actionbar
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26709368
accepted answer: http://stackoverflow.com/a/26709368
tagged with: android-appcompat
downvote count: 0
has answer: http://stackoverflow.com/a/26681156
tagged with: java
has title: NavigationDrawerFragment not working with AppCompat Toolbar
type: Question
tagged with: android-toolbar
upvote count: 6
answer count: 2
possible better answer: http://stackoverflow.com/a/26681156
favorite count: 0

http://stackoverflow.com/comment/41904059
comment on: http://stackoverflow.com/q/26649597
score: 1
has text: If i understand you correctly, you need to create a list view to achieve that
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26652079
favorite count: 0
has comment: http://stackoverflow.com/comment/41909118
has answer: http://stackoverflow.com/a/26652138
upvote count: 2
type: UnansweredQuestion
has body: I'm getting the following Error: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText at com.example.bmicalculator.MainActivity.initializeApp(MainActivity.java.32) Main Activity: public class MainActivity extends Activity { private EditText heightIn; private EditText weightIn; private Button CalculateButton; private double weight =0; private double height =0; private TextView BmiResult; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initializeApp(); } private void initializeApp() { heightIn = (EditText) findViewById (R.id.HeightInput1); weightIn = (EditText) findViewById (R.id.WeightInput1); CalculateButton = (Button) findViewById (R.id.CalculateButton); BmiResult = (TextView) findViewById (R.id.BmiResult); } public void calculateBMI(View v) { weight = Double.parseDouble(weightIn.getText().toString()); height = Double.parseDouble(heightIn.getText().toString()); double bmi = (weight / (height * height)); String result = String.format("%.2f", bmi); Log.d("MyActivity", result); BmiResult.setText(result, TextView.BufferType.NORMAL); } } XML File: &lt;LinearLayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" tools:context="${relativePackage}.${activityClass}" &gt; &lt;TextView android:id="@+id/HeightInput1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/HeightInput" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:hint="@string/InchesHint" android:inputType="numberDecimal" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;TextView android:id="@+id…
tagged with: android
has comment: http://stackoverflow.com/comment/41907619
has answer: http://stackoverflow.com/a/26652131
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26652222
has answer: http://stackoverflow.com/a/26652143
has answer: http://stackoverflow.com/a/26652113
has title: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
type: Question
has comment: http://stackoverflow.com/comment/41907991
has comment: http://stackoverflow.com/comment/41907665
answer count: 6
tagged with: java.lang.class
has answer: http://stackoverflow.com/a/26652126
score: 0
has comment: http://stackoverflow.com/comment/41907893
has comment: http://stackoverflow.com/comment/41909133

http://stackoverflow.com/q/26630543
favorite count: 0
has answer: http://stackoverflow.com/a/26631037
linked to: http://stackoverflow.com/q/34829329
has body: I wish to use a class that provides the option to get all open tabs. Unfortunately, I can only find code in js and other.. and I don't really know how to use it in my Java code..
has comment: http://stackoverflow.com/comment/85787717
has comment: http://stackoverflow.com/comment/41869359
possible better answer: http://stackoverflow.com/a/26631037
has answer: http://stackoverflow.com/a/26630582
has title: Java - How to retrieve all chrome tabs details?
upvote count: 3
tagged with: google-chrome
downvote count: 1
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26630582
type: Question
has comment: http://stackoverflow.com/comment/41869788
answer count: 2
has comment: http://stackoverflow.com/comment/85787790

http://stackoverflow.com/comment/41892633
comment on: http://stackoverflow.com/a/26643021
type: AnswerComment
type: Comment
has text: Avoid using `null` layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify. Check out [Why is it frowned upon to use a null layout in SWING?](http://stackoverflow.com/questions/6592468/why-is-it-frowned-upon-to-use-a-null-layout-in-swing) for more details
score: 1

http://stackoverflow.com/q/26605990
linked to: http://stackoverflow.com/q/3337056
tagged with: zk
has comment: http://stackoverflow.com/comment/41824899
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/26731121
has comment: http://stackoverflow.com/comment/41824985
tagged with: java
linked to: http://stackoverflow.com/q/20553493
has comment: http://stackoverflow.com/comment/41824776
tagged with: post
score: 0
answer count: 2
has title: Get parameters of the POST request with ZK Framework
has body: I want to pass data from one application (Spring MVC) to another application written with ZK Framework using POST request. One of the parameters of the post method will be a file. Let's call it id. So, what I do have now is Composer with the following code: public class PictureComposer extends SelectorComposer&lt;Component&gt; { @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); Execution e = Executions.getCurrent(); System.out.println("post param: " + Executions.getCurrent().getParameterMap().get("id")); HttpServletRequest request = (HttpServletRequest) e.getNativeRequest(); String idd = request.getParameter("id"); System.out.println("id: " + idd); } } And, when I try to make a POST request to this composer, Executions.getCurrent().getParameterMap().get("id") seems to return null. Same thing with the second approach (using HttpServletRequest). On the other hand, I get some value for id, when I use GET request and pass this value as a parameter in the URL. But, unfortunately, I cannot pass my file in the URL. So, the main question is how I can retrieve the variable from the POST request? UPD: (for now I try to retrieve a plain string parameter, just as simplified example) My POST request looks like this: POST /zssessentials/picture.zul HTTP/1.1 Host: localhost:8080 Cache-Control: no-cache ----WebKitFormBoundaryE19zNvXGzXaLvS5C Content-Disposition: form-data; name="id" wooooow ----WebKitFormBoundaryE19zNvXGzXaLvS5C
possible better answer: http://stackoverflow.com/a/26606341
has answer: http://stackoverflow.com/a/26606341
has answer: http://stackoverflow.com/a/26731121

http://stackoverflow.com/a/26598292
has comment: http://stackoverflow.com/comment/41813789
has comment: http://stackoverflow.com/comment/41813824
type: Answer
has body: Use Regular expression to do this. Specifically look at character classes , quantifiers , groups and capturing. Here is a link to the cheatsheet . To get you started here is a "similar" example. String line = "36-B"; Pattern pattern = Pattern.compile("(\\d*)(.+)(\\d*)"); Matcher matcher = pattern.matcher(line); while (matcher.find()) { System.out.println("First captured group: " + matcher.group(1)); System.out.println("Second captured group: " + matcher.group(2)); System.out.println("Thisr captured group: " + matcher.group(3)); } Let us know if you run into issues. Happy coding !!
score: 0
accepted answer of: http://stackoverflow.com/q/26598264
has comment: http://stackoverflow.com/comment/41813813
answers question: http://stackoverflow.com/q/26598264
type: AcceptedAnswer

http://stackoverflow.com/comment/41785358
type: Comment
comment on: http://stackoverflow.com/q/26584836
type: QuestionComment
score: 0
has text: Why don't you use a dedicated API for this (mailapi)?

http://stackoverflow.com/comment/42014319
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26646901
score: 0
has text: The components and columns will be there all the time, just that it will be displayed based on `<printWhenExpression>`. For instance if you have 5 columns and want to show first two, set `<printWhenExpression>` for last three to false using a parameter that you'll pass to report.

http://stackoverflow.com/comment/41886195
type: QuestionComment
type: Comment
has text: @Liste1134 The point is that `getInt` is **not** **capable** of returning a non-integer. So if you input `3.14159` (if `In` is something that reads user input), `getInt` returns 3, `x` will be 3, and the stuff after the decimal point has been thrown away and is gone forever. (P.S. What is `In`? Is it really a `ByteBuffer`, or some user-defined class?)
comment on: http://stackoverflow.com/q/26639447
score: 0

http://stackoverflow.com/q/26524741
has answer: http://stackoverflow.com/a/26525636
tagged with: math
has answer: http://stackoverflow.com/a/26524887
type: UnansweredQuestion
tagged with: arrays
has body: This is a logic problem I cant seem to wrap my head around. What I wish to achieve is to match two different products from two different sets that have the same total value into packages. for simplicity sake lets say we have two arrays with [id,price] pairs array1 = [id=A,price=1],[id=B,price=2],[id=C,price=3] array2 = [id=A,price=2],[id=B,price=1],[id=C,price=1] the cheapest package I can make is for $2 by combining array1 [id A] and array2 [id B] but I can also combine array1 [id A] and array2 [id C] to make a $2 package. So what I am trying to get is a set of packages that could be grouped by total value. but only according to what the is selected in the first array. eg : (purely for visualization purposes) : package1 : total : $2 1st option : [id=A,price=1] 2nd option [id=B,price=1] [id=C,price=1] package2 : total : $3 1st option : [id=A,price=1] 2nd option [id=A,price=2] package3 : total : $3 1st option : [id=B,price=2] 2nd option [id=B,price=1] [id=C,price=1] etc. Im assuming I will need to recursively iterate through the results, I just keep going down the wrong path and maybe someone could point me in the right direction.
type: Question
has title: Grouping two arrays into one array of common results
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/26525264
tagged with: recursion

http://stackoverflow.com/q/26610309
tagged with: java
has answer: http://stackoverflow.com/a/26610358
score: 17
has title: Java - Rotating array
has answer: http://stackoverflow.com/a/48784951
has comment: http://stackoverflow.com/comment/87230716
tagged with: arrays
downvote count: 0
answer count: 16
favorite count: 0
has answer: http://stackoverflow.com/a/41567290
has answer: http://stackoverflow.com/a/26610474
has answer: http://stackoverflow.com/a/42478398
accepted answer: http://stackoverflow.com/a/26610358
has answer: http://stackoverflow.com/a/53890504
has answer: http://stackoverflow.com/a/51582500
has answer: http://stackoverflow.com/a/63236982
has answer: http://stackoverflow.com/a/62571721
has answer: http://stackoverflow.com/a/44480428
has body: So the goal is to rotate the elements in an array right a times. As an example; if a==2, then array = {0,1,2,3,4} would become array = {3,4,0,1,2} Here's what I have: for (int x = 0; x &lt;= array.length-1; x++){ array[x+a] = array[x]; } However, this fails to account for when [x+a] is greater than the length of the array. I read that I should store the ones that are greater in a different Array but seeing as a is variable I'm not sure that's the best solution. Thanks in advance.
possible better answer: http://stackoverflow.com/a/26610474
has answer: http://stackoverflow.com/a/73541789
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26610682
has comment: http://stackoverflow.com/comment/110654516
has answer: http://stackoverflow.com/a/66404042
has comment: http://stackoverflow.com/comment/41832541
upvote count: 17
has answer: http://stackoverflow.com/a/26610649
type: Question
has answer: http://stackoverflow.com/a/74314342
tagged with: rotation
has answer: http://stackoverflow.com/a/35187188

http://stackoverflow.com/comment/41927995
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26650576
type: AnswerComment
has text: Remeber: dont load all images at once, only the images currently visible in you listview and app. On most devices apps get very little memory to work with, most of the time between 16mb and 32mb

http://stackoverflow.com/comment/41748103
comment on: http://stackoverflow.com/q/26564261
has text: Sorry it is a mistake, I corrected it
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26550759
accepted answer of: http://stackoverflow.com/q/26550616
type: Answer
has comment: http://stackoverflow.com/comment/41724145
answers question: http://stackoverflow.com/q/26550616
has body: You should use the attr of EditText: android:digits="0123456789." android:inputType="number" http://developer.android.com/reference/android/widget/TextView.html#attr_android:digits So user will be able enter only digits without minus. UPDATED: Something like that, to prevent first sign from 0: editText.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable edt) { if (edt.length() == 1 &amp;&amp; edt.toString().equals("0")) editText.setText(""); } // ... });
has comment: http://stackoverflow.com/comment/41723678
has comment: http://stackoverflow.com/comment/41736688
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41727082
downvote count: 0
has comment: http://stackoverflow.com/comment/41727306
has comment: http://stackoverflow.com/comment/41725772
upvote count: 57
has comment: http://stackoverflow.com/comment/41725803
score: 57
has comment: http://stackoverflow.com/comment/41724505
has comment: http://stackoverflow.com/comment/41723741

http://stackoverflow.com/comment/41677939
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26524607
score: 0
has text: I run it from the IDE. When I try to run it in the same folder I get it to work! Thanks, however I want to be able to choose a folder and iterate through each file. So this will not be a viable solution in the end.

http://stackoverflow.com/comment/41753338
type: AnswerComment
has text: Boom! Thanks, this was the issue. I wasn't supplying a NumberFormatter Object. Thanks much!!
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26566830

http://stackoverflow.com/q/26585529
tagged with: aspose
upvote count: 1
answer count: 1
score: 0
has title: How to search and highlight pdf file in java
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 1
has comment: http://stackoverflow.com/comment/41818463
tagged with: highlight
favorite count: 0
has body: I need to know how to highlight specific word in pdf file like link below using java. http://www.aspose.com/docs/display/wordsjava/How+to++Find+and+Highlight+Text
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26591257
tagged with: pdfbox

http://stackoverflow.com/comment/41667125
has text: Pure practice. If you need any help or want any info on the above code. Just ask.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26518549

http://stackoverflow.com/comment/41846121
comment on: http://stackoverflow.com/a/26617343
has text: That'd be a solution but I want different objects to be linked to the same ID like on a MySQL table.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41785665
type: Comment
comment on: http://stackoverflow.com/q/26585011
score: 0
type: QuestionComment
has text: Btw you should always target the latest API level in your manifest, not the same as your min sdk.

http://stackoverflow.com/comment/41898655
has text: @LouisWasserman, thanks for poiting this out. I corrected my answer.
comment on: http://stackoverflow.com/a/26624462
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26543437
type: Question
has comment: http://stackoverflow.com/comment/41710875
has comment: http://stackoverflow.com/comment/41710955
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41710675
score: -1
has answer: http://stackoverflow.com/a/26543538
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26543659
answer count: 3
has answer: http://stackoverflow.com/a/26543659
upvote count: 0
has comment: http://stackoverflow.com/comment/41710807
has title: Why I am getting null pointer exception
favorite count: 0
has comment: http://stackoverflow.com/comment/41710832
has comment: http://stackoverflow.com/comment/41710802
accepted answer: http://stackoverflow.com/a/26543538
has comment: http://stackoverflow.com/comment/41710735
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41712351
has answer: http://stackoverflow.com/a/26543516
downvote count: 1
has body: //Author: Darin Park //Date: 24 October, 2014 //Version: 2 package readandcopyupdate1; import java.util.ArrayList; import java.io.*; public class ReadAndCopyUpdate1{ public static void main(String[] args){ ReadAndCopyUpdate1 rc = new ReadAndCopyUpdate1(); final File folder1 = new File("/root/avatar/default/upload/member"); final File folder2 = new File("/root/avatar/default/upload/Transfer"); rc.listFilesForOldFolder(folder1,rc.oldFiles); rc.listFilesForNewFolder(folder2,rc.newFiles); rc.oldFiles.stream().forEach((oldFile) -&gt; { System.out.println(oldFile); }); System.out.println("\n\n"); rc.newFiles.stream().forEach((newFile) -&gt; { System.out.println(newFile); }); } private void listFilesForOldFolder(final File folder, ArrayList arrayList) { /* * This method takes two arguments. * The first argument is the Original Avatar Upload Folder which we want to scan. * The second argument is the ArrayList where we want to store all the avatar file names. * The first argument is not a string, it's a File. * So we need to first convert string to a File by using File Method. Look below for example. * final File folder1 = new File("/root/avatar/default/upload/member"); */ for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { listFilesForOldFolder(fileEntry, arrayList); } else { String str = fileEntry.getName(); if(str.equals("index.html")){ continue; } if(str.charAt(32) == '9'){ arrayList.add(str); } } } } private void listFilesForNewFolder(final File folder, ArrayList arrayList) { /* * This method takes two arguments. * The first argument is the New Transfer folder where we want to store avatar's copy. * The second argument is the ArrayList where we want to store all the avatar names in the new Transfer folder. * The first argument is not a string, it's a File. * So we need to first convert string to a file by using File method. Look below for example. * final File folder2 = new File("/root/avatar/default/upload/Transfer"); */ for (final File fil…

http://stackoverflow.com/comment/41927484
has text: yes that's what I would need to do, I think I attempted this with the char letters in my code. @brso05
comment on: http://stackoverflow.com/q/26662624
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41752340
type: AnswerComment
type: Comment
has text: I fixed my code but now in the second method, why does "scan" come up as an error, saying it cannot be resolved, and in the third method "s" cannot be resolved to a method in any of the while loops.
comment on: http://stackoverflow.com/a/26566279
score: 0

http://stackoverflow.com/q/26609857
downvote count: 2
has body: I'm trying to make a mouse-scrollable background using libGDX. I've already made the background to loop infinitely, but I have no idea how to make it to scroll by dragging the mouse. Is the InputProcessor the only way to make this or is there an easier way? If so, do you know any tutorials about using the mouseDrag-method in InputProcessor? I'm just a noob with libGDX, so if possible write specific replies please.
has title: libGDX - Scrolling background by dragging mouse
has answer: http://stackoverflow.com/a/26612677
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41831900
tagged with: background
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/26612677
type: Question
type: AnsweredQuestion
tagged with: android
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/q/26672883
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: java
has title: What happens when weak referenced object is put itno HashMap as key?
has answer: http://stackoverflow.com/a/26673117
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41945868
has answer: http://stackoverflow.com/a/26672978
accepted answer: http://stackoverflow.com/a/26672978
score: 0
has comment: http://stackoverflow.com/comment/41945989
has body: This is my program : public class MemoryLeaksWithMapsWeakReference { private Map&lt;MemoryLeaksWithMapsWeakReference, Integer&gt; map = null; public MemoryLeaksWithMapsWeakReference() { map = new HashMap&lt;MemoryLeaksWithMapsWeakReference, Integer&gt;(); } public static void main(String[] args) { MemoryLeaksWithMapsWeakReference m = new MemoryLeaksWithMapsWeakReference(); while(true) { m.run(); } } private void run() { MemoryLeaksWithMapsWeakReference mm = new MemoryLeaksWithMapsWeakReference(); WeakReference&lt;MemoryLeaksWithMapsWeakReference&gt; ref = new WeakReference&lt;MemoryLeaksWithMapsWeakReference&gt;(mm); mm = null; map.put(ref.get(), 1); System.out.println(map.size()); } } Now, if an object is weakReferenced, it should get deleted by the garbage collector. However, in the case presented above (inserted into a Map), it is not. Can someone tell why map entries (weak reference) are not getting destroyed ?
possible better answer: http://stackoverflow.com/a/26673117

http://stackoverflow.com/q/26610636
accepted answer: http://stackoverflow.com/a/26612916
answer count: 1
tagged with: android
has title: How to download an image on Android wear?
has answer: http://stackoverflow.com/a/26612916
type: AnsweredQuestion
has body: I have an ArrayList of Serialization objects on my handheld. I found a solution to send it to my wearable device. Can I send custom objects to Android Wear? In my Object I have the URL of an image and in my handheld I am using Picasso to download the image from the URL (es in a ImageView). Can I download the image in the wearable? (I think no). Should I download all the images of the ArrayList in the handheld and send it putting them as assets in a DataMap?
score: 0
tagged with: wear-os
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/25938273

http://stackoverflow.com/q/26668449
score: 1
tagged with: java
has title: How to link to JDK?
downvote count: 0
favorite count: 0
tagged with: scaladoc
has body: I want to have links like Javadoc {@link Object#toString()} Scaladoc Object#toString() How can I do this with scaladoc? I assume I'll have to provide the external URL to link to.
answer count: 0
tagged with: scala
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41953362
type: Question

http://stackoverflow.com/q/26636803
has comment: http://stackoverflow.com/comment/41880896
type: AnsweredQuestion
has body: What I'm trying to do: Given a string from user, swap the first half with second half. If the string length is odd, take the lower first half and swap. And if the string length is 1, leave it alone. For Example: Input: abcde Output: cdeab class swap20 { public static void main(String []args) { Scanner s = new Scanner (System.in); System.out.println("Enter a string"); String str = str.nextInt(); int length = str.length(); System.out.println("The length is:-"+length); int L1 = length/2 int L2 = length-L1; void getChars( int 0, int L1, char[] dst1, 0 ); //String second = void getChars( int (L1+1), int length, char[] dst2, 0); //str1 = str1.concat(String second ); System.out.println(str1); } }
has comment: http://stackoverflow.com/comment/41880881
type: Question
has answer: http://stackoverflow.com/a/26637020
tagged with: java
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26637020
has title: Swapping strings. I want to do this using getChars() and String Concat() function. Don't know how to in java
possible better answer: http://stackoverflow.com/a/26636845
has answer: http://stackoverflow.com/a/26636917
has answer: http://stackoverflow.com/a/26636845

http://stackoverflow.com/q/26619150
upvote count: 3
tagged with: c++
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26620287
has body: Good night, This is my first post here. I'm working on a integration and I'm having some problem. I'm trying to pass some structured data to/from Java&lt;->C++ using JNI, but I'm having a situation. Imagine something like this(despite the ugly format) Class Detail { public int v1; public long v2; } Class Info { public int Number; pubinc int Size; public Detail InfoExtra[] = new Detail[ 3 ]; Info(){ InfoExtra[0] = new Detail(); InfoExtra[1] = new Detail(); InfoExtra[2] = new Detail(); InfoExtra[3] = new Detail(); } } I'm Ok accessing "Number" and "Size" using GetFieldID()/GetIntField(). My problem is when I try to access "InfoExtra" member and yours attributes. I can find "InfoExtra" using: lfieldID = (env*)-&gt;GetFieldID( localClass, "InfoExtra", "[LInfoExtra;" ) But, I don't know how to retrieve this. How can I do that? Best regards Paulo
type: Question
score: 3
tagged with: java-native-interface
tagged with: java
has title: Complex data from Java to C++
has answer: http://stackoverflow.com/a/26620287
answer count: 1
favorite count: 0

http://stackoverflow.com/a/26517054
has comment: http://stackoverflow.com/comment/41703802
has body: My apologies for not documenting the way versioning affects the Java reference implementation more. I'll do so. I will assume that you are familiar with the versioning policy here: http://hl7-fhir.github.io/history.html There are two versions of FHIR extant at the moment. The first is DSTU 1. This is a fork in SVN ("dstu1"), and is only changed for significant bug reports. The reference implementation there is maintained and backwards compatible. The second version is the trunk version, in which we are preparing for the second DSTU release. The svn is highly unstable at the moment - changing constantly, and we are sometimes reversing changes several times, as we consider various options in committee. Further, there are several large breaking changes between DSTU1 and trunk, and more are coming. So you should not expect that switching between DSTU1 and trunk will be painless. Nor should implementers be using trunk unless they're really bleeding edge (and tightly connected, e.g. the implementers skype channel). When trunk is stable, and we think it's worth releasing an implementers beta, we update the versions and version history, and make a release here: http://hl7.org/implement/standards/FHIR-Develop/ and release a maven package for that version. In the trunk, since there are many changes being made, we also changed the constants to uppercase, and flipped the way that get/set properties were generated. Agree that this has a price, but there was already a price to pay for switching from DSTU1 to trunk. And when I do a beta release (soon, actually), I'll update the Java reference implementation number and so forth. Note that the Java constants went to uppercase, but the wire format constants did not change, so stored json streams are fine (though they are broken by many other changes in the specification) Given the scope of the changes between DSTU 1 and trunk (there is no list of these yet, I will have to prepare that when I update the beta), you should expect extens…
downvote count: 0
has comment: http://stackoverflow.com/comment/41698683
upvote count: 3
answers question: http://stackoverflow.com/q/26515298
type: Answer
score: 3

http://stackoverflow.com/q/26557017
possible better answer: http://stackoverflow.com/a/26558516
upvote count: 1
downvote count: 1
type: Question
tagged with: jpa
accepted answer: http://stackoverflow.com/a/26560940
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26560940
has answer: http://stackoverflow.com/a/26558516
has title: How to persist JPA Map @OneToMany
favorite count: 0
tagged with: one-to-many
has body: I have an entity class which contains a map. The map references ranked entities of type Child. @Entity public class Parent implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @OneToMany @JoinTable private Map&lt;String, Child&gt; ranking; } @Entity public class Child implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; } I put objects into the map like so: ranking.put(1, childA); ranking.put(2, childB); ranking.put(3, childA); The Child class does not reference Parent. The map key is a ranking attribute I want to persist. I do not want the ranking attribute to be part of the Child class. I want to achieve a join table (parent_child) where the columns look like: |-------------| |----------| |---------------| | parent | | child | | parent_child | |-------------| |----------| |---------------| | id | | id | | parent_id | | ... | | ... | | child_id | | | | | | ranking | &lt;-- missing |-------------| |----------| |---------------| Actually, I do not get the rank column. What am I missing? Is this even possible?
tagged with: dictionary
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26609724
has title: JPA/Hibernate how to join a particular field from an entity into a different entity
tagged with: jpa
downvote count: 0
tagged with: persistence
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26614731
has answer: http://stackoverflow.com/a/26609932
score: 2
has body: Assuming we have Entity A and Entity B, each with its corresponding table, A and B. Entity A is a Hotel and has an ID and several fields such as Country, City, PostalCode, etc. Entity B is a Description List has an ID (which is the same with the one in Entity A) and another 2 fields, Language and Description. I'm making the following query in my DAO: Query query = getEntityManager().createQuery("FROM " + type.getSimpleName() + " WHERE City = :cityParam AND Country = :countryParam"); query.setParameter("cityParam", cityParam); query.setParameter("countryParam", countryNameParam); query.setMaxResults(numberOfResults); List&lt;HotelDto&gt; hotelMap = query.getResultList(); ListResponseModel result = new ListResponseModel(); result.setHotelMap(hotelMap); return result.getHotelMap().size() &gt; 0 ? result : null; Entity A, the Hotel Entity looks like this: @Entity @Table(name = "propertyList", uniqueConstraints = { @UniqueConstraint(columnNames = "HotelID")}) public class Hotel implements Serializable, EntityWithId&lt;Long&gt; { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name = "HotelID") private Long hotelId; @Column(name = "Name") private String name; @Column(name = "Address") private String address; @Column(name = "City") private String city; @Column(name = "StateProvince") private String stateProvince; @Column(name = "PostalCode") private String postalCode; @Column(name = "Country") private String country; @OneToOne(fetch = FetchType.LAZY) @PrimaryKeyJoinColumn(name = "propertyhotelid") private PropertyDescription propertyDescription; [...] Entity B, the Description, looks like this: @Entity @Table(name = "propertyDescriptionList", uniqueConstraints = { @UniqueConstraint(columnNames = "HotelID")}) public class PropertyDescription implements Serializable, EntityWithId&lt;Long&gt; { private static final long serialVersionUID = 1L; @Id @Column(name = "HotelID", unique = true, nullable = false) private Long hotelId; @Column(name = "Prope…
upvote count: 2
possible better answer: http://stackoverflow.com/a/26609932
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: database
has answer: http://stackoverflow.com/a/26609952
has answer: http://stackoverflow.com/a/26614731
type: Question

http://stackoverflow.com/q/26571042
has answer: http://stackoverflow.com/a/26571359
has answer: http://stackoverflow.com/a/26571331
has title: Set big image to background
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has body: I got current wallpaper as below: WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); Drawable wallpaperDrawable = wallpaperManager.getDrawable(); now my current wallpaper (1152 X 1536) I try to put it as background to activity but in width does not as screen width. ImageView rv = (ImageView) findViewById(R.id.main); rv.setBackgroundDrawable(wallpaperDrawable); how I do it? please help me. thanks in advance
score: 0
answer count: 2

http://stackoverflow.com/comment/41697517
comment on: http://stackoverflow.com/a/26534057
type: AnswerComment
score: 0
has text: Worked like a charm. I didn't save side in an array however. print "Sum:" for each s in sum: print s print a newline print "Antall" for each a in antall: print a is the pseudocode i used.
type: Comment

http://stackoverflow.com/q/26600316
downvote count: 0
has body: Background: My application allows two operating modes that can be chosen from a GUI. If it operates as a server, I want to direct the logs into the server.log file. If it operates as a client, I want to direct the logs into the client.log file. Question: How to programmingly specify different names for different modes for RollingFileAppender in log4j? Added (10-29-2014): The current answer by @Manish Maheshwari does not work for me. It raises the warning log4j:WARN File option not set for appender [file] and it does not write logs into file. My attempt: I define RoleSpecificRollingFileAppender class which extends RollingFileAppender and overrides the setFile() method. public class RoleSpecificRollingFileAppender extends RollingFileAppender { @Override public void setFile(String fileName) { super.setFile(fileName); } } My RollingFileAppender is as follows: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"&gt; &lt;log4j:configuration&gt; # Root logger option log4j.rootLogger=INFO, file # Direct log messages to a log file log4j.appender.file=What to do here? org.apache.log4j.RollingFileAppender log4j.appender.file.File = I don't know how to do here. log4j.appender.file.MaxFileSize=50MB log4j.appender.file.MaxBackupIndex=10 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm} %-5p %c{1}:%L - %m%n &lt;/log4j:configuration&gt; However I don't know what to do in Java code and the log4j.properties file.
tagged with: rollingfileappender
score: 3
answer count: 1
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has title: How to programmatically specify the file name for RollingFileAppender in log4j?
tagged with: logging
has answer: http://stackoverflow.com/a/26600341
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/comment/44953735
score: 0
has text: How is "executed" different from "called"?
type: Comment
comment on: http://stackoverflow.com/a/26666030
type: AnswerComment

http://stackoverflow.com/q/26602510
has comment: http://stackoverflow.com/comment/41819587
has answer: http://stackoverflow.com/a/26602601
tagged with: resultset
has comment: http://stackoverflow.com/comment/41818375
has body: I want to use while(rs.next()) to traverse the UserInfo table. There are seven records in UserInfo table, but I only got the first record. After I had joined the codes of rs.getRow();, I got the result what I want. try{ Statement stmt=conn.createStatement(); String queryStr="SELECT * FROM UserInfo"; ResultSet rs=stmt.executeQuery(queryStr); while(rs.next()) { String strName="Name is "+rs.getString(3)+";"; String intAge="Age is "+rs.getInt(5)+";"; String strCompany="Company is "+rs.getString(4)+".&lt;br&gt;"; //int rowNum=rs.getRow(); out.println(strName+intAge+strCompany); } out.println("Succeed in visiting UserInfo table."); }catch(SQLException e){ out.println("Failed to query."); } I don't want to use rs.getRow();. How should I deal with this problem?
has comment: http://stackoverflow.com/comment/41819854
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26603701
has comment: http://stackoverflow.com/comment/41818422
has title: Resultset can not be traversed
tagged with: java
has answer: http://stackoverflow.com/a/26602641
type: Question
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41820146
has comment: http://stackoverflow.com/comment/41819408
has comment: http://stackoverflow.com/comment/41819825

http://stackoverflow.com/q/26644410
has title: addView in One Row of ListView Android
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41895599
has body: Is it possible to addView in one row of ListView in android? I try to add dynamic layout in one row of my ListView when user click Button in ListView, but I got a problem, the new layout not add in row that I wanted , but add in several rows that I don't want. this is a picture Button Postion : and this picure after I try to addView in one row of ListView: I don't understand why this is happen to my application, this is my code : Adapter_Quisioner adapter_Quisioner = new Adapter_Quisioner(getActivity(), listQuisioner, lisLabelQues); list_tt.setAdapter(adapter_Quisioner); adapter_Quisioner.notifyDataSetChanged(); this is Adapter_Quisioner : public class Adapter_Quisioner extends BaseAdapter implements OnClickListener{ Context context; int count; ArrayList &lt;ModelListQues&gt;listQuisioner; ArrayList &lt;ModelLabelQues&gt;lisLabelQues; View view; public Adapter_Quisioner(Context context, ArrayList &lt;ModelListQues&gt;listQuisioner, ArrayList &lt;ModelLabelQues&gt;lisLabelQues){ this.context = context; this.listQuisioner = listQuisioner; this.lisLabelQues = lisLabelQues; this.count=listQuisioner.size(); } @Override public int getCount() { return count; } @Override public int getViewTypeCount() { return count; } @Override public Object getItem(int position) { return listQuisioner.get(position); } @Override public long getItemId(int arg0) { return 0; } @Override public View getView(final int position, final View convertView, ViewGroup parent) { // convertView = null; view= convertView; Holder holder= null; if (view==null){ LayoutInflater inflater=(LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE); view=inflater.inflate(R.layout.adapter_questformat, parent,false); holder=new Holder(); //linear layout holder.layout_label_kesehatan = (LinearLayout)view.findViewById(R.id.layout_label_kesehatan); holder.layout_jawaban_kesehatan = (LinearLayout)view.findViewById(R.id.layout_jawaban_kesehatan); holder.layout_label_pp = (LinearLayout)view.findViewById(R.…
has comment: http://stackoverflow.com/comment/41895518
has comment: http://stackoverflow.com/comment/41895632
tagged with: java
has comment: http://stackoverflow.com/comment/41895735
type: Question
has comment: http://stackoverflow.com/comment/41895647
tagged with: listview
has comment: http://stackoverflow.com/comment/41899101
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/41895722

http://stackoverflow.com/comment/41738477
has text: I could write **a whole book** on this. But that would be redundant since other people have already done this. I suggest that you read the Oracle Java tutorial sections on writing concurrent / multi-threaded programs, paying particular attention to the parts where it talks about synchronization and thread-safety.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26558314

object
tags question: http://stackoverflow.com/q/26658903
tag name: object
tags question: http://stackoverflow.com/q/26612773
tags question: http://stackoverflow.com/q/26624418
tags question: http://stackoverflow.com/q/26621824
tags question: http://stackoverflow.com/q/26623363
tags question: http://stackoverflow.com/q/26554932
tags question: http://stackoverflow.com/q/26660844
tags question: http://stackoverflow.com/q/26641278
tags question: http://stackoverflow.com/q/26598869
tags question: http://stackoverflow.com/q/26592482
tags question: http://stackoverflow.com/q/26514995
tags question: http://stackoverflow.com/q/26628643
tags question: http://stackoverflow.com/q/26622344
tags question: http://stackoverflow.com/q/26579475
tags question: http://stackoverflow.com/q/26638989
tags question: http://stackoverflow.com/q/26580342
tags question: http://stackoverflow.com/q/26662266
tags question: http://stackoverflow.com/q/26530554
tags question: http://stackoverflow.com/q/26654875
tags question: http://stackoverflow.com/q/26553137
tags question: http://stackoverflow.com/q/26615845
tags question: http://stackoverflow.com/q/26566008
tags question: http://stackoverflow.com/q/26618582
tags question: http://stackoverflow.com/q/26663694
tags question: http://stackoverflow.com/q/26657634
tags question: http://stackoverflow.com/q/26662887
tags question: http://stackoverflow.com/q/26536089
tags question: http://stackoverflow.com/q/26635825
tags question: http://stackoverflow.com/q/26540467
tags question: http://stackoverflow.com/q/26615801
tags question: http://stackoverflow.com/q/26515163
type: Tag
tags question: http://stackoverflow.com/q/26631383
tags question: http://stackoverflow.com/q/26615064
tags question: http://stackoverflow.com/q/26657078
tags question: http://stackoverflow.com/q/26589172
tags question: http://stackoverflow.com/q/26607661
tags question: http://stackoverflow.com/q/26526897
tags question: http://stackoverflow.com/q/26518411
tags question: http://stackoverflow.com/q/26569295

http://stackoverflow.com/q/26538433
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41702462
answer count: 1
has title: when to include ; at the end of while loop in java
has body: We are currently learning the complexity of algorithms and one of them we have to analysis is quicksort, I went online to find an working quicksort code to do the analysis and noticed something int partition(int arr[], int left, int right) { int i = left, j = right; int tmp; int pivot = arr[(left + right) / 2]; while (i &lt;= j) { while (arr[i] &lt; pivot) i++; while (arr[j] &gt; pivot) j--; if (i &lt;= j) { tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i++; j--; } }; return i; } void quickSort(int arr[], int left, int right) { int index = partition(arr, left, right); if (left &lt; index - 1) quickSort(arr, left, index - 1); if (index &lt; right) quickSort(arr, index, right); } I noticed there is a ; at the end of the while loop in the partition function. The code seems to be working fine with it, but if I remove it, it still compiles and runs but it doesn't work correctly, so it intrigued me: when should there be a ; in the end of a while loop?
score: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/41702354
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26538921
has comment: http://stackoverflow.com/comment/41702448
tagged with: java
has comment: http://stackoverflow.com/comment/41702461

http://stackoverflow.com/comment/113513227
comment on: http://stackoverflow.com/a/63660474
type: AnswerComment
score: 0
type: Comment
has text: The given warning message is related to Jetty. So we need to disable it for Tomcat

http://stackoverflow.com/comment/85334185
has text: One option is to configure log4j and have console appender log into flat file.
type: AnswerComment
comment on: http://stackoverflow.com/a/26563371
type: Comment
score: 0

http://stackoverflow.com/a/26645402
answers question: http://stackoverflow.com/q/26645354
upvote count: 2
has comment: http://stackoverflow.com/comment/41896773
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26645354
has body: No, that's not true. An object has only one type: the class that you instantiated. The object will also contain all the fields of the superclass, and it will be possible to call all the methods of the superclasses (that have not been overridden) on the object, but it is still only one object. For example, say you have: class A { int i; } class B extends A { int j; } If you instantiate new B(), you get one object that has storage for two fields, i and j.

http://stackoverflow.com/q/26529428
tagged with: java
has answer: http://stackoverflow.com/a/26529812
possible better answer: http://stackoverflow.com/a/42199336
has answer: http://stackoverflow.com/a/42199336
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/41685518
has comment: http://stackoverflow.com/comment/41686067
downvote count: 0
has answer: http://stackoverflow.com/a/26529818
has comment: http://stackoverflow.com/comment/41685904
favorite count: 0
has title: Unsupported major.minor 52.0 exception in Java
tagged with: exception
has comment: http://stackoverflow.com/comment/41685905
accepted answer: http://stackoverflow.com/a/26529818
has comment: http://stackoverflow.com/comment/41685636
upvote count: 1
has body: Given such an exception: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0 And I know this is because that the JDK and JRE are not compatible. However, when I type in: which java The output is: /usr/java/jdk1.6.0_24/bin/java And when typing in: which javac The output is: /usr/java/jdk1.6.0_24/bin/javac It is the compatible in version. So what's the problem?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41685902
score: 1

http://stackoverflow.com/comment/41778767
type: Comment
comment on: http://stackoverflow.com/a/26580755
has text: The assignment required a counter for the number of times the game has been played, the number of wins, and the number of losses after the user decides to hit NO if they wanna play again. What would these three variables need to be assigned to in the main method to get my count correct? thank you for your help btw.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26518117
has comment: http://stackoverflow.com/comment/41667230
has comment: http://stackoverflow.com/comment/41666588
has comment: http://stackoverflow.com/comment/41666739
answer count: 2
has body: Hey everyone my name is Abraham Esparza and I am currently teaching myself JAVA. Currently I am trying to create a program that asks feedback from the user. I saw several examples of an “Old Mac Donald” program and I wanted to modify it so that it contains a custom method and prompts the user for feedback. I want the program to start with "Old Macdonald had a farm" and prompt the user to input "please enter EIEIO" if the user enter anything else other than "EIEIO" the program will ask them to try again. If the user types "EIEIO" the program moves to the rest of the song. Please help. here is what I have so far package pkgnew.newthod; import java.lang.String; import java.util.Scanner; public class NewNewthod { public static void main(String[] args) { System.out.println("Old MacDonald Had a Farm"); System.out.println( ); // print first verse with a method call int EIEIO, User, message; // print second and third verses (not done yet) } // This method prints the Old Macdonald line public void User( ) { System.out.println("Old Macdonald had a farm, E-I-E-I-O"); Scanner input = new Scanner(System.in); String message = input.nextLine(); System.out.println(EIEIO(message)); } public String EIEIO(String message){ System.out.printf("please enter EIEIO"); if (message.equals("E-I-E-I-O")) return "please enter EIEIO"; return EIEIO(String (message));} else // after the the user types EIEIO i want the program to proceed the next section, but i get illegal start of type { System.out.println("With a moo-moo here and a moo-moo there"); System.out.println("And on his farm he had a cow, E-I-E-I-O"); System.out.println("Here a moo there a moo"); System.out.println("Everywhere a moo-moo"); System.out.println( );{} } }
upvote count: 1
has title: New to Java, trying to create a program "Old Macdonald"
has comment: http://stackoverflow.com/comment/41666402
has answer: http://stackoverflow.com/a/27229558
favorite count: 0
accepted answer: http://stackoverflow.com/a/26518549
score: -3
has comment: http://stackoverflow.com/comment/41666009
tagged with: input
downvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26518549
tagged with: java
tagged with: output
tagged with: methods
has comment: http://stackoverflow.com/comment/41666191
possible better answer: http://stackoverflow.com/a/27229558
type: Question

http://stackoverflow.com/q/26574328
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/41759492
tagged with: android-layout
score: 327
has answer: http://stackoverflow.com/a/43729331
has answer: http://stackoverflow.com/a/40032875
has answer: http://stackoverflow.com/a/36008278
has answer: http://stackoverflow.com/a/39724615
answer count: 25
has answer: http://stackoverflow.com/a/26631227
has answer: http://stackoverflow.com/a/35838593
has answer: http://stackoverflow.com/a/38098988
has answer: http://stackoverflow.com/a/36869650
has answer: http://stackoverflow.com/a/29400711
favorite count: 0
possible better answer: http://stackoverflow.com/a/28433337
has answer: http://stackoverflow.com/a/31053171
has answer: http://stackoverflow.com/a/26604026
has answer: http://stackoverflow.com/a/35381149
has answer: http://stackoverflow.com/a/28433337
upvote count: 328
tagged with: android
has comment: http://stackoverflow.com/comment/41767296
has comment: http://stackoverflow.com/comment/41767080
has answer: http://stackoverflow.com/a/30150754
has answer: http://stackoverflow.com/a/62552589
has answer: http://stackoverflow.com/a/40241636
has comment: http://stackoverflow.com/comment/68912030
has answer: http://stackoverflow.com/a/30048574
has answer: http://stackoverflow.com/a/37101446
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26631227
has title: Changing EditText bottom line color with appcompat v7
tagged with: android-styles
tagged with: android-edittext
has answer: http://stackoverflow.com/a/60094469
has body: I am using appcompat v7 to get the look consistent on Android 5 and less. It works rather well. However I cannot figure out how to change the bottom line color and the accent color for EditTexts. Is it possible? I have tried to define a custom android:editTextStyle (cf. below) but I only succeeded to change the full background color or text color but not the bottom line nor the accent color. Is there a specific property value to use? do I have to use a custom drawable image through the android:background property? is it not possible to specify a color in hexa? According to android API 21 sources, EditTexts with material design seem to use colorControlActivated and colorControlNormal. Therefore, I have tried to override these properties in the previous style definition but it has no effect. Probably appcompat does not use it. Unfortunately, I cannot find the sources for the last version of appcompat with material design.
tagged with: java
has answer: http://stackoverflow.com/a/35401217
linked to: http://stackoverflow.com/q/15543186
has answer: http://stackoverflow.com/a/26768392
has comment: http://stackoverflow.com/comment/56331449
has answer: http://stackoverflow.com/a/35559445
has answer: http://stackoverflow.com/a/36203384
has answer: http://stackoverflow.com/a/34132494

http://stackoverflow.com/comment/50804631
score: 4
type: Comment
has text: Why the `syncronized` blocks if you're already using a `ConcurrentHashMap`?
type: AnswerComment
comment on: http://stackoverflow.com/a/31415308

http://stackoverflow.com/a/26557669
answers question: http://stackoverflow.com/q/26551714
score: 0
type: AcceptedAnswer
type: Answer
has body: I spent all day working on it, and I seem to have a fix for this. The clue was found in the documentation for the Shape class, which reads: Definition of insideness: A point is considered to lie inside a Shape if and only if: it lies completely inside theShape boundary or it lies exactly on the Shape boundary and the space immediately adjacent to the point in the increasing X direction is entirely inside the boundary or it lies exactly on a horizontal boundary segment and the space immediately adjacent to the point in the increasing Y direction is inside the boundary. Actually, this text is a bit misleading; the third case overrides second (i.e., even if a pixel in a horizontal boundary segment on the bottom of a Shape has a filled point to its right, it still will not be filled). Represented pictorially, the Polygon below will not draw the x'ed out pixels: The red, green, and blue pixels are part of the Polygon; the rest are not. The blue pixels fall under the first case, the green pixels fall under the second case, and the red pixels fall under the third case. Note that all of the rightmost and lowest pixels along the convex hull are NOT drawn. To get them to be drawn, you have to move the vertices to the orange pixels as shown to make a new rightmost/bottom-most portion of the convex hull. The easiest way to do this is to use camickr's method: use both fillPolygon() and drawPolygon(). At least in the case of my 45-degree-multiple-edged convex hulls, drawPolygon() draws the lines to the vertices exactly (and probably for other cases as well), and thus will fill the pixels that fillPolygon() misses. However, neither fillPolygon() nor drawPolygon() will draw a single-pixel Polygon, so one has to code a special case to handle that. The actual solution I developed in trying to understand the insideness definition above was to create a different Polygon with the modified corners as shown in the picture. It has the benefit (?) of calling the drawing library only once an…
accepted answer of: http://stackoverflow.com/q/26551714

http://stackoverflow.com/comment/41902820
type: Comment
has text: There can be as many contexts as you want. Every root context is stored under a specific `ServletContext` attribute. All relevant components (`DispatcherServlet`, `DelegatingFilterProxy`, `ContextLoaderListener`) take the name of the attribute as an argument. I'll try to write a proper answer as soon as I am free from work :).
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26609793

http://stackoverflow.com/a/26561909
type: Answer
has body: In Maven project you should move folder jrxml into main/resources folder and then You can get path by calling: ReportGenerator.class.getResource("/jrxml/EmployeeReport.jrxml").getPath() When using Tomcat, You can try move jrxml into WEB-INF and do this: public static String getWebInfPath(){ Class&lt;ReportGenerator&gt; c = ReportGenerator.class; URL classUrl = c.getResource(c.getSimpleName() + ".class"); String path = classUrl.getPath().split("classes")[0]; return path; } and then your file path will be: String path = getWebInfPath() + "jrxml/EmployeeReport.jrxml";
answers question: http://stackoverflow.com/q/26561858
score: 0

http://stackoverflow.com/comment/41777859
comment on: http://stackoverflow.com/q/26580292
has text: It returns an empty set
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26605156
has answer: http://stackoverflow.com/a/26605469
has body: I have a Task Flow with two views: listOfClients and newClient. Shown here: listOfClients view has a table which I want to sort before rendering it. To do it, I want to create a SortEvent with the table as source (as shown in the docs, section 29.4.4 ), but I cannot access the table before rendering the view. I call the method queueSortIdEvent in a pageFlow-scoped managed bean but findComponent cannot find the table (returns null ). Tried also view-scoped, same result. My code in the bean is: public UIComponent findComponent(final String id) { FacesContext context = FacesContext.getCurrentInstance(); UIViewRoot root = context.getViewRoot(); final UIComponent[] found = new UIComponent[1]; root.visitTree(new FullVisitContext(context), new VisitCallback() { @Override public VisitResult visit(VisitContext context, UIComponent component) { if(component.getId().equals(id)){ found[0] = component; return VisitResult.COMPLETE; } return VisitResult.ACCEPT; } }); return found[0]; } public void queueSortIdEvent(){ SortCriterion sc = new SortCriterion("ClientId", true); List&lt;SortCriterion&gt; listSC = new ArrayList&lt;&gt;(); listSC.add(sc); SortEvent new = new SortEvent(findComponent("t1"), listSC); // the table id is "t1" new.queue(); } Is there a way to queue the event before rendering the view? Note: findComponent function works fine in other parts of the code, got it from here My JDeveloper version is 12.1.3
tagged with: jsf
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14378437
score: 0
answer count: 1
has title: Queue an event before rendering a view in taskflow
type: UnansweredQuestion
tagged with: oracle-adf

http://stackoverflow.com/comment/41689296
comment on: http://stackoverflow.com/a/26525036
has text: Which version of Java? I'm on Linux x64 (Ubuntu) java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41691723
comment on: http://stackoverflow.com/q/26532378
score: 0
type: Comment
has text: @DavidConrad I tried but:Multiple markers at this line - The method get(int) is undefined for the type String - The method get(int) is undefined for the type String - The method get(int) is undefined for the type String - The method get(int) is undefined for the type String
type: QuestionComment

http://stackoverflow.com/q/26529090
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26530502
answer count: 2
tagged with: sql
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41694830
has title: Using ORM, can I map a DB table with columns a, b, c to a class with a Map with keys a, b, c?
tagged with: mapping
has answer: http://stackoverflow.com/a/26530291
has body: For example, imagine we have a DB table Person like this: |---------------| |Name|Age|Height| |---------------| |Bob | 34| 167| |Jane| 76| 181| |Joe | 55| 176| |---------------| Using an ORM framework in Java (Hibernate, Spring Data JPA, etc), can I map this table to a class like this: public class Person { private Map&lt;String, Object&gt; attributes; // No other fields! .. } Where e.g. first row of the table would be represented by the Person object with attributes field equal to: {{"Name" -&gt; "Bob"}, {"Age" -&gt; 34}, {"Height" -&gt; 167}} If this is at all possible, how would I go about it? Many thanks!
type: UnansweredQuestion
tagged with: orm
upvote count: 1
type: Question

http://stackoverflow.com/a/26522097
answers question: http://stackoverflow.com/q/26521810
has body: So it seems like this has to do with learning Object Oriented Programming. In this case, you would have one file, ChargeAccount.java, which would contain that code, and maybe ChargeAccountTest.java, which would contain the rest of the code. In OOP, constructors instantiate objects, like you did with the Scanner object, calling new Scanner() called the Scanner constructor. Research how to create constructors and how to call them in other classes. public static void main(String[] args) { ChargeAccount account = new ChargeAccount(); //rest of code }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41672950
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26521810

http://stackoverflow.com/a/26667367
type: Answer
answers question: http://stackoverflow.com/q/26666615
has comment: http://stackoverflow.com/comment/42081692
has body: I really don't recommend doing this. The name of the identifier for the path element should only be known to the controller handler method. Your interceptor has no business knowing about it. What's more, if this logic only applies to that mapping, you might as well put it inside the handler method and use @PathVariable. @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Map&lt;String, String&gt; uriTemplateVars = (Map&lt;String, String&gt;) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); return true; } You can now use any key, like "id" to retrieve a path element from uriTemplateVars.
has comment: http://stackoverflow.com/comment/42081678
score: 0

http://stackoverflow.com/comment/41764279
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26573240
score: 0
has text: Note: traversing with the iterator will give you the elements in an arbitrary order, which may not be particularly useful.

http://stackoverflow.com/a/26593239
has comment: http://stackoverflow.com/comment/55899735
answers question: http://stackoverflow.com/q/26590542
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/55899312
type: Answer
score: 68
upvote count: 68
has comment: http://stackoverflow.com/comment/86182714
accepted answer of: http://stackoverflow.com/q/26590542
has comment: http://stackoverflow.com/comment/41801433
has comment: http://stackoverflow.com/comment/55899192
has body: This is wrong: synchronized(foo) { foo.wait(); } The problem is, what's going to wake this thread up? That is to say, how do you guarantee that the other thread won't call foo.notify() before the first thread calls foo.wait()? That's important because the foo object will not remember that it was notified if the notify call happens first. If there's only one notify(), and if it happens before the wait(), then the wait() will never return. Here's how wait and notify were meant to be used: private Queue&lt;Product&gt; q = ...; private Object lock = new Object(); void produceSomething(...) { Product p = reallyProduceSomething(); synchronized(lock) { q.add(p); lock.notify(); } } void consumeSomething(...) { Product p = null; synchronized(lock) { while (q.peek() == null) { lock.wait(); } p = q.remove(); } reallyConsume(p); } The most important things to to note in this example are that there is an explicit test for the condition (i.e., q.peek() != null), and that nobody changes the condition without locking the lock. If the consumer is called first, then it will find the queue empty, and it will wait. There is no moment when the producer can slip in, add a Product to the queue, and then notify the lock until the consumer is ready to receive that notification. On the other hand, if the producer is called first, then the consumer is guaranteed not to call wait(). The loop in the consumer is important for two reasons: One is that, if there is more than one consumer thread, then it is possible for one consumer to receive a notification, but then another consumer sneaks in and steals the Product from the queue. The only reasonable thing for the fist consumer to do in that case is wait again for the next Product. The other reason that the loop is important is that the Javadoc says Object.wait() is allowed to return even when the object has not been notified. That is called a "spurious wakeup", and the correct way to handle it is to go back and wait again. Also note: The lock is…

http://stackoverflow.com/q/26668790
tagged with: java
has title: ant cannot identify my jar files at all
type: Question
tagged with: ant
tagged with: jar
has body: I have my jar files in Assignment2\lib folder and my build file is in Assignment2. The name of the jar file is Assignment1.jar The following is how I tried to compile my Assignment2 from build file through ant. <project name="Assignment1" default="run" basedir="."> <property name="classes" value="classes" /> <pathelement location="src"/> <pathelement path="${java.class.path}/"/> <pathelement path="${additional.path}"/> <fileset dir="lib" includes="**/*.jar" /> ...... <mkdir dir="build"/> <classpath refid="project.class.path"/> <classpath refid="lib.jars"/> <Project/> I am getting compile errors. I'm using windows. Is that the problem? Is there any way to compile?
score: 0
answer count: 2
tagged with: compiler-errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26684115
has comment: http://stackoverflow.com/comment/41945426
has answer: http://stackoverflow.com/a/26689461

http://stackoverflow.com/comment/41668032
type: Comment
has text: Ummm, the 'wrap' option might help. I hope there could be no space in between of two ends supposed to join together.
comment on: http://stackoverflow.com/a/26519276
type: AnswerComment
score: 0

http://stackoverflow.com/q/26554415
favorite count: 0
tagged with: struts2
has body: I have the following code. HttpServletResponse response = mock(HttpServletResponse.class); System.out.println("Response: " + response); // Prints "Mock for HttpServletResponse, hashCode: 2051435028" ServletActionContext.setResponse(response); System.out.println("Get Response: " + ServletActionContext.getResponse()); // Prints null. ServletActionContext.getResponse()) prints null while response is not null when setting. How do I get the response object? Mockito, Struts2, JUnit
has comment: http://stackoverflow.com/comment/41731145
has comment: http://stackoverflow.com/comment/41730703
tagged with: junit
accepted answer: http://stackoverflow.com/a/26554725
upvote count: 1
has comment: http://stackoverflow.com/comment/41730802
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41730945
has answer: http://stackoverflow.com/a/26554725
tagged with: servlets
has title: Mocking HttpServletResponse and passing it to ServletActionContext - And get the response object
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/41732004
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/41746186
type: QuestionComment
score: 1
has text: I don't see any Transactional annotation on your `saveOrUpdate()` method.
comment on: http://stackoverflow.com/q/26562787
type: Comment

http://stackoverflow.com/a/41284146
score: 0
answers question: http://stackoverflow.com/q/26662990
type: Answer
has body: Scott is right. Increasing only the size of buffer does not solve the problem. ch.config().setRecvByteBufAllocator(new FixedRecvByteBufAllocator(2048)); For HTTP requests it also should use HTTPObjectAggregator. It worked for me.

http://stackoverflow.com/q/26620891
accepted answer: http://stackoverflow.com/a/26621021
has comment: http://stackoverflow.com/comment/41852803
has comment: http://stackoverflow.com/comment/41852645
tagged with: delimiter
type: AnsweredQuestion
tagged with: instance
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26621021
has body: So I have a string variable which is meant to hold names of cars separated by commas. String cars = ""; What I want to do is append cars to this string. The way a new car would be added: String newCar1 = "Mini"; String newCar2 = "LandRover"; appendToCars(newCar1); appendToCars(newCar2); Then currently I have this, which I primarily need help with. public void appendToCars(String newCar) { cars = cars + "," + newCar; } So output should be: Mini,LandRover but it's: [,]Mini Been racking my brain about this for hours figuring out how to do it, but I just can't get the result I actually want. Im also using a JUnit test for this which reads : @Test public void testAppendToCars() { System.out.println("appendToCars"); String newCar1 = "Mini"; String newCar2 = "LandRover"; String expResult = newCar1 + "," + newCar2; testDel.appendToCars(newCar1); testDel.appendToCars(newCar2); String result = testDel.getCars(); assertEquals("Delivery notes incorrectly stored", expResult, result);
tagged with: variables
has comment: http://stackoverflow.com/comment/41852523
score: 0
has title: Java append instances of a String to a String which separated by commas
has comment: http://stackoverflow.com/comment/41852701
answer count: 1
tagged with: string

http://stackoverflow.com/comment/41680018
score: 0
type: Comment
has text: @Jordan please mark the answer as a solution if it is working for you :)
comment on: http://stackoverflow.com/a/26524312
type: AnswerComment

http://stackoverflow.com/a/26604041
has body: Thanks @Panther, I tried your sample code. but this not work. I then tried this : @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getSupportFragmentManager(); switch(position) { case 0: fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) .commit(); break; case 1: fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment2.newInstance(position + 1)) .commit(); break; case 2: fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment3.newInstance(position + 1)) .commit(); break; }//switch }//end onNavigationDrawerItemSelected and this code works fine. However I don't think this is the correct way to do it. Does anyone know a better away. ?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26602958

http://stackoverflow.com/a/26613652
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26613614
answers question: http://stackoverflow.com/q/26613614
has body: The == equality operator precedes the bitwise AND operator in terms of operator precedence (see this page). You should place parentheses to make the latter precede: if ((a &amp; 1) == 0) { Note that the type of the result of a &amp; 1 is the same type of one in the original code (int).
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41851007
type: Answer

http://stackoverflow.com/comment/41680368
type: QuestionComment
comment on: http://stackoverflow.com/q/26526261
has text: You could try: `emf = (EntityManagerFactory) new InitialContext().lookup("java:comp/env/persistence/UNIT NAME");`
score: 0
type: Comment

http://stackoverflow.com/comment/78166102
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26543904
has text: Did you solved this issue? I facing with the same problem
type: Comment

get
tags question: http://stackoverflow.com/q/26552149
type: Tag
tag name: get
tags question: http://stackoverflow.com/q/26578257
tags question: http://stackoverflow.com/q/26631555
tags question: http://stackoverflow.com/q/26638556
tags question: http://stackoverflow.com/q/26552053

http://stackoverflow.com/a/26658069
type: Answer
has comment: http://stackoverflow.com/comment/41920794
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26657869
downvote count: 1
has body: You could use the strategy pattern. Define the interface once, and implement it in OS-specific classes. public interface IPlatformAPI { public void print( String str ); } public class WindowsPlatformAPI implements IPlatformAPI { public void print( String str ) { ... } } public class MacPlatformAPI implements IPlatformAPI { public void print( String str ) { ... } } public class LinuxPlatformAPI implements IPlatformAPI { public void print( String str ) { ... } } public class PlatformAPI { public static IPlatformAPI getPlatformAPI() { // return one of the platform APIs // You can use System.getProperty("os.name") to choose the implementation } }
answers question: http://stackoverflow.com/q/26657869
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41923417
score: 0
has comment: http://stackoverflow.com/comment/41943466

http://stackoverflow.com/comment/41865063
type: AnswerComment
has text: Yes this is precisely what I was asking. So you are saying a string that is "1" comes automatically after a string that is "00" just because the 2nd string has more characters?
comment on: http://stackoverflow.com/a/26628042
type: Comment
score: 0

http://stackoverflow.com/q/26542890
has answer: http://stackoverflow.com/a/26542927
has comment: http://stackoverflow.com/comment/41733288
linked to: http://stackoverflow.com/q/19177994
has comment: http://stackoverflow.com/comment/41734826
upvote count: 2
score: 0
downvote count: 2
answer count: 1
has body: I have a large dump of Stackoverflow data in XML File.I need to split the file into small chunks of XML files of around 500 MB each.Please provide some suggestions
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: Split 30 GB of XML file to small chunks of XML
has comment: http://stackoverflow.com/comment/41709807
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26542927
tagged with: java
has comment: http://stackoverflow.com/comment/41709811
type: Question

http://stackoverflow.com/q/26523650
linked to: http://stackoverflow.com/q/1834826
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/1834826
score: 0
tagged with: sun
has answer: http://stackoverflow.com/a/26523755
has comment: http://stackoverflow.com/comment/41675667
has comment: http://stackoverflow.com/comment/41675728
has title: Usage of sun.* is discouraged
has body: I'm actually developing a Java applet to access an HSM in order to sign data. So I'm using a lot of Sun packages (PKCS11 wrapper and sunPKCS11 provider). I saw that link : http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html that tells us it is discouraged to use sun packages. But I want to make sure why. I'm actually compiling my code in Java 1.6 x86 JDK. Is it possible that end-users won't be able to use my application when updating their version of Java ? Or will the problem appear only if I change my JDK to compile my code ? Or is it both situations ? Thanks in advance for your clarifications.
possible better answer: http://stackoverflow.com/a/26523791
has answer: http://stackoverflow.com/a/26523791
accepted answer: http://stackoverflow.com/a/26523755
type: AnsweredQuestion
tagged with: deprecated
tagged with: java

http://stackoverflow.com/comment/41792582
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26588763
has text: I can't really finD anything there as I am beginner in Java, i have tried but without success. The documentation for beginners is not really readable. A simple piece of code based on my example would be awesome if someone can write it. If not i'll continue to google.

http://stackoverflow.com/q/26566194
has body: public static String jumble(String s) { int length = s.length() - 2; Random r = new Random(); int n = r.nextInt(2)+1; int a = r.nextInt(length)+1; String s1 =""; if (s.length() &lt; 4) { s1 = s1 + s; } else if (s.length() == 4) { s1 = s1 + s.charAt(0); s1 = s1 + s.charAt(2); s1 = s1 + s.charAt(1); s1 = s1 + s.charAt(3); } while (n == a) { a = r.nextInt(length)+1; } if (0 &lt; n &amp;&amp; n &lt; a &amp;&amp; a &lt; s.length()) { s1 = s1 + s.substring(0,n) + s.charAt(a) + s.substring(n + 1, a) + s.charAt(n) + s.substring(a+1,s.length()); } System.out.println(s1); return s1; this is my requirement String jumble(String): accepts a string and returns a jumbled version of the original: for this method, jumbled means that two randomly chosen characters other than the first and last characters of the string are swapped; this method must use the class, Random. The method must swap two different characters: in other words the two random indices into the string cannot be equal, cannot be 0, and cannot be equal to the string’s length minus one. So, for example, a four-letter string MUST result in the returned string having the same first and last characters and have the second and third characters swapped. Examples of what this method might do: “fist” returns “fsit”, “much” returns “mcuh”, but for longer strings there will be more possible return values: “spill” could return “splil” or “sipll”. Only ONE pair of letters should be swapped and strings shorter than four characters are returned unchanged. When the string length is greater than 3, the original string must never be returned. I have to use Random class and can only use the string class methods of length, charAt, and substring. this is what i have so far, I really need help creating the last string when it is greater than 4 and i need to use the random numbers i made. Edit: I have got my code working better now, thanks to Ursa. The problem i have now or at least I think it is a problem is that some times the code does …
has comment: http://stackoverflow.com/comment/41751558
has answer: http://stackoverflow.com/a/26566319
accepted answer: http://stackoverflow.com/a/26566319
possible better answer: http://stackoverflow.com/a/26566413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41751702
tagged with: java
type: Question
has title: I am try to take a string and rebuild it with two random int values i created to swap two chars at those positions
has answer: http://stackoverflow.com/a/26566413
has comment: http://stackoverflow.com/comment/41755860
score: 0
answer count: 2

http://stackoverflow.com/q/26657370
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41917173
has answer: http://stackoverflow.com/a/26657564
tagged with: java
tagged with: eclipse
type: Question
has body: I updated my java "jre" and during the installation, the wizard asked me to uninstall earlier versions as a safety measure, so i did. I have java version 1.8 now but when i run eclipse i get "code 13" error, saying that it requires version 1.6. Is there a solution to this problem other than uninstalling eclipse and re-installing it? I have plenty of plugins going on there with emulators for android. Any help appreciated.
has comment: http://stackoverflow.com/comment/41917029
has title: Eclipse not running anymore - code 13

hql
tag name: hql
tags question: http://stackoverflow.com/q/26531158
tags question: http://stackoverflow.com/q/26603496
tags question: http://stackoverflow.com/q/26587188
tags question: http://stackoverflow.com/q/26587866
tags question: http://stackoverflow.com/q/26598994
type: Tag
tags question: http://stackoverflow.com/q/26583324
tags question: http://stackoverflow.com/q/26526139

http://stackoverflow.com/comment/41822138
score: 0
has text: are you want to compare these two values ??
type: Comment
comment on: http://stackoverflow.com/q/26604549
type: QuestionComment

http://stackoverflow.com/a/26518318
accepted answer of: http://stackoverflow.com/q/26518253
type: Answer
has body: What happens here is that b is cast to long, and this is done via sign extension: the most-significant bit (1) is repeated, hence 7 11111111 bytes are used as padding. The remedy here is to explicitly consider only the 8 least-significant bits in the resulting value, using a bitwise and (&amp;): l = l | ((long)b &amp; 0xff);
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26518253

http://stackoverflow.com/a/26549488
answers question: http://stackoverflow.com/q/26549095
score: 11
downvote count: 0
type: Answer
upvote count: 11
has body: By default a JAXBElement is generated when an XML element is both nillable and optional. <xs:element name="Surname" type="xs:string" nillable="true" minOccurs="0" maxOccurs="1"/> This is to allow you to construct XML the following scenarios: The element should be absent from the XML document when the property is null. The element should be present in the XML with a value of xsi:nil="true"when the property is a JAXBElement when the nil flag set. To get rid of the JAXBElement you can use the generateElementProperty option as answered by f1sh, but then you won't be able to handle both scenarios. For More Information See my answer to a related question: Convert nil="true" to null during unmarshal operation

http://stackoverflow.com/comment/41788113
score: 0
comment on: http://stackoverflow.com/q/26586226
type: Comment
type: QuestionComment
has text: i use classic hibernate so i use HibernateDAOSupport instead of jpaDaoSupport

readonly
tag name: readonly
tags question: http://stackoverflow.com/q/26520129
type: Tag

http://stackoverflow.com/a/26616315
answers question: http://stackoverflow.com/q/26615620
score: 0
type: Answer
has body: Packages are separated by a period (.), not a slash (/), so: #!/bin/bash CLASSPATH=json-simple-1.1.jar:log4j-1.2.17.jar:. # Note the classname: result=$(java -cp $CLASSPATH com.api.endpoint.MyApp $INI) echo $result

http://stackoverflow.com/q/26595835
tagged with: image
type: Question
answer count: 1
has title: java create BMP image from pixel matrix and reverse
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/41806533
has body: Have a task to generate BMP file from int RGB matrix and than read that matrix from BMP image. I've used this class to generate BMP file but it seems that it is hard to reverse this approach for getting rgbValues array from image: /** * Class for creating bmp images from the pixel matrix (an int matrix). * @author eafkuor * @link http://forum.codecall.net/topic/62457-creating-a-bmp-image-in-java/ */ import java.io.File; import java.io.FileOutputStream; public class BMP { private final static int BMP_CODE = 19778; byte[] bytes; public void saveBMP(String filename, int[][] rgbValues) { try { FileOutputStream fos = new FileOutputStream(new File(filename)); bytes = new byte[54 + 3 * rgbValues.length * rgbValues[0].length + getPadding(rgbValues[0].length) * rgbValues.length]; saveFileHeader(); saveInfoHeader(rgbValues.length, rgbValues[0].length); saveRgbQuad(); saveBitmapData(rgbValues); fos.write(bytes); fos.close(); } catch (Exception ignored) {} } private void saveFileHeader() { byte[] a = intToByteCouple(BMP_CODE); bytes[0] = a[1]; bytes[1] = a[0]; a = intToFourBytes(bytes.length); bytes[5] = a[0]; bytes[4] = a[1]; bytes[3] = a[2]; bytes[2] = a[3]; //data offset bytes[10] = 54; } private void saveInfoHeader(int height, int width) { bytes[14] = 40; byte[] a = intToFourBytes(width); bytes[22] = a[3]; bytes[23] = a[2]; bytes[24] = a[1]; bytes[25] = a[0]; a = intToFourBytes(height); bytes[18] = a[3]; bytes[19] = a[2]; bytes[20] = a[1]; bytes[21] = a[0]; bytes[26] = 1; bytes[28] = 24; } private void saveRgbQuad() { } private void saveBitmapData(int[][] rgbValues) { int i; for (i = 0; i &lt; rgbValues.length; i++) { writeLine(i, rgbValues); } } private void writeLine(int row, int[][] rgbValues) { final int offset = 54; final int rowLength = rgbValues[row].length; final int padding = getPadding(rgbValues[0].length); int i; for (i = 0; i &lt; rowLength; i++) { int rgb = rgbValues[row][i]; int temp = offset + 3 * (i + rowLength * row) + row * padding; bytes[temp] = (byte) (r…
downvote count: 0
tagged with: bmp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41822579
has comment: http://stackoverflow.com/comment/41807086
has answer: http://stackoverflow.com/a/26596089
score: 1
tagged with: java

http://stackoverflow.com/q/26595529
has comment: http://stackoverflow.com/comment/41805638
score: -2
tagged with: java
type: Question
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26595639
accepted answer: http://stackoverflow.com/a/26595639
has title: In java could increase the value of a float by a value each time a button is pressed? (and also decrease)
has answer: http://stackoverflow.com/a/26596334
has comment: http://stackoverflow.com/comment/41805683
has comment: http://stackoverflow.com/comment/41805845
possible better answer: http://stackoverflow.com/a/26596334
favorite count: 0
upvote count: 0
type: AnsweredQuestion
has body: Could I use something like sh=current_value if button_pressed=true{ this.sh='current_value'+0.5f }; I think this can probably be done but I am not very experienced in java programming so I am not sure how to do this, so could you please help.

http://stackoverflow.com/a/26618805
has comment: http://stackoverflow.com/comment/41887182
downvote count: 0
answers question: http://stackoverflow.com/q/26615522
type: Answer
upvote count: 1
score: 1
has body: Same problem here, whats going on with: https://www.googleapis.com/oauth2/v2/certs . It says "Not found". Any information about this? UPDATE: I just refreshed https://www.googleapis.com/oauth2/v2/certs and the certs were there, another refresh they were gone, now they are gone no matter how many times I refresh the page. What's going on? UPDATE 2: I changed my Chrome VPN to Germany and the certs are there for now, but without VPN, from Croatia, they are not, same message: "Not found"

http://stackoverflow.com/comment/41782283
has text: @stretchr, Of course it's on disk, too a degree. Once the hash goes through so many iterations, the output has to be stored in order to keep going.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26582048
type: Comment

http://stackoverflow.com/comment/41835747
has text: My problem is when i open the URL with: Browser: It shows the correct View(Window/Frame/Panel or whatever you want to call it) AppletViewer: It shows a different View (not the one it should)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26610719

http://stackoverflow.com/a/26519908
type: Answer
accepted answer of: http://stackoverflow.com/q/26519815
upvote count: 1
answers question: http://stackoverflow.com/q/26519815
score: 1
has body: When java executes double myAngle = (double) ((n - 2) / n);, It will first do the division operation and then do the casting operation. In the division operation you are dividing an Integer by an another Integer. So the result of this division also will be an Integer. In your case case, 2/4 = 0. Correct code would be do the casting first and then division. double myAngle = ((double)(n - 2) / n);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41706060
score: 0
type: AnswerComment
has text: This hasn't worked unfortunately.
type: Comment
comment on: http://stackoverflow.com/a/26540550

listiterator
tags question: http://stackoverflow.com/q/26532338
type: Tag
tag name: listiterator

http://stackoverflow.com/comment/41936793
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26667680
has text: @SotiriosDelimanolis I use following environment of Java: java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
type: Comment

http://stackoverflow.com/comment/41945573
type: Comment
comment on: http://stackoverflow.com/a/26670544
type: AnswerComment
score: 0
has text: absolutely not have any more custom configuration. i'm frustrated, once i use `@Bean HibernateJpaSessionFactoryBean` this error came out, i want to scrab my hair out! I want to config another datasource, one is to read and another one is to write, but that haven begin.

http://stackoverflow.com/a/26585523
answers question: http://stackoverflow.com/q/26585497
type: Answer
score: 1
has body: However, I get ...ParseException: Unparseable date: "10/17/2014, 2:19:22 PM" does anyone know why? Because you haven't told SimpleDateFormat what the format of the string will be. Use one of the constructor that accepts a pattern string so that it knows what to expect.
upvote count: 1
has comment: http://stackoverflow.com/comment/41786684
has comment: http://stackoverflow.com/comment/41786661
downvote count: 0

http://stackoverflow.com/q/26550377
has comment: http://stackoverflow.com/comment/41748350
has title: java logging with log4j and log4j.yaml
tagged with: java
upvote count: 10
downvote count: 1
has comment: http://stackoverflow.com/comment/41754736
type: Question
score: 9
has comment: http://stackoverflow.com/comment/45301844
has answer: http://stackoverflow.com/a/33102665
has comment: http://stackoverflow.com/comment/53119637
tagged with: yaml
answer count: 1
has comment: http://stackoverflow.com/comment/41723212
tagged with: log4j
has comment: http://stackoverflow.com/comment/45301876
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/50429391
has body: Looks like java developers are avoiding logging with log4j.yaml they prefer to use log4j.xml instead I know that there is a support for this in log4j v2 but do not understand why on internet there are no detailed documentation related to this ? I found a lot documentation python/ruby logging and yaml. I know that java is old language but not understand why java developers are not interested in new things. Update: found out how to do, It was hard ;) log4j2.yml or log4j2-test.yml # why yaml http://jessenoller.com/blog/2009/04/13/yaml-aint-markup-language-completely-different status: WARN monitorInterval: 900 # 15 min = 900 sec properties: property: - name: pattern_layout_console value: "%d - [%t] %-5p - %c - %M(%L) | %m%n" - name: pattern_layout_console_no_threads value: "%d - %-5p - %c - %M(%L) | %m%n" - name: log_path value: "./logs" appenders: console: - name: CONSOLE PatternLayout: pattern: "${pattern_layout_console_no_threads}" file: - name: DEBUG_FILE fileName: ${log_path}/debug.log PatternLayout: pattern: "${pattern_layout_console}" append: false - name: INFO_FILE fileName: ${log_path}/info.log PatternLayout: pattern: "${pattern_layout_console_no_threads}" append: false ######## ..... loggers: logger: - name: ch.company.module additivity: false appenderRef: - ref: DEBUG_FILE level: DEBUG - ref: INFO_FILE level: INFO - ref: WARN_FILE level: WARN - ref: ERROR_FILE level: ERROR root: level: INFO appenderRef: ref: CONSOLE pom.xml .... <dependencies> com.fasterxml.jackson.core jackson-core 2.4.2 com.fasterxml.jackson.core jackson-databind 2.4.2 com.fasterxml.jackson.core jackson-annotations 2.4.2 com.fasterxml.jackson.dataformat jackson-dataformat-yaml 2.4.3 org.apache.logging.log4j log4j-slf4j-impl 2.1 org.apache.logging.log4j log4j-api 2.1 org.apache.logging.log4j log4j-core 2.1 org.apache.logging.log4j log4j-1.2-api 2.1 ...
has comment: http://stackoverflow.com/comment/41782737
tagged with: logging

http://stackoverflow.com/q/26645686
has title: Why we have access to A class methods only.Why overriding methods cannot be more restrictive?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41897168
score: -5
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/26645740
accepted answer: http://stackoverflow.com/a/26645752
type: Question
has answer: http://stackoverflow.com/a/26645778
has answer: http://stackoverflow.com/a/26645752
has comment: http://stackoverflow.com/comment/41897093
answer count: 3
has comment: http://stackoverflow.com/comment/41897088
has body: class A{ public void m1(){} public void m2(){} } class B{ public void m3(){} public void m1(){} public static void main(String args[]){ A a=new B(); a.m1(); //Why we have access to A class methods only. // Why overriding methods cannot be more restrictive } }
possible better answer: http://stackoverflow.com/a/26645740
favorite count: 0
upvote count: 0
downvote count: 5

http://stackoverflow.com/q/26575333
type: Question
tagged with: java
tagged with: apdu
has answer: http://stackoverflow.com/a/26677359
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/33333520
has body: please i will like to know how to change some bytes in the Request for answer select command (RATS) that the reader sends to a card during initialization phase. At the moment my NFC reader acr122u send an FSD byte of 5 in the RATS command, and after some research i found out that FSD with a value of 5 means that the terminal only accepts frame sizes with a max size of 64bits and i need to send more than that in one apdu. Could someone please help
tagged with: nfc
tagged with: smartcard
tagged with: android
has title: How to program the RATS command in iso14443a initialization and anticollision
type: UnansweredQuestion

http://stackoverflow.com/q/26528190
type: UnansweredQuestion
tagged with: double
has answer: http://stackoverflow.com/a/26528203
score: 2
upvote count: 2
type: Question
tagged with: null
tagged with: java
has answer: http://stackoverflow.com/a/26528312
answer count: 2
has title: Nullable double
downvote count: 0
has body: Here's a quick question. How do I initialize a double to null? As in when the level is empty, it will require the user to input a data. Else, if the data has already been inputted, it will ask user to overwrite the save changes. From my code below, I can only run the "if(level == null){" and not the overwrite statement public static void inValue() { double level = null; if(level == null){ System.out.println("Enter level: "); level = sc.nextDouble(); pat1.setLevel(level); break; } else{ System.out.println("Overwrite"); System.out.println("Enter level: "); level = sc.nextDouble(); pat1.setLevel(level); break; } }
favorite count: 0

http://stackoverflow.com/q/26618310
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/41848069
score: 0
tagged with: sqlite
has body: I am trying to copy my database from assets-folder to the database folder but it is not working because I get an EISDIR-Error. I also tryed a lot of different solutions from stackoverflow but I had no success: In the activity which is called after launching (MainMenu.java) the app I create an object of my DBHelper (SQLiteConnect.java): SQLiteConnect db = new SQLiteConnect(this); The Constructor of the SQLiteConnect class (which extends SQLiteOpenHelper) is doing the following: public SQLiteConnect(Context ccontext) { super(ccontext, DB_NAME, null, DB_VERSION); this.context = ccontext; this.dbFile = "database.sqlite"; this.dbPath = this.context.getFilesDir().getAbsolutePath() + "/databases/"; copyDataBase(); } The copyDataBase() method looks like this: public void copyDataBase() { System.out.println("Debuglog: Start Database Copy"); byte[] buffer = new byte[1024]; OutputStream myOutput = null; int length; InputStream myInput = null; try { myInput =this.context.getAssets().open(DB_NAME); String file = this.dbPath + this.dbFile; myOutput =new FileOutputStream(file); while((length = myInput.read(buffer)) &gt; 0) { myOutput.write(buffer, 0, length); } myOutput.close(); myOutput.flush(); myInput.close(); System.out.println("Debuglog: Database Copy Finished"); } catch(Exception e) { System.out.println("Debuglog: Database Copy FAILED!"); e.printStackTrace(); } } When initializing the OutputStream-object, I get the following error: 10-28 21:39:12.811: W/System.err(16917): java.io.FileNotFoundException: /data/data/com.wwi12ama.szbeta/files/databases/database.sqlite: open failed: EISDIR (Is a directory) Please ask if you need further information. Thanks a lot!
type: UnansweredQuestion
tagged with: android
has title: EISDIR when trying to copy database from assets-folder to database folder
has comment: http://stackoverflow.com/comment/41858899
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/41886547
comment on: http://stackoverflow.com/q/26639285
type: Comment
type: QuestionComment
has text: You can't compare strings with `==`. Use `.equals` instead.
score: 1

http://stackoverflow.com/q/26521637
has answer: http://stackoverflow.com/a/26521694
score: 0
has title: Java set color to jtable after button press
type: UnansweredQuestion
has body: I have a jtable that has a delete button, when i select a row and clicked to delete button I want the set that row to green color. However when i click away, the row color did not remain there and which every row I selected become green instead of default blue public class table extends javax.swing.JFrame { DefaultTableModel model; private boolean btnClicked = false; public table() { initComponents(); model = (DefaultTableModel) tbltable.getModel(); } public class CustomTableCellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column); if (isSelected) { cell.setBackground(getBackground()); String type = (String) String.valueOf(model.getValueAt(tbltable.getSelectedRow(), 3)); if (("deleted").equals(type)) { cell.setBackground(Color.GREEN); } } return cell; } } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { txtCol1 = new javax.swing.JTextField(); txtCol2 = new javax.swing.JTextField(); txtCol3 = new javax.swing.JTextField(); btnAdd = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tbltable = new javax.swing.JTable(); btnEdit = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); txtCol1.setText("jTextField1"); txtCol2.setText("jTextField2"); txtCol3.setText("jTextField3"); btnAdd.setText("Add"); btnAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAddActionPerformed(evt); } }); tbltable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Col1", "Col2", "Col3", "Col4" } ) { Class[] types = new Class [] { java.lang.Object.class, java.lang.Object.class, ja…
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26521691

http://stackoverflow.com/a/26645684
type: AcceptedAnswer
has body: Interval Class You can limit date ranges in Joda-Time with Interval. You can then query whether a DateTime is within that interval/range.
answers question: http://stackoverflow.com/q/26645648
type: Answer
accepted answer of: http://stackoverflow.com/q/26645648
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/41695438
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/4460661/what-to-do-with-chrome-sending-extra-requests
comment on: http://stackoverflow.com/q/26534513
score: 4

http://stackoverflow.com/comment/41775994
has text: call getCustomNonConfigurationInstance instead
comment on: http://stackoverflow.com/q/26579254
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/a/26514854
has body: It should be like this: String s = "abc"; System.out.println(s.substring(1).equals("bc"));
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26514756

http://stackoverflow.com/a/26584744
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/41785309
answers question: http://stackoverflow.com/q/26584582
score: -1
has comment: http://stackoverflow.com/comment/41785513
has body: make sure go with below code once, as first one is for timestamp creation and then go with get method for retrieving the date android time from oracle database. ...................... java.util.Date android = new java.util.Date(); long t = android.getTime(); java.sql.Date sqlDate = new java.sql.Date(t); java.sql.Time sqlTime = new java.sql.Time(t); java.sql.Timestamp sqlTimestamp = new java.sql.Timestamp(t); ...................... pstmt.getDate(2, sqlDate); pstmt.getTime(3, sqlTime); pstmt.getTimestamp(4, sqlTimestamp); pstmt.executeUpdate();
upvote count: 0

http://stackoverflow.com/comment/41883097
score: 0
type: Comment
type: QuestionComment
has text: yes im using android studio
comment on: http://stackoverflow.com/q/26637740

http://stackoverflow.com/comment/41932505
score: 0
type: AnswerComment
type: Comment
has text: @ajb I learned a long time ago that they weren't. I learned only recently that Oracle don't think we should be able to tell what they are.
comment on: http://stackoverflow.com/a/26665171

http://stackoverflow.com/a/26527013
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26526897
has comment: http://stackoverflow.com/comment/41681192
has comment: http://stackoverflow.com/comment/41681242
type: Answer
has comment: http://stackoverflow.com/comment/41681257
has comment: http://stackoverflow.com/comment/41681769
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26526897
has body: You have no visibility of c1 variable in riders() method. c1 is declared inside abilities(), and then its local to it, only visible inside. If you want to use a variable outside this method, you should use a field instead a local variable, or pass it as parameter to rider method. List&lt;Cyclist&gt; cyclists = new ArrayList&lt;&gt;(); // Declared as field public void riders() { for (cyclist : cyclists){ System.out.print(cyclist.getName()) } } public void abilities() { //Pardilla blir til! Cyclist c1 = new Cyclist(); c1.setName("Sergio Pardilla"); c1.setMountain(75); c1.setTimeTrial(60); c1.setSprint(60); c1.setAge(30); System.out.println(c1.getName() + "'s abilities:"); System.out.println("Mountain - " + c1.getMountain()); System.out.println("TimeTrial - " + c1.getTimeTrial()); System.out.println("Sprint - " + c1.getSprint()); System.out.println("Age - " +c1.getAge()); cyclists.add(c1); //Add cyclist to cyclists list }

http://stackoverflow.com/a/26531661
downvote count: 0
answers question: http://stackoverflow.com/q/26530012
upvote count: 6
has body: Your problem is that you're fetching the value as a double (Numbers in Excel are,except for a few edge cases, stored as floating point numbers). Floating point numbers printed from Java have no leading zeros, use scientific format etc Assuming what you really wanted was "give me a string that looks like what Excel shows for this cell", then you don't want to be printing the raw double value. Instead, you need to use the DataFormatter class, which provides methods which read the Excel format rules applied to a cell, then re-creates (as best it can) those in Java Your code should be: DataFormatter fmt = new DataFormatter(); String numberAsInExcel = fmt.formatCellValue(cell); That will format the number based on the formatting rules applied in Excel, so should return it looking as you expect, with leading zero, non-scientific format etc
type: Answer
score: 6

http://stackoverflow.com/a/26600725
has body: You should use Parcelable Objects https://github.com/codepath/android_guides/wiki/Using-Parcelable
type: Answer
has comment: http://stackoverflow.com/comment/41855729
answers question: http://stackoverflow.com/q/26600598
score: 0
has comment: http://stackoverflow.com/comment/41815959

http://stackoverflow.com/a/52416694
type: Answer
answers question: http://stackoverflow.com/q/26590154
score: 0
has body: Session timeout hierarchy: $tomcat_home/conf/web.xml $your_webapp/WEB-INF/web.xml manual invocation of HttpSession.setMaxInactiveInterval(int)

http://stackoverflow.com/q/26530388
tagged with: hbase
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26534291
downvote count: 0
has answer: http://stackoverflow.com/a/46035351
score: 1
tagged with: java
tagged with: elastic-map-reduce
type: Question
tagged with: hadoop
answer count: 2
upvote count: 1
has body: I have a namenode and data nodes running on aws. I configured foxyproxy and checked the following which are working: Ganglia Metrics Reports master-public-dns/ganglia/ Hadoop ResourceManager master-public-dns-name:9026 Hadoop NameNode master-public-dns-name:9101 My Java code is: import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.client.HBaseAdmin; import com.google.protobuf.ServiceException; public class HBaseConnection { public static void main(String [] args){ System.out.println("HBaseConnection"); } public void getConnection() throws IOException, ServiceException{ Configuration config = HBaseConfiguration.create(); config.clear(); config.set("hbase.zookeeper.quorum", "MASTER_NODE_DNS"); config.set("hbase.zookeeper.property.clientPort","2181"); System.out.println("Getting HBaseConnection.."); try { HBaseAdmin.checkHBaseAvailable(config); } catch (MasterNotRunningException e) { p("HBase is not running."); p(e.toString()); System.exit(1); } QueryHBase query = new QueryHBase(); query.run(config); } private static void p(String msg) { System.out.println(msg); } } I am not able to connect to the master node and receive the following error: 14/10/23 07:17:35 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Operation timed out at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) I have enabled all the ports in my master security group configuration. This issue has been bugging me since quite sometime now.
tagged with: amazon-web-services
has title: Problems while creating a hadoop client in my local machine
favorite count: 0

ear
tags question: http://stackoverflow.com/q/26644564
tag name: ear
tags question: http://stackoverflow.com/q/26552147
type: Tag

http://stackoverflow.com/comment/41759981
has text: Show us how the CORS filter is configured. It is causing this error, not your JAX-RS class.
comment on: http://stackoverflow.com/q/26566561
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41935791
type: Comment
comment on: http://stackoverflow.com/a/26666845
has text: Sounds like you basically reinvented the functionality of the `JFormattedTextField`...
score: 0
type: AnswerComment

jpanel
tags question: http://stackoverflow.com/q/26563412
tags question: http://stackoverflow.com/q/26539026
tags question: http://stackoverflow.com/q/26535645
tags question: http://stackoverflow.com/q/26574496
tags question: http://stackoverflow.com/q/26569082
tags question: http://stackoverflow.com/q/26557087
type: Tag
tags question: http://stackoverflow.com/q/26643745
tags question: http://stackoverflow.com/q/26555706
tags question: http://stackoverflow.com/q/26519837
tags question: http://stackoverflow.com/q/26567220
tags question: http://stackoverflow.com/q/26532691
tags question: http://stackoverflow.com/q/26572748
tags question: http://stackoverflow.com/q/26586604
tags question: http://stackoverflow.com/q/26574593
tags question: http://stackoverflow.com/q/26631694
tags question: http://stackoverflow.com/q/26642982
tags question: http://stackoverflow.com/q/26581332
tags question: http://stackoverflow.com/q/26621830
tags question: http://stackoverflow.com/q/26616026
tag name: jpanel
tags question: http://stackoverflow.com/q/26517955
tags question: http://stackoverflow.com/q/26652658
tags question: http://stackoverflow.com/q/26559981
tags question: http://stackoverflow.com/q/26522125
tags question: http://stackoverflow.com/q/26522924
tags question: http://stackoverflow.com/q/26601623
tags question: http://stackoverflow.com/q/26584579

http://stackoverflow.com/q/26584863
answer count: 1
has body: i have a pdf class for creating,accesing,viewing pdf actions, and i dnt know that, what should be right way to access PDF classes in spring ie. JSF scope, Spring Bean Scope' naming structure etc.. what are the dos and dnts...with brief explanation..it would be a great help..I am new in this and i need in Spring only..not in SpringMVC. Thank you
has answer: http://stackoverflow.com/a/26586188
tagged with: http://stackoverflow.com/tag/pdf
tagged with: spring
tagged with: jsf
type: UnansweredQuestion
tagged with: java
has title: what is the scope and right way to define PDF access class in spring.?
type: Question
score: 0

http://stackoverflow.com/comment/41906010
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26651066
has text: What if i = 10, how will you distrubute? 4-4-2 or 4-3-3

http://stackoverflow.com/a/26571560
has body: Ok...now i got the solution. Problem was in the version of itextpdf and lowagie jars. Earlier i was having the jars included as follows: (1)itextpdf-2.1.7.jar (2)com.springsource.com.lowagie.text-2.0.8.jar Now i have changed them to the following : (1)itextpdf-5.5.3.jar (2)com.lowagie.text-2.1.7 and due to this i can view my report in report viewer print to printer or can save in pdf Now final code is as follows: public void PrepareReport(ResultSet rs){ try{ String reportName ="/com/mmts/reports/challan.jasper"; InputStream st = getClass().getResourceAsStream(reportName); JasperReport jr= (JasperReport) JRLoader.loadObject(st); Map parameters = new HashMap(); JasperPrint jp = JasperFillManager.fillReport(jr,parameters,new JRResultSetDataSource(rs)); JasperExportManager.exportReportToPdf(jp); JasperViewer jv=new JasperViewer(jp,false); jv.setTitle("Challan"); jv.setVisible(true); }catch(JRException ex) { JOptionPane.showMessageDialog(null, ex); } } thanks
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26541842
answers question: http://stackoverflow.com/q/26541842

http://stackoverflow.com/q/26646372
tagged with: tomcat
tagged with: jvm
favorite count: 0
type: Question
tagged with: oracle-database
tagged with: spring
has body: I am having a Batch program (Program to insert / update / query Database) schedule using Java Timer to trigger one time a day. This Batch program runs in two different servers in apache tomcat. Now My problem is that Java Timer API triggering the job parallely in both the servers, due to which my program getting executed twice, hence I am getting same record processed twice, with different Primary Key. I need to make sure that my program triggers only once, that triggering should be happening dynamically irrespective of servers. Once one Batch is started others should not get started or other should not get processed. Here, Tomcat is hosted in two servers each has same application deployed in it I am having one Database which is shared by both the servers. Java and spring is used. Need suggestion / help in solution for the above problem.
has title: Controlling the Execution of Batch program running in different JVM on different server
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26663247
score: 1

http://stackoverflow.com/a/26603288
has comment: http://stackoverflow.com/comment/41882213
downvote count: 0
has comment: http://stackoverflow.com/comment/41882500
type: Answer
answers question: http://stackoverflow.com/q/26602545
score: 2
upvote count: 2
has body: I think your data structure doesn't lend itself to finding the kind of paths you want, because you are not looking for any path, but for paths of a certain shape. It might be better to work with a real grid of data, i.e. a two-dimensional array, instead of a graph-like structure with links. At least you should know your horizontal and vertical positions (x, y). Then you can treat your problem like this: Find vertical paths, i.e. paths where the middle segment is vertical. There are no vertical paths when the y coordinate (going upwards) of the two tiles is the same. Then find hoizontal paths. Paths with only two or three segments can be considered degenerate cases of a three-segmant path. So if the y position of tiles is different: Find the leftmost and rightmost position that is reachable from the start and end tiles, [L1, R1] and [L2, R2]. When both L1 and L2 are beyond the left border of the grid or if both R1 and R2 are beyond the right border of the grid, you have a path. Find the intersection of the two ranges, [L, R] = [L1, R1] ∩ [L2, R2]. If that intersection is empty, there is no (vertical) path. For all x positions in [L, R], test whether there is a possible direct line from (x, y1) to (x, y2). Do the same for horizontal paths if there was no vertical path.

http://stackoverflow.com/comment/41848888
type: Comment
type: QuestionComment
score: 16
has text: I think the *unending hatred of future developers* is a strong enough reason to avoid such thing. It feels as a workaround to avoid tool warnings. If this pattern becomes common enough, the tools will eventually warn against it too.
comment on: http://stackoverflow.com/q/26618890

http://stackoverflow.com/comment/41835550
type: Comment
has text: i use this public int[] ReadFromFile(final String[] tokens) throws IOException { final int[] counters = new int[tokens.length]; BufferedReader br; br = new BufferedReader(new FileReader("D:/test.txt")); String str1 = ""; while ((str1 = br.readLine()) != null) { for (int i = 0; i < tokens.length; i++) if (str1.contains(tokens[i]))//if the line contains the token counters[i]++;// increase counter for the index of the token } return counters; } to read the file it is good or wrong.. i`m new in java...
comment on: http://stackoverflow.com/a/26611687
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41832062
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26514932
has text: it's now really difficult to choose a new name for the variable 'trait', what would be better according to the best practise of Java codestyle?

http://stackoverflow.com/a/26628892
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26628823
has body: When doing a post the parameters are send in the Http Body: Try this: URL u = new URL("http://www.stackoverflow.com"); HttpURLConnection conn = (HttpURLConnection) u.openConnection(); conn.setDoOutput(true); conn.connect(); DataOutputStream wr = new DataOutputStream ( conn.getOutputStream ()); wr.writeBytes (urlParameters); wr.flush(); wr.close(); Where urlParameters is something like: String urlParameters = "tittel="+URLEncoder.encode(tittel,"UTF-8") +"&amp;bedriftsNavn"+URLEncoder.encode(bedriftsNavn,"UTF-8");
has comment: http://stackoverflow.com/comment/41867205

http://stackoverflow.com/q/26633523
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/42985165
has body: I want to enable/disable a @RestController based on configuration, in order achieve it i'm trying to use the @ConditionalOnExpression annotation. Using a static hardcoded value is working just fine: @RestController @ConditionalOnExpression("true") public class MyRestController { @RequestMapping("/hi") public String hi() { return "hi"; } } Yet, using a dynamic property value within a SpEL expression always results in not loading the @RestController: @RestController @ConditionalOnExpression("${my.rest.controller.enabled:false}") public class MyRestController { ... } Would really appreciate any ideas/best practices to resolve this.
downvote count: 0
favorite count: 0
has title: Spring Boot - @ConditionalOnExpression for @RestController
upvote count: 8
tagged with: rest
has answer: http://stackoverflow.com/a/51388334
answer count: 5
has answer: http://stackoverflow.com/a/34921799
tagged with: spring
has answer: http://stackoverflow.com/a/41569441
score: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26683160

http://stackoverflow.com/comment/41671709
comment on: http://stackoverflow.com/q/26521315
score: 0
type: QuestionComment
type: Comment
has text: check if a line begins with a single quote `^'.*`

http://stackoverflow.com/a/26559184
upvote count: 1
type: Answer
has body: you can also do like this: int count=0; String s ="Alaska"; for(char ch : s.toCharArray()){ if(ch=='A' || ch=='a'){ count++; } } System.out.println("Number of A: "+count);
answers question: http://stackoverflow.com/q/26559098
downvote count: 0
score: 1

http://stackoverflow.com/q/26624709
tagged with: spring
has title: @value with static field in spring
answer count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7253694
has comment: http://stackoverflow.com/comment/41859323
has comment: http://stackoverflow.com/comment/41859221
score: 0
has body: I have a class in which I want to read a property file and initialize a static field using @value, but this always comes as null public class MyClass{ @value(${my.value}) private static String myValue; } So my question here, Is there any workaround to do this like using a static setter. Why it does not work with static field, if I change it to non static it starts working :(
duplicate of: http://stackoverflow.com/q/7253694
type: UnansweredQuestion

http://stackoverflow.com/a/26669886
answers question: http://stackoverflow.com/q/26669864
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26669864
upvote count: 3
has body: The array variable charArray is declared as a local variable inside the constructor, and thus is not visible to the other methods. You can declare it as a member field: private int top; private char[] charArray; public Stack () { charArray = new char [50]; top = -1; }
score: 3

http://stackoverflow.com/comment/41926447
type: QuestionComment
comment on: http://stackoverflow.com/q/26662161
type: Comment
score: 0
has text: Do you mean, how do you get a database with all the information that you can put on your hard drive?

http://stackoverflow.com/q/26570019
has comment: http://stackoverflow.com/comment/41758801
tagged with: minecraft
score: -1
tagged with: boolean
accepted answer: http://stackoverflow.com/a/26570029
answer count: 3
has answer: http://stackoverflow.com/a/26570030
favorite count: 0
linked to: http://stackoverflow.com/q/12399205
downvote count: 2
possible better answer: http://stackoverflow.com/a/26570030
has title: Boolean always returning false
upvote count: 1
has comment: http://stackoverflow.com/comment/41759557
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26570079
has body: I'm new to java and i'm trying to make a minecraft plugin. I want a debug mode so I decided to create a boolean that I can switch with a command, but whatever I do it returns false except the p.sendMessage at the end that always says the debug message.Here's my code: package fr.davidp027.itemlogger; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { public static Boolean debug = false; public void onEnable() { PluginManager pm = getServer().getPluginManager(); pm.registerEvents(this, this); } public void onDiasble() { } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { //Player player = (Player) sender; if (cmd.getLabel().equalsIgnoreCase("lping")) { sender.sendMessage("Command Working :D"); } else if (cmd.getLabel().equalsIgnoreCase("ildebug")) { if (Main.debug = false) { sender.sendMessage("Debug mode turned ON. Type command again to disable."); Main.debug = true; } else if (Main.debug = true) { sender.sendMessage("Debug mode turned OFF. Type command again to enable."); Main.debug = false; } } return false; } @EventHandler public void Blockplace(BlockPlaceEvent e) { Player p = e.getPlayer(); Material b = e.getBlock().getType(); Location l = e.getBlock().getLocation(); if (Main.debug = true) { p.sendMessage(ChatColor.RED + "You placed the following block: " + ChatColor.GOLD + b + ChatColor.RED + " at the following location" + ChatColor.GOLD + " X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + ChatColor.RED + " and your name is: " + ChatColor.…
has answer: http://stackoverflow.com/a/26570029
tagged with: java
tagged with: bukkit
type: Question

http://stackoverflow.com/comment/41861831
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26606089
has text: how do serialize an array in externalization ?
score: 0

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/26642153

http://stackoverflow.com/a/26649547
has comment: http://stackoverflow.com/comment/41903468
has body: I assume this is some kind of homework (or self study) so l will give a hint rather than the full solution: You want to print each subject, followed by each mark for that particurlar subject. Currently, you are printing a list of all subjects, then you are printing the marks for each subject afterwards. So this part of your code: for (int j = 0; j &lt; course.length; j++) { courseName = course[j]; System.out.println(courseName + "\t"); } for (int m = 0; m &lt; marks.length; m++) { for (int n = 0; n &lt; marks.length; n++) { courseMarks = marks[m][n]; System.out.print("\t\t" + courseMarks + "\t\t"); } System.out.println(""); } Should be a nested loop rather than two separate loops. ie, the second loop should be inside the first loop. So you print one subject, then all the marks for that subject, then the next subject, then all the marks for that second subject and so on There is still a bit of fiddling around before you will get the exact layout you want.But remember that System.out.println() will print the argument followed by a new line.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41903414
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26649333
accepted answer of: http://stackoverflow.com/q/26649333
has comment: http://stackoverflow.com/comment/41903522

http://stackoverflow.com/a/26545806
downvote count: 0
type: Answer
has body: You, or a library that you are using must be spawning off a thread somewhere and it is that thread that is throwing the exception. Your options are track down the creation of that thread, and handle the exception from there track down which thread group that the thread belongs to and register an exception handler with that thread group
answers question: http://stackoverflow.com/q/26545733
has comment: http://stackoverflow.com/comment/41714760
upvote count: 1
has comment: http://stackoverflow.com/comment/41715066
score: 1

http://stackoverflow.com/q/26557921
type: Question
has answer: http://stackoverflow.com/a/26557998
tagged with: java
has answer: http://stackoverflow.com/a/26558306
answer count: 2
has comment: http://stackoverflow.com/comment/41737099
upvote count: 0
favorite count: 0
tagged with: sdk
has title: Requirement for SKD not found
type: UnansweredQuestion
tagged with: android
score: -1
tagged with: installation
has body: Hi i'm learning Android (beginner) and I first need to download the JDK for the Android SDK, but the SDK requirements clearly say that I need the JDK 6 , which isn't available. What should I do? Will it work?Why does Android SDK needs a old and unavailable version? , it doesn't make sense
downvote count: 1

http://stackoverflow.com/q/26565166
upvote count: 5
accepted answer: http://stackoverflow.com/a/30433662
has comment: http://stackoverflow.com/comment/41749635
tagged with: colors
answer count: 3
downvote count: 0
tagged with: button
possible better answer: http://stackoverflow.com/a/26565256
has answer: http://stackoverflow.com/a/51465071
favorite count: 0
has answer: http://stackoverflow.com/a/26565256
tagged with: shapes
type: AnsweredQuestion
has title: How to display a color selector when clicking a button?
tagged with: java
has body: I'm making a program that draws some shapes and fills them with color. I need to change the 'line' color, and want the user to be able to select the color. How can I, when clicking a button "Choose Color", have a set of colours appear below the button? Is it possible for the selector to be embedded in the UI below the button (and not pop up in a window)? I want to display a color selector like in Paint.
has answer: http://stackoverflow.com/a/30433662
type: Question
has comment: http://stackoverflow.com/comment/41749674
score: 5
has comment: http://stackoverflow.com/comment/41762207

http://stackoverflow.com/comment/85787790
comment on: http://stackoverflow.com/q/26630543
score: 0
type: Comment
has text: It is also possible using Selenium: https://stackoverflow.com/a/43787744/873282
type: QuestionComment

http://stackoverflow.com/comment/41722513
type: QuestionComment
comment on: http://stackoverflow.com/q/26549708
score: 0
has text: @njzk2 I have edited. Could you help me now ?
type: Comment

http://stackoverflow.com/a/26542474
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26541511
type: Answer
answers question: http://stackoverflow.com/q/26541511
has body: In every thread, there is an interrupt flag. Your while condition is fine. So what you can do is, while(!Thread.currentThread().isInterrupted()) { /* Interrupt the current thread if socket connection is broken. This will interrupt the thread and the condition in the while loop will become false. Hence, your loop will exit normally. */ if(socket.isClosed()) Thread.currentThread().interrupt(); } After the loop exited normally, the run() method will be executed completely and your thread will automatically move to dead state. So you will not need to kill it explicitly.
upvote count: 1
score: 1

http://stackoverflow.com/comment/41811388
type: Comment
type: QuestionComment
has text: You can write JavaFX programs without using XML. Besides that, you question is very open-ended - heavy for performance for what? If you want to compare performance for a given task, you would need to create two programs in the different UI toolkits that you want to compare performance on and then run benchmarks on both - I suggest you give that a try. Or create a tech prototype for your target app and validate that performance in your candidate toolkit is acceptable for your app.
comment on: http://stackoverflow.com/q/26597410
score: 0

http://stackoverflow.com/comment/41829364
type: Comment
comment on: http://stackoverflow.com/a/26605082
has text: First change the scanner to `new Scanner(new File("lotto.dat"))`. Second, from the method `drawNumbers()`, you're calling `doCompare()` with random numbers that change every time you run the program. Sometimes you'll have 0 matches, sometimes you'll have one or more matches. And what's the use of `userNumbers()`?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26666669
upvote count: 1
score: 1
downvote count: 0
has body: Replace '\n' with "\n" Why? Because the compiler sees you adding 2 characters together, to the compiler char and int primitive data types are considered to interchangeable and so the + is actually adding the 2 int values together. Using double quotes will tell the compiler that you are adding a string to a character.
type: Answer
answers question: http://stackoverflow.com/q/26666633

http://stackoverflow.com/comment/41839512
type: Comment
has text: Is this Java? If you inherit from ArrayList, you call super.getElementAt(n); from your getElementAt() code.
comment on: http://stackoverflow.com/q/26613946
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41817375
has text: If you are using your Queue often you'll eventually replace the old reference with the new one, effectively releasing it for GC.
comment on: http://stackoverflow.com/a/26601825
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26655846
has body: I have a simple class mapped with JPA: @Entity @Table(name = "SPONSOR") public class Sponsor extends PersistableBusinessObjectBase implements SponsorContract { @PortableSequenceGenerator(name = "SEQ_SPONSOR_CODE") @GeneratedValue(generator = "SEQ_SPONSOR_CODE") @Id @Column(name = "SPONSOR_CODE") private String sponsorCode; @Column(name = "ACRONYM") private String acronym; @Column(name = "AUDIT_REPORT_SENT_FOR_FY") private String auditReportSentForFy; @Column(name = "CAGE_NUMBER") private String cageNumber; @Column(name = "COUNTRY_CODE") private String countryCode; @Column(name = "DODAC_NUMBER") private String dodacNumber; @Column(name = "DUN_AND_BRADSTREET_NUMBER") private String dunAndBradstreetNumber; @Column(name = "DUNS_PLUS_FOUR_NUMBER") private String dunsPlusFourNumber; @Column(name = "OWNED_BY_UNIT") private String ownedByUnit; @Column(name = "POSTAL_CODE") private String postalCode; @Column(name = "ROLODEX_ID") private Integer rolodexId; @Column(name = "SPONSOR_NAME") private String sponsorName; @Column(name = "SPONSOR_TYPE_CODE") private String sponsorTypeCode; @Column(name = "STATE") private String state; @Column(name = "CREATE_USER") private String createUser; @Column(name = "ACTV_IND") @Convert(converter = BooleanYNConverter.class) private boolean active; @ManyToOne(cascade = { CascadeType.REFRESH }) @JoinColumn(name = "SPONSOR_TYPE_CODE", referencedColumnName = "SPONSOR_TYPE_CODE", insertable = false, updatable = false) private SponsorType sponsorType; @ManyToOne(cascade = { CascadeType.REFRESH }) @JoinColumn(name = "OWNED_BY_UNIT", referencedColumnName = "UNIT_NUMBER", insertable = false, updatable = false) private Unit unit; @ManyToOne(cascade = { CascadeType.REFRESH }) @JoinColumn(name = "ROLODEX_ID", referencedColumnName = "ROLODEX_ID", insertable = false, updatable = false) private Rolodex rolodex; .... I have extended that class into a very simple class @Entity public class SponsorMaintainableBo extends Sponsor { } This is exactly what I need for…
tagged with: jpa
has answer: http://stackoverflow.com/a/26656111
accepted answer: http://stackoverflow.com/a/26656111
has answer: http://stackoverflow.com/a/26656221
has comment: http://stackoverflow.com/comment/41914649
has comment: http://stackoverflow.com/comment/41914672
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26656221
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42601053
has title: JPA Mapping with basic class inheritance
score: 0
answer count: 2

http://stackoverflow.com/comment/139435015
type: AnswerComment
type: Comment
has text: Do not place REMOVE cascade type on @ManyToMany relationships because it can remove all the data from both tables in the database
comment on: http://stackoverflow.com/a/54730020
score: 0

http://stackoverflow.com/q/26579465
tagged with: java
type: UnansweredQuestion
tagged with: listview
has answer: http://stackoverflow.com/a/26580635
type: Question
has body: I make demo in which I show data from webservice .Which is working fine .Mean I am able to display data on listview when I hit service first time.But I need hit server again and again and get new data .I am able to get new data .but I need to show new data on listview but my list become blank or empty when I got new data . why ? here is my code . protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.departure_dashboard); Log.d("=========onCreate", "constructor"); try { Bundle bundle = getIntent().getExtras(); String message = bundle.getString("Response"); Log.d("=========onCreate", message); listView=(ListView)findViewById(R.id.listView1); data = new Gson().fromJson(message, deparaturedaseboarddto.class); adapter = new CustomListAdapter(this, data.getData()); listView.setAdapter(adapter); timer =new Timer(); timer.scheduleAtFixedRate(new alertTask(), 0, 4000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } when Timer start I used alerk task.and call webservice again and again public class alertTask extends TimerTask { @Override public void run() { // TODO Auto-generated method stub WebserviceMethod callDepartudeDashboard=new WebserviceMethod(); callDepartudeDashboard.setObserver(Departuredashboardscreen.this); callDepartudeDashboard.getwebService(ConstantVariable.dashboardWebServiceURL+"a/"+"departuredashboard"+"?crsCode=hnh"); } } It is the method which give response again and again ... @Override public void getWebserviceResponse(String result) { // TODO Auto-generated method stub Log.d("timer", result); data.getData().clear(); deparaturedaseboarddto localData = new Gson().fromJson(result, deparaturedaseboarddto.class); data=localData adapter.notifySetDataChanged(); } here is my custom adapter for listview public class CustomListAdapter extends BaseAdapter{ ArrayList&lt;deparaturedaseboarddto&gt; deparaturedaseboarddto; private Context …
tagged with: android-listview
tagged with: android
has title: how to referesh listview after fixed interval of time?
has comment: http://stackoverflow.com/comment/41777105
score: 0
answer count: 1

http://stackoverflow.com/a/26527312
upvote count: 1
has body: Add an org.eclipse.debug.core.IStreamListener to the process. IProcess process = DebugPlugin.newProcess(launch, process, "", null); IStreamsProxy streamsProxy = process.getStreamsProxy(); IStreamMonitor streamMonitor = streamsProxy.getOutputStreamMonitor(); IStreamListener yourListener = ....; streamMonitor.addListener(yourListener ); I would do it this way, because your code above is "core code" (no ui code) org.eclipse.debug.core. If you use the MessageConsole as suggested in How to read message from console tab view in eclipse plugin development you will introduce a dependency from core to ui code.
answers question: http://stackoverflow.com/q/26526847
has comment: http://stackoverflow.com/comment/41710568
accepted answer of: http://stackoverflow.com/q/26526847
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41810214
score: 0
comment on: http://stackoverflow.com/q/26597789
type: QuestionComment
type: Comment
has text: Well, I am not sure. This is my manifest: http://i.gyazo.com/570adfb61c10ff3771078fafe65a3f8f.png But then, I used a utility called Jarcheck, and get this: http://i.gyazo.com/149a37fb1c27293d21a44a4ce64f80f5.png @user432

http://stackoverflow.com/comment/41777791
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26580464
type: AnswerComment
has text: Sorry, but I have to down-vote this answer. The last thing that we want to recommend is for the OP to create static instances when none are needed. If thread safety is an issue (and we have absolutely no indication of this) then there are much better ways of solving this than throwing the baby out with the bath water.

http://stackoverflow.com/q/26665197
tagged with: listview
tagged with: contacts
upvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41944842
has answer: http://stackoverflow.com/a/26674050
tagged with: android
has body: i want to show a simple list of the Contacs in my App. The example code from google is very large and complex, so i searched for other examples.. I found this one: import android.content.*; import android.database.*; import android.net.*; import android.os.*; import android.provider.*; import android.support.v4.app.*; import android.support.v4.content.*; import android.view.*; import android.widget.*; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; public class ContactsFragment extends ListFragment implements LoaderManager.LoaderCallbacks&lt;Cursor&gt;, AdapterView.OnItemClickListener { private CursorAdapter mAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // create adapter once Context context = getActivity(); int layout = android.R.layout.simple_list_item_1; Cursor c = null; // there is no cursor yet int flags = 0; // no auto-requery! Loader requeries. mAdapter = new SimpleCursorAdapter(context, layout, c, FROM, TO, flags); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // each time we are started use our listadapter setListAdapter(mAdapter); // and tell loader manager to start loading getLoaderManager().initLoader(0, null, this); } // columns requested from the database private static final String[] PROJECTION = { ContactsContract.Contacts._ID,// _ID is always required ContactsContract.Contacts.DISPLAY_NAME_PRIMARY, // that's what we want to display }; // and name should be displayed in the text1 textview in item layout private static final String[] FROM = { ContactsContract.Contacts.DISPLAY_NAME_PRIMARY }; private static final int[] TO = { android.R.id.text1 }; @Override public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) { // load from the "Contacts table" Uri contentUri = Contacts.CONTENT_URI; // no sub-selection, no sort order, simply every row // projection says we want just the _i…
has title: Android Contacs not shown im ListView
score: -1
has comment: http://stackoverflow.com/comment/41933988
tagged with: java
answer count: 1
downvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/26617571
tagged with: java
score: 0
answer count: 0
has body: I've got Liferay 6.1.1 bundled with JBoss 7.1.1 Final. I've manage to configure it in Eclipse Luna, set JBoss server and now after typing localhost:8080 in my browser I can see Liferay welcome page. The problem is that server only starts when its Runtime JRE is set to Java SE-1.6. When I change it to 1.7 or 1.8 server is starting, in console I can see a line JBoss AS 7.1.1 Final 'Brontes' Starting but that's it, nothing happens afterwards and server's state is 'starting' instead of started. Anyone knows the reason why or knows how to fix it ? I've got Java 8 and 7 installed, environment path is set to JDK7.
type: UnansweredQuestion
tagged with: jboss
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41846800
tagged with: liferay
type: Question
has comment: http://stackoverflow.com/comment/41846701
has title: Liferay bundled with JBoss 7.1.1 : Works only with JavaSE-1.6

http://stackoverflow.com/comment/41807717
type: Comment
type: QuestionComment
has text: Why do you need Reflection here at all?
comment on: http://stackoverflow.com/q/26596580
score: 0

http://stackoverflow.com/comment/41665686
comment on: http://stackoverflow.com/a/26517859
score: 0
type: AnswerComment
type: Comment
has text: Thanks Jose , but there are other application sitting on the same Web server so I can not change the Java version there , I changed the Jdk version on my machine but the same error . Application gets deployed but doesn't start.

http://stackoverflow.com/comment/41786032
score: 0
comment on: http://stackoverflow.com/q/26583715
type: Comment
type: QuestionComment
has text: does only one copy of object gets saved in the database in Hibernate even though a loop used? @jhamon: Can't we insert multiple rows with a single object? As primary key is auto generated every time a new record is inserted. How could we save multiple times using the same object?

http://stackoverflow.com/comment/114682680
type: Comment
has text: @JeffGrigg I have no idea what problem I was trying to solve back in 2014 when I was asking the question whose answer you posted this comment on. I assume it was some sort of language processing thing, given what I was into in 2014. I noted Unicode because Java strings are Unicode strings, and because the Unicode Consortium has done a lot of research into languages and the properties of their glyphs.
comment on: http://stackoverflow.com/a/42354547
type: AnswerComment
score: 0

http://stackoverflow.com/q/26620609
has comment: http://stackoverflow.com/comment/41861317
tagged with: web-services
has answer: http://stackoverflow.com/a/26628420
type: Question
has body: I'm using Sonar 4.5 and I'm trying, by accessing the API, to get all the violations for a project... for this I'm trying to use the resources endpoint with my project's key. The response contains the basic info but not all the other metrics (violations, coverage etc...). This is what I'm getting: { "id": 582, "key": "myGroupId:myProject", "name": "madfox", "scope": "PRJ", "qualifier": "TRK", "date": "2014-10-23T15:10:11+0100", "creationDate": "2014-10-06T09:58:21+0100", "lname": "myProject", "version": "1.0-SNAPSHOT", "description": "" } And I was trying to use another endpoint that might help but nothing useful so far. Is there anything I can do for the endpoint to return more info? Can the violations be gathered in a different way? UPDATE: I've tried all the resources endpoint variations: api/resources/index api/resources api/resources?resource=myGroupId:myProject api/resources?resource=myGroupId%3AmyProject They return the project's info, or all the projects when the resource param is not specified, but none of them contains the metrics I'm also using the sonar-ws-client and that returns the same thing when I use the ResourceQuery class for the find method. UPDATE2: Steps to reproduce: Use a rest client, like Postman or just the browser since they are GET endpoints with following urls: http://nemo.sonarqube.org/api/resources http://nemo.sonarqube.org/api/resources?resource=org.apache.activemq:activemq-parent
tagged with: sonarqube
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26628420
has comment: http://stackoverflow.com/comment/41862596
tagged with: rest
has title: Sonar WebService API - resources endpoint returns no metrics
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26532835
upvote count: 3
has body: Sure, add them to list and then iterate through that list: List&lt;Setter&gt; setters = new ArrayList&lt;Setter&gt;(); setters.add(s1); //... add more ... for (Setter s: setters) { s.setSomething(123); }
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26532791
answers question: http://stackoverflow.com/q/26532791

http://stackoverflow.com/comment/41809728
has text: The offset depends of the date as it changes with the time (such as daylight savings).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26597153
score: 0

http://stackoverflow.com/a/26602237
score: 5
has body: You have to check the length of the array args before accessing an element. Since you have to access 2nd element in the array, the lengh should be atleast 3. You have to check that like below if(args.length &gt; 2) { //wrap all code here }
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41818019
type: Answer
answers question: http://stackoverflow.com/q/26602209

http://stackoverflow.com/q/26591033
score: 0
tagged with: io
possible better answer: http://stackoverflow.com/a/26591170
upvote count: 1
has title: Binary Tree in Java. Problems with System.out.println()
downvote count: 1
type: AnsweredQuestion
tagged with: algorithm
has answer: http://stackoverflow.com/a/26591151
tagged with: java
accepted answer: http://stackoverflow.com/a/26591151
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26591170
favorite count: 0
tagged with: binary-tree
has body: I have to make an expression tree. This is a single example model of it. But It shows me strange chars but not my strings. Can you help me solve this problem. And another one question: can you show me the way to simplify my code. What about this part of code? Can I do without it? public Iterator&lt;TreeNode&lt;T&gt;&gt; iterator() { return null; } import java.util.*; public class TreeNode&lt;T&gt; implements Iterable&lt;TreeNode&lt;T&gt;&gt; { T data; TreeNode&lt;T&gt; parent; List&lt;TreeNode&lt;T&gt;&gt; children; public TreeNode(T data) { this.data = data; this.children = new LinkedList&lt;TreeNode&lt;T&gt;&gt;(); } public TreeNode&lt;T&gt; addChild(T child) { TreeNode&lt;T&gt; childNode = new TreeNode&lt;T&gt;(child); childNode.parent = this; this.children.add(childNode); return childNode; } public Iterator&lt;TreeNode&lt;T&gt;&gt; iterator() { return null; } public static void main(String[] args){ TreeNode&lt;String&gt; root = new TreeNode&lt;String&gt;("root"); System.out.println(" " + root + " "); System.out.println(" / \\ "); TreeNode&lt;String&gt; node1 = root.addChild("node1"); TreeNode&lt;String&gt; node2 = root.addChild("node2"); System.out.println(" " + node1 + " " + node2); System.out.println(" \\"); TreeNode&lt;String&gt; node20 = node2.addChild(null); System.out.println(" " + node20); System.out.println(" / \\"); TreeNode&lt;String&gt; node21 = node2.addChild("node21"); TreeNode&lt;String&gt; node210 = node20.addChild("node210"); System.out.println(" " + node21 + " " + node210); } }

http://stackoverflow.com/q/26667317
score: -4
tagged with: multithreading
has body: My server aperiodically receives join requests from new clients. Upon receiving a new join request, the server runs a service that can be finished real quick. I implement the service as a Java class (called JC) implementing the Runnable interface. I have parameters within the JC class. At the caller side, I like to have only one instance (or static) of the JC. My question is how to trigger the run() method in the JC every time. Please show me some code. Thanks. Hope following edits make sense, which is my current implementation. In the Server that wants to trigger thread executing: public class Server { private static RealService mm = new RealService(); private static void update(){ new Thread(mm).start(); } } In the Service class: public class RealService implements Runnable{ @Override public void run() { // TODO Auto-generated method stub // Do something } }
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26667607
upvote count: 0
has answer: http://stackoverflow.com/a/26667862
downvote count: 4
has title: Aperiodically trigger a thread to run in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/41936342
type: UnansweredQuestion

http://stackoverflow.com/a/26595493
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41805726
has body: Could you try this method.... This one is working for me. Although its almost same as yours... private void sendNotification(String msg) { int uniqueId = (int) (System.currentTimeMillis() &amp; 0xfffffff); mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent contentIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Hello") .setStyle(new NotificationCompat.BigTextStyle().bigText("Hello")) .setContentText("This is your notification content") .setAutoCancel(true) mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(uniqueId, mBuilder.build()); } Waking up the phone is quite different matter. You can do it using a WakeLock this way: When you set your notification: WakeLock screenOn = ((PowerManager)getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "test"); screenOn.acquire(); And yes, DON'T FORGET TO release the wakelock when you don't need it anymore (may be after 5 seconds or on tap of notificaton; as required per your need): screenOn.release();
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26595041
downvote count: 0
answers question: http://stackoverflow.com/q/26595041
has comment: http://stackoverflow.com/comment/41805658

http://stackoverflow.com/comment/41773354
comment on: http://stackoverflow.com/q/26577873
has text: Is the point of your assignment to write a search algorithm, or are you looking for an easier way to search a data structure, something like ArrayList.contains()? I'm thinking ArrayList is the way to go here, since you state that the code should keep asking for input until the termination character is entered, suggesting an open ended situation. Use arrays when you know in advance the precise size of your input and ArrayList otherwise.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26550427
upvote count: 1
has body: Is it possible to start/run/execute a jar within an Applet? If it is possible, how can I do this?
downvote count: 1
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26606375
has answer: http://stackoverflow.com/a/26550854
has answer: http://stackoverflow.com/a/26606375
tagged with: classpath
type: Question
score: 0
answer count: 2
tagged with: jar
tagged with: applet
favorite count: 0
accepted answer: http://stackoverflow.com/a/26550854
has title: Is it possible to execute a jar within an Applet?
has comment: http://stackoverflow.com/comment/41723134
has comment: http://stackoverflow.com/comment/41723055

http://stackoverflow.com/comment/41926023
has text: Yes, I understand this, but what I am trying to say is that, regardless of the size of my table in the frame, and regardless if I use "NORMAL" or "FIT_WIDTH", the printed table is always at the same size. Maybe it's something related to the custom print code?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26598867
type: AnswerComment

http://stackoverflow.com/q/26639825
score: 0
duplicate of: http://stackoverflow.com/q/2206378
has comment: http://stackoverflow.com/comment/41887381
answer count: 1
has comment: http://stackoverflow.com/comment/41887157
has comment: http://stackoverflow.com/comment/41886876
has comment: http://stackoverflow.com/comment/41887617
has title: keep delimiter "-" with after the string is split("-")
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26639859
tagged with: java
has comment: http://stackoverflow.com/comment/41886780
type: Question
has body: I was wondering what's the best approach to keep the delimiter with the aftermath String after its split("-"). So here is the code: String word = "abc -def ghi -jkl -mno pqr"; String[] strArr= null; strArr = word.split("-"); ... here we iterate through array it will print: abc def ghi jkl mno pqr but I want to keep the delimiter and it should look something like: abc -def ghi -jkl -mno pqr One way is, while iterating, to concatenate the "-" delimiter, but I was wondering if there is a better way.
has comment: http://stackoverflow.com/comment/41886988
linked to: http://stackoverflow.com/q/2206378
accepted answer: http://stackoverflow.com/a/26639859
has comment: http://stackoverflow.com/comment/41887265

http://stackoverflow.com/comment/41705206
type: Comment
type: QuestionComment
has text: i can get all the info, just cant see the photo. and sorry about the runnable example thing, old but new
comment on: http://stackoverflow.com/q/26539833
score: 0

http://stackoverflow.com/q/26544567
tagged with: java
accepted answer: http://stackoverflow.com/a/26544668
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26544759
has body: I have an object represented as follows: public final class FooFunc&lt;KEYIN extends WritableComparable, VALUEIN extends Writable, KEYOUT extends WritableComparable, VALUEOUT extends Writable&gt; extends FooFunction&lt;T&lt;KEYIN,VALUEIN&gt;, T&lt;KEYOUT,VALUEOUT&gt;&gt; implements Q&lt;T&lt;KEYOUT,VALUEOUT&gt;&gt;, S private transient Mapper&lt;KEYIN,VALUEIN,KEYOUT,VALUEOUT&gt; mapper; // main is this line ... } I am working with mappers, whose information is available at: link Mapper has some protected members (setup, cleanup and map methods) which I would like to access, but I am not able to access them. How should I design this in order to make sure that I can access those methods?
score: -1
tagged with: protected
has answer: http://stackoverflow.com/a/26544668
favorite count: 0
has title: Accessing protected class in java
downvote count: 2
possible better answer: http://stackoverflow.com/a/26544759
upvote count: 1
has comment: http://stackoverflow.com/comment/41712874
tagged with: mapper
type: AnsweredQuestion

http://stackoverflow.com/comment/41806213
type: QuestionComment
has text: more vs "Hey I expected this but I did not get it(for whatever reason). Now go and fix me so that I get what I expect"
score: 0
comment on: http://stackoverflow.com/q/26595452
type: Comment

http://stackoverflow.com/comment/41830983
comment on: http://stackoverflow.com/a/26589453
has text: @Anita Yes, The other way is to install manually your jar files in local repository, but this is strange because to start a build lifecycle to maven you must have them declared in your pom
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26670526
has body: Maybe you should use instead of List data parameter some wrapper, that will contain your List data and additional information about it (for example hash code of url). Also please use "".equals(downloadedData) instead of downloadedData.equals("") because if downloadedData is null...
answers question: http://stackoverflow.com/q/26669906
score: 0
type: Answer

http://stackoverflow.com/comment/56388416
comment on: http://stackoverflow.com/a/34299803
type: AnswerComment
has text: @David, did you prove it's wrong? It did work for my apache-tomcat-8.0.28
score: 0
type: Comment

jsf
tags question: http://stackoverflow.com/q/26661260
type: Tag
tags question: http://stackoverflow.com/q/26635725
tags question: http://stackoverflow.com/q/26602436
tags question: http://stackoverflow.com/q/26657368
tags question: http://stackoverflow.com/q/26640896
tags question: http://stackoverflow.com/q/26654963
tags question: http://stackoverflow.com/q/26573468
tags question: http://stackoverflow.com/q/26592310
tags question: http://stackoverflow.com/q/26629149
tags question: http://stackoverflow.com/q/26659584
tags question: http://stackoverflow.com/q/26536128
tags question: http://stackoverflow.com/q/26604103
tags question: http://stackoverflow.com/q/26578890
tags question: http://stackoverflow.com/q/26585190
tags question: http://stackoverflow.com/q/26517547
tags question: http://stackoverflow.com/q/26580442
tags question: http://stackoverflow.com/q/26671600
tag name: jsf
tags question: http://stackoverflow.com/q/26607603
tags question: http://stackoverflow.com/q/26649315
tags question: http://stackoverflow.com/q/26548318
tags question: http://stackoverflow.com/q/26592576
tags question: http://stackoverflow.com/q/26530242
tags question: http://stackoverflow.com/q/26623527
tags question: http://stackoverflow.com/q/26588307
tags question: http://stackoverflow.com/q/26612691
tags question: http://stackoverflow.com/q/26547522
tags question: http://stackoverflow.com/q/26605156
tags question: http://stackoverflow.com/q/26584863
tags question: http://stackoverflow.com/q/26546565

http://stackoverflow.com/comment/41691074
type: AnswerComment
score: 0
has text: I tried it, it only show the beginning of the string then it disappears
type: Comment
comment on: http://stackoverflow.com/a/26529411

http://stackoverflow.com/q/26566277
has body: I have an array that contains dashes and dots. The goal is to fire a "laser" into this array at a certain location that the user decides. In this case row 5 was where they shot. I need to now iterate through that row and change all the dots to dashes ( - ) or ( | ) depending on if its going east to west or north to south. When it hits a dash, it is supposed to act as a mirror and reflect off and continue in another direction. Can anyone help with the loop to do this? I keep putting the dashes in the wrong place. Any help is appreciated. 0 . . . . . / . . . \ 1 . . \ . . . . . . . 2 . . . . . . . / . . 3 . . . . . . . . . . 4 . . . . . . . . \ . 5&gt;. . . . . . . . . . 6 . . . . . . . . . . 7 . . . . . \ . . / . 8 . . \ . . . . . . / 9 . . . . . . . . . . Possible final 0 . . . . . / - - - \ 1 - - \ . . | . . . | 2 . . | . . | . / . | 3 . . | . . | . . . | 4&gt;- - - - - - - - \ | 5 . . | . . | . . | | 6 . . | . . | . . | | 7 . . | . . \ - - / | 8 . . \ - - - - - - / 9 . . . . . . . . . . Basically this could be the end of the grid after the laser is shot through row 4
tagged with: arrays
has comment: http://stackoverflow.com/comment/41753149
score: 0
answer count: 2
type: UnansweredQuestion
has title: Iterating through an array and replacing characters
tagged with: java
has answer: http://stackoverflow.com/a/26566568
tagged with: grid
has answer: http://stackoverflow.com/a/26566788
type: Question

http://stackoverflow.com/a/26625602
upvote count: 3
has body: As @Jeroen Vannevel and @EJP have mentioned above it's both overriding and implementing. In order to understand this I think you need to see it in the context of compile/run time. You have the following possible scenarios: C c = new B(); c.check(); At compile-time you see C#check() (you can use your IDE to get you where c.check() points to) at runtime you see the overridden B#check() A a = new B(); a.check(); At compile-time you see A#check() (you can use your IDE to get you where c.check() points to) at runtime you see the overridden B#check() B b = new B(); b.check(); At compile-time you see B#check() (you can use your IDE to get you where c.check() points to) at runtime you see the overridden B#check() If alternatively you are passing the method call directly in a method: someMethod(new B().check()) then this equates the last of the above scenarios
type: Answer
answers question: http://stackoverflow.com/q/26625435
score: 3
downvote count: 0

http://stackoverflow.com/a/26669744
has body: Try something like this: WeatherModel weatherModel = new WeatherModel(); weatherModel.setArea( myAreaData[areaIdx] ); for( int partIdx = 0 ; partIdx&lt; 7; partIdx++ ) { Interval interval = new Interval(); interval.setDescription( myPartData[partIdx] ); weatherModel.getIntervals().add(interval); } It would be helpful if you can share the XML as well
answers question: http://stackoverflow.com/q/26669401
accepted answer of: http://stackoverflow.com/q/26669401
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41868229
type: Comment
has text: And you'll need a printer allowing you to send PDFs over TCP (or FTP) that can render and print them... only a few printers can do that... for you to research ;) but it is possible!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26629526

http://stackoverflow.com/comment/82263686
type: AnswerComment
type: Comment
has text: @Holger inheritable, but not overridable, pretty weird situation
score: 1
comment on: http://stackoverflow.com/a/26522224

http://stackoverflow.com/comment/42014847
type: AnswerComment
has text: I knew it wouldn't work as it is :) By looking at similar problems, do you have getters and setters in `JoinTablePK` class, for `mainTableId` and `thirdTableId`?
type: Comment
comment on: http://stackoverflow.com/a/26679814
score: 0

http://stackoverflow.com/q/26589229
has body: I need to specify multiple template loader paths for FreeMarker in a Spring Boot web application but the FreeMarkerAutoConfigurationClass only let me specify one path using the spring.freemarker.templateLoaderPath property, which uses the setTemplateLoaderPath method in the FreeMarkerConfigurationFactory. However, this class allows me to set multiple path using the setTemplateLoaderPaths method. Which is the best way to override this auto-configuration class and specify multiple loader paths? I don't really understand well the Spring Java config classes and I want an example for this before write the code I need. I'm using Spring Boot 1.1.2. Thanks in advance.
favorite count: 0
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
tagged with: spring-boot
has answer: http://stackoverflow.com/a/26592805
upvote count: 3
tagged with: java
type: Question
has title: How do I specify multiple templateLoaderPaths for Freemarker in Spring Boot?
downvote count: 0
accepted answer: http://stackoverflow.com/a/26592805
tagged with: freemarker
answer count: 1

http://stackoverflow.com/a/26670674
has body: One mistake is initializing the count inside the loop. It should be outside. It should also be a double if the map holds Double values. double c = 0.0; for (String k : word1.keySet()) { System.out.println(k + "\t" + word1.get(k)); if (words1.get(k) != null) c += word1.get(k); } Now, if you are getting an exception, your map may contain null values. If that's the case, add a null check as in the code above.
has comment: http://stackoverflow.com/comment/41942178
type: Answer
answers question: http://stackoverflow.com/q/26670627
has comment: http://stackoverflow.com/comment/41941887
has comment: http://stackoverflow.com/comment/41941901
score: 0

http://stackoverflow.com/a/26629124
score: 0
answers question: http://stackoverflow.com/q/26628789
has body: synchronized (Integer.class) { method2(); } when you calling this method2(); then its not giving lock to any kind of mehtod its continues goes to the method that you are calling means this. private void method2() { synchronized (Integer.class) { System.out.println("hi there"); } } and after completing its returning. so there is no case of dead lock. hope this explanation helps.
type: Answer

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26576386
tags question: http://stackoverflow.com/q/26621907
tags question: http://stackoverflow.com/q/26518671
tags question: http://stackoverflow.com/q/26586260
tags question: http://stackoverflow.com/q/26550851
tags question: http://stackoverflow.com/q/26587631
tags question: http://stackoverflow.com/q/26634742
tags question: http://stackoverflow.com/q/26622721
tags question: http://stackoverflow.com/q/26639598
tags question: http://stackoverflow.com/q/26581057
tags question: http://stackoverflow.com/q/26563213
tags question: http://stackoverflow.com/q/26647840
tags question: http://stackoverflow.com/q/26567315
tags question: http://stackoverflow.com/q/26547467
tags question: http://stackoverflow.com/q/26576260
tags question: http://stackoverflow.com/q/26542814
tags question: http://stackoverflow.com/q/26612333
tags question: http://stackoverflow.com/q/26605671
tags question: http://stackoverflow.com/q/26578037
tags question: http://stackoverflow.com/q/26633957
type: Tag
tags question: http://stackoverflow.com/q/26570338
tags question: http://stackoverflow.com/q/26636178
tags question: http://stackoverflow.com/q/26621292

http://stackoverflow.com/comment/41858490
type: QuestionComment
type: Comment
has text: Your exception is saying that you are trying to call a constructor that takes 3 ints, but not passing any values to it. You need to overload the constructor, or remove the call Date today = new Date(); from the main program.
comment on: http://stackoverflow.com/q/26624153
score: 0

http://stackoverflow.com/comment/52584039
type: Comment
has text: No. No. In our case we already have the .so file packaged in the jar. We were trying to write/add a class in the jar itself to load the so file during runtime. We used the above code do so. The result is, the lib is extracted to temp directory and the `System.load()` is also executed, but when tried to access the lib it fails. Are we missing something ?
comment on: http://stackoverflow.com/a/26801997
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41842303
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26598725
has text: For some reason I cannot plug this piece of code. I get following: The method until(Function<? super WebDriver,T>) in the type Wait<WebDriver> is not applicable for the arguments (new Function<WebDriver,Boolean>(){}). Which Function package is that?

http://stackoverflow.com/comment/41911121
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26637477
has text: If things weren't so complicated to set up compile-time weaving, I think this would have been the way I went. It provides the flexibility I need, but I don't think it's worth the effort to set up compile-time weaving in my development environment using Eclipse and Gradle. I'll mark this correct because it probably would have been the solution had I pursued it further. Thanks!

http://stackoverflow.com/q/26653529
tagged with: encoder
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26742952
tagged with: decoder
type: AnsweredQuestion
tagged with: pcap
has answer: http://stackoverflow.com/a/26742952
tagged with: jnetpcap
tagged with: java
has title: Encoding and Decoding of Pcap Packets
type: Question
has body: I need to convert packets to byte format and decode it . How is it possible to convert packets captured using jnetpcap library to array[bytes] and vice-versa in Java?

http://stackoverflow.com/comment/41721848
type: Comment
type: QuestionComment
score: 0
has text: Are you sure you are inflating Register.xml view file you provided? Copy and paste a full error stacktrace in your question so we could see some more details.
comment on: http://stackoverflow.com/q/26549602

http://stackoverflow.com/comment/41708260
has text: @Multisync maybe i missunderstand you but this my problem - get string representation of timestamp with time zone
comment on: http://stackoverflow.com/q/26541733
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26638388
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/32744230
score: 0
tagged with: rest
has title: Connect to Neo4J with Android
tagged with: android
type: UnansweredQuestion
has body: I am trying to connect to my localhost (Neo4J database) from an Android application. The way to do this, is using a few libraries: neo4J-rest-graphdb-1.8.1.jar neo4J-rest-graphdb-1.8.1-javadoc-.jar neo4J-rest-graphdb-1.8.1-sources.jar neo4J-rest-graphdb-1.8.1-test-sources.jar neo4J-rest-graphdb-1.8.1-tests.jar neo4j-server-1.8.M03.jar When I add those libraries to my Java Build Path it can use them to connect to the Neo4J database, like this: import org.neo4j.rest.graphdb.RestAPI; import org.neo4j.rest.graphdb.RestAPIFacade; import org.neo4j.rest.graphdb.query.QueryEngine; import org.neo4j.rest.graphdb.query.RestCypherQueryEngine; import org.neo4j.rest.graphdb.util.QueryResult; RestAPI graphDb = new RestAPIFacade("http://localhost:7474/db/data"); QueryEngine engine=new RestCypherQueryEngine(graphDb); QueryResult&lt;Map&lt;String,Object&gt;&gt; result = engine.query("create (:Person {name:\"Steve\"}) return n", Collections.EMPTY_MAP); Iterator&lt;Map&lt;String, Object&gt;&gt; iterator=result.iterator(); if(iterator.hasNext()) { Map&lt;String,Object&gt; row= iterator.next(); int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(getApplicationContext(),"" + row.get("total") , duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } The problem is that I keep getting an error: NoClassDefFoundError org.neo4j.rest.graphdb.RestAPIFacade. I think it's because of missing a jar file for the build path... But I am not sure.. Maybe something else is going wrong. I already tried to install Maven.. But that wont install via the marketplace it says that its missing repositories. Any help would be great!
linked to: http://stackoverflow.com/q/4779963
tagged with: java
type: Question

http://stackoverflow.com/q/26531835
answer count: 0
upvote count: 3
tagged with: java
tagged with: mysql
has title: How to ping MySQL database using spring datasource properties
type: Question
tagged with: heroku
score: 3
has comment: http://stackoverflow.com/comment/41690613
has comment: http://stackoverflow.com/comment/41697991
has comment: http://stackoverflow.com/comment/41690325
downvote count: 0
has comment: http://stackoverflow.com/comment/41690480
has body: I'm using Spring Boot with the following application.properties file for my database setup: spring.datasource.url=jdbc:mysql://&lt;my heroku cleardb host...&gt;/&lt;my db&gt; spring.datasource.username=&lt;some user...&gt; spring.datasource.password=&lt;some pass...&gt; spring.datasource.driverClassName=com.mysql.jdbc.Driver I'm hosting my site on Heroku with ClearDB MySQL Database. My app keeps getting disconnected from the MySQL DB and it's because of this (from their support team): To jump in here about this issue - the reason is that our systems automatically close all idle connections after 90 seconds of inactivity. This could be the reason you are running into this issue, especially if your connection pool is not properly configured to "ping" connections in less than around 90 seconds. Our recommendation would be to set the connection pool configuration to ping all pooled connections once every 60 seconds for safe keeping. So the question is...how can I "ping" my connections every 60 seconds? I would like to believe that there is a way to set a spring.datasource property to do this but I'm having trouble finding a 'ping' property.
favorite count: 0
type: UnansweredQuestion
tagged with: spring
linked to: http://stackoverflow.com/q/4569956

http://stackoverflow.com/q/26612659
has comment: http://stackoverflow.com/comment/41882326
has comment: http://stackoverflow.com/comment/41837633
has answer: http://stackoverflow.com/a/26612797
has title: Java JSON recovers only one item
score: 0
has comment: http://stackoverflow.com/comment/41838474
has body: In a desktop software, the user is available to presh a button and refresh the "database". All the info is provided by an online service which returns JSON responses, those responses are saved into DAT files and then parsed with http://www.json.org/java/index.html in order to be saved into in-memory variables as String. The DAT files are only for break-exception-support. Ok, so I'd created a SwingWorker class which should: parse the content from the in-memory variable iterate through elements recover items update a progress bar This is an example of the JSON code: { "key":"value", "data":{ "Name1":{...}, "Name2":{...}, [...] } } The full iteration of the "data" element will create a List, which I must use to create a JTable and populate the main frame of the GUI. But when executing the SwingWorker, it only returns a List which all elements are the last item of the JSON. Here's the code the SwingWorker: package com.wolfchamane.lolapi; import com.wolfchamane.logging.LoCLogger; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.swing.*; import org.json.JSONArray; import org.json.JSONObject; public class LoLChampions extends SwingWorker{ private static List&lt;LoLChampion&gt; _list; private static JProgressBar _status; private static LoCLogger _log; private static String _exePath; private static String _version; private static LoLDDBB _ddbb; //private static int _max; public List&lt;LoLChampion&gt; getDataTable(){ return _list; } public LoLChampions(){} public LoLChampions(JProgressBar status){ this(); _status = status; } public LoLChampions(JProgressBar status, LoCLogger log){ this(status); _log = log; } public LoLChampions(JProgressBar status, LoCLogger log, String path){ this(status, log); _exePath = path; } public LoLChampions(JProgressBar status, LoCLogger log, String path, LoLDDBB ddbb){ this(status, log, path); _ddbb = d…
tagged with: swing
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41883704
has comment: http://stackoverflow.com/comment/41838393
has comment: http://stackoverflow.com/comment/41940285
type: Question

http://stackoverflow.com/comment/41933570
comment on: http://stackoverflow.com/q/26665839
score: 0
type: QuestionComment
has text: Investigate the null pointer exception and your json call
type: Comment

http://stackoverflow.com/q/26620132
has comment: http://stackoverflow.com/comment/41851171
score: 0
has body: I am having a problem with a plugin I maintain, in that, in the next version of our app, a collection I need to access from the plugin changes type from a Hashset to an ArrayList. What I need is to have a single jar for my plugin, which is able to access the collection in the main app, regardless of the version/collection type. currently if i compile my plugin against V1 (with the Hashset) the plugin will load on both V1 and V2 but hang when trying to access that collection on V2 And if i compile my plugin against V2 (with the ArrayList) the plugin will load on both V1 and V2 but hang when trying to access that collection on V1 I was able to work around this issue using reflection. I'm not sure if its the best or fastest way to do this, but it seems to work fine for now... List&lt;MainPurpose&gt; listOfMps = new ArrayList&lt;MainPurpose&gt;(); try { Method getMps = cs.getContact().getClass().getMethod("getMainPurposes", (Class&lt;?&gt;[]) null); if (getMps.getReturnType().isAssignableFrom(Set.class)) { Set&lt;MainPurpose&gt; mps = (Set&lt;MainPurpose&gt;) getMps.invoke(cs.getContact(), (Object[]) null); listOfMps.addAll(mps); } else if (getMps.getReturnType().isAssignableFrom(List.class)) { List&lt;MainPurpose&gt; mps = (List&lt;MainPurpose&gt;) getMps.invoke(cs.getContact(), (Object[]) null); listOfMps.addAll(mps); } } catch (Exception e) {}
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/41851370
tagged with: java
tagged with: collections
type: Question
has title: code to handle multiple possible collection types in exteral library versions

http://stackoverflow.com/comment/41866783
comment on: http://stackoverflow.com/a/26629052
has text: So, In resume: I need to change the web server configuration, not the *.war, correct?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26661063
has title: easiest way to add parameters to criteria query
tagged with: criteria
has answer: http://stackoverflow.com/a/26690552
tagged with: jpa
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26690552
type: AnsweredQuestion
has body: I want to find the easiest solution for situation in which you have a query method, which takes some attribute of an entity and based on that attribute performs query which returns that entity. The question is, if I want to add more attributes by which I can search for entity, what is the easiest solution when using jpa criteria? One aspect here is that the method has to be portable - if I add attributes later, I don't want to rewrite all my code. I know that this can be done by method overloading, but I'm searching for easier solution. For example my method's code is: public List&lt;Car&gt; findCar(String name) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Car&gt; c = cb.createQuery(Car.class); Root&lt;Car&gt; d = c.from(Car.class); Predicate condition = cb.equal(d.get(Car_.name), name); c.where(condition); TypedQuery&lt;Car&gt; q = em.createQuery(c); List&lt;Car&gt; results = q.getResultList(); return results; } What should I do if I want to extend this query in a way I can search for Car entity by other attributes, for example, Date. I do not want that this method would take more than one argument.
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/26581543
has comment: http://stackoverflow.com/comment/41779573
tagged with: queue
type: Question
tagged with: modulo
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26581722
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/41779758
has comment: http://stackoverflow.com/comment/41779778
tagged with: integer
has comment: http://stackoverflow.com/comment/41779618
has title: How to sort Integer Stream using queue? Lab JAVA
upvote count: 1
has comment: http://stackoverflow.com/comment/41779769
has answer: http://stackoverflow.com/a/26581722
type: AnsweredQuestion
score: 1
tagged with: java
has body: Okay so this program needs to separate a stream of integers using a queue. I get an output but it's not in the desired order which is firstly integers divisible by 3 then 1%3 then 2%3 Any suggestions? Here is my code: import java.util.Random; public class Oct22 { public static void main(String[] arg) { int x; Random rnd = new Random(); Queue&lt;Integer&gt; queue = new ArrayQueue&lt;Integer&gt;(); Queue&lt;Integer&gt; queue2 = new ArrayQueue&lt;Integer&gt;(); //for(char c='a'; c&lt;= 'z'; c++) // queue.add(c); for(int i=0;i&lt;20;i++) queue2.add(rnd.nextInt(100)); for(int i=0;i&lt;queue2.size();i++) { x=queue2.remove(); if(x%3==0) queue.add(x); else queue2.add(x); } for(int i=0;i&lt;queue2.size();i++) { x=queue2.remove(); if(x%3==1) queue.add(x); else queue2.add(x); } for(int i=0;i&lt;queue2.size();i++) { x=queue2.remove(); if(x%3==2) queue.add(x); else queue.add(x); } System.out.println(queue.size()); System.out.println(queue2.size()); System.out.println("the size of queue is: " + queue.size()); while(!queue.isEmpty()) System.out.print(queue.remove()+ " "); System.out.println("\n---------------------------------"); while(!queue2.isEmpty()) System.out.print(queue2.remove()+" "); } }

http://stackoverflow.com/comment/41880095
score: 0
type: AnswerComment
type: Comment
has text: Check C:\Program Files\Java, may be it has jdk directory, doesn't matter from where. After that you can change environment variable JAVA_HOME to your jdk 6 in the D:
comment on: http://stackoverflow.com/a/26636119

http://stackoverflow.com/comment/41839412
comment on: http://stackoverflow.com/a/26611687
has text: @vladEnacho Yes. You should make it a static Hashmap and declare it within the class if you're implementing everything in the main method.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/26642720
accepted answer: http://stackoverflow.com/a/26647882
favorite count: 0
possible better answer: http://stackoverflow.com/a/45509346
tagged with: localization
linked to: http://stackoverflow.com/q/27420236
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40737684
has title: Proper Russian month string translation Java
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/41017092
type: Question
score: 20
has answer: http://stackoverflow.com/a/26647882
has answer: http://stackoverflow.com/a/65477553
upvote count: 20
downvote count: 0
has body: I want to convert a Date in to Russian and using the code below SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG,locale).format(date); where locale is of type Locale The problem is months are not parsed correctly . January is coming as "январь" it should be "января" and February is coming as "февраль" should be "февраля" and so on... One idea is to convert incorrect months to proper ones in my logic Is there any thing by which Java do this automatically ? Thanks
answer count: 6
has answer: http://stackoverflow.com/a/26643100
has answer: http://stackoverflow.com/a/45509346

http://stackoverflow.com/q/26653666
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/26654116
has title: WSDL with duplicate names -- how to force Java Class names
tagged with: wsdl
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: Background: We are developing an application that communicates with several 3rd party webservices. Sadly, one of them has defined a WSDL file using poor naming conventions. The same names are often re-used for a response element, and the complexType that it employs. The code snipped below shows one such occurrence as an example: &lt;s:element name="Reset_PasswordResponse"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="Reset_PasswordResult" type="tns:ResetPasswordResponse" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:complexType name="ResetPasswordResponse"&gt; &lt;s:complexContent mixed="false"&gt; &lt;s:extension base="tns:BaseResponse" /&gt; &lt;/s:complexContent&gt; &lt;/s:complexType&gt; We use Maven cxf codegen plugin (jaxb/jax-ws) to compile this to Java classes. To avoid the name clashes, we have formerly used the option -AutoNameResolution. However, we have found that this leads to unexpected results, where on some machines one class gets renamed to ResetPasswordResponse2.java, while on other machines the other class is renamed. This makes collaborative development very difficult, and also gives us worries for the future (what if it won't compile correctly on Jenkins at some point?) Question: I am looking for a way to manually determine how the translation/renaming should take place. I am told that simply changing the names in the WSDL will not work, because the xml naming annotations in the Java files are of importance. I have also looked into binding files or inline binding statements, but cannot get it to work. The documentation at http://wiki.netbeans.org/WsdlCustomizer#Class_Customization seems to imply that name changes are only possible for "wsdl:portType, wsdl:fault, soap:headerfault, and wsdl:server", which indicates I might be trying to do something that is simply impossible. Are jaxb/jax-ws bindings a possible solution? Are there other options?
linked to: http://stackoverflow.com/q/21685003
has answer: http://stackoverflow.com/a/26654116
linked to: http://stackoverflow.com/q/25687186
tagged with: web-services
type: Question
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/41916075
type: QuestionComment
has text: As you can see on an answer you have to refill friend with the original content if a backspace is involved. And certainlt when results.count==0.
comment on: http://stackoverflow.com/q/26652707
score: 0
type: Comment

http://stackoverflow.com/q/26515829
possible better answer: http://stackoverflow.com/a/26515943
has title: How do I get my toolbar to show?
score: 0
answer count: 2
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/26516054
type: AnsweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/26516054
has body: I have this GUI and it works perfectly however now I wanted to add a toolbar which will have a "File" button that will go down with two options, which are Exit and About. Exit is supposed to close the GUI while About should give out another JFrame box that contains a string about the assignment. For some reason, I could not get my JMenubar to show up there when I run the program. I can type stuff which lets me know if a word or a string is palindrome or not but did not have any luck with toolbar. How should I implement it so that my toolbar shows with "file" button that will have two options below? I am not so good when it comes to GUI's so I would be happy if you walk me through this. Thanks Here is my code below import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Owner */ public class PalindromGUI extends JFrame { private JTextField TextField; private JTextArea textArea; private JMenuBar menubar; private JMenuItem exit; /** * @param args the command line arguments */ public static void main(String[] args) { PalindromGUI gui = new PalindromGUI(); gui.setVisible(true); } public PalindromGUI() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(50,50,90,650); //Create a panel and add components to it. JPanel contentPane = new JPanel(); BorderLayout experimentLayout = new BorderLayout(); contentPane.setLayout(…
has answer: http://stackoverflow.com/a/26515943
type: Question
tagged with: java

http://stackoverflow.com/comment/41757452
score: 0
comment on: http://stackoverflow.com/a/26569179
has text: +1 Actually that's a good point. In a tight loop where something like this is going to even matter, it's probably already in the registry if not merely the cache. One means we have both foo, 1234, and foo - 1234 in the registry. The other means we only have foo and 1234. So even if the CPU cycles are a wash there is going to be a space difference.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26596946
has comment: http://stackoverflow.com/comment/41811418
type: Question
has title: Java Time zone transition period from EDT to EST
has body: Problem statement: Convert "2014-11-02 01:00:15 EST" to GMT. This seems easy enough. But why is the below code giving the wrong answer? Background: EDT aka GMT-4 EST aka GMT-5 2014-11-02 01:00:15 EST == 2014-11-02 06:00:15 GMT If I user the commented out date string it works!!! EDT(until Nov 2, 2014 at 2am) -> at 2am we go to 1am EST Code Example: ZoneId gmt = ZoneId.of("GMT"); //String from = "2014-11-02 01:00:15 GMT-05:00"; String from = "2014-11-02 01:00:15 EST"; final DateTimeFormatter dateTimeFormatterone = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z"); ZnedDateTime zonedDateTime = ZonedDateTime.parse(from, dateTimeFormatterone); ZonedDateTime gmtzonedDateTime = zonedDateTime.withZoneSameInstant(gmt); String result = gmtzonedDateTime.format(dateTimeFormatterone); This is what the outcome is. result == "2014-11-02 05:00:15 GMT" Shouldn't it be result == "2014-11-02 06:00:15 GMT" Any help would be great. I am thinking this is a bug in Java. But I am also think I am making a error somewhere. Thanks Paul
upvote count: 1
answer count: 1
favorite count: 0
tagged with: timezone
tagged with: dst
has comment: http://stackoverflow.com/comment/41837877
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26598670
has comment: http://stackoverflow.com/comment/41808579
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/41893866
has text: What line is line 57?
score: 0
comment on: http://stackoverflow.com/q/26643725
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41682034
has text: I don't agree, the onFailure method should be simple. By adding logic in the onFailure method your spreading logic that actually belongs to the service that's being called to client-logic, making it harder to maintain.
comment on: http://stackoverflow.com/a/26527464
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/115152485
comment on: http://stackoverflow.com/q/26651032
has text: @payne Unfortunately not.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26573723
answer count: 0
has body: I'm not really a Pattern user and I'm trying to change that. I'm reading about this Design Pattern and from what I understand the whole idea is that I should implement Clonable and use clone() method to make a new object based on existing one. Is that what this Pattern is about or is it more to it ?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17203493
tagged with: design-patterns
tagged with: java
has comment: http://stackoverflow.com/comment/41766572
type: Question
tagged with: prototype
score: 0
has title: Is Prototype Design Pattern just an implementation of Clonable?
has comment: http://stackoverflow.com/comment/41777118

http://stackoverflow.com/q/26590141
has title: swapping column from a text file in Java
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41795275
type: UnansweredQuestion
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41795123
has body: I am having some problems with this code. I need to write a code where it says SwapField to display columns from a text file and swaps column 2 to be column 1. public static void main(String[] args) { int lineNum = 0; String delimiter = " "; if (args.length != 3) { System.out.println("USAGE: java SwapColumn fileName column# column#"); System.exit(-1); } String dataFileName = args[0]; String columnAText = args[1]; String columnBText = args[2]; int columnA = Integer.parseInt(columnAText); int columnB = Integer.parseInt(columnBText); File dataFile = new File(dataFileName); Scanner input; String outputText = null; System.out.printf("dataFileName=%s, columnA=%d, columnB=%d\n", dataFileName, columnA, columnB); try { input = new Scanner(dataFile); while (input.hasNextLine()) { String inputText = input.nextLine(); lineNum++; outputText = swapFields(inputText, columnA, columnB, delimiter); System.out.printf("%d: %s\n", lineNum, outputText); } } catch (FileNotFoundException FNF) { System.out.printf("file not found: %s\n", dataFileName); } } static String swapFields(String input, int fieldA, int fieldB, String delim) { String outputBuffer = ""; //code needed here return outputBuffer; }
tagged with: java
has comment: http://stackoverflow.com/comment/41795632
has answer: http://stackoverflow.com/a/26590287
type: Question

http://stackoverflow.com/a/26630626
answers question: http://stackoverflow.com/q/26630469
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41896737
upvote count: 2
has body: General answer - You should use PrepareStatement instead of Statement and execute as batch. Common way to insert multiple entry or execute String sql = "INSERT INTO student (studentid, titleid, forename, familyname, dateofbirth) " + "VALUES (?, ?, ?, ?, ?);"; ps = connection.prepareStatement(SQL_INSERT); for (int i = 0; i &lt; entities.size(); i++) { ps.setString(1, entity.get...()); ... ps.addBatch(); } ps.executeBatch(); Important Note: Why you should use PrepareStatement Over Statement SQL Injection Example
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26630469
has comment: http://stackoverflow.com/comment/41895133
type: Answer

http://stackoverflow.com/comment/41989236
has text: What other person? I know what it means. I just am confused. 1 is a whole number, and that is a part of what was a token before, then _ that is the split that tells that 1/2 is a fraction. I want to convert 1 to 2/2 and add it to 1/2 to be 3/2 and be divided to 1.5 to follow an entered expression suit
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26645243
type: Comment

http://stackoverflow.com/a/26517493
upvote count: 5
type: Answer
downvote count: 0
has body: This happens because the ternary operator always evaluates to a single type, and in your case Java figures that given your second and third parameter, the final type should be Double, and therefore it converts the Integer to match. You can cast to make it return a Number instead: Number zero = ((stepSize instanceof Double) ? (Number) ZERO_D : ZERO_I);
accepted answer of: http://stackoverflow.com/q/26517285
score: 5
answers question: http://stackoverflow.com/q/26517285
has comment: http://stackoverflow.com/comment/41664959
type: AcceptedAnswer

http://stackoverflow.com/comment/41833655
has text: @Giordano Hmmm, maybe then better use `WindowListener`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26587077

http://stackoverflow.com/comment/41811392
score: 0
comment on: http://stackoverflow.com/q/26598536
has text: BTW, I can scan on other columns no problem with the above code
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41845415
type: Comment
comment on: http://stackoverflow.com/a/26617049
score: 0
type: AnswerComment
has text: @LeeDanielCrocker Isn't it already, though? The Random objects are being created in separate methods, so they're never reused.

http://stackoverflow.com/q/26647399
has answer: http://stackoverflow.com/a/26647400
has body: Within a Java EE context, specifically in a CDI ApplicationScoped object, I need to force a rollback of a container-managed transaction. (it's a combination of a JPA (trans-)action and some filesystem action, the later is not really transactional, so I have to manually do some things) I was able to use SessionContext before, but after injection of some more dependencies, the framework (Weld CDI inside WildFly 8.1.0) does not mark my ApplicationScoped object as a session- or message-driven bean anylonger. (according to the error-message and most probably rightfully so) So the question is: is there an alternative? I did look into UserTransaction, but is 'suffers' the same limitation as SessionContext.
accepted answer: http://stackoverflow.com/a/26647400
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Can anyone point me to an alternative for JavaEE SessionContext
type: Question
tagged with: jakarta-ee
tagged with: jta
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cdi

http://stackoverflow.com/a/26527212
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41683482
has body: public Order (String productName, int quantity){ // same as you did "orderNum = orderNum + 1" and "orderNum += 1". // I added "this" in the beginning because "orderNum" is not a variable // you declared in the constructor so it will be from the class. // BTW make sure you initialized the variable. this.orderNum++; // I think you are doing this part by mistake without understanding. So I commented this part. // what this code means is: set the value of variable "productName" (that you declared in the // method, the first parameter) of the value of variable "this.productName" (that you declared // in the root of the class, like orderNum) // productName = this.productName; // The quantity parameter is to be passed to the testQuantity method. // general way to call a method is &lt;method name&gt;(); "()" means execute // any information you want to pass as parameter goes inside the parenthesis testQuantity(quantity); // Following this a call to the getPrice method should be made passing the productName parameter // same rules here. getPrice(productName); // However, you are not storing the values after you calling the methods. // if you have any further questions feel free to comment and I will reply asap. // Good Luck! }
has comment: http://stackoverflow.com/comment/41683335
downvote count: 0
answers question: http://stackoverflow.com/q/26526791
type: Answer

http://stackoverflow.com/comment/41783825
comment on: http://stackoverflow.com/q/26583659
type: Comment
type: QuestionComment
has text: Play 2.3 uses Akka 2.3, so you should file a bug or make very sure your initial delay is calculated correctly.
score: 0

http://stackoverflow.com/q/26622245
answer count: 3
has comment: http://stackoverflow.com/comment/41854840
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26622704
has answer: http://stackoverflow.com/a/26622373
has title: Trying to call methods from another class
has answer: http://stackoverflow.com/a/26622300
type: Question
has body: Hi everyone I'm new here and I'm new to Java. I'm writing a program that plays a game of war and displays the game on a graphics panel. I' having issues calling the draw methods from the Card class in the War class. For example, when trying to use drawSpade I get the error "Cannot make a static reference to the non-static method drawSpade(Graphics, int, int) from the type Card". I know there are tons of posts about this error but I'm having trouble understanding why it is happening in my program and how to fix it. Any help or advice would be great. Thanks! public class War extends JFrame { private int card; private int drawNum; public int drawSuit; private final int xA = 225; private final int yA = 50; public War() { Color tableGreen = new Color(50, 150, 50); setBackground(tableGreen); // Sets background color setSize(800,500); // Sets window size setTitle("War"); // Sets window title setLocation(50,50); // Sets where the window appears setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); // Makes the window appear } int myCard() { Random myCard = new Random(); return myCard.nextInt(13) + 1; } int mySuit() { Random mySuit = new Random(); return mySuit.nextInt(4) + 1; } int compCard() { Random compCard = new Random(); return compCard.nextInt(13) + 1; } int compSuit() { Random compSuit = new Random(); return compSuit.nextInt(4) + 1; } public void cardNum() { if (myCard() == 1) { drawNum = 1; } } public void cardSuit() { if (mySuit() == 1) { drawSuit = 1; } } public void paint (Graphics pane) { drawSuit = 1; drawNum = 1; if (drawNum == 1) Card.drawBlank(pane, xA, yA); Card.drawTwo(pane, xA, yA); if (drawSuit == 1) Card.drawSpade(pane, 75, 100); } public int getDrawSuit() { return drawSuit; } } public class Card { private static final int HEIGHT = 200; private static final int WIDTH = 150; private final int xA = 225; private final int yA = 50; public void drawBlank (Graphics pane, int xA, int yA) { pane.setColor(Color.black); pane.drawRoundRect(xA, yA, WIDT…
score: 0

http://stackoverflow.com/a/26629526
has comment: http://stackoverflow.com/comment/41868229
score: 0
answers question: http://stackoverflow.com/q/26629437
has comment: http://stackoverflow.com/comment/41868047
type: Answer
has body: You can run Chrome in kiosk mode and add a parameter to stop it from showing the print preview dialogue. chrome.exe --kiosk --kiosk-printing This page explains it in an easy way: http://www.sitepoint.com/google-chrome-kiosk-mode/
has comment: http://stackoverflow.com/comment/41867922
has comment: http://stackoverflow.com/comment/41868081

http://stackoverflow.com/q/26665955
has comment: http://stackoverflow.com/comment/41933727
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41934032
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26666018
has title: Java Layout not showing components (sometimes)
tagged with: components
has comment: http://stackoverflow.com/comment/41933810
tagged with: java
upvote count: 1
tagged with: swing
answer count: 1
tagged with: boxlayout
has comment: http://stackoverflow.com/comment/41933888
accepted answer: http://stackoverflow.com/a/26666018
has body: I'm writing a MathQuiz for my pupils including JLatexMath for rendering and jinput for the buzzers. The problem is, that sometimes (like every fourth time) when I start the program, none of the components are visible. They appear after resizing the JFrame. First I was thinking of Bugs in the jinput or jlatexMath libraries, but I do get the same Error even with this minimal Code: public class Shell extends JFrame{ private JButton button1; private JButton button2; private Formula formula; public Shell() { super("blaBla"); this.setSize(800, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); Box b = Box.createHorizontalBox(); button1 = new JButton(" "); button1.setEnabled(false); b.add(button1); b.add(Box.createHorizontalGlue()); button2 = new JButton(" "); button2.setEnabled(false); b.add(button2); add(b); JPanel formulaPanel = new JPanel(); add(Box.createVerticalStrut(20)); add(formulaPanel); } public static void main(String[] args) { Shell s = new Shell(); } } What is wrong, with the code?
type: AnsweredQuestion

http://stackoverflow.com/a/26637481
has body: You set the wrong main class. Choose one of the following solutions. Change main: me.valli308.MintCraftBasic.Main to main: me.valli308.MintCraftBasic.Example in the plugin.yml file. Change public class Example extends JavaPlugin implements Listener { to public class Main extends JavaPlugin implements Listener { in the Example.java file and rename it to Main.java.
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26636376
downvote count: 0

http://stackoverflow.com/comment/52227803
type: AnswerComment
comment on: http://stackoverflow.com/a/31961645
score: 0
type: Comment
has text: seems that the m2e update did the trick, 1.6.1 does not appear to have this problem

http://stackoverflow.com/comment/41840732
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26613946
has text: Yeah, I import javax.swing.AbstractListModel and then my class extends it. Within my class I am trying to override the abstract method getElementAt(int n) so that I can return elements from my ArrayList. When trying to override this method I am at a loss.
score: 0

http://stackoverflow.com/comment/41935040
comment on: http://stackoverflow.com/q/26666622
has text: Hello @Sted thanks for your reply... Here is the message of e.getMessage() Communications link Failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41734364
type: AnswerComment
has text: thanks for the reply, where should the changePropertyValueRequest should be created? My listener is within the edit part. Also this the command you refer to ? `final Command cmd = myEditPart.getCommand(req); cmd.execute();`
type: Comment
comment on: http://stackoverflow.com/a/26549207
score: 0

http://stackoverflow.com/comment/41874955
type: Comment
comment on: http://stackoverflow.com/a/26633435
has text: i know what u mean, i just copied the code from eclipse and copied without "p" so i added it , my bad for a big PxD
type: AnswerComment
score: 0

http://stackoverflow.com/a/26665353
answers question: http://stackoverflow.com/q/26665341
has comment: http://stackoverflow.com/comment/41943201
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41932519
type: Answer
accepted answer of: http://stackoverflow.com/q/26665341
has comment: http://stackoverflow.com/comment/41932590
has comment: http://stackoverflow.com/comment/41932551
has body: merge(int[] list1, int list2) accepts an array as its first parameter (int[]) and a single int as the second. You want it to accept two arrays, so its signature needs to be merge(int[] list1, int[] list2)

http://stackoverflow.com/a/26786574
has body: Joda-Time surprisingly offers what you want (really?). The apparent solution is using LimitChronology. An example: DateTime min = new DateTime(2014, 1, 1, 0, 0); DateTime max = new DateTime(2015, 1, 1, 0, 0).minusMillis(1); Chronology chronology = LimitChronology.getInstance(ISOChronology.getInstance(), min, max); DateTime now = DateTime.now(chronology); System.out.println(now.toString(DateTimeFormat.fullDateTime())); // output: Donnerstag, 6. November 2014 19:08 Uhr MEZ DateTime test = new DateTime(1970, 1, 1, 0, 0).withChronology(chronology); System.out.println(test.toString(DateTimeFormat.fullDateTime())); // no exception! =&gt; output: �, �. � ���� ��:�� Uhr MEZ test = now.withYear(1970); // IllegalArgumentException: // The resulting instant is below the supported minimum of // 2014-01-01T00:00:00.000+01:00 (ISOChronology[Europe/Berlin]) My advise is however not to use this feature. First reason is the inconvenience to apply the LimitChronology on every DateTime-object in your program. Probably you would be forced to change your application architecture to install a central factory for producing such exotic DateTime-objects in order to be sure that you really don't forget any object. Another reason is the partial unreliability of the chronology in question. It can not prevent instantiating DateTime-objects outside of the supported limited range but produces strange formatted output (see example above). Therefore I suggest you to follow the advise of @MadProgrammer or @CharlieS using Interval for range checks.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26645648
upvote count: 1

http://stackoverflow.com/comment/41895133
has text: Ok thanks and how do I use setDate to increment by variable i each time?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26630626
score: 0

http://stackoverflow.com/a/26531681
has body: You have not shared your php code, but the way it works , you will encode PHP array into JSON data, then your app will be able to parse the json string into java objects. Some helpful pointers: Read up about JSON: http://www.json.org/java/ Some JSON libraries: http://developer.android.com/reference/org/json/package-summary.html https://code.google.com/p/google-gson/ PHP http://php.net/manual/en/function.json-encode.php PHP CODE $result = mysql_query($sql); if (!$result) { echo "Unable to get log: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } $row = mysql_fetch_assoc($result); echo json_encode($row);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26531376
upvote count: 1
score: 1

http://stackoverflow.com/q/26517181
score: 1
tagged with: java
has body: So I generate URL same as what we get from withings developer site. However I get {“status”:342}. I am using java and using below for oauth nonce, timestamp and oauth signature But when I replace these 3 values from what I get from withings website, it works just fine. I dont understand what I am doing wrong. Any help is appreciated String.valueOf(Math.random()) for nonce System.currentTimeMillis() / 1000L – timestamp SecretKeySpec to generate signature using below GET http://wbsapi.withings.net/measure?action=getmeas&amp;userid=2---0 oauth_consumer_key=00000000061e0bf7f7b109903040dc------&amp;oauth_nonce=0.4509674797693397&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1414031787&amp;oauth_token=000000-3b5f9e4704d270551e69b45db31de4ec88b4ebe03&amp;oauth_version=1.0
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27009222
tagged with: withings
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: Withings Web API call signature issue?
type: Question

http://stackoverflow.com/q/26590431
has answer: http://stackoverflow.com/a/26599044
accepted answer: http://stackoverflow.com/a/26599044
type: Question
has title: Status Code 415: No MessageBodyReader Found for multipart/form-data, FormDataMultiPart
tagged with: jersey
tagged with: tomcat
upvote count: 3
tagged with: rest
answer count: 1
downvote count: 0
has body: I'm running into some trouble POSTing multipart/form-data to a RESTful web service that I've made. I am trying to upload media files (images, video, audio) via a RESTful web service. I googled around to find the best way to do this and found that POSTing multipart/form-data was the best solution. The problem is when I POST some multipart/form-data I get this error message in my Tomcat server: SEVERE MessageBodyReader not found for media type=multipart/form-data; boundary=----WebKitFormBoundaryTg7uVLcYJ3lsBpQE, type=class org.glassfish.jersey.media.multipart.FormDataMultiPart, genericType=class org.glassfish.jersey.media.multipart.FormDataMultiPart. I did try looking on stackoverflow to find an answer and the problem seemed to be that a mimepull.jar was missing for many people. I checked to make sure that a mimepull.jar was in my classpath and indeed it is, so this is not the issue. At this point I'm stuck. Here are my dependencies in my pom.xml: org.eclipse.persistence eclipselink 2.5.1 javax javaee-web-api 6.0 provided org.glassfish.jersey.core jersey-server 2.12 org.glassfish.jersey.containers jersey-container-servlet-core 2.12 javax.ws.rs javax.ws.rs-api 2.0 com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider 2.4.2 org.glassfish.jersey.media jersey-media-json-jackson 2.12 org.glassfish.jersey.media jersey-media-multipart 2.12 com.fasterxml.jackson.core jackson-core 2.4.2 com.fasterxml.jackson.core jackson-databind 2.4.2 com.fasterxml.jackson.core jackson-annotations 2.4.2 Here is the relevant backend code that handles multipart/form-data POSTs: @POST @Path("media") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response uploadFile(FormDataMultiPart form ) { FormDataBodyPart filePart = form.getField("file"); ContentDisposition headerofFilePart = filePart.getContentDisposition(); InputStream uploadedInputStream = filePart.getValueAs(InputStream.class); String uploadedFileLocation = "C:\\surveymedia\\media" + headerofFilePa…
favorite count: 0
tagged with: maven
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/41927416
has text: @Alex you could use a char array rather than a StringBuilder(I am assuming you haven't covered StringBuilder).
comment on: http://stackoverflow.com/q/26662624
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26654031
type: Question
linked to: http://stackoverflow.com/q/22208579
tagged with: gwt
score: -1
has answer: http://stackoverflow.com/a/26659369
has comment: http://stackoverflow.com/comment/41921039
downvote count: 1
answer count: 1
has body: When I click the calculator button in my GWT application its trying to call the External Windows Calculator (External webapps). I used to achieve this on ProcessBuilder class in java side. But i will not able to do it. i have seen one post in stackoverflow similar problem like what i am facing now Post link. There i could not see any solution for that problem thats why i am rising again. Anybody know How to call the external windows calculator from GWT application?
has comment: http://stackoverflow.com/comment/41911195
favorite count: 0
has comment: http://stackoverflow.com/comment/41921737
has comment: http://stackoverflow.com/comment/41911058
has comment: http://stackoverflow.com/comment/41920993
tagged with: processbuilder
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41921237
has title: Calling a Windows Calculator in a GWT web application
has comment: http://stackoverflow.com/comment/41910958
upvote count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/22208579

http://stackoverflow.com/a/28110958
downvote count: 0
has body: If you are using https, you have to add following to your axis2.xml file 8443 (full article) This enables https listeren for axis2. It is not enabled by default (unlike http access) . the axis2.xml file can be found here: $CATALINA_HOME/webapps/axis2/WEB-INF/conf/axis2.xml
type: Answer
answers question: http://stackoverflow.com/q/26532124
score: 4
upvote count: 4

http://stackoverflow.com/a/26644341
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41895271
has comment: http://stackoverflow.com/comment/41895550
upvote count: 2
has comment: http://stackoverflow.com/comment/41894885
has comment: http://stackoverflow.com/comment/41895025
has body: 1) From my experience with queue managers (MQ Series, ActiveMQ and HornetQ) I never needed this kind of acknowledgement between producer/consumer. Also the environment that I used to deal with, the traffic was about 50/60 million per day of objects on several queues. And the queues are all persisted as well. 2) In my case, using the persistence mechanism on queue manager was totally sufficient to handle a blackout scenario. I used disk persistence on MQ Series and HornetQ. However, sometimes to ack the amount of messages, we developed some mechanisms to compare Database A with Database B, to be sure that messages were consumed as well. I don't know if JMS architecture should provide this kind of mechanism, because such task could decrease the performance. It's something - in my point of view - that you have to measure on your system architecture how important is to match this information, because it's not that easy to keep. Regards.
type: Answer
answers question: http://stackoverflow.com/q/26640218

http://stackoverflow.com/q/26632496
tagged with: java
type: Question
answer count: 1
tagged with: xalan
has answer: http://stackoverflow.com/a/26633464
score: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41874280
has body: My xsl looks like following &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:baseclass="xalan://com.company.BaseClass" version="2.0"&gt; &lt;!-- code here --&gt; &lt;xsl:variable name="destination"&gt;&lt;xsl:value-of select="baseclass:getObjByName($objName):getDestination($variable)"/&gt;&lt;/xsl:variable&gt; &lt;!-- more code --&gt; &lt;/xsl:stylesheet&gt; All methods are static. question: is it possible to call two java methods from xsl - one from base class and another from result?
type: UnansweredQuestion
has title: Calling multiple java methods from xslt
tagged with: xslt

http://stackoverflow.com/q/26640222
type: Question
answer count: 2
tagged with: scope
score: 0
linked to: http://stackoverflow.com/q/15812349
has title: Distinguishing internal/external methods for Javadoc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26641492
tagged with: libraries
linked to: http://stackoverflow.com/q/11396409
has body: I am writing a library in Java. I've divided its implementation into Java packages to help manage the complexity. Only one package contains classes that are visible to clients of the library. However, because only public methods are visible outside of the package for use by other packages of the library, I find myself forced to do one of the following: (1) Only put interfaces and factory methods in the externally-visible package, putting implementations of those interfaces in a separate package, as described in this SO answer. For example external.MyInterface and internal.MyInterfaceImpl. I find this messy. (2) Make both internal and external methods public in the external package, and attach Javadoc tags to the internal methods so I can remove their docs prior to publication, either manually (error-prone) or by writing some sort of Javadoc preprocessor or postprocessor. (3) Use a mechanism that Javadoc provides for this purpose -- ideally, a Javadoc tag. Whatever the approach, all I really care about is having a consistent way to automatically generate Javadocs for just the external APIs. Is there a standard way to do this? A tool for the purpose?
tagged with: java
has answer: http://stackoverflow.com/a/26669936
tagged with: javadoc

http://stackoverflow.com/comment/41720777
type: AnswerComment
has text: No, not NC in main class. `array` in main class. You are using the same `array`, so they are writing on the same place.
comment on: http://stackoverflow.com/a/26548730
type: Comment
score: 0

http://stackoverflow.com/comment/41683418
type: QuestionComment
type: Comment
has text: @tobb the connection ids actually working, the problem is the validation query, see my answer
comment on: http://stackoverflow.com/q/26527763
score: 0

http://stackoverflow.com/comment/41783463
type: Comment
comment on: http://stackoverflow.com/q/26583586
has text: I am not Added to the above code.But,problem is occur.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41805205
score: 0
type: Comment
type: QuestionComment
has text: Try to avoid comparing `double` values to 0 using `==` as you do here in `factorial`. It won't matter in this particular case; but here, where you know the values are always integers, you should be using `int` instead. In general, roundoff errors may cause `double` values to be very small but non-zero even when you know they "should" be zero.
comment on: http://stackoverflow.com/q/26594856

http://stackoverflow.com/a/26539802
has body: new ArrayList[entranceSites.size()]; does not actually initialize the array elements with any constructor. The array will be filled with enteranceSites.size() null elements. You will need to iterate through the array and actually construct ArrayList objects.
answers question: http://stackoverflow.com/q/26539781
upvote count: 4
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/a/26594289
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26594075
downvote count: 0
has body: You'll need to set the file pointer to the end of the file before you start writing, it defaults to the beginning. raf.seek(raf.length()); placed before any of the write operations should do the trick.

http://stackoverflow.com/q/26556174
has comment: http://stackoverflow.com/comment/41734489
downvote count: 0
has body: I'm trying to prompt the user to enter 3 numbers. After those numbers are entered, I am to add the highest two numbers. The main method is to handle all print statements and is to call the other method. I'm not allowed to use for loop for this problem. The variables from the main, should be passed down to the other method. I am not sure why I am unable to call the method from the main. Here is my code: public class HW { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.println("Enter three numbers."); int x = console.nextInt(); int y = console.nextInt(); int z = console.nextInt(); HW.calLargestSum(); //ERROR HW.calLargestSum(int x, int y, int z); //STILL ERROR } public int calLargestSum(int x, int y, int z){ if ( x &gt; y &amp;&amp; x &gt; z &amp;&amp; y &gt; z ) return x + y; else if ( y &gt; x &amp;&amp; y &gt; z &amp;&amp; x &gt; z ) return y + x; else if ( z &gt; x &amp;&amp; z &gt; y &amp;&amp; y &gt; x ) return z + y; return 0; } }
answer count: 2
has answer: http://stackoverflow.com/a/26556182
has answer: http://stackoverflow.com/a/26556200
favorite count: 0
type: UnansweredQuestion
has title: Prompt user to enter 3 numbers, add the 2 highest numbers (Cannot call method)
has comment: http://stackoverflow.com/comment/41733884
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41734662

http://stackoverflow.com/comment/41938506
comment on: http://stackoverflow.com/a/26654942
type: Comment
has text: and I am asking the same is we define the array in java that "An array is a container object that holds a fixed number of values of a single type".
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41911194
comment on: http://stackoverflow.com/q/26653788
score: 0
type: Comment
type: QuestionComment
has text: an Edittext has focus when its being flirted with _(i kkonw you already know that).. but i am thinking you are having 4 edittext text, which any one of which can gain focus..right?

http://stackoverflow.com/comment/41663366
comment on: http://stackoverflow.com/a/26516692
has text: @wrongAnswer thank you for your input. I thought about it, but I think it does not make huge difference :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/53027366
comment on: http://stackoverflow.com/a/26621992
type: AnswerComment
score: 0
type: Comment
has text: Well... if there's a lot of data that need to be processed, showing progress dialog/bar would be a good idea? Is it possible to do that in onResponse from volley without risking leaked windows?

http://stackoverflow.com/q/26606090
has comment: http://stackoverflow.com/comment/41833683
has answer: http://stackoverflow.com/a/26611927
type: AnsweredQuestion
upvote count: 3
has title: Getting Exceptions from logs on *nix using sed/awk/whatever
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41832791
accepted answer: http://stackoverflow.com/a/26611927
tagged with: bash
answer count: 2
has comment: http://stackoverflow.com/comment/41832597
tagged with: sed
tagged with: awk
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26636668
has comment: http://stackoverflow.com/comment/41834853
has answer: http://stackoverflow.com/a/26636668
has body: I want to get exceptions from log files created by tomcat. Yes, I did some research, but because I don't have any experience with sed or awk - adjusting what I've found to what I need is kinda difficult. A sample file is shown below to have something to work on: at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 39 more 2014-10-24 11:40:01,558 ERROR [aaa.bbb.ccc.ddd.SomeClass] - some exception on parsing '2007/11/45' bla bla javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134) ... 32 more 2014-10-24 11:40:01,561 ERROR [aaa.bbb.ccc.ddd] - some error with id = 1214 java.lang.NullPointerException at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) 2014-10-24 11:44:48,253 INFO [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] - Closing Hibernat…
tagged with: regex

http://stackoverflow.com/q/26513964
has answer: http://stackoverflow.com/a/26514209
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question
has title: java generics - The method evaluate(T,T) in the type T is not applicable for the arguments (Comparable, Comparable<capture#11-of ?>)
has answer: http://stackoverflow.com/a/26514677
answer count: 2
favorite count: 0
has body: I'm having a problem with a generic method since i upgrade my java version to 8. The call is the following: Operator o; Comparable a; Comparable&lt;?&gt; b; boolean match = o.evaluate(a, b) and the method public enum Operator{ public &lt;T extends Comparable&lt;T&gt;&gt; boolean evaluate(T value1, T value2) { if (value1 == null &amp;&amp; value2 != null) { return false; } switch (this) { //some code here } } } And the exception is: The method evaluate(T, T) in the type Operator is not applicable for the arguments (Comparable, Comparable) Thanks in advance!
type: UnansweredQuestion

http://stackoverflow.com/q/26546715
type: Question
has body: In Javascript, We can write statement as below. var f_names = { 'a' : 'Apple', 'b' : 'Banana' 'c' : 'Carrot' }; I can call this as f_names['c'] and get output as Carrot. Is there any equivalent to this in Java instead of Map ? Similar to above ? We can create an String array as bellow in java. String[] names= { "Apple","Banana", "Carrot" }; Then can call as names[2] and this will return output as Carrot. I'm looking for solution like this.
has comment: http://stackoverflow.com/comment/41716455
tagged with: arrays
tagged with: javascript
has answer: http://stackoverflow.com/a/26546734
score: -1
has answer: http://stackoverflow.com/a/26546791
has title: Regarding Java Map and Array
has comment: http://stackoverflow.com/comment/41716349
favorite count: 0
has comment: http://stackoverflow.com/comment/41716333
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26546954
has comment: http://stackoverflow.com/comment/41716382
answer count: 4
has answer: http://stackoverflow.com/a/26546867
has comment: http://stackoverflow.com/comment/41716512
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26627295
has title: waffle custom error page in spring
has body: I am using waffle 1.7 + spring 4 + spring security 3.2 + thymeleaf. My problem is, that I am unable to provide custom error page when fall-back form logging fails. This is my configuration: @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/**") .authenticated() .and() .exceptionHandling() .authenticationEntryPoint(negotiateSecurityFilterEntryPoint()) .accessDeniedPage("/access-denied") .and() .addFilterBefore(waffleNegotiateSecurityFilter(), BasicAuthenticationFilter.class); } When user uses browser with SNPENGO off and enters wrong credentials, the default system 500 page appears with following information: com.sun.jna.platform.win32.Win32Exception: The logon attempt failed. waffle.windows.auth.impl.WindowsAuthProviderImpl.acceptSecurityToken(WindowsAuthProviderImpl.java:134) waffle.servlet.spi.NegotiateSecurityFilterProvider.doFilter(NegotiateSecurityFilterProvider.java:103) waffle.servlet.spi.SecurityFilterProviderCollection.doFilter(SecurityFilterProviderCollection.java:130) ... How can I provide my custom page (access-denied.html thymeleaf template) ? So far I have tried everything from http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc but without success.
has answer: http://stackoverflow.com/a/26630540
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26630540
tagged with: spring
possible better answer: http://stackoverflow.com/a/40272335
has answer: http://stackoverflow.com/a/40272335
tagged with: waffle
score: 0
tagged with: java
tagged with: spring-security
type: AnsweredQuestion

http://stackoverflow.com/a/26539742
has comment: http://stackoverflow.com/comment/41789108
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41782208
has body: Here you have an example worker class: public class ArrayWorker implements Runnable { private static final List&lt;ArrayWorker&gt; threadList = new LinkedList&lt;&gt;(); private static final Random rnd = new Random(System.currentTimeMillis()); private final int[] array; private final int index; public ArrayWorker(final int[] array, final int index) { if (index &gt; array.length - 1) { throw new IndexOutOfBoundsException(String.format("%d", index - array.length)); } this.array = array; this.index = index; System.out.println(this + " has been created"); } @Override public void run() { System.out.println(this + " run()"); this.array[this.index] = rnd.nextInt(100); if (index &lt; array.length - 2) { final ArrayWorker worker = new ArrayWorker(array, index + 1); System.out.println(this + " has created: " + worker); new Thread(worker).start(); threadList.add(this); try { synchronized (this) { System.out.println(this + " is now waiting"); this.wait(); System.out.println(this + " got notified"); } } catch (InterruptedException ex) { System.out.println("Error while waiting for termination"); threadList.remove(this); } } else { threadList.forEach(worker -&gt; { synchronized(worker) { System.out.println(this + " notifying: " + worker); worker.notify(); } }); } } @Override public String toString() { return "WorkerThread[" + index + "]"; } } Here the usage: public static void main(String[] args) { final int[] myArray = new int[10]; System.out.println("MainThread creating first WorkerThread and awaiting termination of last WorkerThread"); Thread t = new Thread(new ArrayWorker(myArray, 0)); try { t.start(); t.join(); } catch (InterruptedException ex) { ex.printStackTrace(); System.exit(-1); } System.out.println("Last WorkerThread finished"); for (int i : myArray) { System.out.print(i + " "); } System.out.println(); } Example output: MainThread creating first WorkerThread and awaiting termination of last WorkerThread WorkerThread[0] has been created WorkerThread[0] run() WorkerThrea…
type: Answer
accepted answer of: http://stackoverflow.com/q/26537627
upvote count: 1
has comment: http://stackoverflow.com/comment/41728659
answers question: http://stackoverflow.com/q/26537627
score: 1

http://stackoverflow.com/comment/79569701
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/38005969
type: Comment
has text: i am getting the same error even with the latest jar [mysql-connector-java-6.0.5.jar:6.0.5]

http://stackoverflow.com/comment/41933381
has text: It has to do something with my google maps fragment, I need this fragment in there however. Is there any other way to get rid of my null pointer exception without inflating the layout?
comment on: http://stackoverflow.com/a/26665673
type: AnswerComment
score: 0
type: Comment

utf-8
tags question: http://stackoverflow.com/q/26598421
tags question: http://stackoverflow.com/q/26533878
tags question: http://stackoverflow.com/q/26619592
tags question: http://stackoverflow.com/q/26638196
tags question: http://stackoverflow.com/q/26597128
tags question: http://stackoverflow.com/q/26588828
tags question: http://stackoverflow.com/q/26644649
tag name: utf-8
tags question: http://stackoverflow.com/q/26521282
type: Tag

http://stackoverflow.com/a/26571000
has comment: http://stackoverflow.com/comment/41764327
has comment: http://stackoverflow.com/comment/41764443
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41764352
answers question: http://stackoverflow.com/q/26570891
type: AcceptedAnswer
downvote count: 0
has body: Your design is terrible. A service is supposed to have a clear contract. This contract is defined by the interface of the service. All your services share the same interface, which doesn't make any sense: why would two completely different services share the same contract and have the same methods? Since they obviously don't have the same methods, now you're forced to cast to a concrete class instead of relying on their interface, and you thus lose type-safety (and testability) completely. And since they all have the same interface, you're also forced to use a qualifier to distinguish them. Here's what your code should look like: @Controller public class QuestionController { @Autowired QuestionDisplayService questionDisplayService; @Autowired QuestionService questionService; @Autowired UserService userService; ... long questionid = questionService.addQuestionService(question, tagsid);
accepted answer of: http://stackoverflow.com/q/26570891

http://stackoverflow.com/comment/41808859
has text: Would I wrap around by using %26 since there are 26 letters each for the capital and lowercase ascii characters?
type: Comment
comment on: http://stackoverflow.com/a/26597236
type: AnswerComment
score: 0

http://stackoverflow.com/a/26665980
has body: Your second loop is spanning the concatenated length, when you want it to only span the length of nums2. Try this: for (int i=nums1.length; i&lt;nums2.length; i++) { int value=nums2 [i - num1.length]; nums3 [i]= value; }
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41933806
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26665933

http://stackoverflow.com/a/29944993
upvote count: 5
has body: Hi, Setting up Selenium tests to run on Safari browser is a fairly complex process. You need to install Safari Extensions Developer Certificate in your machine and also install selenium webdriver as an extension in Safari Browser. Also there are some stability issues with Safari browser automation &amp; Selenium combination on Mac 10.9 OS and below. The stability is much better on Mac Yosemite OSX &amp; Safari 8.0.x combination along with Selenium v2.45.0 Detailed steps for the setup can be seen here Regards, VJ
answers question: http://stackoverflow.com/q/26598239
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26598239
type: Answer
has comment: http://stackoverflow.com/comment/49863247

http://stackoverflow.com/q/26541291
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/26541576
has comment: http://stackoverflow.com/comment/41707172
has comment: http://stackoverflow.com/comment/41707248
has comment: http://stackoverflow.com/comment/41707404
tagged with: jtable
has title: printing columns and total wtih specific layout
score: 0
tagged with: printing
tagged with: product
answer count: 1
type: UnansweredQuestion
has body: I am using netbeans plus a database(MYSQL)for this java Program. In JTable shows the following columns--- product name, Price, Stock available, total sold.All I want in my program is that when I click make sale or say a print button it should print the names of product separated by commas plus the total price of selected rows..In addition to this function, it should also decrement stock available by 1 and increment total sale by 1 to the database. [1]: see image at https://i.sstatic.net/Q5to1.jpg
has comment: http://stackoverflow.com/comment/41707221

http://stackoverflow.com/a/26662888
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26586269
accepted answer of: http://stackoverflow.com/q/26586269
type: Answer
downvote count: 0
score: 1
has body: Possibility 1: Define separate entry points for the different versions E.g. version 1: from("restlet:http://localhost:8080/1/users/{id}/like/{beer}") .process(new Processor() { public void process(Exchange exchange) { // version 1 processing } ); E.g. version 2: from("restlet:http://localhost:8080/2/users/{id}/like/{beer}") .process(new Processor() { public void process(Exchange exchange) { // version 2 processing } ); Possibility 2: Define one entry point and pass the version number to the processor E.g.: from("restlet:http://localhost:8080/{version}/users/{id}/like/{beer}") .process(new Processor() { public void process(Exchange exchange) { int version = exchange.getIn().getHeader("version", Integer.class); if (version == 1) { // version 1 processing } else { // version 2 processing } } );

http://stackoverflow.com/q/26517309
has answer: http://stackoverflow.com/a/33260754
accepted answer: http://stackoverflow.com/a/33260754
has answer: http://stackoverflow.com/a/34944712
tagged with: spring
tagged with: autowired
tagged with: logging
has title: How do I inject a logger into a field in the sample spring boot application?
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/26523862
tagged with: java
has body: What I want is to make spring autowire a logger. So, in other words, I want to have this working: import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class MainController { @Autowired private Logger logger; @RequestMapping("/") public String enterSite(HttpServletResponse response) { logger.info("site entered"); return "welcome"; } } Right now it throws an exception at startup: "No qualifying bean of type [org.slf4j.Logger] found for dependency...". My pom.xml dependencies: org.springframework.boot spring-boot-starter-parent 1.2.0.M1 <relativePath /> org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-rest org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-test test org.apache.tomcat.embed tomcat-embed-jasper provided javax.servlet jstl postgresql postgresql 9.1-901.jdbc4 I read this: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-logging It says if you use one of the starter poms (I do) Logback is used - but for internal logging. Can it be autowired in my classes?
type: Question
linked to: http://stackoverflow.com/q/9685316
upvote count: 27
downvote count: 0
score: 27
favorite count: 0
has answer: http://stackoverflow.com/a/57824578
answer count: 5
possible better answer: http://stackoverflow.com/a/34944712
has answer: http://stackoverflow.com/a/55338237

http://stackoverflow.com/comment/41709769
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26542596
has text: when you call the setText, can you also output the fromServer output from the called method? Particularly, can you output the correct text to stdout from the same place where the actual gui change should take place?

http://stackoverflow.com/comment/41863362
type: QuestionComment
comment on: http://stackoverflow.com/q/26621703
has text: 0.29 is quite old - there were some bugs fixed. Use 1.1.0. Do you get any errors in the output? You can share the output with Gist or Pastebin.
score: 0
type: Comment

http://stackoverflow.com/a/38578868
type: Answer
answers question: http://stackoverflow.com/q/26655741
has body: Just .zip the word file, a .docx file is nothing but a collection of xml. You'll find xml files after you open your .zip file. Then convert your xml file into json via google feed API.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/64557849
has comment: http://stackoverflow.com/comment/64547139
downvote count: 0
has comment: http://stackoverflow.com/comment/64557707

http://stackoverflow.com/q/26655071
has comment: http://stackoverflow.com/comment/41939390
has comment: http://stackoverflow.com/comment/66539128
has comment: http://stackoverflow.com/comment/41914678
has comment: http://stackoverflow.com/comment/41945228
has comment: http://stackoverflow.com/comment/41918198
tagged with: spring
has title: Spring framework migration from 3.1 to 4.0, deployment on Glassfish fails with error "NoClassDefFoundError : LibraryUtils"
has comment: http://stackoverflow.com/comment/66240108
answer count: 0
type: UnansweredQuestion
tagged with: maven
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: glassfish
score: 0
has body: I am migrating our project from Spring 3.1 to 4.0 version. I am having the following error while trying to deploy the war to Glassfish 4 server. I am using spring-modules-all-0.9.jar. I have found several links related to this exception but nothing resolved my issue. Here is the error stack track from server.log : Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springmodules.validation.bean.BeanValidator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springmodules.validation.util.LibraryUtils at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1456) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preIns…

http://stackoverflow.com/a/26656857
answers question: http://stackoverflow.com/q/26656481
score: 0
has body: Change the signature of cloneList to: public &lt;X extends Parent&gt; List&lt;X&gt; cloneList(final List&lt;X&gt; original) Then it will work, at least for the method signature. You can internally construct a List&lt;Parent&gt; and then cast it to List&lt;X&gt; and ignore the warnings if you need to; there's no way to find out the runtime type of "X".
type: Answer

http://stackoverflow.com/comment/41809385
type: QuestionComment
comment on: http://stackoverflow.com/q/26597506
has text: That's right, I created it at Google Developers Console with my SHA-1 fingerprint
score: 0
type: Comment

http://stackoverflow.com/a/32182410
score: 34
answers question: http://stackoverflow.com/q/26591521
downvote count: 4
has comment: http://stackoverflow.com/comment/68684245
has body: The correct solution would have been to upgrade to hibernate 4.2.15 / 4.3.6 or above and add the following lines to your persistence.xml: &lt;property name="hibernate.event.merge.entity_copy_observer" value="allow"/&gt;
upvote count: 38
type: Answer
has comment: http://stackoverflow.com/comment/87754203
has comment: http://stackoverflow.com/comment/117718997

http://stackoverflow.com/comment/41746422
has text: I once tried to create a similar class that tried to mimic all of `mcrypt_encrypt` but in the end I gave up in disgust. I did rewrite the sample code of `mcrypt_encrypt` to keep people from falling in the same trap though.
comment on: http://stackoverflow.com/a/26563318
type: Comment
score: 0
type: AnswerComment

file
type: Tag
tags question: http://stackoverflow.com/q/26560548
tags question: http://stackoverflow.com/q/26653867
tags question: http://stackoverflow.com/q/26549820
tags question: http://stackoverflow.com/q/26580729
tag name: file
tags question: http://stackoverflow.com/q/26638445
tags question: http://stackoverflow.com/q/26614637
tags question: http://stackoverflow.com/q/26517915
tags question: http://stackoverflow.com/q/26587807
tags question: http://stackoverflow.com/q/26528081
tags question: http://stackoverflow.com/q/26530445
tags question: http://stackoverflow.com/q/26557375
tags question: http://stackoverflow.com/q/26600191
tags question: http://stackoverflow.com/q/26580078
tags question: http://stackoverflow.com/q/26657476
tags question: http://stackoverflow.com/q/26657640
tags question: http://stackoverflow.com/q/26575009
tags question: http://stackoverflow.com/q/26590007
tags question: http://stackoverflow.com/q/26648955
tags question: http://stackoverflow.com/q/26559981
tags question: http://stackoverflow.com/q/26561498
tags question: http://stackoverflow.com/q/26531961
tags question: http://stackoverflow.com/q/26666495
tags question: http://stackoverflow.com/q/26599368
tags question: http://stackoverflow.com/q/26543907
tags question: http://stackoverflow.com/q/26542892
tags question: http://stackoverflow.com/q/26560570
tags question: http://stackoverflow.com/q/26579229
tags question: http://stackoverflow.com/q/26577419
tags question: http://stackoverflow.com/q/26581748
tags question: http://stackoverflow.com/q/26570310
tags question: http://stackoverflow.com/q/26644933
tags question: http://stackoverflow.com/q/26535384
tags question: http://stackoverflow.com/q/26556301
tags question: http://stackoverflow.com/q/26603929
tags question: http://stackoverflow.com/q/26593342
tags question: http://stackoverflow.com/q/26537894
tags question: http://stackoverflow.com/q/26522656
tags question: http://stackoverflow.com/q/26548835
tags question: http://stackoverflow.com/q/26549581

http://stackoverflow.com/comment/41797899
type: QuestionComment
has text: It's not clear from your question how users are actually authenticated or why you don't want them to be when they access the site. If you want to override the authentication process to deny access, you can use a custom `AuthenticationEntryPoint`. The default on will redirect to the login page. Also don't use `auto-config`. It will create the login setup whether or not you configure it. Just remove it.
comment on: http://stackoverflow.com/q/26590669
score: 0
type: Comment

http://stackoverflow.com/a/26598502
has comment: http://stackoverflow.com/comment/41811439
has comment: http://stackoverflow.com/comment/41811486
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/41811301
has comment: http://stackoverflow.com/comment/41814164
downvote count: 0
has comment: http://stackoverflow.com/comment/41811581
answers question: http://stackoverflow.com/q/26598481
type: Answer
has body: foo += foo + 1 is parsed as foo = (foo) + (foo + 1) not foo = (foo + 1) Meaning you get 1: 3 (+ 1 + 2) 2: 7 (+3 + 4) 3: 15 (+7 +8) 4: 31 (+15 +16) 5: 63 (+32 +33) etc So you'll never have foo == 60 and an infinite loop instead. eta: seems I just learnt something myself. The int rolls over and hits -1. Thanks @Jason C

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/26661572

http://stackoverflow.com/comment/41688238
type: AnswerComment
type: Comment
has text: No worries, 7 more rep and you will ;)
comment on: http://stackoverflow.com/a/26528169
score: 0

http://stackoverflow.com/q/26578500
tagged with: generics
accepted answer: http://stackoverflow.com/a/26578659
possible better answer: http://stackoverflow.com/a/26578560
has title: Create same type ArrayList as ArrayList parameter in method
has body: I'm implementing mergesort in Java. I want it to work with every object that can be compared. Here's code public class MergeSort { public static void sort(ArrayList&lt;? extends Comparable&gt; list) { mergesort(list, 0, list.size() - 1); } private static void mergesort(ArrayList&lt;? extends Comparable&gt; list, int start, int end) { if (start &gt;= end) return; int mid = (start + end) / 2; mergesort(list, start, mid); mergesort(list, mid + 1, end); merge(list, start, mid, end); } private static void merge(ArrayList&lt;? extends Comparable&gt; list, int start, int mid, int end) { ArrayList&lt;? extends Comparable&gt; temp = new ArrayList&lt;Comparable&gt;(end - start + 1); int j = mid + 1; for (int i = start; i &lt;= mid; i++) { while (j &lt;= end &amp;&amp; list.get(i).compareTo(list.get(j)) &gt; 0) { temp.add(list.get(j)); j++; } temp.add(list.get(i)); } while (j &lt;= end) { temp.add(list.get(j)); j++; } int j = 0; for (int i = start; i &lt;= end; i++) { list.set(i, temp.get(j)); j++; } } } The problem is that I can't add elements to "temp" array, compiler says that I should change temp to Comparable, but then I can't replace elements from "temp" to "list". I understand that compiler thinks that list might be Integers and temp Floats. How can I set "temp" to be same type as "list"?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41774351
type: Question
has answer: http://stackoverflow.com/a/26578659
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26578560

http://stackoverflow.com/a/26597936
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41810788
has comment: http://stackoverflow.com/comment/41810691
has comment: http://stackoverflow.com/comment/41810826
type: Answer
answers question: http://stackoverflow.com/q/26597831
has comment: http://stackoverflow.com/comment/41810722
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41810397
accepted answer of: http://stackoverflow.com/q/26597831
has comment: http://stackoverflow.com/comment/41810460
has comment: http://stackoverflow.com/comment/41810792
has body: The syntax of the if-condition is totally wrong. What you want to do? You are mixing assign and condition code. You can do assign like this: if (chanceDir &gt;= 0.5) { Dir = IRobot.AHEAD; Vir = IRobot.BEHIND; Hir = IRobot.AHEAD; Sir = IRobot.BEHIND; } else { Dir = IRobot.RIGHT; Vir = IRobot.LEFT; Hir = IRobot.LEFT; Sir = IRobot.RIGHT; } if (oppchanceDir &gt;= 0.5) { Dir = IRobot.BEHIND; Vir = IRobot.AHEAD; Hir = IRobot.BEHIND; Sir = IRobot.AHEAD; }else { Dir = IRobot.LEFT; Vir = IRobot.RIGHT; Hir = IRobot.RIGHT; Sir = IRobot.LEFT; } Or you can do check conditions like that: if (chanceDir &gt;= 0.5 &amp;&amp; ((Dir == IRobot.AHEAD) &amp;&amp; (Vir == IRobot.BEHIND) &amp;&amp; (Hir == IRobot.AHEAD) &amp;&amp; (Sir == IRobot.BEHIND))) { // do something here }else if((Dir == IRobot.RIGHT) &amp;&amp; (Vir == IRobot.LEFT) &amp;&amp; (Hir == IRobot.LEFT) &amp;&amp; (Sir == IRobot.RIGHT)){ // do something here }else{ // do something here } if (oppchanceDir &gt;= 0.5 &amp;&amp; ((Dir == IRobot.BEHIND) &amp;&amp; (Vir == IRobot.AHEAD) &amp;&amp; (Hir == IRobot.BEHIND) &amp;&amp; (Sir == IRobot.AHEAD))) { // do something here } else if ((Dir == IRobot.LEFT) &amp;&amp; (Vir == IRobot.RIGHT) &amp;&amp; (Hir == IRobot.RIGHT) &amp;&amp; (Sir == IRobot.LEFT)) { // do something here }else{ // do something here }
has comment: http://stackoverflow.com/comment/41810498
upvote count: 1

http://stackoverflow.com/q/26577976
type: Question
accepted answer: http://stackoverflow.com/a/26578298
has title: Accessing field of a nested class in Java
score: 0
has comment: http://stackoverflow.com/comment/41773326
answer count: 1
has answer: http://stackoverflow.com/a/26578298
type: AnsweredQuestion
has body: I have a class that contains 3 nested classes within it. I am looking for a way to access a field of one of the nested classes. public class NestedClasses { class Outer { class InnerOne { int item1; int item2; } class InnerTwo { int item1; int item2; } } //get access to item1 inside InnerOne How can I access item1 inside InnerOne to assing a value to it? I tried: Outer.InnerOne test = new Outer.InnerOne(); x.item1 = 5; but the first line is not valid. What am I doing wrong?
tagged with: inner-classes
tagged with: java

http://stackoverflow.com/q/26666071
answer count: 1
tagged with: jax-rs
favorite count: 0
tagged with: rest
score: 5
has answer: http://stackoverflow.com/a/26666497
has body: I see a lot of Jersey-based web services consisting of 1+ WebResources that have 1+ endpoints/methods like so: package com.myws.fizz; public class FizzResource { @GET @Path("/fizz/{id}") public Response getFizzById(@PathParam("id") Long id) { // ...etc. } @GET @Path("/fizz") public Fizz getFizzByFoo(Foo foo) { // ...etc. } } package com.myws.buzz; public class BuzzResource { @POST @Path("/buzz") public Response createBuzz(Buzz buzz) { // ...etc. } } I'm confused with what Jersey considers a "resource". Is there a relationship between a "resource" and a database? A table? A POJO? When do you return a Response vs. a POJO? Look at my 2 getFizz methods above. When do I return a Fizz and when do I return a Response?
type: AnsweredQuestion
tagged with: java
has title: Jersey RESTful Services: Resources & Responses
type: Question
tagged with: jersey
upvote count: 5
accepted answer: http://stackoverflow.com/a/26666497
downvote count: 0
linked to: http://stackoverflow.com/q/26862500

http://stackoverflow.com/a/26538921
has comment: http://stackoverflow.com/comment/41703271
has comment: http://stackoverflow.com/comment/41703664
has comment: http://stackoverflow.com/comment/41703698
score: 0
has body: It's a typo. It doesn't actively harm the code, as the block statement is unaffected by the placement of that semicolon, but it certainly doesn't help readability. IntelliJ or any other IDE will report this in their inspections as "unnecessary semicolon" or "superfluous", or something to that effect. In general, you want to avoid confusing syntax like that. Despite it being valid syntax, its placement is actively confusing.
has comment: http://stackoverflow.com/comment/41703385
has comment: http://stackoverflow.com/comment/41703509
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41703304
has comment: http://stackoverflow.com/comment/41703379
has comment: http://stackoverflow.com/comment/41703693
has comment: http://stackoverflow.com/comment/41703754
has comment: http://stackoverflow.com/comment/41706503
downvote count: 1
answers question: http://stackoverflow.com/q/26538433
has comment: http://stackoverflow.com/comment/41703341
has comment: http://stackoverflow.com/comment/41703779

http://stackoverflow.com/comment/41930434
score: 0
type: Comment
has text: At least I can say I got my answer. 10,000 seems to be enough to drastically speed things up, but each thread isn't really getting that much of a quantum slice, so it's really all over the place with what thread does what. It's faster, for sure, but what I thought would be just 6 - 7 instructions per thread is taking quite a bit of time, but it's finding a lot of open ports.
type: AnswerComment
comment on: http://stackoverflow.com/a/26663872

http://stackoverflow.com/q/26520142
downvote count: 0
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/41670240
type: Question
has title: Ant and Java on OSX.10 Yosemite
has answer: http://stackoverflow.com/a/26520605
has body: I recently upgraded to Yosemite and it's been nothing but problems related to java. First at startup of the OS (related to Adobe), and then at startup of Eclipse, it told me I needed to install Java 6. So I went and did that and things were better but then Eclipse wasn't working. So I started poking around and it looks like Apple's install of Java is now Java 7 even though all the symlinks point to a folder named A (which is Java 7) but the symlinks are 1.4, 1.5, and 1.6. So I think eclipse was confused. So I decided to ditch Apple's Java and go get Oracle's. So I get Oracle's and it installs to /Library/Java/JavaVirtualMachines/jdk1.7. However, all of Apple's java links in /usr/bin point back to Apple's Java. So to fix this I found this document: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html But /usr/libexec/java_home doesn't exist anymore. So I update all the symlinks myself (not by editing the links in /usr/bin but by updating what they point to) so now when I do a javac it points to Oracle's JDK, as expected. So thinking I fixed everything I then run ant, which was working before all this mess, and I get: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Trying the default build file: build.xml Buildfile: /Users/rjcarr/Subversion/p/build.xml Detected Java version: 1.7 in: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre Detected OS: Unknown parsing buildfile /Users/rjcarr/Subversion/p/build.xml with URI = file:/Users/rjcarr/Subversion/p/build.xml Project base dir set to: /Users/rjcarr/Subversion/p Caught an exception while logging the end of the build. Exception was: java.lang.NoClassDefFoundError: Could not initialize class sun.util.calendar.ZoneInfoFile ... There has been an error prior to that: java.lang.AssertionError: Platform not recognized And this was the result whether I set $JAVA_HOME to the Oracle Java or not. What's going on? These things happen to me every time I update OSX, but I always forget how much…
has comment: http://stackoverflow.com/comment/41670259
upvote count: 2
has comment: http://stackoverflow.com/comment/47681038
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/41669904
linked to: http://stackoverflow.com/q/19563766
has comment: http://stackoverflow.com/comment/41672546
tagged with: ant
has comment: http://stackoverflow.com/comment/41672561
linked to: http://stackoverflow.com/q/19495610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29434672
score: 2

http://stackoverflow.com/comment/41829778
score: 0
type: AnswerComment
type: Comment
has text: Well, the app crashes when I want to launch debug mode.
comment on: http://stackoverflow.com/a/26608558

http://stackoverflow.com/a/26581509
type: Answer
accepted answer of: http://stackoverflow.com/q/26581169
answers question: http://stackoverflow.com/q/26581169
has body: Returning the same decoyObject from createCards to Randomize should resolve the issue. Changes: Added a new method called storeCards() in createCards class which will return the decoyObject to the method call in randomizeCards(). createCards.java public class createCards { decoyObject d = new decoyObject(); public decoyObject storeCards(){ storeHearts(); storeClubs(); storeSpades(); storeDiamonds(); return d; } public void storeHearts(){ String[] heartRay = new String[13]; heartRay[0] = "AceH"; int L = heartRay.length - 4; for(int i = 0; i &lt;= L; i++){ Integer h = i + 2; String heartPlace = h.toString()+"H"; heartRay[i+1] = heartPlace; } heartRay[10] = "JackH"; heartRay[11] = "QueenH"; heartRay[12] = "KingH"; d.setHearts(heartRay); } public void storeClubs(){ String[] clubRay = new String[13]; clubRay[0] = "AceC"; int L = clubRay.length - 4; for(int i = 0; i &lt;= L; i++){ Integer h = i + 2; String clubPlace = h.toString() + "C"; clubRay[i+1] = clubPlace; } clubRay[10] = "JackC"; clubRay[11] = "QueenC"; clubRay[12] = "KingC"; d.setClubs(clubRay); } public void storeSpades(){ String[] spadeRay = new String[13]; spadeRay[0] = "AceS"; int L = spadeRay.length - 4; for(int i = 0; i &lt;= L; i++){ Integer h = i + 2; String spadePlace = h.toString() + "S"; spadeRay[i+1] = spadePlace; } spadeRay[10] = "JackS"; spadeRay[11] = "QueenS"; spadeRay[12] = "KingS"; d.setSpades(spadeRay); } public void storeDiamonds(){ String[] diamondRay = new String[13]; diamondRay[0] = "AceD"; int L = diamondRay.length - 4; for(int i = 0; i &lt;= L; i++){ Integer h = i + 2; String diamondPlace = h.toString() + "D"; diamondRay[i+1] = diamondPlace; } diamondRay[10] = "JackD"; diamondRay[11] = "QueenD"; diamondRay[12] = "KingD"; d.setDiamonds(diamondRay); } } Randomize.java public class Randomize{ createCards c = new createCards(); public void randomizeCards(){ decoyObject d = null; d = c.storeCards(); //I believe the issue happens in the code below String[] randomHearts = d.getHearts(); String[]…
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/41794581
comment on: http://stackoverflow.com/q/26589831
type: Comment
has text: Probably your method in which this code written, returns `String`. Since the first `return` statement is of type `int`, you're getting this error message.
type: QuestionComment
score: 0

http://stackoverflow.com/a/26619597
score: 2
type: AcceptedAnswer
has body: Did you make sure to update the build.gradle file with compile 'com.google.android.gms:play-services:5.+' and to rebuild/clean the project? Make sure you're not working offline and you have a good Internet connection (the gradle needs to be able to access the Internet)
accepted answer of: http://stackoverflow.com/q/26619318
downvote count: 0
answers question: http://stackoverflow.com/q/26619318
upvote count: 2
type: Answer

http://stackoverflow.com/a/26520802
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26520608
score: 1
answers question: http://stackoverflow.com/q/26520608
has body: If you use the MediaPlayer class directly on the activity, then you can use its OnCompletionListener to detect if the media stops playing. inside this OnCompletionListener you can switch your button's text from "Pause" to "Play" like so: mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { mPlayButton.setText("Play"); } }); I integrated your AudioPlayer to the fragment so that it would look like: public class HelloMoonFragment extends Fragment { private Button mPlayButton; private Button mStopButton; private MediaPlayer mPlayer; private boolean mCompleted = false; @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_hello_moon, parent, false); mPlayButton = (Button) v.findViewById(R.id.hellomoon_playButton); mPlayButton.setText("Play"); mPlayButton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { if(mPlayer == null) { mPlayer = MediaPlayer.create(c, R.raw.one_small_step); mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { stopMediaPlayer(); mPlayButton.setText("Play"); } }); } if(mPlayButton.getText().equals("Play")) { mPlayButton.setText("Pause"); mPlayer.start(); } else if(mPlayButton.getText().equals("Pause")){ mPlayButton.setText("Play"); mPlayer.pause(); } } }); mStopButton = (Button)v.findViewById(R.id.hellomoon_stopButton); mStopButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { stopMediaPlayer(); mPlayButton.setText("Play"); } }); return v; } @Override public void onDestroy() { stopMediaPlayer(); super.onDestroy(); } public void stopMediaPlayer() { if (mPlayer != null) { mPlayer.release(); mPlayer = null; } } }
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41707963
type: AnswerComment
comment on: http://stackoverflow.com/a/26541541
score: 0
type: Comment
has text: Thanks a lot @ElliottFrisch i tried the same method but on a textfile with values of {serviceid, name, serviceCodes} and converted them but gives me a numberformat exception for the name?

http://stackoverflow.com/comment/41769485
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26575707
has text: So what your saying, is that when i try to parse the json not as an array but as an object alone, i would be able to include specific characters in my json parsing sample? Lets say, all of these 0-9,A-Z,-(dash),.(dot),$(dollar-sign),/(forward-slash),+(plus-sign),%(percent-sign) and a space? Could you also clear something up for me? Im using the parseInt or parseLong function, but since integers cannot use the weird typeface im trying to get, what would the string version of my parsing look like? As there is no parseString method?

http://stackoverflow.com/comment/41771392
score: 0
has text: updated the posting with working code, and copied some directly from the jQuery DataTables examples page to add just a little extra something. I don't have access to your database and other objects such as Job....
type: Comment
comment on: http://stackoverflow.com/a/26569990
type: AnswerComment

http://stackoverflow.com/comment/42006612
has text: Seems perfectly reasonable to me. You want a database system, which can allow multiple, concurrent users to access it - you need a database server stored on centrally accessible computer. Each client needs to be able to connect to this server. This means they need to provide the server hostname or IP. You can store this in a config file (properties) and have it installed with your application and/or prompt the user for it...
score: 0
comment on: http://stackoverflow.com/q/26667249
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26614825
tagged with: java
has comment: http://stackoverflow.com/comment/41841089
type: Question
has body: In Java 8, I can write List&lt;String&gt; strList = Arrays.asList("1", "2", "3"); List&lt;Integer&gt; intList = strList.stream().map(s -&gt; Integer.valueOf(s)).collect(Collectors.toList()); and that is pretty short already, but I have lots of these conversions and I wonder why the following is not possible, i.e. why is there no convert/transform method? // won't work, as List has no convert() or transform() method: List&lt;Integer&gt; intList = strList.convert(s -&gt; Integer.valueOf(s)); If the implementation of convert would be clever, it could maybe even be lazy, so that the conversion is only done when the elements will actually be requested. Alternatively, I could of course write it myself, but does anyone maybe know a library that provides a method? // any idea which library provides this util? List&lt;Integer&gt; intList = SomeLibraryUtil.convert(strList, s -&gt; Integer.valueOf(s));
score: 0
has comment: http://stackoverflow.com/comment/41841219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41842242
has title: How do I convert a List in Java 8?
answer count: 0

http://stackoverflow.com/q/26520904
has comment: http://stackoverflow.com/comment/41700224
tagged with: java
has comment: http://stackoverflow.com/comment/41700165
type: Question
score: 0
answer count: 1
tagged with: tomcat
tagged with: classloader
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26521016
tagged with: tomcat7
has title: define new class in Tomcat
has body: I want to load new class(not previously loaded) in Tomcat from byte array. I also have reference to tomcat application class loader. I declare my custom classloader as class CustomClassLoader extends ClassLoader{ public CustomClassLoader(ClassLoader classLoader) { super(classLoader); } public Class loadThisClass(String name){ //get .class byte array in data. Class clazz = defineClass(name, data, 0, data.length, null); resolveClass(clazz); return clazz; } } I am using this classloader as CustomClassLoader customClassLoader = new CustomClassLoader(getClass().getClassLoader()); /* print getClass().getClassLoader() and it output as WebappClassLoader context: /test delegate: false repositories: /WEB-INF/classes/ ----------&gt; Parent Classloader: org.apache.catalina.loader.StandardClassLoader@52e99642 */ Class clazz = customClassLoader.loadThisClass("com.Class1"); //print clazz.getMethods, it print my new method. When i try to check this class as follows Class.forName("com.Class1"); I am getting ClassNotFoundException and this class is not accessible to other classes in web application. How can i define new class in tomcat web application that is accessible to other classes in my web application..

http://stackoverflow.com/comment/41814166
has text: With inbox = store.getFolder("folderA"); the result is CONTENT:javax.mail.internet.MimeMultipart@183967b , the content is not a string
comment on: http://stackoverflow.com/q/26597568
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26546678
upvote count: 1
tagged with: performance
score: 1
tagged with: java
tagged with: apache-commons-math
type: Question
downvote count: 0
has title: Performance of Apache Math library version 3.3 vs 2.2
favorite count: 0
has comment: http://stackoverflow.com/comment/41716445
answer count: 0
has comment: http://stackoverflow.com/comment/41718755
has body: I have some code that does physics modelling and uses Apache Math library version 2.2. Math library version 3.3 has superseded ver 2.2 by some 3 years now, and I was wanting to upgrade the library. However, testing showed the new library to make the model take 20% longer to run. Much of the model run-time is spent doing Math.exp() functions, and we use FastMath.exp() where possible as it is much faster. However, FastMath.exp() also appears to be about 20% slower in Apache math3. This is a real shame, as Apache math3 finally includes Erf.erfInv() which would mean we don't have to use a separate library for error functions. However, we cant afford to lose 20% speed. The use of unchecked exceptions in math3 is nice too, but we can simulate that by catching checked exceptions from v2 and re-throwing as unchecked. Does anyone know why math3 is slower in these places? Does anyone have any pressing reason why I should upgrade despite the performance impact? If not, I wont be upgrading to math3 :-/
type: UnansweredQuestion

http://stackoverflow.com/comment/41772432
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26576883
has text: ok i removed java-1.7.0-openjdk now how do i install the new version?
score: 0

http://stackoverflow.com/q/26587517
accepted answer: http://stackoverflow.com/a/26587606
score: 0
has title: Cache and use only one object in case of equality - equal objects should get referneces
has answer: http://stackoverflow.com/a/26587606
type: Question
has comment: http://stackoverflow.com/comment/41790018
type: AnsweredQuestion
has body: I have a KeyObject consuming some fair amount of memory. The KeyObject also has a hashValue and an equals Method implemented. Now I want to hold every unique KeyObject only once in my memory and just use references to this object in case of equality (equals not ==). I thought I could use a Set but I can not get the original KeyObject. I can only replace the existing one with a new one. Here is what I mean in pseude code: Keybject a = new Keybject("a"); Keybject b = new Keybject("a"); boolean thisIsTrue = a.equals(b); boolean thisIsFalse a == b; Map&lt;KeyObject, Value&gt; largeMapA = new HashMap&lt;&gt;(); Map&lt;KeyObject, Value&gt; largeMapB = new HashMap&lt;&gt;(); largeMapA.put(a, "value a"); largeMapB.put(b, "value b"); Now I have the large KeyObject twice -> one for each largeMap, but it would be enough to have only one KeyObject (a.equals(b)) and use a reference for the the 2nd map. So I want something like this: KeyObject b = if there is already a equal object ("a") in my "cache" then use "a" largeMapA.put(a, "value a"); largeMapB.put(b, "value b"); // Now I have ONE large KeyObject // this is just a reference to a The only only solution that comes in mind is to loop the entry largeMapA and find a equal key then replace b: for (KeyObject ko : largeMapA.keySet()) { if (ko.equals(b)) { b = ko; break; } } But this seems not to be a performant solution ...
tagged with: java
answer count: 1

http://stackoverflow.com/comment/41890507
comment on: http://stackoverflow.com/q/26641809
has text: @RealSkeptic `URLEncoder.encode()` encodes for application/x-www-form-urlencoded`, which is quite different from encoding query parameters/URI fragments/etc
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/63332764
comment on: http://stackoverflow.com/a/26583434
score: 0
type: AnswerComment
type: Comment
has text: If its working please mark it as answer It will help others as well or If you change any code please post that as well

http://stackoverflow.com/a/26721596
type: Answer
has comment: http://stackoverflow.com/comment/42157667
score: 0
answers question: http://stackoverflow.com/q/26616723
has body: I resolved the same issue in my project by excluding the Hibernate ejb3 lib that was included via a transitive dependency. The dependency from maven dependency:tree was as follows: [INFO] | +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile [INFO] | | +- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile In my project, this was originally included in the executable jar my build process produced, via the maven assembly plugin. To exclude this (and other libs), I used the assembly plugin's dependencySet configuration in src/main/assemble/test-jar-with-dependencies.xml: test-jar-with-dependencies jar false / org.eclipse.persistence org.hibernate:hibernate-annotations:jar:3.4.0.GA org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA org.hibernate:ejb3-persistence true true true test Hope that helps!

http://stackoverflow.com/q/26608877
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26608993
has title: Viewing console output when web application is running on Amazon Web Services
answer count: 2
has answer: http://stackoverflow.com/a/26608955
downvote count: 0
tagged with: amazon-web-services
tagged with: tomcat
tagged with: console
favorite count: 0
has body: I know that this is a very simple question, but Im new to Amazon Web Services and I need all the help that I can get. When I run my web application locally I can debug by inserting print statements within the code to see if the statement is executed or not (I just look at the console output). Now, I am getting errors in the code when I upload the application to AWS. I do not get these errors when I run the application locally, so I need to debug. Is there a way to see the output of print statements when the application is running on an amazon instance? I can ssh into the instance from my local computer. Is it possible to use the same debugging technique when the code is running remotely? Thanks.
possible better answer: http://stackoverflow.com/a/26608955
has answer: http://stackoverflow.com/a/26608993
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/33893008
upvote count: 30
type: Answer
score: 29
has comment: http://stackoverflow.com/comment/78534563
has body: This is a bug in mysql-connector-java from version 5.1.33 to 5.1.37. I've reported it here: http://bugs.mysql.com/bug.php?id=79343 Edited: This has been corrected from mysql-connector-java 5.1.39 It was a typo in TimeUtil class in loadTimeZoneMappings method that raises a NPE locating /com/mysql/jdbc/TimeZoneMapping.properties file. If you look at the code, the file should be located within TimeUtil class loader, not TimeZone: TimeUtil.class.getResourceAsStream(TIME_ZONE_MAPPINGS_RESOURCE); The parameter useLegacyDatetimeCode allows to correct the difference between client and server timezones automatically when using dates. So it helps you precissely not having to specify timezones in each part. Althought using serverTimeZone parameter is a workaround, and meanwhile the patch is released, you can try better correcting the code by yourself as I did. If it's a standalone application, you can try simply to add a corrected com/mysql/jdbc/TimeUtil class to your code and be careful with jar loading order. This can help: https://owenou.com/2010/07/20/patching-with-class-shadowing-and-maven.html If it's a web application, the easier solution is to create your own mysql-connector-java-5.1.37-patched.jar, substituting the .class directly into the original jar.
has comment: http://stackoverflow.com/comment/58308718
has comment: http://stackoverflow.com/comment/58498529
downvote count: 1
has comment: http://stackoverflow.com/comment/69694676
has comment: http://stackoverflow.com/comment/98493743
has comment: http://stackoverflow.com/comment/97791503
has comment: http://stackoverflow.com/comment/114033025
answers question: http://stackoverflow.com/q/26515700
has comment: http://stackoverflow.com/comment/98017018
has comment: http://stackoverflow.com/comment/61700793
has comment: http://stackoverflow.com/comment/58308818

http://stackoverflow.com/a/26560587
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41742039
downvote count: 0
has body: It doesn't work because, as the javadoc of replace() says: Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar. (emphasis mine) So, the first time you meet an 'a' in the string, you replace all the 'a's by 'd'. But then you go to the next char, and if it's a 'd' that was an 'a' before, you replace it once again, etc. etc. You shouldn't use replace() at all. Instead, you should simply build a new string, using a StringBuilder, by appending each shifted character of the original string: String dictionary = "abcdefghijklmnopqrstuvwxyz"; StringBuilder sb = new StringBuilder(input.length()); for (int i = 0; i &lt; input.length(); i++) { char oldChar = input.charAt(i); int oldCharPositionInDictionary = dictionary.indexOf(oldChar); if (oldCharPositionInDictionary &gt;= 0) { int newCharPositionInDictionary = (oldCharPositionInDictionary + lag) % dictionary.length(); sb.append(dictionary.charAt(newCharPositionInDictionary)); } else if (oldChar == ' ') { sb.append(' '); } } String result = sb.toString();
has comment: http://stackoverflow.com/comment/41741803
has comment: http://stackoverflow.com/comment/41741962
type: Answer
has comment: http://stackoverflow.com/comment/41741874
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26560483
score: 4
answers question: http://stackoverflow.com/q/26560483

http://stackoverflow.com/comment/41772462
score: 0
type: Comment
type: QuestionComment
has text: Now we turn from a mild "duplicate" to a strong "opinion based" ;) So if you keep the pattern outside the loop its okay.
comment on: http://stackoverflow.com/q/26576580

http://stackoverflow.com/a/26589546
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26589425
type: Answer
downvote count: 0
score: 1
has body: This should work: static int getClosestToZero(int[] array) { int num = array[0]; int absNum = Math.abs(num); for (int i = 1; i &lt; array.length; ++i) { int newAbs = Math.abs(array[i]); if (newAbs &lt; absNum) { absNum = newAbs; num = array[i]; }else if(newAbs == absNum &amp;&amp; array[i]&gt;=0)//if equals and the current is positive, then take it { num = array[i]; } } return num; }
answers question: http://stackoverflow.com/q/26589425
upvote count: 1

http://stackoverflow.com/comment/41756491
has text: It is kind of ironic in that it's a "strongly typed" language and all the generic stuff, eg, is oriented towards making typing even stronger, but you can have a mistaken parameter and due to autoboxing it will be swallowed hook, line, and sinker.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26568608

http://stackoverflow.com/comment/41667924
type: Comment
has text: thanks i understand all bugs ,,..could u please tell why u take holder class.and i also got curret results also
comment on: http://stackoverflow.com/a/26519151
score: 0
type: AnswerComment

http://stackoverflow.com/a/26747588
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26604828
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26604828
type: Answer
has body: We are having this same issue. I believe this is a bug in the way Java implemented TLS 1.2 for SSL. According to their documentation, https://blogs.oracle.com/java-platform-group/entry/java_8_will_use_tls, they claim that by enabling TLS 1.2, it is backwards compatible with older versions. However, this is not the case. When TLS 1.2 is disabled, we no longer get the "Remote host closed connection during handshake" error. TLS 1.2 support can be turned off from the Advanced Settings in the Java Control Panel. Once this is done, the applets will work.
upvote count: 2

http://stackoverflow.com/comment/41794714
type: Comment
type: QuestionComment
has text: What is the code of `getPrinterWriter()`?
comment on: http://stackoverflow.com/q/26588828
score: 0

http://stackoverflow.com/q/26611230
has comment: http://stackoverflow.com/comment/41835204
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41834982
has comment: http://stackoverflow.com/comment/41835068
type: Question
has title: DAO factory pattern createConnection from datasource
score: 0
has comment: http://stackoverflow.com/comment/41835243
has comment: http://stackoverflow.com/comment/41834828
has body: Referring to this article on DAO factory pattern, http://www.oracle.com/technetwork/java/dataaccessobject-138824.html I have a CloudscapeDAOFactory , that has a public static Connection createConnection() method. I am using DriverManager.registerDriver() and DriverManager.getConnection() to create connection. //DriverManager.registerDriver(new OracleDriver()); //conn = DriverManager.getConnection(CONNECTION_URL); The individual DAO classes like say CloudscapeCustomerDAO [Example 9.4] calls CloudscapeDAOFactory.createConnection() to get a connection as required. public class CloudscapeCustomerDAO implements CustomerDAO { public CloudscapeCustomerDAO() { // initialization } // The methods in the class can use // CloudscapeDAOFactory.createConnection() // to get a connection as required Question: Now I am implementing connection pooling, and my problem is retaining the 'static' keyword in the createConnection() of the CloudscapeDAOFactory. CloudscapeDAOFactory.java private DataSource dataSource; private static Connection conn = null; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public static Connection createConnection() throws SQLException { conn = dataSource.getConnection()// incorrect static reference// compile time error // If I remove 'static' then CloudscapeCustomerDAO need an instance of CloudscapeDAOFactory to call this method! // If I plan to retain the 'static' then I need to declare DataSource also as static, which I feel is incorrect. } Springconfig.xml &lt;bean id="springDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" &gt; &lt;property name="url" value="jdbc:oracle:thin:@localhost:1521:SPRING_UNNI" /&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt; &lt;property name="username" value="unni" /&gt; &lt;property name="password" value="unni" /&gt; &lt;property name="removeAbandoned" value="true" /&gt; &lt;property name="initialSize" value="20" /&gt; &lt…
tagged with: spring
has comment: http://stackoverflow.com/comment/41834856
has comment: http://stackoverflow.com/comment/41834323
linked to: http://stackoverflow.com/q/9361538
answer count: 0
has comment: http://stackoverflow.com/comment/41834551

http://stackoverflow.com/comment/41955896
score: 0
has text: If your code is properly formatted in your IDE, it should appear properly formatted when copy-pasted; anything *indented with >=4 spaces or a tab appears as code*. A simple way e.g. from eclipse is: open the source file, format if necessary (CTRL-A followed by CTRL-F), indent (TAB), copy (CTRL-C). Paste and there is everything properly formatted. Delete whats irrelevant to the question to make your problem clearer (e.g. import statements, irrelevant methods / method bodies).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26661876

http://stackoverflow.com/comment/61662146
type: AnswerComment
has text: shouldn't this be `TLSv1.2`?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/34904758

http://stackoverflow.com/a/26555219
has body: You could use the ternary operator: while ((isDfa) ? !s.hasAllTransitions() : !input.equals("next")) { ... } But sometimes, instead of trying to cram everything into one complex condition, it's best to break things up. Consider doing it this way: while (true) { if (isDfa) { if (s.hasAllTransitions()) { break; } } else { if (input.equals("next")) { break; } } ... } or while (true) { boolean done; if (isDfa) { done = s.hasAllTransitions(); } else { done = input.equals("next"); } if (done) { break; } ... }
answers question: http://stackoverflow.com/q/26555103
has comment: http://stackoverflow.com/comment/41732475
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41732408
has comment: http://stackoverflow.com/comment/41732590
has comment: http://stackoverflow.com/comment/41732501

http://stackoverflow.com/a/26656766
has body: Check you Build targets in both your project and appcompat. Your project must not be less than the target of appcompat which, I think needs SDK 10 or newer: In Eclipse go to Project->Properties->Android (Project Build Target)
has comment: http://stackoverflow.com/comment/41916909
type: Answer
answers question: http://stackoverflow.com/q/26656567
score: 0

http://stackoverflow.com/comment/41695403
comment on: http://stackoverflow.com/q/26534382
has text: from your screenshot, the library you are trying to use is in your home dir? you probably just need to import it in eclipse, then (and refer it as another project in the buildpath)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26594731
has body: DWR is general works great when all I want to do is access some property of a converted JS Object, but not so well when I want to access a method of said object. &lt;dwr:convert type="bean" class="domain.Fund" javascript="JFund"&gt; &lt;dwr:include method="id,name,availableBalance"/&gt; &lt;/dwr:convert&gt; public double getAvailableBalance(short var) { ... } I have tried many different types of configurations of the Fund object to get access to the availableBalance method, but I haven't had any luck. I cannot explicitly declare getAvailableBalance in the include method list as this throws an error. I know DWR calls the getters of the properties, but i haven't found a way to specify a property whose getter method takes in a parameter. If i make a DB call and am returned a Fund object, doing something like this in JS always results in an undefined error message fund.availableBalance(1); fund.getAvailableBalance(1); but these work find as expected fund.id; fund.name Any idea on how to access methods and pass in parameters?
type: Question
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41841726
has title: DWR: access converted object methods
answer count: 0
has comment: http://stackoverflow.com/comment/41842147
type: UnansweredQuestion
tagged with: dwr

http://stackoverflow.com/q/26598273
favorite count: 0
has body: Im trying to figure out how to validate the users input.I want the user to input something like a1 or B6.The input should be in the following pattern. letter from a to h followed by a number from 1 to 8, [String-number].Also the letter should be accepted either if it is capital either not.Here is my code.Any help is very much appreciated! private void getUserInput() { Scanner scan = new Scanner(System.in); userGuess1 = scan.nextLine(); // Here i should validate if the input is in the right format userGuess = userGuess1;
upvote count: 1
has title: Validating string format(pattern) input
type: AnsweredQuestion
tagged with: format
has answer: http://stackoverflow.com/a/26598384
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26598483
tagged with: string
accepted answer: http://stackoverflow.com/a/26598384
possible better answer: http://stackoverflow.com/a/26598483

http://stackoverflow.com/q/26614845
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26614893
answer count: 1
downvote count: 0
tagged with: jsp
has title: Preserve property case in DTO
favorite count: 0
accepted answer: http://stackoverflow.com/a/26614893
has body: I was wondering if there is any way to maintain the case for the property name. What I am doing is sending response from Spring controller to JSP page as a DTO object. While doing so spring creating JSON object by changing case for the property name. DTO class MyDto { private Long DT_RowId; .... } Controller class MyController { public @ResponseBody MyDto someMethod() { //fill up MyDto object return myDto; } } JSON created and received in JSP { "dt_RowId": 1, .... } //need to be DT_RowId My question is can I specify in property level to maintain case of the property name?
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/26534879
has answer: http://stackoverflow.com/a/26535935
upvote count: 3
favorite count: 0
has title: spring-boot application fails to start
has answer: http://stackoverflow.com/a/26535226
accepted answer: http://stackoverflow.com/a/26535226
possible better answer: http://stackoverflow.com/a/26535935
tagged with: spring
answer count: 4
has answer: http://stackoverflow.com/a/51086084
type: AnsweredQuestion
downvote count: 0
type: Question
tagged with: spring-mvc
score: 3
has body: I recently start to develop a web application with spring-boot, anf, following the guide in the offical site, manage to create this two files: pom.xml 4.0.0 spring app 0.0.1-SNAPSHOT jar app http://maven.apache.org com.spring.app.Application <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE org.springframework.boot spring-boot-starter-web Application.java @Configuration @EnableAutoConfiguration @ComponentScan public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); System.out.println("Let's inspect the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); } } } but when I try run the application with java -jar appname i get the error: Cannot find the main class: com.spring.app.Application. Program will exit, and in the terminal: Exception in thread "main" java.lang.NoClassDefFoundError: com/spring/app/Application. What I am doing wrong?
tagged with: spring-boot
has answer: http://stackoverflow.com/a/42753925
tagged with: java

http://stackoverflow.com/a/26647823
accepted answer of: http://stackoverflow.com/q/26647179
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41901854
score: 1
has body: try creating file context.xml and write all configurations and put it in META-INF folder. sample
answers question: http://stackoverflow.com/q/26647179
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/41818601
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26602520
has text: You can use `socket`, `RMI` or `websevices` to communicate between JMV. I feel `webservices` are the reliable and robus

http://stackoverflow.com/a/26610998
score: 0
has comment: http://stackoverflow.com/comment/41837258
type: Answer
has comment: http://stackoverflow.com/comment/41835363
has body: When you want to synchronize two threads you must lock on a shared resource by all threads. Synchronizing in the run method(or any instance method in thread class) each thread locks it's own method resulting no synchronization at all.
answers question: http://stackoverflow.com/q/26610791

http://stackoverflow.com/a/26543303
downvote count: 0
score: 1
has body: You have to specify the classpath using -cp java -cp YOUR_CLASSPATH_HERE MyFirstJavaProgram
answers question: http://stackoverflow.com/q/26543266
upvote count: 1
type: Answer

http://stackoverflow.com/q/26566575
has title: Storm Topology not working
has comment: http://stackoverflow.com/comment/41752343
answer count: 1
has comment: http://stackoverflow.com/comment/41752375
favorite count: 0
has answer: http://stackoverflow.com/a/26583963
score: 0
type: UnansweredQuestion
tagged with: bigdata
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41752711
tagged with: java
has comment: http://stackoverflow.com/comment/41752315
tagged with: apache-storm
has body: I am new to storm but still i have configured storm on my local machine. I made an eclipse project and followed a simple example from internet. Now my topology is getting submitted but its not working. Was topology submitted? Yeah it was submitted successfully as I can see it on storm ui. Work of my topology is to just print a number if it is a prime number. But its not printing it. I have provided my code as follows: Spout Class: public class NumberSpout extends BaseRichSpout { private SpoutOutputCollector collector; private static final Logger LOGGER = Logger.getLogger(SpoutOutputCollector.class); private static int currentNumber = 1; @Override public void open( Map conf, TopologyContext context, SpoutOutputCollector collector ) { this.collector = collector; } @Override public void nextTuple() { // Emit the next number LOGGER.info("Coming in spout tuble method"); collector.emit( new Values( new Integer( currentNumber++ ) ) ); } @Override public void ack(Object id) { } @Override public void fail(Object id) { } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare( new Fields( "number" ) ); } } Bolt Class: public class PrimeNumberBolt extends BaseRichBolt { private static final Logger LOGGER = Logger.getLogger(PrimeNumberBolt.class); private OutputCollector collector; public void prepare( Map conf, TopologyContext context, OutputCollector collector ) { this.collector = collector; } public void execute( Tuple tuple ) { int number = tuple.getInteger( 0 ); if( isPrime( number) ) { LOGGER.info("Prime number printed is: )" +number); System.out.println( number ); } collector.ack( tuple ); } public void declareOutputFields( OutputFieldsDeclarer declarer ) { declarer.declare( new Fields( "number" ) ); } private boolean isPrime( int n ) { if( n == 1 || n == 2 || n == 3 ) { return true; } // Is n an even number? if( n % 2 == 0 ) { return false; } //if not, then just check the odds for( int i=3; i*i&lt;=n; i+=2 ) { if( n % i == 0) { return…
has comment: http://stackoverflow.com/comment/41752356

http://stackoverflow.com/comment/75223100
has text: Try using Hibernate cascade annotations instead of JPA annotations. Eg.,@Cascade(CascadeType.SAVE_UPDATE) would replace {CascadeType.PERSIST,CascadeType.MERGE }. Check this article: [JPA & Hibernate annotation common mistake](https://www.mkyong.com/hibernate/cascade-jpa-hibernate-annotation-common-mistake/)
type: Comment
score: 8
comment on: http://stackoverflow.com/a/26607059
type: AnswerComment

http://stackoverflow.com/a/32466614
has comment: http://stackoverflow.com/comment/61728867
has body: Inspired by Bhavit S. Sengar's answer, it bundled that technique into a dead simple method call. You can use the NetCipher library to get a modern TLS config when using Android's HttpsURLConnection. NetCipher configures the HttpsURLConnection instance to use the best supported TLS version, removes SSLv3 support, and configures the best suite of ciphers for that TLS version. First, add it to your build.gradle: compile 'info.guardianproject.netcipher:netcipher:1.2' Or you can download the netcipher-1.2.jar and include it directly in your app. Then instead of calling: HttpURLConnection connection = (HttpURLConnection) sourceUrl.openConnection(); Call this: HttpsURLConnection connection = NetCipher.getHttpsURLConnection(sourceUrl);
has comment: http://stackoverflow.com/comment/61662218
answers question: http://stackoverflow.com/q/26649389
has comment: http://stackoverflow.com/comment/75492226
score: 15
has comment: http://stackoverflow.com/comment/54415214
has comment: http://stackoverflow.com/comment/75322550
has comment: http://stackoverflow.com/comment/67983813
type: Answer
has comment: http://stackoverflow.com/comment/63623111
upvote count: 15
has comment: http://stackoverflow.com/comment/64771131
has comment: http://stackoverflow.com/comment/61728878
has comment: http://stackoverflow.com/comment/60871569
downvote count: 0

http://stackoverflow.com/a/26627062
upvote count: 2
has comment: http://stackoverflow.com/comment/41875216
downvote count: 0
has body: From the 3.1.1 of JPA 2.1 spec: The find method (provided it is invoked without a lock or invoked with LockModeType.NONE) and the getReference method are not required to be invoked within a transaction. If an entity manager with transaction-scoped persistence context is in use, the resulting entities will be detached; if an entity manager with an extended persistence context is used, they will be managed.
type: Answer
answers question: http://stackoverflow.com/q/26617551
score: 2

http://stackoverflow.com/a/26784868
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26671316
answers question: http://stackoverflow.com/q/26671316
has body: SUCCESS! apparently it needed ${ param.elc }. why is this not on any tutorials and how come no one knew about it? im a bit skeptical still but it's doing as required. thanks to all who helped!
type: Answer

http://stackoverflow.com/a/26656754
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 9
answers question: http://stackoverflow.com/q/26648409
accepted answer of: http://stackoverflow.com/q/26648409
has comment: http://stackoverflow.com/comment/42025585
score: 9
has body: There is a class in java - 'Key Generator' - This class provides the functionality of secret (symmetric) keys generator. You basically need to use this class for secret key generation, in one of following manner : SecretKey aesKey = KeyGenerator.getInstance("AES").generateKey(); This will generated secret key with default length for the algorithm which is passed as parameter, in this example it will generate secret key for 128 bits (default for AES). Or use the following function : public static SecretKey generateSecretKey() { KeyGenerator keyGener = KeyGenerator.getInstance("AES"); keyGener.init(256) // here you can pass any valid length return keyGener.generateKey(); } You can convert these generated secret keys to character array, byte array or string and then these can be stored with any database, use following : char[] key = encodeHex(aesKey.getEncoded()); or byte[] key = aesKey.getEncoded(); For more detail see the KeyGenerator class : http://docs.oracle.com/javase/7/docs/api/javax/crypto/KeyGenerator.html Happy to help.

http://stackoverflow.com/q/26664544
has body: I have a simple Java REST webservice - @GET @Path("/get1") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Status getstudent(Track track) { System.out.println("GET1 title = " + track.getTitle()); System.out.println("GET1 singer = " + track.getSinger()); Status status = new Status(); status.setStatus_flag("success"); return status; } Track public class Track { String title; String singer; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSinger() { return singer; } public void setSinger(String singer) { this.singer = singer; } @Override public String toString() { return "Track [title=" + title + ", singer=" + singer + "]"; } } Python request module:- import requests title = {"title":"Best Songs","singer":"lucky"} r = requests.get("http://localhost:8080/StudentService/rest/insert/get1",data=title) print r.content Error HTTP Status 415 - Unsupported Media Type type Status report message Unsupported Media Type description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method. Apache Tomcat/6.0.41 Is there a way to create the entity object and send it?
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/34440975
tagged with: python
has answer: http://stackoverflow.com/a/34440975
has answer: http://stackoverflow.com/a/26664583
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
tagged with: python-requests
type: Question
accepted answer: http://stackoverflow.com/a/26664583
has title: Calling Java webservice using Python requests
answer count: 2

http://stackoverflow.com/comment/41741642
type: AnswerComment
comment on: http://stackoverflow.com/a/26560496
type: Comment
has text: @a_horse_with_no_name Actually, the implementation of subSequence() in the StringBuilder and StringBuffer classes also both return a String. I'm not sure about other implementations, though.
score: 1

http://stackoverflow.com/comment/41824755
type: Comment
type: QuestionComment
has text: Your problem is not clear. You need to explain your code and how it relates to the HW assignment. Is part of the code given or did you write it all?
comment on: http://stackoverflow.com/q/26601749
score: 0

http://stackoverflow.com/comment/41682466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26527655
has text: Check that getter and setter also use Integer and not int
score: 0

http://stackoverflow.com/comment/41709403
comment on: http://stackoverflow.com/q/26542628
score: 0
type: Comment
type: QuestionComment
has text: Thanks for formatting the question @DnR .. But can you explain me why this happening?

http://stackoverflow.com/a/26629904
upvote count: 1
has comment: http://stackoverflow.com/comment/41868275
has comment: http://stackoverflow.com/comment/41869030
has comment: http://stackoverflow.com/comment/41868535
answers question: http://stackoverflow.com/q/26629724
has comment: http://stackoverflow.com/comment/41874945
has comment: http://stackoverflow.com/comment/41868785
downvote count: 0
has comment: http://stackoverflow.com/comment/41868675
has comment: http://stackoverflow.com/comment/41869522
type: Answer
has comment: http://stackoverflow.com/comment/41868368
has body: In such "simple" case I would only use property file for configuration of urls and have different config files for different environments (dev, prod,..) with one (same named property), e.g. system.a.url=http://localhost:8081/systemA/authorize You can manage your property files manually (e.g. outside your jar/war) or you can use maven profiles to make jar/war file specific for your environment. But I don't see the need for spring profiles. EDIT: Alternatively you can use environment variables to "configure" settings specific to an environment (what a coincidence in the names :)). Note that you can have different environments also inside one machine. For more details check e.g. this. export AUTH_URL="http://localhost:8081/systemA/authorize"
score: 1

groovy
tags question: http://stackoverflow.com/q/26659567
tags question: http://stackoverflow.com/q/26514974
tags question: http://stackoverflow.com/q/26668660
type: Tag
tags question: http://stackoverflow.com/q/26518683
tags question: http://stackoverflow.com/q/26584320
tags question: http://stackoverflow.com/q/26526234
tags question: http://stackoverflow.com/q/26528485
tags question: http://stackoverflow.com/q/26653521
tags question: http://stackoverflow.com/q/26525690
tags question: http://stackoverflow.com/q/26556580
tags question: http://stackoverflow.com/q/26614446
tags question: http://stackoverflow.com/q/26672168
tags question: http://stackoverflow.com/q/26585067
tags question: http://stackoverflow.com/q/26544524
tags question: http://stackoverflow.com/q/26648552
tags question: http://stackoverflow.com/q/26514274
tags question: http://stackoverflow.com/q/26533690
tags question: http://stackoverflow.com/q/26587099
tags question: http://stackoverflow.com/q/26545383
tag name: groovy

http://stackoverflow.com/a/66212983
type: Answer
upvote count: 10
downvote count: 1
answers question: http://stackoverflow.com/q/26637800
score: 9
has body: add to pom.xml org.springframework.boot spring-boot-starter-validation

http://stackoverflow.com/comment/41777624
type: Comment
type: QuestionComment
score: 2
has text: `public static JButton brushSize1 = new JButton("Size 1");` BTW 1) When it comes to GUI elements, `static` is not our friend. 2) Those 3 buttons should probably be one `JComboBox` or (better) a `JSpinner` with spinner number model. 3) For a `JButton` it is better to add an `ActionListener` that will react to mouse clicks as well as the keyboard.
comment on: http://stackoverflow.com/q/26580335

http://stackoverflow.com/a/26578637
has body: I'm not sure if you are allowed to use arraylists or not in your example but if you are then you can easily store the values you already have and on each for loop you can check if there are any duplicates. for (int i = 0; i &lt; values.length; i++) { for (int j = i + 1; j &lt; values.length; j++) { if (values[i] == values[j] &amp;&amp; !foundValues.contains(values[j])) { System.out.println("Duplicates in Array: " + values[i]); foundValues.add(values[i]); } } } output is Duplicates in Array: 1 Duplicates in Array: 8
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41774557
answers question: http://stackoverflow.com/q/26578401

http://stackoverflow.com/comment/41826982
type: AnswerComment
score: 0
has text: Yes I forgot to delete it, thank you :) I remove all the static things from my code and it works fine now :)
type: Comment
comment on: http://stackoverflow.com/a/26606053

http://stackoverflow.com/a/26589231
answers question: http://stackoverflow.com/q/26588976
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/46401559
score: 0
type: Answer
has body: Okay, so normally I would recommend using a sorted map/array list but if that's not an option... Run through a normal sort algorithm as you would anything else on the first row. However, if you do have to make a swap then just simultaneously swap the second row's value in the same way, e.g.: //loop through int i if(points[i][0] &lt; points[i+1][0]){ int temp = points[i][0]; points[i][0] = points[i + 1][0]; points[i+1][0] = temp; temp = points[i][1]; points[i][1] = points[i + 1][1]; points[i+1][1] = temp; } Nice and simple.

http://stackoverflow.com/a/26555142
answers question: http://stackoverflow.com/q/26555103
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41732320
has comment: http://stackoverflow.com/comment/41732363
score: 0
has body: You could do something like this: boolean testBoolean = false; while(!testBoolean) { if(isDfa) { testBoolean = s.hasAllTransitions(); } else { testBoolean = input.equals("next"); } }
has comment: http://stackoverflow.com/comment/41732200
type: Answer
has comment: http://stackoverflow.com/comment/41732124
has comment: http://stackoverflow.com/comment/41732223

http://stackoverflow.com/q/26652310
tagged with: java
answer count: 1
score: 0
has title: How to access a comboBox from another class in Java
has answer: http://stackoverflow.com/a/26652891
tagged with: jcombobox
type: UnansweredQuestion
has body: comboBoxEnvIn Java is it possible to access a comboBox when it is sitting within a different class entirely?I want to use it as a whole and not just pass through it's values. I have two classes - each has a GUI. I have my main.java (main) class and my ExportImportWindow.java I am trying to access the comboBox that I use in my ExportImportWindow class called comboBoxEnv Currently my code in my main class refers/uses the wrong comboBox called comboBox. It's causing the information that is written to a file to be the incorrect information. My code from main is this: if (comboBox.getSelectedItem() == null ){ JOptionPane.showMessageDialog( null, "Please choose an ei"); } else { String env = comboBox.getSelectedItem().toString(); ExportImportWindow frm = new ExportImportWindow("Export",env,xmlFile , null, me); frm.setVisible( true ); } I am unsure as to how I can get access to the correct comboBox which sits in the other class like so. I have already declared it at the top of my code as to attempt to access it within my main class. public final JComboBox comboBoxEnv ; public ExportImportWindow( final String mode, final String env,String FromFile,String ToFile, final Main main){ comboBoxEnv = new JComboBox(); //other code to populate comboBoxEnv } This is what I currently have after my last attempt did not work: ExportImportWindow exportImport = new ExportImportWindow(//not sure what to pass through); exportImport.comboBoxEnv; // trying to access the method the ComboBoxEnv sits in I feel all the articles I look at are simply asking how to pass the values whether as I want to use the entire comboBox and not just it's values. Really appreciate any one who could share their knowledge on this. I did get access to it but it was only by creating it as a method which did not work.
tagged with: swing
type: Question

http://stackoverflow.com/a/26699242
answers question: http://stackoverflow.com/q/26669633
has body: If you take EPSG 3857 coordinates (which are technically meters) and apply some simple area (or also distance) calculation algorithm, then you will get wrong result. To be be exact, it is more or less correct in equator, but more and more wrong towards either of the poles. You must convert coordinates to latitude and longitude (also known as WGS84, or geographical coordinates, or EPSG:4326), and then use proper spherical calculation. Here seems to be good example for Android.
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42688997
has comment: http://stackoverflow.com/comment/41994587
accepted answer of: http://stackoverflow.com/q/26669633

http://stackoverflow.com/a/41775622
score: -1
answers question: http://stackoverflow.com/q/26517413
type: Answer
has body: On Line 777 of NurseRosteringImporter.java you need to add the lines that are the same as line 776, 775, 773 etc but for DayUnavailableRequest. You also need to do what the guy above said too. It worked for me with those changes.
downvote count: 1
upvote count: 0

unix
tags question: http://stackoverflow.com/q/26525536
tags question: http://stackoverflow.com/q/26643443
tags question: http://stackoverflow.com/q/26543520
type: Tag
tags question: http://stackoverflow.com/q/26654307
tag name: unix
tags question: http://stackoverflow.com/q/26550136

http://stackoverflow.com/comment/41698179
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26535226
has text: FWIW, you need the plugin to create an 'uber' jar with all the dependencies. https://spring.io/guides/gs/spring-boot/#use-maven It will run without it, but the complete jar makes life easy.

http://stackoverflow.com/comment/41745265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562619
has text: Probably you have only 3 rows with the selected class in the table.
score: 0

http://stackoverflow.com/comment/41769670
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26575815
has text: Try to update android studio. The last version is 0.8.14. It might has updates for `Toolbar` rendering.

http://stackoverflow.com/a/26635991
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26618473
answers question: http://stackoverflow.com/q/26618473
has body: Seems like the issue was that the .jar i tried to use was compiled with java 8 and Thats not comparable with Android atm.

http://stackoverflow.com/comment/41929623
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26639130
has text: A com.lowagie.text.Document is a wrapper for a document creator. If you only have that object, you're lost.

http://stackoverflow.com/q/26599348
tagged with: firebase
tagged with: java
has body: I'm trying to just do a simple test in firebase and save a hashmap that contains a string, and a boolean, but I cannot save the data, it never gets pushed. http://hastebin.com/qucocuqexe.cs
type: Question
has title: Firebase cannot save any data
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26614790
type: UnansweredQuestion

http://stackoverflow.com/comment/41787513
comment on: http://stackoverflow.com/a/26586175
score: 0
type: AnswerComment
type: Comment
has text: @HareshChhelana not really. To be an answer length of the answer is doesn't matter.

http://stackoverflow.com/comment/41909705
type: QuestionComment
score: 0
has text: Does the XSLT matters here? i suspect the Transformer Class of the android package.i think XSLT doest change the content in my case it just adds styling. if you still prefer to see XSLT i will provide.
comment on: http://stackoverflow.com/q/26650924
type: Comment

http://stackoverflow.com/a/26561079
has comment: http://stackoverflow.com/comment/41757843
has body: Skimming through the Java EE Tutorial for JAX-RS, it seems they fail to mention anything about the concept of Filters and Interceptors from the jsr339-jaxrs-2.0-final-spec. You should probably download a copy for complete information. Filters and entity interceptors can be registered for execution at well-defined extension points in JAX-RS implementations. They are used to extend an implementation in order to provide capabilities such as logging, confidentiality, authentication, entity compression Entity interceptors wrap around a method invocation at a specific extension point. Filters execute code at an extension point but without wrapping a method invocation. Basically the last paragraph is saying that interceptors occur in the same execution stack as the method call, whereas filters don't. That doesn't mean we can't use filters for your logging case. The filter contexts passed to the filter interface method actually have a lot more information that you can use. The ContainerRequestFilter and ContainerResponseFilter get passed ContainerRequestContext and ContainerResponseContext, respectively, of which we can obtain things like the UriInfo to get the path from. public interface ContainerResponseFilter { void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) } public interface ContainerRequestFilter { void filter(ContainerRequestContext requestContext) } Here's a simple example of a logging filter. There a few different ways to bind the filter, but with this example I'll use dynamic binding where I instantiate the filter explicitly, Therefore I don't have a container managed state, and pass the class and method names to the filter public class LoggingFilter implements ContainerRequestFilter, ContainerResponseFilter { private static final Logger logger = Logger.getLogger(LoggingFilter.class.getName()); protected String className; protected String methodName; public NewLoggingFilter(String className, String methodName) { this.c…
answers question: http://stackoverflow.com/q/26553200
has comment: http://stackoverflow.com/comment/41757371
has comment: http://stackoverflow.com/comment/41757211
downvote count: 0
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/41757398
score: 6

http://stackoverflow.com/q/26585584
has comment: http://stackoverflow.com/comment/41786796
linked to: http://stackoverflow.com/q/2064427
tagged with: java
linked to: http://stackoverflow.com/q/5483047
upvote count: 2
has title: Java thread stack memory occupation
answer count: 1
accepted answer: http://stackoverflow.com/a/26601117
tagged with: tomcat
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/41787088
has comment: http://stackoverflow.com/comment/41786929
has comment: http://stackoverflow.com/comment/41788517
has comment: http://stackoverflow.com/comment/41787230
linked to: http://stackoverflow.com/q/20030120
linked to: http://stackoverflow.com/q/10629521
has answer: http://stackoverflow.com/a/26601117
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41787588
has body: As I was studying about threads and the memory they consume (thread stack), I decided to do a simple load test to see how does number of threads affects RAM on my computer. So, for the test I used Tomcat, and in the settings.xml set minimal and maximal web container thread pool to 200. After that I did the same while setting pool to 2000. I was shocked 'cause there was no difference in memory occupation (was checking through Windows Task Manger) and it was almost the same. So I thought maybe those threads have to be in the running state, used a load test tool to "bombard" the server and I've managed to do some heavy load, most of the threads were now in the running state but there was no change in the memory consumption between 200 and 2000 threads. So I'm wondering what is this thread's stack memory all about and does these results mean that memory on the thread stack isn't allocated while the thread is created? How would I be able to simulate thread stack memory growth to the size where a difference in RAM consumption is seen to a "naked eye" on the graphs? Thanks in advance!
type: Question

http://stackoverflow.com/q/26610988
has comment: http://stackoverflow.com/comment/41852115
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26640331
has body: If I embed Swing into embedded JavaFX which is embedded into Swing I do have issues with the focus of controls. Swing - JavaFX - Swing public EmbeddedTestWithFX() { setSize(new Dimension(300, 300)); JTextArea textArea = new JTextArea(); textArea.setSize(new Dimension(150, 150)); JPanel container = new JPanel(); container.setLayout(null); container.add(textArea); JFXPanel jfxPanel = new JFXPanel(); Platform.runLater(() -&gt; { SwingNode swing = new SwingNode(); StackPane stack = new StackPane(swing); Scene scene = new Scene(stack); swing.setContent(container); SwingUtilities.invokeLater(() -&gt; jfxPanel.setScene(scene)); }); setContentPane(jfxPanel); } public static void main(String[] args) { new EmbeddedTestWithFX().setVisible(true); } } Now I can see the TextArea but the issue is, It doesn't get the focus. If I register a FocusListener on the TextArea, I see that it becomes the focus after a click, but it loses the focus instantly. But if I use: -Djavafx.embed.singleThread=true the example starts to work. I can click now the TextArea, it holds the focos and I can enter text. I really don't to use the VM parameter, because this is not an official supported VM feature, because it merges the two application threads of Swing and JavaFX. Do you know, how my example works without using the flag?
score: 0
has comment: http://stackoverflow.com/comment/41834862
tagged with: migration
answer count: 1
has title: Focus issue when mixing JavaFX and Swing multiple times
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41865432
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/41841931

http://stackoverflow.com/a/26638378
answers question: http://stackoverflow.com/q/26631539
type: Answer
accepted answer of: http://stackoverflow.com/q/26631539
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: For anyone stumbling across this, I managed to solve this by using setClipBounds. I did it by creating two textviews of the full size, one with a coloured number and transparent background and the second with a white number and coloured background. Then setClipBounds is applied to the coloured textview as follows - textview.setClipBounds( new Rect(0, originalHeight*(1 - progress), originalWidth, originalHeight); Here, the variable progress has a value between 0 and 1. The Rect has to be defined relative to the view, not relative to the screen. This exact setup achieves an effect something like this, but it could easily be changed to a horizontal bar or whatever else is required.

http://stackoverflow.com/comment/41679642
type: Comment
comment on: http://stackoverflow.com/a/26524387
type: AnswerComment
has text: thanks. definitely not the case at my env. btw, it is in tomcat debug configuration. not application.
score: 0

http://stackoverflow.com/a/26650276
downvote count: 0
answers question: http://stackoverflow.com/q/26645310
upvote count: 2
type: Answer
score: 2
has body: http://www.java2s.com/Code/Java/Collections-Data-Structure/BinaryTree.htm public class BinarySearchTree { private Node root; public boolean insert(int value) { if (root == null) { root = new Node(value); return true; } else { return insert(root, value); } } private boolean insert(Node node, int value) { if (value &lt; node.value) { if (node.left != null) { return insert(node.left, value); } else { node.left = new Node(value); return true; } } else if (value &gt; node.value) { if (node.right != null) { return insert(node.right, value); } else { node.right = new Node(value); return true; } } else { return false; } } public void printInOrder(Node node) { if (node != null) { printInOrder(node.left); System.out.println("Traversed " + node.value); printInOrder(node.right); } } public static void main(String[] args) { BinarySearchTree t = new BinarySearchTree(); System.out.println("insert 5: " + t.insert(5)); System.out.println("insert 4: " + t.insert(4)); System.out.println("insert 7: " + t.insert(7)); System.out.println("insert 4: " + t.insert(4)); t.printInOrder(t.root); } } class Node { Node left; Node right; int value; public Node(int value) { this.value = value; } }
has comment: http://stackoverflow.com/comment/41933972

http://stackoverflow.com/comment/41700819
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26535922
has text: We need to see the code that fills up the `photoArray` array

http://stackoverflow.com/q/26522504
has body: dear programmers! I have a question for the people who worked with Apache Lucene. What better way to index the array of data in Lucene? I use arr [i] = Field: "arr." + i + ".data" Java Code: Field field = new StringField( "arr." + i + ".data", arr[i], Field.Store.YES); doc.add(field);
has comment: http://stackoverflow.com/comment/41679843
type: Question
accepted answer: http://stackoverflow.com/a/26566816
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41677681
tagged with: apache
has comment: http://stackoverflow.com/comment/41676083
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41677789
tagged with: lucene
favorite count: 0
has comment: http://stackoverflow.com/comment/41679705
has answer: http://stackoverflow.com/a/26566816
type: AnsweredQuestion
has title: What better way to index the array of data in Lucene?
upvote count: 3

http://stackoverflow.com/q/26551538
accepted answer: http://stackoverflow.com/a/26551579
has comment: http://stackoverflow.com/comment/41725264
has comment: http://stackoverflow.com/comment/41725313
type: Question
tagged with: java
has title: Why do I get this NullExceptionError?
score: 0
has body: I keep getting a NullExceptionError but I don't know why. I know that such an error occurs when I refer to an object that hasn't been initialized yet. In this situation the error apparently occurs in the second last line of the second file(I commented that one) but I'm pretty sure I've initialized everything in that line.. so I don't know what I should do to fix the error. By the way, the files compile just fine, the error only appears when I press the left-arrow button. public class SnakeGame { JFrame frame; Draw draw; Timer timer; int direction; public static void main(String[] arg) { new SnakeGame(); } SnakeGame() { draw = new Draw(); frame = new JFrame("Snake"); frame.add(draw, BorderLayout.CENTER); frame.setResizable(false); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.addKeyListener(draw); frame.requestFocusInWindow(); } } - public class Draw extends JPanel implements ActionListener, KeyListener { SnakeGame snakeGame; public Draw(SnakeGame snakeGame) { this.snakeGame = snakeGame; } public Draw() { setPreferredSize(new Dimension(500,500)); setBackground(Color.BLACK); setFocusable(true); } @Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key == KeyEvent.VK_LEFT){ System.out.println("left pressed"); setDirection(1); } else if (key == KeyEvent.VK_RIGHT) { System.out.println("right pressed"); } else if (key == KeyEvent.VK_UP) { System.out.println("UP pressed"); } else if (key == KeyEvent.VK_DOWN) { System.out.println("down pressed"); } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e){ } public int getDirection(){ return snakeGame.direction; } public void setDirection(int dir){ snakeGame.direction = dir; //According to the compiler the error occurs here System.out.println(snakeGame.direction); } }
answer count: 2
has comment: http://stackoverflow.com/comment/41725253
possible better answer: http://stackoverflow.com/a/26551619
has answer: http://stackoverflow.com/a/26551579
has answer: http://stackoverflow.com/a/26551619
tagged with: nullpointerexception
type: AnsweredQuestion

http://stackoverflow.com/q/26543901
tagged with: jbpm
downvote count: 0
favorite count: 0
has body: Environment : jBPM 6.0.1.Final, jboss EAP 6.2,spring data jpa 1.4.3.RELEASE,hibernate 4.1.1.Final,spring 4.0.0.RELEASE I'm facing connection pooling leakage issue with jBPM6 tables and hibernate is firing 50+ queries to complete a single task. Let me explain you clearly. In my application I'm performing DML operations on application related tables, I'm observing the connection realeasing machanism by debug as DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http-/127.0.0.1:8080-4) mysqlDS: returnConnection(3492713e, false) [1/20] Connection pooling mechanism works fine and then I submitted a task to be completed by jbpm,some data inserting into jbpm6 tables like SessionInfo, Task and when data inserted,connection is not releasing and for next task also it is not using opened connections and opening new connections and go on.. Finally I'm getting the following message due to jbpm6 tables. Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/mysqlDS at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] ... 111 more I'm using org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean and org.springframework.orm.jpa.JpaTransactionManager for session and transaction which is working for tables i insert data. But not working for data inserting by jbpm6. I configured &lt;property name="…
type: UnansweredQuestion
has title: Connection pool leakage with jBPM6 transactional tables
tagged with: spring
score: 3
answer count: 0
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/41817823
has comment: http://stackoverflow.com/comment/41817528
tagged with: jpa

http://stackoverflow.com/a/26519073
answers question: http://stackoverflow.com/q/26518826
score: 0
has body: take a look on @MapKey JPA anotation... can't test it right now, but it's should be something like @OneToMany(mappedBy="user") @MapKey private Map&lt;Integer, Order&gt; orders;
type: Answer

http://stackoverflow.com/q/26557421
has answer: http://stackoverflow.com/a/26557470
has comment: http://stackoverflow.com/comment/41736195
tagged with: java
tagged with: methods
tagged with: eclipse
has body: So I created a java calculator, now how do I access the answer and replace with the first number through my Memory class? Example: 1 + 1 = 2, then use the answer (2) as my first number so the equation will be 2 + 1 = 3. import java.util.*; public class calculatortest { private Num num; private Ope ope; private Mem mem; public static void main(String args[]){ calculatortest c = new calculatortest(); c.start(); } public calculatortest() { } public void start() { while(true) { describeProgram(); getInput(); getMemory(); } } private void describeProgram() { System.out.println("this is my program and it starts from here"); } private void getInput() { String number1; String operator2; String number2; Scanner scanner = new Scanner(System.in); System.out.print("Number 1: "); number1 = scanner.next(); System.out.print("Operator: "); operator2 = scanner.next(); System.out.print("Number 2: "); number2 = scanner.next(); Num num1= new Num(number1); Num num2 = new Num(number2); Ope ope = new Ope(num1, operator2, num2); Num answer = ope.equation; if (answer.type == 'i') { System.out.println("Answer: " + answer.iNum); } else if (answer.type == 'd') { System.out.println("Answer: " + answer.dNum); } } private void getMemory() { System.out.println("Enter 'YES' to use previous answer OR 'NO' to exit!"); Scanner scanner = new Scanner(System.in); String number1 = scanner.next(); if (number1.equals("YES")){ mem.getStorednumber(); } else if(number1.equals("NO")){ System.exit(0); } } } class Num //Type checking the numbers { public char type; public double dNum; public int iNum; public Num(String value) { if (value.contains(".")) { //I if the values contain a decimal point run double type = 'd'; dNum = Double.parseDouble(value); } else { // Else run as integer type = 'i'; iNum = Integer.parseInt(value); } } public Num(int value) { type = 'i'; iNum = value; } public Num(double value) { type = 'd'; dNum = value; } class Ope{ public String operator2; public Num num1, num2; public Num equation;…
type: Question
answer count: 2
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/26579053
tagged with: calculator
has comment: http://stackoverflow.com/comment/41736196
type: UnansweredQuestion
has title: Created java calculator, I want to use the answer and replace with the first number?

http://stackoverflow.com/q/26602958
upvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26603384
type: UnansweredQuestion
downvote count: 1
tagged with: android-fragments
has answer: http://stackoverflow.com/a/26604041
has title: Android Fragment Navigation Drawer
tagged with: java
score: -1
tagged with: eclipse
tagged with: navigation-drawer
type: Question
answer count: 2
has body: How to change the auto generated code by eclipse when you chose the Android Navigation Drawer , into each individual fragment. So each item on the drawer, on click will load a different fragment layout. I have looked every where for this, I cant find any answer which uses the latest Google update using ActionBarActivity and :minSdkVersion="8" and targetSdkVersion="21". Can anyone help out how to modify this code below, many thankxs. Main Activity public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); } @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) .commit(); } public void onSectionAttached(int number) { switch (number) { case 1: mTitle = getString(R.string.title_section1); break; case 2: mTitle = getString(R.string.title_section2); break; case 3: mTitle = "Test 3 "; break; } } public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); } @Ove…

http://stackoverflow.com/q/26576937
type: Question
has answer: http://stackoverflow.com/a/26577209
accepted answer: http://stackoverflow.com/a/26577209
has comment: http://stackoverflow.com/comment/41771928
has title: Unpredictable FileWriter
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26576992
favorite count: 0
has body: Why does FileWriter write different number of bytes? FileWriter delegates its write(int) method to StreamEncoder, but its code is not available. I know there are different encodings, but FileWriter doesn't provide a way to set one. Why should one use FileWriter, if its behavior is so strange? public static void main(String[] args) { try (FileWriter fos = new FileWriter("out.txt")) { fos.write(127); //writes 1 byte (for i&lt;128) fos.write(2047); //writes 2 bytes (for 127&lt;i&lt;2048) fos.write(Integer.MAX_VALUE); //writes 3 bytes (for 2048&lt;i) } catch (IOException ex) { Logger.getLogger(Experiments.class.getName()).log(Level.SEVERE, null, ex); } } Notepad shows only one symbol in file (if you comment the third fos.write there will be two symbols in notepad). So how can I make it work and read my file unambiguously?
possible better answer: http://stackoverflow.com/a/26576960
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41771513
downvote count: 0
has answer: http://stackoverflow.com/a/26576960
score: 1
tagged with: java
tagged with: filewriter

http://stackoverflow.com/comment/41831022
has text: Wait, are you using Java or JavaScript? Those are different languages.
comment on: http://stackoverflow.com/q/26609491
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26600945
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41815867
type: Answer
has body: Java's references are passed by value. i.e., the reference itself is copied. So whatever changes you do to the passed reference (not the object the reference refers to) will not be reflected on the original object reference.
answers question: http://stackoverflow.com/q/26600912
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26600912
score: 0

http://stackoverflow.com/q/26555199
accepted answer: http://stackoverflow.com/a/26555232
has comment: http://stackoverflow.com/comment/41732164
has comment: http://stackoverflow.com/comment/41732175
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
has title: Java - Why String( a).getBytes() == a not give the same result?
type: Question
has body: For an example array: byte[] arr = {37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104 }; And the code: String a = new String(arr, Charset.forName("US-ASCII")); System.out.println(Arrays.toString(arr)); System.out.println(Arrays.toString(a.getBytes(Charset.forName("US-ASCII")))); System.out.println( Arrays.equals(arr, a.getBytes(Charset.forName("US-ASCII"))) ); The result is: In "Windows-1251": [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104] [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, 63] false In "US-ASCII": [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104] [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, 63, 63, 63, 63, 63, 63] false In "UTF-8": [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104] [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -17, -65, -67, -17, -65, -67, -17, -65, -67, -45, -121, -17, -65, -67] false I have test with various test case and found that they give different arrays when there are negative number. And I tried with "Windows-1251" like in this question but the arrays still different. So my question is: Why? How to fix it? Addtional Info: I'm using JRE8 and on Windows 8.1. Resolution: Use Charset ISO-8859-1, thank to SLaks for explaining and JB Nizet for point out the ISO-8859-1 String a = new String(arr, Charset.forName("ISO-8859-1")); System.out.println(Arrays.toString(arr)); System.out.println(Arrays.toString(a.getBytes(Charset.forName("ISO-8859-1")))); System.out.println( Arrays.equals(arr, a.getBytes(Charset.forName("ISO-8859-1"))) ); Result: [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104] [37, 80, 68, 70, 45, 49, 46, 53, 13, 37, -30, -29, -49, -45, -121, -104] true
linked to: http://stackoverflow.com/q/19036870
has answer: http://stackoverflow.com/a/26555232
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41732206
upvote count: 2

http://stackoverflow.com/q/26640591
has comment: http://stackoverflow.com/comment/41888398
has body: I am writing a program for my Java class that is supposed to raise 2 to whatever power the user puts in and is to terminate when the user enters -1. The raising to the power and everything like that works, but the code I have to filter out letters also filters out special characters. Any suggestions? Here is the code the filters out the characters: inputString = inputString.replaceAll("[^\\d.]", "");
score: 0
tagged with: filter
has title: How to filter out all letters but not all special characters in a string
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/26640970
accepted answer: http://stackoverflow.com/a/26640970
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41888233
has comment: http://stackoverflow.com/comment/41888519
tagged with: java
type: Question

http://stackoverflow.com/q/26581711
tagged with: java
downvote count: 1
has body: what we want is to figure out the way how we could emulate installations so Google would count it as actual legit installation,let's say we have valid gmail account,login/password etc. everything including proxy address.there is even a real human/user used that account for some time. the question is how could we simulation certain application installation for that gmail user
type: Question
has comment: http://stackoverflow.com/comment/41782345
has title: How we could emulate Android apps installations so Google would count it as actual legit installation?
favorite count: 0
tagged with: download
type: UnansweredQuestion
tagged with: google-play
tagged with: android
tagged with: apk
answer count: 0
upvote count: 2
score: 1

http://stackoverflow.com/a/26567537
answers question: http://stackoverflow.com/q/26567516
has body: You need to give it the full package name, and (unless you change the class path) you need to be in the right directory. If the full package name is com.something.Example2 then you'd expect the compiler to produce a file like this: com/something/Example2.class If you make sure you're in the directory immediately above com (i.e., you can see com when you do a directory listing), then you can run it with java com.something.Example2 Note that it's case sensitive. If you used the default package (i.e., the full class name really just is Example2) then you need to be in the directory containing Example2.class, and then you run java Example2 But using the default package is discouraged. The biggest thing you could do to help yourself out is to use an IDE (Eclipse or NetBeans are the most commonly used ones). As soon as you start to write anything at all large or complex, compiling and running from the command line without an IDE will cause you to claw your own eyes out.
has comment: http://stackoverflow.com/comment/41757934
type: Answer
has comment: http://stackoverflow.com/comment/41756758
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41773064
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26577809
has text: I restarted eclipse, switched from debug to java and back again, deleted and replaced the breakpoint.. I even restarted the PC! still nothing

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/26629844

http://stackoverflow.com/a/42419304
type: Answer
has body: I had the same issue. Did what others here recommended to do. What finally resolved it was removing the following plugin entry from my pom.xml: <plugins> org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 <plugins> So I suggest you check all your pom.xml files
answers question: http://stackoverflow.com/q/26645317
score: 0

http://stackoverflow.com/a/26662147
type: Answer
upvote count: 3
has body: Choose whichever makes most sense semantically: If these variables are three for a fundamental reason (maybe they are coordinates in the 3D space of a 3D game engine), then use three separate variables (because making, say, a 4D game engine is not a trivial change). If these variables are three now but they could be trivially changed to be four tomorrow, it's reasonable to consider an array (or, better yet, a new type that contains them). In terms of performance, traditionally local variables are faster than arrays. Under specific circumstances, the array may be allocated on the stack. Under specific circumstances, bound checks can be removed. But don't make decisions based on performance, unless you have first done everything else correctly first and you have thorough tests and this particular piece of code is a performance-critical hot-spot and you're sure that it is the bottleneck of your application at the moment.
answers question: http://stackoverflow.com/q/26662081
score: 3
downvote count: 0

http://stackoverflow.com/comment/41853079
comment on: http://stackoverflow.com/a/26621170
score: 0
type: AnswerComment
has text: Thanks John, that worked but I'm getting a compile error when it runs but if I hit continue and it prints out both messages.
type: Comment

http://stackoverflow.com/a/26544549
answers question: http://stackoverflow.com/q/26544192
accepted answer of: http://stackoverflow.com/q/26544192
upvote count: 2
has body: The first thing is to add equals() and hashCode() to your Emp class, like this (without constructor, getter and setter): public class Emp { private int id; private int salary; private int name; @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Emp)) { return false; } final Emp emp = (Emp) o; if (id != emp.id) { return false; } if (name != emp.name) { return false; } if (salary != emp.salary) { return false; } return true; } @Override public int hashCode() { int result = id; result = 31 * result + salary; result = 31 * result + name; return result; } } And then you can write a method like: public List&lt;Emp&gt; removeDuplicate(final List&lt;Emp&gt; items) { final List&lt;Emp&gt; result = new ArrayList&lt;Emp&gt;(); final List&lt;Emp&gt; doublettes = new ArrayList&lt;Emp&gt;(); for(final Emp item : items) { if (!doublettes.contains(item) { result.add(item); doublettes.add(item); } } return result; } By the way, do you really want an int for name? In your example you use a String and in the constructor int. If you want Stringyou must modify equals() and hashCode().
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41714384
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/26623637
has body: That is because u giving Static method ref into the non static object. according to the java u can not call method threw direct reference. so u need to make that method static. so change your method according to this . public static int roll() { faceValue = (int)(Math.random() * MAX) + 1; return faceValue; } and after you update this this will work for(int roll=1;roll&lt;=total;roll++) { counts[(Die.roll()+Die.roll())]++; //&lt;--error here will be solved } hope this helps.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26622965

http://stackoverflow.com/q/26518189
has answer: http://stackoverflow.com/a/26518242
accepted answer: http://stackoverflow.com/a/26518242
answer count: 1
downvote count: 0
has body: I want to create a properties file on my classpath then put that file in my folder, but I do not understand: what is my classpath? I know that classpath contains jars and references to the top level folders. I also read many related threads regarding the same (What is a classpath?) but I want some very basic explanation for it so that I won't be confused later. My classpath variable contains multiple values so which is the exact path and where should I create my new file? If I try to add new file to the project and file name is "jboss-ejb-client.properties", eclipse gives an error of invalid file name??? Thanks in advance.
linked to: http://stackoverflow.com/q/2396493
favorite count: 0
has title: Creating properties file on Java classpath
has comment: http://stackoverflow.com/comment/41666076
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: classpath
type: Question
upvote count: 2

http://stackoverflow.com/comment/41826141
type: Comment
comment on: http://stackoverflow.com/a/26605530
has text: If the application is yours, you can make it register itself
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41821070
has text: if you want to use 1 port, you have to implement your own Protocol, it could be simple or it could be complex, make some handshake which occurs 1st thing when connection is made, so the Peers exchange some Unique ID, this ID can be associated to the socket and chat window (using a Map or List) , from now on, all messages sent be Peers should contain that ID so receiver can know to which window this msg belongs...
score: 0
comment on: http://stackoverflow.com/q/26602338
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26658261
tagged with: bluej
score: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/41919261
has title: Eratosthenes (prime-finder)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41919675
has comment: http://stackoverflow.com/comment/41918974
has comment: http://stackoverflow.com/comment/41919737
has comment: http://stackoverflow.com/comment/41930448
has comment: http://stackoverflow.com/comment/41919874
answer count: 0
has comment: http://stackoverflow.com/comment/41930289
tagged with: methods
type: Question
has body: The goal of the program is to find the prime-numbers below a certain maximum. the cancelNonPrimes() method acts like it's working (in the step-by-step debugger) but just does not write the false-values to the list... public class Era2 { int m; int i; boolean[] list; /** * Constructor for objects of class Era2 */ public Era2(int max) { m = max; list = new boolean[m]; initialize(); } /** * Constructor for objects of class Era2 with standard-maximum-value = 25 */ public Era2() { m = 25; list = new boolean[m]; initialize(); } /** * Method for initializing an object: all values to true except 0 and 1 */ void initialize() { while (i &lt; m) { setList(i, true); i = i + 1; } setList(0, false); setList(1, false); } /** * Method for setting a bool to a number on the list */ void setList(int p, boolean b) { list[p] = b; } /** * Method for reading the entire list, printed in terminal */ void getList() { for (int p = 0; p &lt; m; p++){ if (readList(p) == true){ System.out.println(p + "true"); } else { System.out.println(p + "false"); } } } /** * Method for reading a specific shizl on the list */ boolean readList(int p) { return list[p]; } /** * Method for setting all non-primes to false */ void cancelNonPrimes() { i = 2; while (i &lt; m) { if (readList(i) == true) { int c = i; int n = 2; while (c &lt; m) { c = (i * n); setList(c, false); n = n + 1; } } i = i + 1; } } }
tagged with: java
has comment: http://stackoverflow.com/comment/41930963

http://stackoverflow.com/a/26675135
upvote count: 3
has comment: http://stackoverflow.com/comment/41956483
score: 3
has comment: http://stackoverflow.com/comment/41957971
accepted answer of: http://stackoverflow.com/q/26667375
answers question: http://stackoverflow.com/q/26667375
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41956802
downvote count: 0
has body: Cássio Mazzochi Molins comment is correct! You need to use GenericEntity: Represents a response entity of a generic type T. Normally type erasure removes generic type information such that a Response instance that contains, e.g., an entity of type List<String> appears to contain a raw List<?> at runtime. Therefore you need to implement something like that: @GET @Produces(MediaType.APPLICATION_JSON) public Response getDrivers() { System.out.println("printline from drivers api"); GenericEntity<List<Driver>> entity = new GenericEntity<List<Driver>>( dao.getDrivers() ){}; return Response.ok(entity).build(); } Edit (updated question) I don't see a problem except your dependencies. Please add MessageBodyWriter/-Reader support by adding the the correct dependencies. Resources I use under construction (Tomcat 7) are: org.glassfish.jersey.core jersey-server org.glassfish.jersey.containers jersey-container-servlet org.glassfish.jersey.bundles jaxrs-ri org.glassfish.jersey.media jersey-media-json-processing org.glassfish.jersey.media jersey-media-json-jackson org.glassfish.jersey.media jersey-media-multipart org.glassfish.jersey.media jersey-media-moxy Have a nice day...
has comment: http://stackoverflow.com/comment/41957622
type: Answer
has comment: http://stackoverflow.com/comment/41956335
has comment: http://stackoverflow.com/comment/41971563

http://stackoverflow.com/comment/41664959
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26517493
has text: _so it autoconverts/boxes the int_ Which `int`?
score: 0

http://stackoverflow.com/q/26589948
answer count: 6
has answer: http://stackoverflow.com/a/26590044
possible better answer: http://stackoverflow.com/a/26590003
score: 0
has answer: http://stackoverflow.com/a/26590003
tagged with: while-loop
has answer: http://stackoverflow.com/a/26590049
has answer: http://stackoverflow.com/a/26590041
has answer: http://stackoverflow.com/a/26590094
has comment: http://stackoverflow.com/comment/41794746
has comment: http://stackoverflow.com/comment/41794811
has comment: http://stackoverflow.com/comment/41795016
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41794792
has comment: http://stackoverflow.com/comment/41794844
accepted answer: http://stackoverflow.com/a/26590049
has answer: http://stackoverflow.com/a/26590139
tagged with: java
tagged with: loops
type: Question
tagged with: for-loop
has body: I have to display "Greater than 10" four times if a user enters in a number greater than 10 and "Less than 10" seven times, if the user enters a number less than 10. I'm able to get the "Less than 10" to display but I'm stumped as to what to do next. public static void main(String args[]) { Scanner sc = new Scanner(System.in); int num; int i = 0; System.out.print("Please enter a number: "); num = sc.nextInt(); if(num &lt; 10) { while(i &lt; 7) { System.out.println("Less than 10"); i++; } } I know I'm screwing up somewhere with the counter variable 'i' but I've been looking at this so long, my brain is fried. Anyone able to assist with this issue? Also, yes. I'm restricted to if statements and while loops.
has title: While loops in an if statement

http://stackoverflow.com/comment/108416180
has text: Yes. Its just that back then we were not able to find the answer. The answer was actually found in the source code itself. Instead of deleting the question. We left the answer also tagged.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26715520
type: AnswerComment

http://stackoverflow.com/q/26608278
has answer: http://stackoverflow.com/a/26608771
has body: Okay so i have been reading up on how to add Images onto a JButton by using ImageIcon but it still seems to not work for me, below is my code, i am using Eclipse workspace and would like some help the below code block is the program without the imports public class Gui extends JFrame { //Declaration of JPanels JPanel Left = new JPanel(null); JPanel Right = new JPanel(null); JPanel TopAd = new JPanel(null); JPanel RightAd = new JPanel(null); //Decleration For Right JPanel ImageIcon img = new ImageIcon("buttonicon.bmp"); JButton[] Case = new JButton[26]; public Gui() { File imageCheck = new File("src/buttonicon.bmp"); if (imageCheck.exists()) { System.out.println("Image file found!"); for (int i = 0; i &lt; 26; i++) { Case[i] = new JButton(String.valueOf((i + 1))); Case[i].setIcon(new ImageIcon("src/buttonicon.bmp")); } } setLayout(null); add(Left); add(Right); add(TopAd); add(RightAd); Left.setBounds(10, 20, 220, 685); Left.setBackground(Color.black); Right.setBounds(240, 125, 500, 580); Right.setBackground(Color.BLUE); TopAd.setBounds(240, 20, 635, 95); TopAd.setBackground(Color.darkGray); RightAd.setBounds(750, 125, 125, 580); RightAd.setBackground(Color.GREEN); //Initalising Right JPanel for (int i = 0; i &lt; 26; i++) { Right.add(Case[i]); } Case[0].setBounds(20, 5, 110, 75); Case[1].setBounds(135, 5, 110, 75); Case[2].setBounds(250, 5, 110, 75); Case[3].setBounds(365, 5, 110, 75); Case[4].setBounds(20, 85, 110, 75); Case[5].setBounds(135, 85, 110, 75); Case[6].setBounds(250, 85, 110, 75); Case[7].setBounds(365, 85, 110, 75); Case[8].setBounds(20, 165, 110, 75); Case[9].setBounds(135, 165, 110, 75); Case[10].setBounds(250, 165, 110, 75); Case[11].setBounds(365, 165, 110, 75); Case[12].setBounds(20, 245, 110, 75); Case[13].setBounds(135, 245, 110, 75); Case[14].setBounds(250, 245, 110, 75); Case[15].setBounds(365, 245, 110, 75); Case[16].setBounds(20, 325, 110, 75); Case[17].setBounds(135, 325, 110, 75); Case[18].setBounds(250, 325, 110, 75); Case[19].setBounds(36…
has title: how to add image to JButton
possible better answer: http://stackoverflow.com/a/26608921
accepted answer: http://stackoverflow.com/a/26608771
has answer: http://stackoverflow.com/a/26608921
has comment: http://stackoverflow.com/comment/41829031
type: AnsweredQuestion
tagged with: java
tagged with: jbutton
type: Question
tagged with: eclipse
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41828915

http://stackoverflow.com/a/26604079
has comment: http://stackoverflow.com/comment/41841252
type: Answer
has body: try with: &lt;Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="true"/&gt;
has comment: http://stackoverflow.com/comment/41838769
has comment: http://stackoverflow.com/comment/41838004
score: 0
answers question: http://stackoverflow.com/q/26592310

http://stackoverflow.com/comment/41775841
comment on: http://stackoverflow.com/a/26579243
has text: Ok thanks. I'll have a look at that. Plus your answer is really good. It is well explained.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41729376
score: 0
comment on: http://stackoverflow.com/a/26543924
type: AnswerComment
has text: change the compilesdkversion to `21` and add this libary to your project properties.. follow this tutorial and see `https://developer.android.com/tools/support-library/setup.html`
type: Comment

http://stackoverflow.com/comment/41907003
score: 0
type: Comment
has text: I guess I should've been more subtle. Does the rest of my question make any sense? I'm looking to minimize the errors that occur because of differences between my testing environment and 'normal' environment. Of course, I could setup the same environment and keep it in sync, but I would rather disable some modules, because I don't see the benefit of having them there.
type: QuestionComment
comment on: http://stackoverflow.com/q/26650366

http://stackoverflow.com/q/26604745
upvote count: 6
tagged with: selenium-grid
has answer: http://stackoverflow.com/a/26605571
accepted answer: http://stackoverflow.com/a/26605571
has answer: http://stackoverflow.com/a/26606053
has body: First of all, sorry for my english, it's not so perfect :) So I'm facing with the following problem: I'm trying to run parallel tests in different browsers using Selenium Grid and TestNg and I pass the parameters in the @BeforeTest method. My problem is that when every test get initialized, it seems that they will use the last test's parameters. So in this example when I run the test, it will open two Chrome, instead of one Firefox and one Chrome. (The browser.getDriver() method returns a RemoteWebDriver) TestNG.xml: <parameter name="platform" value="windows"/> <parameter name="browserVersion" value="32"/> <parameter name="browserName" value="firefox"/> <class name="example.test.login.LoginOverlayTest"/> <parameter name="platform" value="windows"/> <parameter name="browserVersion" value="38"/> <parameter name="browserName" value="chrome"/> <class name="example.test.login.LoginOverlayTest"/> The AbstractTest class: public class SeleniumTest { private static List<WebDriver> webDriverPool = Collections.synchronizedList(new ArrayList<WebDriver>()); private static ThreadLocal<WebDriver> driverThread; public static BrowserSetup browser; @Parameters({ "browserName", "browserVersion", "platform"}) @BeforeTest() public static void beforeTest(String browserName, @Optional("none") String browserVersion, String platform) throws WrongBrowserException, WrongPlatformException { final BrowserSetup browser = new BrowserSetup(browserName, browserVersion, platform); driverThread = new ThreadLocal<WebDriver>() { @Override protected WebDriver initialValue() { final WebDriver webDriver = browser.getDriver(); webDriverPool.add(webDriver); return webDriver; } }; } public static WebDriver getDriver() { return driverThread.get(); } @AfterTest public static void afterTest() { for (WebDriver driver : webDriverPool) { driver.quit(); } } } And my example @Tests: @Test public void test1() throws InterruptedException { WebDriver driver = getDriver(); System.out.println("START: test1"); driver.get(…
favorite count: 0
tagged with: testng
score: 6
type: AnsweredQuestion
tagged with: remotewebdriver
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26606053
type: Question
has title: Parameterized Selenium Tests in Parallel with TestNG
answer count: 2

http://stackoverflow.com/comment/41748547
comment on: http://stackoverflow.com/q/26563213
score: 0
has text: correction (void -> Void) proceeded, using `Boolean.TRUE` is nice trick, thanks
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41702731
type: Comment
has text: No problem my friend. I like to implement these kind of scenarios, if you have any question, people here is ready to help. Regards :)
comment on: http://stackoverflow.com/a/26533482
score: 0
type: AnswerComment

http://stackoverflow.com/q/26601517
answer count: 1
has answer: http://stackoverflow.com/a/26601851
has comment: http://stackoverflow.com/comment/41816857
tagged with: file-io
has title: Client's BufferedInputStream.read() while loop never stops
has body: I EDITED CODE I'm making file transfer program with java I have to send 21 files. my code stops at Client's while loop in run() (It doesn't print "file receive complete") &lt;- see run() in Client Server's CODE class SendFileThread extends Thread { private ServerSocket fileTransferServerSocket; private Socket fileTransferSocket; private BufferedReader requestReader; private PrintWriter requestAnswerer; private BufferedOutputStream fileWriter; private int fileTransferPort = 12345; public SendFileThread() { try { fileTransferServerSocket = new ServerSocket(fileTransferPort); fileTransferSocket = fileTransferServerSocket.accept(); requestReader = new BufferedReader(new InputStreamReader(fileTransferSocket.getInputStream())); fileWriter = new BufferedOutputStream(fileTransferSocket.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } } public void CloseTransferStream() { try { requestAnswerer.close(); requestReader.close(); fileWriter.close(); fileTransferSocket.close(); fileTransferServerSocket.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } public void SendFile(String filename) { try { File file = new File(CLIENT_PATH + "/" + filename); BufferedInputStream fileReader = new BufferedInputStream(new FileInputStream(file)); int packet; while((packet = fileReader.read()) != -1) fileWriter.write(packet); fileWriter.flush(); fileReader.close(); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } //System.out.print(filename + " send complete (" + count + " times)"); } public void ListenForRequester() { try { String input; while((input = requestReader.readLine()) != null) { if(input.equals("request file")) { SendFile(requestReader.readLine()); } else if(input.equals("end transfer")) break; else { System.out.println("Something wrong"); } } } catch(IOException ioe) { ioe.getStackTrace(); } } public void run() { ListenForRequester(); CloseTransferStream(); } } Client's CODE class ReceiveFileThread extends Thread { private Socket fil…
has comment: http://stackoverflow.com/comment/41817168
has comment: http://stackoverflow.com/comment/41816936
score: 0
accepted answer: http://stackoverflow.com/a/26601851
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: file-transfer

http://stackoverflow.com/comment/41883413
score: 1
has text: show us your main class, and where you call the function
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26638092

http://stackoverflow.com/comment/41940018
score: 0
type: Comment
has text: I'm confident then that its forming the stream correctly... so here comes some server-side troubleshooting. Thanks again Jon. I'm done for the day.
type: AnswerComment
comment on: http://stackoverflow.com/a/26669431

http://stackoverflow.com/q/26528561
answer count: 2
type: UnansweredQuestion
has title: Creating an evenly spaced table
has body: I have written this code so I know it works but I always seem to have difficulties creating a table so my numbers are evenly spaced. Can anyone help me with my last method PlayTour() so when I run the program my table of numbers are evenly spaced and line up correctly? public void playTour() { System.out.printf("%n%n"); //display numbers in column for (int a = 0; a &lt; 8; a++) System.out.printf(" %d", a); System.out.printf("%n%n"); for (int row = 0; row &lt; chessBoard[0].length; row++) { System.out.printf("%d ", row); for (int column = 0; column &lt; chessBoard[1].length; column++) System.out.printf(" %d", chessBoard[row][column]); System.out.println(); } }//end method playTour
has comment: http://stackoverflow.com/comment/41683805
has comment: http://stackoverflow.com/comment/41683819
tagged with: java
has answer: http://stackoverflow.com/a/26528871
type: Question
has answer: http://stackoverflow.com/a/26528719
score: 0

http://stackoverflow.com/comment/41693488
comment on: http://stackoverflow.com/q/26533616
score: 0
type: Comment
has text: Yeah...but how do I know that in the web layer if the service layer does not tell the web layer that something wrong happend? By magic?
type: QuestionComment

http://stackoverflow.com/q/26665024
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/41932362
has body: We have some legacy reflected proxy generation code which basically works like this if you look at it as a black box: Object someObject = new Anything(); Object debugObject = ProxyUtils.wrapWithDebugLogging(someObject); wrapWithDebugLogging takes any object and overrides any method it can (final methods are obviously unfixable if you're extending a real class), intercepting it to log a message about the call, then calling the real method. Inside, it's using cglib to do the work and has a bit of protective logic before it constructs the proxy, because anonymous classes are final, yet can be handled by using the superclass or single interface they implement: Class&lt;?&gt; clazz = someObject.getClass(); Class&lt;?&gt; interfaces = clazz.getInterfaces(); // Anonymous classes are final so you can't extend them, but we know they only have one // superclass or one interface. if (clazz.isAnonymousClass()) { clazz = interfaces.length &gt; 0 ? interfaces[0] : primaryType.getSuperclass(); } Enhancer enhancer = new Enhancer(); if (clazz.isInterface()) { interfaces.add(clazz); } else { enhancer.setSuperclass(primaryType); } enhancer.setInterfaces(interfaces.toArray(new Class[interfaces.size()])); The problem is that Java 8's "lambda" classes return false for isAnonymousClass(). But we would like to treat them exactly the same as the anonymous class. It has been pointed out before that there is no way to determine that a class is a lambda class "by design". But this just seems more like something lacking in the reflection API to me and it certainly isn't the first time Java has "forgotten" to add something obvious to a new API. So is there a sensible way to distinguish a lambda from a non-lambda without having this feature in the API? I can see that isSynthetic() returns true, but it also returns true for all kinds of other things, presumably.
has comment: http://stackoverflow.com/comment/41931930
has comment: http://stackoverflow.com/comment/41932055
upvote count: 2
type: UnansweredQuestion
tagged with: lambda
tagged with: java-8
linked to: http://stackoverflow.com/q/23870478
has answer: http://stackoverflow.com/a/26665171
tagged with: reflection
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41932485
downvote count: 1
type: Question
tagged with: cglib
has answer: http://stackoverflow.com/a/26672135
has title: How can I safely proxy a lambda when I don't know whether it's a lambda up-front?
has answer: http://stackoverflow.com/a/26666261
has comment: http://stackoverflow.com/comment/41943143

http://stackoverflow.com/q/26554220
has comment: http://stackoverflow.com/comment/41730608
type: Question
has title: javaexe based program does not run normally on Windows 8.1
has comment: http://stackoverflow.com/comment/41730954
has comment: http://stackoverflow.com/comment/41731176
has answer: http://stackoverflow.com/a/26565884
upvote count: 2
tagged with: wrapper
has comment: http://stackoverflow.com/comment/41730260
has comment: http://stackoverflow.com/comment/41747601
answer count: 1
tagged with: windows-8.1
has comment: http://stackoverflow.com/comment/41730935
has comment: http://stackoverflow.com/comment/41730462
tagged with: javaexe
has comment: http://stackoverflow.com/comment/41730716
type: UnansweredQuestion
tagged with: windows
has comment: http://stackoverflow.com/comment/41756245
has body: I created a program using javaexe, a wrapper for Java programs that allows them to be launched by an exe file. This program contains a service part, a taskbar part (they send messages one to another). The program purpose is to send SMS and the list of the SMS sent is available from the taskbar icon. The program has been working since a few years on a Windows XP computer, but I would like to launch it from my Windows 8.1 laptop computer, and when I launch the EXE, the splash screen is displayed, the service is installed, but the icon in the taskbar does not appear, and the serviceInit method does not seem to be run. Where does the problem come from? My computer uses Windows 8.1, with Avast! as antivirus and the Comodo firewall. I obviously tested my program having disabled these 2 security programs (Avast! and Comodo) but there is still the same problem.
has comment: http://stackoverflow.com/comment/41730346
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41730847
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/41731114
has comment: http://stackoverflow.com/comment/41731198
has comment: http://stackoverflow.com/comment/41730696

swiperefreshlayout
type: Tag
tags question: http://stackoverflow.com/q/26575629
tags question: http://stackoverflow.com/q/26640644
tag name: swiperefreshlayout

http://stackoverflow.com/comment/41870889
comment on: http://stackoverflow.com/a/26631130
score: 0
type: Comment
has text: @shinjw: it also means value.substring(0, value.length) is a valid method call. If the end index were inclusive the above would fail - which would be unintuitive.
type: AnswerComment

http://stackoverflow.com/q/26655331
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/49854059
tagged with: spring
score: 2
tagged with: spring-jdbc
type: AnsweredQuestion
tagged with: stored-procedures
has answer: http://stackoverflow.com/a/26661779
tagged with: java
has title: Pass array as input parameter to an oracle stored procedure using simple jdbc call
type: Question
possible better answer: http://stackoverflow.com/a/26661779
has body: Here is my oracle procedure specifications CREATE OR REPLACE PACKAGE PKG_RE_FI AS PROCEDURE PRC_RE_FI_DETAILS(P_FAN_NO IN VARCHAR2, P_REF_ID IN TY_APP_REF_ID, P_COMMENTS IN VARCHAR2, P_BILLING_FLAG IN VARCHAR2, P_STATUS OUT VARCHAR2); END PKG_RE_FI; TY_APP_REF_ID is CREATE OR REPLACE TYPE ty_app_REF_ID as varray(500) of obj_array_ref_id CREATE OR REPLACE TYPE obj_array_ref_id AS OBJECT( app_ref_id VARCHAR2(100) ) I am using Spring JDBC Framework(SimpleJdbcCall object) to execute above procedure. Below is the code snippet in which i have declared this.reFIJdbcCall = new SimpleJdbcCall(dataSource).withCatalogName("PKG_RE_FI"). withProcedureName("PRC_RE_FI_DETAILS").declareParameters(new SqlParameter("P_FAN_NO", Types.VARCHAR), new SqlParameter("P_REF_ID", Types.ARRAY), new SqlParameter("P_COMMENTS", Types.VARCHAR), new SqlParameter("P_BILLING_FLAG", Types.VARCHAR), new SqlOutParameter("P_STATUS", Types.VARCHAR) ); How should i pass array to the new SqlParameter("P_REF_ID", Types.ARRAY), to MapSqlParameterSource MapSqlParameterSource in = new MapSqlParameterSource();
has answer: http://stackoverflow.com/a/49854059
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/74577469
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/43760399
has text: Then just add a brief note like "per the comment by AliceW" or "as noted in comment by SusanH". As it is now, that opening paragraph is a confusing distraction.

http://stackoverflow.com/a/26588240
has body: No,It's not safe to store passwords on the device. small advice is always store passwords in char[] in encrypted form rather than storing in a String whenever it is mandatory to store. Since Strings are immutable in Java if you store password as plain text it will be available in memory until Garbage collector clears it and since Strings are used in String pool for re-usability there is pretty high chance that it will be remain in memory for long duration, which pose a security threat. Since any one who has access to memory dump can find the password in clear text and that's another reason you should always use an encrypted password than plain text. Since Strings are immutable there is no way contents of Strings can be changed because any change will produce new String. So Storing password in character array clearly mitigates security risk of stealing password.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26587713
type: Answer
score: 2

http://stackoverflow.com/comment/41682764
type: Comment
has text: Just note that all others will have their `.classpath` deleted when they pull. This could be a major concern. BTW if you used the `--cached` option, the file would not have been removed from the filesystem, just from the index.
type: QuestionComment
comment on: http://stackoverflow.com/q/26527815
score: 0

http://stackoverflow.com/comment/41866706
comment on: http://stackoverflow.com/q/26628789
type: Comment
type: QuestionComment
has text: I think there will be no prob if u calling other method from some method then that other method will be execute till that calling method will be in wait state. there is not dead local at all.
score: 0

http://stackoverflow.com/a/48519316
score: 1
has body: I faced this problem today and I found out the reason it's fetch lazily didn't invoke when we access public variable. Fetch lazily can be invoked by calling getter method of attributes. So I need to create getter in my model fetch data using getter method. @Entity public class Company extends Model { @Id public Integer id; public String name; public Integer getId() { return id; } public String getName() { return name; } } Then fetch company: System.out.println(mrJohn.company.getName());
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26563438

http://stackoverflow.com/q/26607978
has answer: http://stackoverflow.com/a/26608024
has title: Loading image isnt displaying until after the page has loaded.
type: UnansweredQuestion
tagged with: vb.net
has body: I am a newbie to the world of javascript/jquery. I am trying to show a loading image until my page has finished loading. I dont know where I am going wrong. I have read many posts regarding this already but my image and script are both not working. Please see my markup below. I have tried using response.write(html string) and response.flush to sort this out and it works but i then have a major issue at response.redirect with headers already sent as flush causes html buffer to flush. I have used the same code as below in the script tag except didnt have window.load bit in there. This is due to my putting my response.write and flush in page event init & pre-render. <%: Page.Title %> - InfoCentre MI TEST VERSION <asp:PlaceHolder runat="server"> <%: Scripts.Render("~/bundles/modernizr") %> </asp:PlaceHolder> <webopt:BundleReference runat="server" Path="~/Content/css" /> <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
tagged with: java
type: Question
tagged with: jquery
tagged with: asp.net
score: 0
answer count: 1

http://stackoverflow.com/comment/41774871
has text: I haven't thought of changing all Arrays. I checked that solution and you can't pass ArrayList<Integer> to sort(ArrayList<Comparable> list)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26578560
type: AnswerComment

http://stackoverflow.com/a/26568802
score: 21
upvote count: 21
answers question: http://stackoverflow.com/q/26568789
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26568789
has body: Hmm does ArrayList.contains() iterate? /** * Returns &lt;tt&gt;true&lt;/tt&gt; if this list contains the specified element. * More formally, returns &lt;tt&gt;true&lt;/tt&gt; if and only if this list contains * at least one element &lt;tt&gt;e&lt;/tt&gt; such that * &lt;tt&gt;(o==null&amp;nbsp;?&amp;nbsp;e==null&amp;nbsp;:&amp;nbsp;o.equals(e))&lt;/tt&gt;. * * @param o element whose presence in this list is to be tested * @return &lt;tt&gt;true&lt;/tt&gt; if this list contains the specified element */ public boolean contains(Object o) { return indexOf(o) &gt;= 0; } /** * Returns the index of the first occurrence of the specified element * in this list, or -1 if this list does not contain the element. * More formally, returns the lowest index &lt;tt&gt;i&lt;/tt&gt; such that * &lt;tt&gt;(o==null&amp;nbsp;?&amp;nbsp;get(i)==null&amp;nbsp;:&amp;nbsp;o.equals(get(i)))&lt;/tt&gt;, * or -1 if there is no such index. */ public int indexOf(Object o) { if (o == null) { for (int i = 0; i &lt; size; i++) if (elementData[i]==null) return i; } else { for (int i = 0; i &lt; size; i++) if (o.equals(elementData[i])) return i; } return -1; } Why yes. Yes it does. Does HashMap.containsKey() iterate? /** * Returns &lt;tt&gt;true&lt;/tt&gt; if this map contains a mapping for the * specified key. * * @param key The key whose presence in this map is to be tested * @return &lt;tt&gt;true&lt;/tt&gt; if this map contains a mapping for the specified * key. */ public boolean containsKey(Object key) { return getEntry(key) != null; } /** * Returns the entry associated with the specified key in the * HashMap. Returns null if the HashMap contains no mapping * for the key. */ final Entry&lt;K,V&gt; getEntry(Object key) { if (size == 0) { return null; } int hash = (key == null) ? 0 : hash(key); for (Entry&lt;K,V&gt; e = table[indexFor(hash, table.length)]; e != null; e = e.next) { Object k; if (e.hash == hash &amp;&amp; ((k = e.key) == key || (key != null &amp;&amp; key.equals(k)))) return e; } ret…
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42281974
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26793044
has text: Thanks a lot @dave_thompson_085 for your detailed expalnation. I tried the steps mentioned by you and was able to validate a server certificate with its issuer certificate.
type: Comment

http://stackoverflow.com/comment/41806433
has text: You may want to add the code in the sendMail method...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26595952
type: Comment

http://stackoverflow.com/q/26616060
has body: I am trying to set the image of my imageButtons when a user is selecting a photo from the gallery or is taking a photo using the camera. The problem is that my imageButtons are just changed to a blank image, but I am getting the file directory. What am I doing wrong? I have created my ImageIntent and onActivityResult from this answer camera &amp; gallery. But here is my onActivityResult method: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_IMAGE_CAPTURE) { final boolean isCamera; if (data == null) { isCamera = true; } else { final String action = data.getAction(); if (action == null) { isCamera = false; } else { isCamera = action .equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } Uri selectedImageUri; if (isCamera) { selectedImageUri = outputFileUri; } else { selectedImageUri = data == null ? null : data.getData(); } ImageButton pic1 = (ImageButton) findViewById(R.id.ibPic1); Toast.makeText(this, "Image saved to:\n" + selectedImageUri, Toast.LENGTH_LONG).show(); pic1.setImageURI(selectedImageUri); } } } So i know from the Toast that I am getting the Uri's. I have tried this answer, and various other solutions which involves some sort of Bitmap, but these are always resulting in app crash and out of memory exceptions. Edit OnClick method to launch the image intent: public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.ibPic1: openImageIntent(); break; } } Image intent method private void openImageIntent() { // Determine Uri of camera image to save. final File root = new File(Environment.getExternalStorageDirectory() + File.separator + "Klea" + File.separator); root.mkdirs(); final String fname = Sell.getUniqueImageFilename(); final File sdImageMainDirectory = new File(root, fname); outputFileUri = Uri.fromFile(sdImageMainDirectory); // Camera. final List&lt;Intent&gt; cameraIntents = new ArrayList&lt;Intent&gt;(); final Int…
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/4455558
has title: setImageURI not working
has comment: http://stackoverflow.com/comment/41843434
possible better answer: http://stackoverflow.com/a/74981744
has answer: http://stackoverflow.com/a/74981744
downvote count: 0
has comment: http://stackoverflow.com/comment/41843503
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41844332
has comment: http://stackoverflow.com/comment/41843940
tagged with: android
has comment: http://stackoverflow.com/comment/41843537
score: 1
has comment: http://stackoverflow.com/comment/41843606
linked to: http://stackoverflow.com/q/10473823
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26616801
accepted answer: http://stackoverflow.com/a/26616801

http://stackoverflow.com/comment/41964214
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26676789
has text: Do you mean send only a `JSONObject` from the restlet and then use an `ObjectMapper` on the client?If it's so, I think that it's not possible: jackson is the only one to support circular dependencies into pojo objects; with other jsons (`gson` or `java-json`) I always have a stack overflow exception. Also, if it matters, even if I remove the jackson's packages from the deployment and the `ObjectManager` from the restlet class, I'm continuing to have the exception `INFO: Unable to register the helper org.restlet.ext.jackson.JacksonConverter java.lang.NoSuchFieldError: APPLICATION_YAML`

http://stackoverflow.com/q/26572622
answer count: 1
has title: String passed from Android POST request to PHP in server not being recognized properly in MySQL SELECT query
has answer: http://stackoverflow.com/a/26582804
tagged with: mysqli
tagged with: android
has body: I've been hacking at this one for a while, but I can't find a good reason for the following behavior: I have an Android app from which I send a multipart/form-data http post. The request has the following form: private final String delimiter = "--"; private final String boundary = "SwA" + Long.toString(System.currentTimeMillis()) + "SwA"; private final String charset = "UTF-8"; private final String lineSpace = "\r\n"; private final String domain = (domain); private HttpURLConnection configureConnectionForMultipart(String url) throws MalformedURLException, IOException { HttpURLConnection con = (HttpURLConnection) (new URL(url)) .openConnection(); con.setRequestMethod("POST"); con.setDoInput(true); con.setDoOutput(true); con.setRequestProperty("Connection", "Keep-Alive"); con.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); return con; } private void addFormPart(String paramName, String value, DataOutputStream os) throws IOException { os.writeBytes(lineSpace + delimiter + boundary + lineSpace); os.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"" + lineSpace); os.writeBytes("Content-Type: text/plain; charset=" + charset + lineSpace); os.writeBytes(lineSpace + value + lineSpace); os.flush(); } private void addFilePart(String paramName, File data, DataOutputStream os) throws IOException { os.writeBytes(lineSpace + delimiter + boundary + lineSpace); os.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"" + lineSpace); os.writeBytes("Content-Type: application/octet-stream\r\n"); os.writeBytes("Content-Transfer-Encoding: binary" + lineSpace); os.writeBytes(lineSpace); os.flush(); FileInputStream fis = new FileInputStream(data); byte[] buffer = new byte[4096]; int bytesRead = -1; while ((bytesRead = fis.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } os.writeBytes(lineSpace); os.flush(); fis.close(); } private void finishMultipart(DataOutputStream os) throws IOException { os.writeBytes(lineSpac…
tagged with: php
accepted answer: http://stackoverflow.com/a/26582804
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
score: 0

http://stackoverflow.com/comment/41938250
score: 0
type: Comment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ Well, I tried the code in my Eclipse IDE and it compiles and throws an exception in runtime. I guess the compiler doesn't optimize it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26668585

http://stackoverflow.com/comment/42011609
type: AnswerComment
score: 0
type: Comment
has text: I've edited my answer to add a method that recurse through a directory instead of listing just the directory.
comment on: http://stackoverflow.com/a/26549466

http://stackoverflow.com/a/26641392
score: 0
has body: Place your DrivingTest.txt file in the same package where your java file is (in my code Test Class) and Try this... public class Test { String message; public Test() throws IOException{ File path=(new File(Test.class.getProtectionDomain().getCodeSource().getLocation().getPath())).getParentFile(); File txtfile=new File(path,"DrivingTest.txt"); BufferedReader br=new BufferedReader(new FileReader(txtfile)); message=br.readLine(); br.close(); } after this you can access your message string int your jsp. !!!!!!!!!must reDeploy your Web Application!!!!!!!!!
answers question: http://stackoverflow.com/q/26639056
type: Answer

http://stackoverflow.com/a/26632318
has body: null is generally considered more as a place-holder to to set Object references to ,well null to make the Objects eligible for Garbage collection etc, it has a lot more uses too...coming back to your Qeeston Yes null can be considered a Special reference type too
upvote count: 1
answers question: http://stackoverflow.com/q/26632104
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/26535922
type: UnansweredQuestion
has body: I am currently creating a program designed to take pictures from flickr and put them up on a new window. I am making a Junit test to test whether any of the photos are the same. When I run the test, it fails, despite the fact I have ensured that the photos are all unique. The code is as follows: public void test1() { PhotoViewer viewer = this; PhotoFinder finder = new FlickrPhotoFinder("***************************"); PhotoController controller = new PhotoController3(finder, viewer); viewer.setController(controller); controller.initialize(); for ( int i = 0 ; i&lt;20 ; i++ ) { for ( int j = 0 ; j&lt;20 ; j++ ) { if ( j != i ) { assertNotSame(photoArray[i], photoArray[j]); } } } } The array photoArray contains photos in the form of JPEGs. There are 3 different searches which are used in the program as topics. photoController3 sets atleast one of the 20 spaces in photoArray[] to be of each the topics and then randomly allocates the remaining photos. In photoController3, the array is intialised such that photoArray[x] is the xth photo on flickr of that search, so no 2 photos can be the same.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41697796
tagged with: testing
has comment: http://stackoverflow.com/comment/41700819
has title: I am trying to use assertNotSame but when I run the Junit test, it fails where it shouldn't
score: 0
tagged with: assert
tagged with: junit
answer count: 0

http://stackoverflow.com/a/26617782
has body: "So how can I speed up the consumer throughput so that the consumer can catch up with the producer and avoid the message overflow in the queue?" This is the answer "use multiple consumers to consume the incoming message simultaneously", use multi-threading to run in parallel these consumers implementing principle shared nothing, http://www.eaipatterns.com/CompetingConsumers.html
answers question: http://stackoverflow.com/q/26617649
has comment: http://stackoverflow.com/comment/41847252
type: Answer
has comment: http://stackoverflow.com/comment/41846903
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41847908
has comment: http://stackoverflow.com/comment/41847067

http://stackoverflow.com/comment/41944325
comment on: http://stackoverflow.com/a/26671710
has text: Where have you read that? Anyways HttpURLConnection is a general-purpose, lightweight HTTP client. HttpClient is significantly faster than HttpUrlConnection. You can also check this link: http://stackoverflow.com/a/9551206/2330675
type: AnswerComment
score: 0
type: Comment

android-layout
tags question: http://stackoverflow.com/q/26636859
tag name: android-layout
tags question: http://stackoverflow.com/q/26569904
tags question: http://stackoverflow.com/q/26586958
tags question: http://stackoverflow.com/q/26574328
tags question: http://stackoverflow.com/q/26567259
tags question: http://stackoverflow.com/q/26599391
tags question: http://stackoverflow.com/q/26546017
tags question: http://stackoverflow.com/q/26526795
tags question: http://stackoverflow.com/q/26563788
tags question: http://stackoverflow.com/q/26524572
type: Tag
tags question: http://stackoverflow.com/q/26542967
tags question: http://stackoverflow.com/q/26614414
tags question: http://stackoverflow.com/q/26606113
tags question: http://stackoverflow.com/q/26660645
tags question: http://stackoverflow.com/q/26596717
tags question: http://stackoverflow.com/q/26623353
tags question: http://stackoverflow.com/q/26533926
tags question: http://stackoverflow.com/q/26553918
tags question: http://stackoverflow.com/q/26668594
tags question: http://stackoverflow.com/q/26518729
tags question: http://stackoverflow.com/q/26540448
tags question: http://stackoverflow.com/q/26529358
tags question: http://stackoverflow.com/q/26595974
tags question: http://stackoverflow.com/q/26667007
tags question: http://stackoverflow.com/q/26592439

http://stackoverflow.com/comment/41681192
comment on: http://stackoverflow.com/a/26527013
type: Comment
has text: Cheers mate, that makes sense. But why do you declare the Arraylist as "List"?
score: 0
type: AnswerComment

variables
tag name: variables
tags question: http://stackoverflow.com/q/26585700
tags question: http://stackoverflow.com/q/26531696
tags question: http://stackoverflow.com/q/26551358
tags question: http://stackoverflow.com/q/26602815
type: Tag
tags question: http://stackoverflow.com/q/26661303
tags question: http://stackoverflow.com/q/26541743
tags question: http://stackoverflow.com/q/26671316
tags question: http://stackoverflow.com/q/26620891
tags question: http://stackoverflow.com/q/26527393
tags question: http://stackoverflow.com/q/26550342
tags question: http://stackoverflow.com/q/26569525
tags question: http://stackoverflow.com/q/26620500
tags question: http://stackoverflow.com/q/26585709

http://stackoverflow.com/q/26646025
tagged with: java
type: Question
has title: Email issue, sending some lines of string but not sending others
score: 0
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/41899025
has body: I have created the following code: for (i=0;i&lt;count;i++) { substM=LinesList.get(index[i]).split("[|]"); ///*********Email settings************//// final String username = "it-support@test.com"; final String password = "IamSoHappy"; Properties props = new Properties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.host", "mail.test.com"); props.put("mail.smtp.port", "25"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); Message message = new MimeMessage(session); message.setFrom(new InternetAddress("it-support@test.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("Alen@test.com")); message.setSubject(substM[10]+" is left open by "+ substM[11]); ///*******To get Date and Time******///// String st=substM[13]; Date date = new SimpleDateFormat("yyMMddHHmmss",Locale.getDefault()).parse(st); ///******************************////// String st1= substM[10],st2=substM[11]; message.setText("Dear IT Support Team," + "\n\n"+st1+" is left opened by '"+ st2+"' since "+date +" .. !!" + "\n\n"+"Regards," + "\nIT Support Team"); Transport.send(message); } If index[i] contains the index in string list that contains the lines which I want to view, and these lines contains following info : 002|0000|00|00002392651|41933.3385069444|00032018|M| |1|2|OFFICE 2|guest03 guest03|0|141021080727| 002|0000|00|00002392651|41932.3409953704|00032018|M| |1|2|OFFICE 2|Lubna|0|141020081102| 002|0000|00|00002392651|41933.3385069444|00032018|M| |1|2|OFFICE 2|guest03 guest03|0|141021080100| I was able to print all lineslist.get(index[i]), and its output, the same as the above lines, I am also able to receive first and last line but, not the middle one ? Why is that ???
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41922613
has comment: http://stackoverflow.com/comment/41899187
has comment: http://stackoverflow.com/comment/41903578
answer count: 0

http://stackoverflow.com/q/26559013
accepted answer: http://stackoverflow.com/a/26597751
tagged with: dalvik
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41739547
answer count: 1
linked to: http://stackoverflow.com/q/1961146
score: 0
tagged with: java
has title: Using NDK to get an Object's pointing memory address
tagged with: android-ndk
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/26597751
has body: I'm currently on a curious trip and I'm trying to create a native method that returns the memory address of a Java Object. I have properly configure Android's NDK and my Java method is: public static native String getAddressOf(Object obj); Following that, my native implementation in C: jstring Java_com_danysantiago_andmemutil_MemoryUtils_getAddressOf(JNIEnv *env, jobject clazz, jobject obj) { char buffer[11]; sprintf(buffer, "%p", obj); return (*env)-&gt;NewStringUTF(env, buffer); } But for some reason the returned string address is always the same no matter how much I play around with the app on the emulator. I'm assuming I'm not getting the actual memory pointer or my Java knowledge of how objects are stored in memory is wrong. More Background Story: I have successfully obtained the address of an Object in a standard Java app that runs on my computer's JVM following this stackoverflow answer. I was able to confirm it because I made a heap dump and then used MAT to do a search for address which resulted in an instance of my dummy class. However, sun.misc.unsafe is not available in Android. When I try to follow similar steps, making a heap dump of the Android app and searching for the address that the method returns I get no result, but if I use OQL, that is available with MAT I can find the instance of my dummy class with a different address. Looking at how using unsafe one gets the address makes me wonder that in reality I too, with native code, have to calculate the address inspecting the Object fields. Bring in your knowledge awesome people! Thanks! :)
type: AnsweredQuestion

http://stackoverflow.com/a/27583754
score: 1
answers question: http://stackoverflow.com/q/26609078
has body: After spending hours and hours on this, I created a TestListActivity that hooked up to the native Contacts content provider - and that all worked/updated as it should, so I knew the issue was probably in my own content provider that I'd written. I found the answer here. Turns out I had not called setNotificationUri(ContentResolver cr, Uri uri) on the cursor returned by the query() method of my content provider. (I'm sure this was never mentioned in the Reto Mauer book I was working from...) :/ Anyway, all sorted now! :)
accepted answer of: http://stackoverflow.com/q/26609078
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/26555200
score: 0
type: Answer
has body: Another solution could be: add the annotation to your date field, it will convert the long timestamp to date @Temporal(TemporalType.TIMESTAMP) Your code should look like @Column(name = "datetime") @Temporal(TemporalType.TIMESTAMP) @NotNull public Date getDateTime() { return dateTime; }
answers question: http://stackoverflow.com/q/26541220
has comment: http://stackoverflow.com/comment/41737011

http://stackoverflow.com/comment/41815051
score: 0
type: Comment
has text: Wow, that's actually helped me! Thank you so much! I expected a bundle with version 2.0.2 to export it's packages with the same version...I was wrong. Thank you again for your help!
type: AnswerComment
comment on: http://stackoverflow.com/a/26598019

http://stackoverflow.com/comment/41872606
comment on: http://stackoverflow.com/q/26625898
score: 0
has text: Ehh, I use Free Layout. Please help me with respect to NetBeans IDE 8.0-since it has an XML-based drag and drop GUI builder, on which I built my application, it does not allow me to create textfields by code.
type: Comment
type: QuestionComment

jersey
tags question: http://stackoverflow.com/q/26667319
tags question: http://stackoverflow.com/q/26555408
tags question: http://stackoverflow.com/q/26625142
tags question: http://stackoverflow.com/q/26624183
tags question: http://stackoverflow.com/q/26606307
tags question: http://stackoverflow.com/q/26590042
tags question: http://stackoverflow.com/q/26650225
tags question: http://stackoverflow.com/q/26568218
tags question: http://stackoverflow.com/q/26575541
tags question: http://stackoverflow.com/q/26653948
tags question: http://stackoverflow.com/q/26576301
tags question: http://stackoverflow.com/q/26659668
tags question: http://stackoverflow.com/q/26644556
tags question: http://stackoverflow.com/q/26518996
tags question: http://stackoverflow.com/q/26542268
tags question: http://stackoverflow.com/q/26556861
tags question: http://stackoverflow.com/q/26590431
tags question: http://stackoverflow.com/q/26543703
tags question: http://stackoverflow.com/q/26560999
tag name: jersey
tags question: http://stackoverflow.com/q/26564464
tags question: http://stackoverflow.com/q/26621838
tags question: http://stackoverflow.com/q/26645730
tags question: http://stackoverflow.com/q/26599710
tags question: http://stackoverflow.com/q/26552331
tags question: http://stackoverflow.com/q/26622534
tags question: http://stackoverflow.com/q/26566561
tags question: http://stackoverflow.com/q/26666071
tags question: http://stackoverflow.com/q/26577771
tags question: http://stackoverflow.com/q/26549005
type: Tag
tags question: http://stackoverflow.com/q/26661711
tags question: http://stackoverflow.com/q/26546373

http://stackoverflow.com/a/26541057
type: Answer
score: 0
has body: The problem caused in second loop during initialize j = i. This interrupt the var j to be increment. It should be j++ or j += 1 or j = j + 1. Example here... for (int i = 1; i &lt;= 10; i++) { for (int j = 1; j &lt;= i ; j++) { jTextArea1.append(" "+i); } }
answers question: http://stackoverflow.com/q/26541013

http://stackoverflow.com/a/26579032
upvote count: 2
has body: OnResume() can only be called after OnStart(). Is that true? onStart() will have been called by the time onResume() is called. If there is no onStart() method then how can activity will get start? You are inheriting onStart() from Activity.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26579016

http://stackoverflow.com/comment/41781656
type: Comment
comment on: http://stackoverflow.com/a/26582229
has text: In a way. But that is not how we use the word "sort" in IT. At the fundamental level, this does not require us to place the words into any specific order, and that is what "sorting" means in IT.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26670266
tagged with: xml-rpc
has body: I was wondering if anyone knows how to send custom HTTP headers using an XmlRpcClient in Java? I see a custom header can be set using XmlRpcHttpTransport.setRequestHeader() but I don't see a way of tying this in with the XmlRpcClient itself.And I want to know how read response header. I use apache xmlrpc.Can you give me a demo. Thanks. My email :seraphyong@126.com
upvote count: 1
favorite count: 0
has title: Custom HTTP headers with XmlRpcClient And Read response header
type: UnansweredQuestion
tagged with: xmlrpcclient
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: http-headers
type: Question
tagged with: apache

http://stackoverflow.com/comment/41864125
has text: @that other guy but you can't simply modify the calculation of the checksum because you would need the code of the calculation of the checksum and a hacker will not know how to generate the new hash which contains the checksum and the hash from the server (provided: there is a optimal "decompile-protection" for this one class).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26617365

http://stackoverflow.com/a/26534291
upvote count: 1
has comment: http://stackoverflow.com/comment/41695804
has body: Make sure you connect to your Zookeeper ensemble, which may not be colocated with NameNode or ResourceManager. You should make sure zookeeper-host:2181 is reachable.
has comment: http://stackoverflow.com/comment/41696182
has comment: http://stackoverflow.com/comment/41728358
has comment: http://stackoverflow.com/comment/41695242
has comment: http://stackoverflow.com/comment/41694899
answers question: http://stackoverflow.com/q/26530388
has comment: http://stackoverflow.com/comment/41695595
has comment: http://stackoverflow.com/comment/41696938
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41697724
score: 1

http://stackoverflow.com/comment/41714178
comment on: http://stackoverflow.com/q/26545180
has text: I haven't combined it with Java yet. I'm currently only using AS3 for this project. I stated that I would eventually want to learn and possibly add to this project with the new knowledge. I can't find anything specific to creating a button then once I click it, gives me a number and continues as I continue to click. I've searched quite a bit and done a few tutorials. Perhaps I'm missing something.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26579431
has comment: http://stackoverflow.com/comment/41776176
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/41776304
tagged with: java
has title: Sharing a video via intent to messaging apps like Viber
tagged with: viber
has body: With this code i want to share an MP4 video to messaging apps like WhatsApp, Viber, Line etc. but only WhatsApp can do it successfully, But for Example if i choose Viber, After selecting recipient nothing happens, Screen flashes and nothing happens. how i can fix it? Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(String.valueOf(path))); intent.setDataAndType(Uri.parse(String.valueOf(path)), "video/*"); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(String.valueOf(path))); context.startActivity(Intent.createChooser(intent, "Share video using"));
downvote count: 0

http://stackoverflow.com/comment/41716119
type: AnswerComment
comment on: http://stackoverflow.com/a/26546419
type: Comment
has text: @polomo12 that is true for final variables visible for the whole class. However you can declare final variables anywhere; even in methods.
score: 0

midi
tags question: http://stackoverflow.com/q/26555718
type: Tag
tags question: http://stackoverflow.com/q/26657640
tag name: midi

http://stackoverflow.com/q/26530524
has answer: http://stackoverflow.com/a/26531600
answer count: 4
has answer: http://stackoverflow.com/a/26530625
tagged with: java
has answer: http://stackoverflow.com/a/26530611
type: Question
tagged with: class
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26530650
has comment: http://stackoverflow.com/comment/41687480
has body: Just looking for a clear definition of the following: When you include ArrayList&lt;Product&gt; in the class declaration, and product being another class that holds some instance variables. When using the code shown below, Is the ArrayList initialized on creation of the object? For example : public class Basket extends ArrayList&lt;Product&gt; implements Serializable { private int theOrderNum = 0; // Order number public Basket() { theOrderNum = 0; } } If I create an instance of the new class : Basket test = new Basket(); Would that create an array list on the object being created? In order to access the ArrayList inside the object, could I use this.add(foo); ?
has title: ArrayList<Product> in class declaration how to access the ArrayList
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/49002

http://stackoverflow.com/comment/41906489
type: QuestionComment
score: 0
has text: Yes it is. I can download the jar with the URL directly from the browser.
comment on: http://stackoverflow.com/q/26646459
type: Comment

http://stackoverflow.com/comment/41745361
comment on: http://stackoverflow.com/q/26520811
type: Comment
type: QuestionComment
has text: @Ramesh just posted my java file.
score: 0

http://stackoverflow.com/a/26589356
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26588667
has body: You must set the request attributes in the servlet before forwarding to the jsp. I suppose it could be something like : // prepare the attributes int ageList = new int[100]; int sexList = new String[]{"m", "f"}; for (int i=0; i&lt;100; i++) { ageList[i] = i + 1; } // put them in request request.setAttribute("ageList", ageList); request.setAttribute("sexList", sexList); // and forward to the jsp. request.getRequestDispatcher("f.jsp").forward(request, response);

http://stackoverflow.com/comment/78742442
type: Comment
has text: You may want to try the newly released [GAE firewall](https://cloud.google.com/appengine/docs/standard/python/application-security#app_engine_firewall)
score: 0
comment on: http://stackoverflow.com/q/26572944
type: QuestionComment

http://stackoverflow.com/comment/41825049
has text: See my edit for the formatting part. If you have any other questions regarding this, I think it is best if you create a new question since this is already out of your topic :)
type: Comment
comment on: http://stackoverflow.com/a/26600010
score: 0
type: AnswerComment

http://stackoverflow.com/q/26605090
tagged with: lucene
possible better answer: http://stackoverflow.com/a/64653062
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/64653062
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/8880396
has comment: http://stackoverflow.com/comment/41827680
has answer: http://stackoverflow.com/a/26611302
accepted answer: http://stackoverflow.com/a/26611302
has body: I am very new to the index structure of Lucene so please tell me if this makes sense or if I am trying to use a hammer to drill a hole. Main Point / Overview I believe I need to overwrite Lucene's term frequency with a number of my own (i.e. a value [0,100] that represents a probability (i.e. [0,1]) or another number that serves as a measure of evidence that can take the place of term frequency. Is it possible to overwrite the term frequency value at index time so that the number is actually stored inside the Lucene index (instead of the normal term frequency Lucene is using)? In Detail: I have files that may not contain text or very little text. Instead there are mostly (or treated as) digital artifacts with meta information. This meta information are learned conceptual probabilities that is obtained from classifiers and other machine learning methods (e.g. based on object recognition, color histograms, or a combination of evidences). Here a very simple example where an image was classified (with high probability) as containing a tree and also depicting a house. filepath: /pics/1.jpg meta: tree = 0.9 meta: house = 0.8 meta: dog = 0.0 ... (up to 10000 meta fields) an another one shows a dog, a house, but no tree. filepath: /pics/2.jpg meta: tree = 0.0 meta: house = 0.3 meta: dog = 1.0 ... (up to 10000 meta fields) Each meta tag is stored in a separate document field called 'meta' to make all of them searchable by directing the search to it. Each field contains the concept as a word or phrase and is treated as one token. So, I have primarily external sources of evidence for what picture 1 and 2 are about that I am aware that this is mostly outside the realm of the classic TF-IDF paradigm. I would like to insert these probabilities (for the 'meta' field) into the scoring scheme of Lucene to search for these meta information tokens and bring therr probabilities into the score just like TF-IDF. If I search for the meta:tree AND meta:dog I want to find the second documen…
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41829745
has title: Lucene: Overwrite Term Frequency at Index Time
tagged with: java

http://stackoverflow.com/q/26517419
favorite count: 0
type: UnansweredQuestion
tagged with: gradle-eclipse
downvote count: 0
tagged with: java
tagged with: gradle
type: Question
score: 3
has title: Eclipse Gradle plugin spawning hundreds of processes
has body: When I start Eclipse with the Gradle plugin on, sometimes literally hundreds of Java processes will suddenly spawn. They look like this: 26000 pts/24 Sl 0:01 /usr/lib/jvm/default-java//bin/java -Dfile.encoding=utf-8 -Xmx512m -XX:MaxPermSize=128m -XX:+UseG1GC -Dorg.gradle.appname=gradlew -classpath /[...]/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain [project name]:eclipseExternalBuild --configure-on-demand -Dorg.gradle.parallel=false 26230 pts/24 Sl 0:04 /usr/lib/jvm/jdk1.7.0_51/bin/java -XX:MaxPermSize=2048m -Xmx4096m -Dfile.encoding=UTF-8 -cp [...]/.gradle/wrapper/dists/gradle-1.8-all/2kopnp0i5dq014k75fp36m3vd5/gradle-1.8/lib/gradle-launcher-1.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.8 [...]/.gradle/daemon 10800000 4d4119b1-c332-4714-b0cd-1e80bc6dd78f -XX:MaxPermSize=2048m -Xmx4096m -Dfile.encoding=UTF-8 The first kind of process looks like Eclipse is building things; there seems to be at least one (sometimes up to 6!!) process for each project within my workspace. They go away after a few minutes, which is reasonable. What is annoying is that I have no idea what all the GradleDaemons are doing. Gradle dependency management is enabled within Eclipse. I'm using Eclipse 4.4 and Gradle 1.8 on Ubuntu 14.04. How do I fix this? I'm basically calling killall -9 java every few hours when my computer starts being unresponsive.
tagged with: eclipse
upvote count: 3
has answer: http://stackoverflow.com/a/26523809
answer count: 1

http://stackoverflow.com/a/26566717
score: 0
answers question: http://stackoverflow.com/q/26566597
has body: try this :(sort the array and then count the occurence of element) public static void countArray(int[] n) { int count = 0; int i, j, t; for (i = 0; i &lt; n.length - 1; i++) // sort the array { for (j = i + 1; j &lt; n.length; j++) { if (n[i] &gt; n[j]) { t = n[i]; n[i] = n[j]; n[j] = t; } } } for (i = 0; i &lt; n.length;) { for (j = i; j &lt; n.length; j++) { if (n[i] == n[j]) { count++; } else break; } System.out.println(n[i] + " occurs " + count); count = 0; i = j; } }
type: Answer

http://stackoverflow.com/comment/41885856
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26638974
has text: I am using the version 2.3.16.3

http://stackoverflow.com/comment/41942120
has text: The statement Integer.parseInt(oneSecs.getText()); in your code does nothing. It returns an integer, but it is not stored anywhere
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26658629

http://stackoverflow.com/a/26650576
has comment: http://stackoverflow.com/comment/41912007
upvote count: 1
has comment: http://stackoverflow.com/comment/41905531
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26650509
has comment: http://stackoverflow.com/comment/41905892
answers question: http://stackoverflow.com/q/26650509
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41905961
has body: Simple answer: No not when only using base64. But you can: Use a higher "base": like base85 or other algorithms: binary to text encoding algorithms Use some kind of compression algorithm on the base64 strings, like gzip
score: 1
has comment: http://stackoverflow.com/comment/41908429
has comment: http://stackoverflow.com/comment/41908991
has comment: http://stackoverflow.com/comment/41927995

http://stackoverflow.com/comment/41808291
score: 0
type: AnswerComment
type: Comment
has text: Have you considered using `frame.add(this)` instead?
comment on: http://stackoverflow.com/a/26596500

http://stackoverflow.com/comment/41662552
comment on: http://stackoverflow.com/a/26516243
score: 0
type: AnswerComment
type: Comment
has text: Appending is easy. Just add the character '\0;' at the end of the string you are sending. ex. `send += '\0'`. Reading is also quite easy, just cast everything you get in your while-loop to a character and test for equality with the string-termination character. If you find, break out of the loop.

http://stackoverflow.com/comment/41777246
type: QuestionComment
comment on: http://stackoverflow.com/q/26580068
has text: You're going to have to learn more about methods, classes, OOPs (object oriented programming) and objects, to essentially move to the next level of programming to solve this. Keep reading in your book and/or tutorial, and don't give up.
score: 0
type: Comment

http://stackoverflow.com/comment/41682776
comment on: http://stackoverflow.com/a/26527993
type: AnswerComment
has text: It applies to the second option (submit a form). If the function called by `onclick` returns `false`, the browser will not send the request for the URL in the `href` attribute. Since you are sending the request by submitting the form, you do not want to send that request. For the first option (send an ajax request to put the data in the session, and then follow the link) you want such function to return `true`
score: 0
type: Comment

http://stackoverflow.com/q/26567715
has comment: http://stackoverflow.com/comment/41754428
possible better answer: http://stackoverflow.com/a/26567752
tagged with: operator-keyword
type: AnsweredQuestion
has body: // write static methods here public static double [] calcDarts(double [] trial, int numtrials)throws IOException { double x; double y; for(int n = 0; n &lt; numtrials; n++) { x = Math.random(); y = Math.random(); double radius = (Math.pow(x, 2) + Math.pow(y,2)); if(radius &lt;= 1) trial = trial / numtrials * 4; } } The error says the last line of code: trial = trial / numtrials * 4; "The operator / is undefined for the argument type(s) double[], int." How can I have it produce a double value for the variable trial?
accepted answer: http://stackoverflow.com/a/26567748
favorite count: 0
type: Question
tagged with: undefined
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has title: How can I fix the undefined operator in the last expression: trial = trial / numtrials * 4?
has answer: http://stackoverflow.com/a/26567748
has answer: http://stackoverflow.com/a/26567752
has comment: http://stackoverflow.com/comment/41754456
tagged with: java

http://stackoverflow.com/comment/41870999
type: AnswerComment
comment on: http://stackoverflow.com/a/26631392
type: Comment
has text: Thank you so much SO my texture cords should be with range above [0, 1] like that : No i dnt have any errors i am getting a cube but the repeat is not working
score: 0

http://stackoverflow.com/comment/41703851
comment on: http://stackoverflow.com/q/26538726
has text: @AndrewThompson I know is archaic but I had to stick to it. Thanks for your help.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41716399
has text: From the screenshot, looks like your beanstalk app is inside VPC. does your load-balancer have a public IP?
comment on: http://stackoverflow.com/q/26540645
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26647675
type: Question
has comment: http://stackoverflow.com/comment/41901188
has body: I need create hash from my string using analog Linux command SHA224SUM in java under Android. I try use: MessageDigest messageDigest224 = MessageDigest.getInstance( "SHA-224"); byte[] bSHA224 = messageDigest224.digest( "hello word".getBytes()); But I get error MessageDigest SHA-224 implementation not found java.security.NoSuchAlgorithmException: MessageDigest SHA-224 implementation not found SHA-512, SHA-1 algorithm work fine. Please get me link to analog SHA224 in Java. Please any ideas.
has comment: http://stackoverflow.com/comment/41900870
downvote count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41901155
favorite count: 0
has comment: http://stackoverflow.com/comment/41901781
answer count: 0
has title: How create SHA224SUM in java
type: UnansweredQuestion
upvote count: 1
tagged with: sha
has comment: http://stackoverflow.com/comment/41900791
has comment: http://stackoverflow.com/comment/41900851
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41901046

http://stackoverflow.com/q/26525751
answer count: 0
tagged with: join
has title: Join 2 table in Java using two different connections
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: database
linked to: http://stackoverflow.com/q/3552330
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41679571
has comment: http://stackoverflow.com/comment/41679718
has comment: http://stackoverflow.com/comment/41679363
has body: I have a problem. I have to do a join between 2 tables on 2 different database. I can not use the dblink. The only solution is a join in Java using two different connections. My question is: In Hibernate you can do this? In Java there are frameworks that allow me to do a join between two tables in two different databases?

http://stackoverflow.com/q/26665932
tagged with: java
has answer: http://stackoverflow.com/a/26665992
score: 0
answer count: 1
tagged with: awt
type: UnansweredQuestion
tagged with: shapes
linked to: http://stackoverflow.com/q/26662768
has body: so I just started learning java GUI and I have layouts and components down but I am just dreadful at event handling. This is my first meaningful GUI project and I desperately need some guidance. I have my layout good to go I just do not know how to get it to draw a Rectangle, Oval or Line based on selections in the ComboBoxes. Here is my code so far: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.Graphics2D; import java.util.ArrayList; public class PaintApp extends JFrame { private int x, y, posX, posY, width, height; private Graphics2D g; private JButton undo; private JButton clear; private JComboBox color; private JComboBox shape; private JCheckBox fill; private JLabel statusBar; private static final String[] pickColor = {"Black", "Blue", "Green", "Red"}; private static final String[] pickShape = {"Line", "Oval", "Rectangle"}; PaintApp(){ super("Paint"); // north panel JPanel buttonPanel = new JPanel(); undo = new JButton("Undo"); buttonPanel.add(undo); add(buttonPanel, BorderLayout.NORTH); clear = new JButton("Clear"); buttonPanel.add(clear); add(buttonPanel, BorderLayout.NORTH); color = new JComboBox(pickColor); buttonPanel.add(color); add(buttonPanel, BorderLayout.NORTH); color.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if(color.getSelectedItem().equals("Red")){ System.out.println("Color: " + color.getSelectedItem()); }else if(color.getSelectedItem().equals("Blue")){ System.out.println("Color: " + color.getSelectedItem()); }else if(color.getSelectedItem().equals("Green")){ System.out.println("Color: " + color.getSelectedItem()); }else if(color.getSelectedItem().equals("Black")){ System.out.println("Color: " + color.getSelectedItem()); } } }); shape = new JComboBox(pickShape); buttonPanel.add(shape); add(buttonPanel, BorderLayout.NORTH); shape.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if(shape.getSelectedItem().equals("Line"…
has title: How to draw 2D shapes onto a JPanel
tagged with: swing
type: Question

http://stackoverflow.com/comment/41780039
type: AnswerComment
comment on: http://stackoverflow.com/a/26581709
score: 0
type: Comment
has text: @MadProgrammer Why you are saying "here is no nextLine call here". I used that method to read input from the command line as a String.

http://stackoverflow.com/q/26573456
has answer: http://stackoverflow.com/a/55428380
has answer: http://stackoverflow.com/a/26573514
favorite count: 0
has answer: http://stackoverflow.com/a/31684358
tagged with: symbols
tagged with: android
has answer: http://stackoverflow.com/a/41344785
tagged with: android-studio
linked to: http://stackoverflow.com/q/39953495
linked to: http://stackoverflow.com/q/17054000
downvote count: 0
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/31210180
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/28231345
has title: Cannot Resolve symbol R
has body: I was working on Android Studio for adding a short toast message.(I was making an Android Wear Application) I couldn't know why this code has error on 'symbol R' . It says "Cannot Resolve Symbol R." import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.wearable.view.WatchViewStub; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MyActivity extends Activity { private TextView mTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); //getnextpage Button getnextpage; getnextpage = (Button) findViewById(R.id.getnextpage); getnextpage.setOnClickListener(new OnclickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), "Here is 2nd Page", Toast.LENGTH_LONG).show(); } }); final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { @Override public void onLayoutInflated(WatchViewStub stub) { mTextView = (TextView) stub.findViewById(R.id.text); } }); } }
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/32386010
linked to: http://stackoverflow.com/q/38404463
has answer: http://stackoverflow.com/a/48906931
has comment: http://stackoverflow.com/comment/97033576

http://stackoverflow.com/comment/41669827
has text: What do you mean by code has not been written in such a manner because the code compiled properly on a windows, would anything change if it runs on a mac?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26520096
type: AnswerComment

http://stackoverflow.com/comment/41916676
type: Comment
has text: Thanks and yes of course about the receiving messages back, just a proof on concept that at least I can communicate with the server.
comment on: http://stackoverflow.com/a/26655525
score: 0
type: AnswerComment

http://stackoverflow.com/a/26624258
answers question: http://stackoverflow.com/q/26624087
has body: You can implement Iterable and use "the other kind" of for loop for (Friend f : new FriendList(g)) { System.out.println(f.name); } I've created a FriendList that uses the FriendNode. And stuck a Friend object inside the FriendNode rather than just a string. IMO that will allow you better extensiblity going forwards. The implementation looks like this: import FriendList.Friend; public class FriendList implements Iterable&lt;Friend&gt; { public static class Friend { public Friend(String name) { this.name = name; } String name; } public static class FriendNode { FriendNode next; Friend friend; FriendNode(String name) { this.friend = new Friend(name); this.next = null; } public FriendNode(String name, FriendNode n) { this.friend = new Friend(name); this.next = n; } public FriendNode getNext() { return this.next; } } public FriendList(FriendNode n) { first = n; } @Override public Iterator&lt;Friend&gt; iterator() { return new Iterator&lt;Friend&gt;() { FriendNode node = first; @Override public boolean hasNext() { return node != null; } @Override public Friend next() { Friend f = node.friend; node = node.next; return f; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } FriendNode first; public static void main(String[] args) { // TODO Auto-generated method stub FriendNode g = new FriendNode("Bob"); FriendNode o = new FriendNode("Alice"); FriendNode k = new FriendNode("Tom"); FriendNode m = new FriendNode("Day"); g.next = o; o.next = k; k.next = m; m.next = null; FriendList list = new FriendList(g); for (Friend f : list) { System.out.println(f.name); } } }
score: 0
type: Answer

http://stackoverflow.com/q/26580328
has answer: http://stackoverflow.com/a/26584589
tagged with: jackson
favorite count: 0
has body: Need to add following functionality to my Spring Boot based REST application: When a POST method is called, a long running process is started. At regular intervals (every 5 seconds or so), I need to display a message in the browser to the user, until the process ends. Note: This method may not be just called from a browser. Might be called in the future from a shell script. The goal is to send response intermittently in the 'response body'. I tried adding code such as this: OutputStream os = response.getOutputStream(); os.write(msg.getBytes()); os.flush(); But got NullPointer exception while flushing. How would I do this? Do I have to make an AJAX call or something like that?
score: 3
has title: Send response asynchronously in Spring boot
has comment: http://stackoverflow.com/comment/41781160
upvote count: 3
accepted answer: http://stackoverflow.com/a/26584589
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/41781422
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26517571
tagged with: java
downvote count: 3
tagged with: methods
has body: I need to know how to call a variable from one method to another Can anyone help me? public static void number(){ number = 1; } public static void callNumber(){ /*How can I call number to this method??? */ }
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41665180
has answer: http://stackoverflow.com/a/26517972
favorite count: 0
has answer: http://stackoverflow.com/a/26517773
has title: How can i call a variable from another method
type: UnansweredQuestion
score: -3
tagged with: call

http://stackoverflow.com/comment/41845635
score: 0
type: QuestionComment
has text: instance fields in book's constructor don't have the keyword 'this'
comment on: http://stackoverflow.com/q/26617162
type: Comment

http://stackoverflow.com/comment/41685415
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26529289
has text: @RvdK, I know, but unfortunatelly, I can't change it (I use an existing API). For now I have only 1 idea - to create new json (like second in my post) from existing (like first in my post), and only after that - parce second json to object.

http://stackoverflow.com/comment/41847430
type: Comment
has text: Add this exception to your post. BTW if you think that your actions use `mystack` then you are wrong, they don't.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26617414

http://stackoverflow.com/comment/41836225
type: Comment
has text: I was thinking of a problem like that, but even without the JoinTable annotation on the Cross entity, there is the same error.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26611739

http://stackoverflow.com/q/26516733
tagged with: jinternalframe
tagged with: focus
type: UnansweredQuestion
has body: I have a class GameGUI that extends DesktopPane. In it I have some local variables for my custom JInternalFrame windows. For the 3 windows I've made so far, each of them is initialized and added to GameGUI the exact same way. Each window is open/closing successfully with my custom KeyEventDispatcher class, so I know they are added and working. However, one of the three ALWAYS opens without focus, and even after calling requestFocus(), toFront(), etc, it always shows isFocusOwner() == false. But the other two windows work fine, appear in front, are focused, etc. What could cause this behavior? I've tried changing the order in which they were added to no avail. I've examined the classes and don't see any difference in the way the JIF is being initialized and displayed. I would rather not use a workaround because I have two functional windows already.
tagged with: java
type: Question
has title: Java JInternalFrame focus
score: 0
has answer: http://stackoverflow.com/a/30306025
answer count: 1
has comment: http://stackoverflow.com/comment/41664244

http://stackoverflow.com/comment/41755074
score: 0
comment on: http://stackoverflow.com/q/26568003
type: Comment
has text: Im using vmware. I have set the bind-address to 0.0.0.0...
type: QuestionComment

http://stackoverflow.com/comment/42206922
type: Comment
has text: Is very stressfull for hard drive but is the only way to keep the .so file in the jar I think!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26801997

http://stackoverflow.com/q/26642815
has answer: http://stackoverflow.com/a/26642857
has comment: http://stackoverflow.com/comment/41892323
accepted answer: http://stackoverflow.com/a/26642857
tagged with: java
score: -1
type: Question
has body: Hi I'm a little bit confused with this code, I just want to know if why is the value of object Connection, ResultSet and PreparedStatement are null? Can anyone help me explain what's the function of each code below? And why are they null? public class loginForm extends javax.swing.JFrame { Connection conn=null; ResultSet rs=null; PreparedStatement pst=null; public loginForm() { initComponents(); conn = SqlConnnector.ConnectDb(); } }
has comment: http://stackoverflow.com/comment/41892342
possible better answer: http://stackoverflow.com/a/26642899
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/41892303
has answer: http://stackoverflow.com/a/26642926
downvote count: 2
upvote count: 1
has title: Meaning of Null in Java and SQL code
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26642899

http://stackoverflow.com/q/26663288
tagged with: boolean
score: 0
answer count: 3
has body: I'm working on my university homework and i have faced this problem. What i need to accomplish is when the user inputs a metallic element of either zinc, iron, aluminum and sodium i want the program to return true. When the element which is compared is true, the boolean still outputs false. Can you please identify the problem in this code? class IonicCompound public class IonicCompound { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.println("Please enter a metallic element: "); String element1 = input.nextLine(); System.out.println("Please enter a non-metallic element: "); String element2 = input.nextLine(); Elements element = new Elements(element1, element2); element.isMetal(element.first); if (element.isMetal(element.first) == true) { System.out.println("It's a metallic element "); } else { System.out.println("It's not a metallic element "); } } } class Elements public class Elements { public String first, second; public Elements(String f, String s) { first = f; second = s; } public boolean isMetal(String ff) { if (ff == "iron" || ff == "Iron" || ff == "aluminium" || ff == "Aluminium" || ff == "sodium" || ff == "Sodium" || ff == "zinc" || ff == "Zinc") { return isMetal(ff) == true; } else { return false; } } public String toString() { String element = first + " " + second; return element; }
favorite count: 0
has title: Cannot return a true value on a boolean
linked to: http://stackoverflow.com/q/513832
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26663354
has answer: http://stackoverflow.com/a/26663351
upvote count: 3
downvote count: 3
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26663342
has comment: http://stackoverflow.com/comment/41928486

http://stackoverflow.com/a/26583003
type: Answer
downvote count: 0
score: 1
has body: String givenDateString = "Tue Apr 23 16:08:28 GMT+05:30 2013"; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy"); try { Date mDate = sdf.parse(givenDateString); long timeInMilliseconds = mDate.getTime(); System.out.println("Date in milli :: " + timeInMilliseconds); } catch (ParseException e) { e.printStackTrace(); }
answers question: http://stackoverflow.com/q/26582925
upvote count: 1

http://stackoverflow.com/a/26547098
upvote count: 1
has body: Use generics to declare getResult, like this: public &lt;T extends ResponseWrapper&gt; T getResult() { ... } If the getResult method is from a library that you can't change, you won't be able to fix the warning.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26547035

http://stackoverflow.com/a/26565086
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26541220
has body: Thanks for your kind answers. I couldn't figure out how to use the field, but I came up with this (not so pretty) workaround: private Date dateTime; // Original field private Long dateTimeMillis; @Column(name = "datetime") @NotNull @Convert(converter = DateConverter.class) public Date getDateTime() { return dateTime; } // Another mapping for the datetime column, will use this for criteria queries: @Column(name = "datetime", updatable = false, insertable = false) public Long getDateTimeMillis() { return dateTimeMillis; } Predicate: Path&lt;Long&gt; pathDateTo = root.get(Transference_.dateTimeMillis); Predicate predDateTo = cb.lessThanOrEqualTo(pathDateTo, this.dateTo.getTime()); predicates.add(predDateTo); Then it works as expected.
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26541220

http://stackoverflow.com/a/38098988
score: 5
upvote count: 5
type: Answer
has body: I worked out a working solution to this problem after 2 days of struggle, below solution is perfect for them who want to change few edit text only, change/toggle color through java code, and want to overcome the problems of different behavior on OS versions due to use setColorFilter() method. import android.content.Context; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.support.v4.content.ContextCompat; import android.support.v7.widget.AppCompatDrawableManager; import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; import com.newco.cooltv.R; public class RqubeErrorEditText extends AppCompatEditText { private int errorUnderlineColor; private boolean isErrorStateEnabled; private boolean mHasReconstructedEditTextBackground; public RqubeErrorEditText(Context context) { super(context); initColors(); } public RqubeErrorEditText(Context context, AttributeSet attrs) { super(context, attrs); initColors(); } public RqubeErrorEditText(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initColors(); } private void initColors() { errorUnderlineColor = R.color.et_error_color_rule; } public void setErrorColor() { ensureBackgroundDrawableStateWorkaround(); getBackground().setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter( ContextCompat.getColor(getContext(), errorUnderlineColor), PorterDuff.Mode.SRC_IN)); } private void ensureBackgroundDrawableStateWorkaround() { final Drawable bg = getBackground(); if (bg == null) { return; } if (!mHasReconstructedEditTextBackground) { // This is gross. There is an issue in the platform which affects container Drawables // where the first drawable retrieved from resources will propogate any changes // (like color filter) to all instances from the cache. We'll try to workaround it... final Drawable newBg = bg.getConstantState().newDrawable(); //if (bg instanceof DrawableContainer) { // // If we have a Drawable cont…
answers question: http://stackoverflow.com/q/26574328
downvote count: 0

http://stackoverflow.com/q/26639685
accepted answer: http://stackoverflow.com/a/26639794
type: Question
answer count: 2
tagged with: regex
possible better answer: http://stackoverflow.com/a/26639714
has answer: http://stackoverflow.com/a/26639714
upvote count: 3
tagged with: java
has title: Check if string contains any non digit character - no libraries - Java
has body: This might be clear to someone familiar with regex expressions but I am not. Example: String onlyNumbers = "1233444"; String numbersAndDigits = "123344FF"; if (IS_ONLY_NUMBERS(onlyNumbers)) return true; if (IS_ONLY_NUMBERS(numbersAndDigits)) return false; Suggestions? Is there a way to do a similar check without importing libraries?
downvote count: 0
has answer: http://stackoverflow.com/a/26639794
type: AnsweredQuestion
score: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/41886300

http://stackoverflow.com/comment/41672283
score: 1
type: AnswerComment
has text: ok let me , rewrite my table and post again if i face any issue again. thanks
comment on: http://stackoverflow.com/a/26521691
type: Comment

http://stackoverflow.com/a/26522574
has comment: http://stackoverflow.com/comment/41673888
has body: when you pass (ArrayList&lt;Payment&gt;) defaultValues.getPayment(), you are actually passing reference to the array list. Any modifications using that reference will be reflected back to your list. When you pass (ArrayList&lt;Payment&gt;) defaultValues.getPayment().clone(), you are creating a clone of the array list and passing reference to the cloned list. Any changes will be reflected only to the cloned array list not with the original array list.
answers question: http://stackoverflow.com/q/26522440
score: 0
has comment: http://stackoverflow.com/comment/41674042
type: Answer

http://stackoverflow.com/q/26625077
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41859652
tagged with: json-schema-validator
has body: My Project is a maven project and inside resources folder - src/main/resources folder I have a json schema file - "jsonschema.json " package : src/main/resources file : jsonschema.json Now i want to validate my jsonobject with json schema How to load the schema.json file in to the code : Is the below line correct? JsonNode schema = JsonLoader.fromResource("/jsonschema.json"); // correct? or correct me JsonNode data = JsonLoader.fromString(jsonData); ProcessingReport report = validator.validate(schema, data);
accepted answer: http://stackoverflow.com/a/26625867
has comment: http://stackoverflow.com/comment/41860925
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41861569
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41859990
has answer: http://stackoverflow.com/a/26625867
upvote count: 1
tagged with: jsonschema
has title: How to load JSON Schema file from java

http://stackoverflow.com/q/26538738
score: 0
has body: Before anyone tries to tell me this is a duplicate I have tried the solutions on this and just about every other answer I could find. My project builds fine in IntelliJ, passes all the tests I've setup, it even runs from inside IntelliJ just fine, as soon as I try to run the JAR built by maven I'm slapped in the face with several exceptions. The class the code is pointing to: package com.albion; import com.albion.logging.Loggable; import com.albion.packets.Packet; import com.albion.packets.Packets; import com.esotericsoftware.kryonet.Server; import com.esotericsoftware.minlog.Log; import javax.swing.*; import java.io.IOException; import java.util.HashMap; import java.util.UUID; import java.util.logging.Level; public class Main extends Loggable { protected static Integer PORT = 47532; protected static byte[] key = { /* contents omitted for obvious reasons */ }; protected static Server server; protected static Controller controller; public static void main(String[] args) throws IOException { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } Log.set(Log.LEVEL_DEBUG); server = new Server(); server.bind(PORT); try { controller = new Controller(); controller.setVisible(true); ClientManager.setController(controller); } catch (Exception ex) { getLog().log(Level.SEVERE, "Error creating a new Controller instance: ", ex.getCause()); } handlers(); register(); server.start(); } private static void handlers() { getLog().info("Creating new PacketHandler"); PacketHandler handler = new PacketHandler(controller); getLog().info("Creating new ClientListener"); ClientListener listener = new ClientListener(handler); getLog().info("Adding listeners to server"); server.addListener(listener); } private static void register() { getLog().info("Registering data types"); server.getKryo().register(UUID.class); server.getKryo().…
answer count: 1
has title: Kryonet Serialization Error
linked to: http://stackoverflow.com/q/22674663
tagged with: kryonet
accepted answer: http://stackoverflow.com/a/26538762
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26538762
type: Question
tagged with: java

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/26606090

http://stackoverflow.com/comment/41795951
has text: Also, if you're looking to add additional functionality, I strongly recommend that you start using separately defined classes for each shape with a parent 'shape' class (or interface).
comment on: http://stackoverflow.com/q/26590490
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26544440
answers question: http://stackoverflow.com/q/26543014
type: Answer
has body: You have a variety of prompts elements customized using jquery . I found the below one most useful. Have look at Alertify plugin Prompt window can be easily configured as below after adding the required css and js files to your project , // confirm dialog alertify.confirm("Message", function (e) { if (e) { // user clicked "ok" } else { // user clicked "cancel" } });
score: 0

http://stackoverflow.com/comment/41682227
has text: Now that is a very clever idea! I will investigate and get back to you.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26527747

http://stackoverflow.com/comment/41941793
comment on: http://stackoverflow.com/q/26670627
score: 0
has text: Change `c` to `double` and move the declaration to outside the loop.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41905227
has text: Answered partially here: http://stackoverflow.com/questions/9909465/how-to-disable-dtd-fetching-using-jaxb2-0
type: Comment
comment on: http://stackoverflow.com/q/26649950
score: 0
type: QuestionComment

http://stackoverflow.com/a/26608336
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26607121
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26607121
has body: So the issue wasn't with the parser, it was with the Transformer which was stripping out the &lt;!DOCTYPE ...&gt; line in the XML. To solve this, simply set a transformer property so it includes the DTD file. // --- Create a transformer and transform our Document into an InputStream --- Transformer transformer = TransformerFactory.newInstance().newTransformer(); // By default the transformer strips out the DOCTYPE tag so we must re-add our DTD file declaration transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, xmlFile.getParent() + "\\" + xmlDocument.getDoctype().getSystemId()); transformer.transform(xmlSource, outputTarget); If you simply pass in the DTD file name, the parser will search for it at the location the program was launched from, it is advisable to specify the direct path to the DTD file, as I have above.
upvote count: 1

http://stackoverflow.com/a/26514645
has comment: http://stackoverflow.com/comment/41659242
has comment: http://stackoverflow.com/comment/41659300
has body: After completing your html (it wasn't well formed) the xpath worked properly and found the element you want. Tested using http://www.xpathtester.com/xpath EDIT This is a html that works. Don't know if it's exactly your page.. <!--<![endif]--> Network Support
score: 0
answers question: http://stackoverflow.com/q/26514305
has comment: http://stackoverflow.com/comment/41659203
type: Answer
has comment: http://stackoverflow.com/comment/41659176
has comment: http://stackoverflow.com/comment/41659404
has comment: http://stackoverflow.com/comment/41659127

http://stackoverflow.com/a/26516063
type: Answer
has body: I would suggest create a static getInstance() method in Class A which returns the object itself.
score: 0
answers question: http://stackoverflow.com/q/26515917

http://stackoverflow.com/q/26624644
has comment: http://stackoverflow.com/comment/41859031
tagged with: foreach
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41858967
has answer: http://stackoverflow.com/a/26626045
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41858907
score: 0
has body: I want to repeat a CountDownTimer within a for loop until its execution complete. But CountDownTimer executes first index of for loop and it can not repeat again for next index. for (final Question questionData : questionSet) { setUI(questionData); startTimer(); } private void setUI(Question questionData) { question.setText(questionData.getQuestion()); ch1.setText(questionData.getC1()); ch2.setText(questionData.getC2()); ch3.setText(questionData.getC3()); } private void startTimer(){ int interval = 10000; countDownTimer = new CountDownTimer(interval, 1000) { public void onTick(long millisUntilFinished) { time.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { time.setText("done!"); countDownTimer.cancel(); } }.start(); } Here questionSet has two index. Thanks in advance.
accepted answer: http://stackoverflow.com/a/26626045
answer count: 1
has comment: http://stackoverflow.com/comment/41859095
tagged with: timer
has comment: http://stackoverflow.com/comment/41859889
tagged with: countdowntimer
has title: Android repeat CountDownTimer until end foreach loop
tagged with: android

http://stackoverflow.com/comment/41921231
score: 0
type: QuestionComment
has text: Also the `GetMath` class definition is weirdly placed.
type: Comment
comment on: http://stackoverflow.com/q/26659365

http://stackoverflow.com/q/26566659
has title: How can I do something as simple as setting text to a textview in a listview
answer count: 1
tagged with: textview
tagged with: android
type: AnsweredQuestion
has body: All Im getting is a nullpointer, makes no sense to me new Handler().post(new Runnable(){ @Override public void run(){ cursorAdapter = new CustomCursorAdapter(MainActivity.this, contactDBHelper.listAll()); View footer = (View)getLayoutInflater().inflate(R.layout.footer,null); contactCounter = (TextView)findViewById(R.id.contactCounter); //This is where im getting a NullPointer contactCounter.setText("Hi"); listView.addFooterView(footer); listView.setAdapter(cursorAdapter); } }); } Can anyone spot what im doing wrong?
tagged with: java
has answer: http://stackoverflow.com/a/26567045
accepted answer: http://stackoverflow.com/a/26567045
type: Question
score: 0
tagged with: nullpointerexception

http://stackoverflow.com/q/26562869
downvote count: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41745877
has body: I am new to spark. I am using intelliJ Idea with maven integration for running spark examples. But I am facing problems in run a simple hello world program using spark and java class. Here is my pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 HelloWorld HelloWorld 1.0-SNAPSHOT <hadoop.version>2.4.0</hadoop.version> org.apache.spark spark-core_2.10 1.1.0 org.apache.hadoop hadoop-client And I am getting error on these lines import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function; import org.apache.spark.api.java.function.Function2; import org.apache.spark.api.java.function.PairFunction;
tagged with: maven
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/70704637
tagged with: apache-spark
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/41746414
has title: spark program using maven in intellij IDEA
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/a/26655396
type: AcceptedAnswer
has body: contentPane.add(table); You are removing the table from the scrollpane. You must add the scroll pane to the frame. The code should be: contentPane.add(panel);
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26654654
accepted answer of: http://stackoverflow.com/q/26654654
upvote count: 4

http://stackoverflow.com/a/26593394
answers question: http://stackoverflow.com/q/26593271
type: Answer
has body: For your constructor argument posi, you want to take that value and assign it to one of the class fields which in this example would be position. Now, what you're doing is assigning position (which is null) to posi. So you're overwriting your argument with null and not really doing anything with it. What you want to do is the following: position = posi; which assigns the constructor argument i.e. "Vice President to the class field position. Remember the variable on the right is assigned to the variable on the left.
score: 0

http://stackoverflow.com/a/26602398
type: Answer
accepted answer of: http://stackoverflow.com/q/26602291
answers question: http://stackoverflow.com/q/26602291
score: 2
has body: You can get date with time import java.text.SimpleDateFormat; import java.util.Calendar; And the code Calendar currentDate = Calendar.getInstance(); SimpleDateFormat formatter= new SimpleDateFormat("dd-MM-YYYY-hh:mm:ss"); String dateNow = formatter.format(currentDate.getTime()); System.out.println(dateNow);
downvote count: 0
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/comment/41837243
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26612773
has text: Method. Constructor was written elsewhere.

http://stackoverflow.com/a/26623706
accepted answer of: http://stackoverflow.com/q/26623594
has comment: http://stackoverflow.com/comment/41857574
score: 0
type: AcceptedAnswer
has body: Build and Install you project after you have made an entry for Log4j in your pom.xml Remove these entries for log4j from your pom.xml org.apache.logging.log4j log4j-api 2.1 org.apache.logging.log4j log4j-core 2.1 And only a single entry is sufficient for log4j in your pom Also always reference Log4j as below in your class private final static Logger LOGGER = Logger .getLogger(classname.class.getName());
has comment: http://stackoverflow.com/comment/41857355
has comment: http://stackoverflow.com/comment/41857325
answers question: http://stackoverflow.com/q/26623594
type: Answer

http://stackoverflow.com/comment/41938609
score: 0
type: Comment
has text: On a pure, "what the question asked" principle, perhaps http://en.wikipedia.org/wiki/Composite_pattern
type: QuestionComment
comment on: http://stackoverflow.com/q/26668154

http://stackoverflow.com/q/26631492
type: AnsweredQuestion
has body: I have the following Collection&lt;String[]&gt; values = databaseMap.values(); and I am having problems converting it to a list. I keep trying to loop through and print out the elements but I am getting... java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to [Ljava.lang.String; Can someone help me with this?
tagged with: java
accepted answer: http://stackoverflow.com/a/26631532
downvote count: 1
possible better answer: http://stackoverflow.com/a/26631879
type: Question
has title: convert Collection<String[]> to list
score: -1
has answer: http://stackoverflow.com/a/26631532
has comment: http://stackoverflow.com/comment/41871082
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26631879
favorite count: 0
has comment: http://stackoverflow.com/comment/41871221

http://stackoverflow.com/q/26659751
has answer: http://stackoverflow.com/a/26659865
has answer: http://stackoverflow.com/a/26659971
accepted answer: http://stackoverflow.com/a/26659866
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41921653
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41921721
has comment: http://stackoverflow.com/comment/41921724
type: Question
has comment: http://stackoverflow.com/comment/41924638
downvote count: 0
has answer: http://stackoverflow.com/a/26659866
has comment: http://stackoverflow.com/comment/41921739
tagged with: bluej
answer count: 3
has body: I'm learning Java and programming for the first time. I'm using the BlueJ environment. I'm writing a program to draw polygons. I want to change color after every line has been drawn. To do this, I thought I would create an array of colors, then use a pseudo-random number generator to generate a value that would be used as the index to get a color from the array. I've included a snippet of code from the constructor method, as I've been told I need to create the array inside the constructor for this to work. It should be noted that I've imported java.awt.Color, along with java.util.Random. I've also included private Color[] colors; as a field. public PictureMaker() { world = new TurtleWorld(500, 500, "Picture Maker"); fred = new Turtle(); //Allocate the size of the array colors = new Color[7]; //Initialize the values of the array colors[0] = new Color(Color.red); colors[1] = new Color(Color.blue); colors[2] = new Color(Color.yellow); colors[3] = new Color(Color.green); colors[4] = new Color(Color.black); colors[5] = new Color(Color.pink); colors[6] = new Color(Color.orange); } Below is the code from the actual method that will be called to draw the polygon. /** * This method takes sides (int) as input and draws a polygon with that number of sides. */ public void drawPolygon(int sides) { world.dropIn(fred); fred.penDown(); int angle = 360/sides; int linesDrawn = 0; while(linesDrawn &lt; sides) { Random r = new Random(); int minColor = 0; int maxColor = 10; int R = r.nextInt(maxColor-minColor) + minColor; fred.right(angle); fred.forward(60); linesDrawn += 1; } } I haven't included anything to get the color from the array yet, as I can't get the array to work. I'm getting an error message Incompatible types: java.awt.Color cannot be converted to int. I'm not sure why it doesn't work. I hope this makes sense. Please let me know if you need clarification, I'm new to using this site.
has title: How to Randomly pick a color from an array of colors in Java?
favorite count: 0
possible better answer: http://stackoverflow.com/a/26659971

http://stackoverflow.com/comment/41666191
has text: you are right, i am sorry for my short description. so the first hurdle is the "else" statement i can't get it to work. I want my program do move to the next sequence of the song after the user types "EIEIO" as of now i get "illegal start of type"
score: 0
comment on: http://stackoverflow.com/q/26518117
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41771461
has text: What have you tried so far? Read carefully the http://stackoverflow.com/tour and try to post a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/26576882
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41679705
score: 0
comment on: http://stackoverflow.com/q/26522504
type: Comment
type: QuestionComment
has text: Can i save different values in fields with the one name in the single document?

http://stackoverflow.com/a/26628509
score: 1
answers question: http://stackoverflow.com/q/26619813
has body: Use BigDecimal for currencies. It is fixed digit rounding capable. Never use floating point numbers for currencies they are inaccurate. You can setup MathContext for rounding there.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41947518
has text: I think that you should remove @Transient because is used to indicate that a field is not to be persisted in the database. The find operation is based on PrimaryKey, if is transient i think that doesn't work fine.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26672909

http://stackoverflow.com/a/26627514
downvote count: 0
score: 1
upvote count: 1
has body: Try this way,hope this will help you to solve your problem. try { JSONObject jsonObj = new JSONObject("{\"headcode\":\"s\",\"destination\":\"Ardwick\",\"origin\":\"Ardwick\",\"time\":\"29:10:2014 09:52\",\"turnNumber\":\"as\",\"depot\":\"Barrow\",\"conductorName\":\"as\",\"devicePin\":\"123456.78.364813.8\",\"noFirstClassImpact\":\"true\",\"customersInvited\":\"false\",\"customersUninvited\":\"false\",\"customersLeft\":\"false\"}"); }catch (JSONException e){ e.printStackTrace(); }
answers question: http://stackoverflow.com/q/26627339
type: Answer

http://stackoverflow.com/q/26614446
tagged with: sql
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41840564
has title: How would I pull a subset of data from 1 table and put it in a 2nd table?
has body: I am not too familiar with Groovy but I need to get a subset (about 5000 rows) of data from a large table and insert it into another already existing table. The contents of the second should be deleted and by the end of the process should only contain the subset of data from table 1. The tables are on a AS-400 database. Im not sure if that makes a difference at all. Thanks in advance for any help. The following is what I have so far but its probably not even close to right.It asks for a target and source column, the connectionId for the database being used and what table is the defined set table. <?xml version="1.0" encoding="UTF-8"?> <custom-script-transformer name="Subset Data Load" table="false"> Refresh target table columns with source table columns SWBC Column to be updated source column Defined set connection id default Defined set table </custom-script-transformer>
has comment: http://stackoverflow.com/comment/41840953
score: 0
tagged with: groovy

http://stackoverflow.com/q/26576726
tagged with: class
has answer: http://stackoverflow.com/a/26576733
answer count: 3
has answer: http://stackoverflow.com/a/26576830
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26576830
score: 0
tagged with: java
has title: Constructing my own classes?
tagged with: methods
type: Question
has body: I'm having trouble with learning how to write and use my own classes. For example; import java.text.NumberFormat; public class BikeCommute { private String route; private double distanceTraveled; private double timeRequired; private String dateTraveled; private String mode; private double gallonsSaved; final private int mpg = 25; public BikeCommute(String mode, String dateTraveled, String route, double distanceTraveled, double timeRequired) { mode = this.mode; route = this.route; distanceTraveled = this.distanceTraveled; timeRequired = this.timeRequired; dateTraveled = this.dateTraveled; } public double gallonsCalculated(){ gallonsSaved = distanceTraveled/mpg; return gallonsSaved; } public double getGallons(){ return gallonsSaved; } public String toString(){ return mode + route + distanceTraveled + timeRequired + dateTraveled + gallonsSaved; } } I'm trying to write a class called BikeCommute that will read in the route, mode of transportation, distance traveled, time required, and date that the trip was traveled, calculate how many gallons of gas were saved by dividing the distance traveled by the miles per gallon, and output the route, mode, distance traveled, time required, date traveled, and gallons saved. This, however, returns nullnull0.0null0.0 when I run it. Any thoughts?
possible better answer: http://stackoverflow.com/a/26576733
tagged with: eclipse
has answer: http://stackoverflow.com/a/26576734

http://stackoverflow.com/a/26630051
type: Answer
score: 2
has body: Java applications are allowed to use a limited amount of memory. This limit is specified during application startup. To make things more complex, Java memory is separated into two different regions. These regions are called heap space and permgen. The size of those regions is set during the Java Virtual Machine (JVM) launch by specifying parameters such as -Xmx and -XX:MaxPermSize. In your case you have allowed the heap size to grow up to 512m via specifying the -Xmx parameter. So – the “java.lang.OutOfMemoryError: Java heap space” error will be triggered when you try to add more data into the heap space area, but there is not enough room for it. The first solution is easy and obvious - when you have ran out of a particular resource, you should increase the availability of such a resource. In your case: when your application does not have enough Java heap space memory to run properly, fixing it is as easy as increasing heap space in your JVM launch configuration, for example to 1GB as following: -Xmx1024m
answers question: http://stackoverflow.com/q/26606164
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41708139
comment on: http://stackoverflow.com/q/26541792
type: Comment
type: QuestionComment
has text: Here as well . http://stackoverflow.com/questions/13146991/conflict-accessing-sqlite-database-android-from-service-and-onclick I am sure the problem will be solved.
score: 0

http://stackoverflow.com/comment/41903652
has text: Thank You for the reply. I got some error when i tried to execute the above line in my java code. java.security.spec.InvalidKeySpecException: Inappropriate key specification: IOException : DerInputStream.getLength(): lengthTag=111, too big.at sun.security.provider.DSAKeyFactory.engineGeneratePrivate(DSAKeyFactory.java:156) at java.security.KeyFactory.generatePrivate(KeyFactory.java:372) at Pgm.main(Pgm.java:61)
comment on: http://stackoverflow.com/a/26648886
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26668045
has body: I think int[] row1 is not necessary and values is not assigned to row1 array too. rather than used row1 array, passed the row1 arraylist to your method. In the main function, ArrayList is written as Arraylist. I changed this into Arraylist. public int getArraylistsum(ArrayList&lt;Integer&gt; row1){ int sum = 0; for(int i = 0; i&lt;row1.size(); i++){ sum += row1.get(i); } return sum; } public static void main(String[] args){ ArrayList&lt;Integer&gt; row1 = new ArrayList&lt;Integer&gt;(10); row1.add(1); row1.add(8); row1.add(6); ClassName row = new ClassName(); System.out.println(row.getArraylistsum(row1)); }
answers question: http://stackoverflow.com/q/26667988
upvote count: 2
type: Answer
score: 1
downvote count: 1

http://stackoverflow.com/comment/41702985
has text: @oolostoo With a search engine http://www.geeksforgeeks.org/overriding-tostring-method-in-java/
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26538532
type: AnswerComment

http://stackoverflow.com/q/26520173
tagged with: java
type: Question
tagged with: graph
tagged with: infinite-loop
has title: Infinite loop in Java program with graph and inner classes
has answer: http://stackoverflow.com/a/26520314
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41669564
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41669671
has comment: http://stackoverflow.com/comment/41669715
has body: Ok so my task is that given a list of Donations and a Set of Projects (Classes given below) I must see if all the projects can be funded by the donations. If they cannot, it must de-allocate all money allocated so far and return false. Donations have a list of projects that they can donate to and have a given amount. I chose to implement this with a graph. Vertices represent a project and the connections are the donations they share with other projects. It is set up so that it cycles through the donations and donates 1 dollar at a time to each project it can fund. If a project cannot be fully funded but can transfer money from another project it is connected to by donations, transfer money from that project. If there is no possible way of funding all of the projects then de-allocate everything and return false. My two problems are: 1) My test suite is entering an infinite loop when transfers are required. At the moment i'd be happy if someone could just locate my infinite loop problem and propose a fix to make it exit before i really work on getting the transfers part to work. The two given classes don't need to be fixed, its just the first chunk of code that has the problem. I have no doubt as well that my graph, node and connector classes are not very good at all but they work at the moment. I'm just looking for a fix in the canAllocateHelper method. Note: Sorry for posting so much code but i posted a similar question about 12 hours ago and i was told that i didn't give enough code for it to be debugged so i thought i'd just post everything. My code: package a2; import java.util.*; import a2.IterativeAllocator.Connector; import a2.IterativeAllocator.Node; public class IterativeAllocator { /** * @precondition: Neither of the inputs are null or contain null elements. * The parameter donations is a list of distinct donations * such that for each d in donations, d.getTotal() equals * d.getUnspent(); and for each p in projects * p.allocatedFunding() equals 0. * @postco…
tagged with: inner-classes

http://stackoverflow.com/a/37751826
type: Answer
answers question: http://stackoverflow.com/q/26557846
has body: The scanner flags file paths with variables. var sr = new StreamReader("C:\\....\\WEB-INF" + file); As mentioned by Ahmad, it is usually a false positive. But it is a good idea to verify a malicious user could not exploit the code and to get access to files that was not intended. To make the scanner happy, you could supply it with hard coded paths, or create a switch statement for every possible file path. switch (fileId) { case "1": sr = new StreamReader("C:\file-1"); break; case "2": sr = new StreamReader("C:\file-2"); break; } But who wants to do that! Your best option is to ensure no threat exists and to convince the security folks to allow your code to proceed.
score: 0

http://stackoverflow.com/q/26585037
type: Question
score: 0
has answer: http://stackoverflow.com/a/26589756
has comment: http://stackoverflow.com/comment/41785867
answer count: 1
linked to: http://stackoverflow.com/q/10376388
tagged with: bluetooth
tagged with: android
accepted answer: http://stackoverflow.com/a/26589756
has title: Receiving broadcast error for Bluetooth discovery - Error in onReceive() method that receives intents by startDiscovery() Method
has comment: http://stackoverflow.com/comment/41786659
type: AnsweredQuestion
tagged with: java
has body: I am facing a problem in device scan activity. I want to scan all bluetooth devices in vicinity and print them on UI. But i am getting the same run time error as in Receiving broadcast error for Bluetooth discovery. public class MainActivity extends ActionBarActivity { BluetoothAdapter mBluetoothAdapter; private int REQUEST_ENABLE_BT = 1000; public ArrayList&lt;String&gt; deviceArrayList = new ArrayList&lt;&gt;(); public ArrayList&lt;BluetoothDevice&gt; deviceList = new ArrayList&lt;&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { // Device does not support Bluetooth Toast.makeText(this, "Device Doesn't Support Bluetooth!!!", Toast.LENGTH_LONG).show(); return; } if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT ); } scanStart(); } public void scanStart() { // TODO Auto-generated method stub //Adding Paired Devices into ArrayList addPairedDevices(); if(mBluetoothAdapter.isDiscovering()){ mBluetoothAdapter.cancelDiscovery(); } if(mBluetoothAdapter.startDiscovery() == true){ Toast.makeText(this, "Searching...", Toast.LENGTH_LONG).show(); } else{ Toast.makeText(this, "Bluetooth Adapter got Null Value", Toast.LENGTH_SHORT).show(); } // Register the BroadcastReceiver IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); this.registerReceiver(requestReciever, filter); // Don't forget to unregister during onDestroy try { Thread.sleep(12000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Printing Device List on UI ListView lv = new ListView(this); ArrayAdapter&lt;String&gt; listAdapter = new ArrayAdapter&lt;&gt;(thi…
tagged with: eclipse

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/26544691
tags question: http://stackoverflow.com/q/26606350
tags question: http://stackoverflow.com/q/26546222
tags question: http://stackoverflow.com/q/26530592
tags question: http://stackoverflow.com/q/26649043
tags question: http://stackoverflow.com/q/26614305
tags question: http://stackoverflow.com/q/26550367
tags question: http://stackoverflow.com/q/26634418
tags question: http://stackoverflow.com/q/26615752
tags question: http://stackoverflow.com/q/26563008
tags question: http://stackoverflow.com/q/26614637
tags question: http://stackoverflow.com/q/26642382
tags question: http://stackoverflow.com/q/26660844
tags question: http://stackoverflow.com/q/26608344
tags question: http://stackoverflow.com/q/26584169
tags question: http://stackoverflow.com/q/26519816

http://stackoverflow.com/q/26591683
has answer: http://stackoverflow.com/a/37193789
upvote count: 4
possible better answer: http://stackoverflow.com/a/37193789
downvote count: 0
has body: I know that in Java one can use ThreadMXBean to get CPU utilization of any thread. However, as I understand an actor can be scheduled to execute on any thread from a thread pool. So subsequent calls to getCurrentThreadCpuTime from the same actor may end up giving totally unrelated numbers. Is the above true? If yes, is there any way to find the CPU utilization by the actor itself?
tagged with: scala
has answer: http://stackoverflow.com/a/26592132
accepted answer: http://stackoverflow.com/a/26592132
type: AnsweredQuestion
tagged with: java
has title: How do I get the CPU utilization of an akka actor
favorite count: 0
score: 4
type: Question
linked to: http://stackoverflow.com/q/24652401
answer count: 2
tagged with: akka
tagged with: cpu-usage

http://stackoverflow.com/a/26639658
upvote count: 2
has body: Your code risks tying up the Swing event thread preventing it from drawing on your GUI, and effectively freezing your program. Instead use a Swing Timer, not a while loop to achieve your goal. e.g., final SolarSystem SSpanel = new SolarSystem(600, 600); int timerDelay = 100; new Timer(timerDelay, new ActionListener() { public void actionPerformed(ActionEvent e) { // do repeated action in here } }).start(); As an aside, I was going to place, SSpanel.drawSolarObject(0, 0, 30, "YELLOW"); SSpanel.finishedDrawing(); inside my timer code, but it wouldn't make sense because this code isn't "dynamic" and doesn't change anything or do any animation.
has comment: http://stackoverflow.com/comment/41887550
has comment: http://stackoverflow.com/comment/41887017
answers question: http://stackoverflow.com/q/26639598
downvote count: 0
has comment: http://stackoverflow.com/comment/41887351
type: Answer
score: 2

http://stackoverflow.com/a/37580945
has comment: http://stackoverflow.com/comment/90078587
has comment: http://stackoverflow.com/comment/91928816
has comment: http://stackoverflow.com/comment/99189292
score: 34
has comment: http://stackoverflow.com/comment/99195165
has comment: http://stackoverflow.com/comment/99192522
has comment: http://stackoverflow.com/comment/81609055
has comment: http://stackoverflow.com/comment/121360929
downvote count: 1
has body: Setting this property on your application*.properties file (and the corresponding servlet-specific configuration for HTTPS headers in case you are running behind a proxy) and having Spring Security set-up (e.g. having org.springframework.boot:spring-boot-starter-security on your classpath) should be enough: security.require-ssl=true Now, for some reason that configuration is not honored when basic authentication is disabled (at least on old versions of Spring Boot). So in that case you would need to take an extra step and honor it yourself by manually configuring the security on your code, like this: @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Inject private SecurityProperties securityProperties; @Override protected void configure(HttpSecurity http) throws Exception { if (securityProperties.isRequireSsl()) http.requiresChannel().anyRequest().requiresSecure(); } } So, in case you are using Tomcat behind a proxy, you would have all these properties on your application*.properties file: security.require-ssl=true server.tomcat.remote_ip_header=x-forwarded-for server.tomcat.protocol_header=x-forwarded-proto
has comment: http://stackoverflow.com/comment/99186657
type: Answer
answers question: http://stackoverflow.com/q/26655875
has comment: http://stackoverflow.com/comment/94768618
upvote count: 35

http://stackoverflow.com/comment/41719694
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26548318
has text: Well, if the user can delete image files, then nothing is stopping him from deleting database files, so in this setup security from option 1 = security from option 2.

http://stackoverflow.com/q/26604549
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/41822199
type: Question
has answer: http://stackoverflow.com/a/26606365
has comment: http://stackoverflow.com/comment/41822373
has comment: http://stackoverflow.com/comment/41822134
has title: Java: Comparing two lists
has comment: http://stackoverflow.com/comment/41822138
has comment: http://stackoverflow.com/comment/41821995
has comment: http://stackoverflow.com/comment/41821978
has answer: http://stackoverflow.com/a/26604907
accepted answer: http://stackoverflow.com/a/26604907
has body: I have two lists. For example: A = {21, 41, 96, 02} B = {21, 96, 32, 952, 1835} What I want is this as a result: R = {32, 952, 1835} Like this: After this I want to add the result R to A: A = {21, 41, 96, 02, 32, 952, 1835}
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41821998
possible better answer: http://stackoverflow.com/a/26606270
has answer: http://stackoverflow.com/a/26604675
upvote count: 4
has answer: http://stackoverflow.com/a/26606270
has comment: http://stackoverflow.com/comment/41822423
has comment: http://stackoverflow.com/comment/41822234
answer count: 4
type: AnsweredQuestion
score: 3

drawing
tags question: http://stackoverflow.com/q/26551899
tags question: http://stackoverflow.com/q/26661144
tags question: http://stackoverflow.com/q/26585763
type: Tag
tag name: drawing
tags question: http://stackoverflow.com/q/26639303
tags question: http://stackoverflow.com/q/26619951

http://stackoverflow.com/q/26540028
has answer: http://stackoverflow.com/a/26540066
has comment: http://stackoverflow.com/comment/41705173
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26540135
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26540066
score: 2
has body: What I need to do is find the inventory item with the lowest cost from an array list. If there are none, return "N/A". So I can't really figure out how to find the smallest value out of all the inventory item costs. This is what I have so far. My plan was to set cost equal to the first inventory item and cycle through each item checking if it's cost is less but I'm confused on how to do that or if that is even the correct way of doing it. EDIT: We have not covered for loops yet so I cannot use them. I can only use while loops public InventoryItem itemWithLowestCost() { if (inventoryList.size() &gt; 0) { int i = 0; while (i &lt; inventoryList.size()) { double cost = inventoryList.get(i).getCost(); if (cost &lt; ) } } else { return "N/A"; } } Here is my InventoryItem constructor. I'm not sure if this is needed to understand the above code but here it is anyway public InventoryItem(String descriptionIn, double costIn, double percentDepreciatedIn) { description = descriptionIn.trim(); cost = costIn; percentDepreciated = percentDepreciatedIn; }
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41705048
has title: Finding item with the lowest cost in an ArrayList
possible better answer: http://stackoverflow.com/a/26540085
has answer: http://stackoverflow.com/a/26540085
answer count: 3

http://stackoverflow.com/a/26533747
answers question: http://stackoverflow.com/q/26533706
upvote count: 5
has body: You are calculating the discriminant before any values are assigned to a, b, or c. Also, you aren't using the constructor values passed in. double a; double b; double c; public double discrim = (Math.pow(b, 2) - 4*a*c); public Quadratic(double a, double b, double c) {} Because of this, you are dividing 0 by 0 in getSolution1 and getSolution2, which in floating-point arithmetic yields a NaN. (In math it's undefined.) Move that calculation inside the constructor, after you assign values to a, b, and c. public double discrim; public Quadratic(double a, double b, double c) { this.a = a; this.b = b; this.c = c; discrim = (Math.pow(b, 2) - 4*a*c); }
type: Answer
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26533706
downvote count: 0

http://stackoverflow.com/comment/41743895
type: QuestionComment
has text: @sandalone, plesae look on update.
score: 0
comment on: http://stackoverflow.com/q/26561340
type: Comment

http://stackoverflow.com/comment/41864061
comment on: http://stackoverflow.com/a/26626245
type: AnswerComment
score: 0
type: Comment
has text: @Duncan sorry I just had an overflow error. I've been working on that program, that prints barley 7 lines only, since a very long time. So, I reached the point to not put any more effort "on the part of the question asker". However, I appreciate your advises and I will try to figure it out, then I will put some feedback in-case of facing troubles with it. thank you

http://stackoverflow.com/a/26524037
has comment: http://stackoverflow.com/comment/41679783
score: 7
upvote count: 7
has body: Your method performs an asynchronous operation and thus should not return a JsonNode but rather a Promise&lt;JsonNode&gt;. Conceptually - this makes sense - your method does not immediately fetch the data - rather it dispatches a task relating to the said data that will finish some time in the future. You can access the response by unwrapping the promise. You can return the Promise&lt;JsonNode&gt; and then call .map on it at the caller site to unwrap the value. You can also call .get() on the promise which would force the data to wait for the result (that is - returning jsonPromise.get() but that negates the benefit of using promises to begin with. Note that get() here is different from the get() on holder which is fine since it just returns the promise.
accepted answer of: http://stackoverflow.com/q/26523544
answers question: http://stackoverflow.com/q/26523544
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41801845
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26591896
score: 0
has text: @John great! So, something like `session.createCriteria(User.class) .add(Restrictions.like("email", "admin@mail.com")).list()` ? It could be a right workaround (and definitely the accepted answer). Do you know why isn't possible? Specific design choice? Am I missing something on the subject?

http://stackoverflow.com/a/26569004
score: 0
answers question: http://stackoverflow.com/q/26568757
type: Answer
has body: It should be Scanner input = new Scanner(System.in); Also when you set the movie title, it should be one.setRating(input.nextInt()); instead of one.setRating = input.nextInt(); if you type out one.setRating you will see that the method setRating(int NewRating) takes in an int as a parameter, meaning you have to pass in an int (input.nextInt()) when you call this method.

http://stackoverflow.com/comment/41849919
type: Comment
type: QuestionComment
has text: @ControlAltDel You mustn't go around claiming that XML and JSON have made binary protocols obsolete. They haven't, and they can't.
comment on: http://stackoverflow.com/q/26615845
score: 0

jaxb
tags question: http://stackoverflow.com/q/26597752
tags question: http://stackoverflow.com/q/26597201
tags question: http://stackoverflow.com/q/26619375
tags question: http://stackoverflow.com/q/26664152
tags question: http://stackoverflow.com/q/26583752
tags question: http://stackoverflow.com/q/26651208
tags question: http://stackoverflow.com/q/26603559
tags question: http://stackoverflow.com/q/26635784
tags question: http://stackoverflow.com/q/26666289
tags question: http://stackoverflow.com/q/26614438
tags question: http://stackoverflow.com/q/26615264
tags question: http://stackoverflow.com/q/26592458
tags question: http://stackoverflow.com/q/26603884
tags question: http://stackoverflow.com/q/26611567
tags question: http://stackoverflow.com/q/26620061
tags question: http://stackoverflow.com/q/26660033
tags question: http://stackoverflow.com/q/26577083
tags question: http://stackoverflow.com/q/26603222
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/26522398
tags question: http://stackoverflow.com/q/26637338
tags question: http://stackoverflow.com/q/26578239
tags question: http://stackoverflow.com/q/26517573
tags question: http://stackoverflow.com/q/26529024
tags question: http://stackoverflow.com/q/26618647
tags question: http://stackoverflow.com/q/26542373
tags question: http://stackoverflow.com/q/26527655
tags question: http://stackoverflow.com/q/26661141
tags question: http://stackoverflow.com/q/26573426
tags question: http://stackoverflow.com/q/26568076
tags question: http://stackoverflow.com/q/26603610
tags question: http://stackoverflow.com/q/26549095
tags question: http://stackoverflow.com/q/26654592
tags question: http://stackoverflow.com/q/26517551
tags question: http://stackoverflow.com/q/26649950
tags question: http://stackoverflow.com/q/26655579
tags question: http://stackoverflow.com/q/26670537
tags question: http://stackoverflow.com/q/26653666
tags question: http://stackoverflow.com/q/26578539

http://stackoverflow.com/a/26638535
accepted answer of: http://stackoverflow.com/q/26638007
answers question: http://stackoverflow.com/q/26638007
type: AcceptedAnswer
score: 0
has body: Configure Maven Repository to be "default" (~/.m2) or "Local to executor", otherwise each job makes it's own copy of Maven Repo.
type: Answer

http://stackoverflow.com/comment/41794437
type: Comment
comment on: http://stackoverflow.com/a/26586926
has text: No, I cant use interfaces. Actually I only have three abstract methods. Almost all functionality are in the lifecycle methods. The purpouse is manage in app billing methods, some of them in background and also dealing with the downloads after purchases.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26600598
has answer: http://stackoverflow.com/a/26600706
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26600736
accepted answer: http://stackoverflow.com/a/26677368
possible better answer: http://stackoverflow.com/a/26600706
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/26600725
has comment: http://stackoverflow.com/comment/41931741
has body: I'm pretty new to Android programming and I've ran into this issue. I have an object I am trying to send into a new activity, which is an instance of this class: public final class BusinessEntity extends com.google.api.client.json.GenericJson { /** * The value may be {@code null}. */ @com.google.api.client.util.Key private Contact contact; /** * The value may be {@code null}. */ @com.google.api.client.util.Key @com.google.api.client.json.JsonString private java.lang.Long id; /** * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String imageUrl; /** * The value may be {@code null}. */ @com.google.api.client.util.Key private Person owner; /** * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List&lt;java.lang.String&gt; tag; /** * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String type; I have tried converting it to gson and sending it in a Bundle with the Intent, and converting it back to a BusinessEntity in the new Activity The problem is I can't deserialize it in the new activity because it contains objects of an arbitrary type. I have tried parsing it as a JsonArray, but I get the exception: "IllegalStateException: This is not a JSON Array." I guess because the object is not in a collection. There are a lot of attributes in the Person and Contact class that I would like to be able to access in the new Activity, but I would also like to avoid sending each attribute separately. Here's what I have in the first class: Intent i = new Intent(mActivity, DetailsActivity.class); Bundle b = new Bundle(); Gson gson = new Gson(); String business = gson.toJson(businesses.get(position)); b.putString("business", business); i.putExtras(b); startActivity(i); And here's what I have in the second class: Bundle b = getIntent().getExtras(); String json = b.getString("business"); Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonArray array = parser.parse(json…
has title: How do I send an object with arbitrary types in it to another activity?
type: Question
has comment: http://stackoverflow.com/comment/41815213
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41815453
has answer: http://stackoverflow.com/a/26677368
tagged with: android-studio
has comment: http://stackoverflow.com/comment/41931874
has comment: http://stackoverflow.com/comment/41953668
linked to: http://stackoverflow.com/q/26152755
has comment: http://stackoverflow.com/comment/41848536

http://stackoverflow.com/comment/41974113
type: Comment
has text: @Alex it was a CQ bug I think. After it I reinstall CQ and search became work.
type: QuestionComment
comment on: http://stackoverflow.com/q/26544123
score: 0

http://stackoverflow.com/a/26649132
type: Answer
has body: the setContentView(textView); is out side the method i mean it is a global make sure it is with in onCreate method
score: 0
answers question: http://stackoverflow.com/q/26649011

http://stackoverflow.com/q/26625451
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/12967427
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26625953
score: 2
upvote count: 2
has body: I am analysing a large project in Sonar and getting following error, 00:41:48.325 INFO - Base dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\. 00:41:48.325 INFO - Working dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\.\.sonar 00:41:48.325 INFO - Source encoding: UTF-8, default locale: en_US 00:41:48.325 INFO - Quality profile for java: PMD 00:41:48.332 INFO - Sensor QProfileSensor... 00:41:48.336 INFO - Sensor QProfileSensor done: 4 ms 00:41:48.336 INFO - Sensor CpdSensor... 00:41:48.336 INFO - SonarEngine is used for java 00:41:48.336 INFO - Sensor CpdSensor done: 0 ms 00:41:48.336 INFO - Sensor InitialOpenIssuesSensor... 00:41:48.486 INFO - Sensor InitialOpenIssuesSensor done: 150 ms 00:41:48.486 INFO - Sensor ProfileEventsSensor... 00:41:48.602 INFO - Sensor ProfileEventsSensor done: 116 ms 00:41:48.603 INFO - Sensor ProjectLinksSensor... 00:41:48.605 INFO - Sensor ProjectLinksSensor done: 2 ms 00:41:48.606 INFO - Sensor VersionEventsSensor... 00:41:48.631 INFO - Sensor VersionEventsSensor done: 26 ms 00:41:48.631 INFO - Sensor FileHashSensor... 00:41:48.631 INFO - Sensor FileHashSensor done: 0 ms 00:41:48.794 INFO - Execute decorators... 00:41:49.256 INFO - Store results in database INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ Total time: 1:19:23.133s Final Memory: 11M/494M INFO: ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.Batch…
type: Question
has title: Out of memory:java heap size in sonar?
tagged with: java
tagged with: sonarqube
tagged with: sonar-runner

http://stackoverflow.com/q/26645930
score: 0
has comment: http://stackoverflow.com/comment/41927310
type: UnansweredQuestion
tagged with: hive
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/41897445
has body: I am trying to load json data into hive table using JSONSERDE but i am facing this problem FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Could not initialize class org.openx.data.jsonserde.objectinspector.JsonObjectInspectorFactory QUERY: create table tip(type string, text string, business_id string, user_id string, date DATE, likes int) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' WITH SERDEPROPERTIES("mapping.date"="date") STORED AS TEXTFILE; Please help..
has title: Could not initialize class org.openx.data.jsonserde.objectinspector.JsonObjectInspectorFactory

http://stackoverflow.com/q/26613039
answer count: 1
has title: Map primary key composed of two foreign keys? hibernate
tagged with: foreign-keys
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26613575
score: 0
tagged with: primary-key
type: Question
has body: I have 3 classes Player(PK Id_player), Match(PK Id_match) and Inscription(PK should be Id_player and Id_match). A Player has ONE and ONLY ONE inscription(1 Player-> 1 Inscription), and a Match can be in many inscriptions(1 Match -> Many inscriptcions). So the table Inscriptions have 2 foreig keys Id_player and Id_match, the problem is that I don't how to tell hibernate that both foreing keys must be a composed primarey key for Inscriptions Table. This is my code:: @Entity @Table(name = "Players") public class Player{ @Id @GeneratedValue private Long Id_player; @OneToOne @JoinColumn(name = "payer_id") Inscription Inscription;} @Entity @Table(name="Matches") public class Match{ @Id @GeneratedValue private long Id_match; @OneToMany @JoinColumn(name = "id_match") List&lt;Inscription&gt; inscriptions= new ArrayList&lt;&gt;(); What should I write on Inscription class to make both Fk's a composed PK. Thanks
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/26636859
downvote count: 2
upvote count: 1
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/26637143
tagged with: static-methods
answer count: 2
has comment: http://stackoverflow.com/comment/41937177
favorite count: 0
has comment: http://stackoverflow.com/comment/41881020
possible better answer: http://stackoverflow.com/a/26667843
accepted answer: http://stackoverflow.com/a/26637143
has answer: http://stackoverflow.com/a/26667843
tagged with: android
score: -1
type: AnsweredQuestion
has body: Below is the data class that I am using Data Class public class Data { private static String product; public static String getData() { return product; } public static void setData(String data) { product = data; Log.d("Data", product.toString()); } } I am getting the object in the below Fragment class: Fragment Class public class contact_details_tab extends Fragment { TextView hostel_name; JSONObject product; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.contact_details_tab, container, false); hostel_name = (TextView) rootView.findViewById(R.id.hostel_name); product = Data.getData(); try { hostel_name.setText(product.getString("h_name")); } catch (JSONException e) { Log.d("Data", e.getMessage()); } return rootView; } } When I try to print the data in the log I always get the error "println needs a message"
has title: NullPointerException when i want to display data in the log
tagged with: java

http://stackoverflow.com/comment/41721852
comment on: http://stackoverflow.com/q/26549448
score: 0
type: Comment
type: QuestionComment
has text: @Mohammad Yes. i'm sure. So no exception?

http://stackoverflow.com/a/26549531
has body: Well, I see nothing that would keep this from compiling, but I do see some problems. To begin with, there are comments indicating the presence of code which is not there. Comments out of sync with code is always a problem. [EDIT: indentation errors have been edited away] And you're catching Exception e, which you really oughtn't to do. You should always catch a specific exception that you expect to encounter, and handle it specifically. Since there's no exception that System.out.println can throw, this would make the whole Exception handling block a problem.
has comment: http://stackoverflow.com/comment/41721665
type: Answer
answers question: http://stackoverflow.com/q/26549448
score: 0

http://stackoverflow.com/q/26536428
has body: I used the following code to write the xml import nu.xom.Document; import nu.xom.Element; import nu.xom.Serializer; Element root = new Element("ADT"); root.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema"); root.setNamespaceURI("urn:hl7-org:v3"); Element msh = new Element("MSH", "urn:hl7-org:v3"); Element msh_1 = new Element("MSH.1", "urn:hl7-org:v3"); msh_1.appendChild(m.getFieldSeperator()); Element msh_2 = new Element("MSH.2", "urn:hl7-org:v3"); msh_2.appendChild(m.getEncodingCharacters()); msh.appendChild(msh_1); msh.appendChild(msh_2); root.appendChild(msh); Document document = new Document(root); Serializer serializer; serializer = new Serializer(System.out, "UTF-8"); serializer.setIndent(4); serializer.write(document); That prints my xml document on the console with pretty print. If anyone can help me to get the same same to an xml file? Thank you
accepted answer: http://stackoverflow.com/a/26536499
score: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-serialization
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26536499
tagged with: java
type: Question
tagged with: xom
answer count: 1
has title: how to write XOM document to XML file with pretty print?

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/26625798

http://stackoverflow.com/a/26562959
has body: Austin is right, look at this answer: https://stackoverflow.com/a/19838327/458157 OS X 10 still comes with an obsolete version of Java 3D installed by default and it brings an obsolete version of JOGL which is loaded in priority. This old version has no method called javax.media.opengl.GLDrawableFactory.initSingleton(). you can find more information about this concern in my tutorial: http://tinyurl.com/qyf995p
score: 0
answers question: http://stackoverflow.com/q/26515228
type: Answer

http://stackoverflow.com/comment/41713232
comment on: http://stackoverflow.com/q/26544412
type: Comment
type: QuestionComment
has text: And, where is the use of == that can't be replaced by the use of equals() in this example? Hint: `list.contains()` uses `equals()`.
score: 0

http://stackoverflow.com/a/26547925
answers question: http://stackoverflow.com/q/26547731
score: 0
type: Answer
has body: what you can do is to add ActionListener to the button click or if you want you can add MouseListener , actually it depends on what you want to do addItem.addActionListener(new ActtionListener() {...});

http://stackoverflow.com/comment/41757769
type: QuestionComment
comment on: http://stackoverflow.com/q/26569363
has text: The problem is eclipse gives me no errors, I only get an error when I build the jar using the builder, the files are in the jar and if I pack it myself it works, was working perfectly before the rename and now its just not.
score: 0
type: Comment

http://stackoverflow.com/comment/41749226
has text: Sorry my bad. But when i println i get "Players@7852e922"
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26564301

http://stackoverflow.com/comment/41956719
comment on: http://stackoverflow.com/a/26656661
type: AnswerComment
has text: Split 6 in two and added 8 and X, elaborated a bit more on #4+
score: 0
type: Comment

http://stackoverflow.com/comment/41813330
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26599441
has text: I see. I never thought this would become an issue in the real world. I just changed the name of one variable to "asdasdfasdfasdf" and now the assertion holds as expected. Idk what to say.. I have to redesign this aspect of my program.
score: 0

http://stackoverflow.com/q/26559377
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26559407
tagged with: permissions
tagged with: android-permissions
has title: Retrieving all kinds of permissions of the installed apps on Android device?
tagged with: java
tagged with: android-intent
type: Question
linked to: http://stackoverflow.com/q/4386823
score: 0
duplicate of: http://stackoverflow.com/q/4386823
answer count: 1
has comment: http://stackoverflow.com/comment/41739417
has body: All I want to know how can I code an app that scans and retrieves all the permission of the installed apps on Android? Thanks in advance for your help :)

http://stackoverflow.com/a/26545113
answers question: http://stackoverflow.com/q/26544946
type: Answer
accepted answer of: http://stackoverflow.com/q/26544946
score: 0
type: AcceptedAnswer
has body: You can do something like this public class CommandQueued { protected virtual void onHandleCommandMessage(Message msg) { //onConferenceEvent(msg); } } public class DerivedCommandQueue : CommandQueued { protected override void onHandleCommandMessage(Message msg) { //.. } }

http://stackoverflow.com/q/26549302
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41721214
type: Question
accepted answer: http://stackoverflow.com/a/26549443
downvote count: 0
has title: My method scale isn't working, what may be the issue?
has comment: http://stackoverflow.com/comment/41721158
tagged with: scale
tagged with: points
answer count: 1
has comment: http://stackoverflow.com/comment/41727677
favorite count: 0
has answer: http://stackoverflow.com/a/26549443
tagged with: shapes
has body: I have been trying to scale a Shape in java, but I'm having some problems. When i try it the Shape simple dissapears... This method receives 2 points, toScale is the point that i want the shape to extend to, and p1 is the point that I clicked in the rectangle that is around the shape to select (there's a rectangle(boundingBox) surrounding the shape wheter is a polygone or a rectangle or just polylines) Here's the scale method code: public void scale(Point toScale, Point p1) { Graphics g = parent.getGraphics(); int distanceToClicked = 0; int distanceToBoundingBox = 0; int scaleFactor = 0; Vector&lt;Point&gt; pointsAux = new Vector&lt;Point&gt;(); Iterator&lt;Point&gt; it = points.iterator(); while (it.hasNext()){ Point p = it.next(); distanceToClicked = (int) Math.sqrt(Math.pow(getCentroid().getX()-p1.getX(), 2)+Math.pow(getCentroid().getY()-p1.getY(),2)); distanceToBoundingBox = (int) Math.sqrt(Math.pow(getCentroid().getX()-toScale.getX(),2)+Math.pow(getCentroid().getY()-toScale.getY(),2)); scaleFactor = distanceToClicked/distanceToBoundingBox; p = new Point((int)p.getX()*scaleFactor,(int) p.getY()*scaleFactor); pointsAux.add(p); } points.clear(); points.addAll(pointsAux); } public Point getCentroid(){ int sumx = 0; int sumy = 0; for(int i = 0; i&lt;points.size();i++){ sumx+=points.get(i).getX(); sumy+=points.get(i).getY(); } Point centroid = new Point(sumx/points.size(), sumy/points.size()); return centroid; } Any help would be appreciated Thanks in advance, and eventually I'm sorry for the misunderstanding code
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/26568763
has title: Error reading information from a JTable empty string error
favorite count: 0
accepted answer: http://stackoverflow.com/a/26568844
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: Does the following code make sense? I'm basically trying to read in values from a JTable and cast them to double. But I'm getting the following errors. Specifically the error in the line 1567 that reads percentageValueDouble=Double.parseDouble(percentageValueString); But I don't understand what the errors mean or how to fix them. This is the source code: if((gradesTable.getModel().getValueAt(i, j)!=null)&amp;&amp;(gradesTable.getModel().getValueAt(i, j)!="")){ percentageValueObject=gradesTable.getModel().getValueAt(i, j); percentageValueString=percentageValueObject.toString(); percentageValueDouble=Double.parseDouble(percentageValueString); } else percentageValueDouble=(Double) null; And this is the error given: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at Gradebook$13.mousePressed(Gradebook.java:1567)
type: Question
tagged with: jtable
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26568844
tagged with: string

http://stackoverflow.com/comment/41678002
type: AnswerComment
score: 0
type: Comment
has text: I tried your solution but I had to modify it a bit. At first I want to avoid using Cloneable, so I added a copy constructor to Dog and Cat. I had to use instanceof to decide, which animal I have to create. All in all the snippet works like it should. But this solution requires that I know exactly, how deep my collection is nested. Additionally, I would have to use many instanceof's when more animals than dogs and cats are possible. Back to Cloneable: is there a reason you would want to use obj.clone() instead of providing a copy constructor for dogs and cats?
comment on: http://stackoverflow.com/a/26524299

http://stackoverflow.com/comment/41925267
type: AnswerComment
score: 0
type: Comment
has text: So what you're saying is add a say `leftPos` and `rightPos`variables then in the if statements 'if (left != null) { leftPos = 2 * pos; assignPositions(cur.left, leftPos;` and the same for right?
comment on: http://stackoverflow.com/a/26660862

http://stackoverflow.com/q/26581426
type: AnsweredQuestion
tagged with: java
tagged with: loops
has title: Java Lotto Number Generator LOOP
downvote count: 1
type: Question
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/26581463
has answer: http://stackoverflow.com/a/26581636
tagged with: arrays
has answer: http://stackoverflow.com/a/26581463
tagged with: int
score: 0
answer count: 2
has body: I just came up with this code that prints me only one line of 5 random lotto numbers and 1 random mega number. I need to create a loop that asks the user "How many tickets would you like?", then prints the amount of lines that the user asks, instead of just one line. How would I do this? I believe its a for loop, but I'm not sure. public static void main(String[] args) { int[] lottoNumber = new int[6]; { lottoNumber[0] = (int) ((47 * Math.random()) + 1); lottoNumber[1] = (int) ((47 * Math.random()) + 1); lottoNumber[2] = (int) ((47 * Math.random()) + 1); lottoNumber[3] = (int) ((47 * Math.random()) + 1); lottoNumber[4] = (int) ((47 * Math.random()) + 1); lottoNumber[5] = (int) ((27 * Math.random()) + 1); } System.out.println("Lottery Numbers: "); for(int i=0; i&lt;1; i++) { System.out.print(lottoNumber[0] + " " ); System.out.print(lottoNumber[1] + " " ); System.out.print(lottoNumber[2] + " " ); System.out.print(lottoNumber[3] + " " ); System.out.print(lottoNumber[4] + " " ); System.out.print("MEGA:(" + lottoNumber[5] + ")"); } } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/26581636
upvote count: 1

http://stackoverflow.com/comment/41834547
comment on: http://stackoverflow.com/q/26596873
type: Comment
type: QuestionComment
has text: hi.. can anyone please help out for the issue ?
score: 1

http://stackoverflow.com/q/26582675
linked to: http://stackoverflow.com/q/16146222
has comment: http://stackoverflow.com/comment/41781636
accepted answer: http://stackoverflow.com/a/26597254
possible better answer: http://stackoverflow.com/a/26602015
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26602015
upvote count: 2
tagged with: java
type: Question
has body: How would I make a java.text.NumberFormat instance that only allows positive integer numbers? Actually, it would be nice if it only allowed from 1 and on. Docs say that the formatting for postive/negative is divided by the ";" character, but putting nothing in the negative formatting or simply not using the ";" doesn't disables negative numbers. These won't do it apparently: NumberFormat nf = new DecimalFormat("#;"); // or NumberFormat nf = new DecimalFormat("#"); // or NumberFormat nf = new DecimalFormat("#;0");
has title: Positive integers only in java.text.NumberFormat?
has answer: http://stackoverflow.com/a/26597254
has comment: http://stackoverflow.com/comment/41808320
answer count: 2
has comment: http://stackoverflow.com/comment/41781744
downvote count: 0
tagged with: jfxtras
has comment: http://stackoverflow.com/comment/41808640
favorite count: 0

http://stackoverflow.com/comment/87993842
type: Comment
comment on: http://stackoverflow.com/a/26607059
score: 0
type: AnswerComment
has text: I think I know why. It means if the entity is merged, the related entity is merged too, which is not the case in this situation, because we only want to create a new Role, but we don't want to create/update a Permission.

http://stackoverflow.com/comment/42011723
comment on: http://stackoverflow.com/a/26707431
type: Comment
has text: no, no, no: `float[] pts = {0, 0}` was just for testing you need to use tag's coords `float[] pts = {tagX, tagY}`
score: 0
type: AnswerComment

http://stackoverflow.com/a/26616505
has body: The simple, no brains solution: Set&lt;Integer&gt; joinedSet = new HashSet&lt;Integer&gt;(); joinedSet.addAll(list1); joinedSet.addAll(list2);
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26616350
type: Answer
score: 4

http://stackoverflow.com/comment/41889826
type: QuestionComment
has text: BinaryTree is the name of a generic class BinaryTree<T>. I'm not sure how to use the levelOrder method in a toString method so that I can show the contents of the ArrayList.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26641130

http://stackoverflow.com/q/26555187
has answer: http://stackoverflow.com/a/26556404
tagged with: webserver
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26556404
has comment: http://stackoverflow.com/comment/41732171
tagged with: jquery
has comment: http://stackoverflow.com/comment/41733992
favorite count: 0
has body: I'm new to web development, so sorry if this is very basic. I'm trying to install jCrop, an it says I need to "Place the files on your web server so you can request them from your page." How exactly do I do this? I've tried researching this but I can't find an explanation anywhere. I'm using Rails 4.0.10, if that helps.
tagged with: jcrop
has comment: http://stackoverflow.com/comment/41737039
has answer: http://stackoverflow.com/a/26555245
has title: How to place files on a web server?
has comment: http://stackoverflow.com/comment/41732143
type: AnsweredQuestion
upvote count: 1
tagged with: ruby-on-rails
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26555245
tagged with: java

http://stackoverflow.com/comment/41798066
score: 0
type: AnswerComment
type: Comment
has text: AFAIK, according to the javadoc (and to your current problem ...) my answer is no : you have to pass the parameter types in the constructor of the factory.
comment on: http://stackoverflow.com/a/26588634

http://stackoverflow.com/a/26562925
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41751257
has body: MIDI files use two values to specify the timing, the resolution (measured in ticks per quarter note), and the tempo (measured in microseconds per quarter note). The resolution can be read from the Sequence. The tempo is specified with MIDI messages; you have to search the first track for SET_TEMPO meta events, which change the tempo for all following events until the next tempo event. Also see How to get integer value from byte array returned by MetaMessage.getData()?, How does Midi TEMPO message apply to other tracks?, and Reading notes from MIDI file using NAudio.
accepted answer of: http://stackoverflow.com/q/26555718
upvote count: 3
answers question: http://stackoverflow.com/q/26555718
type: AcceptedAnswer

http://stackoverflow.com/q/26572414
has comment: http://stackoverflow.com/comment/41763088
has title: Is there any way to wait a status using Callable in java?
tagged with: futuretask
tagged with: java
has body: I have a problem: I create a Task that implements Callable. This task has a mission that wait for the status return to false. The status is depending on the server return. I dont know exactly when server return to false. So I create a task with name WaitForStatus as below. If the status is true this task will call Thread.sleep(); whenever status is false this task is done. How can I do? Below is my code: class WaitForStatusTask implements Callable&lt;String&gt; { private long waitTime; private boolean status; public WaitForStatusTask(boolean _status, int timeInMillis){ this.waitTime=timeInMillis; this.status = _status; } @Override public String call() throws Exception { while(status){ System.err.println("wait.."); Thread.sleep(waitTime); } return "task done"; } } Can you correct this code for me?
type: Question
tagged with: threadpool
tagged with: callable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41763357
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26572535
has comment: http://stackoverflow.com/comment/41763247

http://stackoverflow.com/comment/41836346
comment on: http://stackoverflow.com/a/26597012
has text: I tried it out, but at /status-with-auth it just shows the values of the attributes modified by the custom context. There was no login-dialog.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26608174
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26608220
has comment: http://stackoverflow.com/comment/41828550
score: 3
has answer: http://stackoverflow.com/a/26608306
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26609458
type: Question
has title: Replace string containing " with \"?
has body: How can I replace string containing " with \" ? replace(""","\"") is not working for me. public static String replaceSpecialCharsForJson(String str){ return str.replace("'","\'") .replace(":","\\:") .replace("\"","\"") .replace("\r", "\\r") .replace("\n", "\\n"); }
downvote count: 0
has answer: http://stackoverflow.com/a/26608308
answer count: 6
has answer: http://stackoverflow.com/a/26608281
has comment: http://stackoverflow.com/comment/41828525
tagged with: string
has answer: http://stackoverflow.com/a/26608225

http://stackoverflow.com/comment/41753742
has text: [I knew that this array looked familiar...](http://stackoverflow.com/q/26538139/1079354)
type: Comment
comment on: http://stackoverflow.com/q/26567312
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41744783
has text: So nutshell is we need to have knowledge of JavaEE as well, as Spring does use of the technologies of JavaEE. Does it mean Spring can't exist on its own (if it doesn't use JavaEE). The more i study about JavaEE / Spring, the more confusing it becomes whether what i have understood, is the actual way.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26562094

http://stackoverflow.com/a/26583085
has comment: http://stackoverflow.com/comment/41782436
type: Answer
has comment: http://stackoverflow.com/comment/41782328
answers question: http://stackoverflow.com/q/26583035
upvote count: 4
score: 0
downvote count: 4
accepted answer of: http://stackoverflow.com/q/26583035
has body: 2147483647 is the maximum value parseInt() can parse without giving an exception. 1000000000000 > 2147483647(=Integer.MAX_VALUE, Max value of int).1000000000000 is no longer be an int value(can't represent as an int without integer overflow). So partInt() will give you NumberFormatException You can use Long.parseLong() for larger values like here. Eg: Long.parseLong("1000000000000")
type: AcceptedAnswer

http://stackoverflow.com/q/26669206
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26672419
tagged with: jsp
possible better answer: http://stackoverflow.com/a/26670576
tagged with: jquery
has title: Refresh <s:select> tag on changing backing Java collection in Struts 2
has answer: http://stackoverflow.com/a/26670576
favorite count: 0
tagged with: struts2
has body: I am using two <s:select> tags and a Java collection List is in its list attribute. On change of the one I want to populate a second dropdown. I've used jQuery for that, it's called an action bean and populated the list with JSON response when it was returned and then set the values in the second drop down. All is working fine. JQuery code is shown below. $(document).ready(function () { $('#projectNameBox').change(function (event) { var projectNameBoxVal = $("select#projectNameBox").val(); alert(projectNameBoxVal); $.getJSON('getPackageListAction.action', { "projectId": projectNameBoxVal }, function (jsonResponse) { alert(jsonResponse); var packageNameSelectBox = $('#packageNameBox'); packageNameSelectBox.find('option').remove(); $.each(jsonResponse, function (key, value) { $(' ').val(key).text(value).appendTo(packageNameSelectBox); }); }); }); }); Now my concern is when I updated the second backing list by calling action on change of the first, then why I have to use below code to set option data? var packageNameSelectBox = $('#packageNameBox'); packageNameSelectBox.find('option').remove(); $.each(jsonResponse, function (key, value) { $(' ').val(key).text(value).appendTo(packageNameSelectBox); }); Can we just refresh the component to reflect changes of backing list ?
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/21342293
type: Question
tagged with: double-select
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25993547
tagged with: java
accepted answer: http://stackoverflow.com/a/26672419

http://stackoverflow.com/a/26620700
has comment: http://stackoverflow.com/comment/41854545
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/26620662
has comment: http://stackoverflow.com/comment/41852230
answers question: http://stackoverflow.com/q/26620662
has body: mainframe.getContentPane().add(newGameBTN); mainframe.getContentPane().add(title); The default layout for the content pane of a JFrame is a BorderLayout. When you don't specify a constraint the component is added to the "CENTER". But you can only have a single component in the center so the second component added replaces the first component. Try: mainframe.getContentPane().add(newGameBTN, BorderLayout.NORTH);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26660391
has comment: http://stackoverflow.com/comment/41922762
type: Answer
has comment: http://stackoverflow.com/comment/41922814
has body: You can take each of the characters of a String with the method charAt() public static int englishVowelIndexOf(String word){ char[] vowels = {'a','e','o','i','u','y'}; String wordLowered = word.toLowerCase(); for (int i=0; i &lt; wordLowered.length(); i++){ for (int j=0; j &lt; vowels.length(); j++) { if (wordLowered.charAt(i) == vowels[j]){ return i; } } } return -1; }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26660306
upvote count: 1

http://stackoverflow.com/comment/41816542
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26601169
has text: Correct but I still can't run : Permission denied in /dev/null, guess this is more on permission issue. thanks... :)

http://stackoverflow.com/a/31230316
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26572245
has body: Use an exception breakpoint for IllegalStateException to halt execution when sendError is called, then inspect the local variables on the stack to get the exception that could not be reported, and invoke its printStackTrace method to see its stacktrace. Hopefully, the root cause of the exception will then be clear, and with it how to fix whatever the problem was.

http://stackoverflow.com/a/26607152
has body: I think there are two object created s1 and s3 which goes in heap memory. s2 and s4 are references.
answers question: http://stackoverflow.com/q/26606977
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41826550
has comment: http://stackoverflow.com/comment/41826712

http://stackoverflow.com/a/28611964
has comment: http://stackoverflow.com/comment/68916866
downvote count: 1
answers question: http://stackoverflow.com/q/26591521
has body: For Hibernate see the workaround here HHH-9106.
score: 0
has comment: http://stackoverflow.com/comment/105092685
has comment: http://stackoverflow.com/comment/45528818
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41787227
type: Comment
type: QuestionComment
score: 2
has text: Regarding your last paragraph, take a look at [structural design patterns](http://en.wikipedia.org/wiki/Structural_pattern), maybe something can help you there. Depending on your use case, [flyweight pattern](http://en.wikipedia.org/wiki/Flyweight_pattern) might be something of interest.
comment on: http://stackoverflow.com/q/26585220

http://stackoverflow.com/q/26547950
accepted answer: http://stackoverflow.com/a/26573194
tagged with: http://stackoverflow.com/tag/json
tagged with: jackson
tagged with: jodatime
answer count: 1
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0
has title: JAX-RS, Jackson and JodaTime: not working automatic configuration
has answer: http://stackoverflow.com/a/26573194
tagged with: java
upvote count: 1
has body: I'm trying to create a simple REST service with JAX-RS (Jersey), without using Spring. And I'm using Joda as date fields in my entity. To configure automatic json mapping, I create a JsonMapperProvider, where I add JodaModule: @Provider @Produces(MediaType.APPLICATION_JSON) public class JsonMapperProvider implements ContextResolver&lt;ObjectMapper&gt; { final ObjectMapper objectMapper; public JsonMapperProvider() { objectMapper = new ObjectMapper(); objectMapper.registerModule(new JodaModule()); } @Override public ObjectMapper getContext(Class&lt;?&gt; arg0) { return objectMapper; } } This is my Resource class: @Path("users") public class UserController { @Inject private UserService userService; @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public User getUserById(@PathParam("id") Long id) { return userService.findById(id); } } And I'm using a "no web.xml" configuration, with this class: @ApplicationPath("api") public class RestApplication extends ResourceConfig { } But it doesn't work... the LocalDate field in User entity is always returned empty. The only workaround I found is to register all the components (including JacksonFeature class from jersey-media-json-jackson) in the ResourceConfig class, like this: @ApplicationPath("api") public class RestApplication extends ResourceConfig { public RestApplication() { super( UserController.class, JsonMapperProvider.class, JacksonFeature.class ); } } Is there another solution to this problem? I'd rather not to register all my services and other stuff in this class manually...
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/41679646
type: QuestionComment
has text: The class isn't used but it is referenced. You are using it as a method argument. The class is scanned for all types it needs (basically all imports) and those will be loaded into the classloader. You can see when classes are loaded by starting the JVM with the `-verbose:class` parameter.
comment on: http://stackoverflow.com/q/26525786
score: 0
type: Comment

http://stackoverflow.com/q/26619560
has comment: http://stackoverflow.com/comment/41850303
accepted answer: http://stackoverflow.com/a/26620696
has title: Java Swing GUI User actions handling
tagged with: user-interface
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41850615
favorite count: 0
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/41850821
has answer: http://stackoverflow.com/a/26620696
type: AnsweredQuestion
has body: How should Listeners etc be managed? I've found only examples with one button etc. I can think of following options: Extra class for each - doesn't seem right, especially when items can be created dynamically Class for each group (such as form1, form2, controlButtonsOnLeft, controButtonsOnRight, mainMenu, userMenu, ...) where I'll check which button/component caused this (via getSource method for example) Some super (sized) controller, which will accept all user actions New anonymous class for each, which will call controller's method with parameters specifying details (probably enums) And another question: I've found many examples for MVC, I was wondering what is better (or commonly used) for app. developed by 1 person (app will not be huge)? A. Viewer sets listeners to controller (A1-3) B. Controller calls viewer's methods, which accepts listener as parameter (methods addLoginSubmitListener, addControlBoldButtonListener etc) All of above are possible to implement and so far I would choose B4. Meaning in Control I would do something like this: ... viewer.addLoginButtonListener(new Listener() { @Override public void actionPerformed(ActionEvent e) { ... someButtonsActionHandler(SomeButtonEnum, ActionEnum); ... } }); ... private void LoginActionHandler(LoginElementsEnum elem, ActionEnum action) { if (elem.equals(LOGINBUTTON)) {...} ... } ... This combines readable code (1 logic part at one place in code), doesnt create any unwanted redundant code, doesnt require any hardly-dynamic checks, is easily reusable and more. Can you confirm/comment this solution?
score: 1
tagged with: java
tagged with: listeners
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/41851298
type: Question

http://stackoverflow.com/comment/41680750
has text: Can you post your `IntegerMetaClass` source?
comment on: http://stackoverflow.com/q/26526234
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41841422
comment on: http://stackoverflow.com/q/26614362
has text: Okay, I was thinking of a completely different approach. But now I see what you are asking. I don't normally use maven to execute my applications. But I think you can use "mvn exec:java" and a local pom to do this. I'll answer this question later if no one else gets to it before I get a chance to look into it...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26545049
has comment: http://stackoverflow.com/comment/41713449
has answer: http://stackoverflow.com/a/26545165
score: 0
possible better answer: http://stackoverflow.com/a/26545167
has answer: http://stackoverflow.com/a/26545167
tagged with: java
has answer: http://stackoverflow.com/a/26545187
accepted answer: http://stackoverflow.com/a/26545165
has body: So I have this cyclingmanager game, and I want to show a list of riders by names, and then I want to show their abilities when the user picks a rider. The program compiles and runs nicely, the problem is in my riders() method.It just does not print out c1, my first rider. Thanks in advance. import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class CyclingManager2 { public static void main(String[] args) { //menyvalgene Menu m = new Menu(); m.choice(); } } class Menu { Scanner in = new Scanner(System.in); Cyclist cy = new Cyclist(); //choices public void choice() { int choice = -1; while (choice != 0) { System.out.println("Choose something: "); System.out.println("-0 will exit the program" + "\n-Pressing 1 will open the database menu"); choice = in.nextInt(); switch(choice) { case 0: choice = 0; break; case 1: database(); break; default: System.out.println("You have to choose either 0 or 1"); break; } } } public void database() { System.out.println("Welcome to the database \nThese are the options:\n0 = Back to menu\n1: Riders"); int dbChoice = -1; while (dbChoice != 0) { System.out.println(); dbChoice = in.nextInt(); switch(dbChoice) { case 0: dbChoice = 0; break; case 1: cy.riders(); System.out.println("Press 0 for going back to the menu\nPress 1 for showing the riders");break; default: System.out.println("Choose either 0 or 1"); break; } } } } class Cyclist { List&lt;Cyclist&gt; cyclists = new ArrayList&lt;&gt;(); private String name; private int mountain; private int timeTrial; private int sprint; private int age; Cyclist c1 = null; public void setName(String name) { this.name = name; } public String getName() { return name; } public void setMountain(int mountain) { this.mountain = mountain; } public int getMountain() { return mountain; } public void setTimeTrial(int timeTrial) { this.timeTrial = timeTrial; } public int getTimeTrial() { return timeTrial; } public void setSprint(int sprint) { this.sprint = sprint; } public int getSpr…
has title: Struggling with objects, program does not work as expected(java)
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26545204
tagged with: object-reference
type: Question

http://stackoverflow.com/comment/41772278
score: 0
has text: Can you try to use `'Some message'` instead of `"Some message"`?
comment on: http://stackoverflow.com/q/26576549
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41683839
comment on: http://stackoverflow.com/a/26528493
has text: This is not just a matter of proper English. The difference between mentioning `A` and `a` is significant in this case. I can edit your answer if you don't care to correct it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26533797
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26532184
has comment: http://stackoverflow.com/comment/41694044
type: Answer
answers question: http://stackoverflow.com/q/26532184
score: 7
has body: The behavior matches what you get when summing up ints in a loop. There are various ways to deal with overflow, all of them being a trade-off between general applicability and performance and since it isn’t obvious which one the API will/should use, the one which is commonly known by Java developers has been chosen. If you want to sum using a bigger data type, you can use either long sumL=IntStream.of(A).asLongStream().sum();// may still overflow or BigInteger sum = IntStream.of(A).mapToObj(BigInteger::valueOf) .reduce(BigInteger.ZERO, BigInteger::add);// might be slower If you want throwing behavior, you can use int sum=IntStream.of(A).reduce(0, (a,b)-&gt;{ int c=a+b; if(a&gt;0? b&gt;0 &amp;&amp; c&lt;0: b&lt;0&amp;&amp; c&gt;0) throw new ArithmeticException("overflow"); return c; }); or, much simpler (integrating Stuart Marks’ solution) int sum=IntStream.of(A).reduce(0, Math::addExact);
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/q/26606089
has comment: http://stackoverflow.com/comment/41861831
tagged with: serialization
has comment: http://stackoverflow.com/comment/41856284
accepted answer: http://stackoverflow.com/a/26606287
has comment: http://stackoverflow.com/comment/41851103
has title: Serialization and write object
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41825789
has comment: http://stackoverflow.com/comment/41827128
type: Question
has comment: http://stackoverflow.com/comment/41857771
has answer: http://stackoverflow.com/a/26606287
score: 0
answer count: 1
has body: I wanted to know can we change the way serialization works in java , like say if we have two fields in a class and we create an object of the class. Can we change the order in which the fields of the object is serialized ? also is this any way related to writeObject() method that is used to write the data into a .ser file..?? please help Thanks in advance.... I wanted to know how to do custom serialization..
tagged with: deserialization

http://stackoverflow.com/comment/41871158
score: 2
has text: Exactly. And address it with *real*, measured data. If you can't measure it, you can't improve it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26631529
type: Comment

http://stackoverflow.com/q/26572655
favorite count: 0
answer count: 0
type: UnansweredQuestion
has body: Why am I getting errors while calling context.getResources().getString(R.string.string) in my class? Using context.getResources().getString(R.string.january); just gives me android.content.res.Resources$NotFoundException: String resource ID #0x7f06002e Heres the complete class: public class CustomCursorAdapter extends CursorAdapter{ @SuppressWarnings("deprecation") public CustomCursorAdapter(Context context, Cursor c){ super(context, c); } @Override public View newView(Context context, Cursor c, ViewGroup parent){ LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View returnView = inflater.inflate(R.layout.row, parent, false); return returnView; } public void bindView(View v, Context context, Cursor c){ TextView firstname, surname, bday; firstname = (TextView) v.findViewById(R.id.firstnameTextView); firstname.setText(c.getString(c.getColumnIndex(c.getColumnName(1)))); surname = (TextView) v.findViewById(R.id.surnameTextView); firstname.append(" " + c.getString(c.getColumnIndex(c.getColumnName(2)))); bday = (TextView) v.findViewById(R.id.datepickerTextView); bday.setText("\n" + context.getResources().getString(R.string.january)); } } Why am I getting this error?
tagged with: android
upvote count: 1
has title: Why am I getting errors while calling context.getResources().getString(R.string.string) in my class?
has comment: http://stackoverflow.com/comment/41763946
tagged with: getstring
score: 0
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41763535
has comment: http://stackoverflow.com/comment/41763277
has comment: http://stackoverflow.com/comment/41763798
has comment: http://stackoverflow.com/comment/41812103
has comment: http://stackoverflow.com/comment/41763896
has comment: http://stackoverflow.com/comment/41763581

http://stackoverflow.com/comment/41911072
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26653433
has text: re: exact type of collection & heapspace: [trove](http://java-performance.info/primitive-types-collections-trove-library/) for example provides "collection" implementations for primitive types that don't use lots of wrapper objects. Saves a lot of heap space, speed wise no idea.
type: Comment

http://stackoverflow.com/q/26663578
has comment: http://stackoverflow.com/comment/42024558
tagged with: eclipse
tagged with: gradle
type: Question
accepted answer: http://stackoverflow.com/a/26718465
score: 4
has comment: http://stackoverflow.com/comment/41929571
has answer: http://stackoverflow.com/a/26718465
answer count: 1
has comment: http://stackoverflow.com/comment/41953242
favorite count: 0
tagged with: android-studio
has comment: http://stackoverflow.com/comment/41950556
has body: I've seen many mentions of this problem but most say it happens intermitently. For me I cannot compile or run my app at all. There is a build error and it is always there. I have also seen stack exchange questions stating it is due to the Gradle version and it just needs to be updated in the build.gradle file. I am already using a far newer version than most of those questions. It seems to be an error caused by my resource files including all my drawables, and strings. Note this project runs fine in Eclipse, I have it working on hardware. When I import it to Studio I get errors. I have tried the following. -Restarting Studio -Clean Project then Rebuild -Moving resource files to everywhere else in file system within project Information:Gradle tasks [:app:compileDebugSources] :app:preBuild :app:preDebugBuild :app:checkDebugManifest :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources Error:Content is not allowed in prolog. :app:mergeDebugResources FAILED C:\Users\jezell\Documents\AndroidStudioProjects\DefenderHud\app\src\main\res\drawable_hdpi\app_setup.png Error:Error: Content is not allowed in prolog. Error:Execution failed for task ':app:mergeDebugResources'. &gt; C:\Users\jezell\Documents\AndroidStudioProjects\DefenderHud\app\src\main\res\drawable_hdpi\app_setup.png:0:0: Error: Content is not allowed in prolog. Information:BUILD FAILED Information:Total time: 2 mins 37.404 secs Information:3 errors Information:0 warnings Information:See complete output in console
tagged with: android
upvote count: 4
has comment: http://stackoverflow.com/comment/41966388
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41964913
downvote count: 0
tagged with: java
has title: Migrating from Eclipse to Android Studio Error Content is not allowed in prolog

http://stackoverflow.com/a/26520474
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41683820
score: 0
answers question: http://stackoverflow.com/q/26520129
has comment: http://stackoverflow.com/comment/41684231
has body: To be completely honest, I am not entirely sure what you are trying to accomplish from the code that you posted. However, in response to your actual title, "How to make a read-only data Class in Java", you should look into Enumerations. Essentially Enums will give you the ability to create you data set once at compile time, and provide a bunch of helper methods to read the data you want. I am not entirely sure if it will help your use case, but it will definitely allow you to separate your data into a read-only style format.
type: Answer

http://stackoverflow.com/comment/41876914
type: Comment
has text: By coding, compiling, and executing it.
score: 4
comment on: http://stackoverflow.com/q/26634689
type: QuestionComment

http://stackoverflow.com/q/26553193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41730942
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/26553249
has comment: http://stackoverflow.com/comment/41728549
has comment: http://stackoverflow.com/comment/41728379
type: Question
has body: Here is my program. Just a little one for end of chapter exercises. Problem is that when I run it, it only works when I have %f in my System.printf when in my mind it should be a %d. All of my variables are double and Math.ceil returns a double so I am super confused. Could someone clarify please? import java.util.Scanner; public class Excersise { public static void main(String[] args) { Scanner input = new Scanner(System.in); double enteredHours = 0; double amountDue = 0; System.out.printf("Please enter the number of hours parked."); enteredHours = input.nextDouble(); amountDue = calculateCharges(enteredHours); System.out.printf("The amount due is %f\n", amountDue); // HERE the line // that when I // changed it to // %f it works, // but again all // variables are // double and // Math.ceil // returns a // double. } public static double calculateCharges(double hours) { double roundedHours = 0; roundedHours = Math.ceil(hours); double charges = 2.00; if (roundedHours &gt; 3.0) charges = charges + .5 * roundedHours; if (roundedHours &gt;= 24.0) charges = 10.00; return charges; } }
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/26553246
has answer: http://stackoverflow.com/a/26553246
answer count: 3
has answer: http://stackoverflow.com/a/26554173
has title: Why System.out.printf will only work with %f when all of the variables are declared as double?
favorite count: 0
has answer: http://stackoverflow.com/a/26553249

http://stackoverflow.com/comment/41962852
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26660960
has text: When I try list[0] it only print out 0 and not a value I entered.

http://stackoverflow.com/a/26647975
has body: In your second case, since the last priority is varargs, before that it passes Auto Boxing(int to Integer-first argument) and Widening for second argument (int to long). Where as varargs in last priority it chooses call 2.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26647902
upvote count: 1

http://stackoverflow.com/comment/41703667
score: 1
comment on: http://stackoverflow.com/q/26539232
type: Comment
type: QuestionComment
has text: How do you declare `tri` - remember, arrays in Java are zero indexed, that is, they start at `0` not `1`

http://stackoverflow.com/comment/67548518
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26662839
has text: I had the same problem and the cause was a javaee-api.jar inside tomcat/lib folder. Removing that fixed the issue.
type: AnswerComment

http://stackoverflow.com/q/26575749
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41771338
has comment: http://stackoverflow.com/comment/41769218
favorite count: 0
has comment: http://stackoverflow.com/comment/41769263
has comment: http://stackoverflow.com/comment/41769371
has body: I'm trying to load 500Mb file in memory (Files.readAllBytes) and I need more than 2 Gb Heap size. With default settings I have OutOfMemoryError: Java heap space. When I set up -Xmx1000m it doesn't work. It works only if I set at least -Xmx2300m -Xmx2300m. Why do Java need such overhead?
type: UnansweredQuestion
upvote count: 1
type: Question
has title: I'm trying to load 500Mb file (Files.readAllBytes) and I need more than 2 Gb Heap size. Why?
has comment: http://stackoverflow.com/comment/41769174
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26576042

http://stackoverflow.com/a/28031468
has body: You can not go to the root folder of your application
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26655011

http://stackoverflow.com/comment/41849024
type: Comment
comment on: http://stackoverflow.com/a/26599111
has text: Fractal noise: n1 = new OpenSimplexNoise(seed1); n2 = new OpenSimplexNoise(seed2); n3 = new OpenSimplexNoise(seed3); for x,y { v = (n1.eval(x / 48.0, y / 48.0, 0.5) + n2.eval(x / 24.0, y / 24.0, 0.5) * .5 + n3.eval(x / 12.0, y / 12.0, 0.5) * .25) / (1 + .5 + .25); //... } Rivers: if (v > -0.1 && v < 0.1) water Biomes: for x,y { elev = n1.eval(x / 24.0, y / 24.0, 0.5); temp = n2... precip = n3... if (elev < 0) water else { //decide biome from the three } }
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41898661
comment on: http://stackoverflow.com/q/26609508
score: 0
type: Comment
type: QuestionComment
has text: I think you can use `printWhenExpression` on sureports, have all of subreports in one and based on `printWhenExpression` they can be chosen to either display or not.

http://stackoverflow.com/q/26579436
upvote count: 2
has answer: http://stackoverflow.com/a/26598761
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Synchronizing an ArrayList in a different Class
score: 2
tagged with: java
has body: So I'm aware that in order to synchronize an arrayList you need to use Collections.SynchronizedList(new ArrayList()); But what if the synchronized arrayList is in one class and I want to have a refernce to it in several other classes, the multiple other classes containing the threads that will add to it. Would I do something like List referenceToList = OtherClass.mainList; // inside OtherClass would be List&lt;String&gt;mainList = Collections.sychronizedList(new ArrayList&lt;String&gt;()); Or would the proper way to be List referenceToList = Collections.synchronizedList(OtherClass.mainList); Also is there any difference in the way i would iterate over the list, or is it the same as if All the adding and reading was contained in one Class?
type: Question

http://stackoverflow.com/q/26561271
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has body: I know how JVM interprets byte codes to machine code,so brings platform independency. But, I want to know how JVM comes on the system? i. Is it a pre-existing executable program file resides inside JRE?So, do we need to install JRE, to get the JVM program on my system? or, ii. what does it mean by 'once .java file gets compiled, a jvm instance gets created?' Does it mean that JVM doesn't pre-exist inside JRE but within an allocated memory area of JRE, a mimic/emulate of the actual CPU(of host system) gets created at run-time, which is known as JVM? Please confirm how JVM comes in the picture? iii.Also, I want to know what does it mean by 'instance of JVM?
tagged with: jvm
answer count: 4
has answer: http://stackoverflow.com/a/26561312
has comment: http://stackoverflow.com/comment/41743195
type: UnansweredQuestion
upvote count: 1
has title: How JVM comes in picture?
has answer: http://stackoverflow.com/a/26561326
has answer: http://stackoverflow.com/a/26561303
has answer: http://stackoverflow.com/a/30209464

http://stackoverflow.com/q/26604265
tagged with: google-glass
has title: CardBuilder Layout.AUTHOR switch order of elements
tagged with: android
type: AnsweredQuestion
has body: I'm working on a google glass application and I'm using the CardBuilder (previously was Card but now deprecated)class. With the arrival of CardBuilder there are a couple of different Layouts proposed, and the one that interests me is Layout.AUTHOR. I was wondering if it was possible to "change" the order of the elements, and if so what would be the best method? Such as having the Footnote replaced with the Heading (composed of the icon, heading, and subheading.. ). Here is what I'm currently doing: CardBuilder c = new CardBuilder(getApplicationContext(), Layout.AUTHOR) .setHeading(title) .setSubheading(duration) .setText(summary) .setFootnote(authors); Here is what I would like to do, but I can't since I am currently unable to change the order. (Visual order would be Text, and then Heading with no footnote). CardBuilder c = new CardBuilder(getApplicationContext(), Layout.AUTHOR) .setHeading(authors) .setSubheading(duration) .setText(title + "\n\n" + summary); If my explanations are unclear, please let me know and I shall revise my post. Thanks.
type: Question
has answer: http://stackoverflow.com/a/26610564
tagged with: java
tagged with: google-gdk
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26610564

http://stackoverflow.com/a/26581254
answers question: http://stackoverflow.com/q/26581222
type: Answer
has body: You need to instantiate your array inside your constructor, since the class variables section is run first before you even create an instance of your Generator.
score: 0

http://stackoverflow.com/a/26632424
answers question: http://stackoverflow.com/q/26632229
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41872847
downvote count: 0
has body: p and q are from Type "Path". If you want to use startsWith() you need the type "String". so try this: package newTestPackage.Contains; import java.nio.file.Path; import java.nio.file.Paths; public class testwise { public static void main(String[] args) { Path p = Paths.get("C:\\fakename"); Path q = Paths.get("C:\\fake"); if(p.toString().startsWith(q.toString())) { System.out.println("they match"); } else { System.out.println("oops. no match."); } } } It`s my first answer here. I hope I was able to help you. :-)

http://stackoverflow.com/q/26651638
tagged with: java
has title: Getting undefined in dynamically calling sibling in jquery
accepted answer: http://stackoverflow.com/a/26651682
has body: I am newbie to jquery. In my code I dynamically generate the radio button in jquery.when user clicked on the radio button I should get the siblings value.here is my jsp code. <c:forEach var="user" items="${model.userList}"> Name Is Approver <c:forEach var="disp" items="${user.value}"> <c:out value="${disp.getTblUserDetails().getUserName()}" /> <c:out value='${user.key.getId()}'/> <c:out value='${disp.getTblUserDetails().getId()}'/> </c:forEach> </c:forEach> My Jquery code: $("#result").on("click",".some",function() { event.preventDefault(); var phaseid= $(this).siblings('.phase').val(); var userid=$(this).siblings('.users').val(); alert(userid+" "+phaseid); }); I am getting undefined in alert box.what's wrong with my code.how to I get siblings. Any help will be greatly appreciated!!!!
type: Question
tagged with: jstl
tagged with: javascript
score: 0
answer count: 1
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/41906962
has answer: http://stackoverflow.com/a/26651682
type: AnsweredQuestion

http://stackoverflow.com/a/26593444
type: Answer
has body: Check the hasNext method here http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#hasNext%28%29 it says "The scanner does not advance past any input." So to move it further you should move to next token.
answers question: http://stackoverflow.com/q/26593342
score: 0

http://stackoverflow.com/q/26637363
has comment: http://stackoverflow.com/comment/48298966
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/48358394
has answer: http://stackoverflow.com/a/66710856
tagged with: ssl
has comment: http://stackoverflow.com/comment/48358594
tagged with: ssl-certificate
upvote count: 2
answer count: 1
has body: Edit: This is actually not a Jetty issue at all. I tried running the server using HTTPS with a self-signed certificate, and it works fine. So, it's an issue getting the certificate working. I'm gonna vote to close this question. I'm trying to setup a secure site using SSL with embedded Jetty (v9.2.3). While I've been developing the site, in addition to testing locally, I've also had a live demo on the server available for others to see, running on port 8080 over HTTP. I'm trying to switch to HTTPS now, but it won't work. The site starts up fine according to the logs, and apparently it's listening on port 443, but all requests are rejected immediately. Chrome tells me the webpage is unavailable. But there's nothing on the server to indicate an error. There's no output from either the terminal that the server is launched from or the logs. If I switch back to using port 8080 with HTTP, then it serves requests normally. The keystore that's used in the launch code below has been generated using a certificate issued by a Certificate Authority (server.crt) with the following: keytool -keystore keystore -import -alias keyalias -file server.crt -trustcacerts I should also mention that when I run the server on localhost with a self-signed certificate, it works. But if the SSL keystore is the problem, then should I not be seeing an error when a request is made or when the server starts up? Here's my launch code: // Java 7 bug (feature?) - this disables SNI everywhere... // required or else outgoing HTTPS requests will fail System.setProperty("jsse.enableSNIExtension", "false"); PropertyConfigurator.configure("./log4j.properties"); Server server = new Server(); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar("war"); server.setHandler(webapp); HttpConfiguration https = new HttpConfiguration(); https.addCustomizer(new SecureRequestCustomizer()); SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStorePath("…
has comment: http://stackoverflow.com/comment/48358511
tagged with: embedded-jetty
favorite count: 0
has title: HTTPS requests to embedded Jetty failing
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/30093816
tagged with: jetty
has comment: http://stackoverflow.com/comment/48347077
score: 2
has comment: http://stackoverflow.com/comment/48340510
downvote count: 0

http://stackoverflow.com/q/26655541
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/66029972
linked to: http://stackoverflow.com/q/26763702
has answer: http://stackoverflow.com/a/26657974
accepted answer: http://stackoverflow.com/a/26657974
has title: MultiDex NoClassDefFound error
score: 20
linked to: http://stackoverflow.com/q/15209831
has body: I have converted my application into MultiDex to bear with 64k dex limit. Now it looks like this: public class App extends MultiDexApplication { private AppWrapper instance; @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(base); } @Override public void onCreate() { super.onCreate(); if (instance == null) { instance = new AppWrapper(this); } } } I've pulled all the usual logic from App to AppWidget to make MultiDex work. And it works ok on other teammates' computers. But not with me. It keeps throwing java.lang.NoClassDefFoundError on application create: I/dalvikvm﹕ Failed resolving Lcom/playday/app/core/AppWrapper; interface 8940 'Lretrofit/ErrorHandler;' W/dalvikvm﹕ Link of class 'Lcom/playday/app/core/AppWrapper;' failed I/dalvikvm﹕ Failed resolving Lcom/playday/app/core/AppWrapper; interface 8940 'Lretrofit/ErrorHandler;' W/dalvikvm﹕ Link of class 'Lcom/playday/app/core/AppWrapper;' failed E/dalvikvm﹕ Could not find class 'com.playday.app.core.AppWrapper', referenced from method com.playday.app.core.App.onCreate W/dalvikvm﹕ VFY: unable to resolve new-instance 7076 (Lcom/playday/app/core/AppWrapper;) in Lcom/playday/app/core/App; D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0007 I/dalvikvm﹕ Failed resolving Lcom/playday/app/core/AppWrapper; interface 8940 'Lretrofit/ErrorHandler;' W/dalvikvm﹕ Link of class 'Lcom/playday/app/core/AppWrapper;' failed D/dalvikvm﹕ DexOpt: unable to opt direct call 0xc21b at 0x09 in Lcom/playday/app/core/App;.onCreate I/MultiDex﹕ VM with version 1.6.0 does not have multidex support I/MultiDex﹕ install I/MultiDex﹕ MultiDexExtractor.load( /data/app/com.playdayteam.playday.debug-1.apk, false) I/MultiDex﹕ Detected that extraction must be performed. I/MultiDex﹕ Trying to delete old file /data/data/com.playdayteam.playday.debug/code_cache/secondary-dexes/com.playdayteam.playday. debug-2.apk.classes2.dex of size 1484912 I/MultiDex﹕ Deleted old file /data/data/com.playdayteam.playday.de…
has answer: http://stackoverflow.com/a/26672473
has answer: http://stackoverflow.com/a/40382175
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/26721646
has answer: http://stackoverflow.com/a/44314654
tagged with: android
has answer: http://stackoverflow.com/a/53888853
has answer: http://stackoverflow.com/a/44920001
upvote count: 20
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/44920001
has answer: http://stackoverflow.com/a/44241066

http://stackoverflow.com/q/26540161
tagged with: apache
tagged with: hdfs
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: maven
has body: I want to write files to hdfs present on a remote server and came across few examples like this and this. I have Cdh4.2.1 on my remote server and when from my code I try to do import org.apache.hadoop.conf.Configuration;, I get the following error: Cannot resolve Configuration My pom.xml looks like: org.apache.hadoop hadoop-core 1.2.1 org.apache.hadoop hadoop-common 2.4.1 In this SO post, the pom.xml looks different and when I try to put those versions in my pom, the maven does not recognize it. How can I resolve this issue?
linked to: http://stackoverflow.com/q/18414151
tagged with: java
has answer: http://stackoverflow.com/a/26543845
type: Question
tagged with: hadoop
has title: error in resolving org.apache.hadoop.conf.Configuration

http://stackoverflow.com/a/26522953
type: Answer
answers question: http://stackoverflow.com/q/26522924
score: 4
upvote count: 4
downvote count: 0
has body: use this.add or just add inside your class p to add component to jpanel p[class p].your class p is itself a jpanel because it is extended by jpanel.so you need to add jp2 to that panel . and care about your layout of panel[class p] you can set layout by setLayout.... inside class p class P extends JPanel{ private JPanel jp2; private JButton b2; public P(){ jp2 = new JPanel(); jp2.setBackground(Color.green); b2 = new JButton("DEBUGGING."); jp2.add(b2); // setLayout.....use a appropriate layout if you need add(jp2); } }

http://stackoverflow.com/a/26602601
answers question: http://stackoverflow.com/q/26602510
has comment: http://stackoverflow.com/comment/41819142
score: 0
has body: rs.next only tells you if there is a next record. When you run ResultSet rs=stmt.executeQuery(queryStr); This already places the data from the first record into variable rs. In order to advance to the next record you need to run rs.getRow but only if there is a next record (check with rs.next).
type: Answer

http://stackoverflow.com/q/26559464
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26559808
has body: I'm doing an app for Android. I have a main activity (not the default MainActivity.java, other activity named HotelPresentacion.java that has 3 buttons for insert/check registers or exit the app). If I touch the Registrar button, supposedly I can register, but the app stops unexpectedly. If I touch the Registros button I can visualize the registers of my app, but when I touch one register (a short touch or long short) for only visualize or edit the app again stops unexpectedly. I modified my androidmanifest.xml to set HotelPresentacion.java as my default starting activity. This is the code of the HotelPresentacion.java package com.example.lab007; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class HotelPresentacion extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hotel_presentacion); } public void onReservar(View v){ Intent i=new Intent(HotelPresentacion.this, ReservacionFormulario.class); startActivity(i); } public void onVer(View v){ Intent i=new Intent(HotelPresentacion.this, MainActivity.class); startActivity(i); } public void onSalir(View v){ finish(); } } My androidmanifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> LOGCAT 10-25 11:16:38.880: E/AndroidRuntime(4247): FATAL EXCEPTION: main 10-25 11:16:38.880: E/AndroidRuntime(4247): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lab007/com.example.lab007.ReservacionFormulario}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 10-25 11:16:38.880: E/AndroidRuntime(4247): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 10-25 11:16:38.880: E/AndroidRu…
has comment: http://stackoverflow.com/comment/41739707
has comment: http://stackoverflow.com/comment/41739753
has comment: http://stackoverflow.com/comment/41740126
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41740147
has comment: http://stackoverflow.com/comment/41740157
has comment: http://stackoverflow.com/comment/41739939
tagged with: eclipse
has answer: http://stackoverflow.com/a/26559800
score: 0
answer count: 2
has title: Android application crashed

gui-testing
type: Tag
tags question: http://stackoverflow.com/q/26592554
tag name: gui-testing

http://stackoverflow.com/a/26628132
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26627978
has body: User regular expressions to find your first digit sequence. For instance: String[] input = { "[6, I.3, Contaminación Mecánica, 0.0, 0.0, 0.0, 196.875, 0.0, 196.875]", "[16, E.19, Errores de los usuarios, 0.0, 0.0, 3281.25, 0.0, 0.0, 3281.25]", "[39854, R.01, Robo Outdoor, 0.0, 84000.0, 24500.0, 24500.0, 0.0, 133000.0]" }; // | preceded by start of input and open square bracket // | | digit sequence of any length (1+ characters) Pattern p = Pattern.compile("(?&lt;=^\\[)\\d+"); // iterating various inputs for (String s: input) { // matching Matcher m = p.matcher(s); if (m.find()) { // printing out match System.out.println(m.group()); } } Output 6 16 39854
type: Answer
downvote count: 0

http://stackoverflow.com/a/26562181
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/41745371
has comment: http://stackoverflow.com/comment/41744484
has body: private Random dice; I don't see any code that initializes the dice variable before you use it in dice.nextInt(rollProgressMA);. Just change the declaration to : private Random dice = new Random();
accepted answer of: http://stackoverflow.com/q/26562162
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26562162
type: Answer
has comment: http://stackoverflow.com/comment/41744512

http://stackoverflow.com/a/26619081
type: Answer
has body: OpenStreetMap .pbf files are not simple protobufs. See the documentation here: http://wiki.openstreetmap.org/wiki/PBF_Format Under the section "File format", you'll see this: The format is a repeating sequence of: int4: length of the BlobHeader message in network byte order serialized BlobHeader message serialized Blob message (size is given in the header) That is, the file starts out with a 4-byte integer before the first protobuf message. Since this integer is probably smaller than 2^24, the first byte will of course be zero, which explains the exact exception you are seeing. You will need to read this 4-byte value manually, then make sure to read only that many bytes and parse them as a BlobHeader, and so on. Personally I'd recommend looking for a PBF decoder library that already handles this for you. There must be a few out there.
upvote count: 1
answers question: http://stackoverflow.com/q/26598419
score: 1
downvote count: 0

http://stackoverflow.com/a/26656381
score: 1
answers question: http://stackoverflow.com/q/26656160
upvote count: 1
has body: To elaborate on Elliott's answer: while (win == false); { // etc. etc. etc. } is equivalent to while (win == false) ; // empty statement, does nothing { // The body, which really isn't part of the while loop any more } which has the same effect as while (win == false) { } { // The part that isn't really part of the loop } Since win starts out at false, this will keep looping and doing nothing until win somehow gets changed to true, which of course will never happen. That's why the program is getting stuck--it's in an infinite loop.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42287848
type: QuestionComment
has text: @SteveSiebert Just a static, for inclusion in a .pdf report that will be printed out. So most image formats should suffice
comment on: http://stackoverflow.com/q/26659363
score: 0
type: Comment

http://stackoverflow.com/comment/41806137
type: Comment
score: 0
type: AnswerComment
has text: I posted my xml files
comment on: http://stackoverflow.com/a/26594943

http://stackoverflow.com/q/26578918
has answer: http://stackoverflow.com/a/26578946
upvote count: 1
type: Question
has title: Multiple Swing Applet actionlisteners java
has comment: http://stackoverflow.com/comment/41775379
accepted answer: http://stackoverflow.com/a/26578944
answer count: 2
downvote count: 0
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/41775110
tagged with: swing
has answer: http://stackoverflow.com/a/26578944
has body: Is there a way to make all of these actionlisteners into one statement? jbtn0.addActionListener(this); jbtn1.addActionListener(this); jbtn2.addActionListener(this); jbtn3.addActionListener(this); jbtn4.addActionListener(this); jbtn5.addActionListener(this); jbtn6.addActionListener(this); jbtn7.addActionListener(this); jbtn8.addActionListener(this); jbtn9.addActionListener(this); jbtnAdd.addActionListener(this); jfrm.add(jbtn0); jfrm.add(jbtn1); jfrm.add(jbtn2); jfrm.add(jbtn3); jfrm.add(jbtn4); jfrm.add(jbtn5); jfrm.add(jbtn6); jfrm.add(jbtn7); jfrm.add(jbtn8); jfrm.add(jbtn9); I am rather new to java, and I am using eclipse.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26578946
score: 1
tagged with: java

http://stackoverflow.com/comment/41718242
score: 0
comment on: http://stackoverflow.com/q/26547689
type: QuestionComment
type: Comment
has text: TextField object does not return `null` it returns `""`. That's why it doesn't work.

http://stackoverflow.com/a/26548169
type: Answer
downvote count: 0
score: 3
has body: thats because you are comparing Strings here, and not as assumed integers. So the actual order in the Set is : 1, 10, 2, 3, 4 ! Use the generics : NavigableSet&lt;Integer&gt; original = new TreeSet&lt;&gt;(); and add the values as integers : original.add(1); and so on.
upvote count: 3
answers question: http://stackoverflow.com/q/26548123

http://stackoverflow.com/comment/43830436
comment on: http://stackoverflow.com/q/26542824
score: 0
type: Comment
type: QuestionComment
has text: In other words, just run *cmd.exe* as an [**Administrator**](http://technet.microsoft.com/en-us/library/cc947813%28v=ws.10%29.aspx) and then user the `java -jar tzupdater.jar --update`.

http://stackoverflow.com/q/26595602
accepted answer: http://stackoverflow.com/a/26595858
tagged with: android
has title: Operation translation from jCombobox in Java to Spinner in Eclipse
type: AnsweredQuestion
tagged with: java
has body: Asking a follow-up question here after solving some other problems I was having. Essentially, I'm translating a working program from Java into Eclipse for development of an android app. I've whittled down the problems to a single block of code. In Java, it looked like this: private void shapeDropDownActionPerformed(java.awt.event.ActionEvent evt) { if(shapeDropDown.getSelectedIndex()==1) diameterBox.setText("0"); if(shapeDropDown.getSelectedIndex()==1) diameterBox.setEditable(false); if(shapeDropDown.getSelectedIndex()==2) widthBox.setText("0"); if(shapeDropDown.getSelectedIndex()==2) widthBox.setEditable(false); if(shapeDropDown.getSelectedIndex()==2) heightBox.setText("0"); if(shapeDropDown.getSelectedIndex()==2) heightBox.setEditable(false);} Basically, if the user chooses a rectangle over a cylinder, the diameter input is set to "0" (so it is an integer) and is set to not editable. Or, if the user chooses cylinder, the height &amp; width inputs were set to "0" and not editable. However, I'm having difficulty with this method in Eclipse. Could you please show me how to implement this method in Eclipse? This is what I've got so far that is not working, thus making the entire app malfunction: //Blank out the appropriate blanks: private void setOnItemSelectedListener (new onItemSelectedListener() { if (shapeDD.equals("Rectangle")) txtDiameter.setText("0"); if (shapeDD.equals("Rectangle")) txtDiameter.setEnabled(false); if (shapeDD.equals("Cylinder")) txtWidth.setEnabled(false); if (shapeDD.equals("Cylinder")) txtWidth.setText("0"); if (shapeDD.equals("Cylinder")) txtHeight.setEnabled(false); if (shapeDD.equals("Cylinder")) txtHeight.setEnabled(false); }); A secondary issue I'm having is with resetting the spinner once I'm done with it. In Java, it's simply: jCombobox.setSelectedIndex(0). What is the equivalent method in Eclipse for a Spinner?
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26595858
score: 0
answer count: 1

http://stackoverflow.com/comment/41932362
comment on: http://stackoverflow.com/q/26665024
score: 2
has text: No, it was not "forgotten". It was deliberately left out because it would violate the language's abstractions.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41803569
score: 0
has text: You certainly do not want to make the fetch type EAGER. If you have a significant number of users you could certainly kill your application because a User will certainly need to know their Roles. If Roles also need to know all their Users any user Logging in will result in loading all the Users in the database.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26594328

http://stackoverflow.com/a/26524683
score: 16
has comment: http://stackoverflow.com/comment/41677343
has body: If your method has no return value, don't use the Function interface. Use Consumer&lt;Runnable&gt; instead. public Consumer&lt;Runnable&gt; runner = Platform::runLater; It represents an operation that accepts a single input argument and returns no result.
answers question: http://stackoverflow.com/q/26524633
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41677296
type: Answer
upvote count: 16
accepted answer of: http://stackoverflow.com/q/26524633

http://stackoverflow.com/a/30996776
upvote count: 5
answers question: http://stackoverflow.com/q/26568218
has comment: http://stackoverflow.com/comment/59455841
downvote count: 0
has body: I encountered this problem as well. For me stepping down to Java 7 was not an option though. After some research I found this answer to a similar problem not involving wadl files. The modified solution is to add the mentioned dependency to the maven-wadl-plugin like this: com.sun.jersey.contribs maven-wadl-plugin ... xerces xercesImpl 2.11.0
type: Answer
score: 5

http://stackoverflow.com/comment/41701297
has text: notifyAll() method notifies all waiting threads. I guess you need to learn wait(),notifyAll()
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26537627
score: 0

http://stackoverflow.com/q/26525444
linked to: http://stackoverflow.com/q/2036970
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41678510
tagged with: null
has body: So this program runs fine, its a cycling manager for learning purposes. The problem is when I try to get a list of one rider's abilities: the return values are all null, even though they are set in one of my methods. What have I done wrong? Scroll down to public void abilities, the mistake seems to be located in this area. Thanks in advance! import java.util.Scanner; public class CyclingManager2 { public static void main(String[] args) { //menyvalgene Menu m = new Menu(); m.choice(); } } class Menu { Scanner in = new Scanner(System.in); Cyclist cy = new Cyclist(); //choices public void choice() { int choice = -1; while (choice != 0) { System.out.println("Choose something: "); System.out.println("-0 will exit the program" + "\n-Pressing 1 will open the database menu"); choice = in.nextInt(); switch(choice) { case 0: choice = 0; break; case 1: cy.database(); break; default: System.out.println("You have to choose either 0 or 1"); break; } } } } class Cyclist { private String name; private int mountain; private int timeTrial; private int sprint; private int age; public void setName(String name) { this.name = name; } public String getName() { return name; } public void setMountain(int mountain) { this.mountain = mountain; } public int getMountain() { return mountain; } public void setTimeTrial(int timeTrial) { this.timeTrial = timeTrial; } public int getTimeTrial() { return timeTrial; } public void setSprint(int sprint) { this.sprint = sprint; } public int getSprint() { return sprint; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } public void abilities() { //Pardilla blir til! Cyclist c1 = new Cyclist(); c1.setName("Sergio Pardilla"); c1.setMountain(75); c1.setTimeTrial(60); c1.setSprint(60); c1.setAge(30); System.out.println(getName() + "s abilities:"); System.out.println("Mountain - " + getMountain()); System.out.println("TimeTrial - " + getTimeTrial()); System.out.println("Sprint - " + getSprint()); System.out.println("Age - " +g…
has title: Program runs, only getting nulls as return values
score: 0
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/26525493
accepted answer: http://stackoverflow.com/a/26525488
favorite count: 0
has answer: http://stackoverflow.com/a/26525493
has answer: http://stackoverflow.com/a/26525488
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41693931
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26530506
has text: stop putting java code in jsp files. that was fine in 1997, but it is terrible in 2005 (and beyond).

http://stackoverflow.com/comment/41732122
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26555124
has text: If the `String`s are not `equal`s then there's a problem with your `String`s. Try to print them out and wrap them between `"` to check if there are no blank spaces.
score: 0

http://stackoverflow.com/comment/41709495
type: QuestionComment
has text: in your class one, just introduce getter method like public Collection<classTwo> getAllClassTwo() { return classTwoList;} and in yout caller class just it like one.getAllClassTwo();
comment on: http://stackoverflow.com/q/26542716
score: 0
type: Comment

http://stackoverflow.com/comment/41777098
has text: @DiegöRivera If your JSON string is of the form `[...]`, then you definitely cannot create a `JSONObject` from it.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26579991

http://stackoverflow.com/q/26616393
has comment: http://stackoverflow.com/comment/41844153
has answer: http://stackoverflow.com/a/26619006
type: AnsweredQuestion
tagged with: java
tagged with: sentinel
type: Question
linked to: http://stackoverflow.com/q/3802192
has body: Im writing a program to get the password from the user and make sure it is at least 8 characters, 1 uppercase, and 1 number. If you cant find a password the sentinel is Q to quit but it won't work. Here's what I have... import java.util.Scanner; public class Chapter5ProblemSet { public static void main(String[] args) { String password = getPassword(); String validatePassword = validatePassword(password); displayPassword(validatePassword); } public static String getPassword(){ String password = ""; Scanner in = new Scanner (System.in); System.out.print("Please enter a password: "); password = in.next(); return password; } //must be 8 characters, contain 1 uppercase, contain 1 digit public static String validatePassword(String password){ String validatePassword = ""; boolean oneUpperCase = false; boolean oneDigit = false; final String SENTINEL = "Q"; Scanner in = new Scanner (System.in); while (!oneUpperCase || !oneDigit || password.length()&lt; 8){ validatePassword = "Please try again or enter Q to quit: "; System.out.print(validatePassword); password = in.next(); oneUpperCase = !password.equals(password.toLowerCase()); oneDigit = password.matches(".*\\d.*"); } validatePassword = "Password Ok"; while(!password.equals(SENTINEL)); System.out.print("Quit"); return validatePassword; } public static void displayPassword(String validatePassword){ System.out.println(validatePassword); } }
accepted answer: http://stackoverflow.com/a/26616551
possible better answer: http://stackoverflow.com/a/26619006
score: 0
answer count: 2
has title: I can't get my sentinel to Work java
has answer: http://stackoverflow.com/a/26616551

google-cloud-datastore
tags question: http://stackoverflow.com/q/26515859
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/26542940
tags question: http://stackoverflow.com/q/26662667
tags question: http://stackoverflow.com/q/26571021
tags question: http://stackoverflow.com/q/26618658
tags question: http://stackoverflow.com/q/26567879
tags question: http://stackoverflow.com/q/26565763
type: Tag
tags question: http://stackoverflow.com/q/26628290
tags question: http://stackoverflow.com/q/26622710

http://stackoverflow.com/q/26638038
has title: Performing an action on each removal and addition to a java collection
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41883405
accepted answer: http://stackoverflow.com/a/26638154
score: 1
tagged with: java
type: Question
downvote count: 0
has body: I can't find any information about this: Generally I have a class extending a HashSet. Each object inserted into this collection has it's "owner" and I want to count number of objects belonging to each owner separately. So I wrote a following code: public class Viruses extends HashSet&lt;Virus&gt; { private HashMap&lt;RaceName, Integer&gt; countsPerRace = new HashMap&lt;RaceName, Integer&gt;(); @Override public boolean add(Virus virus) { if(super.add(virus)) { RaceName race = virus.getOwner().getRace().getName(); if(countsPerRace.containsKey(race)) { countsPerRace.put(race, countsPerRace.get(race) + 1); } else { countsPerRace.put(race, 1); } return true; } else { return false; } } @Override public boolean remove(Object virus) { if(super.remove(virus)) { RaceName race = ((Virus)virus).getOwner().getRace().getName(); if(countsPerRace.containsKey(race)) { countsPerRace.put(race, countsPerRace.get(race) - 1); } else { throw new Exception("This should not happen..."); } return true; } else { return false; } } /** * Returns number of viruses of given race. * @param raceId raceName of the viruses, which is equivalent of an owner id as there should never be two owners with the same race * @return number of viruses of given race. */ public int getCount(RaceName raceId) { return countsPerRace.containsKey(raceId) ? countsPerRace.get(raceId) : 0; } // I don't need these, so I thought the best idea will be just to throw an exception here. @Override public boolean removeAll(Collection&lt;?&gt; collection) { throw new EngineRuntimeException("Unsupported operation!"); } @Override public boolean addAll(Collection&lt;? extends Virus&gt; collection) { throw new EngineRuntimeException("Unsupported operation!"); } } The problem is that the remove method is not called, if I remove objects using an iterator. Is there a way to perform an action each time an object is added or removed from a Collection in Java? If not, which methods or classes do I exactly have to overwrite to make sure tha…
answer count: 2
has answer: http://stackoverflow.com/a/26638154
has answer: http://stackoverflow.com/a/26638209
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/26638209

http://stackoverflow.com/comment/41690621
score: 0
type: Comment
has text: do you have the access engine installed !
type: QuestionComment
comment on: http://stackoverflow.com/q/26532112

http://stackoverflow.com/comment/41925459
comment on: http://stackoverflow.com/q/26661515
type: Comment
type: QuestionComment
score: 1
has text: Actually i have never used Luna so just wondering if it can be done in juno.

http://stackoverflow.com/a/26643158
answers question: http://stackoverflow.com/q/26643085
has body: category is a required parameter In you Java code I see: //params.add(new BasicNameValuePair("catagory", catagory)); Commented out, but also with a typo on catagory instead of category
type: AcceptedAnswer
upvote count: 1
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26643085
score: 1

http://stackoverflow.com/comment/41774078
comment on: http://stackoverflow.com/a/26578386
has text: Thanks for your reply, I have made the suggested changes to the set methods. When I run the code this is printed to the console: "Serial Number = ?????? Title = Untitled Author = Unknown " is this printing because of the fact that I have set "Author = unknown" or is it from above in the code where I defined the variables and added a print method?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/44452260
answers question: http://stackoverflow.com/q/26564077
score: 2
downvote count: 0
upvote count: 2
has body: If anyone wants the full code... import java.awt.AWTException; import java.awt.CheckboxMenuItem; import java.awt.Image; import java.awt.Menu; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import javax.annotation.PostConstruct; import javax.swing.ImageIcon; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; public class MyTrayIcon extends TrayIcon { private static final String IMAGE_PATH = "/PATH.png"; private static final String TOOLTIP = "Running"; private PopupMenu popup; final SystemTray tray; public MyTrayIcon(){ super(createImage(IMAGE_PATH,TOOLTIP),TOOLTIP); popup = new PopupMenu(); tray = SystemTray.getSystemTray(); try { setup(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @PostConstruct private void setup() throws AWTException{ // Create a pop-up menu components MenuItem exitItem = new MenuItem("Exit"); popup.add(exitItem); exitItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { final int exitCode = 0; ExitCodeGenerator exitCodeGenerator = new ExitCodeGenerator() { @Override public int getExitCode() { return exitCode; } }; tray.remove(MyTrayIcon.this); SpringApplication.exit(Application.context, exitCodeGenerator); } }); // popup.addSeparator(); setPopupMenu(popup); tray.add(this); } protected static Image createImage(String path, String description){ URL imageURL = MyTrayIcon.class.getResource(path); if(imageURL == null){ System.err.println("Failed Creating Image. Resource not found: "+path); return null; }else { return new ImageIcon(imageURL,descr…
type: Answer
has comment: http://stackoverflow.com/comment/138622403

http://stackoverflow.com/comment/41774338
score: 0
comment on: http://stackoverflow.com/q/26578517
type: QuestionComment
type: Comment
has text: When unsure, implement it yourself, or preferably if possible, check out the source. The potholes of using clone() is mainly that you cannot always know if it works as intended (unless you test it, of course). For example, I've had a hard time getting a clone of an int array. The documentation of clone however states that it should return a copy of the object, so I'm waiting for an answer for this as well!

http://stackoverflow.com/comment/41921351
type: QuestionComment
has text: "So the primary key is rarely used to fetch data" - Not sure I agree with that!
comment on: http://stackoverflow.com/q/26656632
score: 0
type: Comment

http://stackoverflow.com/a/26565651
type: Answer
has comment: http://stackoverflow.com/comment/41762117
has comment: http://stackoverflow.com/comment/41772488
score: 2
has body: Make sure your JSP is allowed to access the Session request object by setting below parameter on top of your JSP page: &lt;%@ page session="true" %&gt; And to avoid HTML illegal chars, it would be better to use el: &lt;title&gt; &lt;c:out value="${sessionScope.item.firstName}"/&gt; &lt;/title&gt; Note: To use the c (core) JSTL, you must import the tag library by declaring below code on top of you JSP page: &lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
has comment: http://stackoverflow.com/comment/41760276
downvote count: 0
has comment: http://stackoverflow.com/comment/41774617
has comment: http://stackoverflow.com/comment/41782484
answers question: http://stackoverflow.com/q/26564598
upvote count: 2

http://stackoverflow.com/comment/41783975
type: Comment
has text: It could even be 6 lines in a property file. You don't need to set spring.datasource.driverClassName when you're using Postgres as Boot will infer it from spring.datasource.url.
comment on: http://stackoverflow.com/a/26549096
type: AnswerComment
score: 2

http://stackoverflow.com/comment/41803191
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26593392
has text: did you run it from ./bin/MyApp/classes/ or from /bin ? what contains your bin folder?

http://stackoverflow.com/a/26648451
has body: The following code snippet may help you &lt;% String data=" Science Plants,Animals,Humans,Nature";//your data from db String [] values=data.split(","); %&gt; &lt;select&gt; &lt;% for(int i=0;i&lt;values.length;i++) { %&gt; &lt;option&gt;&lt;%=values[i]%&gt;&lt;/option&gt; &lt;% } %&gt; &lt;/select&gt;
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26648004
answers question: http://stackoverflow.com/q/26648004
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41798588
score: 0
type: QuestionComment
type: Comment
has text: The float did not work. How about if I creat an outer method to go through the characters in a user input that searches for -?
comment on: http://stackoverflow.com/q/26591584

apache-commons-dateutils
type: Tag
tags question: http://stackoverflow.com/q/26672030
tag name: apache-commons-dateutils

http://stackoverflow.com/comment/41701702
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26538000
has text: What are the values of `magnitude`?

http://stackoverflow.com/comment/41673067
type: QuestionComment
comment on: http://stackoverflow.com/q/26521840
type: Comment
score: 2
has text: Define `best`. Criteria that come to mind: availability of a decompressor given _time and equipment of access_, space (of compressed text (mentioned above) and programs), memory (times time) used during & time and energy spent decompressing and compressing. That said, I'd expect differences between languages and alphabets to be minimal between "self-learning compression procedures" beyond the first kbyte.

http://stackoverflow.com/a/26528312
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26528190
downvote count: 0
type: Answer
has body: To assign a nullvalue tu a double, you have to use the java.lang.Doubleclass. But that's only one part of your problem. Every time you call inValue(), you set your levelto null. So level==null is always true. You have to declare your levelobject outside this function so it will keep the previous value.

http://stackoverflow.com/q/26582395
has answer: http://stackoverflow.com/a/26585957
type: UnansweredQuestion
tagged with: build-automation
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/29509830
upvote count: 3
has answer: http://stackoverflow.com/a/26584894
has body: I went to page object pattern following link and the concepts are nice , https://code.google.com/p/selenium/wiki/PageObjects Here is my doubt : public LoginPage typeUsername(String username) { driver.findElement(usernameLocator).sendKeys(username); return this; } public LoginPage typePassword(String password) { driver.findElement(passwordLocator).sendKeys(password); return this; } public HomePage submitLogin() { driver.findElement(loginButtonLocator).submit(); return new HomePage(driver); } Above selenium calls are wrapped with some function and we are calling these function in testcase or any page level function like this: public HomePage loginAs(String username, String password) { typeUsername(username); typePassword(password); return submitLogin(); } My doubt is: why can't we directly call the sendkey or submit or click every time throughout the project. only one line code again we wrapped with our own function this will take some more time to run code. is there any performance issue or not?
type: Question
tagged with: automation
tagged with: java
answer count: 3
score: 3
downvote count: 0
has title: Page Object pattern desgin
favorite count: 0

http://stackoverflow.com/comment/41806191
type: Comment
comment on: http://stackoverflow.com/a/26540871
score: 0
type: AnswerComment
has text: I initialize the `min` variable to be the highest possible double value. Then for each `grade` in the array I check to see if it is less than the `min` variable. If so, then I set `min` to be that `grade`. So by the end of the loop `min` will be equal to the lowest `grade` in the array.

http://stackoverflow.com/comment/41813360
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26599190
type: AnswerComment
has text: Hi! Followup, if I need to add parameters to the .BAT file, how'd I accomplish that? Thanks!

http://stackoverflow.com/a/26659179
score: 1
accepted answer of: http://stackoverflow.com/q/26659069
answers question: http://stackoverflow.com/q/26659069
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: define the Array into your arrays.xml <?xml version="1.0" encoding="utf-8"?> Element 1 Element 2 Element 3 Element 4 Element 5 Load the elements: String[] elements = getResources().getStringArray(R.array.myArray); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_main,elements);
has comment: http://stackoverflow.com/comment/41921806
downvote count: 0
has comment: http://stackoverflow.com/comment/41922608

http://stackoverflow.com/comment/41770367
type: Comment
has text: Well Java does have `Calendar`, it just doesn't use GUI to display things. I'm sure there are many examplea online of java calendars. Also, like I said before, if you get stuck, come back and we'll be glad to help (as long as your question is formatted nicely and abides by the [guidelines](http://stackoverflow.com/help/how-to-ask)). Try to include code with your next question aswell
comment on: http://stackoverflow.com/q/26576126
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41847468
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26618188
has text: for sure, sorry forgot that.

http://stackoverflow.com/a/26613475
answers question: http://stackoverflow.com/q/26608754
type: Answer
has body: I found my own answer online, I'll summarise it below: In BufferedImages with a ColorModel the pixel is set to the nearest colour chosen. That means that you might not get the colour you wanted because the colours you can set are limited to the colours in the ColorModel. You can get around that by creating your own BufferedImage and draw the source image onto that and then manipulate those pixels. BufferedImage original = ImageIO.read(new File(file.getPath())); image= new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_3BYTE_BGR); image.getGraphics().drawImage(original, 0, 0, null); for(int y = 0; y &lt; original.getHeight(); y++){ for(int x = 0; x &lt; original.getWidth(); x++){ image.setRGB(x,y, original.getRGB(x,y)); } } That solved the problem. Clearly, the ColorModel did not have the colours I had specified and thus adjusted the pixel to the nearest colour it could. Source
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26608754
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/41773346
type: QuestionComment
comment on: http://stackoverflow.com/q/26577873
score: 0
has text: Can you state exactly what your question is? You are only showing us half of the code. Are you asking about the input loop or about the search?
type: Comment

http://stackoverflow.com/comment/43167756
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27348476
type: Comment
has text: I knew that data must have been somewhere! ;-) Will have a look at it. Thanks a lot!

http://stackoverflow.com/a/26629788
upvote count: 1
has comment: http://stackoverflow.com/comment/41868006
has body: Just first assign value=i, then run your loop. You can get the factorial with only while loop. Important: Because n!=n*(n-1)!, therefore, i-- should must be perform before value = value * i. public static void main(String args[]) { int value=5; int i=value; while (i &gt; 1){ i--; value = value * i; } System.out.print(value); } Update: If you want to count factorial of 0 to 9, then use this code: (It includes factorial of 0 also) public static void main(String args[]){ int countLowest=0; int countHighest=9; int value=1; while (countLowest&lt;= countHighest){ if(countLowest==0) value = value * (countLowest+1); else value=value*countLowest; countLowest++; System.out.println("Factorial of "+(countLowest-1)+" is "+value); } } Result: Factorial of 0 is 1 Factorial of 1 is 1 Factorial of 2 is 2 Factorial of 3 is 6 Factorial of 4 is 24 Factorial of 5 is 120 Factorial of 6 is 720 Factorial of 7 is 5040 Factorial of 8 is 40320 Factorial of 9 is 362880
answers question: http://stackoverflow.com/q/26629622
has comment: http://stackoverflow.com/comment/41868725
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41868811
type: Answer

http://stackoverflow.com/a/27127414
answers question: http://stackoverflow.com/q/26609096
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
has body: Use enhanced if condition it will be more easy
accepted answer of: http://stackoverflow.com/q/26609096

http://stackoverflow.com/comment/41673987
type: Comment
has text: @Kyaw According to user 323go, you mean. Thanks for the tip - I looked further into it, and using a ";" might be more useful to you, depending on the speed of the automated answer service.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26522045

http://stackoverflow.com/q/26517285
has comment: http://stackoverflow.com/comment/41664590
has comment: http://stackoverflow.com/comment/41664753
has comment: http://stackoverflow.com/comment/41664631
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41664517
possible better answer: http://stackoverflow.com/a/26517595
has answer: http://stackoverflow.com/a/26517493
has comment: http://stackoverflow.com/comment/41664719
has comment: http://stackoverflow.com/comment/41664772
has answer: http://stackoverflow.com/a/26517595
has body: I am writing a method where all of its arguments will either be doubles or ints. Since much of the code will be the same inside for both overloads, I thought it would be easier to write the interface to accept Numbers. One of the things I need to do in this method is validate that one of the arguments is greater than zero. To make it so I can compare() the passed value against zero, I have the following static fields: private static final Double ZERO_D = Double.valueOf(0); private static final Integer ZERO_I = Integer.valueOf(0); In the method in question, I then try to execute this test: Number zero = ((stepSize instanceof Double) ? ZERO_D : ZERO_I); The strange thing is that this code ALWAYS sets zero to ZERO_D. I currently am using the following code to successfully work around the issue: Number zero; if (stepSize instanceof Double) { zero = ZERO_D; } else { zero = ZERO_I; } Could anyone explain why I am getting this strange result? I would prefer to use the ternary operator here if I can.
has title: Java 8: Weird results combining instanceof and ternary operator
score: 0
has comment: http://stackoverflow.com/comment/41664546
tagged with: ternary-operator
favorite count: 0
tagged with: instanceof
accepted answer: http://stackoverflow.com/a/26517493
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26545910
tagged with: java
has answer: http://stackoverflow.com/a/26546029
has comment: http://stackoverflow.com/comment/41714935
has answer: http://stackoverflow.com/a/26835860
type: Question
tagged with: android-button
has comment: http://stackoverflow.com/comment/41714955
has title: Android Form Validation - How do I prevent a null field from crashing my application on button press?
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26546028
tagged with: android
answer count: 7
has answer: http://stackoverflow.com/a/26546168
has comment: http://stackoverflow.com/comment/41714809
has answer: http://stackoverflow.com/a/26546098
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/41714857
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26546036
has answer: http://stackoverflow.com/a/26546247
has body: I have a form which lets the user add entries into a raffle. However if the user leaves one of these fields blank and presses the submit button the app crashes. I tried to get around this by creating an if statement - if any of the fields are null, do nothing. Else, run the intent. However this still does not fix my problem. Pressing the button still causes a crash. Here is my code: public void addEntrySubmitButtonClick(View view) { Intent addEntryIntent = getIntent(); int currentRaffleID = addEntryIntent.getIntExtra("raffleIndexInList", 0); Raffle currentRaffle = Raffle.raffleArrayList.get(currentRaffleID); String newEntryForename = String.valueOf(addEntryForename.getText()); String newEntrySurname = String.valueOf(addEntrySurname.getText()); int newEntryTelephoneNo = Integer.parseInt(String.valueOf(addEntryTelephoneNo.getText())); int newEntryTicketCount = Integer.parseInt(String.valueOf(addEntryTicketCount.getText())); int newEntryRaffleId = currentRaffle.getId(); if ((newEntryForename.equals(null)) || (newEntrySurname.equals(null)) || (String.valueOf(addEntryTelephoneNo).equals(null)) || (String.valueOf(addEntryTicketCount).equals(null))){ Intent failIntent = new Intent(); } else { Entry newEntry = new Entry(newEntryForename, newEntrySurname, newEntryTelephoneNo, newEntryTicketCount, newEntryRaffleId); // Get the list of raffles for(Raffle currentEntryRaffle : Raffle.raffleArrayList) { if((currentEntryRaffle.getId() == newEntryRaffleId) &amp;&amp; ((currentEntryRaffle.getEntryArrayList().size()) &lt; (currentEntryRaffle.getMaxTickets()))) { int counter=0; do { currentEntryRaffle.getEntryArrayList().add(newEntry); counter++; } while(counter &lt; newEntryTicketCount); } } Intent returnIntent = new Intent(); setResult(RESULT_CANCELED, returnIntent); finish(); } Here is the logcat: 10-24 10:48:42.599 19481-19481/com.example.rafflemanager E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalStateException: Could not execute method of the activity at android.view.…
linked to: http://stackoverflow.com/q/8259377

http://stackoverflow.com/comment/41836753
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26612157
has text: @user3370849 Array is a class with static methods for handling arrays. object arrays extend Object[] and primitive arrays, i'm not sure what they extend if anything...

http://stackoverflow.com/comment/41750264
comment on: http://stackoverflow.com/a/26564988
has text: Given what you've said about the data not technically being corrupt anymore, you might instead consider having a `List<DataCorrection>` in `UserData`, if what you are trying to do is show the caller what's been fixed, rather than what needs to be fixed. `DataCorrection` can have the name and old value of the corrupt field.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26598511
accepted answer: http://stackoverflow.com/a/26598732
tagged with: ios
has comment: http://stackoverflow.com/comment/41811579
tagged with: while-loop
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41811653
has body: So it took me a while to fix all the errors from debug and run the program I wrote from my intro Java class. But now it is giving me the following error after first input. Exception in thread "main" java.io.IOException: Stream closed at sun.nio.cs.StreamDecoder.ensureOpen(StreamDecoder.java:46) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:148) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) at java.io.BufferedReader.readLine(BufferedReader.java:389) at StatsDemo.main(StatsDemo.java:54) I wrote everything below println according to the comments and instructions. But I am not sure what is wrong. It is supposed to ask to enter the file numbers.txt but after I enter the file, it gives me that error. import java.text.DecimalFormat; import java.util.Scanner; import java.io.*; public class StatsDemo { public static void main(String [] args) throws IOException { double sum = 0; int count = 0; double mean = 0; double stdDev = 0; double difference; DecimalFormat threeDecimals = new DecimalFormat("0.000"); Scanner keyboard = new Scanner (System.in); String filename; System.out.println("This program calculates statistics" + "on a file containing a series of numbers"); System.out.print("Enter the file name: "); filename = keyboard.nextLine();
type: Question
has answer: http://stackoverflow.com/a/26598732
has comment: http://stackoverflow.com/comment/41811516
tagged with: java
upvote count: 1
tagged with: loops
has title: Java io stream closed error
linked to: http://stackoverflow.com/q/22900477
answer count: 1

http://stackoverflow.com/q/26551170
type: Question
tagged with: receiver
has comment: http://stackoverflow.com/comment/41731804
tagged with: mms
score: 0
tagged with: android
has title: MMS Android Receiver
answer count: 0
type: UnansweredQuestion
tagged with: http
has comment: http://stackoverflow.com/comment/41731789
tagged with: java
has comment: http://stackoverflow.com/comment/41724653
has body: I can not download the data from the MMS center. Then try on http download data url that took out PduHeaders. But I returned IOException Time Out. i cannot download data from a URL GET request, but standart app dowload.(Hangouts) public class MMSReceiver extends BroadcastReceiver { Context context; ConnectivityManager manager; public void onReceive(final Context context, Intent intent) { this.context = context; Bundle bundle = intent.getExtras(); manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); byte[] buffer = bundle.getByteArray("data"); GenericPdu genericPdu = new PduParser(buffer).parse(); ContentValues vl = getParams(genericPdu); final String contentLocation = vl.getAsString("ct_l"); new Thread(new Runnable() { @Override public void run() { try { ensureRouteToHost(context, contentLocation, "10.10.10.10"); byte[] rawPdu = HttpUtils.httpConnection(context, SendingProgressTokenManager.NO_TOKEN, contentLocation, null, HttpUtils.HTTP_GET_METHOD, true, "10.10.10.10", 8080); // ЗДЕСЬ &lt;==================== Log.i("mLogs", "DATA :" + rawPdu.length); } catch (IOException e) { e.printStackTrace(); } } }).start(); }
has comment: http://stackoverflow.com/comment/41724516

http://stackoverflow.com/q/26551541
tagged with: java
upvote count: 1
type: Question
tagged with: testing
tagged with: tdd
has title: TDD - Check method correctness in a different way than the one used in implementation
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26552169
has answer: http://stackoverflow.com/a/26551955
type: UnansweredQuestion
has body: I'm trying to get out of a situation that happens to me quite often when I write tests. An example scenario is this: I have this class Vagrant that abstracts a Vagrant virtual machine I have configured (Vagrantfile) in the project's root. In this really simple case, this class only has a method start() and a method isRunning() or perhaps getStatus(), it doesn't make any difference. The test should go like this: @Test public void daemonIsSuccessfullyInstalled() { Vagrant vm = new Vagrant(); vm.start(); // todo: here I want to test that the Vagrant vm is actually running. assertTrue(vm.isRunning()); // or assertEquals(vm.getStatus(), "running"); } After firing up the VM with vm.start(), I want to check if the vm is actually running. To do this I could simply run Runtime.getRuntime().exec("vagrant status") and parse the output with a regular expression to extract the status. However, this is what I plan to do in the implementation of the method getStatus() or isRunning(). But, does it make sense to use this same technique inside the test to check the start() method's correctness? In other words, my problem is that I'm going to use the same code (or the same logic, regardless of the actual code used to implement it) to check if the method start() works correctly, as the one I use to implement the method isRunning(). And now how should I check that this code is correct? Should I be confident that this logic is correct, which is to say that I should give up testing some methods, assuming them as correct instead? Or, should I struggle to find another, decoupled, way to check that the VM is running (perhaps looking into ps or something), to avoid using the same code in the test and in the implementation? That would seem to me like writing a method that computes sums using the + operator, and then checking that the output of the method is correct using the same + operator. What if the + operator is bugged? Thank you very much. EDIT: Forgot to mention what the test title is r…

http://stackoverflow.com/comment/86790117
comment on: http://stackoverflow.com/a/26637209
type: AnswerComment
has text: @BasilBourque answer updated. I haven't noticed that you posted an answer as well.
score: 0
type: Comment

java-websocket
tags question: http://stackoverflow.com/q/26555779
type: Tag
tag name: java-websocket

http://stackoverflow.com/a/26664979
has body: Because sub classes may use it. For example: public abstract class Foo { protected String name; public Foo(String name) { this.name = name; } } public class Bar extends Foo { public Bar(String name) { super(name); //&lt;-- necessary, otherwise it won't compile } public Bar() { super("default name"); // &lt;-- necessary, otherwise it won't compile } }
downvote count: 0
answers question: http://stackoverflow.com/q/26664950
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26520563
has comment: http://stackoverflow.com/comment/41670280
downvote count: 0
score: 1
upvote count: 1
has body: Yes = is assignment operator you have to use == to check equality and other than that,note here your switch can be reduce to following and currently you have redundant code you can better use if statement with || operator here. switch (letter) { case "a": case "A": case "b": case "B": case "c": case "C": case "d": case "D": case "f": case "F": x=true; break; default: //...
answers question: http://stackoverflow.com/q/26520452
type: Answer

http://stackoverflow.com/comment/41837834
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26603231
score: 0
has text: just using logcat to test it out (model.getId() is just the index in the list)

http://stackoverflow.com/comment/41682895
has text: there is this bean inside spring-security.xml <beans:bean id="customSuccessHandler" class="com.springgestioneerrori.loginhandler.CustomAuthenticationSuccessHandler"/>
comment on: http://stackoverflow.com/q/26525073
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/26540772
has body: the user enters 2 sting, which are stored in variable a and b. Now there are many ArrayList present in the program, we have to check if there is an ArrayList present with the name stored in variable a. So how can I do that? public static void root(String a,String b) { ArrayList chicago=new ArrayList(); chicago.add("newyork"); chicago.add("new jersy"); chicago.add("dallas"); ArrayList buffalo=new ArrayList(); buffalo.add("arlington"); buffalo.add("california"); buffalo.add("dallas"); ArrayList newyork=new ArrayList(); newyork.add("chicago"); newyork.add("paris"); newyork.add("nigara"); ArrayList stations=new ArrayList(); stations.add(chicago); stations.add(buffalo); stations.add(newyork); if(stations.contains(a)) { } }
has comment: http://stackoverflow.com/comment/41706526
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41706447
has comment: http://stackoverflow.com/comment/41706386
has answer: http://stackoverflow.com/a/26540942
possible better answer: http://stackoverflow.com/a/26540969
score: 0
has comment: http://stackoverflow.com/comment/41706608
has answer: http://stackoverflow.com/a/26540969
answer count: 3
has answer: http://stackoverflow.com/a/26540845
has comment: http://stackoverflow.com/comment/41706368
has comment: http://stackoverflow.com/comment/41706351
type: AnsweredQuestion
tagged with: java
has title: String object to ArrayList object
accepted answer: http://stackoverflow.com/a/26540845
tagged with: collections

http://stackoverflow.com/q/26594837
type: Question
type: AnsweredQuestion
tagged with: java
has body: I'm stuck on creating a program to solve a question for a class. I have a main method and a secondary testing method that are working in conjunction to solve this problem, however I can't get the solution to work when there's a change. The problem is making sure a word is square free, here's an excerpt from the problem: For this part, implement a method called isSquareFree that takes as input (a reference to ) an array of characters. You may assume that the elements of the array are all lower case letters. (In other words, you do not need to worry about a question like: "is Z the same letter as z?") Your method should test if the given input array of characters is square-free. If it is, the method should print a message stating that, otherwise it should print a message stating that the world is not square-free, where the square subword starts and what that subword is. For example, if the given array contained the word zatabracabrac the method should print: The word, zatabracabrac, is not square free, since it has subword, abrac twice starting at position 4 of the word. Below is the current code I have, it works in the case that there is a repeating character directly next to each other, but I'm unsure of how to continue to check if there is multiple repeating characters (abab for example) nor am I sure how to print out the repeating subword. public static void main(String[] args) { // part (a) of the main Scanner keyboard = new Scanner(System.in); System.out.println("***************************"); System.out.println(" Part (a)"); System.out.println("***************************"); do{ System.out.println("Enter a word and then press enter:"); String str=keyboard.next(); char[] word = str.toCharArray(); isSquareFree(word); System.out.println("Do you want to test another word? Press y for yes, or another key for no"); }while(keyboard.next().charAt(0)=='y'); } public static void isSquareFree(char[] word){ int sqf = 0; for(int i=0; i&lt;word.length; i++){ for(int j=0; j&l…
accepted answer: http://stackoverflow.com/a/26594950
has comment: http://stackoverflow.com/comment/41804508
tagged with: for-loop
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/26594950
has comment: http://stackoverflow.com/comment/41804406
score: 0
has title: Square Free Word in Java

http://stackoverflow.com/comment/41758658
type: QuestionComment
type: Comment
has text: This Questions is unclear for some of my peers their. But some people trying to help me by giving codes and through.I am not a native English speaker if u find a problem in questions please comment let others to do their work.Holding questions gives nothing to any of us.Because you can see some people understand my question and gave their answer so think about it.If possible you just modify this question in a proper way.but i need to improve my English Thank you.
comment on: http://stackoverflow.com/q/26559700
score: 0

http://stackoverflow.com/comment/41861395
comment on: http://stackoverflow.com/a/26624147
has text: There is no answer... it is an issue on the Google side... :/
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41751059
has text: oudouz, may be this could help
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26565815

http://stackoverflow.com/comment/41688582
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26531094
type: Comment
has text: I'm having this issue as well. Seems like it would make more sense to have the api key associated with an account

http://stackoverflow.com/comment/41771753
type: QuestionComment
comment on: http://stackoverflow.com/q/26576883
score: 1
type: Comment
has text: Yes that is the problem. You are probably using JRE 1.7 alongsinde JDK 1.8. Have you tried uninstalling the JRE 1.7 if you don't need it for anything? Then java command from JDK 1.8 would be used. Or you can run `sudo update-alternatives --config java` to set your preferred java version.

http://stackoverflow.com/comment/41833753
type: Comment
has text: yup, `SparseArray` came into my mind but i guess he wanted to set different image resource and also reset the value to the boundary for out of bound values like going above 10 and below 0. as mentioned in previous comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26610263

http://stackoverflow.com/q/26649752
answer count: 1
has comment: http://stackoverflow.com/comment/41903653
accepted answer: http://stackoverflow.com/a/26650082
favorite count: 0
score: -4
has body: I am new in java there is a piece of code which is written in if-else i want to change this to switch statement but i have no idea to write in switch statement.Here is my code. <% String userid = request.getParameter("username"); String pwd = request.getParameter("password"); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/auto_lube","root", "password"); Statement st = con.createStatement(); ResultSet rs; `rs = st.executeQuery("select * from users where uname='" + userid + "' and pass='" + pwd + "' and role='users'");` if (rs.next()) { String username = rs.getString("uname"); String email = rs.getString("email"); session.setAttribute("customer_name", username); int user = rs.getInt("id"); session.setAttribute("customer_id", user); if(dat.after(date)){ MailClient client = new MailClient(); String from="username@gmail.com"; String to = email; String subject="Please Attention"; String message="Please change your vehicles oil today is expiery date?"; client.sendMail(from,to,subject,message);} //out.println("welcome " + userid); //out.println("Log out"); response.sendRedirect("index.jsp"); } else { response.sendRedirect("invalid.jsp"); }
linked to: http://stackoverflow.com/q/867194
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41912873
has comment: http://stackoverflow.com/comment/41903805
has title: How to change if-else to switch in jsp?
has comment: http://stackoverflow.com/comment/41903737
has comment: http://stackoverflow.com/comment/41903897
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/26650082
tagged with: if-statement
upvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/41903661
has comment: http://stackoverflow.com/comment/41903710
downvote count: 4

meta-inf
tag name: meta-inf
type: Tag
tags question: http://stackoverflow.com/q/26585462

http://stackoverflow.com/comment/41679373
type: Comment
type: QuestionComment
has text: You could easily do it simply using Graphics2d aka swing.
comment on: http://stackoverflow.com/q/26525887
score: 0

http://stackoverflow.com/comment/41942041
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26661260
has text: can you post full stack trace? Maybe it is related to some introspector bug
score: 0

http://stackoverflow.com/comment/41675974
has text: You should add a link to the API documentation
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26523478

http://stackoverflow.com/comment/41905492
type: Comment
has text: Thanks for the reply,i tried but app/index.html didnt work
comment on: http://stackoverflow.com/a/26648647
type: AnswerComment
score: 0

http://stackoverflow.com/q/26660041
has body: I am new to Hibernate Here my problem is I know how to call stored procedures of mssql using hibernate, so here I used native queries and I am calling this @NamedNativeQueries({ @NamedNativeQuery( name = "callProc", query = "EXEC SimpleProc :var,:var1,:var2, resultClass = resultbean.class )}) Here I have a procedure named let it be MultiResultProc like Create Procedure MultiResultProc ..... begin select * from resulttable1; select * from resulttable2; select * from resulttable3; end So How to sepeciy these multple resultclass, when I google in some where I found that Hibernate will not handle Multiple Result Sets of Sybase and MSSQL db's. But I need that type of work... here my project have that type of multiple procedures and we can't design again. **So Please Help me **
tagged with: sql-server
score: 0
has answer: http://stackoverflow.com/a/26660473
type: AnsweredQuestion
tagged with: stored-procedures
tagged with: java
tagged with: hibernate
has title: How to Hold multiple results arrived from a procedure in hibernate
possible better answer: http://stackoverflow.com/a/26668043
accepted answer: http://stackoverflow.com/a/26660473
tagged with: mssql-jdbc
type: Question
has answer: http://stackoverflow.com/a/26668043
answer count: 2
has comment: http://stackoverflow.com/comment/41922786
has comment: http://stackoverflow.com/comment/41922586

http://stackoverflow.com/comment/41872715
type: Comment
comment on: http://stackoverflow.com/a/26632270
score: 0
type: AnswerComment
has text: Oh. Duh. I was doing string comparisons in my head. Thanks all!

http://stackoverflow.com/a/32623136
downvote count: 0
has comment: http://stackoverflow.com/comment/89425763
answers question: http://stackoverflow.com/q/26616656
score: 3
has comment: http://stackoverflow.com/comment/72503207
type: Answer
has body: Use YourClass[] for List of objects in Volley request. It has solved my issue. The following code should help you: GsonRequest&lt;ReviewModel[]&gt; jsObjRequest = new GsonRequest&lt;ReviewModel[]&gt;(Request.Method.GET, url, ReviewModel[].class, new Response.Listener&lt;ReviewModel[]&gt;() { @Override public void onResponse(ReviewModel[] response) { ReviewsHandleOkResponse(response); } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ReviewsHandleErrorResponse(error); } }); Network.getInstance(getActivity()).addToRequestQueue(jsObjRequest); }
upvote count: 3

http://stackoverflow.com/q/26614394
score: 0
tagged with: localization
has answer: http://stackoverflow.com/a/26614864
answer count: 1
has title: Liferay: getting all available site languages
tagged with: java
tagged with: liferay
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26614864
type: Question
has body: As you know, in Liferay you can setup (portal-)languages which are available to sites. In a site's controlpanel you can choose which of these languages should be available to a user of that site. So far I have only found languageUtil.getAvailableLocales(), which returns a list of the available portal locales not the sites' locales. Is there a way to get site languages?

http://stackoverflow.com/comment/41702595
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26538567
type: Comment
has text: http://www.cs.cmu.edu/~ckingsf/bioinfo-lectures/subsetsum.pdf

http://stackoverflow.com/comment/41854291
score: 1
has text: *"but it didn't work again"* in what didn't it work?
type: QuestionComment
comment on: http://stackoverflow.com/q/26621889
type: Comment

http://stackoverflow.com/comment/41833946
has text: @ brso05 .. I want to have this code in javascript. public String timeNow() { Calendar c = Calendar.getInstance(); TimeZone z = c.getTimeZone(); int offset = z.getRawOffset(); if(z.inDaylightTime(new Date())){ offset = offset + z.getDSTSavings(); } int offsetHrs = offset / 1000 / 60 / 60; int offsetMins = offset / 1000 / 60 % 60; System.out.println("offset: " + offsetHrs); System.out.println("offset: " + offsetMins); c.add(Calendar.HOUR_OF_DAY, (-offsetHrs)); c.add(Calendar.MINUTE, (-offsetMins)); return c.getTime().toString(); }
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26610463
type: Comment

http://stackoverflow.com/comment/41889670
type: Comment
type: QuestionComment
has text: @FabianBarney I will check the String.
comment on: http://stackoverflow.com/q/26641281
score: 0

http://stackoverflow.com/comment/41935874
comment on: http://stackoverflow.com/a/26666870
has text: Edit to the first comment: the API keeps in memory the last key that the user has pressed, and the user can choose to move into a direction according to it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26566051
answers question: http://stackoverflow.com/q/26565967
has body: This was solved by setting TextEdit preferences, Format to "Plain text" and recreated the input file. Managed to get the output without garbage. Source: File input in Java for Mac
type: Answer
has comment: http://stackoverflow.com/comment/84472564
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/26525936
has comment: http://stackoverflow.com/comment/41679732
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has title: Java, creating two identical zip files if content are the same
has comment: http://stackoverflow.com/comment/41679407
accepted answer: http://stackoverflow.com/a/26526112
has comment: http://stackoverflow.com/comment/41679712
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41679517
linked to: http://stackoverflow.com/q/2445962
type: Question
has body: I have this, which works fine for zipping and unzipping: public static final String SLASH = "/"; public static void zip(int level, File zipfile, File... files) throws IOException { try (FileOutputStream fo = new FileOutputStream(zipfile); ZipOutputStream zo = new ZipOutputStream(fo)) { zo.setLevel(level); for (File file : files) { zip("", file, zo); } zo.flush(); zo.finish(); zo.close(); // !!!!!!!! Tried these !!!!!!!!! long time = Cal.date(1970, Cal.Month.JANUARY, 1).getTime(); zipfile.setLastModified(time); Files.setAttribute(zipfile.toPath(), "lastAccessTime", FileTime.fromMillis(time) ); } } public static File unzip(File zipfile, File to) throws IOException { ZipFile filezipped = new ZipFile( zipfile ); Enumeration&lt;? extends ZipEntry&gt; entries = filezipped.entries( ) ; while ( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement( ) ; File file = new File( to, zipEntry.getName( ) ); if ( zipEntry.isDirectory() ) { file.mkdirs(); } else { file.getParentFile().mkdirs(); try ( InputStream in = filezipped.getInputStream(zipEntry) ) { Files.copy( in, file.toPath() ); } } } return zipfile; } private static void zip(String base, File file, ZipOutputStream zo) throws IOException { String path = base + file.getName(); if ( file.isDirectory() ) { path += SLASH; zo.putNextEntry( new ZipEntry(path) ); for (File ff : file.listFiles()) { zip(path, ff, zo); } zo.closeEntry(); } else { zo.putNextEntry( new ZipEntry(path) ); Files.copy(file.toPath(), zo); zo.closeEntry(); } } However, the zip file will have a different checksum even though the content of the file is unchanged. This is a problem when committing the files using git. How can I ensure that the zipped file stays the same every time unless content has changed?
has answer: http://stackoverflow.com/a/26526114
has answer: http://stackoverflow.com/a/26526112
answer count: 2
possible better answer: http://stackoverflow.com/a/26526114
score: 3
downvote count: 0

http://stackoverflow.com/a/26634227
upvote count: 1
answers question: http://stackoverflow.com/q/26634070
downvote count: 0
has body: So the general point is that you in fact DON'T want anyone to be able to access those values. Not only can I see those variables, but I can also change them to anything I like. This can lead to problems in larger, more complex programs. Furthermore, if you wanted to later change how the class uses/stores these values, you couldn't without having to go out and change all the other classes that access those public variables directly. Instead, you should offer methods that provide just the amount of access that you want to give. The standard analogy is that of driving a car. You know how to turn the wheel, hit the brake, etc, but not how the car actually does these things. So if the engine needed to be dramatically changed, or you got in a new car, then you'd still know how to drive. You don't need to worry about what's happening behind the scenes.
type: Answer
score: 1

http://stackoverflow.com/q/26568555
score: 67
has body: Oh, those tricky Java 8 streams with lambdas. They are very powerful, yet the intricacies take a bit to wrap one's header around it all. Let's say I have a User type with a property User.getName(). Let's say I have a map of those users Map&lt;String, User&gt; associated with names (login usernames, for example). Let's further say I have an instance of a comparator UserNameComparator.INSTANCE to sort usernames (perhaps with fancy collators and such). So how do I get a list of the users in the map, sorted by username? I can ignore the map keys and do this: return userMap.values() .stream() .sorted((u1, u2) -&gt; { return UserNameComparator.INSTANCE.compare(u1.getName(), u2.getName()); }) .collect(Collectors.toList()); But that line where I have to extract the name to use the UserNameComparator.INSTANCE seems like too much manual work. Is there any way I can simply supply User::getName as some mapping function, just for the sorting, and still get the User instances back in the collected list? Bonus: What if the thing I wanted to sort on were two levels deep, such as User.getProfile().getUsername()?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26568724
upvote count: 67
favorite count: 0
type: Question
answer count: 2
tagged with: lambda
tagged with: java-8
tagged with: java-stream
tagged with: java
has title: Sorting by property in Java 8 stream
has answer: http://stackoverflow.com/a/26568724
possible better answer: http://stackoverflow.com/a/67603993
downvote count: 0
tagged with: sorting
has answer: http://stackoverflow.com/a/67603993

http://stackoverflow.com/q/26610660
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26611309
has title: How to drag a JavaFX node and detect a drop event outside the JavaFX Windows?
has body: I'm implementing a TabPane that can be detached from the JavaFX window. When the tab pane is dragged outside of the window where it came from, I would like a new window to be created and the tab to be placed in that window. I already implemented some methods using drag gestures to drag the tab between existing windows. However, I am not able to receive any mouse events or drag events when the mouse is moved outside of JavaFX scenes. Is this something possible?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41834238
score: 1
accepted answer: http://stackoverflow.com/a/26611309
has comment: http://stackoverflow.com/comment/41834419
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/41833101
type: Question
downvote count: 0
tagged with: javafx-8
answer count: 1

http://stackoverflow.com/comment/41851839
type: AnswerComment
comment on: http://stackoverflow.com/a/26616881
type: Comment
has text: Hmm. Interesting. I get the point. According to my thought process this could have been `<String>(<Blub>((<Baz>(<Bar>SomeClass.bla()).bling()).bing()).bizz())`
score: 0

http://stackoverflow.com/q/26644547
has body: Please help me to resolve the below task and let me know if you have any questions. I have data in the departmentList object. There are 3 department objects in the departmentList. Object 1 has 2 employee records. Object 3 is separate dept object but with same deptid. (Deptobject DEPTID DEPTNAME Location EmpId EmpName Empsal) 1 1 ABC NY 1 David $5000 1 1 ABC NY 2 Sam $6000 2 2 PQR NC 4 Brian $5500 3 1 ABC NY 5 Glen $7000 I need to consolidate the data into one object (under unique deptid). Expected Out put from above sample data:- (departmentList contains 2 objects and object1 (depid:1) should contains 3 employee object under 1 employeelist object ) (Deptobject DEPTID DEPTNAME Location EmpId EmpName Empsal) 1 1 ABC NY 1 David $5000 1 1 ABC NY 2 Sam $6000 2 2 PQR NC 4 Brian $5500 1 1 ABC NY 5 Glen $7000 List&lt;Department&gt; departmentsList = new ArrayList&lt;Department&gt;(); public Department { int deptId; String deptName; String deptLocation; List&lt;Employee&gt; employeeList=new ArrayList&lt;Employee&gt;(); getterxxx(); setters(); private void addEmployee(Employee e) { this.employeeList.add(e); } } public class Employee { int empId; String empName; int sal; } Thanks in advance!
has comment: http://stackoverflow.com/comment/41895361
type: Question
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41907715
has answer: http://stackoverflow.com/a/26660338
type: UnansweredQuestion
has title: Remove duplicate objects from arraylist and consolidate data with unique object
has comment: http://stackoverflow.com/comment/41898003

http://stackoverflow.com/q/26539172
type: Question
has answer: http://stackoverflow.com/a/26539213
has answer: http://stackoverflow.com/a/26539206
has comment: http://stackoverflow.com/comment/41703577
answer count: 4
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: Do both of these have the same result? If so I'm just confused on why you don't have to have an else statement returning inventoryList.size(); on the first piece of code because if the if statement is true won't it return 0 and inventoryList.size();? public int numItems() { if (inventoryList.isEmpty()) { return 0; } return inventoryList.size(); } And public int numItems() { if (inventoryList.size() != 0) { return inventoryList.size(); } else { return 0; } }
has title: Are these two equivalent?
has comment: http://stackoverflow.com/comment/41703563
has answer: http://stackoverflow.com/a/26539203
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41703601
downvote count: 1
has answer: http://stackoverflow.com/a/26539214

http://stackoverflow.com/comment/41946865
comment on: http://stackoverflow.com/q/26672909
type: Comment
type: QuestionComment
has text: Can you add the code of you Entity (Operator.java)?
score: 0

opencv
type: Tag
tags question: http://stackoverflow.com/q/26607384
tags question: http://stackoverflow.com/q/26615649
tags question: http://stackoverflow.com/q/26672682
tags question: http://stackoverflow.com/q/26543764
tag name: opencv
tags question: http://stackoverflow.com/q/26577820
tags question: http://stackoverflow.com/q/26535645
tags question: http://stackoverflow.com/q/26560185
tags question: http://stackoverflow.com/q/26515981
tags question: http://stackoverflow.com/q/26525567
tags question: http://stackoverflow.com/q/26601931

http://stackoverflow.com/comment/41801148
type: Comment
type: QuestionComment
has text: You have stored a Boolean, so you should be reading it as a Boolean, not a Long.
score: 1
comment on: http://stackoverflow.com/q/26593131

http://stackoverflow.com/comment/41851947
type: Comment
has text: You have a typo. It's also more common to use `length` **property** instead of `size()` **method**.
comment on: http://stackoverflow.com/a/26620591
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41780315
type: Comment
has text: How can i do that @charlieS?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26582005

http://stackoverflow.com/comment/41776025
has text: Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26579391
score: 0

http://stackoverflow.com/comment/41834785
comment on: http://stackoverflow.com/q/26606234
type: Comment
type: QuestionComment
has text: @NidhishKrishnan Give me some time to do my code with below example, If it successful i will give things :)
score: 0

http://stackoverflow.com/q/26623108
tagged with: java
linked to: http://stackoverflow.com/q/7598623
upvote count: 1
type: UnansweredQuestion
tagged with: svm
tagged with: weka
downvote count: 0
score: 1
has body: i am trying to use WEKA-> libSVM for train a dataset using Support vector machine. Here is my code LibSVM svm = new LibSVM(); FastVector predictionsvm = new FastVector(); for (int i = 0; i &lt; trainingSplits.length; i++) { Evaluation validation = SVMclassify(svm, trainingSplits[i], testingSplits[i]); predictionsvm.appendElements(validation.predictions()); } public static Evaluation SVMclassify(Classifier model, Instances trainingSet, Instances testingSet) throws Exception { //return the classification model after training with train set and test with test set Evaluation evaluation = new Evaluation(trainingSet); model.buildClassifier(trainingSet); evaluation.evaluateModel(model, testingSet); return evaluation; } but When i run the code i get an exception called Exception in thread "main" java.lang.Exception: libsvm classes not in CLASSPATH! at weka.classifiers.functions.LibSVM.buildClassifier(Unknown Source) at dentis.test.SVMclassify(test.java:59) at dentis.test.main(test.java:202) I do check whether libSVM in the package or not and libSVM is there. i import the weka.jar in right way too because this is the 4th classifier i am using and this one is only giving me error. Note - i am using 10 fold cross validation
favorite count: 0
has comment: http://stackoverflow.com/comment/44124760
type: Question
has title: [error]- java.lang.Exception: libsvm classes not in CLASSPATH
has comment: http://stackoverflow.com/comment/42107643
answer count: 0
has comment: http://stackoverflow.com/comment/43831245

http://stackoverflow.com/comment/41806150
type: Comment
has text: @RealSkeptic : Is it possible for a solution here?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26593418

http://stackoverflow.com/q/26653399
upvote count: 8
has answer: http://stackoverflow.com/a/26665670
type: Question
tagged with: android
tagged with: ssh
accepted answer: http://stackoverflow.com/a/26676083
has body: I'm trying to open an SSH client session from my Android app. Trying to connect to a device on the local network (a Raspberry Pi). I'm using the SSHJ library version 0.10.0. It fails on the ssh.connect() call, with a TransportException which is ultimately caused by a NoSuchAlgorithmException. Refer exception tree below. SSHClient ssh = new SSHClient(new AndroidConfig()); Session session = null; try { //ssh.loadKnownHosts(); // Exception thrown on this line ssh.connect("192.168.1.109", 22); // Doesn't reach below ssh.authPassword("user", "password"); session = ssh.startSession(); } catch (net.schmizz.sshj.transport.TransportException ex) { ; } Exception tree: net.schmizz.sshj.transport.TransportException net.schmizz.sshj.common.SSHException net.schmizz.sshj.common.SSHRuntimeException java.security.GeneralSecurityException: java.security.NoSuchAlgorithmException: KeyFactory ECDSA implementation not found java.security.NoSuchAlgorithmException: KeyFactory ECDSA implementation not found Other system info: SSHJ library : v0.10.0 Android device : Galaxy Note 3 running Android 4.4.2 I used the maven dependency support in Android Studio to bring in the SSHJ JAR and it pulled in the following three libraries in addition to the SSHJ v0.10.0 jar... bouncy castle... bcpkix-jdk15on-1.50.jar bcprov-jdk15on-1.50.jar logging.... slf4j-api-1.7.7.jar Don't have a clue where to start with this exception ... any suggestions appreciated! Thanks. UPDATE: 31-Oct-2014 As suggested by LeeDavidPainter, I included the SpongyCastle 1.51.0 JAR and added this line at the top: Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); I'm now getting a different exception on the same line: net.schmizz.sshj.transport.TransportException net.schmizz.sshj.common.SSHException net.schmizz.sshj.common.SSHRuntimeException java.security.GeneralSecurityException: java.security.spec.InvalidKeySpecException: key spec not recognised java.security.spec.InvalidKeySpecException: key …
has answer: http://stackoverflow.com/a/28290542
answer count: 6
tagged with: java
tagged with: sshj
has answer: http://stackoverflow.com/a/59351568
tagged with: raspberry-pi
score: 8
has answer: http://stackoverflow.com/a/26689460
downvote count: 0
has answer: http://stackoverflow.com/a/26676083
has answer: http://stackoverflow.com/a/55520475
type: AnsweredQuestion
has title: Android SSHJ exception upon connect() - "KeyFactory ECDSA implementation not found"
favorite count: 0
possible better answer: http://stackoverflow.com/a/26665670

http://stackoverflow.com/comment/41744484
type: AnswerComment
type: Comment
has text: I've actually tried that before and it didn't work. Just out of curiosity, how is this different from just private Random dice?
comment on: http://stackoverflow.com/a/26562181
score: 0

http://stackoverflow.com/a/26570289
accepted answer of: http://stackoverflow.com/q/26570266
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26570266
has body: sorry, the PATH is for executables... Check out the CLASSPATH section at the end. http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
has comment: http://stackoverflow.com/comment/41759464
has comment: http://stackoverflow.com/comment/41794515
has comment: http://stackoverflow.com/comment/41759277
score: 0

http://stackoverflow.com/a/26667206
answers question: http://stackoverflow.com/q/26666809
accepted answer of: http://stackoverflow.com/q/26666809
score: 0
has comment: http://stackoverflow.com/comment/41960093
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41958989
has body: In the onClick method, try: lvhelmets.setAdapter(new HelmetListAdapter(ctx, rowf_format.xml, helmetList)); That will call your adapter which will populate the listview.
type: Answer

http://stackoverflow.com/q/26615381
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41842296
has answer: http://stackoverflow.com/a/26615437
accepted answer: http://stackoverflow.com/a/26615447
tagged with: java
has comment: http://stackoverflow.com/comment/93006964
has title: java-reversing order of characters in string
linked to: http://stackoverflow.com/q/7569335
has answer: http://stackoverflow.com/a/26615588
possible better answer: http://stackoverflow.com/a/26615448
has answer: http://stackoverflow.com/a/26615448
score: 0
has answer: http://stackoverflow.com/a/26615441
tagged with: reverse
answer count: 5
has comment: http://stackoverflow.com/comment/41842127
has comment: http://stackoverflow.com/comment/41842153
has answer: http://stackoverflow.com/a/26615447
has body: I am trying to write a simple method that reverse the characters of a string. I need someone to help me correct this. public String backward(String s){ String str=new String(); String str2=s; char[] c=str.toCharArray(); for (int i=c.length-1;i&gt;=0;i--) str+=c[i]; return str; }

http://stackoverflow.com/comment/41870771
type: Comment
has text: Thanks a lot! I'm trying that now
type: AnswerComment
comment on: http://stackoverflow.com/a/26591711
score: 0

http://stackoverflow.com/a/26682170
answers question: http://stackoverflow.com/q/26665551
score: 0
has comment: http://stackoverflow.com/comment/41963423
type: Answer
has body: If you use simple JMS Transactions, you can avoid message loss on exception and not have to worry about stopping and starting your listener. Here is a good summary on how to decide on the type of acknowledgment you need. Transactions require a bit more complex set up than the auto-ack you are using. You can find a good non-spring example of setting this up in the answer here.
has comment: http://stackoverflow.com/comment/41963017

http://stackoverflow.com/comment/41694826
type: QuestionComment
has text: you need to actually clone the repo in your workspace to use it.
score: 0
comment on: http://stackoverflow.com/q/26534382
type: Comment

http://stackoverflow.com/q/26595605
has comment: http://stackoverflow.com/comment/41806314
score: 0
tagged with: file-io
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26596021
has body: I am have a difficult time writing this program. I am very new to JAVA and I have the basic understanding. But I can't seem to understand what it is asking me to do. import java.text.DecimalFormat; import java.util.Scanner; import java.io.*; public class StatsDemo { public static void main(String [] args) throws IOException { double sum = 0; int count = 0; double mean = 0; double stdDev = 0; String line; double difference; //difference between the value and the mean DecimalFormat threeDecimals = new DecimalFormat("0.000"); Scanner keyboard = new Scanner (System.in); String filename; System.out.println("This program calculates statistics" + "on a file containing a series of numbers"); System.out.print("Enter the file name: "); filename = keyboard.nextLine(); Here are some of the lines from Number.txt that this program is supposed to be reading from. 87.5517 72.14015 88.24248 60.524 65.38684 94.48039 84.73287 84.74978 73.78996
has comment: http://stackoverflow.com/comment/41806147
tagged with: java
tagged with: loops
type: Question
has title: Loops and File Statistics Java Program

http://stackoverflow.com/q/26565606
has comment: http://stackoverflow.com/comment/41750452
upvote count: 2
accepted answer: http://stackoverflow.com/a/26565697
answer count: 3
has title: What's the difference between these ways of initializing a HashMap?
tagged with: generics
possible better answer: http://stackoverflow.com/a/26565699
favorite count: 0
has comment: http://stackoverflow.com/comment/41750522
has answer: http://stackoverflow.com/a/26565697
has comment: http://stackoverflow.com/comment/41750398
linked to: http://stackoverflow.com/q/2770321
has body: I used a HashMap for my program and it works fine, but I don't understand the difference between these initializations of HashMap. Let's say I'm implementing a HashMap with a character as a key and an integer as a value. What's the difference between these? HashMap&lt;Character, Integer&gt; alphabet1 = new HashMap(); HashMap&lt;Character, Integer&gt; alphabet1 = new HashMap&lt;Character, Integer&gt;(); HashMap alphabet1 = new HashMap&lt;Character, Integer&gt;(); Map alphabet1 = new HashMap&lt;Character, Integer&gt;(); HashMap alphabet1 = new HashMap&lt;Character, Integer&gt;(); HashMap alphabet1 = new HashMap(); Map alphabet1 = new HashMap();
linked to: http://stackoverflow.com/q/4166966
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26565741
has answer: http://stackoverflow.com/a/26565699
type: Question
tagged with: hashmap
linked to: http://stackoverflow.com/q/1992384

http://stackoverflow.com/q/26652722
has comment: http://stackoverflow.com/comment/41908769
tagged with: java
has body: I was trying to read date form an excel using this code case 2: if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { if ((cell.getDateCellValue()) != null) { postAssumpContractPojo.setAssumptionDate(cell.getDateCellValue()); } } Break; But the first Condition is getting Flase ( if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC)) And in excel date is in this format (2014-10-14) Please Help ...
has answer: http://stackoverflow.com/a/26652825
type: Question
has comment: http://stackoverflow.com/comment/41908658
score: 0
has title: how to read Date from Excel file
answer count: 1
linked to: http://stackoverflow.com/q/9756748
type: UnansweredQuestion
tagged with: apache-poi

http://stackoverflow.com/q/26636724
tagged with: java
accepted answer: http://stackoverflow.com/a/26636760
score: 0
has comment: http://stackoverflow.com/comment/41880828
answer count: 1
has body: Is it possible that an Enum like TimeUnit be passed as an argument to a method? I am writing a Java method that takes a long as a duration argument and was curious if there is a better way to do it. Basically, I want to pass something to my method that is a little bit clearer/explicit on what duration I am actually trying to pass to it. I don't want to write my own wrapper since I am sure something already exists out there, doesn't it? So, something like this, which obviously doesn't work because unit doesn't store any "state", does it? : void timedMethod( TimeUnit unit ) { long duration = 1000; long val = unit.toMillis(duration); }
has title: Can the Enum TimeUnit be passed as an argument to a method?
has answer: http://stackoverflow.com/a/26636760
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41880759
has comment: http://stackoverflow.com/comment/41880763
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/41880733

http://stackoverflow.com/q/26652148
has comment: http://stackoverflow.com/comment/41908158
has comment: http://stackoverflow.com/comment/41909491
answer count: 1
has comment: http://stackoverflow.com/comment/41907781
favorite count: 0
has comment: http://stackoverflow.com/comment/41907802
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/41908471
has comment: http://stackoverflow.com/comment/41908708
has comment: http://stackoverflow.com/comment/41907895
has comment: http://stackoverflow.com/comment/41908544
tagged with: java
has comment: http://stackoverflow.com/comment/41907987
type: Question
has comment: http://stackoverflow.com/comment/41907864
upvote count: 0
has answer: http://stackoverflow.com/a/26653139
has title: check if three arrays have the same value
has body: I put numbers of three people in one arraylist and in the case if three people have the same number then overall occurrences++; this is my algorithm but it is not working for this case!! 5 (first person has 5 nums) 13 20 22 43 146 4 (second person has 4 nums) 13 22 43 146 5 (third person has 5 nums) 13 43 67 89 146 int occurrences = 0; for (int i = 0; i&lt;n; ++i){ for (int j = n; j&lt;n+b; ++j ){ if(arr.get(i)==arr.get(j)){ System.out.println(arr.get(i)+" " +arr.get(j)); for(int k=n+b; k&lt;arr.size(); ++k){ if(arr.get(j)==arr.get(k)){ ++occurrences; System.out.println(arr.get(k)); } } } } }
linked to: http://stackoverflow.com/q/5943330
downvote count: 4

http://stackoverflow.com/a/26628095
has body: Eran answer is good, my opinion is that you are expecting to make your IPAdress class implementing Comparable And define your compareTo method to take care of the different adresses in your adresses array.
score: 0
answers question: http://stackoverflow.com/q/26627893
type: Answer

http://stackoverflow.com/comment/66310989
comment on: http://stackoverflow.com/a/29291614
has text: Well, this answer is from Retrofit 1 days, but can't you use it the same way in Retrofit 2 like this? (I haven't tested it): Gson gson = new GsonBuilder().disableHtmlEscaping().create(); Retrofit retrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create(gson)).client(okHttpClient).build();
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/26642025
downvote count: 0
has comment: http://stackoverflow.com/comment/42824611
answers question: http://stackoverflow.com/q/26604516
has comment: http://stackoverflow.com/comment/41903852
has body: Ok, it's a bit tricky, because html's losts it's selection after any update, and real model object (choosen file) for FileUploadField is set only when post event occurs. So, even if we add AjaxEventBehavior with onchange event into our file panel - it's model will be null after user selects file. Actually, we have access to the chosen file before post request only from js and you can implement 'saving' script, to hold already selected files in some array, while ajax update is proccessed, and then set them back, but it is tediously. So, another way to solve this issue is to proccess update only on newly added component and don't touch others. I will use RepeatingView, because I need to generate new wicket ids only when I click addLink and not according to the model. Here's the code (read comments carefully): /* Method, which init your form */ private void init() { /* Container, which will hold all FileUploadFields, as RepeatingView adds children to it's parent object. */ WebMarkupContainer container = new WebMarkupContainer("container"); /* We need DOM id for container component. */ container.setOutputMarkupId(true); add(container); final RepeatingView rv = new RepeatingView("dokumenteList"); container.add (rv); /* We need to add all default model values by ourselfs for RepeatingView: */ for(EtdDokument doc : getListModel().getObject()) { createDocumentRow(rv, doc); } final AjaxLink<String> addLink = new AjaxLink<String>("addDokument") { @Override public void onClick(AjaxRequestTarget target) { final EtdDokument newValue...; final EtdDokumentRowPanel r = createDocumentRow(rv, newValue); ... /* This is it. We dynamicly adding created earlier component to markup. This allows us to update this component via ajax. */ target.prependJavaScript( "var item=document.createElement('div');" + //creating empty 'div' tag "item.id='" + r.getMarkupId() + "'; " + // set markup id for this 'div'. "Wicket.$('" + container.getMarkupId() + "').appendChild(item);" // add this 'div' as co…
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42857692
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26604516

http://stackoverflow.com/comment/41829751
type: AnswerComment
type: Comment
has text: Thats nice of you Pharap. As for fge, I upvoted your answer ;)
comment on: http://stackoverflow.com/a/26608669
score: 0

http://stackoverflow.com/a/26560391
has body: you forgot your j = 3 case for (int i = 1; i &lt;= 5; i++) { for (int j = 1; j &lt;= i; j++) { if (j == 1) { System.out.print(" " + i); } else if (j == 2) { System.out.print(" " + (i + j + 2)); } else if(j == 3){ System.out.print(" " + (i + j + 4)); } else { System.out.print(" " + (i + j + 5)); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26560299

http://stackoverflow.com/comment/41826053
score: 0
has text: Why not a [tag:java-web-start] shortcut?
comment on: http://stackoverflow.com/q/26606822
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26539039
accepted answer of: http://stackoverflow.com/q/26533689
score: 5
type: Answer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/107894832
has body: Yes, this can be done with any task that implements JavaForkOptions. test { minHeapSize = '2g' maxHeapSize = '4g' }
answers question: http://stackoverflow.com/q/26533689
type: AcceptedAnswer

http://stackoverflow.com/comment/41909026
type: Comment
has text: @fge Exactly. Instead of quoting I am giving the inference. Do you believe it is wrong?
comment on: http://stackoverflow.com/a/26652874
type: AnswerComment
score: 0

http://stackoverflow.com/a/26636845
has comment: http://stackoverflow.com/comment/41881006
has body: You could do this instead by using the substring() method. Given a string str: String str = "quicksand"; String firstHalf = str.substring(0, str.length() / 2); String secondHalf = str.substring(str.length() / 2); String finalString = ""; if (str.length() == 1) { finalString = str; } else { finalString = secondHalf.concat(firstHalf); }
upvote count: 1
has comment: http://stackoverflow.com/comment/41881041
downvote count: 1
answers question: http://stackoverflow.com/q/26636803
has comment: http://stackoverflow.com/comment/41881161
score: 0
type: Answer

http://stackoverflow.com/q/26635647
type: UnansweredQuestion
tagged with: stream
type: Question
has body: There's an immense amount of forum posts, blog entries and questions in Q&amp;As (including this site1) answering this question wrongly and showing an alarming misunderstanding of what reading files means for applications. Reading a file into memory and operating on it is not a suitable solution for arbitrary large files (and it lies in the nature of file to be arbitrary large). So now I'm looking for a "real" solution to search a string in a file and retrieve its position counted from the beginning of the stream. To make things clear and not produce the 19382th useless answer: A file is a file. They can be some TB large if not specified contrarily. That implies that reading a file into memory will potentially crash my application and/or cause downtime of my service if the file size isn't validated. Reading files of limited size is not(!) part of my question[2]. A string is a string. They can be of arbitrary length, especially larger than the buffer the file content is read into during stream processing (not larger than memory, though)! AFAIK there's no class in the Java 7 JDK, especially not java.util.Scanner which doesn't retrieve the position of the results and requires the position to be found with java.lang.String.indexOf which requires the input to be in memory! There definitely have to be some streaming libraries for gene substring search used in bioinformatics which have such search already implemented. Not even Wikipedia's article on string search algorithms mentiones or links stream-based processing! EDIT 1: I gave up and used python with the bitstring module (available with pip). It reaches read troughput of 170MB/s (with is the read maximum of the OS) and is well tested; got my script working with 5 lines of code, i.e. exactly what I'm looking for! I'm still interested in (real) solutions for java, though. 1 How to Access string in file by position in Java [2] And also not of the many questions out there which are answered wrongly in my POV (and therefor…
linked to: http://stackoverflow.com/q/14156314
tagged with: java
has comment: http://stackoverflow.com/comment/41879301
has title: How to really find the position of a string in a file in java?
has comment: http://stackoverflow.com/comment/41879205
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/41879018
has answer: http://stackoverflow.com/a/66312796
score: 0
has answer: http://stackoverflow.com/a/26635878

http://stackoverflow.com/a/34811759
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26555346
has body: StringUtils in Apache Commons Lang 3 has a containsOnly method, https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html The implementation should be fast enough.
upvote count: 3

http://stackoverflow.com/a/26536499
accepted answer of: http://stackoverflow.com/q/26536428
answers question: http://stackoverflow.com/q/26536428
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0
has body: FileOutputStream fileOutputStream = new FileOutputStream ("out.xml") serializer = new Serializer(fileOutputStream, "UTF-8"); serializer.setIndent(4); serializer.write(document); //close fileOutputStream ...
score: 3

http://stackoverflow.com/comment/41798272
comment on: http://stackoverflow.com/q/26591584
score: 0
type: Comment
type: QuestionComment
has text: Yes, that was an error in me pasting

http://stackoverflow.com/a/26524038
has comment: http://stackoverflow.com/comment/41676255
answers question: http://stackoverflow.com/q/26523720
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26523720
has body: You've got 1 2 1 in some magic section, because private methods are resolved w/o polymorphism, compiler creates call to method contained in type variable declared with, in your case Test3. Declare print1 as non-private in Test3 (and, consequently, in Test4 as it's prohibited to tighten access modifiers of methods) and see polymorphism in action, so you'll get expected 1 2 2. Consider shorter example: class Test { private static class Test3 { private void print1() { System.out.println("non-polymorphic 1"); } void polymorphic() { System.out.println("polymorphic 1"); } } private static class Test4 extends Test3 { private void print1() { System.out.println("non-polymorphic 2"); } void polymorphic() { System.out.println("polymorphic 2"); } } public static void main(String[] args) { Test4 t4 = new Test4(); t4.print1(); t4.polymorphic(); System.out.println("======"); Test3 t34 = new Test4(); t34.print1(); t34.polymorphic(); } } CLARIFICATION ... to my comment to this answer: polymorphism isn't effective for access to data fields, only for methods. Consider: private static class Test3 { int i = 1; } private static class Test4 extends Test3 { int i = 2; } public static void main(String[] args) { Test4 t4 = new Test4(); System.out.println(t4.i); System.out.println("======"); Test3 t34 = new Test4(); System.out.println(t34.i); } Despite i declared non-private, t34.i value is 1.
score: 3
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41676348
has comment: http://stackoverflow.com/comment/41676173

http://stackoverflow.com/comment/41813059
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26599262
has text: each element (unique combination [row][column])in the matrix is converted to a string. which is what the OP asks for
score: 0

http://stackoverflow.com/comment/41670547
has text: `I would still have been pondering how to do what I was trying to do` - all you had to do was take 5 minutes to look at the tutorial. The tutorial states: `to set the menu bar for a JFrame, you use the setJMenuBar method. To add a JMenu to a JMenuBar, you use the add(JMenu) method. To add menu items and submenus to a JMenu, you use the add(JMenuItem) method.` Not only that, you can download, compile and test the code. There is nothing abstract about that. Did you bookmark the tutorial so you can refer to it for other questions?
type: Comment
comment on: http://stackoverflow.com/a/26516054
score: 0
type: AnswerComment

http://stackoverflow.com/q/26546564
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26546667
tagged with: java
has answer: http://stackoverflow.com/a/26546672
answer count: 2
has comment: http://stackoverflow.com/comment/41717939
possible better answer: http://stackoverflow.com/a/26546672
tagged with: tomcat
tagged with: singleton
has body: I am currently developing a web solution using JavaEE. I have a database connection being established through a singleton. Will a singleton be user specfic, as in a new instance will be created for each user or will the singleton be shared across all users on the server? Thanks
linked to: http://stackoverflow.com/q/12545134
has title: JavaEE Singleton on Tomcat server
score: 0
has answer: http://stackoverflow.com/a/26546667
has comment: http://stackoverflow.com/comment/41716146
type: Question

data-structures
tags question: http://stackoverflow.com/q/26573118
tag name: data-structures
tags question: http://stackoverflow.com/q/26552679
tags question: http://stackoverflow.com/q/26567262
tags question: http://stackoverflow.com/q/26573683
tags question: http://stackoverflow.com/q/26646719
tags question: http://stackoverflow.com/q/26660257
tags question: http://stackoverflow.com/q/26661559
tags question: http://stackoverflow.com/q/26623129
tags question: http://stackoverflow.com/q/26616754
tags question: http://stackoverflow.com/q/26525351
tags question: http://stackoverflow.com/q/26528499
type: Tag
tags question: http://stackoverflow.com/q/26647464

http://stackoverflow.com/a/26593905
score: 1
answers question: http://stackoverflow.com/q/26593794
accepted answer of: http://stackoverflow.com/q/26593794
upvote count: 1
type: AcceptedAnswer
has body: This is about downloading, not uploading. 4.+ will resolve to the latest 4.x version. Not sure I understand your other question about compatibility (you'd have to explain in more detail).
type: Answer
downvote count: 0

http://stackoverflow.com/q/26611999
has comment: http://stackoverflow.com/comment/41861751
linked to: http://stackoverflow.com/q/23512344
has answer: http://stackoverflow.com/a/26613707
accepted answer: http://stackoverflow.com/a/26613707
tagged with: android
possible better answer: http://stackoverflow.com/a/26614421
type: AnsweredQuestion
tagged with: java
type: Question
has title: Get selected checkbox in listview
has body: I'm trying to get the selected checkbox in a listview. I've been searching in the web, but I always found examples using the "Holder", but I'm not using it. I asked my teacher too, but also didn't know why isn't this working. public class MyActivity extends Activity { String s; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); ListView list=(ListView)findViewById(R.id.listView); Button checkBtn=(Button)findViewById(R.id.button); final ArrayList&lt;SportItem&gt; sportArray=new ArrayList&lt;SportItem&gt;(); SportItem sp; sp=new SportItem(getResources().getDrawable(R.drawable.baloncesto),"Basketball",false); sportArray.add(sp); sp=new SportItem(getResources().getDrawable(R.drawable.futbol),"Football",false); sportArray.add(sp); sp=new SportItem(getResources().getDrawable(R.drawable.judo),"Judo",false); sportArray.add(sp); sp=new SportItem(getResources().getDrawable(R.drawable.atletismo),"Athletism",false); sportArray.add(sp); sp=new SportItem(getResources().getDrawable(R.drawable.tenis),"Tennis",false); sportArray.add(sp); SportAdapter spadapter=new SportAdapter(this, sportArray); list.setAdapter(spadapter); checkBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { s=""; for (SportItem ar:sportArray){ if(ar.isCheck()){ s+=ar.getName()+", "; } } Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show(); } }); } } public class SportAdapter extends BaseAdapter { protected Activity activity; protected ArrayList&lt;SportItem&gt; items; CheckBox chk; SportItem sp; public SportAdapter(Activity activity, ArrayList&lt;SportItem&gt; items) { this.activity = activity; this.items = items; } @Override public int getCount(){ return items.size(); } @Override public Object getItem(int i) { return items.get(i); } @Override public long getItemId(int i) { return items.get(i).getId(); } @Override public View getView(int i, View view, ViewGroup viewGr…
tagged with: listview
has answer: http://stackoverflow.com/a/26614421
has comment: http://stackoverflow.com/comment/41835843
score: 0
answer count: 2

http://stackoverflow.com/q/26614467
tagged with: java
has comment: http://stackoverflow.com/comment/82112754
type: Question
tagged with: jasper-reports
score: 2
downvote count: 0
favorite count: 0
tagged with: javac
type: UnansweredQuestion
tagged with: netbeans
answer count: 0
has title: How to define the JavaC version used by JasperReports to match Netbeans
upvote count: 2
tagged with: build.xml
has body: I've done a lot of searching and I can't find an answer. I'm working on a large Netbeans project that is set to compile JasperReports at the same time that it compiles the project. The problem is we want to set JasperReports to compile with the same version of JavaC selected in Netbeans instead of the JavaC version that is on the OS path. I think it can be solved by modifying build.xml. Here is what I believe is the relevant section of the file. <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpath="${javac.classpath}"/> <mkdir dir="${build.classes.dir}/...proj/reports"/> <include name="**/*.jrxml"/> <classpath path="${run.classpath}"/> <include name="**/*.jrtx"/> Testing that javac is on the path. <arg value="-version"/> I truncated a couple file paths to be "...proj".

http://stackoverflow.com/a/31684358
answers question: http://stackoverflow.com/q/26573456
has body: It seems like Gradle is taking too long time to execute for your computer. Wait for the Gradle to finish building the project.
score: 0
type: Answer

web-services
type: Tag
tags question: http://stackoverflow.com/q/26671478
tags question: http://stackoverflow.com/q/26634446
tags question: http://stackoverflow.com/q/26564464
tags question: http://stackoverflow.com/q/26571510
tags question: http://stackoverflow.com/q/26634458
tags question: http://stackoverflow.com/q/26624183
tags question: http://stackoverflow.com/q/26532124
tags question: http://stackoverflow.com/q/26637485
tags question: http://stackoverflow.com/q/26643360
tags question: http://stackoverflow.com/q/26623339
tags question: http://stackoverflow.com/q/26612551
tags question: http://stackoverflow.com/q/26654634
tags question: http://stackoverflow.com/q/26577054
tags question: http://stackoverflow.com/q/26641848
tags question: http://stackoverflow.com/q/26607603
tags question: http://stackoverflow.com/q/26653666
tags question: http://stackoverflow.com/q/26664544
tags question: http://stackoverflow.com/q/26527602
tags question: http://stackoverflow.com/q/26664487
tags question: http://stackoverflow.com/q/26566949
tags question: http://stackoverflow.com/q/26590946
tags question: http://stackoverflow.com/q/26659668
tags question: http://stackoverflow.com/q/26670304
tags question: http://stackoverflow.com/q/26517658
tag name: web-services
tags question: http://stackoverflow.com/q/26607303
tags question: http://stackoverflow.com/q/26588310
tags question: http://stackoverflow.com/q/26592787
tags question: http://stackoverflow.com/q/26520187
tags question: http://stackoverflow.com/q/26579409
tags question: http://stackoverflow.com/q/26653698
tags question: http://stackoverflow.com/q/26582482
tags question: http://stackoverflow.com/q/26620609
tags question: http://stackoverflow.com/q/26547870
tags question: http://stackoverflow.com/q/26659858
tags question: http://stackoverflow.com/q/26561771
tags question: http://stackoverflow.com/q/26585745

http://stackoverflow.com/comment/41783464
has text: That's all wonderfully generic and correct but on it's own it still wont get him a Plugin. Take him the rest of the way.
comment on: http://stackoverflow.com/a/26583813
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41667350
type: Comment
comment on: http://stackoverflow.com/a/26518274
score: 0
type: AnswerComment
has text: You've passed references of objects via methods to other classes?

http://stackoverflow.com/q/26622294
has comment: http://stackoverflow.com/comment/41855961
tagged with: arrays
has body: Hey I'm trying to write a method that compares two arrays and returns the number of values they have in common. For example, if there are two arrays: arr{0,4,2,5} arr1{0,7,4,4} Then the method would return 2. This is what I have so far: public int numDigitsCorrect(Permutation other) { int c=0; for(int i=0; i&lt;nums.length; i++) { for(int x=0; x&lt;nums.length;x++) { if(nums[i]==other.nums[x]) { System.out.println(nums[i] + " " + other.nums[x] + " "); c++; } } } return c; }
has comment: http://stackoverflow.com/comment/41855062
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41855760
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26623969
has title: Finding matching numbers in two arrays
has comment: http://stackoverflow.com/comment/41856173
tagged with: oop
has comment: http://stackoverflow.com/comment/41855288
tagged with: java
has comment: http://stackoverflow.com/comment/41855703
has comment: http://stackoverflow.com/comment/41854945
type: Question
has answer: http://stackoverflow.com/a/26622855

http://stackoverflow.com/q/26583324
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41783961
tagged with: hql
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/41782838
tagged with: jpql
score: 0
has comment: http://stackoverflow.com/comment/41783799
tagged with: sql
has comment: http://stackoverflow.com/comment/41784209
has body: I got some problems with my JPA mapping. I wrote that query: String str = " SELECT alrt.* FROM REACTION.ALERT alrt, REACTION.INVESTIGATION inv, REACTION.CLASSIFICATION_TYPE clst, REACTION.FRAUD_TYPE frt, REACTION.TRANS trns, REACTION.CARD crd WHERE alrt.ISS_INST IN(1111) AND alrt.MODULE_TYPE = 1 AND 0 &lt; (SELECT COUNT(*) FROM REACTION.INVESTIGATION WHERE REACTION.INVESTIGATION.ALERT_ID = alrt.ID) AND inv.CLASSIFICATION_TYPE_ID IS NOT NULL AND clst.CLASSIFICATION_TYPE = 2 AND alrt.REMINDER_USER_LOGIN = 'a' OR alrt.REMINDER_USER_LOGIN IS NULL AND alrt.ID = inv.ALERT_ID AND alrt.TRANSACTION_ID = trns.ID(+) AND inv.CLASSIFICATION_TYPE_ID = clst.ID AND inv.FRAUD_TYPE_ID = frt.ID(+) AND trns.HPAN = crd.HPAN(+)" Query query = entityManager.createNativeQuery(str, Alert.class); so i recieved List entities as result. All looks well, but only field "transaction" in Alerts entity is null(alert.getTransaction() returned null), but in my db its has value-"61". This is how transaction value presents im my Alerts class: Table(name = "ALERT", schema = "REACTION") @Entity(name = "Alert") public class Alert extends AbstractBaseEntity { private static final long serialVersionUID = 9007994864788693025L; @Digits(fraction = 0, integer = 15) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ALERT_SEQ") @SequenceGenerator(name = "ALERT_SEQ", sequenceName = "ALERT_SEQ", initialValue = 1, allocationSize = 100) private Long id; @OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @JoinColumn(name = "TRANSACTION_ID") private Transaction transaction; .... This is id field from Transaction entity: @Entity(name = "Transaction") @Table(name = "TRANS", schema = "REACTION") public class Transaction extends AbstractTransaction { private static final long serialVersionUID = 1110243741971153313L; @Digits(fraction = 0, integer = 15) @Id @SequenceGenerator(name = "TRANS_SEQ", sequenceName = "TRANS_SEQ", allocationSize = 1000) @GeneratedValue(strategy = GenerationType.SEQ…
has title: JPQL join entity field value IS NULL

http://stackoverflow.com/comment/41722132
has text: @Ivan look, at my answer. The definition is the line where you define your fields. In your case it is for example: `EditText inputFullName`
score: 0
comment on: http://stackoverflow.com/q/26549602
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41737893
type: QuestionComment
type: Comment
has text: So to make this more general, you are asking if you can use a stack variable in an Anonymous class?
comment on: http://stackoverflow.com/q/26558465
score: 0

maven-nbm
type: Tag
tags question: http://stackoverflow.com/q/26541413
tag name: maven-nbm

http://stackoverflow.com/comment/41668742
type: AnswerComment
score: 0
type: Comment
has text: I had just fixed it before reading this, thank you for the help though! it was a really quick fix!
comment on: http://stackoverflow.com/a/26519710

http://stackoverflow.com/comment/41806813
has text: That is actually... very much what I needed. I will definitely be using the javadocs along with your code as a reference at a later date. Here's a question I have though: While this tells you if it compiles fine, is there a way to run it if it compiles correctly? Like, this can help me determine if it compiles correctly, and if it does, then can I run it and is there a list of variables that the compiler stores, and are there references to the values inside of these references that I can use?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26595263
type: AnswerComment

http://stackoverflow.com/a/26662297
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41930454
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26618618
answers question: http://stackoverflow.com/q/26618618
has body: Merely adding <dependency> entries to the pom.xml in an otherwise-empty plugin should not generally cause OSGi errors on plugin load, since Confluence should not be trying to import external packages merely based on the presence of a dependency. My suspicion (confirmed in the chat thread) is that one of your dependencies is including some sort of Spring instructions that is confusing Confluence on plugin load. When a plugin is built using the defaults, the plugin SDK will automatically un-JAR all of the dependencies and include the resulting set of files in the main plugin JAR. If one of your library dependencies inadvertently included Spring-related data in META-INF/spring or elsewhere, this would get intermingled with your own plugin's Spring configuration, which can wreak havoc. The best way to solve this is to disable dependency extraction. This means that instead of un-JARring all of your dependencies and dumping them in the same JAR as your plugin, the dependencies are left in their source JARs and those JARs are included directly in META-INF/lib. Even if the dependencies do declare some rogue Spring instructions, they will remain in their own JAR and they will not be processed by Confluence when loading your plugin. To disable the extraction of dependencies, you will want to set extractDependencies to false in the confluence-maven-plugin section of your pom.xml, as shown below: com.atlassian.maven.plugins maven-conflue‌​‌​nce-plugin x.y.z [...] [...] false
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/41985279
has text: *"I still need to understand how applets work."* No you don't. Really.. See [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/) for the views of the top applet answerer on SO (me).
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26662580

http://stackoverflow.com/q/26539194
has answer: http://stackoverflow.com/a/26541192
has comment: http://stackoverflow.com/comment/41720581
upvote count: 0
answer count: 1
has title: Selenium Webdriver automation for random text
favorite count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 2
tagged with: selenium
type: Question
score: -2
has body: I'm fairly new to Selenium Webdriver and am trying to automate the following scenario: User is prompted to enter the answer to a security question. Say the answer is "ANSWER". The screen will display _ X _ X _ _ where X is the letter you have to enter and the rest of the letters are masked. In this case, User has to click N and W on a keyboard simulator on the screen then continue to answer correctly. The difficult part is that the X will be randomly generated each time this screen is accessed. Any ideas please?

http://stackoverflow.com/q/26663766
has answer: http://stackoverflow.com/a/37073861
favorite count: 0
tagged with: character
tagged with: infinite
upvote count: 1
has body: So I know how the basics of streams work. Basically I can implement it in java like this inputStream = new FileReader("infinite.txt"); // or socket, whatever int c; while ((c = inputStream.read()) != -1) { //something here } But this is more of a theory question, and less of a coding question. What is the interviewer looking for when he asks this question? I mean I can use an ArrayList and just use .append each time a string comes in and then run a function to sort it.... each time after I append since you cant say that the ever ends so if you do it after everything is in the ArrayList. I'm looking for clever solutions, this is a practice interview question. Hashtables, Trees? Edit: Keeping in mind Hashtable/Tree usually has a better runtime then a sort on a regular array Thanks a ton!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41929734
has comment: http://stackoverflow.com/comment/41929740
tagged with: java
possible better answer: http://stackoverflow.com/a/37073861
accepted answer: http://stackoverflow.com/a/26663850
tagged with: stream
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/37534912
has answer: http://stackoverflow.com/a/26663850
has title: Practicing for an interview, Sorting infinite character stream
score: 0
answer count: 3

http://stackoverflow.com/q/26671319
score: 1
favorite count: 0
type: Question
tagged with: jframe
has body: When I run my JFrame it shows me in hidden size. I have to resize to see JFrame. Why I cannot get fully sized JFrame. I used: Pack(); setVisible(true); but it doesn't work. Here is my code: public class Mytest extends JFrame{ JLabel label=new JLabel(); JLabel label2=new JLabel(); Timer myTimer; /** * @param args the command line arguments */ public static void main(String[] args) { new Mytest().show(); } public Mytest(){ getContentPane().setLayout(new GridBagLayout()); setTitle("test"); GridBagConstraints gridCon=new GridBagConstraints(); gridCon.gridx=0; gridCon.gridy=0; getContentPane().add(label,gridCon); gridCon.gridx=0; gridCon.gridy=1; getContentPane().add(label2,gridCon); myTimer = new Timer(1000,new ActionListener(){ public void actionPerformed(ActionEvent e){ myTimerActionPerformed(e); } }); pack(); myTimer.start(); setLocationRelativeTo(null); } private void myTimerActionPerformed(ActionEvent e){ Date today=new Date(); label.setText(DateFormat.getDateInstance(DateFormat.FULL).format(today)); label2.setText(DateFormat.getTimeInstance().format(today)); } }
has answer: http://stackoverflow.com/a/26671373
tagged with: netbeans
tagged with: java
answer count: 2
upvote count: 1
tagged with: swing
has title: Show the hidden JFrame
accepted answer: http://stackoverflow.com/a/26671373
possible better answer: http://stackoverflow.com/a/26672007
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26672007
downvote count: 0

http://stackoverflow.com/comment/41733178
type: QuestionComment
comment on: http://stackoverflow.com/q/26539546
has text: @cygnus In a code review I'd reject _every_ line of that code. Ok, maybe not the println.
score: 0
type: Comment

http://stackoverflow.com/a/26611777
answers question: http://stackoverflow.com/q/26611188
score: 0
has body: If the URL with the request parameters comes from a page on which you have no control (or if it is a link) you can do the following : use a servlet on that URL if it finds request parameters in the query strings, it gets them and store them in session, then redirects to itself with no query string if there is no query string, get the parameter from session, remove them from the session to avoid to reuse them by mistake and process the query If the parameters exists in query string, because of a form using GET method, simply change the method to POST to pass the parameters in the request body instead of the query string.
type: Answer

http://stackoverflow.com/comment/41910358
comment on: http://stackoverflow.com/q/26652800
has text: Well the POM exists. Can you reach the following URL from that machine: http://repo.spring.io/libs-release/org/springframework/boot/spring-boot-starter-parent/1.1.8.RELEASE/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26606943
has body: guys i am working on web application in jsp and servlets and oracle SQL developer .. in myjsp.jsp i have a list List&lt;String&gt; sexList = (List&lt;String&gt;)request.getAttribute("sexList"); %&gt; and put it in cumbo box in JSTL tag like this &lt;select name="sex"&gt; &lt;c:forEach items="${sexList}" var="sex"&gt; &lt;option value="${sex}"&gt;${sex}&lt;/option&gt; &lt;/c:forEach&gt; &lt;/select&gt; and i wrote a query like &lt;sql:query dataSource="${dbcon}" var="result"&gt; select firstname,lastname from members where sex = ? &lt;sql:param value="${sex}"&gt;&lt;/sql:param&gt; and the sex in my database is number(0,1) .. so any help to avoid the error ??
has comment: http://stackoverflow.com/comment/41826241
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/41826304
answer count: 0
has comment: http://stackoverflow.com/comment/41826203
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41826282
has title: : ORA-01722: invalid number error in JSTL query
has comment: http://stackoverflow.com/comment/41826384
type: Question
has comment: http://stackoverflow.com/comment/41826152
tagged with: servlets
has comment: http://stackoverflow.com/comment/41826337
tagged with: jstl
tagged with: jsp

http://stackoverflow.com/a/26664042
has comment: http://stackoverflow.com/comment/41934033
score: 0
has comment: http://stackoverflow.com/comment/41967603
has comment: http://stackoverflow.com/comment/41966103
has comment: http://stackoverflow.com/comment/41932983
has body: The line: for(double x = 0; x &lt;= 1; x += (1 / 150)) iterates starting from 0.0, ending at 1.0, and adding 0.0 to x after every iteration. To increment x by 1 / 150, you have to change 1 / 150 to a double value 1.0 / 150 So the for loop is changed into for(double x = 0; x &lt;= 1; x += (1.0 / 150)) Iterating doubles, however, is very bad practice because of how floating-point numbers may behave. For example the following code: double var = 1.7; var -= 0.1; System.out.println(var); may print something like 1.6000007. Read more about this in another post here. You should find an alternative way of calculating your... calculations. The bottom line is; always iterate non-floating-point numbers.
type: Answer
answers question: http://stackoverflow.com/q/26663789
has comment: http://stackoverflow.com/comment/41966059

http://stackoverflow.com/q/26575541
has answer: http://stackoverflow.com/a/26809396
score: 0
possible better answer: http://stackoverflow.com/a/26582867
tagged with: file-upload
has comment: http://stackoverflow.com/comment/41771612
tagged with: rest
has comment: http://stackoverflow.com/comment/41772800
accepted answer: http://stackoverflow.com/a/26809396
has comment: http://stackoverflow.com/comment/41772706
tagged with: jersey-client
linked to: http://stackoverflow.com/q/2015463
type: AnsweredQuestion
has body: Just before starting to explain you my problem, I would like to share with you the libraries' versions that I use and the server: javax.ws.rs-api: 2.0.1 jersey-container-servlet: 2.13 jersey-media-multipart: 2.13 jackson: 2.4.3 I also use Apache Tomcat Server version 7.0.55. So I coded that below: /** * On the client side. */ public void uploadAFile() { Client client = ClientBuilder.newBuilder() .register(MultiPartFeature.class) .build(); WebTarget target = null; try { target = client .target("https://blo-bla.rhcloud.com/rest") .path("v1").path("upload"); } catch (IllegalArgumentException | NullPointerException e) { LOG_TO_CONSOLE.fatal(e, e); LOG_TO_FILE.fatal(e, e); } Builder builder = target.request(MediaType.TEXT_PLAIN); builder.header("Authorization", getValidBasicAuthenticationStrEncrypted()); FormDataMultiPart form = new FormDataMultiPart(); form.field("anotherParam", "Bozo"); String fileName = "/Users/drizzy/Documents/Divx/CaseDepartFolder/sample.avi"; File file = new File(fileName); form.bodyPart(new FileDataBodyPart("file", file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); Response response = builder.post(Entity.entity(form, MediaType.MULTIPART_FORM_DATA_TYPE)); LOG_TO_CONSOLE.debug(response.getStatus()); LOG_TO_CONSOLE.debug(response.readEntity(String.class)); } /** * On the server side. */ @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.TEXT_PLAIN) public String uploadFile(@FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDisposition, @FormDataParam("anotherParam") String str) throws FileNotFoundException, IOException { System.out.println("str: " + str); final String basePath = "/Users/drizzy/eclipse-workspace/tomcat7jbossews" + "/src/main/resources/uploads/"; final String fileName = fileDisposition.getFileName(); System.out.println(new StringBuilder().append("***** fileName ") .append(fileName) .toString()); final String filePath = new StringBuilder().append(baseP…
tagged with: java
has comment: http://stackoverflow.com/comment/41769171
linked to: http://stackoverflow.com/q/7615645
type: Question
has comment: http://stackoverflow.com/comment/41773120
answer count: 2
tagged with: jersey
has title: How to upload a file of 750MB in JAVA, using jersey-client V2.13 (from a client to a server)?
has comment: http://stackoverflow.com/comment/41772436
has answer: http://stackoverflow.com/a/26582867

http://stackoverflow.com/a/26601424
has comment: http://stackoverflow.com/comment/41817931
downvote count: 0
has body: You can simply keep a flag in the database. when the button is clicked it will be set as a false and when operation finishes set it back to true. So the other user's access gets restricted.
has comment: http://stackoverflow.com/comment/41817028
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26601372
score: 1

http://stackoverflow.com/a/58061590
has comment: http://stackoverflow.com/comment/136222232
has comment: http://stackoverflow.com/comment/108565427
has body: @EnableWebSecurity @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requiresChannel().anyRequest().requiresSecure(); } } If your application is behind a load balancer or reverse proxy server you will need to add the following to your application.properties file: server.forward-headers-strategy=NATIVE This will prevent an redirect loop. If you are using Tomcat you can configure the names of the forward headers in your application.properties file: server.tomcat.remote_ip_header=x-forwarded-for server.tomcat.protocol_header=x-forwarded-proto See the Spring Boot Documentation for more information.
answers question: http://stackoverflow.com/q/26655875
has comment: http://stackoverflow.com/comment/122087918
downvote count: 0
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/comment/41947245
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26665670
type: Comment
has text: Thanks for the suggestion - I gave it a go and am now getting a different exception - java.security.spec.InvalidKeySpecException: key spec not recognised. It happens at the same spot - on the ssh.connect() call. I've updated the question above with the details.

http://stackoverflow.com/q/26622387
has comment: http://stackoverflow.com/comment/41855111
has comment: http://stackoverflow.com/comment/41855289
score: 0
has comment: http://stackoverflow.com/comment/41856376
type: UnansweredQuestion
has title: Why doesn't Eclipse recognize my Eclipse projects?
answer count: 0
tagged with: java
has body: I tried to rename my top level folder which contains multiple java projects. I also wanted to create a new workspace to point everything to the right location. My current workspace has all the right projects in it, but when I go to import the copied projects into my new workspace, they don't show up. I checked each projects .classpath and .project files and they seem to be the same. I thought as long as they have a .classpath and .project eclipse should recognize them and be able to import them but they don't show up. I looked in the workspace files but don't see anything there that seems of value. What other files do my projects need to be picked up by Eclipse? I'm not even sure how I got them into my current workspace to begin with.
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41872001
type: QuestionComment
comment on: http://stackoverflow.com/q/26631555
has text: @zapl Thanks a lot for your feedback, how would I go about adding the get methods to my code so far? I have had a lot of issues with adding them without mistakes :( I am unsure how to do this
score: 0
type: Comment

http://stackoverflow.com/comment/41782391
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26551751
has text: My LoginBean is previously initialized from a dedicated page
score: 0

http://stackoverflow.com/a/26560244
answers question: http://stackoverflow.com/q/26558373
type: Answer
has body: Websocket OnClose method invokes when session closes, you dont need close session. You want close closed session. This error shows that session already closed. You can see it from here: http://docs.oracle.com/javaee/7/api/javax/websocket/Session.html Once the session is closed, it is no longer valid for use by applications. Calling any of its methods (with the exception of the close() methods) once the session has been closed will result in an IllegalStateException being thrown. Developers should retrieve any information from the session during the Endpoint.onClose(javax.websocket.Session, javax.websocket.CloseReason) method. Following the convention of Closeable calling the Session close() methods after the Session has been closed has no effect.
has comment: http://stackoverflow.com/comment/41751177
has comment: http://stackoverflow.com/comment/114844620
has comment: http://stackoverflow.com/comment/41741221
score: 0
has comment: http://stackoverflow.com/comment/41742027

http://stackoverflow.com/comment/41837745
type: Comment
has text: Nevermind, I got my solution. Check my ans. And tnQ so much for sticking with me for this long. If you've fb please send me a request here: [My FB Profile](https://www.facebook.com/shihank1) or Skype id: sinoscuras
comment on: http://stackoverflow.com/a/26574061
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43151587
score: 0
has text: I've run into the same issue for Intellij IDEA. Hmm, no wonder, as it's based on the same code as Android Studio.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26603621

http://stackoverflow.com/comment/41888561
type: Comment
type: QuestionComment
score: 2
has text: Your biggest mistake right now is that you're trying to run non-compilable code -- never do this! Instead find out what problems the compiler tells you about, not the JVM, and then try to fix them. Only try to run your code after it compiles without error.
comment on: http://stackoverflow.com/q/26640806

http://stackoverflow.com/q/26663105
tagged with: apache-commons-math
downvote count: 1
type: Question
tagged with: blas
has comment: http://stackoverflow.com/comment/41928894
tagged with: optimization
score: 0
has answer: http://stackoverflow.com/a/26663706
has comment: http://stackoverflow.com/comment/41928237
answer count: 1
has comment: http://stackoverflow.com/comment/41929242
favorite count: 0
has title: RealMatrix multiply without reassign
type: UnansweredQuestion
has body: in my Java source i must execute following lines very often: vecX = EigenMat.multiply(vecX); vecY = EigenMat.multiply(vecY); EigenMat is a N x N Matrix with N~40 vecX/vecY is a N x 1 vector (intern a RealMatrix to) I used the "Sampler" from VisualFM to find some hotspots in my code and org.apache.commons.math3.linear.Array2DRowRealMatrix.&lt;init&gt;() org.apache.commons.math3.linear.Array2DRowRealMatrix.multiply() have a very high runtime. I'm not a java professional but i think every multiplication a new vector is created. Can i reassign the old one? Maybe i should switch to JBLAS to speed it up? Matyro Edit: Single core only
linked to: http://stackoverflow.com/q/2064427
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26627366
tagged with: regex
upvote count: 2
has title: String pattern not matched in Java
accepted answer: http://stackoverflow.com/a/26627403
type: Question
type: AnsweredQuestion
has body: I want to validate this NIC number in Android Java. NICs=NIC.getText().toString(); if((nameS.equals("")||NICs.equals(""))||!(NICs.matches("/^[0-9]{9}[vVxX]$/"))) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( this); // set title alertDialogBuilder.setTitle("Warning!"); // set dialog message alertDialogBuilder .setMessage("Please fill the above feilds !") .setCancelable(false) .setNegativeButton("OK",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { // if this button is clicked, just close // the dialog box and do nothing dialog.cancel(); } }); My NIC="896201328V" But it says NIC mismatches with the pattern given.
tagged with: java
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26627403

http://stackoverflow.com/q/26665782
tagged with: java
has comment: http://stackoverflow.com/comment/41933515
type: Question
answer count: 2
has body: I have written multiple attempts to this problem, but I think this is the closest I could get. This solution makes the method recurse infinitely, because I don't have a base case, and I can't figure it out. The counter++ line is unreachable, and I can't get this to work, and I am very tired. This would be very easy with a loop, but recursion is kind of a new concept to me, and I would be thankful if someone helped me solve this. public static double pi(int a, double b){ int counter=0; if (counter %2==0){ return a-(a/(pi(a,b+2))); counter++; } else { return a+(a/(pi(a,b+2))); counter++; }
score: 0
has title: Find the value of pi from the infinite series (pi=4-4/3+4/5-4/7+4/9-4/11…. ) using recursion in java
has answer: http://stackoverflow.com/a/26665838
has answer: http://stackoverflow.com/a/26666283
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41933914
tagged with: recursion

http://stackoverflow.com/q/26670288
has answer: http://stackoverflow.com/a/26670540
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41941159
tagged with: split
answer count: 2
has body: I have a problem with task. My job is grab a String from a file (in source file are numbers in one line, divided by spaces) split that string by spaces then parse each String to an int and finally use bubbleSort on them. I'm stucked on parsing, don't get any idea how to do it. Code atm looks sth like this: public class Main { public static void main(String[] args) throws IOException { String numbers = new String(Files.readAllBytes(Paths.get("C:\\README.txt"))); String s[] = numbers.split(" "); for (String element : s) { System.out.println(element); } } } I tried to use a scanner to read string numbers, then loop it for parseInt, but doesn't work for me.
has title: Multitask: parse space-separated integers from a string
tagged with: int
score: 0
has answer: http://stackoverflow.com/a/26670907
tagged with: string
tagged with: parsing
type: UnansweredQuestion

http://stackoverflow.com/q/26605671
has body: For more detailed information regarding the motivation behind this goal (and my efforts to solve it) view my previous question. I decided to ask this as a new question entirely as I thought that it had evolved sufficiently to merit doing so. As a summary, I intend to use JDOM in combination with NIO in order to: Gain an exclusive file lock on an xml file. Read the file into a Document object. Make arbitrary changes (with lock still active!). Write the changes back to the xml file. Release the file lock. The issue which I am getting however is that the built-in code to read the xml file into a document object closes the channel (and therefore releases the lock), as seen below: import java.io.*; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import javax.xml.parsers.*; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Test4{ String path = "Test 2.xml"; private DocumentBuilderFactory dbFactory; private DocumentBuilder dBuilder; private Document doc; public Test4(){ try (final FileChannel channel = new RandomAccessFile(new File(path), "rw").getChannel()) { dbFactory = DocumentBuilderFactory.newInstance(); dBuilder = dbFactory.newDocumentBuilder(); System.out.println(channel.isOpen()); doc = dBuilder.parse(Channels.newInputStream(channel)); System.out.println(channel.isOpen()); channel.close(); } catch (IOException | ParserConfigurationException | SAXException e) { e.printStackTrace(); } } public static void main(String[] args){ new Test4(); } } Output: true false Having looked through the documentation and trawled the built in Java libraries, I am really struggling to even find where the channel is closed, let alone how to prevent it closing. Any pointers would be great! Thanks.
favorite count: 0
tagged with: io
tagged with: channel
has comment: http://stackoverflow.com/comment/41826023
possible better answer: http://stackoverflow.com/a/26605795
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26606305
accepted answer: http://stackoverflow.com/a/26606305
has title: Prevent file channel from closing after reading xml file
upvote count: 1
linked to: http://stackoverflow.com/q/26587631
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26605795
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41825750
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/41668262
type: Comment
comment on: http://stackoverflow.com/a/26519342
type: AnswerComment
has text: I just think that the feature you're trying to use is part of JSTL. I googled the uri, probably old. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> is probably right. JSTL has a dependency as well.
score: 0

http://stackoverflow.com/a/26656117
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41918269
type: Answer
answers question: http://stackoverflow.com/q/26655567
accepted answer of: http://stackoverflow.com/q/26655567
has body: Copy the times in the Stint constructor. public class Stint { private Integer[] start; public Stint(Driver driver, Integer[] start) { this.start = Arrays.copyOf[start, start.length]; // ... } }
score: 0

http://stackoverflow.com/comment/41718479
score: 0
comment on: http://stackoverflow.com/q/26547617
type: QuestionComment
type: Comment
has text: Does it work? If you are asking for how to improve working code, this question should be moved to codereview.stackexchange.com. stackoverflow is for debugging help.

http://stackoverflow.com/comment/41747444
type: Comment
comment on: http://stackoverflow.com/a/26559570
has text: I tried converting my project from a java project to a maven project but I still get the java.lang.NoClassDefFoundError: org/yaml/snakeyaml/Yaml
type: AnswerComment
score: 0

http://stackoverflow.com/a/26569945
upvote count: 3
answers question: http://stackoverflow.com/q/26569921
has body: boolean fileExists = new File("file.xml").exists(); Tests whether the file or directory denoted by this abstract pathname exists. Returns: true if and only if the file or directory denoted by this abstract pathname exists; false otherwise. Always check the javadocs first!
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/26545165
score: 2
has body: I think you want more something like: public void riders() { abilities(); for (int i = 0; i &lt; cyclists.size(); i++){ System.out.print(cyclists.get(i).getName()); } } Another thing, is that I'm not sure you want List&lt;Cyclist&gt; cyclists = new ArrayList&lt;&gt;(); to be part of Cyclist class.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26545049
has comment: http://stackoverflow.com/comment/41713841
answers question: http://stackoverflow.com/q/26545049
type: Answer

http://stackoverflow.com/comment/41944718
type: QuestionComment
has text: @markspace ... Thanks, yes I was going to do that at first. I just thought it would be good if we could find a method to wrap thing in a _type-safe_ way. Strings don't have type, _per se_. I doubt this is something that will 'work as intended' in Java.
comment on: http://stackoverflow.com/q/26668135
score: 0
type: Comment

http://stackoverflow.com/comment/47373729
has text: @Kufuma Sadly no, even put a bounty of 50 on it, but it got ignored :(
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26513792
type: Comment

apache-poi
tags question: http://stackoverflow.com/q/26546180
tags question: http://stackoverflow.com/q/26649705
tags question: http://stackoverflow.com/q/26652722
type: Tag
tags question: http://stackoverflow.com/q/26590375
tag name: apache-poi
tags question: http://stackoverflow.com/q/26649598
tags question: http://stackoverflow.com/q/26530012
tags question: http://stackoverflow.com/q/26655741
tags question: http://stackoverflow.com/q/26625316

http://stackoverflow.com/a/26602912
has body: What is mean by PC to Mobile. PC &amp; mobile both are hardware devices to access the mail.Please follow the below link for sending mail in java using java mail API via gmail SMTP. http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
type: Answer
answers question: http://stackoverflow.com/q/26602032
score: 0

http://stackoverflow.com/comment/41844101
type: Comment
has text: Beware of trying to learn cryptography by studying source code. Not all source code is cryptographically secure, and there are a lot of examples of bad code, even on SO. Some theoretical knowledge is required.
score: 1
comment on: http://stackoverflow.com/q/26615898
type: QuestionComment

http://stackoverflow.com/q/26651408
has answer: http://stackoverflow.com/a/26651559
accepted answer: http://stackoverflow.com/a/26651559
favorite count: 0
has body: I am searching for the main difference between SAX and Pull Parser . I know the SAX parser is good for handling the large XML file as it does not store the XML and traverse in only one direction. as compared to DOM. But I am unable to find the major difference between SAX and PULL. Please suggest me any link
possible better answer: http://stackoverflow.com/a/39200214
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39200214
downvote count: 0
tagged with: xmlpullparser
tagged with: garbage-collection
score: 13
type: Question
has title: What is the difference between XML Pull Parser and SAX Parser
has comment: http://stackoverflow.com/comment/41906985
tagged with: java
upvote count: 13
has comment: http://stackoverflow.com/comment/41909884
answer count: 2
tagged with: saxparser

http://stackoverflow.com/q/26660447
tagged with: java
tagged with: swt
tagged with: selected
tagged with: menuitem
type: Question
has comment: http://stackoverflow.com/comment/41980059
has body: How can I distinguish right-click from left-click on popup menu in swt? By adding a SelectionListener I can act on both left and right-click, but how do I know which one was used? Is it possible to have a MouseListener on a MenuItem? What I want to do is similar to a browser-favorites menu, left-click to select and right-click for a favorite context menu. Button bn = new Button(shell, SWT.FLAT); bn.setText("Right Click to see the popup menu"); Menu popupMenu = new Menu(bn); MenuItem newItem = new MenuItem(popupMenu, SWT.CASCADE); newItem.setText("New"); newItem.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { System.out.print("SELECTED1\n" ); } public void widgetDefaultSelected(SelectionEvent e) { System.out.print("SELECTED2\n" ); } }); To clarify: Sorry, did not manage to include a screen shot, but I think you can see what I mean if you follow this description. Select the Favorites menu in Windows Explorer (or probably any other browser) If you left-click on one of your favorites the browser will open this URL, but you may also Right-click on this favorite. Right-click will bring up a context menu valid for the selected favorite. I also need two different actions for the same MenuItem (actually for the same purpose as the browser).
has comment: http://stackoverflow.com/comment/41965114
tagged with: right-click
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41966597
score: 2
has answer: http://stackoverflow.com/a/26660724
upvote count: 2
has comment: http://stackoverflow.com/comment/41955188
has title: Java, swt, How to distinguish right-click from left-click on popup menu

cd
tag name: cd
tags question: http://stackoverflow.com/q/26631456
type: Tag

http://stackoverflow.com/comment/41702461
type: Comment
has text: It's merely an empty statement following the while block. The author probably typed it in out of habit and since it's not a syntax error, it was just left there.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26538433

http://stackoverflow.com/comment/41662125
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26515987
has text: Can you share your pom as well.
score: 0

http://stackoverflow.com/comment/44428313
type: AnswerComment
comment on: http://stackoverflow.com/a/28020916
score: 0
type: Comment
has text: In the repository you could add a method, specifying the exact SQL query with `@Query("SELECT ....")` annotation. So you'll have a custom query!

http://stackoverflow.com/comment/44752346
type: AnswerComment
comment on: http://stackoverflow.com/a/26526915
score: 0
type: Comment
has text: Not less than you, obviously, and I have a lot of free time when Im attending meetings :) Go learn now, or better yet delete all those bad answers of yours, and then go study.

http://stackoverflow.com/q/26590669
has title: Spring Security does not throw any exceptions
has body: My spring security config: <security:http auto-config="true" use-expressions="true" > <security:intercept-url pattern="/game/**" access="isAuthenticated()"/> <security:intercept-url pattern="/**" access="permitAll"/> <security:form-login password-parameter="password" username-parameter="username" login-page="/" default-target-url="/game/" login-processing-url="/processLogin" authentication-failure-url="/"/> <security:logout logout-url="/game/logout" logout-success-url="/" delete-cookies="true" invalidate-session="true"/> <security:access-denied-handler ref="accessDeniedHandler" /> </security:http> Custom handler: @Component public class AccessDeniedHandler extends AccessDeniedHandlerImpl { @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException exception) throws IOException, ServletException { super.handle(request, response, exception); } } Exception resolver: accessDenied The problem I have is that spring security does not throw any exceptions. For example, when I enter a protected url, it redirects me to the login page. If I delete login page from the config, it redirects me to spring security default login form. Because of that I can't handle any exceptions like AccessDeniedException. As you can see above, I have defined custom access denied handler which overrides handle method but it doesn't even go inside it. I also tried with SimpleMappingExceptionResolver but that does not work either. So my question is: How do I make spring security throw exceptions so I can catch them by either resolver or custom handler?
has comment: http://stackoverflow.com/comment/41797672
tagged with: security
has comment: http://stackoverflow.com/comment/41798265
has comment: http://stackoverflow.com/comment/41797899
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/27624827
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/41797302
tagged with: spring
has answer: http://stackoverflow.com/a/27624827
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/9564936
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41798065

http://stackoverflow.com/a/26653465
answers question: http://stackoverflow.com/q/26652943
has body: In your test class, create a non-abstract inner class that extends Foo. Use that in your test.
has comment: http://stackoverflow.com/comment/41912393
has comment: http://stackoverflow.com/comment/41912256
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41910679
type: Answer
has comment: http://stackoverflow.com/comment/41913321
has comment: http://stackoverflow.com/comment/41910510
has comment: http://stackoverflow.com/comment/41915729
accepted answer of: http://stackoverflow.com/q/26652943

http://stackoverflow.com/comment/41795020
comment on: http://stackoverflow.com/q/26590042
score: 2
type: QuestionComment
type: Comment
has text: why not just pass paramter as 100-300 then parse the request like string.split("-"). Then convert min 100 and max 300 to ints and create an array of elements from 100 to 300.

http://stackoverflow.com/comment/41810684
comment on: http://stackoverflow.com/a/26580995
score: 0
type: Comment
has text: @Joehot200 - reliable stream oriented network protocols; e.g. TCP/IP.
type: AnswerComment

http://stackoverflow.com/comment/41903533
type: QuestionComment
has text: Please undo the edit and open a new question with edited text, cause otherwise the answer don't fit and later nobody knows the topic of that question.
score: 0
comment on: http://stackoverflow.com/q/26626199
type: Comment

http://stackoverflow.com/comment/41766952
score: 0
has text: your ajax call expects json, so does your service provide data in json format (from above it seems not)?
comment on: http://stackoverflow.com/q/26574600
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26628823
has comment: http://stackoverflow.com/comment/41866407
score: 1
tagged with: java
has title: Won't send all parameters to post http request
tagged with: post
has answer: http://stackoverflow.com/a/26628892
downvote count: 0
answer count: 1
tagged with: url
favorite count: 0
has body: I am trying to send a http request with java. This is my code: String AnnonseUrl = "http://webpage.no/insert_annonse.php?info="+info+"&amp;tittel="+tittel+"&amp;bedriftsNavn="+bedriftsNavn+"&amp;kontaktEmail="+kontaktEmail+"&amp;varighet="+varighet+"&amp;frist="+frist+"&amp;url="+url+"&amp;sted="+sted+"&amp;kontaktNavn="+kontaktNavn; URL url = new URL(AnnonseUrl); URLConnection uc = url.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( uc.getInputStream())); in.close(); Only the first three parameters are submitted.. If I copie the string "AnnonseUrl" and paste it in to my browser, then everything works fine.
type: UnansweredQuestion
upvote count: 1
tagged with: request
tagged with: http
type: Question

http://stackoverflow.com/q/26609078
favorite count: 0
accepted answer: http://stackoverflow.com/a/27583754
tagged with: android
answer count: 1
tagged with: android-loadermanager
upvote count: 2
has title: Android ListFragment data not updating via SimpleCursorAdapter / LoaderManager / notifyChange()
tagged with: simplecursoradapter
linked to: http://stackoverflow.com/q/7915050
score: 2
type: AnsweredQuestion
tagged with: java
has body: I have a ListFragment that shows the names of all the shopping lists stored in my database table. The problem is that when I add a new shopping list row to the table, the ListFragment on the UI is not automatically updated. (The change can only be seen if I close and restart the app.) Firstly, this is the code that is executed in my DbContentProvider class when I add a shopping list: ` // Insert the values into the table id = db.insert(SHOPPING_LISTS_META_TABLE, null, values); if (id &gt; -1) { // Construct and return the URI of the newly inserted row. Uri insertedId = ContentUris.withAppendedId(CONTENT_URI_SHOPPING_LISTS_META, id); // Notify any observers of the change in the data set. Log.d(LOG_TAG, "................. notifyChange(\"" + insertedId + "\", null)"); getContext().getContentResolver().notifyChange(insertedId, null); Log.d(LOG_TAG, "................. notifyChange() done"); return insertedId; } else { return null; } ` ...and here is the LogCat output for it... 10-28 12:29:41.133: D/SQLiteOpenHelper(19401): ................. notifyChange("content://org.example.myapp.DbContentProvider/shopping_lists_meta/12", null) 10-28 12:29:41.143: D/SQLiteOpenHelper(19401): ................. notifyChange() done 10-28 12:29:41.153: D/HomeActivity(19401): Shopping list, "My Test Shopping List" created: content://org.example.myapp.DbContentProvider/shopping_lists_meta/12 10-28 12:29:41.183: D/AbsListView(19401): unregisterIRListener() is called 10-28 12:29:41.193: E/ViewRootImpl(19401): sendUserActionEvent() mView == null 10-28 12:29:41.503: D/AbsListView(19401): unregisterIRListener() is called In LogCat, there is no output at all from my ListFragment class when I add the new shopping list row. Here is my ListFragment class... ` public class ShoppingListNamesListFragment extends ListFragment implements LoaderManager.LoaderCallbacks { private final static String LOG_TAG = ShoppingListNamesListFragment.class.getSimpleName(); // This is the Adapter being used to display the…
type: Question
has answer: http://stackoverflow.com/a/27583754
tagged with: android-listfragment
downvote count: 0

http://stackoverflow.com/comment/41933081
type: AnswerComment
comment on: http://stackoverflow.com/a/26665591
score: 0
type: Comment
has text: What exactly is elementData? I have never seen it before

http://stackoverflow.com/q/26558976
tagged with: postgresql
has comment: http://stackoverflow.com/comment/41738912
tagged with: jdbc
upvote count: 4
type: AnsweredQuestion
tagged with: connection-pooling
downvote count: 0
has comment: http://stackoverflow.com/comment/41740468
tagged with: java
has body: I have a basic question about the Tomcat 7 JDBC Connection Pool: is a separate pool created for each separate database (i.e., URL)? Or is a single pool created that holds open connections from any number of different databases? For example, if I open connections to databases A and B by doing this: PoolProperties poolProperties = new PoolProperties(); poolProperties.setDriverClassName("org.postgresql.Driver"); poolProperties.setUrl("jdbc:postgresql://myserver/db_a"); poolProperties.setInitialSize(1); poolProperties.setMaxActive(10); poolProperties.setMaxIdle(1); poolProperties.setMinIdle(0); and then this: PoolProperties poolProperties = new PoolProperties(); poolProperties.setDriverClassName("org.postgresql.Driver"); poolProperties.setUrl("jdbc:postgresql://myserver/db_b"); poolProperties.setInitialSize(1); poolProperties.setMaxActive(10); poolProperties.setMaxIdle(1); poolProperties.setMinIdle(0); Have I just created one pool with a maxActive of 10, or two pools, each with a maxActive of 10? If it's one pool, what if I had changed maxActive to, say, 30 when opening the connection for database B? Does the first call to setMaxActive win, or does the second call override, or does this cause a separate pool to be created?
type: Question
has comment: http://stackoverflow.com/comment/41738787
score: 4
accepted answer: http://stackoverflow.com/a/26619088
answer count: 1
has title: tomcat 7 JDBC connection pool - separate pool for each database?
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/26619088

http://stackoverflow.com/comment/41663604
type: Comment
comment on: http://stackoverflow.com/a/26515714
score: 0
has text: ah ok, then at the end of your constructor the test has to be ready to be administered, i'll update my post with further comments
type: AnswerComment

http://stackoverflow.com/comment/87754203
score: 4
type: AnswerComment
has text: @VHS can you explain what happens if I remove `CascadeType.MERGE`? I see it as the answer everywhere, but I *bet* it is a breaking change with side effects.
comment on: http://stackoverflow.com/a/32182410
type: Comment

http://stackoverflow.com/comment/41908753
type: QuestionComment
comment on: http://stackoverflow.com/q/26652707
score: 0
type: Comment
has text: Add more details please

http://stackoverflow.com/q/26538956
has answer: http://stackoverflow.com/a/26600020
has answer: http://stackoverflow.com/a/26539388
favorite count: 0
has body: I need to do some operations with a big file (>2GB). I need to encrypt the file and I didn't want to store the >2GB file in memory and then encrypt it using the Cipher class. Is there any library to do this? Split the file or something?
tagged with: encryption
downvote count: 2
tagged with: aes
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26539388
tagged with: java
tagged with: memory
type: Question
answer count: 2
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/26600020
has title: Encrypt big file with AES

http://stackoverflow.com/q/26667642
tagged with: japplet
answer count: 1
has comment: http://stackoverflow.com/comment/41936644
downvote count: 0
has body: It's been a long time since I have worked with java and I forgot how to deal with a NullPointerException. The only thing I can think of is line 8. I'm not sure if that's how I'm supposed to retrieve an audio file from the same folder the java file is located in. This is my first time working with AudioClip. If that is the problem, what is the correct way to do it? Thank you in advance for any help/tips. If there is any other piece of information that I can provide, to help you help me, please let me know. :) [Purpose of this code is to create three buttons that will allow the user to play,loop, and stop the music] import javax.swing.*; import java.applet.*; import java.awt.*; import java.awt.event.*; public class ProgAsThree extends JApplet { private AudioClip music = Applet.newAudioClip(getClass().getResource("Music.mp3")); private JButton jbtPlay = new JButton("Play"); private JButton jbtLoop = new JButton("Loop"); private JButton jbtStop = new JButton("Stop"); public ProgAsThree() { JPanel panel = new JPanel(); panel.add(jbtPlay); panel.add(jbtLoop); panel.add(jbtStop); add(panel); jbtPlay.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { music.play(); } }); jbtLoop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { music.loop(); } }); jbtStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { music.stop(); } }); } } java.lang.NullPointerException at sun.applet.AppletAudioClip.&lt;init&gt;(AppletAudioClip.java:65) at java.applet.Applet.newAudioClip(Applet.java:311) at ProgAsThree.&lt;init&gt;(ProgAsThree.java:8) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Const…
has comment: http://stackoverflow.com/comment/41936797
favorite count: 0
has comment: http://stackoverflow.com/comment/41936813
has comment: http://stackoverflow.com/comment/41936621
has answer: http://stackoverflow.com/a/26694996
has comment: http://stackoverflow.com/comment/41936702
type: AnsweredQuestion
tagged with: audio
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/26694996
has comment: http://stackoverflow.com/comment/41936663
has comment: http://stackoverflow.com/comment/41936807
has title: How did I get a NullPointerException? Working with JApplet
tagged with: nullpointerexception

http://stackoverflow.com/comment/41818407
has text: Consider my input is "EDUCATION  2009-2011 Masters in Hospital Administration Padmashree College of Hospital Administration, Bangalore.India ". If the string "EDUCATION" is match in 20th line, then it display the output of next 2 lines from the matched string that is i want output of 23 and 24th line.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26582575
type: QuestionComment

http://stackoverflow.com/q/26586226
tagged with: spring
has comment: http://stackoverflow.com/comment/41835212
possible better answer: http://stackoverflow.com/a/26586507
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41787639
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26607975
upvote count: 2
tagged with: java
tagged with: hibernate
has body: hi every body im creating a web app with Spring-MVc and hibernate and Spring Transaction when i add @Repository to my class it make error: the error is : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'numberGeneratorImpl' defined in file [E:\JAVA\BankEE\out\artifacts\BankEE_war_exploded\WEB-INF\classes\model\bl\NumberGeneratorImpl.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:633) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:602) at org.spring…
type: Question
has comment: http://stackoverflow.com/comment/41799428
has title: Error creating bean in Spring Transaction Manager
has comment: http://stackoverflow.com/comment/41827690
has comment: http://stackoverflow.com/comment/41788126
has comment: http://stackoverflow.com/comment/41788336
has comment: http://stackoverflow.com/comment/41799273
has comment: http://stackoverflow.com/comment/41799676
answer count: 2
has answer: http://stackoverflow.com/a/26607975
downvote count: 0
has comment: http://stackoverflow.com/comment/41788004
has comment: http://stackoverflow.com/comment/41788159
favorite count: 0
has comment: http://stackoverflow.com/comment/41788113
has answer: http://stackoverflow.com/a/26586507
has comment: http://stackoverflow.com/comment/41787721

http://stackoverflow.com/comment/41832556
has text: log4j.properties must be available on the class path. The WEB-INF directory is not (normally) on the class path. If you run your application with `-Dlog4j.debug` on the command line you will discover what log4j thinks is happening (if anything at all).
score: 0
comment on: http://stackoverflow.com/q/26609879
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26563784
has comment: http://stackoverflow.com/comment/41754341
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26562686
has body: Instead of Character, try String like below: Replace this code: ArrayStack&lt;Character&gt; e = new ArrayStack(n); char ch=0,res=0,a,b; int op1,op2,result=0,c=0; int z; for(int i=0; i&lt;n; i++) { if(Character.isDigit(izraz[i])) { ch=izraz[i]; e.push(ch); } if(izraz[i]=='+' || izraz[i]=='-' || izraz[i]=='/' || izraz[i]=='*') { ch=izraz[i]; op1 =e.pop()-'0'; //System.out.print(op1+" "); op2 =e.pop()-'0'; With: ArrayStack&lt;String&gt; e = new ArrayStack&lt;String&gt;(n); char ch=0; int op1,op2,result=0; for(int i=0; i&lt;n; i++) { if(Character.isDigit(izraz[i])) { final StringBuilder number= new StringBuilder(); while (izraz[i] != ' ') { number.append(izraz[i]); i++; } e.push(number.toString()); continue; } if(izraz[i]=='+' || izraz[i]=='-' || izraz[i]=='/' || izraz[i]=='*') { ch=izraz[i]; op1 =Integer.parseInt(e.pop()); //System.out.print(op1+" "); op2 =Integer.parseInt(e.pop());
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41750271
answers question: http://stackoverflow.com/q/26562686

http://stackoverflow.com/q/26652990
score: 0
tagged with: rest
type: UnansweredQuestion
has body: I am using a REST service in my project. When I convert a bean class into json string (return type is String) using return new Gson().toJson(myoutput); It will accept and work properly. If I return my bean class directly without convert into String (my return type is my bean class name), it will produce null pointer exception. java.lang.NullPointerException at org.glassfish.jersey.message.filtering.ObjectGraphImpl.getFields(ObjectGraphImpl.java:94) at org.glassfish.jersey.moxy.internal.MoxyObjectProvider.createSubgraphs(MoxyObjectProvider.java:105) at org.glassfish.jersey.moxy.internal.MoxyObjectProvider.createObjectGraph(MoxyObjectProvider.java:91) at org.glassfish.jersey.moxy.internal.MoxyObjectProvider.transform(MoxyObjectProvider.java:78) at org.glassfish.jersey.moxy.internal.MoxyObjectProvider.transform(MoxyObjectProvider.java:63) at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.createFilteringObject(AbstractObjectProvider.java:135) at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:97) at org.glassfish.jersey.message.filtering.spi.AbstractObjectProvider.getFilteringObject(AbstractObjectProvider.java:80) at org.glassfish.jersey.moxy.json.internal.FilteringMoxyJsonProvider.preWriteTo(FilteringMoxyJsonProvider.java:80) at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:807) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:263) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proc…
has comment: http://stackoverflow.com/comment/41909955
has comment: http://stackoverflow.com/comment/41909793
has comment: http://stackoverflow.com/comment/41909998
has title: Null pointer exception in REST service while return bean class as json
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41911891
type: Question
has comment: http://stackoverflow.com/comment/41911076

http://stackoverflow.com/comment/41710104
has text: I'm actually using that data structure. But I'm checking the size in the functions and clearing it as a handle them. Is that wrong?
type: Comment
comment on: http://stackoverflow.com/q/26543064
score: 0
type: QuestionComment

http://stackoverflow.com/q/26628191
type: Question
accepted answer: http://stackoverflow.com/a/26630418
score: 0
answer count: 1
has body: I am new to selenium web-driver. I am facing a issue 'handling a javascript popup' I click on a button and after clicking that button a popup comes it has a ok button.when I recorded in selenium ide, it shows a (COMMAND) assertAlert and (TARGET) *A copy of your e-Quote #514106617764 has been generated successfully and sent to your e-mail id.\nPlease continue with your online purchase process. in table(recorded script).so i wrritten following code to handle this popup. i am trying on getQoute page of igaruntee of https://buyonline.aegonreligare.com/cordys/buyonlineesales/startiGuarantee.htm?key=websitedirect# try{ Actions aa=new Actions(dd); aa.sendKeys("ENTER"); } catch(Exception e) {System.out.println(e)} try { dd.manage().timeouts().pageLoadTimeout(120, TimeUnit.SECONDS); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("check1"))); WebElement a=dd.findElement(By.id("check1")); if(a != null) { status = 1; System.out.println("iGurantee_Premium Qoute Page " + status); } else { status = 0; System.out.println("iGurantee_Premium Qoute Page " + status); } Monitoring_FrameWork.SaveResult(tstartTime,"iGurantee_Premium QoutePage ", status,120); } catch(Exception e) { status = 0; System.out.println(e); System.out.println("iGurantee_Premium Qoute Page " + status); } but I am getting an exception as: org.openqa.selenium.UnhandledAlertException: Modal dialog present Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:45' System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67' Session ID: db7cdba6-b905-49e0-9947-947d18761929 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=t…
has answer: http://stackoverflow.com/a/26630418
has title: Issue in handling JS popup throwing an exception:org.openqa.selenium.UnhandledAlertException: Modal dialog present
type: AnsweredQuestion
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/41835140
comment on: http://stackoverflow.com/q/26611668
type: Comment
has text: resize your jframe while running and check does it show
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41878641
type: QuestionComment
has text: see that: http://pastebin.com/JyuYWuAq
comment on: http://stackoverflow.com/q/26614835
score: 0
type: Comment

http://stackoverflow.com/q/26635105
has body: I am currently working on a project where I have to implement an Authorization server (java web application) which has to support JSON web token. I would very much like to use the spring support (spring-security-oauth2, spring-security-jwt) but unfortunately I can't find any example on the net. If anyone has already implemented it I would very much appreciate if you shared this with me. I have already looked into cloudfoundry(https://github.com/cloudfoundry/uaa) but can't find any help there. Thanks.
has title: Working example of Spring OAuth2.0 and JWT in Java with xml configuration
type: Question
score: 10
favorite count: 0
has comment: http://stackoverflow.com/comment/44147509
tagged with: oauth-2.0
tagged with: spring
tagged with: jwt
tagged with: java
upvote count: 10
has comment: http://stackoverflow.com/comment/67093656
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41673515
type: QuestionComment
comment on: http://stackoverflow.com/q/26522440
score: 1
has text: @TheLostMind, i've read this statement, but what they say and what i have experienced is different
type: Comment

http://stackoverflow.com/comment/41844595
comment on: http://stackoverflow.com/a/26616290
score: 1
has text: @Arun: `averageCalculation` represents a "reason to change", so SOLID principles dictate that it should be in a separate class from your other methods, which aren't changing. Any class that calls `averageCalculation()` should require an `I` as either a method parameter or a constructor parameter, and call `averageCalculation()` on that. Project C: `doCalculate(I i) { i.averageCalculation(); }` Project A: `doCalculate(new CClassForA())`.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26671562
tagged with: arraylist
has body: I am trying to create a method that allows another Account to be added to a collection: import java.util.*; import java.util.ArrayList; /** * The Account list if the grouping of all the accounts for customers in the system. * * @author * @version 1.0 */ public class AccountList { // This is the ArrayList being declared private ArrayList&lt;Account&gt; accounts; /** * Constructor for objects of class AccountList */ public AccountList() { //This is the ArrayList being initialised in a constructor. accounts = new ArrayList&lt;Account&gt;() ; } /** * This method will allow a new account to be added to the system. * * @param accounts the accounts in the system. */ public void addAccount(Account accounts) { accounts.add(); } } The problem is that it cannot find the method add on the addAccount section even with the ArrayList class being imported at the top of the class. I'm new to Java so any help would be greatly appreciated!
has comment: http://stackoverflow.com/comment/41943476
type: UnansweredQuestion
downvote count: 2
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/26671906
has answer: http://stackoverflow.com/a/26671591
score: -2
tagged with: java
has title: "Cannot find symbol - method add" using ArrayList
has comment: http://stackoverflow.com/comment/41943553
answer count: 3
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26671669

http://stackoverflow.com/comment/41787221
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26585521
score: 0
has text: You can just use `instanceof`. I think that @waqaslam was referring to this.

http://stackoverflow.com/q/26605182
score: 1
favorite count: 0
has title: web.servlet.PageNotFound ,Request method 'GET' not supported,Spring
type: Question
accepted answer: http://stackoverflow.com/a/26607415
has body: I encounter a strange problem in my Spring MVC Controller. I have four pages in my webapp folder @Controller public class WelcomeController { @RequestMapping(value="/wodi/welcome",method=RequestMethod.GET) public String welcome(){ return "redirect:/pages/webwelcome.html"; } } Just now, it worked fine to find the page http://localhost:8080/pages/webwelcome.html, but now I have the error that the browser says: There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported I have no idea what I did that influence it. I read WARN : org.springframework.web.servlet.PageNotFound - Request method 'GET' not supported But this is not the same case as mine since I am using "GET" method. Below is my Application.java to Boot the Spring app @Configuration @EnableAutoConfiguration @ComponentScan({"hello","wodinow.weixin.jaskey"}) public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); System.out.println("Let's inspect the beans provided by Spring Boot:"); String[] beanNames = ctx.getBeanDefinitionNames(); Arrays.sort(beanNames); for (String beanName : beanNames) { System.out.println(beanName); } } @Bean public CommandService commandService(){ return CommandService.getInstance(); } }
has answer: http://stackoverflow.com/a/26605486
has comment: http://stackoverflow.com/comment/41824091
has comment: http://stackoverflow.com/comment/41823615
tagged with: spring
tagged with: spring-mvc
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/34275393
linked to: http://stackoverflow.com/q/15492927
has comment: http://stackoverflow.com/comment/41824747
possible better answer: http://stackoverflow.com/a/34275393
has answer: http://stackoverflow.com/a/26607415
linked to: http://stackoverflow.com/q/26325524
has comment: http://stackoverflow.com/comment/41823427
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/26580931
has answer: http://stackoverflow.com/a/26581168
accepted answer: http://stackoverflow.com/a/26581168
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25811112
downvote count: 0
tagged with: rhino
tagged with: java
tagged with: scriptengine
has body: ScriptEngineManager.getEngineByName looks up and creates a ScriptEngine for a given name. Rhino registers itself as "js", "rhino", "JavaScript", "javascript", "ECMAScript", and "ecmascript" Nashorn registers itself as "nashorn", "Nashorn", "js", "JS", "JavaScript", "javascript", "ECMAScript", and "ecmascript" If I use a name like "js" which both Nashorn and Rhino have registered with, which script engine will be used? Will it use Nashorn on Java 8 and Rhino otherwise?
type: Question
tagged with: nashorn
score: 5
possible better answer: http://stackoverflow.com/a/28901500
has answer: http://stackoverflow.com/a/28901500
answer count: 2
favorite count: 0
upvote count: 5
has title: Which JS Script Engine will be chosen by Java?

http://stackoverflow.com/q/26629086
upvote count: 1
favorite count: 0
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41866901
downvote count: 1
accepted answer: http://stackoverflow.com/a/26629144
has answer: http://stackoverflow.com/a/26629144
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26629194
has title: Parse simple JSON array using JSONArray
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/26629194
type: Question
answer count: 2
has body: I'm new to use JSON format in Java and Android. My result from server is : ["7405,test,3","7406,mahdi,1"] with: String archive_group = new JsonService ( G.config_username, G.config_password, G.F_GET_GROUP_ARCHIVE ).request (); Now I want to parse this result and split with ,. My code is not correct. Please help me to resolve that. String archive_group = new JsonService ( G.config_username, G.config_password, G.F_GET_GROUP_ARCHIVE ).request (); JSONArray data_array = new JSONArray ( archive_group ); JSONArray json_obj = null; for (int i = 0; i &lt; data_array.length (); i++) { try { json_obj = data_array.getJSONArray ( i ); } catch (JSONException e) { e.printStackTrace (); //To change body of catch statement use File | Settings | File Templates. Log.e ( "json_obj", String.valueOf ( e ) ); } }

http://stackoverflow.com/q/26635675
type: Question
tagged with: java
has body: I'm currently a bit stuck with part of an assignment and was hoping you might be able to show me where I'm going wrong. I'm building an unsophisticated iTunes program and currently working on a method to get all the musicians involved with a particular track and display them as a string (e.g. "Frank Black, Joey Santiago, Kim Deal" etc.) This method needs to work by retrieving an array list inside the Artist object and displaying it. I'm having trouble with my get() method though. I know that I should implement a get() method so that the Track object can access fields in the Artist object, but all the ways I've tried to do this have sent up error messages. So far, I've tried an enhanced 'for loop' like this: for (String member : members.getMembers() ) { where 'members' is an ArrayList which contains a String for each of the musician's names, but that sends up "cannot find symbol - variable members". Then I tried this: for (String member : Artist.members.getMembers() ) { but that says "non-static variable members cannot be referenced from a static context". I get the feeling I'm missing something pretty basic here. Do any of you have any idea what it might be...?
has comment: http://stackoverflow.com/comment/41878867
has title: Getting an Array List from Another Object
score: 0
has comment: http://stackoverflow.com/comment/41879213
has answer: http://stackoverflow.com/a/26635765
has answer: http://stackoverflow.com/a/26635782
answer count: 4
has answer: http://stackoverflow.com/a/26636109
has comment: http://stackoverflow.com/comment/41879100
has answer: http://stackoverflow.com/a/26636076
type: UnansweredQuestion

http://stackoverflow.com/comment/41809163
comment on: http://stackoverflow.com/q/26597152
has text: "...(not school related)...I've got no idea on how to proceed without using an array, which I'm not keen on." Yeah, only the thing is, it's very common for a teacher to say, "you may not use an array," but what is unusual is for somebody to be "not keen on" using an array to hold a fixed-length sequence of anything.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26666575
has body: I am trying to recreate this query on spring mongo layer. db.LASTVIEWED_TEST.aggregate([{$match: {'_id' : '12070'}}, {$unwind:"$value"}, {$match:{"value.Dockey":{"$in":["390", "539","626"]}}}, {$group:{_id:"$_id", "value":{$push:"$value"}}} ]) I have made some attempts using various methods however I came across the examples here: https://github.com/spring-projects/spring-data-mongodb/blob/master/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTests.java and created this: Aggregation agg = Aggregation.newAggregation(// match(where("entityid").is(entityId)),// unwind("$value"), // match(where("value.Dockey").in(dockeyList)),// group("id").push("$value").as("value")// ); However this builder does not see to recognise the where, unwind keywords etc... and my compiler tells me my class does not have these methods. What do I need to do to pass values to the newAggregation builder. cheers,
tagged with: mongodb
upvote count: 1
answer count: 1
has title: Aggregation on spring mongo
favorite count: 0
tagged with: aggregation-framework
tagged with: spring
tagged with: mongodb-query
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26666755
accepted answer: http://stackoverflow.com/a/26666755
downvote count: 0
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/26552272
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41727205
answer count: 0
has comment: http://stackoverflow.com/comment/41727530
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41727393
tagged with: java
has comment: http://stackoverflow.com/comment/41726824
type: Question
tagged with: mssql-jdbc
has title: building an sql connection url in java
has body: so I am attempting to connect to a database on a network through java and I am having difficulty getting a connection to the server. I believe my problem is with the connection url. I have tried a few different things to test it out, but nothing has been working yet, so hopefully someone can help me. The error I get is: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 192.168.1.16, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.". at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241) at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243) at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at dbTest.db.dbConnect(db.java:23) at dbTest.testConnection.main(testConnection.java:11) Though depending on which connection url I use sometimes i get a java.net.sockettimeoutexception error. This is the code I am currently using to try to connect: try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Properties props = new Properties(); props.setProperty("user","sa"); props.setProperty("password",""); Connection conn = DriverManager.getConnection("jdbc:s…
tagged with: sql-server
score: 0

http://stackoverflow.com/q/26523698
favorite count: 0
linked to: http://stackoverflow.com/q/4732544
has title: Java anonymous inner class
tagged with: inner-classes
answer count: 1
linked to: http://stackoverflow.com/q/2804923
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26523767
downvote count: 0
tagged with: closures
type: UnansweredQuestion
has body: Does an instance of an anonymous inner class store all the accesible final variables or does it store only the variables that are being used inside the said inner class? (i.e. does it perform some kind of analysis? As far as I know the reference to the parent instance is being stored no matter what.)
tagged with: anonymous-class
type: Question
has comment: http://stackoverflow.com/comment/41675863
score: 3
has comment: http://stackoverflow.com/comment/41675607

http://stackoverflow.com/a/26522045
has body: As you know you can ask Android dial a number for you: Uri number = Uri.parse("tel:" + numberString); Intent dial = new Intent(Intent.ACTION_CALL, number); startActivity(dial); But on stock Android, you cannot interact with the dialer application after you have dialled your number. However, you can tell the dialer to set a pause between some numbers: either a 2-second pause, or an indefinite wait. To enter a 2-second pause between numbers, use a "," in the dial string: "6581329445,303" (thanks to @323go) To wait indefinitely, use a ";" in the dial string: "6581329445;123" This can be more useful in some situations - it depends on how long the automated answering service will take to allow you to enter the extension. The indefinite pause is handled by the dialer by popping up a dialog in the dialler app, allowing the user to send the extra numbers.
has comment: http://stackoverflow.com/comment/41673176
score: 4
answers question: http://stackoverflow.com/q/26520263
has comment: http://stackoverflow.com/comment/41673987
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/26561123
downvote count: 0
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26561017
accepted answer of: http://stackoverflow.com/q/26561017
type: Answer
has body: First you need to keep track of the root. ExpNode root = new ExpNode(op, null, null); To insert you need to find a node that has either left or right pointing to null. Then create a new node and arrange the pointers. Example to get you started: ExpNode current = root; while(current != null) { if(current.left == null) { ExpNode temp = new ExpNode(op, null, null); current.left = temp; break; } else if(current.right == null) { ExpNode temp = new ExpNode(op, null, null); current.right = temp; break; } else current = current.left; } This code will you get started. Play with it, until you understand it, then you can tweak it to solve your homework. You should notice something peculiar happing on the left side of the tree.
score: 2
has comment: http://stackoverflow.com/comment/41750855

http://stackoverflow.com/comment/41862296
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26608024
type: AnswerComment
has text: can you create a jsfiddle link with your problem statement, so that i can help you better.

http://stackoverflow.com/q/26558490
linked to: http://stackoverflow.com/q/18093928
has body: I am trying to run my netbeanz project from command line , it works when I run it from the netbean IDE I have already read this and this and the sun java tutorial but I am still unable to solve the problem. My main file : hill.java is located in the following folder In command line , I change directory to the above and run javac *.java which works as expected The problem arises when I attempt to java hill ( hill.java is the name of my main class file ) Contents of directory hill hill.java package hill; import java.util.Random; import java.io.*; import java.util.*; import java.math.*; public class Hill { public static void printmenu() { printline(); System.out.println("Welcome to Hill Cipher"); System.out.println("1) Key Generation"); System.out.println("2) Encrypt"); System.out.println("3) Decrypt"); System.out.println("4) Quit"); printline(); } public static String readString(String prompt) { System.out.print(prompt); return new java.util.Scanner(System.in).nextLine(); } public static int readInt(String prompt) { int input = 0; boolean valid = false; while (!valid) { try { input = Integer.parseInt(readString(prompt)); valid = true; } catch (NumberFormatException e) { System.out.println("*** Please enter an integer ***"); } } return input; } public static void main(String[] args) { int choice=0; do { printmenu(); choice = readInt("Please select your option : "); selectmenu(choice); }while (choice != 4); } } What am I doing wrongly and how do I solve this problem ??
has comment: http://stackoverflow.com/comment/41737945
type: AnsweredQuestion
has title: "Could not find or load main class" using command line
tagged with: command-line
downvote count: 0
possible better answer: http://stackoverflow.com/a/26558691
linked to: http://stackoverflow.com/q/7485670
score: 1
has comment: http://stackoverflow.com/comment/41738157
tagged with: java
type: Question
tagged with: compilation
answer count: 2
has answer: http://stackoverflow.com/a/26558691
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26558580
accepted answer: http://stackoverflow.com/a/26558580

http://stackoverflow.com/a/26556968
accepted answer of: http://stackoverflow.com/q/26553415
type: Answer
has body: Yes, those are required for the server to accept your request, but as you said, when sending Pay requests with a preapproval key there really is no need for it. I generally just use the primary site domain, like www.domain.com in both places.
answers question: http://stackoverflow.com/q/26553415
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41758021
type: Comment
has text: Sure. I might have a few `robot.delay(3000);` statements in the infinite loop.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26569094

http://stackoverflow.com/comment/41763423
comment on: http://stackoverflow.com/a/26572684
type: AnswerComment
score: 0
type: Comment
has text: Thanks a lot. I made a similar method that works for generic `byte[]` based on this. It works like a charm, and I've been hours wondering what could be wrong in the code. Thanks once again!

http://stackoverflow.com/q/26626428
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26668727
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has title: hibernate 4.3.6 save(entity) oracle
accepted answer: http://stackoverflow.com/a/26668727
score: 0
tagged with: oracle-database
answer count: 1
has body: After update to hibernate 4.3.6 save(entity) doesn't work. Before update save look's like: public void save(Object entity) { getHibernateTemplate().save(entity); } And it work's fine. Now it's: public void save(Object entity) { getCurrentSession().save(entity); } And it doesn't save entity. Hibernate entities and maps are the same. Nothing was changed. The problem is when i'm trying to save entity, then i'm calling stored procedure using ibatis which need to get entity saved before in DB (Oracle). There is no data in DB so my procedure crash. My question: What is wrong with hibernate-core 4.3.6 that this save doesn't work like in hibernate-core 3.5.6 (my previous version). No changes in code except save call. Only libraries. When i execute save on debug mode: 2014-10-29 11:35:31,820 Thread-8 SessionFactoryImpl$SessionBuilderImpl- Opening Hibernate Session. tenant=null, owner=null 2014-10-29 11:35:31,823 Thread-8 SessionImpl- Setting flush mode to: MANUAL 2014-10-29 11:35:31,862 Thread-8 DefaultSaveOrUpdateEventListener- Saving transient instance 2014-10-29 11:35:31,865 Thread-8 AbstractSaveEventListener- Generated identifier: 10107, using strategy: org.hibernate.id.Assigned 2014-10-29 11:35:31,868 Thread-8 AbstractSaveEventListener- Saving pl.com.uhc.db.hibernates.dto.ster.Message#10107 2014-10-29 11:35:31,871 Thread-8 ActionQueue- Adding an EntityInsertAction for [pl.com.uhc.db.hibernates.dto.ster.Message] object 2014-10-29 11:35:31,874 Thread-8 ActionQueue- Adding insert with no non-nullable, transient entities: [EntityInsertActionpl.com.uhc.db.hibernates.dto.ster.Message#10107] 2014-10-29 11:35:31,877 Thread-8 ActionQueue- Adding resolved non-early insert action. 2014-10-29 11:35:31,880 Thread-8 IdentifierValue$4- ID unsaved-value strategy UNDEFINED 2014-10-29 11:35:31,883 Thread-8 AbstractEntityPersister- Getting current persistent state for: pl.com.uhc.db.hibernates.dto.ster.MessageType#1 Hibernate: select messagetyp_.MessageTypeID, messagetyp_.FullName as Full…

http://stackoverflow.com/comment/41944067
type: Comment
has text: yes, advert_property has column advert_id which points to advert. See upd question for entitites=)
comment on: http://stackoverflow.com/a/26671695
score: 0
type: AnswerComment

http://stackoverflow.com/q/26557007
answer count: 1
tagged with: hierarchy
tagged with: user-profile
has answer: http://stackoverflow.com/a/26557123
accepted answer: http://stackoverflow.com/a/26557123
has body: I have a list of frequent terms obtained from different search queries of a certain user. For example: sports, badminton, soccer soccer, sports research, AI, algorithm research, adaptive, personalized search research, AI, neuro network The goal here is to build a hierarchical user profile based on these frequent terms with the hypothesis that terms that frequently appear in such queries represent topics that interest the user. In the hierarchy, general terms with higher frequency are placed at higher levels, while specific terms with lower frequency are placed at lower levels of the hierarchic user profile. The expected result would be a tree of the user profile looking somehow like this : User profile research AI algorithm personalized search .. sports soccer badminton So, I'm currently stuck and I don't even know how to begin or what libraries to use. (I'm working with java on this project). I would be very grateful if somebody could provide me with some help. Thanks in advance.
type: Question
linked to: http://stackoverflow.com/q/5841123
type: AnsweredQuestion
tagged with: java
score: 0
has title: Constructing a hierarchical user profile

union
type: Tag
tags question: http://stackoverflow.com/q/26569663
tag name: union

http://stackoverflow.com/a/26633352
type: Answer
has body: I'm now generating an authentication token that I store in the DB with the account and pass it to the client on login. the client uses this token to authentication again in the other module (stores it in local storage). after successful authentication in the module the token gets destroyed.
accepted answer of: http://stackoverflow.com/q/26624395
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26624395

http://stackoverflow.com/a/26667194
has body: Add one more if condition which will be if(lineCounter == 10){ primeNumberString += "\n"; lineCounter = 1; } This will create a new line and rest the lineConter. If you can change primeNumberString to StringBuffer than you could just save that + which bad.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41936207
has comment: http://stackoverflow.com/comment/41936025
has comment: http://stackoverflow.com/comment/41935927
accepted answer of: http://stackoverflow.com/q/26667158
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26667158

http://stackoverflow.com/comment/41725973
has text: I'm trying to make onde myself...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26551596
score: 0

http://stackoverflow.com/comment/41933356
has text: That sounds really weird. There might be several issues with your code. However, this was one of them.
comment on: http://stackoverflow.com/a/26665673
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41929214
has text: I'd add the listener in the constructor of the custom panel...
comment on: http://stackoverflow.com/a/26662941
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41861499
comment on: http://stackoverflow.com/a/26624732
score: 0
has text: the regex is giving an error saying invalid escape sequence in java
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41719681
score: 0
comment on: http://stackoverflow.com/q/26547689
has text: Show us some code that can be compiled so we know exactly what you are doing https://stackoverflow.com/help/mcve
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41864980
score: 1
has text: `null` is a valid comparator. Try running it though...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26627934

http://stackoverflow.com/q/26517470
tagged with: dropbox
has comment: http://stackoverflow.com/comment/41684667
has comment: http://stackoverflow.com/comment/41684554
tagged with: dropbox-api
score: 0
has comment: http://stackoverflow.com/comment/41664957
has body: I have seen several posts about my issue, but the solutions given don't solve my trick. I try to connect my app to Dropbox core API, but it's impossible I can't find out why this line final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER; makes crash my code. The content of logcat is below: 10-22 23:16:54.071: E/AndroidRuntime(17666): FATAL EXCEPTION: main 10-22 23:16:54.071: E/AndroidRuntime(17666): java.lang.ExceptionInInitializerError 10-22 23:16:54.071: E/AndroidRuntime(17666): at java.lang.Class.newInstanceImpl(Native Method) 10-22 23:16:54.071: E/AndroidRuntime(17666): at java.lang.Class.newInstance(Class.java:1319) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.ActivityThread.access$600(ActivityThread.java:155) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1252) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.os.Handler.dispatchMessage(Handler.java:99) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.os.Looper.loop(Looper.java:137) 10-22 23:16:54.071: E/AndroidRuntime(17666): at android.app.ActivityThread.main(ActivityThread.java:5096) 10-22 23:16:54.071: E/AndroidRuntime(17666): at java.lang.reflect.Method.invokeNative(Native Method) 10-22 23:16:54.071: E/AndroidRuntime(17666): at java.lang.reflect.Method.invoke(Method.java:511) 10-22 23:16:54.071: E/AndroidRuntime(17666): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 10-22 23:16:54.071: E/AndroidRuntime(17666): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 10-22 23:16:54.071: E/AndroidRuntime(17…
has title: Dropbox Core API - connection impossible - Caused by: java.lang.NoClassDefFoundError
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41665270
has comment: http://stackoverflow.com/comment/41695108
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41696452
type: Question

http://stackoverflow.com/comment/41746743
has text: How would you know the number of JTextField(s) then?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26563468
score: 0

http://stackoverflow.com/q/26667158
favorite count: 0
has answer: http://stackoverflow.com/a/26667194
upvote count: 1
has body: I want to find prime numbers from 1 to 1000, and perfect numbers from 1 - 10000. Finally I got the code output works. But I want to print 10 numbers of the prime numbers on a line. For example: 2 3 5 7 11 13 17 19 23 29 and then 31 37 41 43 47 53 59 61 67 71 however, my output is in a line like this 235791113171923293137414347 There are 2 sets of code, one is the method and is the actual program that call the method public class MyMath {//class start //method to define prime number public static boolean isPrime( long num ) {//start isPrime method //declare and initialize prime variable as true boolean isPrime = true; if ( num &gt;= 2) {//start if statement for ( long counter = 2; counter &lt; num; counter++) {//start for loop //define whether num is prime or not with // a reminder operator if( num%counter == 0) isPrime = false;//if not initialize variable to false }//end for loop }//end if //check for negative number and two if( num &lt;= 1 ) isPrime = false; if ( num == 2) isPrime = true; return isPrime;//send back prime variable }//end method //method to define perfect numbers public static boolean isPerfect( long num ) {//start method //declare and initialize perferct number variable as true boolean isPerfect = true; long sum = 0; //check for input if ( num &lt;= 1) isPerfect = false; //if num is larger than one if ( num &gt; 1) {//start if statement //use a for loop to find the factor for(long factor = 1; factor &lt;= num/2; factor++ ) {//start for loop if( num%factor == 0 ) sum += factor; }//end for loop }//end if statement //if the sum of the factor equal to num //initialize perfect number variable as true //else perfect number variable is false if ( num == sum ) isPerfect = true; else isPerfect = false; return isPerfect;//send back perfect number variable }//end method }//end class and this is the actual code import javax.swing.JOptionPane;//import JOptionPane for dialog boxes public class MyMathTest {//start MyMathTest class public static void main (String a…
type: AnsweredQuestion
tagged with: java
has title: print 10 set of prime number in a line on JOptionPane output
type: Question
accepted answer: http://stackoverflow.com/a/26667194
answer count: 1
downvote count: 0
score: 1
tagged with: prime-factoring

http://stackoverflow.com/comment/41693205
has text: Nice. If you want try and get ahead a little, you can read about Lists.. Here is the API for a List http://docs.oracle.com/javase/7/docs/api/java/util/List.html
score: 2
comment on: http://stackoverflow.com/q/26533301
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41681392
score: 0
type: Comment
type: QuestionComment
has text: have you looked the | in Java8 for catching exceptions? You can do something like catch(ExceptionA | ExceptionB e). Not sure if it will help but maybe there is a solution there.
comment on: http://stackoverflow.com/q/26527060

http://stackoverflow.com/comment/41709728
has text: As you are new to android dev, I suggest you starting with Android Studio. In any case, open your SDK Manager and you should be able to update your api and support libraries level.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26541623

http://stackoverflow.com/q/26598309
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41811092
score: 0
has body: I am getting back into Java, and I am trying to make a program that has a square, which turns into for smaller equal squares, and those squares turn into 4 smaller squares and so on and so on, but when i try to run the program it doesn't do anything. Here is my code: package main; import java.awt.Graphics; import java.util.ArrayList; import javax.swing.JPanel; public class mainPanel extends JPanel { @SuppressWarnings("rawtypes") ArrayList rects = new ArrayList(); int rectangles = 1; int x = 1; int y = 1; int size = 1000; long lastTime = System.nanoTime(); int frames = 0; int fps = 0; public mainPanel() { setDoubleBuffered(true); rects.add(new cube(x, y, size)); Thread t = new Thread() { public void run() { while (1 != 2) { repaint(); try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } }; t.start(); } @SuppressWarnings("unchecked") public void paint(Graphics g) { super.paint(g); Graphics g2 = g; for (int i = 0; i &lt; rectangles; i++) { g.fillRect(x, y, size, size); size /= 4; x += size / 2 + 1; y += size / 2 + 1; rectangles += 4; } frames++; if (System.nanoTime() - lastTime &gt;= 1000000000) { fps = frames; frames = 0; lastTime = System.nanoTime(); } g.drawString("FPS: " + fps, 5, 15); g.dispose(); } } When I run the program, even when I slow down the sleep function to 1000ms, no squares are drawn at all, and over time my fps slows down alot.
has comment: http://stackoverflow.com/comment/41811539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41811010
tagged with: swing
has title: Squares dividing program not drawing
answer count: 0
has comment: http://stackoverflow.com/comment/41811056
tagged with: java

http://stackoverflow.com/q/26618890
has answer: http://stackoverflow.com/a/26619453
tagged with: java
has body: A common thing to do to utility classes is to give them a private constructor: public final class UtilClass { private UtilClass() {} ... } But unfortunately, some tools don't like that private constructor. They may warn that it's never called within the class, that it's not covered by tests, that the block doesn't contain a comment, etc. A lot of those warnings go away if you do this instead: public enum UtilClass {; ... } My question is: besides the unending hatred of future developers, what important differences are there between an enum with no values and a class with a private constructor in Java? Note that I am not asking What's the advantage of a Java enum versus a class with public static final fields?. I'm not deciding between whether a list of things should be a bunch of constants or an enum, I'm deciding between putting a bunch of functions in a constructor-less class or a value-less enum. Also note that I don't actually want to do this. I just want to know the trade-offs as part of general language knowledge. For example, using an enum pollutes the autocomplete with useless methods like UtilClass.values(). What other downsides are there? Upsides?
has title: Difference between java enum with no values and utility class with private constructor
has comment: http://stackoverflow.com/comment/41849718
type: Question
has answer: http://stackoverflow.com/a/26619405
has comment: http://stackoverflow.com/comment/41848948
has answer: http://stackoverflow.com/a/26619655
has comment: http://stackoverflow.com/comment/41849937
has comment: http://stackoverflow.com/comment/41848899
has comment: http://stackoverflow.com/comment/41848950
has comment: http://stackoverflow.com/comment/41848858
possible better answer: http://stackoverflow.com/a/26619655
upvote count: 39
has comment: http://stackoverflow.com/comment/41848844
has comment: http://stackoverflow.com/comment/41850152
has answer: http://stackoverflow.com/a/26619349
linked to: http://stackoverflow.com/q/70689
has comment: http://stackoverflow.com/comment/41848952
answer count: 4
has comment: http://stackoverflow.com/comment/41849891
has comment: http://stackoverflow.com/comment/41849521
favorite count: 0
has comment: http://stackoverflow.com/comment/41848888
score: 38
linked to: http://stackoverflow.com/q/9969690
has comment: http://stackoverflow.com/comment/41849510
downvote count: 1
has comment: http://stackoverflow.com/comment/41849229
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41850265
tagged with: enums
accepted answer: http://stackoverflow.com/a/26619349
tagged with: private-constructor

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/26650238
tags question: http://stackoverflow.com/q/26573720
tags question: http://stackoverflow.com/q/26576986
type: Tag
tags question: http://stackoverflow.com/q/26586655

http://stackoverflow.com/a/26564340
downvote count: 0
score: 1
has body: You have to check for null or empty string. try and catch blocks help there: try { String inputs = myTextBox.getText().toString(); int i = Integer.parseInt(inputs); i++; outputTextBox.setText(String.valueOf(i)); } catch (NumberFormatException e) { // Invalid integer received (empty or null string) outputTextBox.setText(""); } Explanation: Integer.parseInt throws a NumberFormatException if null or empty string is passed. If that is the case you just clear the outputTextBox. Solution 2: Manually check for an empty string as suggested by @rossum. if (TextUtils.isEmpty(inputs)) { outputTextBox.setText(""); } else { int i = Integer.parseInt(inputs); i++; outputTextBox.setText(String.valueOf(i)); }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41748204
accepted answer of: http://stackoverflow.com/q/26564302
type: Answer
has comment: http://stackoverflow.com/comment/41749609
answers question: http://stackoverflow.com/q/26564302
has comment: http://stackoverflow.com/comment/41749579
has comment: http://stackoverflow.com/comment/41748141

http://stackoverflow.com/comment/41757718
has text: This will return how many iterations should be done to change a string into a palindrome.And T tels how many strings we gonna check
score: 0
comment on: http://stackoverflow.com/q/26569261
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/74552981
comment on: http://stackoverflow.com/q/26542812
score: 0
type: QuestionComment
type: Comment
has text: I am trying to do same thing. Did you guys find anything?

http://stackoverflow.com/comment/41847087
type: QuestionComment
has text: Hi @jdramaix, I have been able to get this to work in 2D (i.e., as a replacement for the code I already have). Thank you very much for that. However, I am having difficulty in transforming it to 3D as per my question: http://stackoverflow.com/questions/26601336/how-to-convert-a-css3-2d-animatuon-to-a-3d-transform Regards, Glyn
comment on: http://stackoverflow.com/q/26580867
score: 0
type: Comment

http://stackoverflow.com/q/26668578
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: logging
has title: Location change for Logs in play framework
has body: I have been newly working on Play framework and the version is 1.2.5. The logs for my application are stored at location where the entire application is installed. I have installed my application package in C:\app location and running it through Java wrapper. I am confused as my log.properties file do not say anything about the stored location of log, as shown below, but still it is logging in default log folder of play. Below is the exactly copied log.properties file for my application which is working fine. Few lines are commented but that is how I have received it. #properties file used for log4j log4j.rootLogger=ERROR, Console log4j.logger.play=DEBUG # Rolling files #log4j.appender.Rolling=org.apache.log4j.RollingFileAppender #log4j.appender.Rolling.File=logs/application.log #log4j.appender.Rolling.MaxFileSize=1MB #log4j.appender.Rolling.MaxBackupIndex=100 #log4j.appender.Rolling.layout=org.apache.log4j.PatternLayout #log4j.appender.Rolling.layout.ConversionPattern=%d{DATE} %-5p ~ %m%n # Console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p ~ %m%n All I want to know is how Play is storing it there, Is there any class of Play that has this location stored, and How can I configure to change the location of building logs to other drive say E:\logs?
score: 1
has answer: http://stackoverflow.com/a/26668673
tagged with: java
type: Question
tagged with: apache
downvote count: 0
answer count: 1
tagged with: playframework

http://stackoverflow.com/comment/41807120
type: Comment
has text: If I remove my **join()** method and second thread. it works great.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26595978

http://stackoverflow.com/comment/118511187
type: AnswerComment
has text: The encoding itself is fine, but it's encoding the brackets and such as well. That doesn't seem exactly equivalent to sending "foo=bar" and I don't think all servers will interpret it to be the same. I guess that's what the poster is asking for though!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26542491

http://stackoverflow.com/comment/41806533
has text: javax.imageio.ImageIO should handle this for you.
comment on: http://stackoverflow.com/q/26595835
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41718273
type: QuestionComment
comment on: http://stackoverflow.com/q/26547467
has text: @MarkoTopolnik cool, thank you. I knew that it was on the cards but not that it was actually in. Do you happen to know when it went in, and whether it ever made it in for for loop optimizations?
score: 0
type: Comment

http://stackoverflow.com/comment/41663571
has text: Each instance of the class Item has a randomNames array inside it. Therefore in the constructor of Item you must add your values to the array. The code:randomNames.add("Key"); randomNames.add("Rock"); randomNames.add("Balloon"); randomNames.add("Boot"); randomNames.add("Knife"); randomNames.add("Pencil"); Should be inside "Item" constructor. Otherwise the array will be created empty when the Item is created.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26516464
score: 0

http://stackoverflow.com/comment/42154291
has text: I believe [virtual directories just replace the docroot](https://community.oracle.com/thread/793995?start=0&tstart=0).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26514277
score: 0

http://stackoverflow.com/q/26556580
has comment: http://stackoverflow.com/comment/41734644
has comment: http://stackoverflow.com/comment/41740403
score: 0
tagged with: groovy
answer count: 1
has answer: http://stackoverflow.com/a/26557062
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/41734857
has body: I'd like to recursively read a zip file and then extract all files in a separate folder. For example if some.zip file has the following contents: file5.txt somefolder file.txt file4.txt inside.zip file2.txt file3.txt What I want is just all the files, including all the files in zip files inside the zip file (inside.zip in the example above). end result of somefolder would be all the files (I don't care about the folder structure): file5.txt file.txt file4.txt file2.txt file3.txt What I tried: I have the code below but it maintains the folder structure and does not open zip files inside zip files: import java.util.zip.* def extractZip (String zipFile) { def zipIn = new File(zipFile) def zip = new ZipFile(zipIn) zip.entries().findAll { !it.directory }.each { e -&gt; (e.name as File).with{ f -&gt; f.parentFile?.mkdirs() f.withOutputStream { w -&gt; w &lt;&lt; zip.getInputStream(e) } } } }
type: UnansweredQuestion
tagged with: java
has title: How to read all files from a zip file
has comment: http://stackoverflow.com/comment/41734922
type: Question

http://stackoverflow.com/comment/41736007
score: 0
type: Comment
type: QuestionComment
has text: Yea when I type bone I get "there are 0 vowels in bone"
comment on: http://stackoverflow.com/q/26557185

http://stackoverflow.com/q/26576322
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26576527
accepted answer: http://stackoverflow.com/a/26576527
has answer: http://stackoverflow.com/a/49548931
score: 2
type: AnsweredQuestion
has title: Does a fragment get destroyed when you pop the back stack?
possible better answer: http://stackoverflow.com/a/26576583
type: Question
has answer: http://stackoverflow.com/a/26576583
tagged with: android-fragments
tagged with: java
has body: Cannot find a direct answer to this so i'll ask here. If I have one activity which starts with Fragment A attached and then when a button on A is pressed it replaces fragment A with fragment B. A is added to back stack. If the back button is pressed it will go from B back to A but I want to know does the fragment B get destroyed? because technically the activity is not so do I need to explicitly remove fragment B even when the back stack is pop? Thank you for reading
upvote count: 2
answer count: 3

http://stackoverflow.com/a/26567977
has body: You have to escape the | in your regular expression. This should work: String tempStr[] = info.split("\\|");
type: AcceptedAnswer
score: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/26567964
answers question: http://stackoverflow.com/q/26567964
downvote count: 0
upvote count: 6

http://stackoverflow.com/comment/41943244
score: 0
type: Comment
type: QuestionComment
has text: @ashokramcse: same result
comment on: http://stackoverflow.com/q/26671281

http://stackoverflow.com/comment/42533956
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26993209
has text: great, I am expecting something along these lines. if you have working example of this, please post
score: 0

http://stackoverflow.com/comment/41838369
has text: I read in another SO thread that even TCP is not totally immune to packet loss?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26580995

http://stackoverflow.com/comment/41853554
type: QuestionComment
type: Comment
score: 0
has text: See if any of these help: http://stackoverflow.com/questions/3553163/android-long-touch-event, http://stackoverflow.com/questions/4324362/detect-touch-press-vs-long-press-vs-movement, http://developer.android.com/training/gestures/detector.html
comment on: http://stackoverflow.com/q/26621522

http://stackoverflow.com/comment/41845578
comment on: http://stackoverflow.com/q/26617162
score: 0
type: Comment
type: QuestionComment
has text: this is the default return values of `toString` of the class `Object`, you need to override it in your class and give it a meaningful implementation.

http://stackoverflow.com/q/26662116
type: Question
downvote count: 0
tagged with: abstract-class
possible better answer: http://stackoverflow.com/a/26662400
has answer: http://stackoverflow.com/a/26662400
answer count: 4
has answer: http://stackoverflow.com/a/26662502
favorite count: 0
has answer: http://stackoverflow.com/a/26662490
has answer: http://stackoverflow.com/a/26662184
has body: I'm new to Java and I am currently learning about Abstract classes. Currently I am creating a simple RPG. Suppose I have an abstract class called Person, which extends to two other classes, Warrior and Wizard. Now suppose that I have another abstract class called Weapon where from there we can create different types of weapons(swords, axes, bows etc..) which share some basic methods, that can be overwritten by other inherited classes, such as attack() or maintenance(). When a Person(Wizard or Warrior) will call the attack() method at some point in the game, I need to know who will be the attacker and who the defender (show I can modify their life bar status, durability of their weapons , etc) . (Which essentially means, receiving two objects in the attack() method as parameters). So here is where I am stuck. The combination of attacker-defender could be Wizard-Warrior, Wizard-Wizard, Warrior-Wizard or Warrior-Warrior. How should I implement the attack() method in the Weapon class so it can permit me to receive an object as a parameter, without caring if the object is going to be wizard or warrior ? Could this be possible? doing something like this for example? void attack(Person attacker, Person defender) { // add method logic here } Thanks in advance.
has title: Receiving an object derived from an abstract class as a parameter in method
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41926705
accepted answer: http://stackoverflow.com/a/26662490

http://stackoverflow.com/q/26669012
has comment: http://stackoverflow.com/comment/42043806
tagged with: android
has title: JSoup "wrap" is not working as expected everytime
has comment: http://stackoverflow.com/comment/41939086
has comment: http://stackoverflow.com/comment/42046541
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26729206
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41939959
has body: I have an HTML string which contains text, images or map images. The HTML is dynamically generated. Now, wherever there is an &lt;img&gt; tag, it should be wrapped by a &lt;center&gt; tag. To achieve this, I use JSoup and I successfully apply that to static images and text. But, whenever I am trying to post a map, the HTML is losing its structure. I do not understand what is happening. Both the normal and the map images have &lt;img&gt; tags. How can the method give different outputs? This is the method which is doing the job: public String wrapImgWithCenter(String html){ Document doc = Jsoup.parse(html); doc.select("img").wrap("&lt;center&gt;&lt;/center&gt;"); return doc.html(); } Original HTML with image and map images before wrapping: &lt;p dir="ltr"&gt;&lt;img src="http://files.parsetfss.com/bcff7108-cbce-4ab8-b5d1-1f82827e6519/tfss-4de5af73-68f1-401d-9feb-1dfde1373cff-file" /&gt;&lt;/p&gt; &lt;p dir="ltr"&gt;&lt;a href="15.2993265,74.123996"&gt;&lt;img src="http://maps.google.com/maps/api/staticmap?center=15.2993265,74.123996&amp;zoom=15&amp;size=960x540&amp;sensor=false&amp;markers=color:blue%7Clabel:!%7C15.2993265,74.123996" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p dir="ltr"&gt;&lt;a href="22.572646,88.363895,-25.274398,133.775136"&gt;&lt;img src="http://maps.google.com/maps/api/staticmap?center=22.572646,88.363895&amp;zoom=2&amp;size=960x540&amp;markers=22.572646,88.363895%7C-25.274398,133.775136&amp;path=color:0xff0000ff%7Cweight:5%7C22.572646,88.363895%7C-25.274398,133.775136&amp;sensor=false" /&gt;&lt;/a&gt;&lt;br /&gt; &lt;/p&gt; Result after wrapping &lt;p dir="ltr"&gt; &lt;/p&gt; &lt;center&gt; &lt;img src="http://files.parsetfss.com/bcff7108-cbce-4ab8-b5d1-1f82827e6519/tfss-01516245-c773-4765-b542-ebecb964b255-file" /&gt; &lt;/center&gt; &lt;br /&gt; &lt;br /&gt; &lt;p&gt;&lt;/p&gt; &lt;p dir="ltr"&gt; &lt;/p&gt; &lt;center&gt; &lt;a href="15.2993265,74.123996"&gt;&lt;img src="http://maps.google.com/maps/api/staticmap?center=15.2993265,…
type: Question
has comment: http://stackoverflow.com/comment/41940321
has comment: http://stackoverflow.com/comment/41940336
tagged with: image
tagged with: jsoup
has comment: http://stackoverflow.com/comment/41975381
linked to: http://stackoverflow.com/q/26795112
answer count: 1
has answer: http://stackoverflow.com/a/26729206
downvote count: 0
has comment: http://stackoverflow.com/comment/42166142
favorite count: 0

http://stackoverflow.com/a/26593981
answers question: http://stackoverflow.com/q/26593271
score: 0
type: Answer
has body: Thats because you of this statement: posi = position; Change it to position =posi; Use "this" pointer to avoid these errors. Happy Coding !!

http://stackoverflow.com/q/26553436
tagged with: java
type: Question
tagged with: graphics
has body: Class one: public class Bar extends JComponent { // instance variables - replace the example below with your own private static boolean litUp = false; private static boolean vertical = true; private static int positionX; private static int positionY; private static int sizeX; private static int sizeY; private static Color color; public void paintComponent(Graphics g) { System.out.println("I am being called"); positionX = 50; positionY = 30; vertical = true; if(vertical == true) { sizeX = 10; sizeY = 30; if(litUp == true) { color = Color.red; } else { color = Color.black; } } else{ sizeX = 30; sizeY = 10; if(litUp == true) { color = Color.red; } else { color = Color.black; } } g.fillRect(positionX, positionY, sizeX, sizeY); g.setColor(color); super.paintComponent(g); } } Class Two: public class TestingBar { public static void main(String[] args) { final int FRAME_WIDTH = 317; final int FRAME_HEIGHT = 415; //created frame and panel. Panel layout is taken away from the flow layout. final JFrame myFrame = new JFrame(); myFrame.setTitle("Tester Window (v2)"); myFrame.setSize(FRAME_WIDTH,FRAME_HEIGHT); final JPanel myPanel = new JPanel(); myPanel.setLayout(null); final Bar testBar = new Bar(); //myPanel.add(testBar); myFrame.getContentPane().add(testBar); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.setVisible(true); myPanel.add(testBar); } } This is just giving me an empty JFrame. And the print statement is never being utilized in the paintComponent method. I am seriously stumped. PS: They won't let me post this without typing more, so I will talk about turtles. I don't understand how they survive out in the wild. They can't run, their shells really aren't that hard, they can only attack from the front, and if they are flipped over they are crippled for an indefinite amount of time. You think that natural selection would have worn them out of the pool by now. Maybe they survived by being so darn adorable. I mean, just watch youtube videos of a baby tur…
has answer: http://stackoverflow.com/a/26553674
score: 0
has title: Cannot get this blasted rectangle to draw!! (java swing)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26553478
has answer: http://stackoverflow.com/a/26553594
tagged with: swing
answer count: 4
has answer: http://stackoverflow.com/a/26553520

http://stackoverflow.com/a/26602619
has body: Once a stream is closed, you cannot send back data to acknowledge the successful receiving of the file. As written in my comment, you can first send the length of the file to the client so the client will know how many bytes it has to read. Once the client read this amount of data, the client can send back the acknowledge because the stream is not closed. Once the server received the acknowledgement, it can close the stream or initiate another transfer.
has comment: http://stackoverflow.com/comment/41818562
answers question: http://stackoverflow.com/q/26602053
has comment: http://stackoverflow.com/comment/41818724
has comment: http://stackoverflow.com/comment/41818539
has comment: http://stackoverflow.com/comment/41818979
score: 0
has comment: http://stackoverflow.com/comment/41818742
has comment: http://stackoverflow.com/comment/41819069
type: Answer

jodatime
tags question: http://stackoverflow.com/q/26639304
tags question: http://stackoverflow.com/q/26645648
type: Tag
tag name: jodatime
tags question: http://stackoverflow.com/q/26564192
tags question: http://stackoverflow.com/q/26516765
tags question: http://stackoverflow.com/q/26545762
tags question: http://stackoverflow.com/q/26547596
tags question: http://stackoverflow.com/q/26661995
tags question: http://stackoverflow.com/q/26593580
tags question: http://stackoverflow.com/q/26547950
tags question: http://stackoverflow.com/q/26597153

http://stackoverflow.com/q/26588958
has comment: http://stackoverflow.com/comment/41793194
type: Question
has comment: http://stackoverflow.com/comment/41793042
has title: Using a Session interface in another class
tagged with: session
has comment: http://stackoverflow.com/comment/41793032
has comment: http://stackoverflow.com/comment/41793106
has body: I have a web application I am making using a websocket API to handle the websockets, here is the code for that part package comm2.hello; import java.io.IOException; import java.util.ArrayList; import javax.websocket.OnClose; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; import org.apache.catalina.session.*; @ServerEndpoint(value = "/echo") public class wschat { private static ArrayList&lt;Session&gt; sessionList = new ArrayList&lt;Session&gt;(); @OnOpen public void onOpen(Session session) { try { sessionList.add(session); // asynchronous communication session.getBasicRemote().sendText("hello"); } catch (IOException e) { } } public void send(String text, Session session) throws IOException { session.getBasicRemote().sendText(text); } } I am trying to have another java class then call into the send method to send messages, using the following code. package comms; import java.io.IOException; import java.util.ArrayList; import javax.websocket.Session; import javax.websocket.Session; import comm2.hello.*; public class main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub wschat h = new wschat(); String text = "hello"; //session shouldn't be null but not sure what to make it Session session = null; h.send(text,session); } } As you can see, I have the session variable in the main.java class set to null which will thus always produce a null pointer error. This is because I am not sure what to make session equal to, does anyone have any idea what to initialize the session variable to in main.java?
score: 0
tagged with: websocket
tagged with: tomcat
type: UnansweredQuestion
answer count: 0
tagged with: java

http://stackoverflow.com/q/26595318
has body: I have a problem which I can't solve. I want to solve Alphametics(e.g. SEND + MORE = MONEY --> O=0,M=1,Y=2,E=5,N=6,D=7,R=8,S=9) So I tried to make a Equation out of that like this: 1000*S+100*E+10*N+D + 1000*M+100*O+10*R+E = 10000*M+1000*O+100*N+10*E+Y So I tried to use a Hashmap, to collect this Data(this is just for the left side of the equation): Scanner s = new Scanner(System.in); int HowMuchWords = s.nextInt(); String[] Words = new String[HowMuchWords]; for(int i = 0; i&lt;Words.length;i++){ Words[i] = s.next().toUpperCase(); } HashMap&lt;Character,Integer&gt; Letters = new HashMap&lt;Character, Integer&gt;(); for(int i = 0;i&lt;Words.length;i++) { char[] LettersWord = Words[i].toCharArray(); for (int j = 0; j &lt; LettersWord.length; j++) { Letters.put(LettersWord[j],Letters.get(LettersWord[j])+(int) Math.pow(10, LettersWord.length - 1 - j)); } But I have problems with the Letters.get command. Because I want to add a number to null, the Value is still null. So I want to set the default value of every value in the Hashmap to 0. Is there a possibility to do that?
has title: Default Values in a Hashmap
type: UnansweredQuestion
type: Question
tagged with: hashmap
tagged with: java
has answer: http://stackoverflow.com/a/26596891
answer count: 3
has answer: http://stackoverflow.com/a/26595393
tagged with: default-value
linked to: http://stackoverflow.com/q/7519339
has answer: http://stackoverflow.com/a/26595750
has comment: http://stackoverflow.com/comment/41805342
has comment: http://stackoverflow.com/comment/41805213
score: 0

http://stackoverflow.com/q/26576477
has title: super and extends behaves same way
has answer: http://stackoverflow.com/a/26576582
upvote count: 2
answer count: 2
tagged with: collections
downvote count: 1
linked to: http://stackoverflow.com/q/4343202
has answer: http://stackoverflow.com/a/26576531
tagged with: oop
tagged with: java
duplicate of: http://stackoverflow.com/q/4343202
type: UnansweredQuestion
favorite count: 0
type: Question
score: 1
has body: This question may have been asked before in different formats but I just couldn't find an appropriate answer. Whats the difference between these codes: FIRST CODE ArrayList&lt;? super Number&gt; list=new ArrayList&lt;&gt;(Arrays.asList(1)); SECOND CODE ArrayList&lt;? extends Number&gt; list=new ArrayList&lt;&gt;(Arrays.asList(1)); Both statement compiles . Please justify why the former compiles . It shows Integer extends Number and Integer super Number too. EDIT:: The answer I was looking forward to is: new ArrayList(Collection&lt;? extends E&gt;) hence both of them compile. In that way this isn't a duplicate question as the referred answer doesn't describe that.
tagged with: generics
has comment: http://stackoverflow.com/comment/41770573

http://stackoverflow.com/comment/41991460
type: Comment
comment on: http://stackoverflow.com/a/26605344
has text: Oh yes, i didnt notice that. Fine no problem.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26553415
has answer: http://stackoverflow.com/a/26556968
answer count: 1
score: 0
tagged with: paypal-adaptive-payments
accepted answer: http://stackoverflow.com/a/26556968
tagged with: paypal
has body: I am using the PayPal Classic API for Java and Adaptive Payments. It's a Tomcat web app. I am getting a PreApproval from the user up front through the web interface. Once their request is accepted on the back-end, I am processing the payment with PAY in Java. i.e. not in a servlet. It works fine but complains if I do not have the CancelUrl or ReturnUrl defined and valid. Since I am processing the payment in a non-web environment, there is no valid URL and those two options should never be required. Am I missing something? Should I just include a couple of URLs and ignore the fact that it makes no sense? What is the best way to automatically transact preapproved funds based on a status field changing in the database? PayRequest payreq = new PayRequest(); payreq.setCancelUrl(hostURL + "/whydoineedthis.do?&amp;action=cancel"); payreq.setReturnUrl(hostURL + "/whydoineedthis.do?&amp;action=approved");
type: AnsweredQuestion
has title: PayPal Adaptive Payments - background processing
tagged with: java
type: Question

http://stackoverflow.com/q/26527815
has comment: http://stackoverflow.com/comment/41682523
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/1139762
upvote count: 1
downvote count: 1
tagged with: git
has comment: http://stackoverflow.com/comment/41682582
has comment: http://stackoverflow.com/comment/41682764
has comment: http://stackoverflow.com/comment/41682396
tagged with: java
tagged with: eclipse
type: Question
has body: There is /android directory where is set up android project(by eclipse) which tree -a looks like: . ├── AndroidManifest.xml ├── assets ├── bin │ ├── ├── .classpath ├── gen │ ├── ├── .gitignore ├── ic_launcher-web.png ├── libs │ └── ├── lint.xml ├── proguard-project.txt ├── .project ├── project.properties ├── res │ ├── ├── .settings │ ├── └── src └── also in this folder .gitignore is set as: # generated files bin/ gen/ # Eclipse project files .classpath .project The issue is that git does not take into account it. Exampl: every time the .classpath from above directory get modified it is marked under git as a modified. There is one .gitignore over the /android but it is commited as empty. Regards
has comment: http://stackoverflow.com/comment/41682521
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/41682687
linked to: http://stackoverflow.com/q/1139762
has title: .gitignore does not take into account the .classpath file
answer count: 0

http://stackoverflow.com/comment/41891412
comment on: http://stackoverflow.com/q/26642288
score: 4
type: Comment
type: QuestionComment
has text: The vote to close because "this is about English" is a bit flippant. I could ask what a "volatile" field means, and you could say it's just a question about English -- but it's more than that, because `volatile` means something specific in Java. Without knowing the answer to this question, it's similarly plausible that "the Java Universe" is a similarly specific term.

http://stackoverflow.com/q/26566813
tagged with: pojo
has answer: http://stackoverflow.com/a/26687425
score: 4
has answer: http://stackoverflow.com/a/26722367
has body: I would like to create an ORM for lucene. Here is what i am trying to do .I have to make an POJO to map lucene Index. Lets say i have a class public class Users { public String username; public String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } I need to map this class to a lucene index. I have used ORM lite for SQL but here the data source is a custom class which creates index, update etc. Is there any existing solution available or which is the best way to achieve it?.
has answer: http://stackoverflow.com/a/26722916
downvote count: 0
has answer: http://stackoverflow.com/a/26679142
favorite count: 0
has answer: http://stackoverflow.com/a/26736848
answer count: 5
type: UnansweredQuestion
has title: ORM mapping to lucene
tagged with: java
tagged with: orm
type: Question
upvote count: 4

http://stackoverflow.com/a/26610649
downvote count: 0
upvote count: 2
has body: I think the fastest way would be using System.arrayCopy() which is native method: int[] tmp = new int[a]; System.arraycopy(array, array.length - a, tmp, 0, a); System.arraycopy(array, 0, array, a, array.length - a); System.arraycopy(tmp, 0, array, 0, a); It also reuses existing array. It may be beneficial in some cases. And the last benefit is the temporary array size is less than original array. So you can reduce memory usage when a is small.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26610309

http://stackoverflow.com/a/26627636
has body: Before running of mutation testing analysis run mvn test to compile main and test classes (and by the way verify that all tests pass which may affect PIT results). After mvn clean or on a freshly cloned repository PIT doesn't have any classes to mutate and you can get mentioned message. By default PIT plugin for Maven takes groupId as a base package, so for commons-math it is ok to completely omit a configuration section. Also update PIT version to 1.1.0 (or newest when available) to not hit already fixed bugs.
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41866087
accepted answer of: http://stackoverflow.com/q/26621703
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26621703
has comment: http://stackoverflow.com/comment/41866732
upvote count: 3

http://stackoverflow.com/a/26671628
downvote count: 0
has comment: http://stackoverflow.com/comment/41943896
answers question: http://stackoverflow.com/q/26671382
score: 3
accepted answer of: http://stackoverflow.com/q/26671382
type: AcceptedAnswer
has body: As pointed elsewhere, using Strings for SQL statements is dangerous, regarding SQL injections. That being said, you simply have to call the method, and compare the result to a String you build "by hand" : public void testBuildSqlToDoXYZ() throws Exception { WhateverYourObjectIs yourObject = new WhateverYourObjectIs(); MyConfig myConfig = new MyConfig(); myConfig.setABC("foo"); String sql = yourObject.getSqlToDoXYZ(myConfig); assertEquals("SELECT BLAH BLAH WHERE ABC='foo'", sql); } Mockito would only be helpfull in this case if is impossible for you to create a "MyConfig" object by hand. There might be something else in your code that makes that difficult, but you haven't really provided us enough info.
has comment: http://stackoverflow.com/comment/41943647
upvote count: 3
type: Answer

http://stackoverflow.com/comment/41876088
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26632582
has text: Cygwin merely allows to compile linux software for windows by providing a compatibility layer - it can't execute native linux binaries either

http://stackoverflow.com/a/26648040
type: Answer
has comment: http://stackoverflow.com/comment/41911096
answers question: http://stackoverflow.com/q/26646944
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41910554
has body: A possible alternative might be abusing Regex. This is quite performance-intensive with dynamically changing strings, but if you are comparing against constants it could be an alternative: Matcher matcher = Pattern.compile("^" + myOtherString + "$", Pattern.CASE_INSENSITIVE | Pattern.LITERAL | Pattern.UNICODE_CASE).matcher(); if (matcher.matches(myString)) { // ... } This anchors the string you want to compare against, specifies Unicode-aware case-insensitive matching of the Literal string.

http://stackoverflow.com/q/26528519
downvote count: 0
tagged with: servlets
has answer: http://stackoverflow.com/a/26529208
favorite count: 0
has body: I create a dynamic web app project using JSP/Servlet with eclipse. And I want to create a copy of "db.xls" file in the same place. I try to create a copy of the "db.xls", the copy will named out.xls but it won't. These files should be located inside the same folder "files". My code compile, db.xls is correctly read, but file out.xls is not created. What's wrong with my method ? Please help ! public void readExcel() { try{ ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url1 = classLoader.getResource(""); // read db.xls wbook = Workbook.getWorkbook(new File(url1.getPath()+"/db.xls")); // create a copy of db.xls nammed out.xls wwbCopy = Workbook.createWorkbook(new File(url1.getPath()+"/out.xls"), wbook); shSheet = wwbCopy.getSheet(0); } catch(Exception e) { e.printStackTrace(); } } I move the file "db.xls" inside WEB-INF and use getServletContext().getRealPath("/WEB-INF") but the output file "out.xls" still not created. public void readExcel() { try{ // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // URL url1 = classLoader.getResource(""); String tomcatRoot = getServletContext().getRealPath("/WEB-INF"); wbook = Workbook.getWorkbook(new File(tomcatRoot+"/db.xls")); wwbCopy = Workbook.createWorkbook(new File(tomcatRoot+"/out.xls"), wbook); shSheet = wwbCopy.getSheet(0); } catch(Exception e) { e.printStackTrace(); } }
accepted answer: http://stackoverflow.com/a/26529497
linked to: http://stackoverflow.com/q/24759551
upvote count: 2
has answer: http://stackoverflow.com/a/26528771
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26528755
has title: read/copy file inside dynamic web project in java
type: Question
has answer: http://stackoverflow.com/a/26529497
possible better answer: http://stackoverflow.com/a/26528755

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/26538703

http://stackoverflow.com/q/26564144
has body: I'm building an application and i am trying to find a way to get data from one class to another class. in my main class called Driver, i have a function which throws two dices and then i get a sum of them. This function is created in a class called Dices. I have a new class called Players, where i need to get the data from the dice throw from my main class. The code is the following public class Player { public String spillernavn; public int pos; public String SpillerNavn() { return spillernavn; } public int move(int steps){ move=??; pos=steps+pos; return ??; } public int SpillerPos() { return pos; } } The Methode public int move(int steps){} is where i need to use the data from the dice throw and then make the addition with the pos, which stands for position. The main function is the following public static void main(String[] args) { //Intializing dices Dice die1 = new Dice(); Dice die2 = new Dice(); //Summ of dice int sum = die1.throwDice() + die2.throwDice();
has comment: http://stackoverflow.com/comment/41747971
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26564301
upvote count: 1
has title: Get data from another class
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41747819
tagged with: class
answer count: 2
has answer: http://stackoverflow.com/a/26564218
has comment: http://stackoverflow.com/comment/41747995
accepted answer: http://stackoverflow.com/a/26564301
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26564218

http://stackoverflow.com/comment/41776577
has text: Probably you should attempt some "simplified code," then ask a question here (or ask your professor) when you get stuck on a specific problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26579669
score: 0

http://stackoverflow.com/comment/41772718
type: Comment
comment on: http://stackoverflow.com/a/26577414
type: AnswerComment
has text: I don't know what happened. It works now. Thank you!
score: 0

http://stackoverflow.com/q/26565967
upvote count: 0
has title: Java scanner reading garbage
has answer: http://stackoverflow.com/a/26566102
has comment: http://stackoverflow.com/comment/41751028
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/52841760
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/41751086
tagged with: java.util.scanner
type: Question
downvote count: 2
answer count: 3
accepted answer: http://stackoverflow.com/a/26566102
has answer: http://stackoverflow.com/a/26566077
has comment: http://stackoverflow.com/comment/41751049
tagged with: java
has body: I am reading a text file using java Scanner. try { while(sc.hasNextLine()) { //Read input from file inputLine = sc.nextLine().toUpperCase(); System.out.println(inputLine); } The above gives below output while my text file only includes "aabbcc". How to avoid scanner from scanning the garbage? Thanks. {\RTF1\ANSI\ANSICPG1252\COCOARTF1265\COCOASUBRTF210 {\FONTTBL\F0\FSWISS\FCHARSET0 HELVETICA;} {\COLORTBL;\RED255\GREEN255\BLUE255;} \PAPERW11900\PAPERH16840\MARGL1440\MARGR1440\VIEWW10800\VIEWH8400\VIEWKIND0 \PARD\TX566\TX1133\TX1700\TX2267\TX2834\TX3401\TX3968\TX4535\TX5102\TX5669\TX6236\TX6803\PARDIRNATURAL \F0\FS24 \CF0 AABBCC}
linked to: http://stackoverflow.com/q/5237663
possible better answer: http://stackoverflow.com/a/26566051
has answer: http://stackoverflow.com/a/26566051

http://stackoverflow.com/comment/41695780
type: Comment
has text: Found more information if anyone is interested...http://stackoverflow.com/questions/95635/what-does-a-just-in-time-jit-compiler-do
type: QuestionComment
comment on: http://stackoverflow.com/q/26534739
score: 0

http://stackoverflow.com/comment/41822036
type: AnswerComment
comment on: http://stackoverflow.com/a/26604150
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63758/discussion-between-akhil-and-end-game).
type: Comment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/26671281
tags question: http://stackoverflow.com/q/26639049
tags question: http://stackoverflow.com/q/26608365
tags question: http://stackoverflow.com/q/26558413
tags question: http://stackoverflow.com/q/26533845
tags question: http://stackoverflow.com/q/26628914
tags question: http://stackoverflow.com/q/26646894
tags question: http://stackoverflow.com/q/26634412
tags question: http://stackoverflow.com/q/26637045
tags question: http://stackoverflow.com/q/26598223
tags question: http://stackoverflow.com/q/26592811
tags question: http://stackoverflow.com/q/26668982
tags question: http://stackoverflow.com/q/26644649
tags question: http://stackoverflow.com/q/26549608
tags question: http://stackoverflow.com/q/26607202
tags question: http://stackoverflow.com/q/26554015
tags question: http://stackoverflow.com/q/26631515
tags question: http://stackoverflow.com/q/26514305
tags question: http://stackoverflow.com/q/26527774
tags question: http://stackoverflow.com/q/26584974
type: Tag
tags question: http://stackoverflow.com/q/26662066
tags question: http://stackoverflow.com/q/26611084
tags question: http://stackoverflow.com/q/26672189
tags question: http://stackoverflow.com/q/26604179
tags question: http://stackoverflow.com/q/26578103
tags question: http://stackoverflow.com/q/26597509
tags question: http://stackoverflow.com/q/26655778
tags question: http://stackoverflow.com/q/26538976
tags question: http://stackoverflow.com/q/26570736
tags question: http://stackoverflow.com/q/26624627
tags question: http://stackoverflow.com/q/26610561
tags question: http://stackoverflow.com/q/26515733
tags question: http://stackoverflow.com/q/26650380
tags question: http://stackoverflow.com/q/26564594
tags question: http://stackoverflow.com/q/26551756
tags question: http://stackoverflow.com/q/26668669
tags question: http://stackoverflow.com/q/26632819
tags question: http://stackoverflow.com/q/26529118
tags question: http://stackoverflow.com/q/26633498
tags question: http://stackoverflow.com/q/26638691
tag name: html
tags question: http://stackoverflow.com/q/26584224
tags question: http://stackoverflow.com/q/26561498
tags question: http://stackoverflow.com/q/26574284
tags question: http://stackoverflow.com/q/26599985
tags question: http://stackoverflow.com/q/26626980
tags question: http://stackoverflow.com/q/26574096
tags question: http://stackoverflow.com/q/26657104
tags question: http://stackoverflow.com/q/26609189
tags question: http://stackoverflow.com/q/26542190

http://stackoverflow.com/comment/41898023
score: 0
type: Comment
type: QuestionComment
has text: You should write the code yourself.
comment on: http://stackoverflow.com/q/26646163

http://stackoverflow.com/a/26577055
has comment: http://stackoverflow.com/comment/41771707
score: 0
answers question: http://stackoverflow.com/q/26576953
type: Answer
has comment: http://stackoverflow.com/comment/41772615
has comment: http://stackoverflow.com/comment/41772260
has comment: http://stackoverflow.com/comment/41771768
has comment: http://stackoverflow.com/comment/41771834
has comment: http://stackoverflow.com/comment/41772073
has body: Since you are using a process builder, and you don't specify anything about the environment, is there a chance that your JAR file can't find needed elements (like JVM location or classpath) because it's not getting an environmental variable?
has comment: http://stackoverflow.com/comment/41772726
has comment: http://stackoverflow.com/comment/41772165

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/26630799

http://stackoverflow.com/a/26566971
answers question: http://stackoverflow.com/q/26566803
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41753233
type: Answer
accepted answer of: http://stackoverflow.com/q/26566803
has comment: http://stackoverflow.com/comment/41753294
has body: The boat is always being hit because the declaration of frigate is: frigate = {board[1][1], board[1][2]} , which is ultimately assigning the string '[ ]' to both values of the frigate. This is then being compared to more empty strings, when you are looking for the frigate and comparing the values. This can be fixed by making a board of position x in [1,2,3,4, n] and y in [A,B,C...,Letter_n]. That is, the coordinates of the frigate would be Frigate.x = 1 and Frigate.y = A. I hope this helps! I saw your further question of how to implement this. I would make Frigate a class that has a list of coordinates: this.x as one point either Letter or Number this.y as one point Not of type this.x as in your example The tuple (this.x, this.y) would work nice in your list Frigate Do the same for any other points in the list Frigate. After the list Frigate has been completed, then two more things have to be changed. The first thing that has be changed is how to check if the user is calling things in the scope that you want. The second thing that has to be changed is how to make sure the same point isn't being called over and over again to 'blow up' a ship. That is, when a point in Frigate gets called, then it should be removed from Frigate. The remaining tuples in Frigate are going to be the 'health' of 'hit points' left on Frigate. To recall the original size of Frigate, an addition of Frigate.initialSize() would be very handy, but this could be later down the road.

http://stackoverflow.com/q/26604337
linked to: http://stackoverflow.com/q/1394265
score: 0
has comment: http://stackoverflow.com/comment/41821867
duplicate of: http://stackoverflow.com/q/1394265
answer count: 1
has answer: http://stackoverflow.com/a/26604370
has comment: http://stackoverflow.com/comment/41821565
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26604370
type: Question
tagged with: jakarta-ee
has title: Is java bean and java pojo same?
has body: Is java beanand java POJO same thing or there are differences?
tagged with: java

http://stackoverflow.com/comment/41734513
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26556466
has text: ok but i want that in db is stored null when data is null

http://stackoverflow.com/a/26615839
answers question: http://stackoverflow.com/q/26598235
type: Answer
has body: I'm not sure WHY this was working with the hardware keyboard, but I found that the reason it wasn't working with the virtual keyboard was that I needed to set the text TextView through the custom adapter vs. setting it directly.
score: 0

http://stackoverflow.com/comment/41695213
comment on: http://stackoverflow.com/q/26534513
score: 0
has text: **Never** store some kind of state in spring MVC controllers, what do you expect, how do you fetch the jsp (if with a browser, wich one && did you refresh the page)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/49137130
type: Comment
has text: Check history in the repo, it was previously unified.
score: 1
comment on: http://stackoverflow.com/a/26553818
type: AnswerComment

http://stackoverflow.com/q/26667319
has title: When is a Jersey Rest service actually started/closed?
has body: So I have a Jersey REST service on a Tomcat server that takes client requests, processes them with an Entity Manager to get data from a database, then sends back a response to the client. So my question is, when is my REST class (containing the URL paths and such) created/destroyed? Is it created fresh with every new AJAX request or does it stay running and open on the server indefinitely? Thanks!
tagged with: tomcat
tagged with: ajax
tagged with: rest
type: Question
accepted answer: http://stackoverflow.com/a/26667723
score: 0
tagged with: java
answer count: 1
tagged with: jersey
has answer: http://stackoverflow.com/a/26667723
type: AnsweredQuestion

http://stackoverflow.com/a/26662492
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26617649
has body: While it is true adding more consumers may speed things up the real issue will be saving to the database. There are already many answers here that talk about adding consumers (threads, and or machines) and changing the QoS so I'm not going to reiterate that. Instead you should seriously consider using the Aggregator pattern to aggregate the messages into a group of messages and then batch insert the group into your database in one shot. Your current code for each message probably opens up a connection, inserts the data, and the closes that connection (or return to the pool). Worse it may even be using transactions. By using the aggregator pattern your essentially buffering the data before you flush. Now writing a good aggregator is tricky. You will need to decide how you want to buffer (ie each worker has its own buffer or a central buffer like Redis). Spring integration has an aggregator I believe.

http://stackoverflow.com/a/56532729
answers question: http://stackoverflow.com/q/26548505
score: 2
upvote count: 2
downvote count: 0
type: Answer
has body: I had the same issue and after debugging it turns out that Spring application.properties had wrong IP address for DB server spring.datasource.url=jdbc:oracle:thin:@WRONG:1521/DEV

http://stackoverflow.com/q/26656774
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/26659736
tagged with: ecj
tagged with: java
has answer: http://stackoverflow.com/a/26656965
has title: Why does Eclipse let me compile some Java 7 language features into Java 6 class files?
type: Question
upvote count: 5
tagged with: eclipse
has body: I have found that in Eclipse (using the Eclipse compiler) I can use some Java 7 language features but still create Java 6 class files. In the below image, you can see two Java 7 language features that are successfully compiled as a Java 6 class file. However, other Java 7 features, those commented out, do not compile. My assumption is that Eclipse is determining which Java 7 language features are compatible with the Java 6 JVM and which are not. For example, the generic type JComboBox is just a compilation (and not runtime) feature, so I can imagine how it would be compatible. The switch String feature though I would think might make differences in byte code and rely on new JVM features, but I could be wrong... My questions: Is Eclipse really smart enough to know which Java 7 language features are capable of being compiled into Java 6 class files and which are not? The example below is clearly not 1.6 source compatible, so why does setting "Source compatibility" to 1.6 not cause an error? This "trick" appears to let me use at least some Java 7 language features and still create Java 6 class files. Using javac with source 1.7 and target 1.6 would fail, so why does this work? Does the Ecilpse compiler have a feature that javac does not? For the sake of comparison here is the result when I switch to a Java 6 compiler, as expected.
score: 5
downvote count: 0
linked to: http://stackoverflow.com/q/3061654
has answer: http://stackoverflow.com/a/26657497
favorite count: 0
has answer: http://stackoverflow.com/a/26659290

http://stackoverflow.com/q/26554722
has comment: http://stackoverflow.com/comment/41731253
has body: So I need to add an array of strings, into a two dimensional array called squares. The array squares is a 10 by 10 array in which the first row of initStrings will match up with squares. IE - static String[] strings = {"hello"} The h would be in the first location of the squares array, the e would be in the second and so on. Im wondering how to do this. static String[] initStrings = { "...../...\\", "..\\.......", "......./..", "..........", "........\\.", "..........", "..........", ".....\\../.", "..\\....../", ".........." }; I know that I need to have a nested for loop. Something along the lines of for (col = 0; col &lt; 10; col++) { for (rows = 0; rows &lt; 10; rows ++) { // what goes here? } }
tagged with: java
has comment: http://stackoverflow.com/comment/41731227
has answer: http://stackoverflow.com/a/26554960
has comment: http://stackoverflow.com/comment/41731578
has answer: http://stackoverflow.com/a/26554782
has answer: http://stackoverflow.com/a/26556632
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26554960
linked to: http://stackoverflow.com/q/26538139
tagged with: multidimensional-array
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26554782
has comment: http://stackoverflow.com/comment/41731271
type: Question
duplicate of: http://stackoverflow.com/q/26538139
score: 0
answer count: 3
has title: Adding an array of strings into a 2D array

http://stackoverflow.com/comment/41910862
has text: Have a look at https://github.com/spidasoftware/format too. It's a command line version which is probably easier to understand.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26653836
type: AnswerComment

http://stackoverflow.com/a/26593414
answers question: http://stackoverflow.com/q/26593311
score: 1
has body: The problem is not at line A instance = new A(a); The problem is that, as you haven't defined any constructor in Test, the compiler is supposed to provide one of the following form: Test() { super(); } But it can't because the superclass (A) doesn't have any default constructor. So, you need to provide a constructor explivitely: Test() { super(0); } or Test(int i) { super(i); } for example.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26555296
answers question: http://stackoverflow.com/q/26554716
score: 0
has body: Regarding UDP sockets: reading a UDP socket is not the same as reading a TCP socket. You either get the UDP packet or you do not. From UDP: Datagrams – Packets are sent individually and are checked for integrity only if they arrive. Packets have definite boundaries which are honored upon receipt, meaning a read operation at the receiver socket will yield an entire message as it was originally sent. So for UDP, you do not need to worry about reading an incorrect number of bytes. But you do have to worry about what happens if some data does not arrive, or if it arrives in a different order than it was sent.
type: Answer

http://stackoverflow.com/a/26517811
has comment: http://stackoverflow.com/comment/41665647
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41665682
accepted answer of: http://stackoverflow.com/q/26517703
has body: The println has to be after all loop. public class ThreeDimensionalArray { public static void main(String[] args) { int[][][] array = new int[4][5][6];//initializing array int sum=0;//define sum for(int[][] i: array)//start of enhanced for loop { for(int[] j: i) for(int k:j) sum +=[k]; }//end enhanced for loop System.out.println("Output is",sum);//output sum }//end method main //end ThreeDimensionalArray }
has comment: http://stackoverflow.com/comment/41668972
type: Answer
answers question: http://stackoverflow.com/q/26517703
has comment: http://stackoverflow.com/comment/41665761
score: 0
has comment: http://stackoverflow.com/comment/41666046

http://stackoverflow.com/a/26579452
answers question: http://stackoverflow.com/q/26579411
score: 0
has body: First I hope you are using Java 7. If not (or if you want to just simplify it) you can use char instead of String in your switch statements. Also at the same time you are setting cardClas in both switch statements. Also your method getClasses returns cardType and your getCardType returns cardClas
type: Answer

http://stackoverflow.com/q/26526799
answer count: 4
type: UnansweredQuestion
has title: java: justifying existence of different Exception classes
has comment: http://stackoverflow.com/comment/41680723
tagged with: java
has answer: http://stackoverflow.com/a/26526883
type: Question
has answer: http://stackoverflow.com/a/26526979
has answer: http://stackoverflow.com/a/26526902
has comment: http://stackoverflow.com/comment/41681908
has comment: http://stackoverflow.com/comment/41681168
score: 0
has body: Assume during app development you created 5 different exception classes to use throughout your code. You then noticed, that all of these exceptions are handled in the same way. Say all you do for all 5 exceptions, when they're caught, you log a message. There's nothing else you're doing (or can do) to recover from the exception being thrown. The question is: Is the same handling a good enough reason to replace all 5 different exception classes with one. Or is there some real value in having 5 different exceptions because their names (the names of the exception classes) can help to understand the problem and ease debugging or any other reason.... Or to rephrase it: When you create a new exception class in your code, is it when you can see that there can be a unique handling of this exception in the code or is it to aptly describe the problem with the exception class name?
tagged with: exception
has answer: http://stackoverflow.com/a/26527074

http://stackoverflow.com/comment/41801274
type: AnswerComment
score: 0
type: Comment
has text: Pls create a new question on this topic .. Since I haven't used oracle in Mule .. I can't help much .. But other people can help you here on this new topic
comment on: http://stackoverflow.com/a/26592215

http://stackoverflow.com/comment/41815571
has text: Is the first index supposed to be the row or column index?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26600778
type: Comment

http://stackoverflow.com/comment/41894132
score: 0
type: AnswerComment
type: Comment
has text: Using your edited method, the program no longer accepts "quit" as the exit string
comment on: http://stackoverflow.com/a/26643791

http://stackoverflow.com/q/26566561
tagged with: jersey
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41760324
upvote count: 3
tagged with: rest
downvote count: 0
tagged with: wildfly
has comment: http://stackoverflow.com/comment/41759981
tagged with: http
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26571805
has title: Jersey error on @DELETE: "Unsupported HTTP method: DELETE"
accepted answer: http://stackoverflow.com/a/26571805
type: Question
has body: I do RESTful application in Jersey (deployed on WildFly 8.1.0.Final) but I have a problem with testing methods @DELETE. All other (GET, POST, PUT) work as expected. However, when calling @DELETE I receive the following error message Cross-Origin Resource Sharing (CORS) Filter: Unsupported HTTP method: DELETE I test RESTful interface via a plugin in Google Chrome: Advanced REST Client. How can I fix it? Resource class: I deleted other methods for better clarity. @Path(value = "destination") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public class DestinationResource { public DestinationResource() {} @DELETE @Path(value = "/{id}") public Response deleteDestination(@PathParam("id") Long id) { //Doing something return Response.status(Response.Status.OK).build(); } } EDIT: I added CORS.filter but still nopt working. Here is my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> Jersey Web Application com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.api.json.POJOMappingFeature true 1 Jersey Web Application /rest/* resteasy.scan false resteasy.scan.providers false resteasy.scan.resources false CORS com.thetransactioncompany.cors.CORSFilter cors.allowGenericHttpRequests true cors.allowOrigin * cors.allowSubdomains false cors.supportedMethods GET, HEAD, POST, PUT, OPTIONS cors.supportedHeaders * cors.exposedHeaders X-Count-records cors.supportsCredentials true cors.maxAge 3600 CORS /*

http://stackoverflow.com/comment/41670272
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26520459
has text: Make you vehicle class static like i said

http://stackoverflow.com/comment/41820747
score: 0
comment on: http://stackoverflow.com/q/26603420
type: Comment
type: QuestionComment
has text: My aggregator does not use the parent. But all child modules do use the parent. Is this what is missing? I thought that if child has the parent than it always has to be included in the build. I called the builds using netbeans build. In all cases. I presume this just runs install goal on the project. In the case of aggregation module this runs build recursively on submodules.

http://stackoverflow.com/comment/41855692
comment on: http://stackoverflow.com/q/26621568
has text: @DustinF The print you are talking about is simply just a string I print out. The print that i was reffering to that works is System.out.println(line); I do this so that I know the file is being read line by line, and as I said this works fine
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26551562
linked to: http://stackoverflow.com/q/513832
downvote count: 0
answer count: 1
has body: Im having trouble with an IF statement which is to check to see if there is a value in an array or not, and if not then +1 to be added to InvalidLine. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Assignment { public static void main(String[] args) throws FileNotFoundException { Scanner scan = new Scanner(new File("../Text.txt")); String line; while (scan.hasNext()) { line = scan.nextLine(); String[] elements = line.split(":"); System.out.println("The line has " + elements.length + " elements."); for (int i = 0; i &lt; elements.length; i++) { System.out.println("Element " + (i + 1) + " was : " + elements[i]); int InvalidLine = 0; if (elements[i] == "");{ Invalid++; } System.out.println("Invalid Fields " + InvalidLine); } } } } When the output generates, +1 is added to InvalidLine even though in some cases there is no data in the [1]array The line had 4 elements. Element 1 was : 1 Element 2 was : biscuits 1 Element 3 was : 3 1 Element 4 was : 4 1 The line had 4 elements. Element 1 was : Coffee 1 Element 2 was : Cake 1 Element 3 was : 3 1 Element 4 was : 6 1
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has answer: http://stackoverflow.com/a/26551598
accepted answer: http://stackoverflow.com/a/26551598
type: AnsweredQuestion
has title: Check if there is data in an array slot
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41725284

http://stackoverflow.com/comment/41874415
has text: @Tom just replaced the systemout.println(result); with textField.setText(result); and is not working. that's why i asked for help with this. ok then JTextPane but how
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26633061

http://stackoverflow.com/a/26598541
has comment: http://stackoverflow.com/comment/41811704
score: 13
has comment: http://stackoverflow.com/comment/41811868
has body: If you're talking about it being -1 at the end of the loop; it's just because int is signed and it wraps around. int foo = 1; while (foo &gt;= 0) { foo += foo + 1; } System.out.println(foo); Will output -1. You can trace through it: foo += 1 + 1 ---&gt; 3 foo += 3 + 1 ---&gt; 7 foo += 7 + 1 ---&gt; 15 foo += 15 + 1 ---&gt; 31 foo += 31 + 1 ---&gt; 63 foo += 63 + 1 ---&gt; 127 foo += 127 + 1 ---&gt; 255 foo += 255 + 1 ---&gt; 511 foo += 511 + 1 ---&gt; 1023 foo += 1023 + 1 ---&gt; 2047 foo += 2047 + 1 ---&gt; 4095 foo += 4095 + 1 ---&gt; 8191 foo += 8191 + 1 ---&gt; 16383 foo += 16383 + 1 ---&gt; 32767 foo += 32767 + 1 ---&gt; 65535 foo += 65535 + 1 ---&gt; 131071 foo += 131071 + 1 ---&gt; 262143 foo += 262143 + 1 ---&gt; 524287 foo += 524287 + 1 ---&gt; 1048575 foo += 1048575 + 1 ---&gt; 2097151 foo += 2097151 + 1 ---&gt; 4194303 foo += 4194303 + 1 ---&gt; 8388607 foo += 8388607 + 1 ---&gt; 16777215 foo += 16777215 + 1 ---&gt; 33554431 foo += 33554431 + 1 ---&gt; 67108863 foo += 67108863 + 1 ---&gt; 134217727 foo += 134217727 + 1 ---&gt; 268435455 foo += 268435455 + 1 ---&gt; 536870911 foo += 536870911 + 1 ---&gt; 1073741823 foo += 1073741823 + 1 ---&gt; 2147483647 foo += 2147483647 + 1 ---&gt; -1 The math just works out that way. Each iteration results in a value that is 1 less than a power of 2. I guess if you worked out the algebra you could show this. So it makes sense that it would hit -1, which, in a 32-bit signed int, is 232-1. Then as tom and Tomáš Zíma astutely point out, it gets stuck because -1 + -1 + 1 is still just -1. Also note, as tom discovered in comments below, that you'll hit -1 no matter what number you start with. This is because foo += foo + 1 is the same as foo = 2 * foo + 1, which is really just foo = (foo &lt;&lt; 1) | 1 (left shift [results in low bit 0] then turn on low bit - same as adding 1 when the number is even). So no matter what you start with, after at most 32 (or however many bits there are) iterations, you will eventually have sh…
answers question: http://stackoverflow.com/q/26598481
has comment: http://stackoverflow.com/comment/41811792
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26598481
has comment: http://stackoverflow.com/comment/41811748
has comment: http://stackoverflow.com/comment/41811900
has comment: http://stackoverflow.com/comment/41814159
type: Answer
upvote count: 13

http://stackoverflow.com/a/26632805
upvote count: 1
type: AcceptedAnswer
has body: I wasn't able to find an efficient way of doing it. The best I managed was static &lt;T&gt; Stream&lt;T&gt; symmetricDifference(Stream&lt;T&gt; stream1, Stream&lt;T&gt; stream2) { Set&lt;T&gt; elements1 = stream1.collect(Collectors.toSet()); Set&lt;T&gt; elements2 = stream2.collect(Collectors.toSet()); Set&lt;T&gt; result = new HashSet&lt;T&gt;(elements1); result.addAll(elements2); elements1.retainAll(elements2); result.removeAll(elements1); return result.stream(); } which is probably the solution you already came up with. Even when trying to use stream operations to come up with the symmetric difference, I found myself having to produce lots of temporary streams and sets in order to get over the problem that I have to iterate over the streams multiple times. Here is a version that produces a Stream containing the symmetric difference, using only stream operations. You can see that it is far more inefficient. static &lt;T&gt; Stream&lt;T&gt; disjointStream(Stream&lt;T&gt; stream1, Stream&lt;T&gt; stream2) { Set&lt;T&gt; elements1 = stream1.collect(Collectors.toSet()); Set&lt;T&gt; elements2 = stream2.collect(Collectors.toSet()); Set&lt;T&gt; elementsIn1Notin2 = elements1.stream().filter(t -&gt; !elements2.stream().anyMatch(Predicate.isEqual(t))).collect(Collectors.toSet()); Set&lt;T&gt; elementsIn2Notin1 = elements2.stream().filter(t -&gt; !elements1.stream().anyMatch(Predicate.isEqual(t))).collect(Collectors.toSet()); return Stream.concat(elementsIn1Notin2.stream(), elementsIn2Notin1.stream()); } I'm putting this up because I'd be interested to see how it can be improved while retaining only stream operations (no Set or Collection operations apart from Collection.stream()); and also how my clunky syntax can be improved. As an aside, for people who are just getting into Java 8 and wondering where these classes are, my imports are: import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util…
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26547286
answers question: http://stackoverflow.com/q/26547286

http://stackoverflow.com/q/26574138
score: 9
type: Question
has comment: http://stackoverflow.com/comment/41769803
tagged with: android-toolbar
upvote count: 9
has body: Is there a way to make the new Android support Toolbar: android.support.v7.widget.Toolbar Have a transparent background? I tried setting the colorPrimary to an ARGB (#00ffffff) but it just gives me a solid gray bar. And Toolbar only allows me to set a background drawable. Is it kosher to set the background drawable to a transparent PNG, or is there a better way to do this? Ideally I'd be able to do it in code / animate it so certain activities have a transparent bar and some activities don't. Thanks in advance.
has title: How to make the support Toolbar background transparent?
possible better answer: http://stackoverflow.com/a/28931666
answer count: 2
has answer: http://stackoverflow.com/a/26574413
has answer: http://stackoverflow.com/a/28931666
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/26490126
tagged with: android
accepted answer: http://stackoverflow.com/a/26574413
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/64706964
type: Comment
comment on: http://stackoverflow.com/a/30230023
score: 0
type: AnswerComment
has text: Now I Correct this @Mistalis. Thank you

http://stackoverflow.com/comment/41783611
has text: We need the code to reproduce and solve your problem. Stackoverflow is about facts, not faith. Thanks.
score: 0
comment on: http://stackoverflow.com/q/26583586
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41865451
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26628172
type: Comment
has text: Ah ok, so following this...I can now register clicks. But my problem is, is that I do not want to manually create 30+ buttons....is this the only way to do it?

http://stackoverflow.com/comment/41869484
type: Comment
has text: This is really a great answer. I had even attempted the <type> specification. I have read most of the specifications, but it is hard to remember it all before seing their practical use :). This means that my intuitions are right, to add just a parent, and not all transative dependencies, and that my error is indeed coming from somewhere else :) I'm pretty sure maven will prove worth the time spent learning it! Thank you :)
comment on: http://stackoverflow.com/a/26627318
type: AnswerComment
score: 0

http://stackoverflow.com/q/26590542
has body: I am using ProgressDialog. I need to stop the thread when a user closes the ProgressDialog. Unfortunately, it is giving an exception. In inner class: class UpdateThread extends Thread{ public void run() { while (true){ count=adapter.getCount(); try { mHandler.post( new Runnable() { public void run() { Log.i(TAG,count+"count"); progressDialog.setMessage(count + "Device found"); } }); Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } } } } Oncreate: updateThread=new UpdateThread(); progressDialog= new ProgressDialog(GroupListActivity.this); synchronized (this) { updateThread.start(); } Ondismissal: progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { try { synchronized (this) { updateThread.wait(300); } } catch (InterruptedException e) { e.printStackTrace(); } Log.i(TAG,"Thread is stopped"); } });
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/41800783
score: 52
downvote count: 0
has answer: http://stackoverflow.com/a/26593239
possible better answer: http://stackoverflow.com/a/26590703
has answer: http://stackoverflow.com/a/26590703
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41801220
accepted answer: http://stackoverflow.com/a/26593239
tagged with: android
favorite count: 0
type: Question
upvote count: 52
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41801556
has comment: http://stackoverflow.com/comment/41801005
linked to: http://stackoverflow.com/q/7126550
has title: java.lang.IllegalMonitorStateException: object not locked by thread before wait()?
has answer: http://stackoverflow.com/a/26593399

http://stackoverflow.com/comment/41914846
comment on: http://stackoverflow.com/a/26655893
score: 0
type: Comment
type: AnswerComment
has text: This is nice. I did these changes and it works well. Just that now in my normal Java code if there is a <= it also will get replaced. Any solutions which you can think of ?

http://stackoverflow.com/comment/41856284
has text: Can i use out.write() for an Arraylist ?
comment on: http://stackoverflow.com/q/26606089
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40032875
score: 5
downvote count: 0
has body: In Activit.XML add the code &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/editText" android:hint="Informe o usuário" android:backgroundTint="@android:color/transparent"/&gt; Where BackgroundTint=color for your desired colour
type: Answer
answers question: http://stackoverflow.com/q/26574328
upvote count: 5

http://stackoverflow.com/a/35809269
type: Answer
answers question: http://stackoverflow.com/q/26582312
has body: You grab the default printer with PrintService myService = PrintServiceLookup.lookupDefaultPrintService(); But then you toss it away with job.setPrintService(choosePrinter()); If you want the default printer, use it. If not, prompt. If you only want to prompt the first time, well, then you have a data persistence problem and you should be storing your preferences somewhere and then re-loading them at a later time. When you load them, use your PrintServiceLookup.lookupPrintServices to match, set print service, etc.
score: 0

http://stackoverflow.com/a/26572992
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26572250
has comment: http://stackoverflow.com/comment/41766815
has body: Ceylon achieves this with union types. Since this language exists on the JVM stack this means there are no technical limitations that would disallow such a feature (nor can I think of such a limitation). Nevertheless, one might argue that such a feature is less desirable, especially when the language supports mixins/traits/default methods. Personally I prefer the usage of the interface segregation principle and the usage of intersection types. That is much cleaner in terms of readability and maintainability. Of course this is not always possible, especially when working with third party libraries. Therefore it is not a bad idea (I guess the guys at Redhat also thought so). So to combine both arguments into an answer to your question: Is there any stronger reason than "not implemented"? There is no technical limitation, but it is not a great idea, therefore it has not been a priority, and it probably will not be for a long time.
downvote count: 0

http://stackoverflow.com/comment/41932962
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26665563
has text: This question appears to be off-topic because it is lazy.

http://stackoverflow.com/a/26562347
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41745082
accepted answer of: http://stackoverflow.com/q/26562190
has comment: http://stackoverflow.com/comment/41744883
has comment: http://stackoverflow.com/comment/41745227
answers question: http://stackoverflow.com/q/26562190
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41744786
has comment: http://stackoverflow.com/comment/41745097
has body: In order to resolve ${...} placeholders in &lt;bean&gt; definitions or @Value annotations using properties from a PropertySource, you must register a PropertySourcesPlaceholderConfigurer. This happens automatically when using &lt;context:property-placeholder&gt; in XML, but must be explicitly registered using a static @Bean method when using @Configuration classes. The method must be static for the PropertySourcesPlaceholderConfigurer Because BeanFactoryPostProcessor (BFPP) objects must be instantiated very early in the container lifecycle, they can interfere with processing of annotations such as @Autowired, @Value, and @PostConstruct within @Configuration classes. Adding this to your application class should do the trick : @Bean public static PropertySourcesPlaceholderConfigurer pspc() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); return pspc; } From the PropertySource documentation. EDIT Have you try to Put the PropertySourcesPlaceholderConfigurer in the AppStarter class. Move the PropertySource annotation to the AppStarter class. Remove the Configuration annotation on the PropertyLoader. Remove the propertyLoader method annotated with Bean. The problem is probably related to the fact that the PropertyLoader is a component and a configuration class.

http://stackoverflow.com/comment/41672724
has text: Two files containing a class with the main method and another class used within the main method represent a single program. You could compare that with a machine made-up of different parts.
score: 0
comment on: http://stackoverflow.com/q/26521810
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41767331
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26560009
has text: @MadProgrammer i need 15 reputation to up the answers..i have only 9 tilll now

http://stackoverflow.com/comment/41682950
type: AnswerComment
has text: No, the resolution behaves the same as with all other classes. See [my answer](http://stackoverflow.com/a/26528180/2711488)…
type: Comment
comment on: http://stackoverflow.com/a/26526225
score: 1

http://stackoverflow.com/q/26579580
tagged with: duplicates
has comment: http://stackoverflow.com/comment/41776985
type: Question
has comment: http://stackoverflow.com/comment/41776354
has answer: http://stackoverflow.com/a/26579596
tagged with: arrays
has comment: http://stackoverflow.com/comment/41776328
score: 0
possible better answer: http://stackoverflow.com/a/26582385
answer count: 3
has body: I'm working on an assignment and I need to throw an exception if the user entry already exists in the array but I can't get it to work. I have to use an array and it can't be an arrayList. If the entry doesn't exist in the array it should be added. Here is what I have so far: try { boolean duplicates = false; num = Integer.parseInt(inputField.getText()); for (int i = 0; i &lt; index; i++){ if (num == (array[i])) { duplicates = true; } } array[index] = num; index++; if(!duplicates){ throw new DuplicateValueException();} } // end try Thanks!
has comment: http://stackoverflow.com/comment/41776495
has answer: http://stackoverflow.com/a/26582451
has title: Avoiding duplicate user entries in array
has comment: http://stackoverflow.com/comment/41792423
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26582385
accepted answer: http://stackoverflow.com/a/26579596
tagged with: java

http://stackoverflow.com/a/26650761
score: -2
answers question: http://stackoverflow.com/q/26650225
has body: When inserting a byte array into a JSONObject the toString() method is invoked. public static void main(String... args) throws JSONException{ JSONObject o = new JSONObject(); byte[] b = "hello".getBytes(); o.put("A", b); System.out.println(o.get("A")); } Example output: [B@1bd8c6e so you have to store it in a way that you can parse the String into the original datatype.
type: Answer
upvote count: 0
downvote count: 2

junit
type: Tag
tags question: http://stackoverflow.com/q/26595695
tags question: http://stackoverflow.com/q/26638012
tags question: http://stackoverflow.com/q/26559731
tags question: http://stackoverflow.com/q/26626291
tags question: http://stackoverflow.com/q/26592856
tags question: http://stackoverflow.com/q/26662309
tags question: http://stackoverflow.com/q/26531547
tags question: http://stackoverflow.com/q/26555408
tags question: http://stackoverflow.com/q/26611027
tags question: http://stackoverflow.com/q/26550752
tags question: http://stackoverflow.com/q/26642165
tags question: http://stackoverflow.com/q/26521595
tags question: http://stackoverflow.com/q/26658648
tags question: http://stackoverflow.com/q/26572023
tags question: http://stackoverflow.com/q/26539094
tags question: http://stackoverflow.com/q/26546618
tags question: http://stackoverflow.com/q/26554415
tags question: http://stackoverflow.com/q/26535922
tags question: http://stackoverflow.com/q/26517404
tags question: http://stackoverflow.com/q/26553307
tags question: http://stackoverflow.com/q/26651032
tag name: junit
tags question: http://stackoverflow.com/q/26540438
tags question: http://stackoverflow.com/q/26513855
tags question: http://stackoverflow.com/q/26604220
tags question: http://stackoverflow.com/q/26667649
tags question: http://stackoverflow.com/q/26595452
tags question: http://stackoverflow.com/q/26589193
tags question: http://stackoverflow.com/q/26672229
tags question: http://stackoverflow.com/q/26657260
tags question: http://stackoverflow.com/q/26586239
tags question: http://stackoverflow.com/q/26514862
tags question: http://stackoverflow.com/q/26647814
tags question: http://stackoverflow.com/q/26630354
tags question: http://stackoverflow.com/q/26652943
tags question: http://stackoverflow.com/q/26640536
tags question: http://stackoverflow.com/q/26616867
tags question: http://stackoverflow.com/q/26629706
tags question: http://stackoverflow.com/q/26638906

http://stackoverflow.com/q/26594742
upvote count: 1
has comment: http://stackoverflow.com/comment/41805188
downvote count: 1
type: Question
tagged with: java
has body: I am new here, I would like to get help, this is an activity from an Android programming course. I will post the files that I have to implement. ToDoManagerActivity.java package course.labs.todomanager; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.text.ParseException; import java.util.Date; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import course.labs.todomanager.ToDoItem.Priority; import course.labs.todomanager.ToDoItem.Status; public class ToDoManagerActivity extends ListActivity { private static final int ADD_TODO_ITEM_REQUEST = 0; private static final String FILE_NAME = "TodoManagerActivityData.txt"; private static final String TAG = "Lab-UserInterface"; // IDs for menu items private static final int MENU_DELETE = Menu.FIRST; private static final int MENU_DUMP = Menu.FIRST + 1; ToDoListAdapter mAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create a new TodoListAdapter for this ListActivity's ListView mAdapter = new ToDoListAdapter(getApplicationContext()); // Put divider between ToDoItems and FooterView getListView().setFooterDividersEnabled(true); // TODO - Inflate footerView for footer_view.xml file // VER LUEGO!!!!! TextView footerView = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null); // TODO - Add footerView to ListView getListView().addFooterView(footerView); footerView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.i(TAG,"Entered footerView.OnClickListener.onCl…
tagged with: listview
score: 0
tagged with: crash
has comment: http://stackoverflow.com/comment/41804463
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/41804364
has answer: http://stackoverflow.com/a/26595102
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26594943
has title: Crash after adding data to ListView
has answer: http://stackoverflow.com/a/26595799

http://stackoverflow.com/q/26595916
has comment: http://stackoverflow.com/comment/41806651
downvote count: 1
tagged with: java-8
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26596001
tagged with: java
possible better answer: http://stackoverflow.com/a/26595962
has answer: http://stackoverflow.com/a/26595962
has title: Anonymous classes can access non-final outer objects in java 8?
answer count: 2
score: 5
has body: Before java 8 an inner class could access outer objects only if they were declared final. However now when I run example code (from below) on javaSE 1.8 there is no compilation error and program runs fine. Why did they change that and how does It work now? Example code from java 7 tutorial: public class MOuter { private int m = (int) (Math.random() * 100); public static void main(String[] args) { MOuter that = new MOuter(); that.go((int) (Math.random() * 100), (int) (Math.random() * 100)); } public void go(int x, final int y){ int a = x + y; final int b = x - y; class MInner{ public void method(){ System.out.println("m is "+m); System.out.println("x is "+x); // supposedly illegal - 'x' not final System.out.println("y is: "+y); System.out.println("a is "+a); // supposedly illegal? - 'a' not final } } MInner that = new MInner(); that.method(); } }
has answer: http://stackoverflow.com/a/26596001
has comment: http://stackoverflow.com/comment/41806479
upvote count: 6
linked to: http://stackoverflow.com/q/20938095
favorite count: 0

http://stackoverflow.com/comment/127724120
type: AnswerComment
has text: This does not work if you use multiple data sources for databases by different vendors. for example if you have one data source for DB2 and another for Oracle, this will not work.
type: Comment
comment on: http://stackoverflow.com/a/44215481
score: 0

http://stackoverflow.com/a/26613806
accepted answer of: http://stackoverflow.com/q/26613579
has comment: http://stackoverflow.com/comment/41839270
upvote count: 2
type: AcceptedAnswer
has body: I assume that here is the problem as Scanner is not being closed after reading? This is most likely the culprit. A Scanner can be closed implicitly if it is available for garbage collection. However, since it is impossible to predict when the garbage collector will run, you should never rely on this. Instead, you should explicitly close the Scanner when you are finished with it. This means that you should follow this pattern: Scanner scan = null; try { scan = new Scanner(file); String token = scan.next(); // do something with token } catch (Exception ex) { // print out error message } finally scan.close(); } Of course, depending on your exact needs, this might be in a method which simply propagates the exceptions by declaring a throws clause. The main idea is that you need a finally clause somewhere to ensure that the Scanner is closed whether or not an exception is ever thrown. Note that Java 7 introduced "try with resources" which makes it much easier for us to do manage this kind of situation. If you are using Java 7, I suggest that you look into this.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26613579

http://stackoverflow.com/q/26630221
upvote count: 1
duplicate of: http://stackoverflow.com/q/23036062
tagged with: java
has answer: http://stackoverflow.com/a/26630299
has body: I am trying to have a user input an int and then input that number of names. The program prints those names backwards and in reverse order. However, the array where I am storing these names is always being created one element too small when I use Scanner. When I just assign a number myself, I don't have this problem. Is there something unique with Scanner or what am I doing wrong? import java.util.Scanner; class forTester { public static void main (String str[]) { Scanner scan = new Scanner(System.in); //Why does this commented code scan only one less name than expected??? /* System.out.println("How many names do you want to enter?"); int num = scan.nextInt(); System.out.println("Enter " + num + " Names:"); String names[] = new String[num]; */ //Comment out the next two lines if you use the four lines above. System.out.println("Enter " + 4 + " Names:"); String names[] = new String[4]; // The code below works fine. for (int i = 0; i &lt; names.length; i++) { names[i]=scan.nextLine(); } for(int i = names.length - 1; i &gt;= 0; i--) { for(int p = names[i].length() - 1; p &gt;= 0; p--) { System.out.print(names[i].charAt(p)); } System.out.println(""); } } }
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26630292
tagged with: arrays
score: 0
answer count: 2
favorite count: 0
has title: Array Length Initialized with Scanner
tagged with: java.util.scanner
linked to: http://stackoverflow.com/q/23036062
type: UnansweredQuestion

http://stackoverflow.com/comment/41825759
score: 0
has text: `@PersistenceContext` did not change anything. Stacktrace updated above.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26606608

http://stackoverflow.com/a/26640621
type: Answer
has comment: http://stackoverflow.com/comment/41888567
has comment: http://stackoverflow.com/comment/41888784
has comment: http://stackoverflow.com/comment/41888675
accepted answer of: http://stackoverflow.com/q/26640581
score: 0
answers question: http://stackoverflow.com/q/26640581
has body: String[] myStringArray = new String[]{"x", "a", "r", "y"}; StringBuilder builder = new StringBuilder(); for(String s:myStringArray) builder.append(s); System.out.println(builder );
has comment: http://stackoverflow.com/comment/41888202
type: AcceptedAnswer

http://stackoverflow.com/q/26601443
tagged with: java
has comment: http://stackoverflow.com/comment/41823197
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41816613
has comment: http://stackoverflow.com/comment/41816668
score: 0
has title: GUI and MVC in Java
tagged with: user-interface
has body: I'm currently building a system that takes an order for snacks. The system has a GUI interface, with the application code stored in a model package. so Ive done the main windows and it consists of three radio button and one sale button. so the radio buttons are "MAINS" , "SIDES" , "DRINKS". the problem i have is how do i code the action listener for each of the buttons in conjuction to the model package. this what I have. import java.text.*; import java.util.*; import model.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class LeftPanel extends JPanel { private ButtonGroup group = new ButtonGroup(); private String groupName; public LeftPanel(Groups groups) { setup(); build(); } private void setup() { setLayout(new GridLayout(3,1)); } private void build() { Box box = Box.createVerticalBox(); box.add(Box.createHorizontalStrut(65)); add(button("Mains", new MainsListener())); add(button("Sides", new SidesListener())); add(button("Drinks", new DrinksListener())); } private JRadioButton button(String s, ActionListener listener) { JRadioButton button = new JRadioButton(s); button.addActionListener(listener); group.add(button); return button; } private class MainsListener implements ActionListener { public void actionPerformed(ActionEvent e) { groupName = e.getActionCommand(); Groups groups = Groups.groups(groupName); new StockWindow(group); } } private class SidesListener implements ActionListener { public void actionPerformed(ActionEvent e) { groupName = e.getActionCommand(); Groups groups = Groups.groups(groupName); new StockWindow(group); } } private class DrinksListener implements ActionListener { public void actionPerformed(ActionEvent e) { groupName = e.getActionCommand(); Groups groups = Groups.groups(groupName); new StockWindow(group); } } } Groups is in the model package which reads the stock package model; import java.util.*; public class Groups extends Viewable { private LinkedList&lt;Group&gt; groups = new…
type: UnansweredQuestion
tagged with: model-view-controller
linked to: http://stackoverflow.com/q/3066590
answer count: 0

wicket
tags question: http://stackoverflow.com/q/26534031
tags question: http://stackoverflow.com/q/26644232
type: Tag
tags question: http://stackoverflow.com/q/26586764
tags question: http://stackoverflow.com/q/26608569
tag name: wicket
tags question: http://stackoverflow.com/q/26610072
tags question: http://stackoverflow.com/q/26604516
tags question: http://stackoverflow.com/q/26672703

http://stackoverflow.com/a/26556496
accepted answer of: http://stackoverflow.com/q/26556399
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26556399
type: Answer
score: 3
upvote count: 3
has body: You've imported java.util.Timer but you seem to be wanting to use a javax.swing.Timer

http://stackoverflow.com/q/26632177
tagged with: development-environment
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26632582
favorite count: 0
has body: I want to test my code against the (beta) IBM Java SDK 8.0, which will be a part of IBM Java products in future and support Java SE 8. The beta version is available for download from here, but it's only available for Linux on x86 (/ x86_64), and not Windows. But my development environment is Windows. Of course, I could run the Java SDK through Cygwin or equivalent, so it's possible to execute the binaries, but is there any easy way to trigger them from an Eclipse instance running on Windows?
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Is there any way to run a Windows-based Eclipse with a Linux-based Java SDK?
tagged with: cygwin

http://stackoverflow.com/a/26617505
has comment: http://stackoverflow.com/comment/46403763
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/46403851
downvote count: 0
has body: You are almost answering your own question. The solution is the statement that "ForkJoinPool avoids this problem by stealing work from other threads from inside the join() call". Whenever the threads are blocked for some other reason except ForkJoinPool.join(), this work stealing does not occur, and the threads just waits and does nothing. The reason for this is that in Java it is not possible for the ForkJoinPool to prevent its threads from blocking and instead give them something else to work on. The thread itself needs to avoid blocking and instead ask the pool for work it should do. And this is only implemented in the ForkJoinTask.join() method, not in any other blocking method. If you use a Future inside a ForkJoinPool, you will also see the starvation deadlock. Why is work stealing only implemented in ForkJoinTask.join() and not in any other blocking methods in the Java API? Well, there are many of such blocking methods (Object.wait(), Future.get(), any of the concurrency primitives in java.util.concurrent, I/O methods etc), and they have nothing to do with ForkJoinPool, which is just an arbitrary class in the API, so adding special cases to all these methods would be bad design. It would also lead to possibly very surprising and undesired effects. Imagine for example a user passing a task to an ExecutorService that waits on a Future, and then finding out that the task hangs very long in Future.get() just because the running thread stole some other (long-running) work item instead of waiting for the Future and continuing immediately after the result is available. Once a thread starts working on another task, it cannot return to the original task until the second task is finished. Thus it is actually a good thing that other blocking methods do not do work stealing. For a ForkJoinTask, this problem does not exist, because it is not important that the primary task is continued as soon as possible, it is only important that all tasks together are handled as effici…
accepted answer of: http://stackoverflow.com/q/26576260
has comment: http://stackoverflow.com/comment/46382231
has comment: http://stackoverflow.com/comment/41848559
answers question: http://stackoverflow.com/q/26576260
has comment: http://stackoverflow.com/comment/46400892
has comment: http://stackoverflow.com/comment/46396044
type: Answer
score: 44
has comment: http://stackoverflow.com/comment/46408021
has comment: http://stackoverflow.com/comment/46403791
upvote count: 44

http://stackoverflow.com/a/26580757
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26580335
downvote count: 0
has body: MyPaint is not abstract and does not override abstract method mouseExited(java.awt.event.MouseEvent) in java.awt.event.MouseListener This means the code declares implementation of an interface - yet does not actually implement all the methods defined in the interface. To get rid of that error, define the method!

http://stackoverflow.com/q/26664783
has comment: http://stackoverflow.com/comment/41931366
has comment: http://stackoverflow.com/comment/41932294
type: Question
possible better answer: http://stackoverflow.com/a/26664861
has body: When I try to use Arrays to print out an Arrays to print out my 2D ArrayList it says "Arrays cannot be resolved" If this isn't how your suppose to print out an Arraylist then how are you suppose to? Here's my code: package assignment2; import java.util.*;; public class BadmintonScoring { static final int PLAYER1 = 1; static final int PLAYER2 = 2; public static void main(String[] args){ ArrayList&lt;Integer&gt;[][] list = new ArrayList[2][26]; list[0][0] = new ArrayList&lt;Integer&gt;(); list[1][1].add(1); list[2][2].add(2); for(ArrayList&lt;Integer&gt;[] arr : list){ System.out.println(Arrays.toString(arr)); } } }
tagged with: arrays
has comment: http://stackoverflow.com/comment/41931502
tagged with: arraylist
upvote count: 2
has answer: http://stackoverflow.com/a/26664972
answer count: 3
has title: statement Arrays not working java
has comment: http://stackoverflow.com/comment/41932891
has comment: http://stackoverflow.com/comment/41931833
has comment: http://stackoverflow.com/comment/41932197
favorite count: 0
has comment: http://stackoverflow.com/comment/41932079
has comment: http://stackoverflow.com/comment/41932030
has answer: http://stackoverflow.com/a/26664861
has answer: http://stackoverflow.com/a/26664824
accepted answer: http://stackoverflow.com/a/26664824
has comment: http://stackoverflow.com/comment/41931882
has comment: http://stackoverflow.com/comment/41931297
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41932211

http://stackoverflow.com/q/26541782
type: AnsweredQuestion
has title: How to split and join message for crypto?
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26542250
has answer: http://stackoverflow.com/a/26562562
accepted answer: http://stackoverflow.com/a/26562562
has comment: http://stackoverflow.com/comment/41745523
type: Question
answer count: 2
has body: The encrypt and decrypt althorithm often come with a "base-number" value, such as Caesar (N = 26), Elgamal(N is prime). And if a message value is greater than N, we must split it. A simple example: E(m) = m + 1 = c (mod 1009) =&gt; D(c) = c - 1 = m (mod 1009) with m = `"buazyhv"` = `546999123` (base-26 to base-10) To avoid loss data (with modulo), I split to block of 3 digit: M = (546)(999)(123) = m1m2m3 Now, encrypt each block 546 -&gt; E -&gt; 547 999 -&gt; E -&gt; 1000 123 -&gt; E -&gt; 124 Then we join it: C = `5471000124` = "rsmetls" For decryption, we do the same: 5 -&gt; D -&gt; 4 471 -&gt; D -&gt; 470 000 -&gt; D -&gt; 999 124 -&gt; D -&gt; 123 And we have the decypt message M = 4470999123 = "omhwyat". So, my split and join message approach is not correct. With another encrypt function like ElGamal (like c = 980*m (mod 1009)) 139 -&gt; 980 * 139 = 5 (mod 1009) -&gt; 005 (fill to 3 digit) 696 -&gt; 980 * 696 = 1005 (mod 1009) -&gt; 1005 So, if we found m[i] == "005", we can't predict that it previous encrypt block is "005" or "1005". How can we encode/decode the ciphertext correctly in Java?
downvote count: 0
has answer: http://stackoverflow.com/a/26542250
has comment: http://stackoverflow.com/comment/41709340
favorite count: 0
tagged with: encryption
upvote count: 1

http://stackoverflow.com/comment/41794547
score: 0
type: Comment
type: QuestionComment
has text: You should post the entire code of the method. What you posted so far doesn't make any sense.
comment on: http://stackoverflow.com/q/26589831

http://stackoverflow.com/comment/41668896
comment on: http://stackoverflow.com/q/26519815
has text: You're casting the result of integer division, not the integers - by the time you cast, the truncation has already happened ;)
type: QuestionComment
type: Comment
score: 7

http://stackoverflow.com/a/26604370
has comment: http://stackoverflow.com/comment/41821613
downvote count: 3
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/41824360
answers question: http://stackoverflow.com/q/26604337
has comment: http://stackoverflow.com/comment/41821649
type: Answer
accepted answer of: http://stackoverflow.com/q/26604337
score: 2
has comment: http://stackoverflow.com/comment/41821872
has body: All JavaBeans are POJOs but not all POJOs are JavaBeans. A JavaBean is a Java object that satisfies certain programming conventions: the JavaBean class must implement either Serializable or Externalizable the JavaBean class must have a no-arg constructor all JavaBean properties must public setter and getter methods (as appropriate) all JavaBean instance variables should be private

http://stackoverflow.com/comment/41844866
type: Comment
comment on: http://stackoverflow.com/a/26600736
has text: Just kidding, I keep getting null when trying to grab it in the new activity. I'll try the JsonObject.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41944194
has text: yup.like ordinary project ,when we need external jar file,we just add it to class path using eclispe..Which is exactly what i want.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26669829
type: Comment

http://stackoverflow.com/q/26560174
has title: resource not available issue in spring mvc
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/30796317
tagged with: jsp
has body: I'm new to Spring MVC and trying to create a simple login module using spring and Hibernate in Eclipse.. but I'm getting the following error HTTP Status 404 - /Login.spring/processCredentials type Status report message /Login.spring/processCredentials description The requested resource is not available. Apache Tomcat/8.0.12 Below is my XML: `<?xml version="1.0" encoding="UTF-8"?> LoginApp-SpringMVC-Part2 index.html index.htm index.jsp default.html default.htm default.jsp org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.spring ` Below is my controller class: package com.pointerunits.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.pointerunits.service.*; @Controller @RequestMapping("/Login.spring") public class LoginController { @Autowired //Here the authenticate service is automatically injected into this controller private AuthticateService authenticateService; @RequestMapping(method =RequestMethod.POST) public ModelAndView processCredentials(@RequestParam("userName")String userName,@RequestParam("password")String password) { System.out.println("processcredentials"); String message = "Invalid credentials"; if(authenticateService.verifyUserNameAndPassword(userName, password)) { message = "Welcome " + userName + "!!"; } return new ModelAndView("results","message",message); } } jsp file: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Login Welcome. Please login. User: Password: when I call the action i get the error as stated above my application context file: <?xml version="1.0" encoding="UTF-8"?> com/pointerunits/pojo/User.h…
score: 0
has comment: http://stackoverflow.com/comment/41740961
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26560247
tagged with: spring

http://stackoverflow.com/a/26557436
accepted answer of: http://stackoverflow.com/q/26557375
has comment: http://stackoverflow.com/comment/41736363
type: Answer
answers question: http://stackoverflow.com/q/26557375
has body: Appending to your string will: Allocate memory for a new string Copy all data previously copied. Copy the data from your new string. You repeat this process for every single line, meaning that for N lines of output, you copy O(N^2) bytes around. Meanwhile, writing to your PrintWriter will: Copy data to the buffer. Occasionally flush the buffer. Meaning that for N lines of output, you copy only O(N) bytes around.
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/41704737
type: Comment
type: QuestionComment
has text: So does 'B' correspond to "R2"?
comment on: http://stackoverflow.com/q/26539675
score: 0

http://stackoverflow.com/a/26515260
accepted answer of: http://stackoverflow.com/q/26515171
answers question: http://stackoverflow.com/q/26515171
score: 1
has body: This is actually called an anonymous inner class. You would use it if you only need to use the class once. It would also reduce the size of your code unless it overrides many features of course (personally I prefer anonymous classes to be small in size for readability).
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41858967
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26624644
has text: until execution complete of for loop

http://stackoverflow.com/a/26655467
accepted answer of: http://stackoverflow.com/q/26654904
has comment: http://stackoverflow.com/comment/41914043
has body: public static Vector&lt;ClassB&gt; convert(Vector&lt;ClassA&gt; v){ Vector&lt;ClassB&gt; result = new Vector(v.size()); for(ClassA a : vector){ result.add(a.toClassB()); } //optional: v.clear() return result; } This static method could be in any class (probably it should be in ClassA, due to cohesion). Still, from a oop perspective, the class relationship seems odd. If there is no meaningful difference between ClassA and ClassB, you should either investigate, if you need both classes, or if there is a useful abstraction for them (regarding separation of concerns).
answers question: http://stackoverflow.com/q/26654904
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41767602
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26549207
has text: You can create the request just about anywhere you see fit - no restrictions on that. I suppose the somewhat tricky part would be finding the right editpart to get the command. You can execute the command via cmd.execute(), but then it's unlikely to be executed in an EMF transaction. I'd recommend getting a reference to the CommandStack and executing the command from it.

http://stackoverflow.com/q/26625435
has answer: http://stackoverflow.com/a/44465230
score: 1
tagged with: java
upvote count: 1
has body: I have a very basic doubt about Java Interfaces and inheritance. Suppose I have two classes A and B and one interface C with following definitions interface C{ public void check(); } class A implements C{ public void check(){ System.out.println("A"); } } class B extends A implements C{ // Is the following method overriding the method from class A or implementing the method from C? public void check(){ System.out.println("B"); } } I am confused that whether it is over-riding or implementation of check() method in class B?
type: Question
has title: Java Interfaces and inheritance
has comment: http://stackoverflow.com/comment/41860254
possible better answer: http://stackoverflow.com/a/26625602
accepted answer: http://stackoverflow.com/a/26625479
has answer: http://stackoverflow.com/a/26625602
downvote count: 0
has answer: http://stackoverflow.com/a/26625519
favorite count: 0
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26625479

http://stackoverflow.com/q/26647109
type: Question
has comment: http://stackoverflow.com/comment/41908400
has comment: http://stackoverflow.com/comment/41899679
has comment: http://stackoverflow.com/comment/41900398
score: 0
has comment: http://stackoverflow.com/comment/41900019
answer count: 0
has body: Sorry because I am coming with stupid questions, is my first time here.I will try first to explain my application. I have 3 objects ( or 3 java class in android ) Every class is basically an ImageView with a textView ( first 2 class, the last class is only an Imageview ).I succeed to open the same Pop-up where I change values of the text views or doing other stuffs. So basically I have 3 images views with fiew text views where I want to open the same pop-up and change some values of the textViews or changing some backgrounds etc.I have implemented this only for 2 classes and when I open the pop-up from 1 object I get null to Other one, same to second object when I open it I get Null Pointer at first object.I will put some commented lines of my code below: MainActivity: RelativeLayout mylayout; //Getting my Layout mylayout = (RelativeLayout) rootView.findViewById(R.id.mylayout); RelativeLayout inflator = new RelativeLayout(getActivity().getApplicationContext()); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); inflator.setLayoutParams(lp); mylayout.addView(inflator); inflator.setBackgroundColor(Color.CYAN); TemperatureSymbol mytempsymbol = new TemperatureSymbol(getActivity(), inflator); HumiditySymbol myhumiditysymbol = new HumiditySymbol(getActivity(), inflator); Ok, in mainActivity I am creating the objects and add them to a layout, I want those object to stick together in a tiny layout and move only the layout, inflator is the layout where I am adding them. TemperatureSymbol.class public class TemperatureSymbol extends LinearLayout{ private int[] location = new int[2]; private ImageView temperature; private int value = 20; private GestureDetectorCompat mDetector; private ControlListener controlListener; private TextView celsius; public interface ControlListener { public void onLongStatement(); } public void setControlListener(ControlListener controlLi…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41899272
has title: android, null pointer of 1 class when trying to open same pop-up from another object
tagged with: java

http://stackoverflow.com/comment/41923000
comment on: http://stackoverflow.com/a/26660466
score: 0
type: AnswerComment
has text: that doesn't have breaks (which could not be a problem for some weird logic) but you haven't defined i's anywhere..
type: Comment

http://stackoverflow.com/q/26626063
has comment: http://stackoverflow.com/comment/41861553
tagged with: java
has comment: http://stackoverflow.com/comment/41862199
type: Question
has title: how to print the third column of the file in java
score: 0
has answer: http://stackoverflow.com/a/26626424
has comment: http://stackoverflow.com/comment/41861515
answer count: 3
has answer: http://stackoverflow.com/a/26626229
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26626402
has body: My file contains data which is output of Treetagger big JJ big nice JJ nice full JJ full big JJ big best JJS good Here is my code File f = new File(n[x]); BufferedReader br = new BufferedReader(new FileReader(f)); String s; String filedata = " "; while ((s = br.readLine()) != null) { filedata += s + " "; } StringTokenizer stk = new StringTokenizer(filedata, " "); while (stk.hasMoreTokens()) { String token = stk.nextToken("JJ"); String[] to = token.split(" ", 2); String ft = to[1]; a.write(ft); } The third column is the stemmed words. how to print it?
has comment: http://stackoverflow.com/comment/41863612

http://stackoverflow.com/a/26660422
has comment: http://stackoverflow.com/comment/44062374
has body: phoneBook is out of reach in enterNumber. It has no visibility. Pass it as a parameter. public void enterNumber (Map&lt;String, String&gt; phoneBook, String name, String number) { phoneBook.put(name, number); }
answers question: http://stackoverflow.com/q/26660355
score: 0
type: Answer

http://stackoverflow.com/q/26611424
has comment: http://stackoverflow.com/comment/41835155
tagged with: excel
has answer: http://stackoverflow.com/a/32357203
has body: I am trying to add a function to my web app which lets the users download an excel file. I'm trying to achieve this with the following code: @Override public void doPost(HttpServletRequest request, HttpServletResponse response) { File file = new File("d:/test/test.xls"); response.setContentType("application/xls"); response.addHeader("Content-Disposition", "attachment; filename=test.xls"); response.setContentLength((int) file.length()); try { FileInputStream fileInputStream = new FileInputStream(file); OutputStream responseOutputStream = response.getOutputStream(); int bytes; while ((bytes = fileInputStream.read()) != -1) { responseOutputStream.write(bytes); } fileInputStream.close(); responseOutputStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } I'm able to download the excel file with the above code, however the file is corrupted. If I open it with microsoft excel, I get a popup with the message: "the file format and extension of don't match. the file could be corrupted or unsafe". And the excel file is empty. After running the code, the original file(d:/test/test.xls) gets also corrupted. What am I doing wrong?
downvote count: 0
score: 1
tagged with: java
has title: Java HttpServlet how to download excel file
tagged with: http
has comment: http://stackoverflow.com/comment/41834829
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41834901
linked to: http://stackoverflow.com/q/1442893
tagged with: servlets
has comment: http://stackoverflow.com/comment/41834940
has comment: http://stackoverflow.com/comment/41834841
upvote count: 1
has comment: http://stackoverflow.com/comment/41836309
favorite count: 0
has comment: http://stackoverflow.com/comment/65154576
tagged with: download
has answer: http://stackoverflow.com/a/26611557
type: UnansweredQuestion

http://stackoverflow.com/comment/41840095
score: 0
comment on: http://stackoverflow.com/a/26612032
has text: Yeah, and I said why I'd like to use Optional in my first comment. In this toy example, yes filter would be the way to go. But I had a real-world case where optional would have been better (but only in Scala it seems, Java doesn't seem to cut it)
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26602545
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41818871
tagged with: oop
tagged with: algorithm
score: 1
tagged with: java
tagged with: path-finding
has body: Looking for a pattern to search for specific paths on the grid. There is 2D grid of simple nodes like: public class TileNode { private final int ID; public TileNode leftNeightbour; public TileNode topNeightbour; public TileNode rightNeightbour; public TileNode bottomNeightbour; private TileState currentTileGameState; } If one of neighbours is unable to pass by current node it's state is set for outOfGame. I've tried with recursive DFS alg to find all paths but the complexity was terrible. I will try to cut of search collection with those paths to search: The red nodes are those where we start and finish, the black lines are paths which should go trough other nodes(neighbours), who are able to be passed. We do not consider any other paths other than those specified. And of course there is no limit for length of of those paths. EDIT: I would like to check if between two nodes exists any path that would follow the path on image. It might be pretty simple. There might exist more than one of them. It looks similary to those paths example
has comment: http://stackoverflow.com/comment/41818921
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41818691
favorite count: 0
has answer: http://stackoverflow.com/a/26603288
tagged with: android
has title: How to find specific path patterns efficiently?

http://stackoverflow.com/q/26540782
has title: Spring: nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
has comment: http://stackoverflow.com/comment/41862368
has answer: http://stackoverflow.com/a/26628539
score: 10
has answer: http://stackoverflow.com/a/26659345
has answer: http://stackoverflow.com/a/26660742
answer count: 6
possible better answer: http://stackoverflow.com/a/26628539
has comment: http://stackoverflow.com/comment/41862602
downvote count: 0
has comment: http://stackoverflow.com/comment/41862936
favorite count: 0
has comment: http://stackoverflow.com/comment/41862546
has comment: http://stackoverflow.com/comment/41865742
has answer: http://stackoverflow.com/a/26768200
has body: Stack trace: Oct 24, 2014 8:12:04 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@50df2e: startup date [Fri Oct 24 08:12:04 IST 2014]; root of context hierarchy Oct 24, 2014 8:12:05 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [knights-aop.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [knights-aop.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationCont…
has comment: http://stackoverflow.com/comment/41708460
has answer: http://stackoverflow.com/a/26650910
has answer: http://stackoverflow.com/a/26751625
has comment: http://stackoverflow.com/comment/41862301
has comment: http://stackoverflow.com/comment/41710224
tagged with: spring
has comment: http://stackoverflow.com/comment/41863020
has comment: http://stackoverflow.com/comment/41863390
type: AnsweredQuestion
tagged with: java
upvote count: 10
linked to: http://stackoverflow.com/q/16458816
type: Question
accepted answer: http://stackoverflow.com/a/26768200
has comment: http://stackoverflow.com/comment/41710167

http://stackoverflow.com/a/26560993
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26555373
score: 4
has body: It really depends on what you are trying to achieve. Are you writing a Java EE web application (war/ear) or a standalone app? Also: Weld is the reference implementation of CDI and CDI is just a part of Java EE. If you use CDI only (by setting up weld-se), you cannot use EJB/EntityManager/Transactional/... , its "just" CDI. That all being said: using weld-se in a java standalone application can be done by importing org.jboss.weld.se weld-se 2.2.6.Final Bootstrapping the application "Main.class" is done via // Initialize Weld Weld theWeld = new Weld(); WeldContainer theContainer = theWeld.initialize(); // Execute the run method theContainer.instance().select(Main.class).get().run(); // Shutting down Weld again theWeld.shutdown();
type: Answer
answers question: http://stackoverflow.com/q/26555373

http://stackoverflow.com/q/26526733
answer count: 4
has body: I am trying to make an assignment where I have to check if rectangels overlap or not and a few other methods. I have almost completed it but I cant create new objects from the class. It is giving me Error:(121, 32) java: unreported exception java.lang.Exception; must be caught or declared to be thrown Here is my code /** * Created by Sarang on 18-10-2014. */ import java.awt.*; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.Scanner; import javax.swing.JFrame; import javax.swing.JPanel; import java.io.*; public class Rectangle { private int upper_x, upper_y, lower_x, lower_y; public Rectangle(int upper1, int upper2,int lower1,int lower2) throws Exception { this.upper_x=upper1; this.upper_y=upper2; this.lower_x=lower1; this.lower_y=lower2; try { if (upper_x &gt; lower_x || upper_y &gt; lower_y) { throw new IllegalArgumentException(); //Checking if the rectangle is valid } if(lower_x &gt;500) {lower_x=500;} if(lower_y&gt;500) {lower_y=500;} //Setting the lower bounds to 500 if(upper_x&lt;50) {upper_x=50;} if(upper_y&lt;50) {upper_y=50;} } catch (IllegalArgumentException IAE) { System.out.println("Invalid Rectangle"); } } Rectangle( Rectangle other) { upper_x=other.upper_x; upper_y=other.upper_y; lower_x=other.lower_x; lower_y=other.lower_y; } public boolean overlap(Rectangle other) { if(upper_x&lt;other.upper_x &amp;&amp; upper_y&lt;other.upper_y &amp;&amp; lower_x&gt;other.lower_x &amp;&amp; lower_y&gt;other.lower_y) { return false;} if (!( lower_y &lt; other.upper_y || upper_y &gt; other.lower_y || lower_x &lt; other.upper_x || upper_x &gt; other.lower_x )) { return true;} return false; } public boolean containedIn(Rectangle other) { if(upper_x&lt;other.upper_x &amp;&amp; upper_y&lt;other.upper_y &amp;&amp; lower_x&gt;other.lower_x &amp;&amp; lower_y&gt;other.lower_y) { return true;} if(other.upper_x&lt;upper_x &amp;&amp; other.upper_y&lt;upper_y &amp;&amp; other.lower_x&gt;lower_x &amp;&amp; other.lower_y&gt;lower_y) { re…
has comment: http://stackoverflow.com/comment/41681308
has comment: http://stackoverflow.com/comment/41680668
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26526802
type: AnsweredQuestion
has title: Java.lang.exception while creating an object
has answer: http://stackoverflow.com/a/26526812
tagged with: java
possible better answer: http://stackoverflow.com/a/26526802
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/26526833
has answer: http://stackoverflow.com/a/26526823
accepted answer: http://stackoverflow.com/a/26526812
score: -2

http://stackoverflow.com/comment/41841301
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26614809
score: 0
has text: Are you sure that it's being called? You should expand on your question, show output!

http://stackoverflow.com/q/26626309
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26709205
tagged with: windows-services
accepted answer: http://stackoverflow.com/a/26709205
type: Question
score: 0
answer count: 1
has title: Windows couldn't start the service on Local Computer
has body: I've been created an windows service with WinRun4J. The application is successfully installed as service. But when I try to start the service with run net start service in command prompt , the service wouldn't start. Then I try to start the service via windows: Services -> Start the service, the popup message has come up "Windows couldn't start the service on Local Computer". Any idea?

http://stackoverflow.com/a/26552397
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26551910
has body: If you want increase field's height, modify its preffered size (apply method to your field): private void increaseFieldHeight(JTextField field, int times) { Dimension d = field.getPreferredSize(); d.height = d.height * times; field.setPreferredSize(d); }

http://stackoverflow.com/comment/41850827
type: Comment
comment on: http://stackoverflow.com/q/26619813
type: QuestionComment
score: 1
has text: *Nothing* changes the way it handles (doubles and) floats except the presence of `strictfp`. Don't mix that up with formatting or conversion to `String`.

http://stackoverflow.com/a/26530194
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41687211
accepted answer of: http://stackoverflow.com/q/26530108
has comment: http://stackoverflow.com/comment/41687053
answers question: http://stackoverflow.com/q/26530108
score: 3
has body: You need to initialize a new String array with your values: doSomething(new String[]{"531", var}); By doing doSomething("531", var) You are calling doSomething with 2 String arguments while it's expecting a single argument: String array
has comment: http://stackoverflow.com/comment/41687179
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41687182

http://stackoverflow.com/q/26608248
type: AnsweredQuestion
has title: ResourceBundle.getBundle(class,locale) don't get default Bundle
has body: I have a very strange behavior with ResourceBundle.getBundle on both Java7 and Java8 on my Machine (Windows 7 64Bit) and am perplexed. I try to get the MyRessource Bundle (wich extends RessourceBundle) for the choosen Locale. Here is the simple code (shortend and simplified): Default RessourceBundle class: public class MyRessource extends ResourceBundle { @Override protected Object handleGetObject(final String key) { if (key.equals("submit")) return "submit"; return null; } } German RessourceBundle class: public class MyRessource_de extends MyRessource { @Override protected Object handleGetObject(final String key) { if (key.equals("submit")) return "absenden"; return null; } } Then i want to retrieve the German Bundle: final ResourceBundle bundle_DE = ResourceBundle.getBundle(MyRessource.class.getName(), Locale.GERMANY); LOG.debug("Bundle {}", bundle_DE); LOG.debug(bundle_DE.getString("submit")); Output is: Bundle com.example.MyRessource_de@6cf82c7d absenden Now the same with another Language, this should return the Default Bundle: final ResourceBundle bundle_EN = ResourceBundle.getBundle(MyRessource.class.getName(), Locale.UK); LOG.debug("Bundle {}", bundle_EN); LOG.debug(bundle_EN.getString("submit")); But the output is: Bundle com.example.MyRessource_de@6cf82c7d absenden The Same cached Bundle was returned. I tried to clear the cache with ResourceBundle.clearCache() with no success. When I implement another Language-Bundle and asked for it i get it, but i dont get the Default-Bundle Class. I have no idea why Java is behaving this way and will be happy of any answer. On other Machines the code works as intended. BTW: My Windows System Language is de.
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26608675
accepted answer: http://stackoverflow.com/a/26608675
has comment: http://stackoverflow.com/comment/41829332

http://stackoverflow.com/comment/41921213
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26657927
type: Comment
has text: Unfortunately, there is no other way

http://stackoverflow.com/a/26596765
has body: There is really no point in making constructor of abstract class public. But you can be sure, that nobody will create instance directly.
answers question: http://stackoverflow.com/q/26596512
score: 0
type: Answer

http://stackoverflow.com/q/26523841
answer count: 3
has answer: http://stackoverflow.com/a/44626170
upvote count: 1
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/26524312
tagged with: timer
accepted answer: http://stackoverflow.com/a/26524312
possible better answer: http://stackoverflow.com/a/26524061
has body: I have a timer with a delay of 5 seconds. I am trying to change the label named lblTimer after a second passes to act as a countdown. I am having issues with it as currently it only works at 5 seconds. Do you have any suggestionsuggestions? protected void Addition() { //addition function final int delay = 5000; //milliseconds ActionListener taskPerformer = new ActionListener() { @SuppressWarnings("unused") public void actionPerformed(ActionEvent evt) { //...Perform a task... frame.getContentPane().setBackground(Color.red); } }; new Timer(delay, taskPerformer).start(); Random RandomNumber = new Random(); int number1 = RandomNumber.nextInt(12); int number2 = RandomNumber.nextInt(12); int number3 = RandomNumber.nextInt(12); lblAnswer.setText(""); lblFirstNumber.setText(""+ number1); lblfunction1.setText("+"); lblsecondNumber.setText(""+number2); lblfunction2.setText("+"); lblthirdnumber.setText(""+number3); lblequals.setText("="); answer = number1+number2+number3; if(delay &lt;= 1000){ lblTimer.setText("1"); } else if(delay == 2000){ lblTimer.setText("2"); } else if(delay == 3000){ lblTimer.setText("3"); } else if(delay == 4000){ lblTimer.setText("4"); } else if (delay == 5000){ lblTimer.setText("5"); } }
has answer: http://stackoverflow.com/a/26524061
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
has title: How do you change label text in java after a timer ticks a second passed?

http://stackoverflow.com/comment/41945673
has text: Thank you very much for detailed answer, many things become more clear
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26672007

http://stackoverflow.com/comment/41675469
has text: As a side note: if you don’t modify `intList`, as in your code example, there is no need to wrap the result of `Arrays.asList` into an `ArrayList`, it *is* already a `List`. On the other hand, if you have a mutable list like `ArrayList` and you don’t need the original contents of `intList` anymore, there is `removeIf(Predicate)` on every `Collection` allowing an in-place filtering. In either case, you can simplify your code…
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26522005

http://stackoverflow.com/comment/111542896
type: Comment
comment on: http://stackoverflow.com/a/55815322
type: AnswerComment
has text: I'm using spring boot 2.3.1 and mysql connector 8.0.21 and this worked for me.
score: 0

http://stackoverflow.com/comment/41685141
comment on: http://stackoverflow.com/a/26528216
type: AnswerComment
score: 0
type: Comment
has text: I updated my code using a SwingWorker instead. I'm not sure what you're doing entirely, but I kept it sorta generic to get you going.

http://stackoverflow.com/q/26596489
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21067307
tagged with: spring
has comment: http://stackoverflow.com/comment/41807896
has comment: http://stackoverflow.com/comment/41807835
answer count: 0
has comment: http://stackoverflow.com/comment/41807974
has comment: http://stackoverflow.com/comment/41807954
has body: I am trying to use @Transactional annotation using Spring 4.0.5, and hibernate, using mysql db. ===== The below is the code ===== The model class is: package com.vipin.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="USER_INFO") public class UserInfo { @Id @Column(name="ssnID") private int ssnID; private String firstName; private String lastName; public int getSsnID() { return ssnID; } public void setSsnID(int ssnID) { this.ssnID = ssnID; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } The dao interface which declares the DB operations. DBOperationsDao.java package com.vipin.dao; import com.vipin.model.UserInfo; public interface DBOperationsDao { public UserInfo getUserInfo(int ssnId); public void updateUserInfo(int ssnId); public void deleteUser(int ssnId); public void addUser(UserInfo userInfo); } Dao interface implementation (simple one) DBOperationsDaoImpl.java package com.vipin.dao; import com.vipin.model.UserInfo; import org.hibernate.SessionFactory; import javax.annotation.Resource; import org.hibernate.Session; import org.springframework.transaction.annotation.Transactional; public class DBOperationsDaoImpl implements DBOperationsDao { private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } @Resource(name="sessionFactory") public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; System.out.println("Inside setSessionFactory() method, value of this.sessionFactory is " + this.sessionFactory); } @Override public UserInfo getUserInfo(int ssnId) { // TODO Auto-generated method stub return null; } @Override public void updateUserInfo(int ssnId) { // TODO Auto-generated…
upvote count: 1
has comment: http://stackoverflow.com/comment/41808106
type: Question
has comment: http://stackoverflow.com/comment/41808370
has title: Hibernate Spring 4.x and @Transactional annotation
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41808092
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41808062

http://stackoverflow.com/comment/41936797
has text: Where is `Music.mp3` located, in relationship to the source file...?
comment on: http://stackoverflow.com/q/26667642
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26530242
tagged with: jsf-2
score: 0
answer count: 1
has title: How to find the data source (dataTable) in Java with Primefaces?
accepted answer: http://stackoverflow.com/a/26530440
tagged with: datatable
type: AnsweredQuestion
tagged with: jsf
has body: PHP programmer here. Absolute beginner in Java and Primefaces. Simple question. How I find the source SQL of this dataTable? I need to rewrite the SELECT (or similar method of querying the database) of this dataTable. ... &lt;p:dataTable id="pendentList" var="ava" value="#{avaBean.avaTut}" rowKey="#{ava.id_ava}" emptyMessage="Empty records"&gt; &lt;p:column headerText="Ativ" sortBy="#{ava.pos}" width="400"&gt; ... The application uses Primefaces running on Glassfish3. Thanks.
tagged with: java
type: Question
tagged with: primefaces
has answer: http://stackoverflow.com/a/26530440

http://stackoverflow.com/q/26657795
type: Question
has answer: http://stackoverflow.com/a/26658104
has body: I have two entities: Shop and Transport with many to many relation. And I have page for editing Shop entity where user can see list of shop's transports like checkboxes. To show user all transports I'm using for each by all transports: &lt;c:forEach items="${transports}" var="transport"&gt; &lt;div class="checkbox"&gt; &lt;label&gt; &lt;input type="checkbox" value="${transport.id}"&gt; ${transport.name} &lt;/label&gt; &lt;/div&gt; &lt;/c:forEach&gt; Also on this page I have an object Shop and can get list of shop's transports. The problem is I want to mark as checked shop's transport when I show list of all transports. So user will be able to see which transports belong to shop and which do not. Can't figure out how to check it in my loop. Thanks in advance. EDITED public boolean hasTransport(Transport transport, Integer id) { boolean result = false; for (Shop shop : transport.getShops()) { if (shop.getId().equals(id)) { result = true; break; } } return result; } And check it on jsp page: &lt;c:forEach items="${transports}" var="transport"&gt; &lt;div class="checkbox"&gt; &lt;label&gt; &lt;c:choose&gt; &lt;c:when test="${shop.hasTransport(transport, shop.id)}"&gt; &lt;input type="checkbox" checked name="transportsId" value="${transport.id}"&gt; ${transport.name} &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;input type="checkbox" name="transportsId" value="${transport.id}"&gt; ${transport.name} &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/label&gt; &lt;/div&gt; &lt;/c:forEach&gt;
has title: Many to many check if one list contains elements of another
score: 0
answer count: 2
tagged with: jsp
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26658104
tagged with: java
has answer: http://stackoverflow.com/a/26658113
accepted answer: http://stackoverflow.com/a/26658113

http://stackoverflow.com/a/26537432
has comment: http://stackoverflow.com/comment/41709028
has comment: http://stackoverflow.com/comment/41709056
has comment: http://stackoverflow.com/comment/41710322
type: Answer
has comment: http://stackoverflow.com/comment/41711153
has comment: http://stackoverflow.com/comment/41709197
score: 3
upvote count: 3
has body: Hibernate uses proxies to implement lazy-loading. This means that when you load an A, this A references an instance of a class that is a subclass of B, and also a proxy to B. So it IS a B, by the rules of inheritance and polymorphism. When calling a method for the first time on this proxy, it initializes itself by getting the B data from the database, executes the method of the proxied B, and returns the same result as it would have if you had no proxy. There is thus no problem. The same happens with your BaseClass instances. Some of them have already been referenced as proxies when you access the elements of the collection, and Hibernate thus puts the proxies in the collection, to make sure a single instance is ever used in the same session to reference the same entity. Some others haven't yet, and Hibernate then puts the actual class instances in the collection. But that doesn't matter, because they are all instances of BaseClass. So basically, it's just the same as doing List&lt;Number&gt; list = new ArrayList&lt;&gt;(); list.add(new Integer(1)); list.add(new Long(2)); The list contains Integer and Long instances, but it's still a list of Number, and since that's all you care about since you declared the list as a List, everything is normal.
answers question: http://stackoverflow.com/q/26535896
has comment: http://stackoverflow.com/comment/41711473
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41710415
has comment: http://stackoverflow.com/comment/41709281
accepted answer of: http://stackoverflow.com/q/26535896

http://stackoverflow.com/q/26669649
has answer: http://stackoverflow.com/a/26669753
has title: org.json.JSONException: Value 0 at success of type java.lang.String cannot be converted to JSONArray
possible better answer: http://stackoverflow.com/a/26669839
has comment: http://stackoverflow.com/comment/41940117
tagged with: android
has comment: http://stackoverflow.com/comment/41940006
tagged with: php
has answer: http://stackoverflow.com/a/26669839
accepted answer: http://stackoverflow.com/a/26669753
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41940011
answer count: 2
has body: I trying access array of data from a php using AsyncHttpClient API. When ever I try to get the data I exception: org.json.JSONException: Value 0 at success of type java.lang.String cannot be converted to JSONArray I am not sure what is wrong here. If $response["success"] = 1 then I would like to do something if not I want to toast a value for which I am trying to access success value. Here is my PHP file: &lt;?php include("config.php"); $response = array(); if (isset($_GET['userID'])) { $userID = $_GET['userID']; // mysql inserting a new row $result = //MY QUERY GOES HERE // check for empty result if (mysql_num_rows($result) &gt; 0) { $response["data"] = array(); while ($row = mysql_fetch_array($result)) { // temp user array $detail = array(); $detail["userID"] = $row["username"]; $detail["password"] = $row["password"]; array_push($response["data"], $detail); } // success $response["success"] = 1; // echoing JSON response echo json_encode($response); } else { // no products found $response["success"] = 0; // echo no users JSON echo json_encode($response); } } else { // no products found $response["success"] = 0; // echo no users JSON echo json_encode($response); } ?&gt; And my Android code: AsyncHttpClient client = new AsyncHttpClient(); client.get(uploadWebsite, requestParams, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { JSONArray sucessdetails = response.getJSONArray("success"); for (int i = 0; i &lt; sucessdetails.length(); i++) { JSONObject successObject = sucessdetails.getJSONObject(i); Log.e("Value","Of success"+successObject); } } catch (JSONException e) { Log.e("ERROR","E"+e); e.printStackTrace(); } } }); Can somebody help me fix this I am been working on it for last 1 day. SO seems to have similar issues but not the exact problem. Thanks!

http://stackoverflow.com/comment/41707433
comment on: http://stackoverflow.com/a/26541388
type: AnswerComment
score: 0
type: Comment
has text: You can also simply trim the file name

http://stackoverflow.com/comment/41658772
score: 0
has text: @SamTebbs33 Readers are meant to handle text sources, Streams are meant to handle binary sources. `FileReader` seems like correct class here.
type: Comment
comment on: http://stackoverflow.com/q/26514387
type: QuestionComment

getmethod
tag name: getmethod
tags question: http://stackoverflow.com/q/26653698
type: Tag
tags question: http://stackoverflow.com/q/26658903

http://stackoverflow.com/comment/41931129
score: 0
has text: Thank you. I Would upvote, but I don't have enough reps yet. I will revisit when I Do. thanks!
type: Comment
comment on: http://stackoverflow.com/a/26663356
type: AnswerComment

http://stackoverflow.com/a/26528169
has body: Do I have to run this method in an own Thread or just the progress setting method? or both? Both tasks should run in separate threads: business logic (in this case word's count) must be performed in a background thread while progress bar update must run in the Swing thread, also known as Event Dispatch Thread (EDT). IMO the best way to accomplish this is by using a SwingWorker: Move all count logic to doInBackground() implementation. Attach a PropertyChangeListener to the swing worker to listen for progress property and update the progress bar within this listener. Use setProgress() inside doInBackground to set the worker's progress and fire a property change event notifying your listener. There are a lot of examples here in SO, just take a look to swingworker tag. Also, consider this snippet: SwingWorker&lt;Void, Void&gt; worker = new SwingWorker&lt;Void, Void&gt;() { // Following code is performed in a background thread @Override protected Void doInBackground() throws Exception { String[] words = string.split(System.lineSeparator()); int totalWords = words.length; for (int count = 0; count &lt; totalWords; count++) { int progress = (count + 1) * 100 / totalWords; setProgress(progress); } return null; } }; worker.addPropertyChangeListener(new PropertyChangeListener() { // Following code is performed in the EDT, as all event handling code is. // Progress bar update must be done here, NOT within doInBackground() @Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { Integer progress = (Integer)evt.getNewValue(); progressBar.setValue(progress); } } });
answers question: http://stackoverflow.com/q/26527717
type: Answer
has comment: http://stackoverflow.com/comment/41687533
score: 2
has comment: http://stackoverflow.com/comment/41686532
upvote count: 2
has comment: http://stackoverflow.com/comment/41687011
has comment: http://stackoverflow.com/comment/41686447
has comment: http://stackoverflow.com/comment/41687082
has comment: http://stackoverflow.com/comment/41688106
has comment: http://stackoverflow.com/comment/41968338
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41688238
accepted answer of: http://stackoverflow.com/q/26527717

http://stackoverflow.com/q/26579804
has body: Sorry if the title sounds confusing, i'll try to explain... What I have is a class (Force) which requires a string in the constructor public Force(double mag, double ang, String f){ magnitude = mag; angle = ang; from = f; } However later I Have a function (within the same class) that returns a new Force public Force inverse(){ return new Force(magnitude, toRads(angle+180), //String goes here ); } The problem is, I want the name of whatever class/object which is calling that method to be put into the parameters of new constructor. Is there any way of doing this?
has comment: http://stackoverflow.com/comment/41776956
type: UnansweredQuestion
tagged with: physics
linked to: http://stackoverflow.com/q/442747
has comment: http://stackoverflow.com/comment/41776794
tagged with: java
has comment: http://stackoverflow.com/comment/41776785
has comment: http://stackoverflow.com/comment/41776764
type: Question
has answer: http://stackoverflow.com/a/26579854
has title: Is it possible to get the name of a class which is calling a method?
score: 0
has comment: http://stackoverflow.com/comment/41777078
answer count: 1

http://stackoverflow.com/comment/104480770
has text: Of course! You'll find one here: https://gitlab.com/dheid/colorpicker/blob/master/src/test/java/com/bric/colorpicker/ColorPickerExample.java
type: Comment
comment on: http://stackoverflow.com/a/51465071
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41856181
comment on: http://stackoverflow.com/a/26622912
type: AnswerComment
score: 0
type: Comment
has text: The time in [Singapore](http://en.wikipedia.org/wiki/Singapore_Standard_Time) is also obtainable with "UTC+8", or a google search. You can also use "UCT-8", according to this [table](http://docs.oracle.com/cd/B10191_01/calendar.903/b10094/timezone.htm). But if I have the wrong TimeZone, it should be possible to find one that works.

http://stackoverflow.com/a/26662490
accepted answer of: http://stackoverflow.com/q/26662116
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26662116
score: 0
type: Answer
has body: First step, derive Wizard and Warrior from Person (you may consider making Person an interface). Second step, implement attack(Person attacker, Person defender) in terms of Person, not in terms of Warior or Wizard. All methohds common to Warrior and Wizard should be available to person. Any method not common should be made irrelevant to attack(). For example, if Wizard has castBestSpell(Person target) method, while Warrior has hitWithWeapon(Person target), you need to reduce both methods to Person.attack(Person target). Wizard and warrior will implement attack(Person target) differently: one by calling castBestSpell, one by calling hitWithWeapon.

http://stackoverflow.com/a/53536058
score: 0
answers question: http://stackoverflow.com/q/26515700
has comment: http://stackoverflow.com/comment/98096554
has body: Agree with @bluecollarcoder answer, but it's better to use TimeZone.getDefault().getID(); at the end of the connection string: "jdbc:mysql://localhost/db?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=" + TimeZone.getDefault().getID(); In this case Timezone parameter automatically updates depending on the local machine timezone.
type: Answer

http://stackoverflow.com/q/26575545
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41768891
has comment: http://stackoverflow.com/comment/41769854
type: Question
has body: I'm building a simulation game using Java. I have an interface, "Critter" and an abstract class "AbstractCritter". All of my "critters" are defined using these two. Critter public interface Critter { // create constants // each holds a unique integer value final int NORTH = 1; final int WEST = 2; final int SOUTH = 3; final int EAST = 4; final int CENTER = 5; // create abstract methods public char getChar(); public int getMove(CritterInfo theInfo); } AbstractCritter public abstract class AbstractCritter implements Critter{ // create char to hold a particular critter private char critterChar; public AbstractCritter(final char theChar) { critterChar = theChar; } public char getChar() { return critterChar; } } Example critter: public class Stone extends AbstractCritter { public Stone(char S) { super(S); // This is the main constructor for stone } public int getMove(CritterInfo theInfo) { // The stone cannot move. return 5; } } And the main loop: public final class CritterMain { /** private constructor to inhibit instantiation. */ private CritterMain() { // Do not instantiate objects of this class throw new IllegalStateException(); } /** * The start point for the CritterMain application. * * @param theArgs command line arguments - ignored */ public static void main(String[] theArgs) { EventQueue.invokeLater(new Runnable() { @Override public void run() { CritterFrame frame = new CritterFrame(); frame.add(100, Stone.class); frame.add(50, Bat.class); frame.add(25, Frog.class); frame.add(25, Mouse.class); frame.add(25, Turtle.class); frame.add(25, Wolf.class); frame.start(); } }); } } Whenever I try to run the main CritterMain, I get this weird error I can't find anywhere on google: "Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: no zero-argument constructor for class Stone" It has something to do with how I am defining my critters. Can anyone help me figure this out?
accepted answer: http://stackoverflow.com/a/26575655
has comment: http://stackoverflow.com/comment/41768848
answer count: 1
has comment: http://stackoverflow.com/comment/41768859
has title: Java "Zero-Argument" Error
has comment: http://stackoverflow.com/comment/41768922
has answer: http://stackoverflow.com/a/26575655
has comment: http://stackoverflow.com/comment/41768761
has comment: http://stackoverflow.com/comment/41768980
type: AnsweredQuestion
tagged with: oop

http://stackoverflow.com/q/26532378
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41691200
has comment: http://stackoverflow.com/comment/41691611
has comment: http://stackoverflow.com/comment/41691959
tagged with: java
has comment: http://stackoverflow.com/comment/41691723
has comment: http://stackoverflow.com/comment/41691754
has comment: http://stackoverflow.com/comment/41691322
has comment: http://stackoverflow.com/comment/41691358
type: Question
has comment: http://stackoverflow.com/comment/41691337
accepted answer: http://stackoverflow.com/a/26533098
has comment: http://stackoverflow.com/comment/41691372
has comment: http://stackoverflow.com/comment/41691278
has body: I would like to write a Spark program that parses a csv log file, splits the words by a separator ";" and creates an object, who's attribute values are words located on specific positions. The code would look like this in Scala but I am having trouble in translating this to Java 1.8 (I would like to use the lambda expressions in Java). val file = sc.textFile("hdfs:/../vrLogs.csv") class VREvent(val eventTimestamp: String, val deviceID: String, val eventType: String, val itemGroupName: String) val vrEvents = file.map(_.split(';')).filter(_.size == 32).map(a =&gt; new VREvent(a(0), a(1), a(6), a(13))) I am not sure how to translate this part to Java: .map(a =&gt; new VREvent(a(0), a(1), a(6), a(13))). I tried this (without the filter part): JavaRDD&lt;String&gt; records = lines.flatMap(s -&gt; Arrays.asList(s.split(";"))).map(a -&gt; new CDREvent(a[0], a[1], a[6], a[13]));
score: 0
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/41692412
answer count: 1
has comment: http://stackoverflow.com/comment/41691554
has comment: http://stackoverflow.com/comment/41691572
favorite count: 0
has title: From Scala to Java 1.8
upvote count: 2
has answer: http://stackoverflow.com/a/26533098
tagged with: scala
downvote count: 2
tagged with: bigdata
has comment: http://stackoverflow.com/comment/41691441
tagged with: lambda

http://stackoverflow.com/q/26668258
type: Question
linked to: http://stackoverflow.com/q/513832
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26668286
has comment: http://stackoverflow.com/comment/41937758
answer count: 3
has body: I'm new to Java (and to programming in general). I have a program that is supposed to run a method on two variable strings, but only if the strings are the same length and are not identical. I've tried using while(i &lt; n){ if (string1.length() == string2.length() &amp;&amp; string1 != string2){ compare(string1, string2); i++ } } but it still runs the compare method even if the strings are identical. I've also tried using while(i &lt; n){ if (string1.length() == string2.length(){ if (string1 == string2){ continue; } compare(string1, string2); } i++ } but this also still runs the compare method regardless of whether or not the strings are identical. Is there an issue with my formatting, or perhaps misused keywords? Thanks!
has comment: http://stackoverflow.com/comment/41937674
score: 0
has answer: http://stackoverflow.com/a/26668276
has title: Trouble trying to skip iteration of a while loop in Java
has answer: http://stackoverflow.com/a/26668289
type: UnansweredQuestion
tagged with: loops
tagged with: skip

http://stackoverflow.com/comment/113511496
score: 1
comment on: http://stackoverflow.com/q/26631078
type: Comment
type: QuestionComment
has text: to inflict pain on mathematicians

http://stackoverflow.com/q/26652352
has comment: http://stackoverflow.com/comment/41908342
answer count: 3
has answer: http://stackoverflow.com/a/26652545
possible better answer: http://stackoverflow.com/a/40531705
has body: I'm trying to figure out how to share an established connection to a database among classes to execute different SQL statements. I read through some of the topics, but as I'm fairly new to programming I have a hard time to adapt the given information to my problem. Problem: I have two classes with one opening a connection to a database, executing some SQL statments and calling the other class to do the same only using different tables and SQL statments. Now as long as I run the classes separatly with their own main method and connections everything works fine. But as one class calls the other I get different Exceptions, depending on my workarounds I tried so far (either MySQLNonTransientConnectionException: Data source rejected establishment of connection or a StackOverflowException). Here is how I'm trying to established a connection that is used to execute some sql operations in two different classes: public ClassA{ public static Connection dbConn; //Set up a connection to the database String dbURL = "jdbc:mysql://&lt;some database&gt;"; //put host, port and database here Properties connectionProbs = new Properties(); connectionProbs.put("user", "root"); //insert USER here connectionProbs.put("password", "root"); //insert PASSWORD here dbConn = null; try{ dbConn = DriverManager.getConnection(dbURL, connectionProbs); PreparedStatement useStmt; try{ useStmt = dbConn.prepareStatement("USE &lt;some database&gt;"); //insert DATABASE here useStmt.executeUpdate(); } catch(SQLException e){ e.printStackTrace(); } //Do some SQL operations //Call class B to do some SQL operations using the same connection } catch(SQLException e){ System.err.println("There was a problem connecting to the database"); e.printStackTrace(); } finally{ if(dbConn != null) try{dbConn.close();}catch(SQLException e){e.printStackTrace();} } } Why can't class B use the connection of ClassA, for instance by doing something like this (This leads to a StackOverflow): PreparedStatement Stmt = ClassA.dbConn.…
has answer: http://stackoverflow.com/a/26652706
has comment: http://stackoverflow.com/comment/42003800
tagged with: jdbc
has title: How to share a databse connection among classes? (JDBC)
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/26652706
has answer: http://stackoverflow.com/a/40531705

http://stackoverflow.com/a/26632136
has body: It's not so much the "length from the start" but "end index exclusive". The reason is obvious if you look at how those two numbers work with code to create a substring by copying characters from one array to another. Given: int start; // inclusive int end; // exclusive char[] string; Now look how easy it is to use those numbers when copying elements of an array: char[] substring = new char[end - start]; for (int i = start; i &lt; end; i++) substring[i - start] = string[i]; Notice how there is no adjusting by adding/subtracting 1 - the numbers are just what you need for the loop. The loop could actually be coded without the subtraction too: for (int i = start, j = 0; i &lt; end; i++) substring[j++] = string[i]; Choosing those numbers is "machine friendly", which was the way when the C language was designed, and Java is based on C.
answers question: http://stackoverflow.com/q/26631078
upvote count: 3
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/q/26644605
has comment: http://stackoverflow.com/comment/41895533
type: AnsweredQuestion
tagged with: java
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41895481
has answer: http://stackoverflow.com/a/26644782
score: -1
has comment: http://stackoverflow.com/comment/41895544
has body: this is my first time using stackFlow, and i need help i am kind of new to programming. i have a method that i created which asks the points made and the points lost for each game a team plays. i want someone to explain what i need to do, thats all, or if its not possible this way I want to store the name of the teams in an arrayList. how do i get it to ask, What is Arsenal pointsMade, What is Arsenal pointsLost, and What it liverpool pointsMade and pointsLost? please, if you dont understand my question, let me know so i can rephrase it better. Thanks. public class projectscore { public int pointsMade; public int pointsLost; public projectscore(int pointsM, int pointsL) { pointsMade = pointsM;`enter code here` pointsLost = pointsL; } public void setpointsMade(int pointsM) { pointsMade = pointsM; } public void setpointsLost(int pointsL) { pointsLost = pointsL; } public int getpointsMade() { return pointsMade; } public int getpointsLost() { return pointsLost; } public void getfinalScore() { System.out.println(pointsMade); System.out.println(pointsLost); } } import java.util.*; public class fProjectScore { public static void main(String[] args) { projectscore pscore = new projectscore(0, 0); Scanner in = new Scanner(System.in); System.out.println("what is the points made today "); Integer temp = in.nextInt(); System.out.println("what is the points lost today "); Integer temp2 = in.nextInt(); pscore.setpointsMade(temp); pscore.setpointsLost(temp2); /* HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); map.put(temp, temp2); */ if(temp &gt; temp2) { System.out.println("winner"); } else if(temp &lt; temp2) { System.out.println("losser"); } else if(temp == temp2) { System.out.println("Tie Game"); } } } i want to add this to my main method ArrayList&lt;String&gt;participants = new ArrayList&lt;String&gt;(); participants.add("Arsenal"); participants.add("Liverpool); how do i get it to ask, What is Arsenal pointsMade, What is Arsenal pointsLost, and W…
tagged with: arraylist
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26644782
tagged with: constructor
has title: Comparing two different arrayList
has comment: http://stackoverflow.com/comment/41895301

spring-data-cassandra
tags question: http://stackoverflow.com/q/26622936
tag name: spring-data-cassandra
type: Tag

http://stackoverflow.com/comment/41756039
has text: Any chance you swapped hours and minutes in the time calculation
comment on: http://stackoverflow.com/q/26568476
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26531479
accepted answer of: http://stackoverflow.com/q/26526238
answers question: http://stackoverflow.com/q/26526238
has body: You didn't mention whether you have the ultimate edition or not. If so, you can use Intellij's structural search feature. You can invoke it with &lt;CTRL&gt;-&lt;Shift&gt;-S or by navigating to Edit-&gt;Find-&gt;Search Structurally. To find all interfaces, use this template: interface $Interface$ {}. The $Interface$ part is a variable and can be parameterized with a regular expression so you can narrow down your search. The same principle applies for abstract classes and enums. Structural search is a powerful feature, make sure to take a look at the existing predefined templates.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/41692658
score: 6

http://stackoverflow.com/a/26592628
has body: Since you are creating a new Path every time you click and drag on the scene, it is not necessary to go over the whole list of paths to assign the event handlers. Just add them to the last new path. Besides, there's another problem, since you're using the global variable path on the mouseEventHandler2. You should refer to the path from e.getSource(). Otherwise, only the last path will react to mouse events. One last problem: if you try to drag an existing path, at the same time you are creating a new one... I guess that's the i==0 part, which doesn't make sense to me (assuming i is the number of paths, I don't see why you limit to just to 1 and then use a for-loop...). Basically, these are my modifications to your code (with the second drag event handler commented, and with no limit to path creation). private final EventHandler&lt;MouseEvent&gt; mouseEventHandler2 = (MouseEvent me) -&gt; { Path path1 = (Path)me.getSource(); if (me.getEventType() == MouseEvent.MOUSE_ENTERED) { path1.setEffect(new DropShadow(20, Color.BLACK)); } if (me.getEventType() == MouseEvent.MOUSE_EXITED) { path1.setEffect(null); } if (me.getEventType() == MouseEvent.MOUSE_DRAGGED) { path1.relocate(me.getX(), me.getY()); } }; private final EventHandler&lt;MouseEvent&gt; mouseEventHandler = (MouseEvent e) -&gt; { if (e.getEventType() == MouseEvent.MOUSE_PRESSED) { path = new Path(); path.setStroke(Color.BLACK); path.setStrokeWidth(10); path.getElements().add(new MoveTo(e.getX(), e.getY())); root.getChildren().add(path); } if (e.getEventType() == MouseEvent.MOUSE_DRAGGED) { path.getElements().add(new LineTo(e.getX(), e.getY())); } if (e.getEventType() == MouseEvent.MOUSE_RELEASED) { path.getElements().add(new LineTo(e.getX(), e.getY())); path.setOnMouseEntered(mouseEventHandler2); path.setOnMouseExited(mouseEventHandler2); // path.setOnMouseDragged(mouseEventHandler2); } };
accepted answer of: http://stackoverflow.com/q/26589503
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/26589503
type: Answer

http://stackoverflow.com/comment/41886577
type: QuestionComment
has text: *"I think my Menu class has errors present which prevents it from running"* Any error / exception messages? Please include them. Also, I recommend you debug your code (many IDEs have debugging tools such as step-by-step execution) to track where the problems are.
comment on: http://stackoverflow.com/q/26639734
score: 0
type: Comment

http://stackoverflow.com/comment/41863418
type: Comment
type: QuestionComment
has text: What is p1? have you defined it?
comment on: http://stackoverflow.com/q/26627083
score: 0

http://stackoverflow.com/comment/41794453
type: AnswerComment
has text: This command will do it correctly for you, but yeah, that is basically what will happen.
type: Comment
comment on: http://stackoverflow.com/a/26589026
score: 0

http://stackoverflow.com/comment/41917725
type: AnswerComment
has text: Ok I changed it, but the values where not taken, it just displayed Welcome ${FirstName} ${LastName}
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26657559

http://stackoverflow.com/comment/41888649
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26621389
has text: Either use a different layout (like `GridBagLayout`) or a compound series of layouts to achieve the desired results
type: Comment

http://stackoverflow.com/comment/41729012
type: Comment
has text: I have added my code for onSaveInstance and I've tried running Logs on the index. They are exactly the same. I am almost certain I am setting/getting correctly.
type: QuestionComment
comment on: http://stackoverflow.com/q/26553443
score: 0

http://stackoverflow.com/comment/50851446
has text: I am using `22.2.0` version of AppCompat but this trick is not working :(
score: 0
comment on: http://stackoverflow.com/a/30150754
type: AnswerComment
type: Comment

gwtp
tags question: http://stackoverflow.com/q/26595872
type: Tag
tag name: gwtp
tags question: http://stackoverflow.com/q/26543430

http://stackoverflow.com/comment/41829618
type: QuestionComment
comment on: http://stackoverflow.com/q/26608574
type: Comment
has text: @MarkoTopolnik True, I just tested it, because I didn't believe you!
score: 1

http://stackoverflow.com/comment/41886361
type: Comment
comment on: http://stackoverflow.com/a/26638834
type: AnswerComment
has text: I have edited my question and changed the web.xml. Can you please check if it's correct. It's still not working for me.
score: 0

http://stackoverflow.com/a/26537438
type: Answer
answers question: http://stackoverflow.com/q/26536687
has body: How do I remove it? A JTable is designed to display data with a header to describe the data in the column. Since you only have a single column of data, if you don't want the header then don't use a JTable. Instead you can use a JList. Read the section from the Swing tutorial on How to Use Lists for more information and examples.
score: 0

http://stackoverflow.com/q/26610383
has answer: http://stackoverflow.com/a/38759806
tagged with: admob
type: Question
has answer: http://stackoverflow.com/a/55817156
has answer: http://stackoverflow.com/a/49523809
has title: Admob No fill from ad server - failed to load ad: 3
has answer: http://stackoverflow.com/a/29669900
has answer: http://stackoverflow.com/a/30555124
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41834686
has answer: http://stackoverflow.com/a/50380498
score: 37
has answer: http://stackoverflow.com/a/48400575
has answer: http://stackoverflow.com/a/47909282
has answer: http://stackoverflow.com/a/31224183
downvote count: 0
has answer: http://stackoverflow.com/a/26830390
favorite count: 0
answer count: 19
upvote count: 37
has answer: http://stackoverflow.com/a/31846398
has comment: http://stackoverflow.com/comment/41835095
has body: My issue is that ads are not being displayed at all in my app, test mode or not. I am going to keep this question specific to test mode, and once I get that working I will worry about live ads. Development Information I am using Eclipse for development. I have setup ads using Google Play Services and Admob in my Android app, as described in the online documentation provided by Google. I have added my device ID using addTestDevice("xxxxxxxxxxxxxxxx"), and have checked the hashed device ID a number of times to be sure it is correct. The Issue (see below for log info) When I run the application on my device, no ads are displayed at all. This happens even when I have added my device as a test device. I have searched high and low, and turned up many similar issues, but am yet to find an answer to this specific problem. LogCat Output 10-28 13:56:41.659: I/Ads(1704): Starting ad request. 10-28 13:56:42.187: I/Ads(1704): No fill from ad server. 10-28 13:56:42.187: W/Ads(1704): Failed to load ad: 3 10-28 13:56:42.199: W/Ads(1704): No GMSG handler found for GMSG: gmsg://mobileads.google.com/jsLoaded?google.afma.Notify_dt=1414504602197 My Activity package bb.hoppingbird; import org.cocos2d.layers.CCScene; import org.cocos2d.nodes.CCDirector; import org.cocos2d.opengl.CCGLSurfaceView; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; import android.app.Activity; import android.content.SharedPreferences; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager.LayoutParams; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.widget.RelativeLayout; import android.widget.Toast; public class MainActivity extends Activity { private CCGLSurfaceView mGLSurfaceView; //&lt;!-- Admob Ads Using Google Play Services SDK --&gt; private static fina…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/48319528
tagged with: cocos2d-android
has answer: http://stackoverflow.com/a/79011084
linked to: http://stackoverflow.com/q/33566485
has comment: http://stackoverflow.com/comment/41834448
has answer: http://stackoverflow.com/a/65661164
has answer: http://stackoverflow.com/a/53969170
tagged with: java
has comment: http://stackoverflow.com/comment/41833498
has answer: http://stackoverflow.com/a/28523766
has comment: http://stackoverflow.com/comment/41834648
has answer: http://stackoverflow.com/a/33814463
has answer: http://stackoverflow.com/a/29713782
has answer: http://stackoverflow.com/a/34241531

http://stackoverflow.com/q/26590154
downvote count: 0
has title: Manually reset session timeout (keep alive) in a spring web application
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/52416694
upvote count: 2
type: Question
has body: Is it possible to manually reset the timeout interval of a specific session for a user that is currently logged in my web app? I would like the ability to do something similar to this : public void keepAliveForUser(long userID) { Session session = this.userSessionManager.getUserSessionById(userID); session.resetTimeOut(); } P.S - keep in mind this function is not being called in a follow up to a user request. (i.e. It's called from a cron job, a scheduled task, etc...) Thanks!
tagged with: session
tagged with: java
has answer: http://stackoverflow.com/a/26599860
answer count: 2

http://stackoverflow.com/comment/41900156
has text: Can i add my code please give me suggestion. problem is modify the file1 but documentlistener enabled for file2 not for file1. @MadProgrammer
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26646163

http://stackoverflow.com/comment/41773500
type: QuestionComment
comment on: http://stackoverflow.com/q/26577970
has text: it is showing the address not the data Fahad: hashtable.StudentReg@15db9742 Alan: hashtable.StudentReg@6d06d69c Ahmed: hashtable.StudentReg@7852e922
score: 0
type: Comment

http://stackoverflow.com/q/26640837
favorite count: 0
has body: I have updateNewPassword() in my controller which gets hString from request for the first time and when the second time its called I need to access hString again so am adding it to ModelAndView object mav before return statement as below but on the second call to updateNewPassword() am getting hString as null. Can someone please help me how to fix this? Am using Spring MVC 4 and JDK 7 @RequestMapping(method = { RequestMethod.GET, RequestMethod.POST }) public ModelAndView updateNewPassword(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { getCurrentRequestProperties().put(CurrentRequestProperties.IS_VALID_REQUEST, true); ModelAndView mav = new ModelAndView(); String hString = request.getParameter("hString"); String newPassword = request.getParameter("newPassword"); String confirmPassword = request.getParameter("confirmPassword"); if (StringUtils.isNotEmpty(newPassword) || StringUtils.isNotEmpty(confirmPassword)) { UserSecurityQuestions qRecord = api.search.query(UserSecurityQuestions.class, api.search.property("hashString").eq(hString)).first(); if (qRecord != null &amp;&amp; !qRecord.isValidRequest()) { mav.addObject("failedMessage", "forgot.url.expired"); } else { // updates the password } } else { mav.addObject("hString", hString); mav.addObject("notimeout", true); } return mav; }
upvote count: 2
has title: How to access parameter in spring controller method when its called second time
has comment: http://stackoverflow.com/comment/41888843
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/41889075
type: Question
has answer: http://stackoverflow.com/a/26645737
answer count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26645737

http://stackoverflow.com/q/26533490
score: 1
tagged with: java
has body: This is my code. It produces the error java.util.NoSuchElementException. It is meant to search a file, example.txt for a word (eg. and) and find all instances of the the word and print the word either side of it also (eg. cheese and ham, tom and jerry) in ONE JOptionPane. Code: import java.io.File; import java.util.Arrays; import java.util.Scanner; import javax.swing.JOptionPane; public class openFileSearchWord { public static void main(String Args[]) { int i=0,j=0; String searchWord = JOptionPane.showInputDialog("What Word Do You Want To Search For?"); File file = new File("example.txt"); try { Scanner fileScanner = new Scanner(file); String[] array = new String[5]; String[] input = new String[1000]; while (fileScanner.hasNextLine()) { for(i=0;i&lt;1000;i++) { input[i] = fileScanner.next(); if(input[i].equalsIgnoreCase(searchWord)) { array[j] = input[i-1] + input[i] + input[i+1]; j++; } } } Arrays.toString(array); JOptionPane.showMessageDialog(null, array); fileScanner.close(); } catch(Exception e) { System.out.println(e); } } }
type: Question
tagged with: arrays
answer count: 3
tagged with: file-io
has comment: http://stackoverflow.com/comment/41693146
upvote count: 1
possible better answer: http://stackoverflow.com/a/26533661
has title: Search for a word in a file results in java.util.NoSuchElementException
has answer: http://stackoverflow.com/a/26534190
favorite count: 0
has answer: http://stackoverflow.com/a/26533661
has answer: http://stackoverflow.com/a/26533651
accepted answer: http://stackoverflow.com/a/26533651
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41762556
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26570738
has text: And the class `MovingPoints` is?
type: QuestionComment

http://stackoverflow.com/comment/41862808
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/26549005
has text: Java has no top-level static class, similar question [here](http://stackoverflow.com/a/7486050/339286).
type: Comment

http://stackoverflow.com/comment/41669948
type: Comment
type: QuestionComment
score: 3
has text: `single` != `married`...one of those conditions HAS to fail...And I would think `String#equalsIgnoreCase` would be simpler...
comment on: http://stackoverflow.com/q/26520372

http://stackoverflow.com/q/26662320
has title: Disable highly verbose logging
tagged with: logback
tagged with: slf4j
has comment: http://stackoverflow.com/comment/41927536
has comment: http://stackoverflow.com/comment/41927050
answer count: 1
tagged with: log4j
has answer: http://stackoverflow.com/a/32069832
type: UnansweredQuestion
tagged with: logging
score: 0
tagged with: java
has body: I am getting this highly verbose logging and I want to get rid of it. 1:39:20.187 [main] INFO c.v.c.c.ConfigManager - End XML Read 11:39:20.187 [main] INFO c.v.c.c.ConfigManager - The content of ConfigCfg_pdMetering.xml is ConfigCfg [xxx=yyy] 11:39:37.335 [Thread-1] DEBUG o.a.h.c.p.RequestProxyAuthentication - Proxy auth state: UNCHALLENGED 11:39:37.335 [Thread-1] DEBUG o.a.h.i.c.DefaultHttpClient - Attempt 1 to execute request The logging comes from a jar I have imported in the project. I modified the logback.xml and log4j.properties in the jar using "jar uf" logback.xml now looks like: <?xml version="1.0"?> %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n <logger name="com.hccl" level="ERROR"/> <logger name="org.apache.http.wire" level="ERROR"/> <appender-ref ref="STDOUT"/> and log4j.properties: log4j.rootCategory=INFO, stdout log4j.logger.org.springframework.ws.client.MessageTracing.sent=ERROR log4j.logger.org.springframework.ws.client.MessageTracing.received=ERROR log4j.logger.org.springframework.ws.server.MessageTracing=ERROR log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n log4j.logger.httpclient.wire=ERROR I imported this modified jar and imported it to my project. This has not affected the logging. Also I am getting the following in the console: SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] I do not know why I am seeing this warning.
type: Question

http://stackoverflow.com/comment/41835344
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26611771
has text: This is a duplicate question to many others on this site, please google your questions or look them up on this site before posting a question
score: 0

http://stackoverflow.com/q/26667988
has answer: http://stackoverflow.com/a/26668017
has answer: http://stackoverflow.com/a/26668019
has answer: http://stackoverflow.com/a/26668187
upvote count: 1
tagged with: methods
has comment: http://stackoverflow.com/comment/41937247
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41937296
has body: I want to create a method to add the Arraylist firstRow. But I keep getting the error nullPointerexception. Its because of the for loop for(int i = 0; i&lt;firstRow.length; i++) in the getArraylistsum() method Here is the whole code: int[] row1; public int getArraylistsum(){ int sum = 0; for(int i = 0; i&lt;row1.length; i++){ sum += row1.length; } return sum; } public static void main(String[] args){ ArrayList&lt;Integer&gt; row1 = new Arraylist&lt;&gt;(10); row1.add(1); row1.add(8); row1.add(6); ClassName row = new ClassName(); System.out.println(row.getArraylistsum()); } Thanks for your help.
has title: Adding Arraylist values method java
tagged with: java
has answer: http://stackoverflow.com/a/26668009
has comment: http://stackoverflow.com/comment/41937276
has answer: http://stackoverflow.com/a/26668580
score: 0
has answer: http://stackoverflow.com/a/26668084
has comment: http://stackoverflow.com/comment/41937309
answer count: 7
has answer: http://stackoverflow.com/a/26668045
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41937393
type: UnansweredQuestion

http://stackoverflow.com/q/26560198
has body: This has reference to JFreeChart rendering of candlestick charts. Below is the code fragment that generates a candle stick chart with JFreeChart. This code has been tested and has been working for a long time. However, the version of JFreeChart was changed from 1.0.17 to 1.0.19 and the candlestick chart generated with 1.0.19 is showing smudging of the candle objects/lines. When I changed the library back to 1.0.17, the candlestick objects/lines once again becomes clear. The images with both the libraries are provided below. I have tried to find the cause of this and have been unsuccessful as yet. Now, the question is, since the code is tested and possibly does not have any error (at least what I can figure or am I missing something?), is the issue with the library? Have anyone faced this problem and has an work around I shall be rather grateful, if someone has found the reason/solution to this and shared the same. Please use MS Paint to view the images. try{ chart=ChartFactory.createCandlestickChart("Candlestick Chart", "Date", "EOD Closing Price", (OHLCDataset)dataset, true); plot=(XYPlot)chart.getPlot(); CandlestickRenderer renderer=new Chart_CandlestickRenderer();//(CandlestickRenderer)plot.getRenderer(); renderer.setSeriesPaint(0, Color.BLACK); renderer.setUpPaint(Color.WHITE); renderer.setDownPaint(Color.BLACK); //HighLowItemLabelGenerator candleTooltipGenerator=new HighLowItemLabelGenerator(new SimpleDateFormat("dd-MMM-yyyy"), new DecimalFormat()); XYToolTipGenerator candleTooltipGenerator=Chart_TooltipProvider.getOHLCTooltipGenerator(); renderer.setBaseToolTipGenerator(candleTooltipGenerator); plot.setRenderer(0,renderer); //Organize the data to draw Fibbonacci retracements with highs and lows DefaultOHLCDataset ohlcDataset=(DefaultOHLCDataset)dataset; int dataCount=ohlcDataset.getItemCount(0); data=new double[dataCount*2];//for each data item we shall get 2 values, high and low for(int i=0;i&lt;dataCount;i++){ //for each i 2 data values need to be put into t…
tagged with: swing
tagged with: jfreechart
type: Question
has title: JFreeChart Smudging of lines in Candlestick Chart
has comment: http://stackoverflow.com/comment/41780170
score: 0
has comment: http://stackoverflow.com/comment/41834701
has comment: http://stackoverflow.com/comment/41741005
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32841087
has comment: http://stackoverflow.com/comment/41744857
has comment: http://stackoverflow.com/comment/41744182
tagged with: java

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/26615305
tags question: http://stackoverflow.com/q/26597486
tags question: http://stackoverflow.com/q/26545997
type: Tag

http://stackoverflow.com/comment/41839574
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26600240
has text: I have changed my entire code yet again. I need your help, again!

http://stackoverflow.com/a/26557724
downvote count: 0
has body: The Strings you pre-define in the xml have dynamically generated ids in the R.java class. For example R.string.question_africa is an integer, pointing to your saved String resource. You can open the R.java class and see the exact integers that refer to your strings but it won't mean anything to you since they're automatically generated. setText() method can be called on different variables, in your example is setText(int resId), where resId is a resource id More: http://developer.android.com/reference/android/widget/TextView.html#setText(int)
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26557637

http://stackoverflow.com/q/26617649
has answer: http://stackoverflow.com/a/26662492
has answer: http://stackoverflow.com/a/26618021
has title: RabbitMQ: fast producer and slow consumer
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: multithreading
tagged with: rabbitmq
has body: I have an application that uses RabbitMQ as the message queue to send/receive message between two components: sender and receiver. The sender sends message in a very fast way. The receiver receives the message and then does some very time-consuming task (mainly database writing for very large data size). Since the receiver takes a very long time to finish the task and then retrieve the next message in the queue, the sender will keep filling up the queue quickly. So my question is: Will this cause the message queue to overflow? The message consumer looks like the following: public void onMessage() throws IOException, InterruptedException { channel.exchangeDeclare(EXCHANGE_NAME, "fanout"); String queueName = channel.queueDeclare("allDataCase", true, false, false, null).getQueue(); channel.queueBind(queueName, EXCHANGE_NAME, ""); QueueingConsumer consumer = new QueueingConsumer(channel); channel.basicConsume(queueName, true, consumer); while (true) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); String message = new String(delivery.getBody()); System.out.println(" [x] Received '" + message + "'"); JSONObject json = new JSONObject(message); String caseID = json.getString("caseID"); //following takes very long time dao.saveToDB(caseID); } } Each message received by the consumer contains a caseID. For each caseID, it will save large amount of data to the database, which takes very long time. Currently only one consumer is set up for the RabbitMQ since producer/consumer use the same queue for the publish/subscribe of caseID. So how can I speed up the consumer throughput so that the consumer can catch up with the producer and avoid the message overflow in the queue? Should I use multithreading in the consumer part to speed up the consumption rate? Or should I use multiple consumers to consume the incoming message simutaneously? Or is there any asynchronous way to let the consumer consume the message asynchronously without waiting it to finish? Any suggestion…
tagged with: java
has answer: http://stackoverflow.com/a/26618748
type: Question
upvote count: 22
has answer: http://stackoverflow.com/a/26660425
tagged with: amqp
downvote count: 0
has answer: http://stackoverflow.com/a/26617782
score: 22
tagged with: producer-consumer

http://stackoverflow.com/q/26595305
type: UnansweredQuestion
has title: Run user code in Jboss as a nonroot account
has comment: http://stackoverflow.com/comment/41805404
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41805259
tagged with: jboss
score: 0
has body: Is there a way to designate an account in Jboss 7.1.1 to run user code under, without running the whole Jboss process as that account?
tagged with: linux

http://stackoverflow.com/comment/41855470
type: QuestionComment
comment on: http://stackoverflow.com/q/26622525
has text: you will have to post SalesPerson, AnnualSales and main class too, as from above code it we are not able to make the flow out of it. Or probably post some other code which will replicate the issue you are getting.
score: 0
type: Comment

http://stackoverflow.com/q/26515618
favorite count: 0
tagged with: runtime-error
tagged with: exception
answer count: 1
accepted answer: http://stackoverflow.com/a/26848498
has body: I am new to programming and this was my first time on codechef. I am getting proper output as required when i run it in cmd, but when i submit on codechef it keeps saying run time error. Here is my code, can some one please help me. This is the problem: http://www.codechef.com/problems/TIDRICE import java.io.*; import java.lang.*; import java.util.*; class Rice { public static void main(String args[]) throws IOException { String a[][]=new String[20][100]; String name[]=new String[100]; String vote[]=new String[100]; int x,y,j; int count=0; int flag=0; int counts[]=new int[20]; Scanner sc=new Scanner(System.in); x=sc.nextInt(); for(int i=0;i&lt;x;i++) { y=sc.nextInt(); for(j=0;j&lt;y;j++) { a[j][0]=sc.nextLine(); String[] parts=a[j][0].split(" "); name[j]=parts[0]; vote[j]=parts[1]; if(parts[1].equals("+")&amp;&amp;(j==0)) { count=count+1; } if(parts[1].equals("-")&amp;&amp;(j==0)) { count=count-1; } if((parts[1].equals("+"))&amp;&amp;(j&gt;0)&amp;&amp;(parts[0].equals(name[j-1]))&amp;&amp;(vote[j].equals("+"))) { count=count+0; } if((parts[1].equals("+"))&amp;&amp;(j&gt;0)&amp;&amp;(!(parts[0].equals(name[j-1])))) { count=count+1; } if((parts[1].equals("-"))&amp;&amp;(j&gt;0)&amp;&amp;((!parts[0].equals(name[j-1])))) { count=count-1; } if((parts[1].equals("-"))&amp;&amp;(j&gt;0)&amp;&amp;(parts[0].equals(name[j-1]))&amp;&amp;(vote[j].equals("+"))) { count=count-2; } if((parts[1].equals("+"))&amp;&amp;(j&gt;0)&amp;&amp;(parts[0].equals(name[j-1]))&amp;&amp;(vote[j].equals("-"))) { count=count+2; } } counts[i]=count; count=0; flag=flag+1; } for(int k=0;k&lt;flag;k++) System.out.println(counts[k]); } }
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42532580
type: Question
has title: Getting runtime(NZEC) error when submitting it on codechef
has answer: http://stackoverflow.com/a/26848498
upvote count: 0

http://stackoverflow.com/comment/41760019
comment on: http://stackoverflow.com/q/26570753
has text: Then it seems you have problems with either `/`,`\` or `whitespace`. Does your file name have any space?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26605996
has comment: http://stackoverflow.com/comment/41843410
has comment: http://stackoverflow.com/comment/41864163
has comment: http://stackoverflow.com/comment/41863566
has comment: http://stackoverflow.com/comment/41841240
score: 0
has comment: http://stackoverflow.com/comment/41827497
type: Answer
answers question: http://stackoverflow.com/q/26605297
has comment: http://stackoverflow.com/comment/41824710
has comment: http://stackoverflow.com/comment/41863720
has body: You can use the mvc:resources tag to load items you consider resources. &lt;mvc:resources location="/web-inf/&lt;path to html file&gt;" mapping="&lt;url context in a browser&gt;" cache-period="86400"/&gt; Reference: http://docs.spring.io/spring/docs/4.1.2.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/#mvc-config-static-resources
has comment: http://stackoverflow.com/comment/41864462
has comment: http://stackoverflow.com/comment/41842867
has comment: http://stackoverflow.com/comment/41863600
has comment: http://stackoverflow.com/comment/41863818
has comment: http://stackoverflow.com/comment/41824891

http://stackoverflow.com/q/26553314
answer count: 1
duplicate of: http://stackoverflow.com/q/24437564
favorite count: 0
tagged with: android
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/19409137
tagged with: java
has title: save an audio file to a newly created folder - android development
linked to: http://stackoverflow.com/q/24437564
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26554938
has body: I'm working on an android app and part of it records audio. My code works fine and it saves the recorded audio in the SD card using the following code: String mediaFile = null; mediaFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myRecordings.mp3"; But I want to create a folder with the app name and be able to save recorded audio to that folder. Can someone tell me how to do that? I succeeded in creating the folder but I don't know how to move the mediaFile in there: String newFolder = "/FolderName"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File myNewFolder = new File(extStorageDirectory + newFolder); myNewFolder.mkdir(); mediaFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myRecordings.mp3" Appreciate any help. Thanks
accepted answer: http://stackoverflow.com/a/26554938

http://stackoverflow.com/a/26557425
type: Answer
score: 1
upvote count: 1
has body: You have to specify the generic type for the method public &lt;T&gt; List&lt;T&gt; mapObjectArrayListToClassList(List&lt;Object[]&gt; objectArrayList, Class&lt;T&gt; genericType) Note: Raw types like List and Class compile in Java but don't use them, they are evil.
downvote count: 0
answers question: http://stackoverflow.com/q/26557233

http://stackoverflow.com/q/26528828
has title: Android. Release build service not started
has comment: http://stackoverflow.com/comment/41684244
tagged with: android
has comment: http://stackoverflow.com/comment/41685326
answer count: 0
type: UnansweredQuestion
has body: I have to weird behavior of application. In manifest I declare service with name &lt;service android:name="com.qwerty.SomeService" android:process=":qwerty"/&gt; When application worked in debug mode service started normally with no problem, but when application signed for release service not started. In case if I remove android:process=":qwerty" service also started normally in release build, but with process name no.. Device Nexus 7 I really puzzled. Please help me to solve this situation. Any help will be appreciated
tagged with: java
type: Question
tagged with: android-service
score: 0

http://stackoverflow.com/a/26568355
has comment: http://stackoverflow.com/comment/41756829
accepted answer of: http://stackoverflow.com/q/26568272
has comment: http://stackoverflow.com/comment/41755962
answers question: http://stackoverflow.com/q/26568272
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41756211
type: Answer
upvote count: 3
has body: The problem is that you are reusing the variables and overwriting it. double investmentAmount; //the amount the user chooses to invest, expressed as a double investmentAmount = Double.parseDouble(InputInvestmentAmount); Double OrginalInvestment; OrginalInvestment=investmentAmount;//this is too keep your orginal investment double Interest; // amount of interest in percent, expressed as a double Interest = Double.parseDouble(InputInterest); double YearsInvested; //the total years (under 15) the user wants to invest, expressed as a double YearsInvested = Double.parseDouble(InputYearsInvested); double Zero = 0; //a starting point for the year double Total; System.out.println("Years Invested \t\tAmount in Account\t\tInterest\t\tTotal"); if (YearsInvested &gt;=16) { JOptionPane.showMessageDialog(null,"I am sorry. Please make sure that you are investing your money for " + "less than 16 years.", "Compound Investing Calculator",JOptionPane.ERROR_MESSAGE); } double IntrestMoney; do { Zero++; //the year IntrestMoney = investmentAmount*(Interest/100); Total = investmentAmount+IntrestMoney; System.out.format("%5.2f%32f%28f%25f%n",Zero,investmentAmount,IntrestMoney,Total); investmentAmount=Total+OrginalInvestment; // } while (YearsInvested &lt;= 15 &amp;&amp; Zero&lt;=YearsInvested-1); } This is the output if you use $200 as your investment, 10% as your rate, 5 years as your duration : Years Invested Amount in Account Interest Total 1.00 200.000000 20.000000 220.000000 2.00 420.000000 42.000000 462.000000 3.00 662.000000 66.200000 728.200000 4.00 928.200000 92.820000 1021.020000 5.00 1221.020000 122.102000 1343.122000 Edit since too long decimal points are going to mess up your table I suggest to round your answers to 4 decimal values you can use this following method: public static double round(double value, int places) { if (places &lt; 0) { throw new IllegalArgumentException(); } BigDecimal bd = new BigDecimal(value); bd = bd.setScale(places, BigDecimal.ROUND_HALF_UP); return …
score: 3

http://stackoverflow.com/comment/41692664
comment on: http://stackoverflow.com/q/26532473
score: 0
type: QuestionComment
has text: My comment goes to define the `@Autowired` and `@Qualifier` in the setter of the subclass, for your case, in `Warrior` and `Archer` classes, while in `Hero` class you only define `Weapon`.
type: Comment

http://stackoverflow.com/comment/41852842
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26618647
has text: I've got 1MB of xsds that are constructed that way. Isn't it feasible to write a xjc plugin that handles the type restrictions?
score: 0

http://stackoverflow.com/comment/42013415
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26646842
has text: good logic. How to do same thing for third row(another arraylist)
score: 0

http://stackoverflow.com/q/26528850
answer count: 1
tagged with: jframe
has comment: http://stackoverflow.com/comment/41693214
tagged with: swing
accepted answer: http://stackoverflow.com/a/26530698
type: AnsweredQuestion
has title: How can make the first window close when i go to the second?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
has body: When I select the create option it will still show the options. public Assign(){ setLayout(new BorderLayout()); JPanel jpnButton = new JPanel(); jpnButton.add(jbtCreate); //the selection for user to choose jpnButton.add(jbtRetrieve); jpnButton.add(jbtUpdate); jpnButton.add(jbtDelete); add(jpnButton, BorderLayout.CENTER); jbtCreate.addActionListener(new ActionHandle()); jbtRetrieve.addActionListener(new ActionHandle()); jbtUpdate.addActionListener(new ActionHandle()); jbtDelete.addActionListener(new ActionHandle()); setTitle("Manage Supplier"); setSize(500,100); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public class ActionHandle implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == jbtCreate){ //if the user choose to create a new supplier then it will come out the previous selection together- Create,retrieve,update and delete add(ptn1, BorderLayout.CENTER); add(ptn2, BorderLayout.SOUTH); ptn1.setBorder(new TitledBorder(null, "New Supplier Details")); ptn1.add(new JLabel("Company Name")); ptn1.add(jtxt1); ptn1.add(new JLabel("Address")); ptn1.add(jtxt2); ptn1.add(new JLabel("Town")); ptn1.add(jtxt3); ptn1.add(new JLabel("Postcode")); ptn1.add(jtxt4); ptn1.add(new JLabel("Country")); ptn1.add(jtxt5); ptn1.add(new JLabel("Contact Information")); ptn1.add(new JLabel("Contact Name")); ptn1.add(jtxt6); ptn1.add(new JLabel("Email")); ptn1.add(jtxt7); ptn1.add(new JLabel("Product Supply")); ptn1.add(jtxt8); ptn2.add(jbtOK); ptn2.add(jbtCancel); setSize(1000,500); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
has answer: http://stackoverflow.com/a/26530698
score: 0
has comment: http://stackoverflow.com/comment/41687509

http://stackoverflow.com/q/26533926
type: UnansweredQuestion
tagged with: android-intent
has title: How to call the selected item from one layout to another layout?
tagged with: java
has body: I'm new to android java coding. i have did my java class and xml layout, but i'm stuck at view. I don't know how to make the selected item from menu.xml to be shown on view.xml layout? Here is my coding for menu and view. This is my menu.java . import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.Toast; import java.util.ArrayList; public class MenuActivity extends Activity { Button btnorder; Button btnback; Button btnlinkcart; ArrayList&lt;String&gt; checked_item = new ArrayList(); CheckBox pizza_large; CheckBox pizza_medium; CheckBox pizza_personal; CheckBox Chicken_wings; CheckBox garlic_bread; CheckBox drink_large; CheckBox drink_medium; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu); btnlinkcart = (Button) findViewById(R.id.button1); btnback = (Button) findViewById(R.id.button2); pizza_large = (CheckBox) findViewById(R.id.checkBox1); pizza_medium = (CheckBox) findViewById(R.id.checkBox2); pizza_personal = (CheckBox) findViewById(R.id.checkBox3); Chicken_wings = (CheckBox) findViewById(R.id.checkBox4); garlic_bread = (CheckBox) findViewById(R.id.checkBox5); drink_large = (CheckBox) findViewById(R.id.checkBox6); drink_medium = (CheckBox) findViewById(R.id.checkBox7); //TODO:repeat for the rest // protected void onCreate(Bundle savedInstanceState) { // // TODO Auto-generated method stub // super.onCreate(savedInstanceState); // setContentView(R.layout.menu); // back button click event btnback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MenuActivity.this, MainActivity.class); startActivity(intent); } }); //array to store what item is checked // Link to Cart Screen btnlinkcart.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if(pizza_large.isChecked())…
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/26534787
score: 0
tagged with: android
answer count: 1
tagged with: android-activity

http://stackoverflow.com/a/47822745
type: Answer
answers question: http://stackoverflow.com/q/26578465
score: 0
has body: Your Code look like this in manifest file <action android:name="android.provider.Telephony.SMS_RECEIVED"/> Add the following to your in the manifest: android:enabled="true" android:exported="true"> Furthermore, according to this thread, it seems that you have to manually start one of your activities before the broadcast receiver will start working, i.e. the application has to have been launched at least once before any broadcast receiver will work.

http://stackoverflow.com/comment/41946111
type: QuestionComment
comment on: http://stackoverflow.com/q/26651855
has text: @hchawla: You still can write an answer and accept it to help future visitors with similar problems. As for the credit sometimes 'thank you' is enough. :)
score: 1
type: Comment

http://stackoverflow.com/a/50705619
has body: I solved putting below connection string in the URL jdbc:mysql://localhost:3306/db?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
upvote count: 34
type: Answer
answers question: http://stackoverflow.com/q/26515700
score: 34
has comment: http://stackoverflow.com/comment/98096527
downvote count: 0

http://stackoverflow.com/comment/41818499
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26602385
score: 0
has text: That still doesn't tell anything, it greatly varies if there is 1, 10 or 10000000 objects to create. Also your objects are `@Configurable` meaning that they are dependency injected with Spring, which also takes time. So again I doubt the problem is the query but the amount of objects that need to be created and what those objects do (i.e. `@Configurable`).

apache-spark
tags question: http://stackoverflow.com/q/26615972
tags question: http://stackoverflow.com/q/26535530
tags question: http://stackoverflow.com/q/26532378
tag name: apache-spark
tags question: http://stackoverflow.com/q/26611471
tags question: http://stackoverflow.com/q/26611307
tags question: http://stackoverflow.com/q/26526717
tags question: http://stackoverflow.com/q/26658451
tags question: http://stackoverflow.com/q/26667435
tags question: http://stackoverflow.com/q/26562869
type: Tag

http://stackoverflow.com/q/26541013
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/26541057
has answer: http://stackoverflow.com/a/26541057
has answer: http://stackoverflow.com/a/26541029
has comment: http://stackoverflow.com/comment/41706804
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26541082
tagged with: loops
type: Question
upvote count: 2
has body: I am trying to solve a problem using java where I have to print the number the same number of time as the number itself. For example 1 will be printed once 2 twice 3 thrice and so on. I tried to attempt the question using nested loop but it is going into infinite loop. Please pinpoint the mistake in the code. Thanks! { for (int i=1;i&lt;=10;i=i+1) { for (int j=1;j&lt;=i; j=i) { jTextArea1.append(""+j); } } } P.S I attempted this question using netbeans.
answer count: 3
has comment: http://stackoverflow.com/comment/41706784
downvote count: 1
has title: Program into infinite loop -Java
accepted answer: http://stackoverflow.com/a/26541029
favorite count: 0

http://stackoverflow.com/a/26662144
has body: The answer is: It depends. You shouldn't think too much about the performance implications for this case. the performance difference between the two is not big enough to notice. What you really need to be on the look out for is readability and maintainability. if i, j, and k, all essentially mean the same thing, and you're going to be using them the same way, and you feel like you might want to iterate over them, then it might make sense to use an array, so that you can iterate over them more easily. if they're different values, with different meanings, and you're going to be using them differently, than it does not makes sense to include them in an array. They should each have their own identity, and their own descriptive variable name.
answers question: http://stackoverflow.com/q/26662081
type: Answer
upvote count: 5
downvote count: 0
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26662081

http://stackoverflow.com/comment/41687194
score: 0
comment on: http://stackoverflow.com/q/26527539
type: Comment
type: QuestionComment
has text: Which DBMS are you using? Postgres? Oracle?

http://stackoverflow.com/a/26534167
type: Answer
has body: Syntax error. Where you have =+ should be +=. The compiler does not object because it's still a valid statement.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26534049
downvote count: 0

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/26532080
tags question: http://stackoverflow.com/q/26538542
type: Tag

http://stackoverflow.com/a/26569992
score: 3
answers question: http://stackoverflow.com/q/26569859
has body: Be aware! float and double can break your heart when used with a calculator. These types are not for doing taxes or balancing a checkbook. Why? Because they don't use 10 digit numbers like you and I. They use binary numbers. With whole numbers that's no problem but with fractions you run into problems that are hard to see because java ACCEPT'S them in base 10, DISPLAY'S them in base 10, but it doesn't STORE them in base 10. That can make it hard to realize that there is no such thing as 0.1 in a float or double. It's as impossible to perfectly express as π is for us in base 10. When you pull it back out it might display that way because of rounding but that is not what was stored and that is not what you'll be calculating against. This is why Calculators do NOT use the IEEE floats and doubles. These types are intended for use with scientific instruments for taking measurements and doing calculations that are fine with precision limits. If you are modeling a calculator like you used in grade school take note that those do NOT use IEEE floats or doubles for this very reason. For more about this issue read this and this Instead some very smart people have created something that's perfect for modeling calculators: java.math.BigDecimal; If you're the visual type let me show you something that might make the difference between BigDecimal and float and double clear: These rulers both show inches. For whole inches there is no difference between them. However, they divide inches differently. The top one divides by 10's. The bottom one divides by 2's. The top can be perfectly modeled by BigDecimal. The bottom can be perfectly modeled by float or double. Some of the ticks will line up like .5 because 5/10 = 1/2 but 1/10 = x / (2^n) doesn't have a solution where x and n are whole numbers. Because humans have a long tradition of using base ten numbers in calculators I don't recommend letting floats or doubles anywhere near your accountant. import java.math.BigDecimal; import jav…
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/a/29509830
score: 0
has body: I think the question and your doubts revolves on the basic, and furthor more I will try to answer What is Page Object design pattern exactly? Well, Page Objects are some sort of an API to a page (or a view) you have in your system, lets think of it as more as “Services” the page gives the tester… Once it is seen as so, I believe its easier to think of the motivation... A Page Object knows the internal of its matching HTML page (or view) and it alone knows it… For example, if we would like to perform login (as a user) we are provided with these services: We type a username in the username input. We can type a password in the password input. We can click on the ‘Login’ button (Expecting failure or success). Of course there are more “Services” given, but we can stop here and get back to the point… What are we supposed to do with these “Services”? Thats the easy part: We need to create a “LoginPage” object that know the (private) selectors of the page and the HTML construct (ids, classes, xpaths and so on…). What is public to the tester? The services we just talked about above… A tester can ask the login page to “TypeUsername(string inputUsername)” or TypePassword(string inputPassword) – You can also add “Services” like “LoginAsDefaultUser()” if you are using this page to test other pages… The Problem While this a good start, it leaves a lot of room for improvement. The most obvious problem is that there are common actions we will likely need across multiple Page Objects. And with our current approach we would end up with duplicative code. A Solution When creating a BasePage Object that wraps Selenium core, and each page Inherit from this page (directly or in directly) we are creating a dynamic environment that is not coupled and if somewhere a page (or view) has change you need to fix only one specific object. Summary Even though it is called the Page Object design pattern, it is more as a View Object design pattern, for example: If in your platform there is a left men…
answers question: http://stackoverflow.com/q/26582395
type: Answer

http://stackoverflow.com/a/26655687
has comment: http://stackoverflow.com/comment/41981610
has comment: http://stackoverflow.com/comment/42002615
type: Answer
has comment: http://stackoverflow.com/comment/41981622
answers question: http://stackoverflow.com/q/26655607
downvote count: 0
score: 2
has body: I'd like to call the original (not overriden) method. You can't do that from outside the subclass. From the subclass itself, you can call super.my_method(); which will always call the superclass implementation, even if it's been overridden in this class. But to be able to do that outside the subclass would reduce encapsulation.
upvote count: 2

http://stackoverflow.com/a/26571018
has comment: http://stackoverflow.com/comment/41760473
has comment: http://stackoverflow.com/comment/41761193
has comment: http://stackoverflow.com/comment/41760811
type: Answer
has comment: http://stackoverflow.com/comment/41760648
has comment: http://stackoverflow.com/comment/41760435
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41760757
has comment: http://stackoverflow.com/comment/41760973
has comment: http://stackoverflow.com/comment/41760915
has comment: http://stackoverflow.com/comment/41760733
has comment: http://stackoverflow.com/comment/41760529
has comment: http://stackoverflow.com/comment/41761227
has body: Change if (names[j].compareTo(names[j - 1]) &gt; 0) { to if (names[j] != null &amp;&amp; names[j].compareTo(names[j - 1]) &gt; 0) { And the annoying null pointer exception will go away. If you ever get over your 500 String array obsession I suggest you try TreeSet since it will do all the sorting work for you. public static void main(String[] args) { Set&lt;String&gt; alphabetical = new TreeSet&lt;String&gt;(); alphabetical.add("A"); alphabetical.add("Z"); alphabetical.add("M"); System.out.println(alphabetical); } outputs: [A, M, Z]
has comment: http://stackoverflow.com/comment/41760430
answers question: http://stackoverflow.com/q/26570949
has comment: http://stackoverflow.com/comment/41760826
downvote count: 0
has comment: http://stackoverflow.com/comment/41760842

http://stackoverflow.com/comment/41842400
comment on: http://stackoverflow.com/q/26613872
score: 0
type: Comment
type: QuestionComment
has text: @Brandon It is also unsafe because the Thread can be erroneously started more than once if `start` is called from multiple threads without synchronization (`t` is not volatile). But it is from [a wrong tutorial](http://www.tutorialspoint.com/java/java_multithreading.htm), the OP did not come up with it.

http://stackoverflow.com/comment/75835522
comment on: http://stackoverflow.com/a/44418075
type: Comment
has text: The accepted answer posted 3 years earlier already mentions this, I'm not sure what this answer adds beyond that.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26616032
answers question: http://stackoverflow.com/q/26615540
has comment: http://stackoverflow.com/comment/108513804
score: 12
has body: First of all, look at these: @JacksonXmlElementWrapper(localName = "Cards") private List&lt;Card&gt; cards; And then look at the error: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Card" (class com.cardshifter.core.cardloader.XmlCardLoader$Cards) Nowhere does it say "Card" in your class. Secondly, after fixing that, here's how I solved your entire loading: private static class Cards { @JacksonXmlElementWrapper(localName = "Card") @JsonProperty("Card") private List&lt;Card&gt; card = new ArrayList&lt;&gt;(); @JsonSetter public void setCard(Card card) { this.card.add(card); } } The setCard method simply tells Jackson that if it encounters this, it should interpret it as a Card, and then you provide the method that adds it to the array.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/108481373
has comment: http://stackoverflow.com/comment/108513764
type: Answer
upvote count: 12
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26615540

http://stackoverflow.com/comment/41671448
has text: @capslock, if u don't mind can u check my new code? and edit that please
comment on: http://stackoverflow.com/a/26521048
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26591255
tagged with: swing
has answer: http://stackoverflow.com/a/26631400
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: swingx
has title: JXtreeTable ignores getValueAt for tree-nodes
tagged with: treetable
has comment: http://stackoverflow.com/comment/41798974
has body: I have a JXTreeTable, which has a tree of nodes (different datatypes) on the left side and a grid on the right side (as default). Now I want that all displayed values (also the tree-captions) are taken from the getValueAt(row,column) method, but instead of the tree-nodes are rendered as by their toString() method How can I force the JXTreeTable not to take the class-specific toString() and use the Value returned by getValueAt(...)? thanks! here is my model: public class TreeTableGroupTreeTableModel extends AbstractTreeTableModel { private final static String[] COLUMN_NAMES = { "Tree", "Add/Edit", "Remove" }; //Group-Hierarchy: private JXGroup groupRootObject; public TreeTableGroupTreeTableModel(JXGroup groupRoot) { this.groupRootObject = groupRoot; } // Here is my structure: //GROUP 1-1 ModuleAggregation 1-* Modules 1-1 JXGroupAccessMemberAggregation 1-* JXGroupAccessSimpleUserObjectLeaf /** * Returns the value for the node at columnIndex. The node must be managed * by this model. Unamanaged nodes should throw an IllegalArgumentException. * * * node - the node whose value is to be queried column - the column whose * value is to be queried */ @Override public Object getValueAt(Object node, int column) { System.out.println(node.getClass()); if (node instanceof JXGroup) { switch (column) { case 0: return "this should render this string instead of the class tostring()";//((JXGroup) node); case 1: case 2: return ""; } } else if (node instanceof JXGroupAccessModuleAggregation) { switch (column) { case 0: return "Modules"; case 1: return "ADD"; case 2: return "REMOVE ALL"; } } else if (node instanceof JXGroupAccessModule) { switch (column) { case 0: return ((JXGroupAccessModule) node).getModule(); case 1: return "ADD"; case 2: return "REMOVE"; } } else if (node instanceof JXGroupAccessMemberAggregation) { switch (column) { case 0: return "Members"; case 1: return "ADD"; case 2: return "REMOVE ALL"; } } else if (node instanceof JXGroupAccessSimpleUserObjectLeaf) { switch (c…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41871036

http://stackoverflow.com/comment/41670035
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26520237
has text: create a set to track the guesses

http://stackoverflow.com/comment/41943376
type: QuestionComment
has text: Do you access your Webservice using HTTPS? Because in that case you may need to add the servers certificate to your clients truststore
comment on: http://stackoverflow.com/q/26671478
score: 0
type: Comment

http://stackoverflow.com/q/26542123
tagged with: java
has comment: http://stackoverflow.com/comment/41708405
type: Question
has comment: http://stackoverflow.com/comment/41709897
has body: I am using a JTextPane and want to show text in two columns for only a part of the content. I can't use HTML because I have to show an icon on the UI as well(I get an instance of javax.swing.Icon from an external API and I add it using StyleConstants.setIcon). I need a layout like this but using a DefaultStyledDocument. Is this achievable? If so how can I do it? Following is my code. I would like to have Paragraph2 and Paragraph3 side-by-side. import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.image.BufferedImage; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.text.DefaultStyledDocument; import javax.swing.text.Document; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.Style; import javax.swing.text.StyleConstants; public class Test { public static void main(String[] args) { try { JFrame f = new JFrame("Test"); f.getContentPane().setLayout(new GridBagLayout()); JTextPane pane = new JTextPane(); URL url = new URL( "http://files.softicons.com/download/toolbar-icons/fatcow-hosting-icons-by-fatcow/png/32/status_online.png"); BufferedImage img = ImageIO.read(url); ImageIcon icon = new ImageIcon(img); Document document = pane.getDocument(); Style style = ((DefaultStyledDocument) document).addStyle("StyleName", null); StyleConstants.setIcon(style, icon); document.insertString(document.getLength(), "ignored text", style); document.insertString(document.getLength(), "\n\nParagraph 1. Lorem Ipsum is simply dummy text of the printing and typesetting industry. " + "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s," + " when an unknown printer took a galley of type and scrambled it to make a type specimen book." + " It has survived not only five centuries, but also the leap into electronic typesetting", new SimpleAttributeSet()); document…
score: 0
has title: How to Show Text in Two columns in JTextPane without using HTMLDocument?
tagged with: jeditorpane
has comment: http://stackoverflow.com/comment/41709005
answer count: 0
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/41665435
score: 0
comment on: http://stackoverflow.com/q/26517696
type: QuestionComment
has text: (although this will not work anyway if the array is not sorted, obviously)
type: Comment

http://stackoverflow.com/q/26592091
has answer: http://stackoverflow.com/a/26592364
answer count: 3
tagged with: arrays
has body: For a class assignment I have to write a method that called encodeChars that takes an array of characters and shifts each lowercase letter in the array up by one. The method is supposed to modify the array passed in and has no return value. My existing code is as follows: public void encodeChars(char[] change){ for (int x = 0; 0 &lt; change.length; x++){ switch (change[x]){ case('a'): change[x] = 'b'; break; case('b'): change[x] = 'c'; break; case('c'): change[x] = 'd'; break; case('d'): change[x] = 'e'; break; case('e'): change[x] = 'f'; break; case('f'): change[x] = 'g'; break; case('g'): change[x] = 'h'; break; case('h'): change[x] = 'i'; break; case('i'): change[x] = 'j'; break; case('j'): change[x] = 'k'; break; case('k'): change[x] = 'l'; break; case('l'): change[x] = 'm'; break; case('m'): change[x] = 'n'; break; case('n'): change[x] = 'o'; break; case('o'): change[x] = 'p'; break; case('p'): change[x] = 'q'; break; case('q'): change[x] = 'r'; break; case('r'): change[x] = 's'; break; case('s'): change[x] = 't'; break; case('t'): change[x] = 'u'; break; case('u'): change[x] = 'v'; break; case('v'): change[x] = 'w'; break; case('w'): change[x] = 'x'; break; case('x'): change[x] = 'y'; break; case('y'): change[x] = 'z'; break; case('z'): change[x] = 'a'; break; default: change[x] = change[x]; break; } } } While I know that the switch is probably overkill for changing the incoming chars and a loop would be more efficient, my issues comes in when trying to test the code in my main method. For the life of me I can not figure out, or find anywhere in class notes/ on the internet of how to get this method to take in an array of chars and modify it. This goes along with testing the method, to make sure I correctly wrote the code to do as I need it. Also, sorry for the any issues that may have resulted in my inexperience of posting code to stackoverflow.
score: 0
has comment: http://stackoverflow.com/comment/41799165
accepted answer: http://stackoverflow.com/a/26592364
has comment: http://stackoverflow.com/comment/41799447
has comment: http://stackoverflow.com/comment/41799029
has answer: http://stackoverflow.com/a/26592560
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/26592322
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26592322
tagged with: java
has title: Java - A method that takes an array and changes it, returning nothing (issues)
has comment: http://stackoverflow.com/comment/41799066
tagged with: methods
has comment: http://stackoverflow.com/comment/41799513

http://stackoverflow.com/q/26602032
has body: final String username = "&lt;mail_name&gt;"; final String password = "&lt;password&gt;"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "465"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("&lt;mail_from&gt;@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("&lt;mail_to&gt;@gmail.com")); message.setSubject("Test Subject"); message.setText("Test"); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } I have tried this code for sending mail from pc to mobile but it giving error while compiling . Can any one help me to send mail?
has title: sending mail using java from pc to mobile
has answer: http://stackoverflow.com/a/26603870
has comment: http://stackoverflow.com/comment/41817539
favorite count: 0
type: UnansweredQuestion
score: -3
upvote count: 1
tagged with: java
type: Question
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/26602912

http://stackoverflow.com/q/26648552
type: Question
has title: Debugging groovy scripts
has answer: http://stackoverflow.com/a/26648811
linked to: http://stackoverflow.com/q/11758688
score: 0
answer count: 1
tagged with: debugging
tagged with: java
type: UnansweredQuestion
has body: I have bunch of Groovy scripts and I execute them from Java (so I haven't .class files for this scripts, I compile them on the fly). Can I somehow debug this scripts from Netbeans?
tagged with: groovy
has comment: http://stackoverflow.com/comment/41901988

http://stackoverflow.com/a/26554173
answers question: http://stackoverflow.com/q/26553193
score: 0
has body: %f is used for formatting floats/double and %d is used for decimal and In java %d is used for display the result for example :- public class Exercise { public static void main(String[] args) { long number = 30208; System.out.printf("Number: %d", + number); } } here we use %d for display the value of long variable
type: Answer

http://stackoverflow.com/comment/41727897
comment on: http://stackoverflow.com/q/26550660
type: Comment
score: 0
has text: @NeilStockton. I thought you were asking for the pom file.
type: QuestionComment

http://stackoverflow.com/a/26566329
downvote count: 0
has comment: http://stackoverflow.com/comment/41752365
type: Answer
has body: You have to have the @EventHandler annotation, and you also have to register events in your onEnable() method: In your main class (the one that extends JavaPlugin): public class MyMainClass extends JavaPlugin{ public void onEnable(){ //format: //this.getServer().getPluginManager().registerEvents(this, new MyClassThatImplementsListener()); this.getServer().getPluginManager().registerEvents(this, new Hunger()); //onEnable() stuff that you currently have } //other stuff } in your Hunger class (your listener, that you posted in the question): public class Hunger implements Listener{ @EventHandler //you need this annotation above ALL events public void onPlayerInteractEvent(PlayerInteractEvent event){ Player player = event.getPlayer(); player.setFoodLevel(20); } }
score: 1
answers question: http://stackoverflow.com/q/26565024
upvote count: 1

http://stackoverflow.com/a/26596526
accepted answer of: http://stackoverflow.com/q/26595626
type: AcceptedAnswer
score: 0
type: Answer
has body: Change &lt;c:forEach items="categoriaList" var="categoriaElement"&gt; to &lt;c:forEach items="${categoriaList}" var="categoriaElement"&gt; You are currently passing to the c:forEach tag library the string "categoriaList" instead of the model attribute with this name
answers question: http://stackoverflow.com/q/26595626

http://stackoverflow.com/comment/41695567
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26534639
has text: @getlost - No. You should upvote only if you think the answer is worthy of an upvote. Not just because someone else thinks the answer is worthy of a downvote. "Cancelling votes" make a mockery of the whole voting process - refer http://meta.stackoverflow.com/q/253383
type: Comment

http://stackoverflow.com/comment/41816322
has text: Thanks @Roman C, it solved my issue. Thanks for your timely help bro
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26588335

http://stackoverflow.com/q/26562421
has body: I need to access some data that used PHP encryption. The PHP encryption is like this. base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cipher), $text, MCRYPT_MODE_ECB)); As value of $text they pass the time() function value which will be different each time that the method is called in. I have implemented this in Java. Like this, public static String md5(String string) { byte[] hash; try { hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Huh, MD5 should be supported?", e); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Huh, UTF-8 should be supported?", e); } StringBuilder hex = new StringBuilder(hash.length * 2); for (byte b : hash) { int i = (b &amp; 0xFF); if (i &lt; 0x10) hex.append('0'); hex.append(Integer.toHexString(i)); } return hex.toString(); } public static byte[] rijndael_256(String text, byte[] givenKey) throws DataLengthException, IllegalStateException, InvalidCipherTextException, IOException{ final int keysize; if (givenKey.length &lt;= 192 / Byte.SIZE) { keysize = 192; } else { keysize = 256; } byte[] keyData = new byte[keysize / Byte.SIZE]; System.arraycopy(givenKey, 0, keyData, 0, Math.min(givenKey.length, keyData.length)); KeyParameter key = new KeyParameter(keyData); BlockCipher rijndael = new RijndaelEngine(256); ZeroBytePadding c = new ZeroBytePadding(); PaddedBufferedBlockCipher pbbc = new PaddedBufferedBlockCipher(rijndael, c); pbbc.init(true, key); byte[] plaintext = text.getBytes(Charset.forName("UTF8")); byte[] ciphertext = new byte[pbbc.getOutputSize(plaintext.length)]; int offset = 0; offset += pbbc.processBytes(plaintext, 0, plaintext.length, ciphertext, offset); offset += pbbc.doFinal(ciphertext, offset); return ciphertext; } public static String encrypt(String text, String secretKey) throws Exception { byte[] givenKey = String.valueOf(md5(secretKey)).getBytes(Charset.forName("ASCII")); byte[] encrypted = rijndael_25…
linked to: http://stackoverflow.com/q/18101545
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26563318
answer count: 1
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26563318
downvote count: 0
has title: JAVA a reliable equivalent for php's MCRYPT_RIJNDAEL_256
favorite count: 0
type: Question
tagged with: encryption
tagged with: rijndael
tagged with: php

http://stackoverflow.com/comment/41868753
type: Comment
type: QuestionComment
has text: Don't use scriplets. With S2 you don't need to put values into a request.
comment on: http://stackoverflow.com/q/26630034
score: 0

http://stackoverflow.com/comment/41680443
type: QuestionComment
comment on: http://stackoverflow.com/q/26526488
score: 0
has text: All of them are in Local network only.
type: Comment

http://stackoverflow.com/comment/41721318
comment on: http://stackoverflow.com/q/26548969
has text: as per the post here the line 71 seems to be a comment `//final TextView ans = (TextView) findViewById(R.id.ans);` :-/
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26583319
tagged with: classloader
type: Question
has answer: http://stackoverflow.com/a/26583640
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41782591
tagged with: casting
has answer: http://stackoverflow.com/a/26583813
linked to: http://stackoverflow.com/q/234600
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2215843
tagged with: class
has answer: http://stackoverflow.com/a/26583441
answer count: 4
has body: I wrote my own classloader, which works with classes, which implements interface Plugin. But I can't cast Class to Plugin. What's wrong? public Plugin load(String pluginName, String pluginClassName) { SimpleClassLoader system = new SimpleClassLoader(); system.setClassName(pluginClassName); Plugin aClass = null; try { aClass = (Plugin) system.loadClass(pluginRootDirectory + pluginName + "\\" + pluginClassName + ".class"); } catch (ClassNotFoundException e) { e.printStackTrace(); } return aClass; } Error:(18, 47) java: incompatible types: java.lang.Class cannot be converted to Plugin I addition this is the main part of my SimpleClassLoader class which extends ClassLoader. @Override protected Class&lt;?&gt; findClass(String name) throws ClassNotFoundException { byte[] bytes; try { bytes = Files.readAllBytes(new File(name).toPath()); } catch (IOException e) { throw new ClassNotFoundException(); } return defineClass(className, bytes, 0, bytes.length); }
score: 2
has comment: http://stackoverflow.com/comment/41782719
downvote count: 0
has title: Returning Interface instead Class<Interface>
favorite count: 0
has answer: http://stackoverflow.com/a/26692440

http://stackoverflow.com/comment/41682258
has text: errors like illegal start of expression
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26527651
score: 0

http://stackoverflow.com/a/26541357
answers question: http://stackoverflow.com/q/26541196
score: 5
has body: You can try to observe a "trend" or "pattern" when solving questions of this type. Given: 100/1+99/2+98/3+97/4+96/5...3/98+2/99+1/100 We derived: Numerator/Denominator, let's call it n divide by d (n/d) Pattern Observed: n - 1 after every loop d + 1 after every loop So, if you have 100 numbers, you need to loop 100 times. Thus using a for-loop which loops 100 times will seemed appropriate: for(int n=0; n&lt;100; n++) //A loop which loops 100 times from 0 - 100 To let n start with 100, we change the loop a little to let n start from 100 instead of 0: for(int n=100; n&gt;0; n--) //A loop which loops 100 times from 100 - 0 You settled n, now d needs to start from 1. int d = 1; //declare outside the loop Putting everything together, you get: int d = 1; double result = 0.0; for (int n=100; n&gt;0; x--) { result += (double)n/d; //Cast either n or d to double, to prevent loss of precision d ++; //add 1 to d after every loop }
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/48587353
has comment: http://stackoverflow.com/comment/84172433
type: Answer
downvote count: 2
answers question: http://stackoverflow.com/q/26617573
has body: Should have been written without the main (args)
upvote count: 0
score: -2

http://stackoverflow.com/comment/41816931
has text: you could break it down more since the op wants to have an arraylist of an array? lol!!!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26601603

http://stackoverflow.com/comment/41920599
type: Comment
type: QuestionComment
has text: If the error happens at `g.drawImage(frames[count]..`, I think this does not mean that the *image* is `null`, but that the `frames` array is `null`. Some debugging (or even just some `System.out.println`s) should help to quickly find out what's wrong there, though...
comment on: http://stackoverflow.com/q/26658761
score: 0

http://stackoverflow.com/q/26668660
tagged with: groovy
has title: Publishing archives in local maven repository
possible better answer: http://stackoverflow.com/a/26673165
upvote count: 3
has body: I'm trying to publish jar to a local maven ropsitory. I've written the following piece of gradle build script: uploadArchives{ repositories{ mavenDeployer{ repository(url: "C:/users/Admin/maven") } } } But I got an error: Could not publish configuration 'archives' For artifact {:upload_archive:unspecified:jar}: The groupId cannot be empty . What's worng? I did it as the section 8.7 of the documentation said.
has answer: http://stackoverflow.com/a/26673165
accepted answer: http://stackoverflow.com/a/26668717
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: gradle
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26668717

http://stackoverflow.com/comment/41838442
has text: Although I have not tried your solution it would seem to be similar to the one I posted. Thanks, devilpreet.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26609371

http://stackoverflow.com/comment/41823237
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26602236
has text: Everyone else forgot about passing arguments :)
type: AnswerComment

http://stackoverflow.com/q/26605297
has answer: http://stackoverflow.com/a/26606498
has comment: http://stackoverflow.com/comment/41824211
has comment: http://stackoverflow.com/comment/41824514
has body: I have following web application structure: inside addTerminal.jsp I write following: .... show map ... function showMap(lat,lng) { window.open('map.html?lat='+lat+'&lng='+lng, 'map', 'width=600,height=400'); } .... But as client cannot access to WEB-INF folder I see 404 when click on href Can you advice workaround how resolve my issue? I think I can put map.html into webapp folder but I think exist another fix. Application technology stack: Tomcat + Hibernate + SpringMVC web.xml: Spring MVC Application org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener contextConfigLocation /WEB-INF/spring/webContext.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/webContext.xml 1 appServlet / springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* charsetFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true charsetFilter /*
tagged with: popup
type: UnansweredQuestion
upvote count: 1
tagged with: spring
type: Question
tagged with: spring-mvc
has title: How to open popup in spring mvc application
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41824650
has comment: http://stackoverflow.com/comment/41824662
answer count: 2
has comment: http://stackoverflow.com/comment/41824271
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/41824071
has answer: http://stackoverflow.com/a/26605996
favorite count: 0

http://stackoverflow.com/a/40531705
downvote count: 0
has body: You should create one controlling class the creates the database connection, then passes it to the other two classes as method parameters. public class ConnectionManager { private static String url = "jdbc:mysql://localhost:3306/DbName"; private static String username = "YourUsername"; private static String password = "yourDbPass"; private static Connection con; public static Connection getConnection() throws Exception { con = DriverManager.getConnection(url, username, password); return con; } } public class main { public static void main(String[] args) throws Exception { Connection con = null; con = ConnectionManager.getConnection(); CrudCity s = new CrudCity(); s = s.read(con); System.out.println(s); CrudCountry c = new CrudCountry(); c = c.read(con); System.out.println(c); CrudCountryLanguage lang = new CrudCountryLanguage(); lang = lang.read(con); System.out.println(lang); } } public class CrudCity extends City implements CrudInterface { public CrudCity read(Connection con) throws Exception{ CrudCity p = new CrudCity(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT ID,Name,CountryCode FROM world.city"); while (rs.next()) { p.setId(rs.getInt("ID")); p.setName(rs.getString("Name")); p.setCountryCode(rs.getString("CountryCode")); } rs.close(); return p; } } public class CrudCountry extends Country implements CrudInterface{ public CrudCountry read(Connection con) throws Exception{ CrudCountry c = new CrudCountry(); Statement stmt =con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT Code,Name,Continent FROM world.country"); while (rs.next()) { c.setCountryCode(rs.getString("Code")); c.setCountryName(rs.getString("Name")); c.setCodeContinent(rs.getString("Continent")); } rs.close(); return c; } }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26652352

apache
tag name: apache
tags question: http://stackoverflow.com/q/26610513
tags question: http://stackoverflow.com/q/26528001
tags question: http://stackoverflow.com/q/26523575
tags question: http://stackoverflow.com/q/26540161
tags question: http://stackoverflow.com/q/26671824
tags question: http://stackoverflow.com/q/26567263
tags question: http://stackoverflow.com/q/26598375
tags question: http://stackoverflow.com/q/26530012
tags question: http://stackoverflow.com/q/26668578
tags question: http://stackoverflow.com/q/26581241
tags question: http://stackoverflow.com/q/26649705
tags question: http://stackoverflow.com/q/26583340
tags question: http://stackoverflow.com/q/26593603
tags question: http://stackoverflow.com/q/26624278
tags question: http://stackoverflow.com/q/26545186
tags question: http://stackoverflow.com/q/26620356
type: Tag
tags question: http://stackoverflow.com/q/26548975
tags question: http://stackoverflow.com/q/26670266
tags question: http://stackoverflow.com/q/26621140
tags question: http://stackoverflow.com/q/26553986
tags question: http://stackoverflow.com/q/26583363
tags question: http://stackoverflow.com/q/26522504
tags question: http://stackoverflow.com/q/26652601

http://stackoverflow.com/a/26533929
answers question: http://stackoverflow.com/q/26533870
has body: You cannot call toString() on a primtive. You can use String.valueOf(float) String str = String.valueOf(ans); String str2 = String.valueOf(ans2); Also, Java does not perform exponentiation with ^ (it's bitwise xor) if ((Math.pow(num2, 2)) - (4*num1*num3) &lt; 0){
score: 0
type: Answer

http://stackoverflow.com/comment/41848362
has text: Look at your **else** clause (the letter is not found). Notice the print statement saying "With what letter do you wish...". Explain why you are surprised to see this when the letter is not found.
comment on: http://stackoverflow.com/q/26618649
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135557866
comment on: http://stackoverflow.com/a/26603464
type: Comment
has text: @XXLuigiMario It's easy to say _overly opiniated_ while you didn't had to handle the maintainance and support the library and the consequences of the alternatives. This default has been chosen because too many users experienced NPEs hard to diagnose issues due to unboxing for novices in particular when `null` was used. This trade-off was worth it in usability. Maybe this could be revisited when/if Java gets a nullability notation reachable via reflection.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26663789
linked to: http://stackoverflow.com/q/13088648
type: UnansweredQuestion
tagged with: stddraw
has answer: http://stackoverflow.com/a/26664042
tagged with: java
type: Question
tagged with: for-loop
answer count: 1
score: 0
has title: StdDraw.line() loop- for creating silhouette of a bowling pin
has body: it's supposed to calculate the y axis then draw a small line segment each time in a different location and create the silhouette of a bowling pin. the x value is never changes so it doesnt draw anything. the black filled circle is just there to make sure it's actually drawing. import java.util.Scanner; public class test{ public static void main(String args[]) { double a0 = 1.27731344; double a1 = .85418707; double a2 = .032282353; double a3 = .127018447; double a4 = (-5.1957538)*(Math.pow(10,-2)); double a5 = (6.718114)*(Math.pow(10,-3)); double a6 = (-3.61828)*(Math.pow(10,-4)); double a7 = (7.025)*(Math.pow(10,-6)); for(int i=0;i&lt;=150;i++){ for(double x=0;x&lt;=1;x+=(1/150)){ double x2 = x + (1/150); double y = Math.sqrt((a0)+(a1*x)+(a2*x)+(a3*x)+(a4*x)+(a5*x)+(a6*x)+(a7*x)); StdDraw.line(x,y,x2,y); System.out.println(x+" "+y+" "+x2); } }StdDraw.filledCircle(.5,.5,.25); } }

http://stackoverflow.com/comment/41756375
type: Comment
comment on: http://stackoverflow.com/a/26568557
has text: Edited my comment, jumped the gun too quick in my code. Let me make sure I have everything right on my end. Sorry about that.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26600163
tagged with: time-complexity
answer count: 1
has body: The problem is to find the min and max triple product (product of 3 numbers) that can be formed, given an array of numbers. I managed to work out a code which works perfect, but it has got complexity (N^2). I need some help in reducing it to O(N) if possible. Edit: Numbers can be both positive and negative. Here's my code: import java.util.*; class Result { public static int min =50000000; public static int max =-50000000; public static int solve(int pos, int currPro, int depth) { if (depth==3){ check(currPro); } else { for (int i=1; i&lt;=Triplet.data.length-pos; i++){ if(pos+i &lt; Triplet.data.length){ solve(pos+i,currPro*Triplet.data[pos+i],depth+1); } } } return 0; } public static void check(int currPro) { if (currPro &gt; max){ max = currPro; } if (currPro &lt; min){ min = currPro; } } } class Triplet { static int[] data; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); //Number of int data = new int[num]; for (int i=0;i&lt;num;i++){ data[i] = sc.nextInt(); } if (num==3){ int result= data[0]*data[1]*data[2]; System.out.println(""+result+" "+result); } else{ Result.solve(-1, 1, 0); System.out.println(""+Result.min+" "+Result.max); } } }
has comment: http://stackoverflow.com/comment/41815951
has comment: http://stackoverflow.com/comment/41816223
has answer: http://stackoverflow.com/a/26601133
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41816890
has comment: http://stackoverflow.com/comment/41816769
has title: Algorithm with O(n) to find min and max of triple product in subsets
type: Question
tagged with: recursion
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41814543
has comment: http://stackoverflow.com/comment/41816269
score: 0

http://stackoverflow.com/comment/41750690
has text: @JordanIatro Avoid raw types if possible. Change that line of code to `ArrayList<OrderForm> alr = new ArrayList<>();`. Your compiler can now check if you try to insert something different than an `OrderForm` into that list.
type: AnswerComment
comment on: http://stackoverflow.com/a/26565760
type: Comment
score: 3

http://stackoverflow.com/comment/41872373
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26631041
score: 0
has text: thanks José Pereda somehow i missed this one! can you add this as an answer to accept it? thanks!

http://stackoverflow.com/q/26514387
score: 1
tagged with: java
upvote count: 1
tagged with: memory
has comment: http://stackoverflow.com/comment/41658631
type: Question
has title: Java: What's the most efficient way to read relatively large txt files and store its data?
possible better answer: http://stackoverflow.com/a/26515035
has answer: http://stackoverflow.com/a/26514468
answer count: 3
accepted answer: http://stackoverflow.com/a/26514468
has answer: http://stackoverflow.com/a/26515126
downvote count: 0
tagged with: string
favorite count: 0
has body: I was supposed to write a method that reads a DNA sequence in order to test some string matching algorithms on it. I took some existing code I use to read text files (don't really know any others): try { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); while((line = br.readLine()) != null) { seq += line; } br.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } This seems to work just fine for small text files with ~3000 characters, but it takes forever (I just cancelled it after 10 minutes) to read files containing more than 45 million characters. Is there a more efficient way of doing this?
has comment: http://stackoverflow.com/comment/41658695
has comment: http://stackoverflow.com/comment/41658678
has answer: http://stackoverflow.com/a/26515035
has comment: http://stackoverflow.com/comment/41658772
type: AnsweredQuestion

http://stackoverflow.com/comment/41679100
type: Comment
type: QuestionComment
has text: Please post your code.
comment on: http://stackoverflow.com/q/26525795
score: 0

http://stackoverflow.com/q/26627893
type: Question
possible better answer: http://stackoverflow.com/a/26628095
has answer: http://stackoverflow.com/a/26628095
has body: I am attending an IT school and we just started studying JAVA and we had to do a project that sort of simulated simple "messages" being passed around a network of Nodes that had IP Addresses. The whole project does not matter for purposes of this question. We have an IPAddress class, and one of its methods is to compare three IP address objects and decide whether the first one is "in the range" of the other two. For example, let's have a Node in the system, call it N1 (there is a whole node class but that's unimportant atm) and have a package(also its own class) with the message "Hello" in it. The package has the IP Address of 127.0.0.1 The system wants to pass it onto N1 which has an IP address of something (irrelevant) and an IP address range (which shows which range of IPs does it handle) of 127.0.0.0 (lower limit) and 127.0.0.255(upper limit) The IPAddress class InsideRange method receives two IPs as parameters to compare it with the third in the following way: public boolean insideRng(IPAddress lower, IPAddress upper){ String this_str = this.toString(); String lower_str = lower.toString(); String upper_str = upper.toString(); String[] addressses = {this_str, lower_str, upper_str}; for (int i=0; i&lt;addressses.length; i++){ String[] tmp = addressses[i].split("\\."); addressses[i] = String.format("%3s.%3s.%3s.%3s",tmp[0],tmp[1],tmp[2],tmp[3]); } String address = addressses[0]; Arrays.sort(addressses); return (addressses[1].equals(address)); } In this case 127.0.0.1 IS INSIDE 127.0.0.0 and 127.0.0.255 so it returns true. I did not make the above code however, I asked a friend to help me. The reason is that my version did not properly work (it returns true for an IP that is outside of the lower or upper limit sometimes): public boolean insideRng(IPAddress lower, IPAddress upper){ //nem mukodott String lower_str = lower.toString(); String upper_str = upper.toString(); String this_str = this.toString(); return (lower_str.compareTo(this_str) &lt;= 0 &amp; upper_str.c…
has answer: http://stackoverflow.com/a/26628042
tagged with: lexicographic
score: 0
answer count: 2
tagged with: string
accepted answer: http://stackoverflow.com/a/26628042
type: AnsweredQuestion
tagged with: java
has title: JAVA: Lexicographically comparing two Strings

http://stackoverflow.com/comment/41702185
type: Comment
type: QuestionComment
has text: Also note that I am not familiar with the `Turtle` class you are using, and it is possible that it can track points in a simpler manner than the solution I have described... This is one of the reasons why its usually best to seek help from your instructors before resorting to StackOverflow.
comment on: http://stackoverflow.com/q/26536918
score: 0

http://stackoverflow.com/comment/42278049
has text: Should i post the same question in cryptography or bitcoin communities in stackoverflow?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26648469

http://stackoverflow.com/a/26584296
has comment: http://stackoverflow.com/comment/41791995
score: 1
accepted answer of: http://stackoverflow.com/q/26583973
answers question: http://stackoverflow.com/q/26583973
has comment: http://stackoverflow.com/comment/41792303
upvote count: 1
type: AcceptedAnswer
has body: If you have a 64bit OS you probably need to put it in SysWow64 folder instead (on the same level as System32). But it's probably better to just put it in the same directory as the executable. The reason this may work is that System32 despite the name contains all the 64bit dll's and 32bit applications (that are run in comnpatibility mode) are redirected to use SysWoW64 instead (Of which mos of the dll's thunk the calls through the 64bit libraries in system32).
type: Answer
has comment: http://stackoverflow.com/comment/41784521
downvote count: 0

http://stackoverflow.com/q/26666121
score: 0
has answer: http://stackoverflow.com/a/26666318
answer count: 1
tagged with: mergesort
has body: For my class project, we have to go through the Shakespeare sonnet and check if each word is in the dictionary or not. Now I have two String arrays both in alphabetical order, one consists of the words from the sonnet and the other one is consisted of the word from the dictionary. I am asked to use the merge sort to check if the word in the sonnet exists in the dictionary. Can anyone give me an idea of how I can implement this??? Thanks in advance!
has comment: http://stackoverflow.com/comment/41934146
type: UnansweredQuestion
tagged with: dictionary
tagged with: java
tagged with: wordsearch
type: Question
has title: Word Search: two string arrays in alphabetical order using merge sort

http://stackoverflow.com/comment/41659879
has text: could it be possible that your eclipse vm is using different parameters than your system vm? Or maybe your Eclipse java version is different from your system version?
comment on: http://stackoverflow.com/a/26514827
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41739287
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26559145
has text: Something looks wrong with your code; in particular `txtString.equals(word)`. Does the README.TXT file contain single words? If so, this *might* work. What's an example of the input file contents?
type: Comment

http://stackoverflow.com/a/26521048
has comment: http://stackoverflow.com/comment/41671325
has comment: http://stackoverflow.com/comment/41671311
has comment: http://stackoverflow.com/comment/41671415
has comment: http://stackoverflow.com/comment/41680767
score: 1
has comment: http://stackoverflow.com/comment/41671164
answers question: http://stackoverflow.com/q/26520849
has comment: http://stackoverflow.com/comment/41671171
has body: That code will do your trick but please notice that this is ugly. First you are taking the whole user input line instead of the first character. public static void main(String args[]) { String c = "Message"; char character; Scanner sc = new Scanner(System.in); System.out.println("Enter the character : "); character = sc.next().charAt(0); System.out.println(); for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 13; j++) { if (i == 0 || i == 2) { System.out.print(character); } else if (j == 0) { String middle = character + " " + c + " " + character; System.out.print(middle); } } System.out.println(); } } output : aaaaaaaaaaaaa a Message a aaaaaaaaaaaaa
accepted answer of: http://stackoverflow.com/q/26520849
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41671448
has comment: http://stackoverflow.com/comment/41671708
has comment: http://stackoverflow.com/comment/41735980
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41671262
has comment: http://stackoverflow.com/comment/41671143
downvote count: 0

http://stackoverflow.com/a/26528622
has comment: http://stackoverflow.com/comment/41690352
has comment: http://stackoverflow.com/comment/41683872
type: Answer
has comment: http://stackoverflow.com/comment/41684024
answers question: http://stackoverflow.com/q/26528554
upvote count: 2
downvote count: 1
score: 1
has body: setTitle(""); will do that in onCreate() i suppose.

http://stackoverflow.com/a/26565465
type: Answer
has comment: http://stackoverflow.com/comment/41750302
has body: If you don't know how many comma separated values you will get, then the split you do is as far as I've been able to find the best way to do it. If you know you will always have 3 values as comma separated, then you can get those 3 directly. (for instance if you have lat,long or x,y,z then you could get it with 3 pathvariables. (see one of the stackoverflow links posted below) there are a number of things you can do with matrix variables but those require ; and key/value pairs which is not what you're using. Things I found (apart from the matrix stuff) How to pass comma separated parameters in a url for the get method of rest service How can I map semicolon-separated PathParams in Jersey?
answers question: http://stackoverflow.com/q/26564464
has comment: http://stackoverflow.com/comment/41750318
score: 0

http://stackoverflow.com/a/26633531
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26633379
has body: You wrote a recursive method that ignores results of intermediate invocations. The return statement in question would be reached only if you start your search right at the node that you want to find. To fix this, your recursive branch should pay attention to what's returned by recursive invocation. If you need to find the first matching child, do this: for (int i = 0; i &lt; childrens.getLength(); i++) { String tmp = searchNode(childrens.item(i), node, nodeResult); if (tmp != null &amp;&amp; tmp.length() != 0) { return tmp; } }
upvote count: 1
type: Answer

http://stackoverflow.com/comment/41711582
type: QuestionComment
type: Comment
has text: What kind of tests do you need to do after the build ?
comment on: http://stackoverflow.com/q/26539094
score: 0

http://stackoverflow.com/comment/41759414
has text: Er... As U know, I use IntelliJ IDE and install a plugin which be called "IDEA Jetty Runner" and the version is 0.0.5. The servlet-api version is 2.5. Tha's all.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26570378
type: QuestionComment

http://stackoverflow.com/a/43172811
has comment: http://stackoverflow.com/comment/75020689
type: Answer
has comment: http://stackoverflow.com/comment/74986668
has body: The 2017 answer is: Use the date and time classes introduced in Java 8 (and also backported to Java 6 and 7 in the ThreeTen Backport). If you want to interpret the date-time string in the computer’s time zone: long millisSinceEpoch = LocalDateTime.parse(myDate, DateTimeFormatter.ofPattern("uuuu/MM/dd HH:mm:ss")) .atZone(ZoneId.systemDefault()) .toInstant() .toEpochMilli(); If another time zone, fill that zone in instead of ZoneId.systemDefault(). If UTC, use long millisSinceEpoch = LocalDateTime.parse(myDate, DateTimeFormatter.ofPattern("uuuu/MM/dd HH:mm:ss")) .atOffset(ZoneOffset.UTC) .toInstant() .toEpochMilli();
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26637168

http://stackoverflow.com/a/26541544
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/41707595
answers question: http://stackoverflow.com/q/26541513
downvote count: 1
has body: It's not a memory leak as much as a file-handle leak. The operating system will only allow a single process to open a certain number of files, and if you don't close your input streams, it might forbid the JVM from opening any more.
has comment: http://stackoverflow.com/comment/41757945
has comment: http://stackoverflow.com/comment/41707537
score: 10
has comment: http://stackoverflow.com/comment/41707942
has comment: http://stackoverflow.com/comment/41707629
has comment: http://stackoverflow.com/comment/41707793

http://stackoverflow.com/a/55620996
answers question: http://stackoverflow.com/q/26571994
type: Answer
has body: I had the same issue and the asyncTimeout was not enough... I was using Zuul to reverser proxy my api and I forgot to add the zuul.host.connect-timeout-millis and zuul.host.socket-timeout-millis, your solution + this one solved my problem.
score: 0

http://stackoverflow.com/a/26556052
has comment: http://stackoverflow.com/comment/41734747
has comment: http://stackoverflow.com/comment/41733993
has body: Inside the run() method there is a while(condition) that actually means.. wait (receiving tokens from neighbours) This is not true as per your code while(flag() &gt; 1); if the Node has only one Node ( 4 /5 / 6 ) - for these the flag() would return 1 and which will terminate while loop and then would move forward and send requst even before the initiators starts send message UPDATE As you know there are 4 initiators for this code (3,4,5,6) And excepts to get out of while loop .. Take this Nodes selected: 5, 3, 4, 6, 0, 2, 1 3 sends token to 1 5 sends token to 2 4 sends token to 1 6 sends token to 2 2 sends token to 0 0 sends token to 1 1 decides! It is purely an race condition , what if previously started initiator (5) already reached /sends message to other initator's (3) neighbor ( 1) . while Initator(3) try to start and get SlientNeigh it would got Null ( no slient neigh) . thus you are getting Null pointer exception at n.sendToken. Reference for Algorithm : You dont need to sycn ( we dont have rule that each node should receive only one message from neighbour) . From the reference three simple properties – In each computation there is one initiator, which starts the algorithm by sending out exactly one message –– A process, upon receipt of a message, either sends out one message or decides –– The algorithm terminates in the initiator and when this happens, each process has sent a message at least once
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26554478
has comment: http://stackoverflow.com/comment/41734424
has comment: http://stackoverflow.com/comment/41734337
score: 1
has comment: http://stackoverflow.com/comment/41734718
has comment: http://stackoverflow.com/comment/41733844
has comment: http://stackoverflow.com/comment/41734749
has comment: http://stackoverflow.com/comment/41734243
has comment: http://stackoverflow.com/comment/41734620
downvote count: 0

http://stackoverflow.com/comment/41829332
has text: http://docs.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26608248
score: 0

http://stackoverflow.com/comment/41880400
comment on: http://stackoverflow.com/a/26634113
score: 0
type: AnswerComment
type: Comment
has text: ActionBarActivity is a subclass of FragmentActivity so it should work with that too

http://stackoverflow.com/comment/41761869
type: QuestionComment
comment on: http://stackoverflow.com/q/26571824
score: 0
has text: Because, as you're saying in the question: We know that each class extends from Object which means that we can use all Object's methods in any class
type: Comment

http://stackoverflow.com/comment/41749223
type: Comment
has text: Are there any performance differences? any bugs? or anything? or are they 2 exact same things that are coming in different forms?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26564955

http://stackoverflow.com/comment/41693774
score: 0
type: Comment
has text: This does not serve the case where there is no dot at all in the file name, which the original code does handle. The observation about greedy vs. reluctant quantifiers is good, though.
comment on: http://stackoverflow.com/a/26533693
type: AnswerComment

http://stackoverflow.com/q/26573866
has answer: http://stackoverflow.com/a/30230023
tagged with: java
has body: I am completely new to Java and am writing code to check whether a number is an Armstrong number or not in the range 0 to 999. Please tell me what is wrong. When run on command prompt, it repeatedly prints: 1 is the count Code: import java.util.*; class Armstrong { public static void main (String[] args) { int sum = 0; for (int i = 0; i &lt; 1000; i++) { int n = i; int count =0; while(n &gt; 0) { int mod = n % 10; n = n / 10; count++; } System.out.println(+count+ "is the count"); for (int j = 1; j &lt; count; j++) { int val = i % 10; i= i / 10; sum = val * val * val + sum; } if (sum == i) { System.out.println( +i+ "is an Armstrong number"); } } } }
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
has title: Armstrong number code in Java is not working right
has comment: http://stackoverflow.com/comment/41765553
type: Question
has answer: http://stackoverflow.com/a/26574059
has answer: http://stackoverflow.com/a/26573998
answer count: 3
has comment: http://stackoverflow.com/comment/41765684
upvote count: 1

http://stackoverflow.com/q/26614442
has comment: http://stackoverflow.com/comment/41844530
tagged with: android
tagged with: properties
tagged with: extract
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26616683
has body: I got a prop file that I want to extract from it the version release number (as a String). The file looks like this : ro.build.version.sdk=19 ro.build.version.codename=REL ro.build.version.release=4.4.2 ro.build.date=Mon Oct 27 00:53:09 IST 2014 ro.build.date.utc=1414363989 I don't know the version release number, allIi know that I got this prop on my file. How can I get with Java the value of this prop, and to save it on a String variable? (Here it will be 4.4.2)
has comment: http://stackoverflow.com/comment/41841714
score: 1
tagged with: java
has title: extracting information from prop file
has comment: http://stackoverflow.com/comment/41844311
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41844605
favorite count: 0

http://stackoverflow.com/a/26643742
type: Answer
has body: My current (poor) workaround is to expand all in the test sources folder, and manually shift-click a range of tests and control click off the ones I don't want to run.
score: 0
answers question: http://stackoverflow.com/q/26643652

http://stackoverflow.com/a/26651567
upvote count: 1
has comment: http://stackoverflow.com/comment/41907060
accepted answer of: http://stackoverflow.com/q/26651540
has body: You're already using String.trim() in your Comparator. Just use it as well when you add the lines to your Lists: while ((inputLine = bufferedReader.readLine()) != null) { lineList.add(inputLine.trim()); } You may even get to remove it from the Comparator if you're not reusing it somewhere else.
answers question: http://stackoverflow.com/q/26651540
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/26671669
score: 0
type: Answer
has body: Change like below public void addAccount(Account account) { accounts.add(account); } If you use the local variable name same as outer variable. then local variable will be consider first.
answers question: http://stackoverflow.com/q/26671562

http://stackoverflow.com/a/75823094
has body: You could bite the bullet on this one and take your expensive (by cpu cycles) integration tests out of the main build. The you can run your project with -Pintegrationtests via a separate scheduling mechanism. For example, you could run them 4 times daily, on a cron schedule.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26543490

http://stackoverflow.com/comment/41684694
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26528265
score: 1
has text: Well, thanks a lot to both of you!

http://stackoverflow.com/a/26645302
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41897626
has comment: http://stackoverflow.com/comment/41896439
has comment: http://stackoverflow.com/comment/41896508
answers question: http://stackoverflow.com/q/26644957
has body: Create Custom Expandable List for parent. Like that: xml: &lt;View android:layout_width="wrap_content" android:layout_height="2dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="0dp" android:layout_marginTop="0dp" android:background="@color/list_divider" /&gt; &lt;ImageView android:id="@+id/imgViewHeader" android:layout_width="80dp" android:layout_height="80dp" android:padding="8dp" android:layout_alignParentLeft="true" /&gt; &lt;TextView android:id="@+id/lblListHeader" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textColor="#FFFFFF" android:padding="8dp" android:gravity="center" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginLeft="90dp" android:layout_marginTop="10dp" android:textSize="30sp" /&gt; Java Code: Adapter public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; private List&lt;String&gt; _listDataHeader; private List&lt;Integer&gt; _listImageHeader;// header titles // child data in format of header title, child title private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild; Typeface ttf; public ExpandableListAdapter(Context context, List&lt;String&gt; listDataHeader, List&lt;Integer&gt; listImageHeader, HashMap&lt;String, List&lt;String&gt;&gt; listChildData,Typeface ttff) { this._context = context; this._listDataHeader = listDataHeader; this._listImageHeader = listImageHeader; this._listDataChild = listChildData; ttf=ttff; } @Override public Object getChild(int groupPosition, int childPosititon) { return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .get(childPosititon); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } // Set Inflater For Child View (Child) @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final St…

http://stackoverflow.com/comment/41927422
type: AnswerComment
score: 0
type: Comment
has text: I changed my sql statement verbatim to yours and I'm still getting the same error.
comment on: http://stackoverflow.com/a/26662627

http://stackoverflow.com/q/26538300
tagged with: java
type: Question
answer count: 1
score: 0
has title: Call method from child class stored in property
has comment: http://stackoverflow.com/comment/41705050
has comment: http://stackoverflow.com/comment/41705336
has body: I'm creating a validation class for my project. At the moment I'm stuck on the point that I want to invoke a method (in this case getText()) from a class that is being passed via a generic type. Here are the codes: In this class I created a getRules where I pass a HashMap where the key is the name of the field, and the value in the rules attached to it. public class PlayerValidator extends FormValidator&lt;PlayerFormPanel&gt; { @Override protected HashMap&lt;String, String&gt; getRules() { HashMap&lt;String, String&gt; rules = new HashMap&lt;&gt;(); rules.put("firstNameField", "required"); return rules; } } Next I got a parent class where I got a validate method, which will iterate over the rules and check if the rule is valid or invalid. abstract class FormValidator&lt;T&gt; { abstract HashMap&lt;String, String&gt; getRules(); public void validate(T form) { System.out.println(form.toString()); for (Map.Entry&lt;String, String&gt; field : getRules().entrySet()) { System.out.println(field.getKey()); System.out.println(field.getValue()); } } } In the generic type T I get the PlayerFormPanel object, but how would I be able to call the getText() method on the firstNameField (field.getKey())?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26539058
tagged with: design-patterns
linked to: http://stackoverflow.com/q/8524011

http://stackoverflow.com/comment/41851210
score: 0
has text: if you are doing java you have write things in a class. How do you think you will call the method that @Mosa has proposed
type: Comment
comment on: http://stackoverflow.com/a/26620201
type: AnswerComment

http://stackoverflow.com/q/26627934
answer count: 4
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26628629
tagged with: comparable
type: Question
has answer: http://stackoverflow.com/a/26628287
has comment: http://stackoverflow.com/comment/41864980
tagged with: sorting
has answer: http://stackoverflow.com/a/26628398
possible better answer: http://stackoverflow.com/a/26628498
has title: Collections.sort no compile time error
score: 0
has answer: http://stackoverflow.com/a/26628498
has answer: http://stackoverflow.com/a/26628629
has body: What is the difference between Collections.sort(list) and Collections.sort(list,null) I supposed both of them compared elements in the list in their natural order. So I tried these two codes: CODE 1: List&lt;Object&gt; list=Arrays.asList("hello",123); Collections.sort(list); CODE 2: List&lt;Object&gt; list=Arrays.asList("hello",123); Collections.sort(list,null); The latter compiles but former doesn't giving the expected compiler error that instances of class Object are not comparable. Why latter does not give compile time error. EDIT: Based on the comment given below. I understand why latter doesn't give compile time error but on running it throws ClassCastException : String cannot be converted into Integer . How it deduced that runtime objects are String and Integer because what I think public static sort(List&lt;Object&gt; list) ---&gt; Since list was of type object { // For instances of object in list call the compareTo method } }
has comment: http://stackoverflow.com/comment/41865008
tagged with: collections

http://stackoverflow.com/q/26655624
downvote count: 0
answer count: 1
favorite count: 0
tagged with: bluetooth
tagged with: android
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26656509
accepted answer: http://stackoverflow.com/a/26656509
has body: I've got some problems with Android Bluetooth stuff. When I call bytes = mmInStream.read(buffer); It usually works as it should. On the Cat B15 smartphone however, the read method sometimes blocks forever, even though the connection is still running and data should be arriving. I have temporarily solved the problem by this code: while (true) { int available = 0; try { available = mInStream.available(); } catch (IOException e) {} if (available &gt; 0) { try { bytes = mInStream.read(buffer); ioExceptionsCounter = 0; // [send the obtained bytes to the UI activity] // ............... } catch (IOException e) { ++ioExceptionsCounter; if (ioExceptionsCounter &gt;= 4) { break; } } } try { Thread.sleep(10); } catch (InterruptedException e) {} } I dont think that the ioExceptionsCounter is really necessary but there was some complaints that it sometimes disconnects without reason so I thought one IOException might not be enough to close the connection. What I really don't like about this is that it uses polling. It does work now on the Cat phone but it doesn't make me happy that all the other devices now execute this ugly code. Do you have any ideas why this could be? Is this just a bug of the phone? By the way it runs ICS but it is definitely device specific.
type: Question
type: AnsweredQuestion
has title: Bluetooth InputStream.read() doesn't return Data and Blocks forever
tagged with: java
has comment: http://stackoverflow.com/comment/54571169

http://stackoverflow.com/a/26519276
answers question: http://stackoverflow.com/q/26519141
upvote count: 5
has comment: http://stackoverflow.com/comment/41668288
has comment: http://stackoverflow.com/comment/41668198
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41670359
has comment: http://stackoverflow.com/comment/41850428
has body: The end of image should be concatenated with the beginning of the image. So it always repeats showing Check out the Marquee Panel. You can add a JLabel with an ImageIcon to the MarqueePanel. The MarqueePanel provides various method to customize the scrolling. Edit: The basic code would be: MarqueePanel panel = new MarqueePanel(); panel.setWrap(true); panel.setWrapAmount(0); panel.setPreferredWidth(250); JLabel label = new JLabel( new ImageIcon( "heartbeat.jpg" ) ); panel.add( label ); frame.add( panel ); If you want the image to fully appear at the left when it is displayed you can change the startScrolling() method and use scrollOffset = 0;.
type: Answer
has comment: http://stackoverflow.com/comment/41667957
has comment: http://stackoverflow.com/comment/41850670
has comment: http://stackoverflow.com/comment/41668705
accepted answer of: http://stackoverflow.com/q/26519141
has comment: http://stackoverflow.com/comment/41668032

http://stackoverflow.com/comment/41702392
type: QuestionComment
comment on: http://stackoverflow.com/q/26537668
has text: Are you closing the entityManager? If you don't, it might be your problem.
score: 0
type: Comment

http://stackoverflow.com/comment/41724111
comment on: http://stackoverflow.com/q/26550990
type: Comment
type: QuestionComment
has text: No they don't. Except if your using some kind of language I don't know about.
score: 2

http://stackoverflow.com/comment/41768174
score: 0
comment on: http://stackoverflow.com/q/26567220
type: Comment
type: QuestionComment
has text: Welcome to [so]. I've formatted your code for you. Please __format__, and __comment through__ your code yourself next time - The formatter that comes with your IDE is helpful and it improves the readability of these questions. Also, that's a lot of code. Please see a [__Minimal__, __Complete__, and __Verifiable__ example](http://stackoverflow.com/help/mcve) or a [__Short__, __Self Contained__, Correct (__Compilable__) example](http://sscce.org/).

http://stackoverflow.com/q/26569082
has comment: http://stackoverflow.com/comment/41757246
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41757298
tagged with: jcomponent
tagged with: swing
has title: Getting a custom JPanel to show custom JComponents (Java Swing)
has comment: http://stackoverflow.com/comment/41757260
has comment: http://stackoverflow.com/comment/41757397
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41757683
tagged with: jpanel
has answer: http://stackoverflow.com/a/26569533
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41757280
has answer: http://stackoverflow.com/a/26569169
has body: I am seriously at a loss with this one guys. I am trying to create a custom LED display to show 7 bars arranged as an 8. I got a single custom JComponent (bar) to show inside of a JFrame, but I cannot get the bars to show inside of the custom panel that I am creating. Here is the code for the constructor methods and the paint methods in my classes as well as the main method that I am using to test these classes. The custom JComponent: public class Bar extends JComponent { // instance variables - replace the example below with your own private static boolean litUp = false; private static boolean vertical = false; private static boolean rotated = false; private static boolean rotClockwise = false; private static int positionX; private static int positionY; public Bar(boolean lit, boolean vert, int posX, int posY) { litUp = lit; vertical = vert; positionX = posX; positionY = posY; repaint(); System.out.println("The bar is being initialized"); } public void paintComponent(Graphics g) { System.out.println("BAR: Paint Component being called"); super.paintComponent(g); Graphics2D g2D = (Graphics2D)g; if(vertical == true) { if(litUp == true) { g2D.setColor(Color.red); } else { g2D.setColor(Color.black); } g2D.drawRect(positionX , positionY, 10, 30); g2D.fillRect(positionX , positionY, 10, 30); System.out.println("BAR: fillRect is being called for a vertical bar"); if(rotated == true) { if(rotClockwise == true) { g2D.rotate(0.3398); } else { g2D.rotate(-0.3398); } } } else{ System.out.println("BAR: fillRect is being called for a horizontal bar"); if(litUp == true) { g2D.setColor(Color.red); } else { g2D.setColor(Color.black); } g2D.drawRect(positionX,positionY, 30, 10); g2D.fillRect(positionX,positionY, 30, 10); } } } The Custom JPanel: public class LED extends JPanel { // instance variables - replace the example below with your own //private static Bar[] bars = new Bar[7]; //private static int xPos; //private static int yPos; private Bar barZero; private Bar barOne; private…
upvote count: 2
has comment: http://stackoverflow.com/comment/41757658

http://stackoverflow.com/comment/41868374
has text: Oh sweet! So at least I've done it right-ish & won't risk creating instance upon instance that way. Thanks for the explanation!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26629968

http://stackoverflow.com/q/26524862
has answer: http://stackoverflow.com/a/26525616
has answer: http://stackoverflow.com/a/26525838
has comment: http://stackoverflow.com/comment/41677581
type: AnsweredQuestion
has title: Java: How to return object of not known child class from another class (not parent)?
possible better answer: http://stackoverflow.com/a/26525007
has answer: http://stackoverflow.com/a/26525356
tagged with: java
has answer: http://stackoverflow.com/a/26525007
has comment: http://stackoverflow.com/comment/41677726
type: Question
accepted answer: http://stackoverflow.com/a/26525616
tagged with: parent-child
tagged with: class
score: 0
has body: I googled a lot, but it seems I don't know a term which describe this situation, because I am pretty new in programming. I have an absctract class. Something like this: public abstract A { ... public void randomize() {...} ... } And I have a lot of child classes, like class B extends A, class C extends A. Then I have separate class, which should know the type of a child class. Something like this: public class D { private Class&lt;? extends A&gt; childClassType; public C(Class&lt;? extends A&gt; type) { ... } .... } The thing is: this class should have a method which should return object of child class (that is passed as a parameter here). So that I could cast some value to his type and call randomize() method. So basically, I need something like this inside C class: public [???] neededMethod() { libraryMethodRequiringClassAsParameter(childClassType); .... [???] childObject = ([???]) libraryMethodReturningObject(); childObject.randomize(); return childObject; } I don't know syntax of [???], because I don't know how such situation is called. I can just create A object (it works), but then I will need double-cast (inside from object to A, outside from A to it's child), which seems stupid. Will be appreciate for any info.
answer count: 4

http://stackoverflow.com/comment/41724854
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26551340
score: 1
has text: *Its better to use a stored procedure to avoid sql injection*: This is not entirely true. The simplest solution is to use a instance of `PreparedStatement`.

http://stackoverflow.com/comment/41713713
type: QuestionComment
has text: Is `ProjectManager` in a different plugin? If so the package containing it would have to be in the Export-Package list for the plugin.
comment on: http://stackoverflow.com/q/26545120
score: 0
type: Comment

http://stackoverflow.com/comment/41665891
type: AnswerComment
comment on: http://stackoverflow.com/a/26517986
score: 0
type: Comment
has text: Now the application is failing on my local machine as well where java_home is set to JDK 1.7 but it shows further errors :

http://stackoverflow.com/comment/41689802
type: QuestionComment
comment on: http://stackoverflow.com/q/26531720
score: 4
has text: Don't post your interpretation of an error that you don't understand. post the actual exception stack trace, along with the relevant code.
type: Comment

http://stackoverflow.com/comment/41719621
has text: Here is my code: WebElement droplist1 = driver.findElement(By.xpath("//div[@class='x-combo-list-inner']")); droplist1.sendKeys("Michael W Baber,20,13222"); droplist1.sendKeys(Keys.ENTER);
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26547833

http://stackoverflow.com/comment/41831908
has text: I do not think that is possible, if that would've been possible then one could simple make a web page that could manipulate the client machine with a button click. e.g. running malicious delete command to delete files on client machine through cmd.exe. Sorry that i have not stated that in my answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26605530
type: AnswerComment

http://stackoverflow.com/comment/41802527
score: 0
has text: @Robin if (input.startsWith("http://", count)) that checks if anything after that certain index within the String starts with "http://"? Now I'm really curious, I always thought that using count as the index would check forward from that index within the String?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26593664

http://stackoverflow.com/a/26635765
has body: If members is an arrayList holding strings, then you should do like this for (String m: members){ } Or for (String m : Artist.members){ } which ever is applicable to your situition
answers question: http://stackoverflow.com/q/26635675
score: 0
has comment: http://stackoverflow.com/comment/41880502
type: Answer

http://stackoverflow.com/q/26535645
accepted answer: http://stackoverflow.com/a/26537681
type: Question
score: 9
tagged with: ip
has title: IP camera with OpenCv in Java
has answer: http://stackoverflow.com/a/41117263
upvote count: 9
tagged with: camera
has body: I am trying to get and display an video stream from a IP camera. I found some sample code here:http://answers.opencv.org/question/24012/reading-video-stream-from-ip-camera-in-opencv-java/ But it is not working for me. my code works when I use my internal webcam, but when I switch the camera to the IP, it does not work. I have no idea why. Can someone please help me? Here is my code: import java.awt.BorderLayout; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.highgui.VideoCapture; import org.opencv.imgproc.Imgproc; public class openCVTest { public openCVTest() { // TODO Auto-generated constructor stub } /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); //VideoCapture camera = new VideoCapture("http://192.168.0.7/image.jpg"); VideoCapture camera = new VideoCapture(0); if (camera.isOpened()) { System.out.println("Video is captured"); } else { System.out.println(""); } videoCamera cam = new videoCamera(camera); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(cam); frame.setSize(800,800); frame.setVisible(true); while(camera.isOpened()) { cam.repaint(); } } } import java.awt.Graphics; import java.awt.Point; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.util.ArrayList; import javax.swing.JFrame; import javax.swing.JPanel; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.VideoCapture; import org.opencv.imgproc.Imgproc; import…
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/41117263
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26537681
tagged with: opencv
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26559784
type: Answer
answers question: http://stackoverflow.com/q/26556972
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26556972
has body: For word length frequency, tokenizer.nextToken() shouldn't be emit as key. The length of that string actually be considered. So your code will do fine with just the following change and is sufficient : word.set( String.valueOf( tokenizer.nextToken().length() )); Now if you give deep look, you will realize that Mapper output key should no longer be Text although it works. Better use an IntWritable key instead : public static class Map extends Mapper&lt;LongWritable, Text, IntWritable, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private IntWritable wordLength = new IntWritable(); public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { wordLength.set(tokenizer.nextToken().length()); context.write(wordLength, one); } } } Although most of the MapReduce examples use StringTokenizer, it's cleaner and advisable to use String.split method. So make the changes accordingly.

http://stackoverflow.com/a/26572007
type: Answer
downvote count: 0
score: 1
has body: The short answer is "Usually not". You should use final based on clear design and readability rather than for performance reasons. Does use of final keyword in Java improve the performance?
accepted answer of: http://stackoverflow.com/q/26571817
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26571817

http://stackoverflow.com/comment/41940336
score: 0
comment on: http://stackoverflow.com/q/26669012
type: QuestionComment
type: Comment
has text: @AndrewT. the result should be as neat as the valid outputs posted above

http://stackoverflow.com/comment/41756850
type: QuestionComment
comment on: http://stackoverflow.com/q/26554146
has text: @JeroenVannevel It is simply passing current instances in order to have different functions performed on it?
score: 0
type: Comment

http://stackoverflow.com/q/26601202
tagged with: neo4j
tagged with: curl
has answer: http://stackoverflow.com/a/26604204
upvote count: 2
accepted answer: http://stackoverflow.com/a/26604204
has title: @PluginTarget(Node.class) not registering as neo4j plugin
score: 2
type: AnsweredQuestion
has body: Simple class below won't show up as a plugin package com.danmacias.neoneoteplugin; import java.util.ArrayList; import java.util.List; import org.neo4j.graphdb.*; import org.neo4j.server.plugins.*; import org.neo4j.graphalgo.*; //import org.neo4j.tooling.GlobalGraphOperations; @Description( "An extension to the Neo4j Server for getting all nodes or relationships" ) public class GetPaths extends ServerPlugin { @Name( "breadth_first_paths" ) @Description( "Breadth First Traversal of a specific node." ) @PluginTarget( Node.class ) public Iterable&lt;Path&gt; getPaths( @Source Node graphDb ) { ArrayList&lt;Path&gt; paths = new ArrayList&lt;&gt;(); return paths; } } curl returns { "extensions" : { "GetAll" : { "get_all_nodes" : "http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes" } ... }, But when I replace both instaces of Node.class with GraphDatabaseService.class, it recognizes the plugin just fine. Why won't it accept a Node? Also, /var/logs/neo4j doesn't show any errors relating to this
tagged with: java
type: Question
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26564598
tagged with: java
linked to: http://stackoverflow.com/q/3608891
has comment: http://stackoverflow.com/comment/41748635
tagged with: servlets
has comment: http://stackoverflow.com/comment/41760329
has answer: http://stackoverflow.com/a/26564832
downvote count: 0
has comment: http://stackoverflow.com/comment/41760361
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/41752992
has comment: http://stackoverflow.com/comment/41760489
accepted answer: http://stackoverflow.com/a/26564832
answer count: 3
has comment: http://stackoverflow.com/comment/41750246
score: 2
has answer: http://stackoverflow.com/a/26565452
type: AnsweredQuestion
has title: passing variable from servlet to jsp doesn't work
has answer: http://stackoverflow.com/a/26565651
upvote count: 2
has body: I have problem with passing an object from servlet to jsp. Servlet.java @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Controller test = new Controller(); test.setObjects(); request.getSession().setAttribute("item", test.node_1); request.getRequestDispatcher("index.jsp").forward(request, response); } index.jsp ${item.firstName} web.xml <?xml version="1.0" encoding="UTF-8"?> Servlet socialgraphui.Servlet Servlet /Servlet 30 Tomcat output okt 25, 2014 6:17:14 PM org.apache.catalina.startup.HostConfig deleteRedeployResources INFO: Undeploying context [] okt 25, 2014 6:17:14 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /Library/Java/Servers/apache-tomcat-7.0.42/conf/Catalina/localhost/ROOT.xml okt 25, 2014 6:17:14 PM org.apache.catalina.util.LifecycleBase start INFO: The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] after start() had already been called. The second call will be ignored. In browser console is no error or warning message. Could you please help me how can i find out what is wrong?
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41760308
possible better answer: http://stackoverflow.com/a/26565651
has comment: http://stackoverflow.com/comment/41748924
has comment: http://stackoverflow.com/comment/41748883

http://stackoverflow.com/comment/41986408
type: AnswerComment
has text: yeah sure, but I don't have the permission to vote since I am new to stack-overflow. I am very sorry about that.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26605344

http://stackoverflow.com/q/26633743
answer count: 2
tagged with: android
tagged with: android-fragments
has title: Fragments won't show up in activity extending ActionBarActivity
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26740177
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26634113
linked to: http://stackoverflow.com/q/25577960
type: Question
has body: I have a main activity extending ActionBarActivity. In my activity i create a fragment which isn't showing up. I modified the main activity to extend FragmentActivity and in this case the fragment is showing up. Why isn't the fragment showing up when my activity extends ActionBarActivity? I know that ActionBarActivity extends FragmentActivity so in theory ActionBarActivity should support fragments. Edit: I resolved it. I wouldn't set any content view on my activity. Now that i set it it works when i extend ActionBarActivity. Still is weird that even if i don't set it, when i extend FragmentActivity it works. This is my main activity code: package com.example.yamba; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; //import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; public class StatusActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(savedInstanceState == null) { StatusFragment fragment = new StatusFragment(); FragmentTransaction fr = getSupportFragmentManager().beginTransaction(); fr.add(android.R.id.content, fragment); fr.commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.status, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } This is my fragment code: package com.example.yamba; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.View; import…

http://stackoverflow.com/a/26626833
has comment: http://stackoverflow.com/comment/41864220
upvote count: 5
has body: Your problem is due to there aren't Transaction in progress to commit. Cause: javax.persistence.TransactionRequiredException: no transaction is in progress Here an example on how to configure transaction manager by annotation. Here the reference @Configuration @EnableTransactionManagement public class PersistenceJPAConfig{ @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(){ ... } @Bean public PlatformTransactionManager transactionManager(){ JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory( entityManagerFactoryBean().getObject() ); return transactionManager; } } Add on scheduleCrawlerJob @Transactional @Scheduled(fixedRate=100000) @Transactional public void scheduleCrawlerJob() throws MalformedURLException { Iterable&lt;PossibleOfferLink&gt; links = repo.findAll(); PossibleOfferLink link = repo.save(new PossibleOfferLink(new URL("..."))); }
has comment: http://stackoverflow.com/comment/41866428
type: Answer
has comment: http://stackoverflow.com/comment/41865531
has comment: http://stackoverflow.com/comment/41863702
downvote count: 0
has comment: http://stackoverflow.com/comment/41866244
has comment: http://stackoverflow.com/comment/41865256
has comment: http://stackoverflow.com/comment/41863747
answers question: http://stackoverflow.com/q/26625793
has comment: http://stackoverflow.com/comment/41865358
score: 5
has comment: http://stackoverflow.com/comment/41864357
has comment: http://stackoverflow.com/comment/41864442

http://stackoverflow.com/q/26576000
downvote count: 3
has answer: http://stackoverflow.com/a/26576081
upvote count: 1
has body: Hi I am really new to Java. I really don't have an idea on what I can do to make this code work at all. public class Distance { private int xOne,yOne,xTwo,yTwo; private double distance; public Distance() { } public Distance(int x1, int y1, int x2, int y2) { x1=xOne; x2=xTwo; y1=yOne; y2=yTwo; } public void setCoordinates(int x1, int y1, int x2, int y2) { xOne=4; yOne=3; xTwo=6; yTwo=56; } public void calcDistance() { Math.sqrt((xTwo-xOne)*(xTwo-xOne)+(yTwo-yOne)*(yTwo-yOne)); } public void print( ) { out.println("x1:"); out.println("y1:"); out.println("x2:"); out.println("y2:"); out.println(distance); } }
has title: how to calculate distance between two points in Java
answer count: 4
tagged with: distance
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26577048
favorite count: 0
possible better answer: http://stackoverflow.com/a/26576041
has answer: http://stackoverflow.com/a/26576041
type: Question
accepted answer: http://stackoverflow.com/a/26577048
score: -2
has answer: http://stackoverflow.com/a/26576070
has comment: http://stackoverflow.com/comment/41769667
tagged with: java

http://stackoverflow.com/a/26521771
score: 3
accepted answer of: http://stackoverflow.com/q/26517573
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26517573
has body: I believe you have a weird naming colission here. You have two properties named id and setId. Per property, JAXB generated two a getter (getXXX) and, if instructed "isSetter" to check if the property is set - useful for primitive types. This "isSetter" is named isSetXXX. In this case your isSetter for setId collides with the getter for id. Issetter for setId: @Transient public boolean isSetId() { return (this.id!= null); } Getter for id: public II getSetId() { return setId; } Note isSetId vs. getSetId. This probably makes Hibernate crazy because it thinks that isSetId is a boolean getter whereas it expects an enity getter. Solution: rename the setId property in you model using jaxb:property in your bindings file.
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41771521
has text: what is the language you use?
comment on: http://stackoverflow.com/q/26576968
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26552314
has answer: http://stackoverflow.com/a/26584775
accepted answer: http://stackoverflow.com/a/26584775
score: 0
has title: how to use undomanager for sourceviewer
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has body: I need to add undo redo feature to my source viewer. Below is my code. public class MyViewer extends SourceViewer { public MyViewer(final Composite parent, final int styles) { super(parent, null, styles); final Font font = JFaceResources.getFont(MyConstants.EDITOR_TEXT_FONT); getTextWidget().setFont(font); IUndoManager undoManager = getUndoManager(); //new TextViewerUndoManager(25); //setUndoManager(undoManager); //new TextViewerUndoManager(10)); //undoManager.connect(this); if (undoManager != null) { undoManager.reset(); } else { undoManager = new TextViewerUndoManager(25); setUndoManager(undoManager); undoManager.connect(this); } } @Override public void setDocument(final IDocument document) { ... } @Override public void setHyperlinkPresenter(final IHyperlinkPresenter hyperlinkPresenter) throws IllegalStateException { ... } } I have added a key binding as seen in the below image. Still the undo redo does not work. I am not sure if the key binding is wrong or i am missing something in my code or both. Please highlight my mistake.
tagged with: eclipse-plugin

http://stackoverflow.com/q/26552799
score: 7
has comment: http://stackoverflow.com/comment/41727659
has comment: http://stackoverflow.com/comment/41727554
favorite count: 0
accepted answer: http://stackoverflow.com/a/26553138
tagged with: constructor
type: Question
has comment: http://stackoverflow.com/comment/41727841
has comment: http://stackoverflow.com/comment/41727715
tagged with: instance-variables
has comment: http://stackoverflow.com/comment/41727632
tagged with: scjp
has comment: http://stackoverflow.com/comment/41727886
tagged with: java
upvote count: 7
answer count: 1
has answer: http://stackoverflow.com/a/26553138
has body: According to the SCJP6 (Page 507) i found that instance variables are assigned default values before the superclass constructors complete, i tried an example in Debugg mode but i saw that the super contractor runs before instance variables get their default values, could any one explain that to me ? Example i used in case someone want to try it: package courseExercise; class test { test() { System.out.println("Super Constructor run"); } } public class Init extends test { private Integer i = 6; private int j = 8; Init(int x) { super(); System.out.println("1-arg const"); } Init() { System.out.println("no-arg const"); } static { System.out.println("1st static init"); } public static int d = 10; { System.out.println("1st instance init"); } { System.out.println("2nd instance init"); } static { System.out.println("2nd static init"); } public static void main(String[] args) { new Init(); new Init(7); } }
has title: Which run first? default values for instance variables or Super Constructors?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41743056
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26546246
score: 0
has text: You're changing it back **after** all the recursion. So all deeper recursion levels still see the flag.

http://stackoverflow.com/comment/41741282
type: QuestionComment
comment on: http://stackoverflow.com/q/26560332
has text: I am using eclipse and I am using Java 1.7 and the library is org.json
score: 0
type: Comment

http://stackoverflow.com/q/26632856
accepted answer: http://stackoverflow.com/a/26633207
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41874040
type: Question
has comment: http://stackoverflow.com/comment/41873731
answer count: 1
has body: I want to use one of the implementations of the Map interface instead of implementing the ArrayList to store data in BaseAdapter. I'm looking for the best way to get values from Map by index. Creating lists from map when i have index seem to be highly not efficient. @Override public Object getItem(int position) { // TODO Auto-generated method stub List&lt;Map.Entry&lt;String, String&gt;&gt; list = new LinkedList&lt;Map.Entry&lt;String,String&gt;&gt;(this.countries.entrySet()); return list.get(position); } Any suggestion how to do it in right way? Thanks in advanace.
score: 0
has answer: http://stackoverflow.com/a/26633207
tagged with: android
has comment: http://stackoverflow.com/comment/41874134
has title: Using implementation of Map interface instead of List interface to store data in BaseAdapter

http://stackoverflow.com/q/26531480
score: 0
has comment: http://stackoverflow.com/comment/41690461
answer count: 1
has comment: http://stackoverflow.com/comment/41689967
tagged with: sockets
has body: I am making a chat program in which I have to separate a file into 1024 Bytes chunk and send it over Socket in this format: &lt;DataPacket&gt;Binary_data&lt;DataPacket\&gt; Currently, my only idea is to send a string "&lt;Packet&gt;" then a Byte[1024] and then a string "&lt;Packet\&gt;". So my question is: Is there a more convenience way to do this? Which Java class for input/output (DataInputStream, BufferedOutputStream,... ) is most suitable and a small example code of doing this? Additional Info: I must use Java library (JRE8), no Apache,... I understand that I dont have to separate the data in TCP, it just be a must. It would be very good if all the code can be run from a function like: void SendFile(Socket sendingSocket, File fileToSend); void ReceiveFile(Socket receivingSocket);
has title: Java - How to send efficiently binary data between string over socket?
has answer: http://stackoverflow.com/a/26532278
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26532278

http://stackoverflow.com/comment/41668969
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26519837
has text: Don't make your variables local, make them instance variables. Construct a model between the tabbed pane and the views, allow the model to either be updated or changed all together.

http://stackoverflow.com/q/26626380
has answer: http://stackoverflow.com/a/26627006
downvote count: 0
favorite count: 0
upvote count: 2
has body: I currently have this code in my main(). Logger logger = Logger.getLogger("My Log"); FileHandler fh; logger.addHandler(fh); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logger.info("Test"); This outputs 2 lines. One with datetime, and the other is test. I read many other questions on this site, but i do not get how to implement it to my current code. UPDATE: I have created a new file called logging.properties and updated Logger logger = Logger.getLogger("logging.properties"); Inside the file i inputted these values handlers= java.util.logging.ConsoleHandler .level= INFO java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter javax.jms.connection.level = INFO java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n But when i run i still see the date line. What am i missing?
possible better answer: http://stackoverflow.com/a/26626628
has answer: http://stackoverflow.com/a/26626628
tagged with: logging
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2950704
accepted answer: http://stackoverflow.com/a/26627006
tagged with: java
type: Question
has title: java.util.logging: Remove date time line
answer count: 2

http://stackoverflow.com/comment/41756068
comment on: http://stackoverflow.com/a/26568365
has text: Maybe I misspoke. It depends on whether you eliminate the duplicates before or after. In the former case, you are right. The duplicates shouldn't be in the array at all, and the slots greater than the 'count' position can be left in their initial state. (Just don't print them ...) Anyway, you should think it all through for yourself rather than taking my (or anyone else's) word for it.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/26653086
score: -1
upvote count: 0
has body: If you insist on using a String array you will need to use the toString function of the Integer class. E.g. Integer.toString(42); However, this will cause pain when trying to perform Math operations on them later.
has comment: http://stackoverflow.com/comment/41909412
answers question: http://stackoverflow.com/q/26653006
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/41909500

http://stackoverflow.com/q/26618649
has answer: http://stackoverflow.com/a/26618798
has answer: http://stackoverflow.com/a/26618793
downvote count: 2
has comment: http://stackoverflow.com/comment/41848309
has title: Correct while loop output (Java)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41848313
tagged with: java
upvote count: 1
tagged with: loops
has body: I need to now make my program output this: Enter a word: house What letter do you want to replace?: a There is no a in house. What letter do you want to replace?: b There is no a in house. What letter do you want to replace?: e With what letter do you wish to replace it? w The new word is housw. _____________________________________. Here is my current output: Enter a word: house What letter do you want to replace?: a There is no a in house What letter do you want to replace?: b With what letter do you wish to replace it? _____________________________________. I am having trouble with my while loop.And im not sure how to correct the error. Here is my code: import java.util.Scanner; public class WordScrambler { //name public static void main(String[] args) { String word = ""; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a word: " + word); word = keyboard.nextLine(); String readChar = null; System.out.print("What letter do you want to replace?: "); readChar = keyboard.next(); while(true) { if(word.contains(readChar)) { String changeChar; System.out.print("With what letter do you wish to replace it? "); changeChar = keyboard.next(); System.out.println(word.replace(readChar, changeChar)); } else { System.out.print("There is no "+ readChar + " in " + word); System.out.println(); System.out.print("What letter do you want to replace?: "); readChar = keyboard.next(); String changeChar; System.out.print("With what letter do you wish to replace it? "); changeChar = keyboard.next(); System.out.println(word.replace(readChar, changeChar)); } } } }
type: Question
accepted answer: http://stackoverflow.com/a/26618798
has comment: http://stackoverflow.com/comment/41848277
answer count: 3
tagged with: while-loop
has answer: http://stackoverflow.com/a/26618827
has comment: http://stackoverflow.com/comment/41848362
favorite count: 0
score: -1
possible better answer: http://stackoverflow.com/a/26618793

http://stackoverflow.com/a/26559756
answers question: http://stackoverflow.com/q/26558955
score: 0
type: Answer
has body: That's the point of a heap versus a stack. Heaps support holes while stacks do not. You could easily use a heap like a stack, with a single pointer to the "end" of the heap, quickly incrementing it to allocate new objects, but then you run into the same problem on cleanup - how to get the space back. Unless freeing of objects can be guaranteed to happen in exactly reverse order of allocation, a stack is going to be challenging to use as a heap.

http://stackoverflow.com/comment/41745291
type: QuestionComment
comment on: http://stackoverflow.com/q/26562619
has text: so? what is the problem then?
score: 0
type: Comment

http://stackoverflow.com/q/26616026
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/26616145
type: Question
score: 0
answer count: 1
has body: OK i'm really new and i may just be doing something stupid but here is what i typed and i just want to know why once i hit the button the J Labels AL, BL, CL and the text fields A,B,C don't appear but the "pythag has been clicked" is still typed. (it works outside of the if loop but I don't know how to make it work in the if loop) import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Scanner; import javax.swing.*; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JTextField; public class JFrameStuff extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; public static void main(String[] args) { new JFrameStuff().setVisible(true); } public JFrameStuff() { super("Math"); setSize(400, 300); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); JButton bton1 = new JButton("Pythagorean Math");// 1 JPanel pythag = new JPanel(); bton1.addActionListener(this); add(bton1); add(pythag); } @Override public void actionPerformed(ActionEvent e) { String name = e.getActionCommand(); if (name.equals("Pythagorean Math")) { System.out.println("pythag has been clicked"); JLabel AL = new JLabel("A"); JLabel BL = new JLabel("B"); JLabel CL = new JLabel("C"); JTextField A = new JTextField(200); JTextField B = new JTextField(200); JTextField C = new JTextField(200); add(AL); add(A); add(BL); add(B); add(CL); add(C); } } }
tagged with: jlabel
has title: How to add a button once you click a button
has comment: http://stackoverflow.com/comment/41843551
tagged with: jframe
accepted answer: http://stackoverflow.com/a/26616145
type: AnsweredQuestion

http://stackoverflow.com/comment/41826720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26607054
has text: Did you debug it using break points?
score: 0

http://stackoverflow.com/a/26638669
type: Answer
has body: You could technically do this: ArrayList list = new ArrayList(); list.add("Name"); list.add(89); However this is not great because you would need to know ahead of time which item in the ArrayList is of what type in case you want to perform specific operations on certain items. A better solution would be to create a Person object i.e. class Person{ //fields //setter getter methods } and then do something like this: ArrayList&lt;Person&gt; list = new ArrayList&lt;Person&gt;(); Person p = new Person(); p.setName("Name"); list.add(p); In this case Person would be the equivalent of your Random object.
score: 0
answers question: http://stackoverflow.com/q/26638556

http://stackoverflow.com/a/26656634
has body: Make sure you have configured source path for JDK/SDK correctly (Project structure -> SDKs) and Maven is configured to download sources/docs automatically (Maven -> Importing). You can also check Settings -> Editor -> Show quick doc on mouse move setting.
type: Answer
has comment: http://stackoverflow.com/comment/41916482
upvote count: 1
answers question: http://stackoverflow.com/q/26656314
downvote count: 1
has comment: http://stackoverflow.com/comment/41936095
score: 0

http://stackoverflow.com/comment/41752069
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26566314
type: Comment
has text: There is a tool called "debugger", did you debug your code already?

dice
tags question: http://stackoverflow.com/q/26595265
tags question: http://stackoverflow.com/q/26518720
tags question: http://stackoverflow.com/q/26567639
type: Tag
tag name: dice

http://stackoverflow.com/comment/41922645
comment on: http://stackoverflow.com/q/26629376
type: QuestionComment
type: Comment
has text: Show me your code, on what you are doing and Why do you want to redirect? Are you submitting the data to third party websites? If you can give additional details I can help you
score: 0

http://stackoverflow.com/comment/41817126
comment on: http://stackoverflow.com/q/26601623
type: QuestionComment
type: Comment
has text: That you're only choices to provide a runnable example...
score: 0

http://stackoverflow.com/a/26562094
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/41744959
score: 11
has comment: http://stackoverflow.com/comment/41748506
has comment: http://stackoverflow.com/comment/41745131
accepted answer of: http://stackoverflow.com/q/26561995
has comment: http://stackoverflow.com/comment/41744783
has comment: http://stackoverflow.com/comment/41745020
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26561995
downvote count: 0
has body: Spring consists in many different parts, and so does Java EE. Some of them are direct competitors, while for others, Spring provides an abstraction layer and/or Spring integration of Java EE components. For example: Spring MVC is built on top of servlets (which are part of Java EE), and it competes with JAX-RS and JSF Spring core (IoC, AOP) competes with CDI and EJBs The Spring transaction handling is just an abstraction layer on top of existing transactional mechanisms (JPA, Hibernate, JDBC or JTA) Spring-data-JPA is an abstraction layer on top of JPA Spring-JDBC is an abstraction layer on top of JDBC So, for a typical webapp built with Spring, you will at least use some components of Java EE: servlets, maybe JDBC or JPA. If you need messaging and XA transactions, you'll use JMS and JTA, but Spring will provide an integration layer. Regarding dependency injection, you won't need EJBs and CDI, because Spring has direct support for the same functionality.
has comment: http://stackoverflow.com/comment/41747363

http://stackoverflow.com/comment/41742039
type: Comment
has text: Thanks a lot! It works great! Sorry for not having explained too good!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26560587

http://stackoverflow.com/q/26615348
has answer: http://stackoverflow.com/a/26615392
has title: Does anyone know how to space out console text for java in Eclipse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26615482
tagged with: console
type: Question
tagged with: spacing
accepted answer: http://stackoverflow.com/a/26615482
has answer: http://stackoverflow.com/a/26615409
has body: Excuse me if I sound ignorant in anyway. This is my first day learning Java and I have a problem. Everytime I run a program. This happens : Eveytime i run my program, it reads "53308.0of Drew Brees' Pass Yards is533.08Football Fields." I don't know how to put spaces between the number "53308.08" and "of " and also " 533.08" and Football Is this how console text is supposed to be? Can i fix it ? public class BreesPassingYardsFields { public static void main (String args []) { double PassYards; // Number of career pass yards Drew Brees has. double FieldLength; // Number of yards in a football field double FootballFields; // The amount of football fields Drew Brees has thrown for PassYards = 53308; // Start with Drew Brees' Pass Yards FieldLength = 100; // Length of a football field FootballFields = PassYards / FieldLength; // converts to how many Football Fields Drew Brees has thrown for System.out.println(PassYards + "of Drew Brees' Pass Yards is" + FootballFields + "Football Fields"); } }
tagged with: numbers
score: 0
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/26615401
answer count: 4
possible better answer: http://stackoverflow.com/a/26615392

http://stackoverflow.com/comment/41766815
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26572992
has text: Thanks. Also in case of full application of the interface segragation principle, there might be situations (as you mentioned, third party libraries) where you have to look for a tradeoff. The OR clause in generics would be the perfect tradeoff.
type: AnswerComment

http://stackoverflow.com/comment/41833788
has text: i don`t know why u say my examples contradict each other. i just wanna know how to read from that file and output into a jtextarea only the numbers from that file
comment on: http://stackoverflow.com/q/26610242
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26541319
has body: if you want the result in the same format then do : int j = 100; double sum=0; for (int i = 1; i &lt;= 100; i++) { sum += ((double) j / i); // typecast as least one of i or j to double. System.out.print(j + "/" + i+"+"); j--; } // here print the sum
score: 0
has comment: http://stackoverflow.com/comment/41707515
type: Answer
has comment: http://stackoverflow.com/comment/41707504
has comment: http://stackoverflow.com/comment/41707275
answers question: http://stackoverflow.com/q/26541196
has comment: http://stackoverflow.com/comment/41707294

http://stackoverflow.com/q/26625316
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/26643307
tagged with: java
linked to: http://stackoverflow.com/q/21855842
type: Question
has answer: http://stackoverflow.com/a/26643307
has title: Add line marker to line series/chart (Apache POI XSSF or Excel VBA)
score: -1
has body: I have studied Apache POI Example on how to create a line chart. It output a single line chart like the chart in Apache POI add a Series name into LineChart. How can I add the line marker to the line?
answer count: 1
downvote count: 1
tagged with: vba
favorite count: 0
tagged with: excel
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/135378565
type: Comment
score: 1
has text: You would think if Jackson 2 is completely incompatible with Jackson 1, that this would have been an opportunity to make it work properly. Jackson is stupidly complicated to get working compared to other languages/frameworks.
comment on: http://stackoverflow.com/a/26866667
type: AnswerComment

size
type: Tag
tags question: http://stackoverflow.com/q/26555706
tags question: http://stackoverflow.com/q/26559440
tag name: size

http://stackoverflow.com/a/26612293
score: 0
type: AcceptedAnswer
has body: Solved! I modified the opencv.jar and forgot to delete the Meta-Inf! In my case, the error came because of the Meta-Inf.
type: Answer
answers question: http://stackoverflow.com/q/26607384
accepted answer of: http://stackoverflow.com/q/26607384

http://stackoverflow.com/q/26521097
has title: Using infowindowclicklistener for maker pin in google maps for data retrieved from JSON android
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26521152
type: Question
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/26521152
score: 0
answer count: 1
has body: I am working on a project where there is a google map and the marker pins in it are populated with data recieved from JSON.I have set the marker pins as follows: public void loadpinsonmap() { for(int i=0;i&lt;job_list.size();i++) { Job_data j=job_list.get(i); googleMap.addMarker(new MarkerOptions().title(j.job_shop_name+"@@@"+j.job_total_price) .position(new LatLng(Double.parseDouble(j.job_shop_latitude),Double.parseDouble(j.job_shop_longitude)))); } } The custom info window is set as follows: googleMap.setInfoWindowAdapter(new InfoWindowAdapter() { @Override public View getInfoWindow(Marker pin) { View v = getActivity().getLayoutInflater().inflate(R.layout.info_window_layout, null); TextView tvshop = (TextView) v.findViewById(R.id.tv_shop_name); TextView tvprice = (TextView) v.findViewById(R.id.tv_job_price); String[] contents = pin.getTitle().split("@@@"); String shop_name = contents[0]; String job_price = contents[1]; tvshop.setText(shop_name); tvprice.setText("Rs "+job_price); return v; } @Override public View getInfoContents(Marker arg0) { return null; } }); Now my issue is this: I want to click the info window and get the corresponding object for that particular marker pin.One way of doing it would be to iterate through the list and compare with the latitude of that particular pin's latitude.But if the list is large then there would be time wasted in iteration.So is there any way to get the corrseponding object other than iterating through the list?

http://stackoverflow.com/q/26658939
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/53009143
type: Question
tagged with: amazon-s3
upvote count: 5
tagged with: java
tagged with: hadoop
score: 5
downvote count: 0
has title: Error when trying to access S3 using jets3t
has body: I know this question has been asked before, but either there was no response or there was no indication from the person originally asking that it was resolved. I am trying to access S3n storage by modifying the S3n interface of Hadoop. I am setting up a file-system called Tachyon on top of S3n. For this, I have to format the file-system. I was getting this error when trying to do so: Connection to tachyon-master... Formatting Tachyon Worker @ tachyon-master Removing local data under folder: /mnt/ramdisk/tachyonworker/ Connection to tachyon-master closed. Formatting Tachyon Master @ tachyon-master Formatting JOURNAL_FOLDER: /home/ubuntu/tachyon-0.5.0/libexec/../journal/ Exception in thread "main" java.lang.NoClassDefFoundError: org/jets3t/service/S3ServiceException at org.apache.hadoop.fs.s3native.NativeS3FileSystem.createDefaultStore(NativeS3FileSystem.java:280) at org.apache.hadoop.fs.s3native.NativeS3FileSystem.initialize(NativeS3FileSystem.java:270) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2433) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:88) at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2467) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:287) at tachyon.UnderFileSystemHdfs.&lt;init&gt;(UnderFileSystemHdfs.java:89) at tachyon.UnderFileSystemHdfs.getClient(UnderFileSystemHdfs.java:56) at tachyon.UnderFileSystem.get(UnderFileSystem.java:69) at tachyon.UnderFileSystem.get(UnderFileSystem.java:54) at tachyon.Format.formatFolder(Format.java:32) at tachyon.Format.main(Format.java:59) Caused by: java.lang.ClassNotFoundException: org.jets3t.service.S3ServiceException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.find…
favorite count: 0
has comment: http://stackoverflow.com/comment/49651835
answer count: 0

http://stackoverflow.com/q/26572256
linked to: http://stackoverflow.com/q/13381452
upvote count: 2
tagged with: spring
has comment: http://stackoverflow.com/comment/75330942
tagged with: java
score: 2
has body: I am new to spring security and learning it. I was looking for simple authentication process in Spring security where user enters his credentials and spring security authenticates it. Go this link mykong simple authentication example. But everywhere on net like in this example i see configuration like below &lt;http&gt; &lt;intercept-url pattern="/welcome*" access="ROLE_USER" /&gt; &lt;http-basic /&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="mkyong" password="123456" authorities="ROLE_USER" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; Here if user access any URL with pattern /welcome*, Two steps will take place :- 1)he will be authenticated for user name as "mkyong" and password as "123456" 2)Spring will also check if user has role "ROLE_USER" What i am looking for is just for step where user is authenticated for credentials but not for role? I am sure it should be minor change in configuration. But could not spot it
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/41762899
linked to: http://stackoverflow.com/q/32685057
type: Question
has title: Spring authentication without role authorization?
has comment: http://stackoverflow.com/comment/41764351

http://stackoverflow.com/comment/41865509
comment on: http://stackoverflow.com/a/26628087
type: Comment
has text: Thank you, i used this method. i need to manage a large number of strings so i tried to evade `split` in any moment.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/41734108
type: Comment
type: QuestionComment
has text: You shouldn't be creating a Frame within an Applet, this could cause a SecurityManagerException
comment on: http://stackoverflow.com/q/26556225
score: 0

http://stackoverflow.com/comment/41660118
score: 0
type: QuestionComment
type: Comment
has text: Edit the code which creates the file into your app. Consider temporarily moving the file to the external storage, or using the emulator, so that you can adb pull the file and examine it.
comment on: http://stackoverflow.com/q/26513870

http://stackoverflow.com/comment/41659134
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26514659
has text: Multiply by 10 n times?
score: 6

http://stackoverflow.com/q/26668736
has answer: http://stackoverflow.com/a/26668762
has answer: http://stackoverflow.com/a/26668763
has comment: http://stackoverflow.com/comment/41938456
answer count: 2
upvote count: 1
has title: How to get value from list in java which is added from hash map
favorite count: 0
has body: I have some doubt regarding the following code: public static void main(String[] args) { HashMap&lt;String,String&gt; hMap = new HashMap&lt;String,String&gt;(); System.out.println("Size of HashMap : " + hMap.size()); hMap.put("1", "One"); hMap.put("2", "Two"); hMap.put("3", "Three"); System.out.println("Size of HashMap after addition : " + hMap.size()); // remove one element from HashMap ArrayList&lt;HashMap&lt;String, String&gt;&gt; list; list = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); list.add(hMap); System.out.println(""+hMap.get(1)); System.out.println(""+list.size()); //if(list.size()&lt;1) System.out.println(""+list.get(0)); } Output Size of HashMap : 0 Size of HashMap after addition : 3 null 1 {3=Three, 2=Two, 1=One} Myquestion How do I get each value from the list?
type: AnsweredQuestion
tagged with: list
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26668763
tagged with: collections
type: Question
possible better answer: http://stackoverflow.com/a/26668762

google-app-engine
tags question: http://stackoverflow.com/q/26571710
tag name: google-app-engine
tags question: http://stackoverflow.com/q/26646558
tags question: http://stackoverflow.com/q/26557542
tags question: http://stackoverflow.com/q/26565763
tags question: http://stackoverflow.com/q/26569240
type: Tag
tags question: http://stackoverflow.com/q/26622710
tags question: http://stackoverflow.com/q/26515859
tags question: http://stackoverflow.com/q/26557940
tags question: http://stackoverflow.com/q/26574680
tags question: http://stackoverflow.com/q/26646459
tags question: http://stackoverflow.com/q/26621474
tags question: http://stackoverflow.com/q/26542940
tags question: http://stackoverflow.com/q/26557828
tags question: http://stackoverflow.com/q/26545971
tags question: http://stackoverflow.com/q/26594955
tags question: http://stackoverflow.com/q/26559774
tags question: http://stackoverflow.com/q/26550851
tags question: http://stackoverflow.com/q/26568293
tags question: http://stackoverflow.com/q/26618658
tags question: http://stackoverflow.com/q/26561162
tags question: http://stackoverflow.com/q/26572944
tags question: http://stackoverflow.com/q/26624395
tags question: http://stackoverflow.com/q/26571021
tags question: http://stackoverflow.com/q/26644232
tags question: http://stackoverflow.com/q/26628290
tags question: http://stackoverflow.com/q/26547298
tags question: http://stackoverflow.com/q/26644792
tags question: http://stackoverflow.com/q/26599121
tags question: http://stackoverflow.com/q/26564360
tags question: http://stackoverflow.com/q/26533837
tags question: http://stackoverflow.com/q/26538942
tags question: http://stackoverflow.com/q/26664888

http://stackoverflow.com/q/26556366
tagged with: parsing
accepted answer: http://stackoverflow.com/a/26572355
score: 0
has comment: http://stackoverflow.com/comment/41770380
answer count: 1
has comment: http://stackoverflow.com/comment/41749722
has body: I am trying to extract some data from the following link and I can retrieve contents of any element of that page except the one that holds a dynamic time. I tried every possible CSS Selectors and none of them worked. You might want to inspect the element of this page. HTML: Today 12:41 am , , The Java Code: import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { /** * @param args */ public static void main(String[] args) throws IOException { Document doc=Jsoup.connect("http://bikroy.com/en/ads-in-bangladesh?query=Nokia&category=&location=").userAgent("Chrome").timeout(999999).get(); Elements titles = doc.select("div.title"); Elements prices = doc.select("span.data"); Elements locations = doc.select("span.location"); Elements dates = doc.select("span.date"); //Elements dates = doc.select("[data-time*=14]"); for(int i = 0; i < titles.size(); i++) { System.out.println("\nTitle: " + titles.get(i).text() + "\nPrice: " + prices.get(i).text() + "\nLocation: " + locations.get(i).text() + "\nDate: " + dates.get(i).text()); } } } Sample Output: Title: Brand New Nokia Lumia 530 Dual Sim Price: Tk. 8,000 Location: Dhaka Date: Title: Nokia n95 Price: Tk. 999 Location: Dhaka Date: Title: Nokia c3-01 Price: Tk. 3,500 Location: Dhaka Date: See? The Date is empty!! How can I fix this? Update: import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { /** * @param args */ public static void main(String[] args) throws IOException, ArrayIndexOutOfBoundsException { Document doc=Jsoup.connect("http://bikroy.com/en/ads-in-bangladesh?query=Nokia&category=&location=").userAgent("Chrome").timeout(999999).get(); Elements titles = doc.select("div.title"); Elements prices = doc.select("sp…
has title: Jsoup: Unable to retrieve time/date elements
tagged with: java
has comment: http://stackoverflow.com/comment/41762134
tagged with: jsoup
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26572355
has comment: http://stackoverflow.com/comment/41769654
type: Question
tagged with: css

http://stackoverflow.com/comment/41780170
type: QuestionComment
comment on: http://stackoverflow.com/q/26560198
score: 0
has text: Not sure if this will help, but give it a try in case some drawing resolution defaults changed in between versions. You can try to wrap the chart in a ChartPanel and set the maximum resolution before things get scaled like this: `chartPanel = new ChartPanel(chart); chartPanel.setMaximumDrawHeight(2400); chartPanel.setMaximumDrawWidth(3600);`.
type: Comment

http://stackoverflow.com/comment/41661071
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26515530
has text: I guess "variable number of arguments" is more suitable than "unknown". See http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
score: 0

http://stackoverflow.com/q/26593576
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/513832
tagged with: validation
tagged with: parsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41805089
has comment: http://stackoverflow.com/comment/41801880
has body: I have to create a program that accepts a "tweet" from a user and validates it. First it tests to make sure it is less than 140 characters. If it is valid, it counts the number of hashtags (#), attribution symbols (@), and links ("http://) are in the string, then prints them out. My program works for hashtags and attributions, but not links. How can I fix this code so that it works? import java.util.Scanner; class Testing { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("Please enter a tweet: "); String input = scan.nextLine(); int length = input.length(); int count = 0; int hashtags = 0, attributions = 0, links = 0; char letter; if (length &gt; 140) { System.out.println("Excess characters: " + (length - 140)); } else { while (count &lt; length) { letter = input.charAt(count); if (letter =='#') { hashtags++; count++; } if (letter == '@') { attributions++; count++; } if (letter == 'h') { String test = input.substring(count,count+6); test = test.toLowerCase(); if (test == "http://") { links++; count++; } else { count++; } } else { count ++; } } System.out.println("Length Correct"); System.out.println("Number of Hashtags: " + hashtags); System.out.println("Number of Attributions: " + attributions); System.out.println("Number of Links: " + links); } }
tagged with: tweets
tagged with: java
has answer: http://stackoverflow.com/a/26593664
has title: Tweet validation in Java
type: Question
has comment: http://stackoverflow.com/comment/41801902
has comment: http://stackoverflow.com/comment/41802467
has answer: http://stackoverflow.com/a/26593737
has comment: http://stackoverflow.com/comment/41801965

http://stackoverflow.com/q/26606113
has body: I've also tried some other stackoverflow and google-solutions but they didn't work (How to properly design/style a Android Navigation Drawer, Navigation Drawer – Part 1) I want to style the NavigationDrawer but I don't understand, which code I should change. I want to set following style (background/foreground): Standard Active-Item Pressed/Focused-Item and I also want to add an Icon before the List-Items! Here is the activity where the content is loaded in and drawer is shown: activity_main_window.xml: &lt;!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="bernd.slider"&gt; &lt;FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;!-- The drawer is given a fixed width in dp and extends the full height of the container. --&gt; &lt;fragment android:id="@+id/navigation_drawer" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" android:name="bernd.slider.NavigationDrawerFragment" tools:layout="@layout/fragment_navigation_drawer" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; And here the fragment_navigation_drawer.xml:(Where the ListView is stored in) &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:choiceMode="singleChoice" android:divider="@color/darkred" android:dividerHeight="1dp" android:background="@color/white" tools:context="bernd.slider.NavigationDrawerFragment" android:id="@+id/navigation_drawer…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26630395
has title: NavigationDrawer Fragment Styling/Icon
tagged with: android
linked to: http://stackoverflow.com/q/18201727
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-fragments
tagged with: java
type: Question
tagged with: android-layout
score: 0
answer count: 1

http://stackoverflow.com/q/26651066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41906194
tagged with: java
has answer: http://stackoverflow.com/a/26651601
has answer: http://stackoverflow.com/a/26651291
possible better answer: http://stackoverflow.com/a/26651322
has comment: http://stackoverflow.com/comment/41906151
accepted answer: http://stackoverflow.com/a/26651354
type: Question
has answer: http://stackoverflow.com/a/26651322
tagged with: algorithm
has answer: http://stackoverflow.com/a/26651354
has comment: http://stackoverflow.com/comment/41906037
score: 0
has comment: http://stackoverflow.com/comment/41906088
has comment: http://stackoverflow.com/comment/41906172
has title: How to distribute integers topdown a set of persons?
has body: I have a sorted set of persons, and I want to distribute a defined count topdown. Example: Scenario: int i = 8; personA = 0; personB = 0; personC = 0; Desired result: personA = 3; personB = 3; personC = 2; Of course I could iterate with for/while loops, but if i is very large that might be inefficient. Can the result also be optained by devision, without loops? Pseudocode: distributed = 0; while (distributed &lt; i) { for (int p : persons) { p++; distributed++; } } interation steps: 1-1-1 &gt; start over &gt; 2-2-2 &gt; start over &gt; 3-3-2
has comment: http://stackoverflow.com/comment/41906010
answer count: 4

http://stackoverflow.com/q/26588649
tagged with: jnetpcap
score: 0
tagged with: java
type: Question
has title: jNetPcap overloading openOffline()
has answer: http://stackoverflow.com/a/26592664
answer count: 1
has body: I'm looking for a way to overload this function in jNetPcap: Pcap openOffline(String fname, StringBuilder errbuf); I want to implement it in this way: Pcap openOffline(InputStraem stream, StringBuilder errbuf); I have downloaded the source code but this function is a native function, how can I go to the implementation of this function and try to change it?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26592664

http://stackoverflow.com/q/26556659
has comment: http://stackoverflow.com/comment/41736403
favorite count: 0
upvote count: 14
has comment: http://stackoverflow.com/comment/41735079
has answer: http://stackoverflow.com/a/61103154
has comment: http://stackoverflow.com/comment/41734778
possible better answer: http://stackoverflow.com/a/27395652
tagged with: getter-setter
answer count: 5
has answer: http://stackoverflow.com/a/34899503
accepted answer: http://stackoverflow.com/a/34899503
has answer: http://stackoverflow.com/a/77360510
has title: Can IntelliJ generate getters without the "get" prefix?
downvote count: 0
has comment: http://stackoverflow.com/comment/41734964
has comment: http://stackoverflow.com/comment/41734881
type: Question
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27395652
tagged with: java
has body: IntelliJ has the cool feature to generate Java getters. For example, for a field private final String foo, it will generate a getter getFoo(). Is there any way I can configure IntelliJ to generate getters in the format String foo()? I am working mainly with immutable objects and prefer this syntax.
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/44119228
tagged with: getter

http://stackoverflow.com/a/26578929
upvote count: 1
has comment: http://stackoverflow.com/comment/41775133
type: Answer
downvote count: 0
score: 1
has body: Probably just one thread, assuming you have one DatagramSocket. You could always spawn a processData thread from your thread that reads the UDPSocket. Like people said in the comments it's up to you, but usually one is good. Edit: Also look into mutexes if you do this.
has comment: http://stackoverflow.com/comment/41775214
answers question: http://stackoverflow.com/q/26578692

http://stackoverflow.com/comment/41928090
comment on: http://stackoverflow.com/a/26659413
type: AnswerComment
type: Comment
score: 3
has text: You can ask the stream for a Spliterator, call tryAdvance(lambda) where your lambda captures anything passed to it, and then return a Spliterator that delegates almost everything to the underlying Spliterator, except that it glues the first element back onto the first chunk (and fixes up the result of estimateSize).

http://stackoverflow.com/comment/41840539
has text: IngredientsAdapter ingredientsAdapter = new IngredientsAdapter(this.getActivity());
comment on: http://stackoverflow.com/q/26614353
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26559455
tagged with: java
tagged with: jtextfield
type: Question
tagged with: arrays
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26559508
has title: For Each loops to first build and then retrieve JTextField inputs
accepted answer: http://stackoverflow.com/a/26559508
favorite count: 0
upvote count: 2
tagged with: jbutton
has body: I am still quite new to coding and I am hitting a bit of a wall right now. I have an array of strings that I use in a loop to build a JLabel and a corresponding JTextField. String[] textFieldList = {"Name", "Age", "Height", "weight"}; formPanel.setLayout(new BoxLayout(formPanel, BoxLayout.Y_AXIS)); for (String tfL : textFieldList) { JLabel jl = new JLabel(tfL); JTextField jtf = new JTextField(""); jtf.setName(tfL); formPanel.add(jl); formPanel.add(jtf); } addPanel.add(formPanel, BorderLayout.CENTER); I have a save button that I want to retrieve the all of entered values, so I am trying to use the same array to get the name of each JTextField by using the same array of strings to get the value of each text field. I have not yet been able to successful build a loop that has worked for me yet. saveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (String tfL : textFieldList) { tfL.getText() } } }); Is there a way that I can build the loop correctly to return the string results and can I test the returned values to see if they should be parsed as ints. If anyone could point me in the right direction it would be great.
tagged with: foreach
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/41715166
type: Comment
comment on: http://stackoverflow.com/a/26534250
has text: I was too quick off the mark with my response and acceptance there - I just came across some more code which is now going over the line width and not wrapping. I'll leave the up-vote on your answer but I can't accept it. I'll put the issue in the question.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26614925
accepted answer: http://stackoverflow.com/a/26627746
tagged with: java
upvote count: 1
answer count: 1
has body: I have implemented and added a PhysicsCollisionListener to register when a projectile hits a player. But when a projectile hits a player. multiple events are triggered. I add my listener with bulletAppState.getPhysicsSpace().addCollisionListener(collisionListener) in my simpleInitApp() method. I remove the projectile after the collision. What I need to do to get only one event for each projectile? Here is my code: public void collision(PhysicsCollisionEvent event) { //nodeA is a projectile if(event.getNodeA().getName().startsWith("Projectile")) { //projectile hits player if(event.getNodeB().getName().startsWith("Player")) { onHit(event.getNodeA(), event.getNodeB().getParent().getUserData("player"); } //projectile hits projectile else if(event.getNodeB().getName().startsWith("Projectile")) { return; } //in any case, remove projectile projectileNode.detachChild(event.getNodeA()); bulletAppState.getPhysicsSpace().remove(event.getNodeA()); } //nodeB is a projectile if(event.getNodeB().getName().startsWith("Projectile")) { //projectile hits player if(event.getNodeA().getName().startsWith("Player")) { onHit(event.getNodeB(), event.getNodeA().getParent().getUserData("player"); } //in any case, remove projectile projectileNode.detachChild(event.getNodeB()); bulletAppState.getPhysicsSpace().remove(event.getNodeB()); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26627746
downvote count: 0
score: 1
tagged with: jmonkeyengine
favorite count: 0
type: Question
has title: jMonkeyEngine multiple collision events for single collision

http://stackoverflow.com/comment/41822574
type: QuestionComment
has text: Side note : You don't have to use `BufferedReader+ FileReader` as argument to the scanner.. You can just pass the fileName.
comment on: http://stackoverflow.com/q/26604875
score: 0
type: Comment

http://stackoverflow.com/comment/106802844
type: AnswerComment
has text: note that there's also the searchScope.fetchObjects, that immediately gives you the Document object. Combined it with "select *" to have the document populated with it's properties. This reduces the need for an additional fetchInstance (roundtrip)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26652452

http://stackoverflow.com/q/26545241
tagged with: owl
tagged with: owl-api
has answer: http://stackoverflow.com/a/26556964
has title: owlexplanation with Hermit reasoner
favorite count: 0
has body: I am trying to use Hermit Reasoner to check consistency. Hermit reasoner by default does not provide any justification/explanations for the inconsistencies. EDITED VERSION:: I'm currently trying with OWLReasoner, but still it which throws an error. import java.util.Set; import org.semanticweb.HermiT.Reasoner; import org.semanticweb.owl.explanation.api.Explanation; import org.semanticweb.owl.explanation.api.ExplanationGeneratorFactory; import org.semanticweb.owl.explanation.api.ExplanationManager; import org.semanticweb.owl.explanation.impl.blackbox.checker.InconsistentOntologyExplanationGeneratorFactory; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.reasoner.Node; import org.semanticweb.owlapi.reasoner.OWLReasoner; import org.semanticweb.owl.explanation.api.ExplanationGenerator; import org.semanticweb.owlapi.model.OWLDataFactory; import org.semanticweb.owlapi.model.OWLNamedIndividual; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; public class ConsistencyChecker { public static void main(String[] args) throws Exception { OWLOntologyManager m=OWLManager.createOWLOntologyManager(); OWLOntology o=m.loadOntologyFromOntologyDocument(IRI.create("http://www.cs.ox.ac.uk/isg/ontologies/UID/00793.owl")); // Reasoner hermit=new Reasoner(o); OWLReasoner owlreasoner=new Reasoner.ReasonerFactory().createReasoner(o); System.out.println(owlreasoner.isConsistent()); //System.out.println(hermit.isConsistent()); //---------------------------- Copied from example--------- OWLDataFactory df = m.getOWLDataFactory(); OWLClass testClass = df.getOWLClass(IRI.create("urn:test#testclass")); m.addAxiom(o, df.getOWLSubClassOfAxiom(testClass, df.get…
has answer: http://stackoverflow.com/a/26715520
accepted answer: http://stackoverflow.com/a/26715520
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: ontology
possible better answer: http://stackoverflow.com/a/26556964
tagged with: eclipse
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/a/26640762
has comment: http://stackoverflow.com/comment/41888456
accepted answer of: http://stackoverflow.com/q/26640644
type: Answer
upvote count: 16
has body: The problem is that setColorSchemeColors() expects color integers as inputs (e.g. Color.BLUE), not color resource IDs. You should use setColorSchemeResources() instead, which accepts color resource references.
downvote count: 0
score: 16
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26640644

http://stackoverflow.com/a/26584414
upvote count: 2
has body: This int[] highSum = highestSum(array); System.out.println("The array is: "+highSum); will print the result you see. Use System.out.println("The array is: " + Arrays.toString(highSum)); to print the content.
answers question: http://stackoverflow.com/q/26584325
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26584325
score: 2

http://stackoverflow.com/q/26649631
score: 1
tagged with: java
tagged with: hibernate
has body: I have 2 tables: @Entity public class A implements Serializable { @Column @NotNull @Size(min = 1) @Pattern(regexp = "[A-Za-z]{1}[A-Za-z0-9_]*") private String token; @ManyToOne(optional = true) @JoinColumn(name = "b_id", referencedColumnName = "id") private B b; ... } @Entity public class B implements Serializable { @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "b") private List&lt;A&gt; a; ... } The Token in entity A should be UNIQUE within B. For example there is a Token1 within B1 and also a Token1 within B2, but there can be a second Token1 inside B1. I'm using JPA with Hibernate. How do I achieve this?
type: Question
has title: JPA: Column should be unique inside its parent.
tagged with: jpa
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26649800
favorite count: 0
tagged with: unique
accepted answer: http://stackoverflow.com/a/26649800
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/26657055
score: 15
answer count: 3
has body: I am using Spring Data MongoDB and would like to perform a Bulk Update just like the one described here: http://docs.mongodb.org/manual/reference/method/Bulk.find.update/#Bulk.find.update When using regular driver it looks like this: The following example initializes a Bulk() operations builder for the items collection, and adds various multi update operations to the list of operations. var bulk = db.items.initializeUnorderedBulkOp(); bulk.find( { status: "D" } ).update( { $set: { status: "I", points: "0" } } ); bulk.find( { item: null } ).update( { $set: { item: "TBD" } } ); bulk.execute() Is there any way to achieve similar result with Spring Data MongoDB ?
has title: Spring Data MongoDB and Bulk Update
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring-data-mongodb
has answer: http://stackoverflow.com/a/37030773
has answer: http://stackoverflow.com/a/26667339
tagged with: java
has answer: http://stackoverflow.com/a/63303282
type: Question
upvote count: 15
tagged with: mongodb

http://stackoverflow.com/q/26583267
favorite count: 0
has title: How to handle DLL events in java project used JNI?
linked to: http://stackoverflow.com/q/6746078
has body: I made Java project using JNI(Java Native Interface). Java load a DLL file. the DLL fires Events. How to handle DLL events in Java program? When the DLL event is fired, I want to call specific method.
has answer: http://stackoverflow.com/a/26592947
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-native-interface
accepted answer: http://stackoverflow.com/a/26592947
answer count: 1
downvote count: 0
tagged with: events
has comment: http://stackoverflow.com/comment/41790358

http://stackoverflow.com/comment/41902737
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26648879
type: Comment
has text: If you have a binary relation where x% will be 1 and y% will be N, then the expected length of your array will be 1*x% + N * y%. For example if 50% of your arrays will be of length 1 and 50% will be of length 10, then the expected length of each array will be 0.5 + 10 * 0.5 = 5.5 So you should set your `ArrayList` to either 5 or 6 (on average), but this will waste a lot of memory for virtually no computational gain.

http://stackoverflow.com/q/26583715
type: Question
has comment: http://stackoverflow.com/comment/41784949
has comment: http://stackoverflow.com/comment/41786242
has body: I am trying to insert multiple rows in the Database. I am calling the hibernate saveorupdate method inside a for loop for inserting multiple rows in the table. But only row gets inserted below is the code for(int i=1; i&lt;=noofrows;i++) // value of noofrows is fetched from jsp saveintoDB(employeeData); Below is the DAO method public EmployeeData saveintoDB(EmployeeData employeeData) throws Exception{ Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); session.saveOrUpdate(employeeData); tx.commit(); } finally { session.close(); } return employeeData; } The employeeData object has empid as the primary key. Does hibernate allows only one row to be inserted at a time or do we have to make changes for empid property in EmployeeData.hbm.xml?
has comment: http://stackoverflow.com/comment/41786162
upvote count: 1
favorite count: 0
has title: Hibernate saveorupdate method does not insert multiple rows using for loop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41783492
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41783306
tagged with: mysql
has comment: http://stackoverflow.com/comment/41783323
has comment: http://stackoverflow.com/comment/41786032

http://stackoverflow.com/comment/41903466
comment on: http://stackoverflow.com/q/26649412
score: 1
type: Comment
type: QuestionComment
has text: No you can't; recommended viewing: [here](http://www.youtube.com/watch?v=C_QbkGU_lqY). In short: method references etc are dealt with using invokedynamic call sites. Such call sites _are_ programmable however, see [here](http://docs.oracle.com/javase/8/docs/api/java/lang/invoke/CallSite.html).

http://stackoverflow.com/q/26658287
type: Question
linked to: http://stackoverflow.com/q/12369967
has title: How to determine currently running Play version?
tagged with: java
upvote count: 1
answer count: 1
has body: Is there some easy way of retrieving the currently running version of Play framework for an application? I was hoping there is something like Play.getVersion() which would return "2.3.6" if the application is running version 2.3.6. The only way I've found so far is the do something like System.out.println(((HashMap&lt;String, Object&gt;)Play.application().configuration().getObject("java")).get("class")); which gives me all jars loaded for my application, and I can check if e.g. play_2.11-2.3.6.jar is loaded. Please tell me there is a better way?
has answer: http://stackoverflow.com/a/26658431
type: UnansweredQuestion
tagged with: playframework
tagged with: version
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/26664153
has body: Thank you RaSh, thank you dansouza. I found a way to fill the &lt;h:inputText&gt; with the values gotten from the database, and it's really easy. Just create a method in the ManagedBean: //Fill the inputText with values public void loadFields(int id, int placa, String marca, String modelo, String color, boolean agencia, int anio) { //Filling values into the form setId(id); setMarca(marca); setPlaca(placa); setModelo(modelo); setColor(color); setAgencia(agencia); setAnio(anio); } Then in the .xhtml page: &lt;h:commandButton value="Actualizar vehiculo" action="#{vehiculoMB.cargarCampos(vehi.id, vehi.placa, vehi.marca, vehi.modelo, vehi.color, vehi.agencia, vehi.anio)}" &gt; &lt;/h:commandButton&gt; I know this is not a best practice, but I am learning JSF yet. Hope this can be helpful for any who need it.
type: Answer
answers question: http://stackoverflow.com/q/26637549
accepted answer of: http://stackoverflow.com/q/26637549
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26665396
tagged with: spring-integration
tagged with: java
has comment: http://stackoverflow.com/comment/41933132
has body: <property name="host" value="${host}" /> <property name="privateKey" value="file:${keyfile}"/> <property name="user" value="${user}" /> <property name="port" value="${port}" /> I have the above configuration. and I have public key under authorized keys ~/.ssh2 on server. I am still getting the Caused by: com.jcraft.jsch.JSchException: Auth fail error. All the credentials are correct and am able to sftp through command prompt. Kindly suggest asap. Confused. Please see the logs: INFO | jvm 1 | 2014/10/31 13:41:23 | ... 21 more INFO | jvm 1 | 2014/10/31 13:41:23 | Caused by: com.jcraft.jsch.JSchException: Auth fail INFO | jvm 1 | 2014/10/31 13:41:23 | at com.jcraft.jsch.Session.connect(Session.java:464) INFO | jvm 1 | 2014/10/31 13:41:23 | at com.jcraft.jsch.Session.connect(Session.java:158) INFO | jvm 1 | 2014/10/31 13:41:23 | at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:198) INFO | jvm 1 | 2014/10/31 13:41:23 | ... 22 more This is the detailed log. Iam Confused whether it is connecting or not. Could you please help me
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41932829
has comment: http://stackoverflow.com/comment/41932743
has comment: http://stackoverflow.com/comment/41933180
has comment: http://stackoverflow.com/comment/41933361
has comment: http://stackoverflow.com/comment/41933148
has title: Caused by: com.jcraft.jsch.JSchException: Auth fail with sftp private key
score: 1
linked to: http://stackoverflow.com/q/16154361
favorite count: 0
has comment: http://stackoverflow.com/comment/41936252
tagged with: sftp
type: Question
has comment: http://stackoverflow.com/comment/41933940
upvote count: 2
has answer: http://stackoverflow.com/a/26675283
has comment: http://stackoverflow.com/comment/41933216
downvote count: 1
answer count: 1

http://stackoverflow.com/comment/41689260
has text: where i can find more information about spring+hibernate+firebird, thx?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26528391
type: Comment

http://stackoverflow.com/comment/41916063
type: QuestionComment
score: 0
has text: try calling `init()` and `doWork()` in either onCreateView() or `onViewCreated()`
type: Comment
comment on: http://stackoverflow.com/q/26656821

http://stackoverflow.com/a/26664841
type: Answer
accepted answer of: http://stackoverflow.com/q/26664809
upvote count: 11
answers question: http://stackoverflow.com/q/26664809
has body: String.contains doesn't use regular expressions - it just checks whether one string contains another, in the way that "foobar" contains "oob". It sounds like you want to check that name only contains letters, in which case you should be checking something like: if (name.matches("^[A-Za-z]+$")) The + (instead of *) will check that it's non-empty; the ^ and $ will check that there's nothing other than the letters. If you expect it to be a full name, however, you may well want to allow spaces, hyphens and apostrophes: if (name.matches("^[-' A-Za-z]+$")) Also consider accented characters - and punctuation from other languages.
has comment: http://stackoverflow.com/comment/41931656
has comment: http://stackoverflow.com/comment/41931573
has comment: http://stackoverflow.com/comment/41931586
score: 11
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26632219
type: Question
tagged with: android-viewpager
has body: Right now I have an Adapter class, which extends PagerAdapter. Inside I have my InstantiateItem() method. Here I have instantiate several buttons on the view: @Override public Object instantiateItem(ViewGroup parent, final int position) { final int delPosition = position; //Get the inflater LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); //inflate the root layout View view = inflater.inflate(R.layout.collection, null); //Grab instance of image ImageView imageView = (ImageView) view.findViewById(R.id.region); //Sets a drawable as the content of this ImageView. imageView.setImageResource(regionImages.get(position)); //scores toggle buttons zero = (ToggleButton) view.findViewById(R.id.number_zero); one = (ToggleButton) view.findViewById(R.id.number_one); two = (ToggleButton) view.findViewById(R.id.number_two); three = (ToggleButton) view.findViewById(R.id.number_three); four = (ToggleButton) view.findViewById(R.id.number_four); five = (ToggleButton) view.findViewById(R.id.number_five); six = (ToggleButton) view.findViewById(R.id.number_six); seven = (ToggleButton) view.findViewById(R.id.number_seven); eight = (ToggleButton) view.findViewById(R.id.number_eight); nine = (ToggleButton) view.findViewById(R.id.number_nine); ten = (ToggleButton) view.findViewById(R.id.number_ten); one.setOnClickListener(createClickListener(1)); two.setOnClickListener(createClickListener(2)); three.setOnClickListener(createClickListener(3)); four.setOnClickListener(createClickListener(4)); five.setOnClickListener(createClickListener(5)); six.setOnClickListener(createClickListener(6)); seven.setOnClickListener(createClickListener(7)); eight.setOnClickListener(createClickListener(8)); nine.setOnClickListener(createClickListener(9)); ten.setOnClickListener(createClickListener(10)); //Back Arrow Button final ImageView back_button = (ImageView) view.findViewById(R.id.back_nav_arrow); back_button.setOnClickListener(new View.OnClickLi…
score: 0
answer count: 1
has title: How can I save the state and value of button press between views in a viewpager?
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26639082
tagged with: java
accepted answer: http://stackoverflow.com/a/26639082

http://stackoverflow.com/q/26654462
type: Question
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26656906
favorite count: 0
tagged with: ibatis
tagged with: sybase
has comment: http://stackoverflow.com/comment/41914049
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41912805
has body: Hi i'm using ibatis 2 and trying to query a table with 3 types of parameters. below is the code <parameter property="jobSet" javaType="java.lang.String" jdbcType="VARCHAR"/> <parameter property="job" javaType="java.lang.String" jdbcType="VARCHAR"/> <!-- <parameter property = "currentJobStatusStrArr" javaType="java.lang.String" jdbcType="VARCHAR"/> --> <parameter property = "currentJobStatusArr" javaType="java.util.List" jdbcType="ARRAY"/> select a.JOBSET as "JOBSET", a.JOB as "JOB", a.JOB_NO as "JOB_NO", a.QUALIFIER as "QUALIFIER", b.JOB_AVG as "JOB_AVG", a.STATUS as "STATUS" from CA_JOB_STATUS a,JOB_AVG b where a.JOBSET = b.JOBSET and a.JOB=b.JOB and a.JOBSET like ? and a.JOB like ? #currentJobStatusArr[]# order by a.END_TIME desc, a.START_TIME desc It still gives me an error for input parameter not set index 2 Please help as to what is wrong in this approach.
has title: using in clause in ibatis
downvote count: 0
score: 1

http://stackoverflow.com/a/26549256
score: 1
has body: To hash a password, look at bcrypt. Now your problem with JPA/ORM is that you need two (or rather four) password fields, depending on the situation: A field with the current password A field to validate the password during login A field to store the old password when the user wants to change it (can be the same as #2) A field to store the new password while the user changes it A field to repeat the new password The usual solution for this mess is that you store the password as bytes in the database. When you need to check and change the password, you need a new object with more/different fields where the password is stored (for a short amount of time) as plain text. When you need to update the database, you hash the password and only save the result of the hash function. Or to put it another way: There is no way to add JPA/ORM mapping to a password field in such a way that you can update it with a single setPassword(String) method.
has comment: http://stackoverflow.com/comment/41723102
has comment: http://stackoverflow.com/comment/41790989
upvote count: 1
answers question: http://stackoverflow.com/q/26548771
has comment: http://stackoverflow.com/comment/41789130
type: Answer
has comment: http://stackoverflow.com/comment/41723810
has comment: http://stackoverflow.com/comment/41787501
downvote count: 0

http://stackoverflow.com/a/26581502
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26581380
has comment: http://stackoverflow.com/comment/41779491
type: Answer
score: 5
upvote count: 5
has body: Your answer looks correct to me. This trick works for generalized tree's, not only binary ones. Follow the dotted line and visit the node when you find the black dot. Reusing this graph for pre-order traversal is just a matter of rotating all the black dots 180 degrees. In-order traversal would be 90 degrees but is ambiguous if this isn't a binary tree. see http://en.wikipedia.org/wiki/Tree_traversal From http://www.brpreiss.com/books/opus4/html/page259.html postorder traversal visits the root last. To do a postorder traversal of a general tree: Do a postorder traversal each of the subtrees of the root one-by-one in the order given; and then visit the root.
answers question: http://stackoverflow.com/q/26581380
type: AcceptedAnswer

http://stackoverflow.com/comment/41725769
type: AnswerComment
score: 0
type: Comment
has text: You have to be a bit more careful than this, although I'd expect your dynamically generated code to at least share a superclass.
comment on: http://stackoverflow.com/a/26551490

caching
tags question: http://stackoverflow.com/q/26625096
tags question: http://stackoverflow.com/q/26670459
tags question: http://stackoverflow.com/q/26646985
type: Tag
tags question: http://stackoverflow.com/q/26624425
tags question: http://stackoverflow.com/q/26658426
tags question: http://stackoverflow.com/q/26622471
tags question: http://stackoverflow.com/q/26622721
tags question: http://stackoverflow.com/q/26555307
tags question: http://stackoverflow.com/q/26585817
tag name: caching
tags question: http://stackoverflow.com/q/26551068

http://stackoverflow.com/comment/41901980
has text: but in this case i have all application in tomcat on port XXXX that i set in connector?! If i want two application with http://localhost:XXXX/MyApplication/Myresource and http://localhost:YYYY/MyApplication2/Myresource ? Thanks
comment on: http://stackoverflow.com/a/26648637
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41904718
type: Comment
has text: That means the library that you are pointing to is incompatible with the current build environment.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26649833

http://stackoverflow.com/comment/41932983
score: 0
comment on: http://stackoverflow.com/a/26664042
type: AnswerComment
has text: Thanks, helped a lot and I have to calculate that way for the assignment.
type: Comment

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/26653948
type: Tag

http://stackoverflow.com/comment/41768904
score: 0
type: AnswerComment
has text: something similar to this? http://stackoverflow.com/questions/20244696/could-not-resolve-placeholder-in-string-value
type: Comment
comment on: http://stackoverflow.com/a/26575050

http://stackoverflow.com/a/26542393
upvote count: 1
has body: The real problem is that num16 is dependent on num5 and num11. That forces you to break up the otherwise uniform run between num3 and num14. (You couldn't do them all in one go anyway because that's bigger than an int. We could have played with BigInteger but oh well). Here's how I'd do it if I wasn't trying to be fancy: public String generateCardNo(int expiryDay, int expiryMonth, char firstNameInitial, char surnameInitial) { int firstNameInitialNumber = formatInitial(firstNameInitial); int surnameInitialNumber = formatInitial(surnameInitial); Random rand = new Random(); int num1 = 4 + rand.nextInt(5); int num2 = (expiryDay + expiryMonth) % 10; int num3to4 = rand.nextInt(100); // int num4 = rand.nextInt(10); int num5 = rand.nextInt(10); int num6to10 = rand.nextInt(100000); // int num7 = rand.nextInt(10); // int num8 = rand.nextInt(10); // int num9 = rand.nextInt(10); // int num10 = rand.nextInt(10); int num11 = rand.nextInt(10); int num12to14 = rand.nextInt(1000); // int num13 = rand.nextInt(10); // int num14 = rand.nextInt(10); int num15 = (firstNameInitialNumber + surnameInitialNumber) % 10; int num16 = (num1 + num5 + num11) % 10; String cardNumStr = "" + num1 + num2 + String.format("%02d", num3to4) + num5 + String.format("%05d", num6to10 + num11 + String.format("%03d", num12to14) + num15 + num16; return cardNumStr; }
accepted answer of: http://stackoverflow.com/q/26541919
answers question: http://stackoverflow.com/q/26541919
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41709085
has comment: http://stackoverflow.com/comment/41709645
type: Answer
has comment: http://stackoverflow.com/comment/41709049
has comment: http://stackoverflow.com/comment/41709589
has comment: http://stackoverflow.com/comment/41709516
has comment: http://stackoverflow.com/comment/41709770
score: 1
has comment: http://stackoverflow.com/comment/41709432
has comment: http://stackoverflow.com/comment/41747899
has comment: http://stackoverflow.com/comment/41709337

http://stackoverflow.com/comment/41771144
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26575707
has text: Hey, i changed the json array to jsonobject, except the fact that i ask for the json my using the parseInt function, do you have any idea what i could use to make it check for any value and make it return so?

http://stackoverflow.com/a/26629701
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26603614
type: Answer
has comment: http://stackoverflow.com/comment/45556523
has body: According to RedHat's "Supported Configurations" document, Java 8 isn't supported. There are some plans to add support of Java 8 to a 6.3.x or 6.4 version. (see https://developer.jboss.org/message/906154)

http://stackoverflow.com/q/26629724
has answer: http://stackoverflow.com/a/26629904
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has body: I have the following: System A - Authorization (REST API) System B - Needs to check for auth System C - Needs to check for auth System D - Needs to check for auth And I have many environment: Development Homolog Production Each one will have different URLs for System A. So I want to create a project that will integrate those systems. Since All Systems use Jersey and Spring, I can create one filter (jersey) that will abort the request in case the user is not authorized. So the idea is to create Integration System that will be a JAR with Jerseys filters and uses the parents configuration (Active profile from Spring) to get the correct URL. I might even use this JAR to make System B communicate with System D also, if I can make this work. The trick is, making this JAR get the correct .properties file based on the Enviroment (set on the parent-project). To be honest, I dont know where to begin. Reading the DOCs for Spring Environment I found: Do not use profiles if a simpler approach can get the job done. If the only thing changing between profiles is the value of properties, Spring's existing PropertyPlaceholderConfigurer / may be all you need. I could have 3 different properties files (development, homolog or production) or I could have one properties file with different keys: system.a.url.develpment=http://localhost:8080/systemA/authorize system.a.url.homolog=http://localhost:8081/systemA/authorize system.a.url.production=http://api.systemA.com/authorize What is the best approach? What would you do?
tagged with: spring-environment
tagged with: environment
score: 1
tagged with: java
has title: Spring Best approach for multiple environments
type: Question
downvote count: 0

http://stackoverflow.com/q/26655114
accepted answer: http://stackoverflow.com/a/26655315
upvote count: 1
has title: java.lang.ClassCastException with org.apache.logging.log4j.Logger
has comment: http://stackoverflow.com/comment/41913212
favorite count: 0
has answer: http://stackoverflow.com/a/26655381
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has body: I have a cast issue whose generates a java.lang.ClassCastException exception: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.message.MessageFactory; public class MyLogger extends org.apache.logging.log4j.core.Logger { MyLogger(LoggerContext context, String name, MessageFactory messageFactory) { super(context, name, messageFactory); // TODO Auto-generated constructor stub } public static MyLogger getLogger(String name) { org.apache.logging.log4j.core.Logger logger_ = (org.apache.logging.log4j.core.Logger) LogManager .getLogger(name); return (MyLogger) logger_; } } While this is the same principle as this one: public class test { private static class A { } private static class B extends A { } public static void main(String [] args) { A a = new A(); B b = new B(); a = (A) b; } } Can someone give an explaination?
possible better answer: http://stackoverflow.com/a/26655381
has answer: http://stackoverflow.com/a/26655315

http://stackoverflow.com/a/48125580
type: Answer
score: 3
downvote count: 0
has body: With the latest version of log4j2, all create the APIs like PatternLayout.createLayout, FileAppender.createAppender, LoggerConfig.createLogger have become deprecated, it's better to use a custom log ConfigurationFactory along with ConfigurationBuilder for defining the log configuration programmatically.
answers question: http://stackoverflow.com/q/26668938
upvote count: 3
has comment: http://stackoverflow.com/comment/98650059

http://stackoverflow.com/a/26650082
has body: The real question here is - how can my code divert to the invalid page when the query returns no results. You should look at this - https://stackoverflow.com/a/6813771/1355930 - which shows a better way of working with result set. Your code should read something like: if (rs.isBeforefirst()) { // do the stuff for logged in user response.sendRedirect("index.jsp"); } else { response.sendRedirect("invalid.jsp"); } My guess, though, is that the problem isn't your if statement. Try redirecting to the invalid.jsp in all cases to make sure that you can actually do that redirect.
answers question: http://stackoverflow.com/q/26649752
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26649752

http://stackoverflow.com/a/26552170
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26551894
downvote count: 0
has body: In addition to Jon's answer, what you perhaps want to do is to declare your variable to still use generics, but accept any type: Generic&lt;?&gt; generic = ...; Leaving out the type modifier completely will, as Jon explained, also disable other generics declarations not directly related to the class' type.

http://stackoverflow.com/comment/41846143
comment on: http://stackoverflow.com/q/26616529
score: 0
has text: *"The JFrame Size was not big enough. I set it to 1100, 850 now and the button is displayed proberly now as well"* Consider using `pack` over `setSize` on the `JFrame`, this will automatically determine the frame size based on the requirements of it's content
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41726591
has text: The question is copied direcly from an old exam. The question is written excacly that way and the question is "What does this code print out".
type: Comment
comment on: http://stackoverflow.com/q/26548185
score: 0
type: QuestionComment

http://stackoverflow.com/q/26600444
tagged with: css
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26601679
tagged with: java
has title: Using Jsoup to select classes and id
type: Question
tagged with: jsoup
has body: I am using this as an example http://www.shopping.com/digital-camera/products?CLT=SCH&amp;KW=digital+camera In the linke above there is a class &lt;span class="numTotalResults"&gt; Results 1 - 40 of 1500&amp;#43; &lt;/span&gt; I got it using Document query_result = Jsoup.connect("http://www.shopping.com") .data("CLT", "digital camera") .post(); but when I System.out.println(query_result.select(".numTotalResults")); System.out.println(query_result.select("#quickLookItem-1")); System.out.println(query_result.select("[name=D0]")); Nothing happens, while System.out.println(query_result); System.out.println(query_result.select("span")); clearly prints out the values The selector seems to work only with div and span and anchor, but I can' select the classes or the id Can someone help me? Thanks Edit: It seems like the post did not go through. I don't quite understand why it didn't.
accepted answer: http://stackoverflow.com/a/26601679
score: 0
answer count: 1

http://stackoverflow.com/comment/41821735
score: 0
type: AnswerComment
has text: You cannot start an Activity inside the switch case. Remove them. Use Fragments instead.
type: Comment
comment on: http://stackoverflow.com/a/26604150

http://stackoverflow.com/comment/41904404
comment on: http://stackoverflow.com/a/26650130
has text: Again, are you on laptop? Did you try to use powercfg in cmd outside of Java program or attached errorStream?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/26596185
has title: How to update a progress bar to show the progress during an activity(when a method is working)?
tagged with: progress-bar
has body: I searched for this question and I found several documentation but they are too complicated to understand for me. I just want simply to make progress bar works during an activity not after that. At the sample codes I provided, the progress bar works after the run method done, not during that. how can I change this code to progress bar is being updated when the run method is working? I think I have to create a new thread to handle the long-running method but I don't know how to do that? public class Gui extends JFrame { private JProgressBar progressBar; private JButton button; public Gui() throws HeadlessException { super("Progress bar"); setSize(500, 100); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); add(resPan()); } private JPanel resPan() { JPanel resPan = new JPanel(new FlowLayout(FlowLayout.CENTER)); resPan.setPreferredSize(new Dimension(500, 100)); progressBar = new JProgressBar(); progressBar.setPreferredSize(new Dimension(180, 40)); button = new JButton("Action"); button.setPreferredSize(new Dimension(80, 40)); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { progressBar.setIndeterminate(true); run(); } }); resPan.add(button); resPan.add(progressBar); return resPan; } private void run() { try { Thread.sleep(4000); //progressBar.setIndeterminate(false); } catch (InterruptedException e) { e.printStackTrace(); } }}
linked to: http://stackoverflow.com/q/254719
accepted answer: http://stackoverflow.com/a/26596366
has answer: http://stackoverflow.com/a/26596875
has comment: http://stackoverflow.com/comment/41807209
tagged with: java
has answer: http://stackoverflow.com/a/26596366
tagged with: swing
type: AnsweredQuestion
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/26596875
answer count: 2

http://stackoverflow.com/q/26579254
answer count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
has title: Android: NonConfigurationInstances cannot be cast
type: Question
score: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41775994
tagged with: android
has body: I'm trying to retain a Radio (class I've made) array on onRetainCustomNonConfigurationInstance method, but then when I try to get it back with a cast to getLastNonConfigurationInstance, I'm having this error: java.lang.ClassCastException: android.support.v4.app.FragmentActivity$NonConfigurationInstances cannot be cast to me.android....lib.Radio[] Here is my code: public void loadFeed() { @SuppressWarnings("deprecation") final Object data = getLastNonConfigurationInstance(); // the activity is starting for the first time // read the json response and populate the radio stream list if(data == null) { //test Toast.makeText(getApplicationContext(), "1", Toast.LENGTH_SHORT).show(); populateListFromJson(); } else { //test Toast.makeText(getApplicationContext(), "2", Toast.LENGTH_SHORT).show(); // The activity was destroyed/created automatically, populate the radio stream // list with the info load by the previous activity final Radio[] radios = (Radio[]) data; for(Radio radio : radios) { radiosList.add(radio); } adapter.notifyDataSetChanged(); } } @Override public Object onRetainCustomNonConfigurationInstance() { // TODO Auto-generated method stub return radios; } Can somebody help me?
has comment: http://stackoverflow.com/comment/48940564

http://stackoverflow.com/q/26558099
tagged with: java
tagged with: lwjgl
type: Question
tagged with: fullscreen
upvote count: 3
has body: Hi this is my first post. I've been using LWJGL for a while and I'm working on a game that happens to have a full screen button. When it is clicked the game goes into full screen but the textures don't bind it's just a white screen. Here is the code for the full screen transition code which I suspect is where the problem is: package lifeLine.game; import static org.lwjgl.opengl.GL11.*; import java.util.logging.Level; import java.util.logging.Logger; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; public class FullscreenManager { boolean fsState; GameLoop gameLoop; public FullscreenManager(GameLoop gl, boolean defaultState) { gameLoop = gl; fsState = defaultState; Display.destroy(); try { Display.setFullscreen(fsState); Display.setDisplayMode(new DisplayMode(gameLoop.WIDTH, gameLoop.HEIGHT)); Display.setTitle("Life Line: 1.0"); Display.create(); } catch (LWJGLException e){ e.printStackTrace(); } initGL(); } public void toggleFullscreen() { Display.destroy(); try { Display.setDisplayMode(new DisplayMode(gameLoop.WIDTH,gameLoop.HEIGHT)); Display.setFullscreen(!fsState); Display.create(); Display.setVSyncEnabled(true); fsState = !fsState; } catch (LWJGLException e){ Logger.getLogger(GameLoop.class.getName()).log(Level.SEVERE, null, e); } initGL(); } public void setFullscreen(boolean state) { try { Display.destroy(); if (!state) { Display.setDisplayMode(new DisplayMode(gameLoop.WIDTH, gameLoop.HEIGHT)); } fsState = state; Display.setFullscreen(state); Display.create(); Display.setVSyncEnabled(true); } catch (LWJGLException e){ Logger.getLogger(GameLoop.class.getName()).log(Level.SEVERE, null, e); } initGL(); } private void initGL() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, gameLoop.WIDTH, 0, gameLoop.HEIGHT, -1, 1); glMatrixMode(GL_MODELVIEW); glClearColor(0, 0, 0, 1); glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } } This c…
has title: LWJGL when full screen toggles textures don't show
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: textures
score: 3
downvote count: 0

http://stackoverflow.com/comment/41763449
has text: @GregPenrose Nope. Initially pi == 3.0 and oldPi == 0.0. Then you assign 3.0 to oldPi, but change pi before testing the condition again.
comment on: http://stackoverflow.com/a/26572598
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26568789
has title: ArrayList.contains() vs HashMap.containsKey() vs HashMap.get()
type: Question
accepted answer: http://stackoverflow.com/a/26568802
tagged with: hashmap
has body: Does ArrayList.contains() have to iterate over all items to do its check? Does HashMap.containsKey()? I know HashMap.get() doesn't need to, but is that why it is the most efficient?
linked to: http://stackoverflow.com/q/19347816
tagged with: arraylist
answer count: 1
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/26568802
score: 6
type: AnsweredQuestion
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/18004064

http://stackoverflow.com/q/26597568
has answer: http://stackoverflow.com/a/28698787
downvote count: 0
has comment: http://stackoverflow.com/comment/41809572
has comment: http://stackoverflow.com/comment/41814166
answer count: 1
favorite count: 0
has title: How to access to label folder in gmail using java?
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41814382
has body: We can read messages from gmail inbox but can we read from a label? If I take the following example from http://harikrishnan83.wordpress.com/2009/01/24/access-gmail-with-imap-using-java-mail-api/ import java.util.Properties; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Store; public class InboxReader { public static void main(String args[]) { Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.gmail.com", "&lt;username&gt;", "password"); System.out.println(store); Folder inbox = store.getFolder("Inbox"); inbox.open(Folder.READ_ONLY); Message messages[] = inbox.getMessages(); for(Message message:messages) { System.out.println(message); } } catch (NoSuchProviderException e) { e.printStackTrace(); System.exit(1); } catch (MessagingException e) { e.printStackTrace(); System.exit(2); } } } If I change "inbox" by a label name it's throwing an error: inbox is not found. Any help, please?
tagged with: java
type: Question
score: 2

http://stackoverflow.com/comment/41665442
type: AnswerComment
has text: I posted updated code, still not compiling. Any help would be appreciated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26517279

http://stackoverflow.com/comment/41766785
has text: Thank you for your response, I have only one problem - the second 'join' causes the 'Invalid syntax' error. Is it only my problem or is it some mistake in this code? I must admit, that I don't see any :D
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26574360
type: Comment

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/26542814

http://stackoverflow.com/comment/41859071
type: QuestionComment
has text: Can you provide your code snippet
comment on: http://stackoverflow.com/q/26624740
score: 0
type: Comment

http://stackoverflow.com/comment/41888743
score: 0
comment on: http://stackoverflow.com/q/26640192
type: QuestionComment
type: Comment
has text: you are getting hString as null because when request is coming to updateNewPassword() it's a new request and it's not having hString as request parameter.

http://stackoverflow.com/q/26585220
tagged with: initialization
favorite count: 0
linked to: http://stackoverflow.com/q/2430655
possible better answer: http://stackoverflow.com/a/26585258
has answer: http://stackoverflow.com/a/26585265
tagged with: memory-management
has body: In Java, does it cost memory to declare a class level instance variable without initializing it? For example: Does int i; use any memory if I don't initialize it with i = 5;? Details: I have a huge super-class that many different (not different enough to have their own super classes) sub-classes extend. Some sub-classes don't use every single primitive declared by the super-class. Can I simply keep such primitives as uninitialized and only initialize them in necessary sub-classes to save memory?
has title: Do uninitialized primitive instance variables use memory?
has comment: http://stackoverflow.com/comment/41787227
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41819720
has comment: http://stackoverflow.com/comment/41788671
tagged with: java
accepted answer: http://stackoverflow.com/a/26585250
downvote count: 3
tagged with: primitive
has comment: http://stackoverflow.com/comment/41819762
type: Question
has comment: http://stackoverflow.com/comment/41810689
upvote count: 46
has comment: http://stackoverflow.com/comment/41807391
linked to: http://stackoverflow.com/q/49002
answer count: 6
has comment: http://stackoverflow.com/comment/41815522
score: 43
has answer: http://stackoverflow.com/a/26585945
has comment: http://stackoverflow.com/comment/41824494
has comment: http://stackoverflow.com/comment/41824022
has answer: http://stackoverflow.com/a/26585258
linked to: http://stackoverflow.com/q/26632799
has answer: http://stackoverflow.com/a/26609142
has answer: http://stackoverflow.com/a/26585341
has answer: http://stackoverflow.com/a/26585250

http://stackoverflow.com/comment/41694920
comment on: http://stackoverflow.com/q/26534400
score: 0
has text: @ElliottFrisch tomcat 7
type: Comment
type: QuestionComment

geotools
type: Tag
tags question: http://stackoverflow.com/q/26524781
tag name: geotools

http://stackoverflow.com/a/26564884
has comment: http://stackoverflow.com/comment/41755207
has comment: http://stackoverflow.com/comment/41760239
answers question: http://stackoverflow.com/q/26564654
type: Answer
has comment: http://stackoverflow.com/comment/41752470
has body: There are errors in your program.First of all,it's better to use nextInt() method rather than nextLine() and then parseInt(String).It's going to save 2 lines of code.And about your problem.... Now,in case of a deposit,the deposit amount is added to the initial balance.So,it is going to be balance+=CurBal.The same applies to withdrawal.This total balance is not "CurBal" here, it is the balance after deposit or withdrawal.And one more thing,you wish to perform deposit or withdrawal operations.I do not think there is any need of the variable "CurBal" here.So,it is going to be like this:- int deposit=keyboard.nextInt(); balance+=deposit; TotalBal=balance; And for the withdrawal:- int withdrawal=keyboard.nextInt(); balance-=withdrawal; TotalBal=balance; I think it's better to use this.So,give it a try.
has comment: http://stackoverflow.com/comment/41752912
has comment: http://stackoverflow.com/comment/41750814
score: 0

http://stackoverflow.com/comment/41847459
score: 0
comment on: http://stackoverflow.com/a/26615998
type: AnswerComment
type: Comment
has text: I ended up implementing the notion of putting the db in a "known state" before each test i.e. in my case delete data from all tables. I looked into DBUnit but found no notion of deleting all the data from *all* tables. I ended up using Jdbc directly to [delete all the data from my Oracle db](http://stackoverflow.com/a/11030009/614800)

http://stackoverflow.com/a/26619123
answers question: http://stackoverflow.com/q/26618961
has comment: http://stackoverflow.com/comment/41849288
has comment: http://stackoverflow.com/comment/41886561
has comment: http://stackoverflow.com/comment/41886275
has comment: http://stackoverflow.com/comment/41886599
has comment: http://stackoverflow.com/comment/41887191
has comment: http://stackoverflow.com/comment/41849809
has comment: http://stackoverflow.com/comment/41887313
has comment: http://stackoverflow.com/comment/41885763
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41849231
has comment: http://stackoverflow.com/comment/41887622
has comment: http://stackoverflow.com/comment/41886046
has comment: http://stackoverflow.com/comment/41849214
has comment: http://stackoverflow.com/comment/41849785
has body: A few things: When you create a function you must return a value of that type always, you declared your method to return int so you must return an int, always (or you will get a compiler error). Also, you can declare variables inside your method, there's no need to pass all of them from your main. Don't forget to call your function in your main, otherwise it is not being used. This would be the code public class Part3 { public static void main (String args []) { Scanner sc = new Scanner(System.in); int number; int factor=1; System.out.println("Enter a number to find the factorial of it: "); number= sc.nextInt(); factor=factorial(number); System.out.println("The factorial of "+number+" is = " +factor); } public static int factorial (int number) { int result = 1; if (number &lt; 1 || number &gt; 10) System.out.println("Invalid!! the number has to be between 1 and 10"); else { for(int x=1; x&lt;=number; x++ ) { result= result*x; } } return result; } }
type: Answer
has comment: http://stackoverflow.com/comment/41887346
accepted answer of: http://stackoverflow.com/q/26618961
score: 1
upvote count: 1

http://stackoverflow.com/comment/41714857
score: 2
has text: Don't use `equals` for null-checking! Use `==`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26545910

http://stackoverflow.com/q/26514780
upvote count: 11
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26514820
has body: I am not iterating the LinkedList by any means like scanner or other methods, I am using Collections.max() to get maximum number from the LinkedList. I have read on Stack Overflow that this exception is thrown due to iterator or scanner or tokenizer, but I am using none of them. import java.io.*; import java.util.*; class TLG { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); LinkedList&lt;Integer&gt; first = new LinkedList&lt;Integer&gt;(); LinkedList&lt;Integer&gt; second = new LinkedList&lt;Integer&gt;(); int cases = Integer.parseInt(br.readLine()); for(int i=1;i&lt;=cases;i++) { String score = br.readLine(); int number1 = Integer.parseInt(score.split(" ")[0]); int number2 = Integer.parseInt(score.split(" ")[1]); int diff = number1 - number2; if(diff &gt; 0){ first.add(diff); } else { second.add(java.lang.Math.abs(diff)); } } Integer max1 = Collections.max(first); // Getting Exception here Integer max2 = Collections.max(second); // Getting Exception here if(max1 &gt; max2) { System.out.println(1+" "+max1); } else { System.out.println(2+" "+max2); } } }
tagged with: collections
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41659623
possible better answer: http://stackoverflow.com/a/26515040
tagged with: nosuchelementexception
has answer: http://stackoverflow.com/a/26515013
has answer: http://stackoverflow.com/a/26515040
tagged with: java
score: 10
has title: LinkedList : Collections.max() throwing NoSuchElementException
answer count: 3
has comment: http://stackoverflow.com/comment/41659500
has comment: http://stackoverflow.com/comment/41659663
favorite count: 0
has answer: http://stackoverflow.com/a/26514820
has comment: http://stackoverflow.com/comment/41659444

http://stackoverflow.com/q/26579911
type: Question
has title: Chunking input string into number of characters per line java programming
tagged with: string
score: 0
answer count: 1
has body: I am trying to write a java code that takes as input a string and a chunk size, and it chops the string into chunks of the given size. Note that the last chunk may be smaller than the size requested. Heres an example of what the output would look like: String? abcdefghijklmnopqrstuvwxyz Chunk size? 4 abcd efgh ijkl mnop qrst uvwx yz I cannot figure this out, I have been working on it for quite some times, so here I am. This is the code that I have right now, but a lot has been moved around just to try: package Oct_27_2014; import java.util.Scanner; public class ChunkingAPhrase { public static void main(String[] args) { // declare variables int chunkNumber; String phrase; int start = 0; // get input Scanner scan = new Scanner(System.in); System.out.print("String? "); phrase = scan.nextLine(); System.out.print("Chunk size? "); chunkNumber = scan.nextInt(); // parse string while(start &lt; phrase.length()) { String chunks = phrase.substring(start, chunkNumber); start++; if (phrase.indexOf(chunkNumber) != start) { System.out.println(chunks); System.out.println(); }else{ } } } } This is the output I get for this code: String? abcdefg12345 Chunk size? 3 abc Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 bc c at java.lang.String.substring(Unknown Source) at Oct_27_2014.ChunkingAPhrase.main(ChunkingAPhrase.java:24)
type: UnansweredQuestion
tagged with: input
has answer: http://stackoverflow.com/a/26580399
tagged with: java

http://stackoverflow.com/comment/41716386
comment on: http://stackoverflow.com/a/26546734
has text: That is not at all Javascript map. It's Javascript object.
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/26639408
answer count: 1
type: UnansweredQuestion
tagged with: forms
tagged with: post
tagged with: jsoup
has answer: http://stackoverflow.com/a/26843742
type: Question
has body: I'm trying to use Jsoup to login to a website and then scrape the contents. I've already read a few similar questions, and figured that I need to do a POST and pass all the input parameters. I've done just that, but it still doesn't work for some reason. Any help greatly appreciated. HTML form: &lt;form method="post" action="https://login.yahoo.com/config/login?" name="login_form" id="login_form" onsubmit="return hash2(this)"&gt; &lt;input type="hidden" name="sessionId" id="sessionId" value="IyLZEAs5n9RP"&gt; &lt;input type="hidden" name=".tries" value="1"&gt; &lt;input type="hidden" name=".src" value="spt"&gt; &lt;input type="hidden" name=".md5" value=""&gt; &lt;input type="hidden" name=".hash" value=""&gt; &lt;input type="hidden" name=".js" value=""&gt; &lt;input type="hidden" name=".last" value=""&gt; &lt;input type="hidden" name="promo" value=""&gt; &lt;input type="hidden" name=".intl" value="us"&gt; &lt;input type="hidden" name=".lang" value="en-US"&gt; &lt;input type="hidden" name=".bypass" value=""&gt; &lt;input type="hidden" name=".partner" value=""&gt; &lt;input type="hidden" name=".u" value="516l00ha52emg"&gt; &lt;input type="hidden" name=".v" value="0"&gt; &lt;input type="hidden" name=".challenge" value="HupRQ9x1ptIRHP1H8P9eYBbAlofE4YsoSQ--"&gt; &lt;input type="hidden" name=".yplus" value=""&gt; &lt;input type="hidden" name=".emailCode" value=""&gt; &lt;input type="hidden" name="pkg" value=""&gt; &lt;input type="hidden" name="stepid" value=""&gt; &lt;input type="hidden" name=".ev" value=""&gt; &lt;input type="hidden" name="hasMsgr" value="0"&gt; &lt;input type="hidden" name=".chkP" value="Y"&gt; &lt;input type="hidden" name=".done" value="http://hockey.fantasysports.yahoo.com/hockey/27381/startingrosters?.scrumb=0"&gt; &lt;input type="hidden" name=".pd" value="spt_ver=0&amp;c=&amp;ivt=&amp;sg="&gt; &lt;input type="hidden" name=".ws" id=".ws" value="0"&gt; &lt;input type="hidden" name=".cp" id=".cp" value="0"&gt; &lt;input type="hidden" name="nr" value="0"…
score: 0
tagged with: java
tagged with: authentication
has title: Using JSoup to login before scraping a website

http://stackoverflow.com/q/26541669
has answer: http://stackoverflow.com/a/26552611
score: 1
tagged with: java
has title: How to read the data from standard output in jatcl by running tcl script in java
type: Question
has body: I have two questions basically. I am using JACL interpreter to run TCL script in JAVA. My questions are: How to get the data from standard output after running tcl file? How to pass arguments for tcl script when executing using jatcl? E.G: sample.tcl: `puts "Hi this is from tcl" ` When ran using java as follows: `Interp i = new Interp(); i.eval("source sample.tcl");` then the output will be written to stdout console of JAVA. I want to read that output to some variable like x[] = i.eval("sample.tcl") then x should contain Hi this is from tcl. How to pass some parameter to sample.tcl
answer count: 1
downvote count: 0
tagged with: tcl
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jacl

http://stackoverflow.com/q/26576204
tagged with: android
accepted answer: http://stackoverflow.com/a/26576238
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41770044
upvote count: 2
has title: app crashing when ever i entering negitive value
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26576238
type: Question
downvote count: 0
has body: I am working on a requirement, where i have two text fields when i enter a Celsius value in first text field automatically it converts into Fahrenheit The problem i'm facing is when ever i entering a negative value app is crashing Here is my code My XML file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="20dp" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Celsius" /&gt; &lt;EditText android:id="@+id/myTextBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberSigned" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Forenheight" /&gt; &lt;EditText android:id="@+id/outputBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberSigned" /&gt; &lt;TextView android:id="@+id/tv_in_for" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Forenheit" /&gt; &lt;EditText android:id="@+id/et_in_for" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberSigned" /&gt; &lt;TextView android:id="@+id/tv_out_cel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Celsius" /&gt; &lt;EditText android:id="@+id/et_out_cel" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberSigned" /&gt; &lt;/LinearLayout&gt; This is my java code @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.type2); final EditText outputTextBox = (EditText) findViewById(R.id.outputBox); final EditText my…
has comment: http://stackoverflow.com/comment/41770041

http://stackoverflow.com/comment/41948393
score: 0
has text: @Abhinav i´ve put my applicationContext.xml on my question too.
comment on: http://stackoverflow.com/q/26660708
type: Comment
type: QuestionComment

http://stackoverflow.com/a/31372941
type: Answer
upvote count: 19
answers question: http://stackoverflow.com/q/26521836
score: 19
has comment: http://stackoverflow.com/comment/60708974
has comment: http://stackoverflow.com/comment/53476791
has body: First off all, be sure there's a "libs" subfolder in the "app" folder of your project. If there's not, create one. Next, in the app/build.gradle file, add this line of code: dependencies { ... compile fileTree(dir:'libs', include: ['*.jar']) ... } Place all of your .jar files in the "libs" folder, and voila, you're done
has comment: http://stackoverflow.com/comment/62861636
downvote count: 0

http://stackoverflow.com/q/26647667
has body: I have the following syntax in SQL. select Count(*) from queue_in_progress where CATEGORY_PK = 100001 AND SERVICE_STATUS = 0 AND SERVICE_CENTER_PK = 100001 AND SERVICE_COUNTER = 100001 ; After this I got the following scenario . But in my Java file I have the following code. String sql="select Count(*) from queue_in_progress where CATEGORY_PK = "+ ctgry_pk + "AND SERVICE_STATUS = 0 AND SERVICE_CENTER_PK = "+service_center+ " AND SERVICE_COUNTER = "+service_counter+" ;"; rs = getSeletRS(sql); int count = rs.getInt(1); Here I have got the following exception. Exception in thread "main" java.lang.NullPointerException at dbquery.SQLQuery.get_TOKEN_Pk(SQLQuery.java:160) at dbquery.SQLQuery.clickNextButton(SQLQuery.java:131) at dbquery.SQLQuery.main(SQLQuery.java:388) I cannot understand why I got this error.
has comment: http://stackoverflow.com/comment/42007616
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/26648334
has comment: http://stackoverflow.com/comment/41900270
type: Question
has comment: http://stackoverflow.com/comment/41900874
tagged with: java
accepted answer: http://stackoverflow.com/a/26648334
has comment: http://stackoverflow.com/comment/41900143
tagged with: sql
answer count: 1
has title: rs.getInt(1) not working properly

http://stackoverflow.com/a/26634487
has comment: http://stackoverflow.com/comment/121041530
score: 22
type: Answer
has comment: http://stackoverflow.com/comment/75025523
upvote count: 22
accepted answer of: http://stackoverflow.com/q/26634000
answers question: http://stackoverflow.com/q/26634000
downvote count: 0
has body: By default, Java source files need to go into src/main/java (or src/test/java for test sources). Either adapt your directory structure accordingly, or reconfigure the source directory as follows: sourceSets { main { java { srcDirs = ["src"] } } }
type: AcceptedAnswer

http://stackoverflow.com/q/26603061
type: Question
tagged with: opengl-es-2.0
has title: Feed Shader Program with World Units instead of (0f,1f) values
upvote count: 1
accepted answer: http://stackoverflow.com/a/26608724
has body: I'm rendering a simple rectangle mesh using libgdx, and other geometric elements that are similar in simplicity. Therse are going to interact with the sprites I have setup in my game. The sprites' position and other properties are setup in world units and before each sprite draw session I setup the camera like this: camera.update(); batch.setProjectionMatrix(camera.combined); It all works well but I need to draw meshes using world units. How can I feed the shader program world coordinates(12.5f, 30f, etc, based on my game world data) instead of (0f, 1f) ranges? I want to draw several textured meshes so I need coordinates that are in relation with the other elements in the game. Here is how I draw a simple rectangle mesh : mesh = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, "a_position"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords")); mesh.setVertices(new float[] { -1.0f, -1.0f, 0, 0,1, 0.0f, -1.0f, 0,1,1, 0.0f, 0.0f, 0, 1,0, -1.0f, 0.0f, 0, 0,0 }); mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0}); Gdx.graphics.getGL20().glEnable(GL20.GL_TEXTURE_2D); Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE); createShader(); shader.begin(); mesh.render(shader, GL20.GL_TRIANGLES); shader.end(); Is there any way I can feed world units to the mesh vertices array ?
tagged with: libgdx
tagged with: java
type: AnsweredQuestion
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26608724

http://stackoverflow.com/comment/41701230
score: 0
has text: May I assume you read the data in from a file or any other stream ? Then it might be more appropriate to directly read them in a loop and inset them via a **prepared SQL** statement. Depending on how well the RDBMS supports prepared statements it should boost the whole thing significantly.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26537665

http://stackoverflow.com/comment/41881276
type: AnswerComment
comment on: http://stackoverflow.com/a/26630652
type: Comment
score: 0
has text: ya modified but not working sir.Is parameter added in android code is correct? Image and audio storing ? But cannot get parameter.

http://stackoverflow.com/comment/41850007
score: 0
type: Comment
type: QuestionComment
has text: Your assignment was probably set by someone who isn't very good at programming. IMHO you should use a `for` loop, not a `while` loop - because you have an iterative aspect (re-asking if the user enters invalid response). Also, the assignment should not dictate an implementation - chosing one is part of learning.
comment on: http://stackoverflow.com/q/26619146

http://stackoverflow.com/comment/41866361
type: Comment
type: QuestionComment
score: 1
has text: Re-entrant (recursive) mutex? In this case mutex can be acquired multimple times from the same thread but will (dead)lock from multiple threads
comment on: http://stackoverflow.com/q/26628789

http://stackoverflow.com/a/26520250
score: 0
answers question: http://stackoverflow.com/q/26518996
has body: Have you tried adding this to your web.xml? com.sun.jersey.api.json.POJOMappingFeature true I believe this tutorial shows what you are trying yo do http://examples.javacodegeeks.com/enterprise-java/rest/jersey/json-example-with-jersey-jackson/ Another one from mkyong http://www.mkyong.com/webservices/jax-rs/json-example-with-jersey-jackson/
type: Answer
has comment: http://stackoverflow.com/comment/41675251

http://stackoverflow.com/comment/41852523
type: QuestionComment
has text: Your code seems find(except it should print `,Mini,LandRover`. Mind posting a full compilable example?
score: 1
comment on: http://stackoverflow.com/q/26620891
type: Comment

http://stackoverflow.com/a/26644637
downvote count: 0
has body: FileNotFoundException == The file... wasn't found. Error 404. It's just not there. In this case, you didn't specify a file, you specified a webpage - it doesn't work like that, you need to use network-related classes to download the page before you can interact with it. the File class is purely for files on your harddrive (or connected USBs / disks / etc). Check out How to read a text from a web page with Java? for help reading webpages. (The question itself has what you're looking for, the answers are more advanced interaction.)
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26644603

http://stackoverflow.com/comment/41769126
type: AnswerComment
comment on: http://stackoverflow.com/a/26575715
type: Comment
has text: So you dont have driver in your classpath. Make sure you have mysql driver in your classpath. See this about driver url http://www.vogella.com/tutorials/MySQLJava/article.html#jdbcdriver and steps you need to follow
score: 0

http://stackoverflow.com/comment/41720916
has text: What is your comment about? I know how to set Java Console visible. My question is about how to replace standard Java `AWT/Swing` console with new `JavaFX` one.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26545561

http://stackoverflow.com/a/26539223
has body: Your approach is incorrect: when you pick middle letters at random, it is impossible to guarantee that all letters from the middle of the word would be printed (and as a consequence, that other letters would not be repeated). There are several ways of fixing this: Each time you generate a random index, mark that index in an array of booleans. The length of the array is equal to the length of the word. Check the array before using each new index that you generate; if the index is marked, continue generating new random indexes until you hit an empty one. Create an array of integer indexes of letters inside the word (i.e. 1 through length-1, inclusive). Do a random shuffle on the array, and use the shuffled indexes to pick middle letters. Similar to 2, except you put all middle letters in an array, and shuffle it.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26539083
upvote count: 1

http://stackoverflow.com/a/26666114
type: Answer
upvote count: 3
has body: It is definitely not safe to convert a BigInteger to an int, as you would be vulnerable to overflow. In order to get around this, you would have to put in a condition, that makes sure that you will not convert BigIntegers outside the ints range, which is: Integer.MAX_VALUE = 2147483647 Integer.MIN_VALUE = -2147483648 You could consider if long is sufficient for you use though. It has significantly wider bounds: Long.MAX_VALUE = 9223372036854775807 Long.MIN_VALUE = -9223372036854775808
answers question: http://stackoverflow.com/q/26666053
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26666053

http://stackoverflow.com/a/26565151
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26565105
has comment: http://stackoverflow.com/comment/41749794
answers question: http://stackoverflow.com/q/26565105
upvote count: 2
has comment: http://stackoverflow.com/comment/41749695
has comment: http://stackoverflow.com/comment/41749842
has body: Iterate over two arrays and on each step make new string combination. After all just print combinations in some way. List&lt;String[]&gt; input = ...; Set&lt;String&gt; allCombinations = new HashSet&lt;&gt;(); for (int i = 0; i &lt; input.size() - 1; i++) { for (int j = i + 1; j &lt; input.size(); j++) { allCombinations.addAll(twoArraysCombinations(input.get(i), input.get(j))); } } // print allCombinations private static Set&lt;String&gt; twoArraysCombinations(String[] first, String[] second) { Set&lt;String&gt; result = new HashSet&lt;&gt;(); for (String f : first) { for (String s : second) { result.add(f + s); } } return result; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41749998
type: Answer
has comment: http://stackoverflow.com/comment/41750033
score: 2
has comment: http://stackoverflow.com/comment/41749826

http://stackoverflow.com/comment/41713333
comment on: http://stackoverflow.com/q/26544946
type: Comment
has text: Why not define another class which drives from the base class and override in it?
score: 0
type: QuestionComment

http://stackoverflow.com/q/26605599
has body: I'm using Spring-data-jpa with CrudRepository to persist data in a postgres db. On a daily basis I want to renew the full db content, which means detele all data in a specific table first. The repository offers a method dao.deleteAll(), but that lasts very long as I have about 500k entries. How can I improve this?
favorite count: 0
answer count: 2
has answer: http://stackoverflow.com/a/26605834
tagged with: spring
accepted answer: http://stackoverflow.com/a/26926938
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/26605834
has title: How to quickly drop a database table content using Spring?
tagged with: jpa
downvote count: 0
linked to: http://stackoverflow.com/q/1262723
has answer: http://stackoverflow.com/a/26926938
tagged with: postgresql
tagged with: spring-data-jpa
type: Question
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/41755355
score: 0
type: AnswerComment
has text: One thing you dont recognize. There is a different between layout_gravity and gravity. Use gravity to set gravity in parent view to set gravity of its child layouts. And layout_gravity to set gravity to the layout itself.
comment on: http://stackoverflow.com/a/26568070
type: Comment

http://stackoverflow.com/comment/41759769
type: QuestionComment
has text: cuz **you cannot predict the future** I guess
comment on: http://stackoverflow.com/q/26570682
score: 0
type: Comment

http://stackoverflow.com/comment/41914049
comment on: http://stackoverflow.com/q/26654462
score: 0
type: Comment
has text: no no... the query works fine, if i remove the list parameter. and for those parameter its just a select and i'm not sending any inputs for those.
type: QuestionComment

http://stackoverflow.com/comment/41702192
score: 0
type: Comment
type: QuestionComment
has text: @ower best thing is for me to convert my comment into an answer.
comment on: http://stackoverflow.com/q/26537894

http://stackoverflow.com/comment/41795657
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26590204
has text: As i am a novice couldn't get much about it.Can you please explain me in detail

http://stackoverflow.com/comment/41850615
comment on: http://stackoverflow.com/q/26619560
has text: @alterfox:Thanks for pointing.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26650617
has answer: http://stackoverflow.com/a/26651938
type: Question
has body: I got an activity showing as a dialog using android:theme="@android:style/Theme.Holo.Dialog" in the manifest file How can I change the colors of the text and background in the dialog/activity
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26650788
type: UnansweredQuestion
tagged with: android-xml
tagged with: android-dialog
tagged with: android
tagged with: android-manifest
has title: How can I alter colors on Theme.Holo.Dialog?
tagged with: java

http://stackoverflow.com/q/26639304
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/28418400
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/29931256
answer count: 2
accepted answer: http://stackoverflow.com/a/29931256
upvote count: 1
downvote count: 0
favorite count: 0
has title: Why does Joda Time report a wrong offset for a timezone, while the Android Java Api returns the correct one?
tagged with: android
has answer: http://stackoverflow.com/a/28418400
has comment: http://stackoverflow.com/comment/41887779
has comment: http://stackoverflow.com/comment/41888068
has comment: http://stackoverflow.com/comment/41885876
has comment: http://stackoverflow.com/comment/41885768
has comment: http://stackoverflow.com/comment/41885709
has comment: http://stackoverflow.com/comment/41886977
has body: I included Joda Time into my Android project to be able to use updated timezone information. Unfortunately, I got a report from a user in Bangladesh that the timezone offset is calculated incorrectly. Testing it on the emulator, I too am getting incorrect offsets. After running an Android emulator using the flag -timezone Asia/Dhaka I see this in my app: Reported TimeZone offset using normal Java API TimeZone zone = TimeZone.getDefault(); String zoneName = zone.getDisplayName(daylight, TimeZone.SHORT); int millisOffset = zone.getOffset(System.currentTimeMillis()); =&gt; Asia/Dhaka, Offset +6 hours Reported using the Joda Time Library DateTime today = new DateTime(); String name = today.getZone(); int millisOffset = today.getZone().getOffset(today.getMillis()); =&gt; Asia/Dhaka, Offset +7 hours Is there something I'm missing?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41886689

http://stackoverflow.com/a/26637957
answers question: http://stackoverflow.com/q/26637740
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41883889
has comment: http://stackoverflow.com/comment/41889472
has comment: http://stackoverflow.com/comment/41887026
type: Answer
has body: In your fragments try putting this: tools:layout="@layout/my_fragment_view" where my_fragment_view is the layout you want to be loaded into the fragment. This is for the viewer only. I think the graphical view is giving you a tip so it can render more smoothly. tools attribute is for editor only. does not work at run time. &lt;fragment android:name="xetron.cosmicclicker.MyActivity$AdFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:layout="@layout/my_fragment_view" android:layout_above="@+id/adFragment" /&gt;
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26637740
has comment: http://stackoverflow.com/comment/41883199
score: 1
has comment: http://stackoverflow.com/comment/41883460

http://stackoverflow.com/q/26593451
has body: Why am I getting NullPointerException here package Threads; public class Test implements Runnable { FF d; public static void main(String[] args) { new Test().go(); } void go() { System.out.println(Thread.currentThread()); d = new FF(); new Thread(new Test()).start(); new Thread(new Test()).start(); } public void run() { System.out.println(d); System.out.println(Thread.currentThread()); d.chat(Thread.currentThread().getId());//RTE } } class FF { static long flag = 0; void chat(long id) { if(flag == 0) { flag = id; } for(int x=1;x&lt;3;x++) { if(flag == id) { System.out.println("Yo"); }else { System.out.println("dude"); } } } } //can anybody explain why I am getting NullPointerException here.I though d reference variable was intialized in go() method but I think it has something to do when new Thread is created.
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26593515
possible better answer: http://stackoverflow.com/a/26593501
has answer: http://stackoverflow.com/a/26593501
has comment: http://stackoverflow.com/comment/41801694
accepted answer: http://stackoverflow.com/a/26593515
has comment: http://stackoverflow.com/comment/41803824
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: NullPointerException in Threads

http://stackoverflow.com/comment/41731594
score: 1
type: AnswerComment
type: Comment
has text: Get is also a blocking call, which would block the EDT, defeating the purpose of using the SwingWorkers in the first place
comment on: http://stackoverflow.com/a/26554580

http://stackoverflow.com/comment/41776281
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26579506
has text: Shorthand, possibly, or legacy compatibility.

layout
tags question: http://stackoverflow.com/q/26628583
tags question: http://stackoverflow.com/q/26571244
tags question: http://stackoverflow.com/q/26516327
tag name: layout
tags question: http://stackoverflow.com/q/26632094
type: Tag
tags question: http://stackoverflow.com/q/26573473

http://stackoverflow.com/a/26649632
downvote count: 1
has comment: http://stackoverflow.com/comment/41903715
has comment: http://stackoverflow.com/comment/41903620
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26649540
has body: try replace this lines String temp=sName.replace(" ","%20"); URL js = new URL("http://192.11.my api.php"+temp); with String temp=URLEncoder.encode("http://192.11.my api.php/"+sName, "UTF-8"); URL js = new URL(temp);
type: Answer
has comment: http://stackoverflow.com/comment/41904172
has comment: http://stackoverflow.com/comment/41904266
has comment: http://stackoverflow.com/comment/41904015
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/26649540

http://stackoverflow.com/comment/41698042
has text: Your operating system has a language. And the Java Runtime will simply use that bit of information. Run your software e.g. from an english Ubuntu Live CD and it will accept `3.5`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26535932
type: Comment

http://stackoverflow.com/a/27468807
has body: I just found out the issue with it. The thread was ending before Firebase could call the onComplete function. You can just call a Thread.sleep(x_ms) within a loop after the last line of code in the application.
has comment: http://stackoverflow.com/comment/62208861
score: 4
answers question: http://stackoverflow.com/q/26671214
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26671214
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26530445
tagged with: file
has title: compare directories to check if one is sub-directory of another
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41687369
tagged with: java
tagged with: comparison
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26533063
tagged with: directory
tagged with: arraylist
has body: I have an arraylist of directories in the root of the class, ArrayList&lt;File&gt; sources, and a method addNewSource to add new directories in the list. private void addNewSource(File src){ sources.add(src); } Now I need to add a new method to check if the new source is a sub-directory of existing directories in the list. Lets assume the arraylist have following directories: ["D:\", "E:\", "F:\"] Now I am going to add two new directories, one "G:\" and another "D:\Folder\". The new method should return false for the first and true for second one. Simple Solution I Found: Go to the parent directory and check if it exist in the list until we reach the root directory. It get my work done but takes a lot of time when working with big list (1000 directories) and the new directory is inside 1500 parent directories. Do you have or know any better and optimized solution for this problem that won't take long processing time. please no external library.
accepted answer: http://stackoverflow.com/a/26533063

http://stackoverflow.com/a/26531917
answers question: http://stackoverflow.com/q/26531500
has comment: http://stackoverflow.com/comment/41693352
has comment: http://stackoverflow.com/comment/41693640
has body: Finally your code should be this: HttpSession session = req.getSession(true); for (int i = 0; i &lt; goods.length; i++) { if (session.getAttribute(goods[i]) == null) session.setAttribute(goods[i], new Integer(0)); } if ((s = req.getParameter("fifa")) != null) { int n = ((Integer) session.getAttribute(goods[0])).intValue(); session.setAttribute(goods[0], new Integer(n + 1)); } else if ((s = req.getParameter("battle")) != null) { int n = ((Integer) session.getAttribute(goods[1])).intValue(); session.setAttribute(goods[1], new Integer(n + 1)); } else if ((s = req.getParameter("gta")) != null) { int n = ((Integer) session.getAttribute(goods[2])).intValue(); session.setAttribute(goods[2], new Integer(n + 1)); } And html page: Fifa 15 &lt;/br&gt; &lt;img src="images/fifa-15.jpg" width = 200 height = 300 alt="image" /&gt;&lt;/br&gt; &lt;input type="submit" value="add to cart" name = "fifa"&gt;&lt;/br&gt; Battlefield 4&lt;/br&gt; &lt;img src="images/battlefield-4.jpg" width = 200 height = 300 alt="image" /&gt;&lt;/br&gt; &lt;input type="submit" value="add to cart" name ="battle"&gt;&lt;/br&gt; GTA 5&lt;/br&gt; &lt;img src="images/gta-5.jpg" width = 200 height = 300 alt="image" /&gt;&lt;/br&gt; &lt;input type="submit" value="add to cart" name = "gta"&gt; After detecting which button was pressed you can choose action for each button.
score: 0
accepted answer of: http://stackoverflow.com/q/26531500
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41693110
has comment: http://stackoverflow.com/comment/41695267
type: Answer
has comment: http://stackoverflow.com/comment/41693563
has comment: http://stackoverflow.com/comment/41693807

eclipse-rcp
tags question: http://stackoverflow.com/q/26545120
type: Tag
tags question: http://stackoverflow.com/q/26613890
tags question: http://stackoverflow.com/q/26593750
tags question: http://stackoverflow.com/q/26636947
tags question: http://stackoverflow.com/q/26648158
tag name: eclipse-rcp

http://stackoverflow.com/q/26525690
has body: According to Java Exec allJvmArgs property javadoc, allJvmArgs is List&lt;String&gt; allJvmArgs The full set of arguments to use to launch the JVM for the process. This includes arguments to define system properties, the minimum/maximum heap size, and the bootstrap classpath. I am trying to use this property unsuccessfully. Below is my attemps. Example Java Code. //src/main/java/com/examples package com.examples; public class AllJvmArgumentsInJavaExecBug { public static void main(String[] args) { System.out.println("Hello From Java"); } } // File: build.gradle apply plugin: 'java' task(runJavaExecNormal, dependsOn: 'classes', type: JavaExec) { main = 'com.examples.AllJvmArgumentsInJavaExecBug' classpath = sourceSets.main.runtimeClasspath } task(runJavaExecArgumentSetExample1, dependsOn: 'classes', type: JavaExec) { main = 'com.examples.AllJvmArgumentsInJavaExecBug' classpath = sourceSets.main.runtimeClasspath allJvmArgs = [ '-Xms10240m', '-Xmx20280m'] } task(runJavaExecArgumentSetExample2, dependsOn: 'classes', type: JavaExec) { main = 'com.examples.AllJvmArgumentsInJavaExecBug' classpath = sourceSets.main.runtimeClasspath List&lt;String&gt; argumentList = new ArrayList&lt;String&gt;(); argumentList.add('-Xms10240m') argumentList.add('-Xmx20280m') allJvmArgs = argumentList } I get following error. P:\github\gradleJavaExecAllJvmArgs&gt;gradle FAILURE: Build failed with an exception. * Where: Build file 'P:\github\gradleJavaExecAllJvmArgs\build.gradle' line: 14 * What went wrong: A problem occurred evaluating root project 'gradleJavaExecAllJvmArgs'. &gt; java.lang.UnsupportedOperationException (no error message) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 3.733 secs I am unable to use this property. I can use maxHeapSize = "2g" as pointed in this question. I would like to use it to set minumum heap size. Following is github project which recreates this situation.
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
score: 4
upvote count: 4
tagged with: groovy
linked to: http://stackoverflow.com/q/9794829
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41684196
favorite count: 0
has answer: http://stackoverflow.com/a/26528266
accepted answer: http://stackoverflow.com/a/26528266
has title: Gradle JavaExec Task, How to use allJvmArgs property

http://stackoverflow.com/q/26620760
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41864035
tagged with: matrix
has comment: http://stackoverflow.com/comment/41882459
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26620827
type: Question
has body: I'm trying to work out the modular inverse of a matrix, how could this be done in Java? So far I've found the package Jama package - http://math.nist.gov/javanumerics/jama/ Can be used for inverse and matrix multiplication, however I'm stumped trying to find the mouldar inverse of a matrix... This is exactly what I am trying to achieve here: http://planetcalc.com/3324/ Any ideas? Thanks
score: 1
tagged with: java
tagged with: jama
has title: Modular inverse of a matrix in Java
has comment: http://stackoverflow.com/comment/41852197
upvote count: 1

http://stackoverflow.com/comment/41729290
type: QuestionComment
score: 0
has text: could you provide an example with expected output?
type: Comment
comment on: http://stackoverflow.com/q/26553567

http://stackoverflow.com/q/26516028
has body: I increased the hibernate.jdbc.batch_size parameter to 50. This makes batch processings in our application a lot faster, which is great. Do I need to expect any drawbacks for the "regular" tasks of the application? The application responds to web requests and uses a single database connection per request. Most of the requests read only from the database, some requests save a few objects (but not hundreds). Thank you very much for sharing your experiences.
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/29128206
favorite count: 0
has title: Drawbacks of a high hibernate.jdbc.batch_size setting
has comment: http://stackoverflow.com/comment/41663972
score: 6
tagged with: jdbc
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/29128206

http://stackoverflow.com/a/26572064
type: Answer
has comment: http://stackoverflow.com/comment/41762620
has comment: http://stackoverflow.com/comment/41762334
score: 0
has body: Having a quick browse though the version 1 source code (link here) I found this method which claims to be doing what you want: /** * Verifies that the actual {@code List} contains the given objects, in the same order. This method works just like * {@code isEqualTo(List)}, with the difference that internally the given array is converted to a {@code List}. * * @param objects the objects to look for. * @return this assertion object. * @throws AssertionError if the actual {@code List} is {@code null}. * @throws NullPointerException if the given array is {@code null}. * @throws AssertionError if the actual {@code List} does not contain the given objects. */ public @Nonnull ListAssert containsExactly(@Nonnull Object... objects) { checkNotNull(objects); return isNotNull().isEqualTo(newArrayList(objects)); } If I'm understanding the Javadoc correctly, you would just do this: assertThat(listOfObjects).containsExactly(object1, object2, object3); Note though that there were some issues with this method in version 2.0-M8. As detailed here! They were resolved in version 2.0-M9.
has comment: http://stackoverflow.com/comment/41762399
answers question: http://stackoverflow.com/q/26572023

http://stackoverflow.com/a/46143936
has body: The below Link works well for EC2 / Linux or Mac sudo yum install tomcat8-webapps tomcat8-docs-webapp tomcat8-admin-webapps This will install: WebApps Folder Tomcat documentation (Gives local documentation for qucik reference) Admin App : through which you can install / export / start /stop / reload an application (without having to login) Note: When a Manager App is installed - be sure to change the default roles and permissions etc and Password too. Otherwise you are very vulnerable. Its best to disable the admin module for better security.
upvote count: 3
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26637550
score: 2

http://stackoverflow.com/a/26597772
score: 3
has body: Just use a Label. Here's a proof of concept: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class CustomLabelDemo extends Application { @Override public void start(Stage primaryStage) { Label label = new Label("Hello World"); label.setStyle( "-fx-alignment: center;" +"-fx-padding: 6px;" +"-fx-background-color: red, -fx-background;" +"-fx-background-insets: 0, 4px;" ); StackPane root = new StackPane(label); primaryStage.setScene(new Scene(root, 350, 75)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } The way the css is working here is that it defines two backgrounds: the first (and thus the one at the back) is red; the one in front is set to -fx-background, which is the color defined in the default stylesheet for the background of most controls. Corresponding to these are two insets for the two backgrounds: the first set to zero, and the second set to 4 pixels. This means that 4 pixels of the red border will be visible. The padding is just set to make sure the text doesn't overlap the outer background (the border). In a real application, you should put the style in an external file. You can also define a "looked-up-color" for the border color; this will make it much easier to change the color at runtime: import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class CustomLabelDemo extends Application { @Override public void start(Stage primaryStage) { Label label = new Label("Hello World"); label.getStyleClass().add("custom-label"); Button changeColorButton = new Button("Change to green"); changeColorButton.setOnAction(event -&gt; label.setStyle("custom-label-border-color: green;")); VBox root = new VBox(10, label, changeColorButton); …
has comment: http://stackoverflow.com/comment/41810536
accepted answer of: http://stackoverflow.com/q/26596774
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26596774
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41809921
downvote count: 0

http://stackoverflow.com/q/26578150
downvote count: 1
has answer: http://stackoverflow.com/a/26578258
has comment: http://stackoverflow.com/comment/41773728
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26578355
type: Question
has comment: http://stackoverflow.com/comment/41773644
has title: Reading from random access file in Java
has body: I am trying to set up a while loop that will read from a RandomAccessFile and stop when it reaches the end of the file. But every time I try running the program I get an error. RandomAccessFile raf = new RandomAccessFile(filename, "rw"); final int EOF = -1; while(raf.readInt() != EOF){ id = raf.readInt(); existingMileage = raf.readInt(); gasCost = raf.readInt(); ndays = raf.readInt(); rate = raf.readInt(); totalCharge = raf.readInt(); discount = raf.readInt(); tax = raf.readInt(); netCharge = raf.readInt(); returnMileage = raf.readInt(); } This is the error I am getting: Exception in thread "main" java.io.EOFException at java.io.RandomAccessFile.readInt(Unknown Source) at TakeHome.TakeHome.fileReaderMethod(TakeHome.java:127) at TakeHome.TakeHome.main(TakeHome.java:20)
tagged with: randomaccessfile
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/36197765
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/41965114
has text: Yes on a button, but I hav'nt managed to do that on a MenuItem. In fact I suspect that the os only have the "selected" event for menues, and as far as I can see this event does not carry info about wich button is used. It could in a browser very well be a widget that only looks like a menu. Of course I could also do that, but it would save a lot of work if a Menu could be used.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26660447

http://stackoverflow.com/comment/41844783
comment on: http://stackoverflow.com/a/26596989
score: 4
type: AnswerComment
type: Comment
has text: Delete support library jar from your project's libs folder. Keep everything as is.

http://stackoverflow.com/comment/41926552
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26661854
has text: No, that's sqljdbc4-3.0.jar, which is presumably v3.0 of the driver. Try the download link on the page [here](http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx) for the v4.0 driver.

http://stackoverflow.com/q/26535511
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26536851
type: Question
answer count: 2
has title: Spring Security SuccessHandler error with forward
tagged with: spring-security
possible better answer: http://stackoverflow.com/a/26536154
has answer: http://stackoverflow.com/a/26536154
has answer: http://stackoverflow.com/a/26536851
tagged with: spring
type: AnsweredQuestion
has body: I keep getting a Http 400 error when I try an Http POST or Http PUT with using a custom SuccessHandler. Specifically the error occurs, after I forward the request. I forward the request as follows: public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String context = request.getContextPath(); String fullURL = request.getRequestURI(); String url = fullURL.substring(fullURL.indexOf(context) + context.length()); request.getRequestDispatcher(url).include(request, response); request.getRequestDispatcher(url).forward(request, response); } Any of my other calls that do not include a RequestBody do not produce a Http 400 error. What could be the problem?

http://stackoverflow.com/q/26664487
has title: "java.net.SocketTimeoutException: connect timed out" My client is not able to invoke web service
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/3877572
answer count: 1
duplicate of: http://stackoverflow.com/q/3877572
tagged with: ssl
type: UnansweredQuestion
has body: I'm trying to call a web service and send some xml data to it. I was given certificates by the company that hosts the web service and I have imported them to my keystore and have also set the key store in my code. The company says my IP's are whitelisted and their server is up and running but I keep getting this exception: 17:18:00,255 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) java.net.SocketTimeoutException: connect timed out 17:18:00,255 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.PlainSocketImpl.socketConnect(Native Method) 17:18:00,256 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) 17:18:00,256 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 17:18:00,257 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 17:18:00,257 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 17:18:00,258 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at java.net.Socket.connect(Socket.java:579) 17:18:00,258 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618) 17:18:00,258 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) 17:18:00,259 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) 17:18:00,259 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) 17:18:00,259 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(HttpsClient.java:275) 17:18:00,260 ERROR [stderr] (DefaultQuartzScheduler_Worker-1) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371) 17:18:00,260 E…
has answer: http://stackoverflow.com/a/26665033
type: Question
tagged with: keystore
tagged with: web-services
has comment: http://stackoverflow.com/comment/41931702

http://stackoverflow.com/comment/41938368
type: AnswerComment
has text: @user3469274 on imageview xml you wrote wrape content
comment on: http://stackoverflow.com/a/26668448
score: 0
type: Comment

http://stackoverflow.com/a/26606316
answers question: http://stackoverflow.com/q/26605791
score: 0
type: Answer
has body: As with a servlet, there are two ways to do this. HttpServletReponse.sendRedirect() actually sends a response to the browser giving it a URL to fetch instead of the original one, which may be on a different server. The other option is to use a RequestDispatcher to load a different resource on the server instead of the resource which would have been loaded, transparently to the browser.

http://stackoverflow.com/comment/41958989
type: AnswerComment
has text: Okay I got that part. Now how do I go about accessing an actual row? For instance how would I execute `.setSelected(Boolean.TRUE)` for a specific row?
type: Comment
comment on: http://stackoverflow.com/a/26667206
score: 0

http://stackoverflow.com/a/26681981
downvote count: 0
type: AcceptedAnswer
score: 1
has body: The shutdown hook mechanism doesn't have any way to run shutdown hooks just for particular exit codes. You could register a shutdown hook which checks the exit code, as discussed here, and decides what to do based on that.
accepted answer of: http://stackoverflow.com/q/26672332
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26672332

http://stackoverflow.com/comment/41823729
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26605486
has text: I am not sure what you mean, I did not use any xml to config my app, I do indeed have a web.xml but I did not create that, maven creates it but I do not put anything new in it. Would you please post a complete code sample?

http://stackoverflow.com/comment/41778672
comment on: http://stackoverflow.com/a/26580755
has text: I did miss that. I forgot to add that to a comment. Thank you so much. It worked. Not so worried about the count loop at the end, but would the loop to count the number of times be okay if I nest them?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26547313
upvote count: 2
type: UnansweredQuestion
tagged with: space-complexity
has title: Given a list of words, how do you find common letters that overlap
score: 2
has comment: http://stackoverflow.com/comment/41717679
tagged with: java
has body: I have an input list of words. You check the suffix of the first word to the prefix of the next word. Eg. serene next tango extra {serene,next}= 2common letters {serene,tango}=0 {serene,extra}= 1 {next,serene}= 0 {next,tango}= 1 {next,extra}= 3 {tango,serene}=0 {tango,next}= 0 {tango,extra}= 0 {extra,serene}=0 {extra,next}=0 {extra,tango}=0 You can also switch the order of the words i.e.(next, serene) if overlap letter score is better this way so you check the overlap scores with each word and finally return the list of words with maximal score Going by the input list the score is 1 serene,next,tango,extra = 1 Maximal Score is = 5 and the output list returned would be the following: serine,next,extra,tango serene,next= 2common letters serene,tango=0 serene,extra= 1 next,serene= 0 next,tango= 1 next,extra= 3 tango,serene=0 tango,next= 0 tango,extra= 0 extra,serene=0 extra,next=0 extra,tango=0 What is the best way to calculate overlap score and return maximal score list in terms of complexity? I am only able to calculate the overlap score for consecutive words, but that doesn't give maximal score.
type: Question
answer count: 2
tagged with: algorithm
has answer: http://stackoverflow.com/a/26547835
downvote count: 0
has answer: http://stackoverflow.com/a/26551327
has comment: http://stackoverflow.com/comment/41718669
tagged with: time-complexity
favorite count: 0

http://stackoverflow.com/comment/41812327
has text: try removing XmlElement() annotation from the storage class field, and annotate RepositoriesMap as XmlRootElement() (in a non-inner, non-static class)
type: AnswerComment
comment on: http://stackoverflow.com/a/26592857
type: Comment
score: 0

http://stackoverflow.com/q/26592482
tagged with: java
accepted answer: http://stackoverflow.com/a/26592531
type: Question
score: 0
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/41799729
possible better answer: http://stackoverflow.com/a/26592536
has title: Difference between "passing reference after assigning an object" and "passing object using new keyword" to a method in java?
tagged with: reference
has answer: http://stackoverflow.com/a/26592536
has answer: http://stackoverflow.com/a/26592531
has comment: http://stackoverflow.com/comment/41799787
upvote count: 1
downvote count: 1
has body: What difference does it makes? Let's think we have a method in java as following: void demoMethod(MyClass mc){ // some operations } First type: demoMethod(new MyClass()); // directly passing an object Second type: MyClass mc = new MyClass(); demoMethod(mc); // passing reference of an object
type: AnsweredQuestion
tagged with: object
tagged with: oop

http://stackoverflow.com/a/26624320
downvote count: 0
has comment: http://stackoverflow.com/comment/41858431
has comment: http://stackoverflow.com/comment/41858552
type: Answer
has comment: http://stackoverflow.com/comment/41858467
answers question: http://stackoverflow.com/q/26624262
has comment: http://stackoverflow.com/comment/41858505
accepted answer of: http://stackoverflow.com/q/26624262
has comment: http://stackoverflow.com/comment/41858778
has body: Fix your imports and replace import com.mysql.jdbc.PreparedStatement; by import java.sql.PreparedStatement; You should never use mysql-specific classes in your code. The standard JDBC classes are all you need. Regarding the use aof prepared stataments, yes, it should be used every time you need to pass parameters to a query. It's a matter of robustness and of security (read about SQL injection attacks). But JDBC code, and scriptlets in general, have nothing to do in JSPs. JSPs are view components, whose job is to generate HTML. They're not data access components. These should be written in Java and accessed from a controller servlet.
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/41669914
type: AnswerComment
comment on: http://stackoverflow.com/a/26520314
type: Comment
score: 0
has text: Yeah these two bits you posted are the if statements to increment through the donations. The last one is to run the exact same code again as it allocates one dollar at a time. once the donation is spent (donation.spent()) or the count of fully funded projects for the donation is met, then it increments to the next donation. Although as you say, it is possible that this is the reason for the infinite loop as it may be de-allocating from a failure and then triggering the increment instead of just exiting on a failure

http://stackoverflow.com/a/26537369
score: 2
has body: Call getTitle (note spelling) on a NewsItem rather than on the List itself &lt;c:forEach var="newsItem" items="${newsList}"&gt; ${newsItem.title} &lt;/c:forEach&gt;
has comment: http://stackoverflow.com/comment/41715373
has comment: http://stackoverflow.com/comment/41715947
has comment: http://stackoverflow.com/comment/41702383
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26537322
type: Answer

http://stackoverflow.com/comment/41795152
comment on: http://stackoverflow.com/a/26589846
has text: Didn't got could you please elaborate or what exactly you want or may be you can put the image so we can understand. And down voters please leave a comment when you down vote it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26611471
has title: Spark data processing with grouping
has answer: http://stackoverflow.com/a/26612246
has body: I need to group a set of csv lines by a certain column and do some processing on each group. JavaRDD&lt;String&gt; lines = sc.textFile ("somefile.csv"); JavaPairRDD&lt;String, String&gt; pairRDD = lines.mapToPair(new SomeParser()); List&lt;String&gt; keys = pairRDD.keys().distinct().collect(); for (String key : keys) { List&lt;String&gt; rows = pairRDD.lookup(key); noOfVisits = rows.size(); country = COMMA.split(rows.get(0))[6]; accessDuration = getAccessDuration(rows,timeFormat); Map&lt;String,Integer&gt; counts = getCounts(rows); whitepapers = counts.get("whitepapers"); tutorials = counts.get("tutorials"); workshops = counts.get("workshops"); casestudies = counts.get("casestudies"); productPages = counts.get("productpages"); } private static long dateParser(String dateString) throws ParseException { SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mma"); Date date = format.parse(dateString); return date.getTime(); } dateParser is called for each row. Then min and max for the group is calculated to get the access duration. Others are string matches. pairRDD.lookup is extremely slow.. Is there a better way to do this with spark.
tagged with: apache-spark
downvote count: 0
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/26612246
favorite count: 0
tagged with: rdd
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/26590375
linked to: http://stackoverflow.com/q/2422468
accepted answer: http://stackoverflow.com/a/26590556
has body: I'm trying to upload excel file to a servlet, get data from it and then send this data to a database. And I'm stuck at the very beginning: uploading the file. To get data from the file, I want to use Apache POI, and here is my code: System.out.println("entered Import.java"); Part filePart = request.getPart("import"); System.out.println("filePart: "+filePart); FileInputStream inputStream = (FileInputStream) filePart.getInputStream(); System.out.println("inputStream: "+inputStream); Workbook book = WorkbookFactory.create(inputStream); Sheet sheet = book.getSheetAt(0); for (Row row : sheet) { for (Cell cell : row) { System.out.println("row: "+row+", cell value: "+cell.getRichStringCellValue().getString()); } } inputStream.close(); The output of this code is: entered Import.java filePart: org.apache.catalina.core.ApplicationPart@bc6f13 inputStream: java.io.FileInputStream@532048c5 Servlet.service() for servlet [Import] in context with path [/Management] threw exception [Servlet execution threw an exception] with root causejava.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions The UI part is SAPUI5 framework and here it is. I looked through this and this threads, but it didn't help me. How do I get this servlet to work?
type: Question
tagged with: servlets
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/22985809
has answer: http://stackoverflow.com/a/26590556
has comment: http://stackoverflow.com/comment/41795855
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
has title: Upload Excel file to servlet and get data from it
linked to: http://stackoverflow.com/q/26024193

http://stackoverflow.com/a/26572684
type: Answer
has comment: http://stackoverflow.com/comment/41763423
upvote count: 1
answers question: http://stackoverflow.com/q/26572507
score: 1
accepted answer of: http://stackoverflow.com/q/26572507
has body: Your getSname() method returns a byte[] of fixed length 64, which is the specified length of the sname field in the BOOTP protocol. When you pass it directly to the String(byte[]) constructor, you get a string right-padded to length 64 with zero-characters. To fix this, you need to find the first zero byte in the array and use that when constructing the string. Additionally make sure you pass in an explicit character encoding; otherwise you are at the mercy of the platform default. So, use code such as this: sname2string(byte[] sname) { int length = 0; while (length &lt; 64 &amp;&amp; sname[length] != 0) length++; return new String(sname, 0, length, StandardCharsets.ISO_8859_1); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41826006
type: QuestionComment
comment on: http://stackoverflow.com/q/26604230
has text: configured the IE Protected mode properly and removed the capability. But still getting null pointer exception. Not able to analyze why its happening. Any suggestion please...
score: 0
type: Comment

http://stackoverflow.com/q/26596570
has title: How do I use 'WHERE' from VersionOne JAVA SDK
type: Question
tagged with: java
score: 0
tagged with: api
answer count: 1
has answer: http://stackoverflow.com/a/26596855
tagged with: rest
type: UnansweredQuestion
has body: I have a query like the following, /rest-1.v1/Data/TeamRoom?sel=Name,Team,Participants.@Count&amp;where=Team='Team:4250032' How do I do the same from the VersionOne Java SDK ?
tagged with: versionone

http://stackoverflow.com/a/26515714
has comment: http://stackoverflow.com/comment/41663604
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41661359
score: 1
answers question: http://stackoverflow.com/q/26515553
has body: you're not setting the current question anywhere before you are trying to use it. you need a method like: public void startTest() { currentQuestion = q.get(0); } and then: DrivingTest drivingTest = new DrivingTest(); drivingTest.startTest(); while( true ) { //.... also ensure you have questions to get, or you will get other errors as well.. if you are using eclipse, try Debugging your code by stepping through it... you might want to look in a better way to terminate that loop as well, currently it will fail at the end of the test... EDIT: ok the loop wont break, but its really messy... Edit of the DrivingTest constructor: public DrivingTest() throws FileNotFoundException{ File f = new File("DrivingTest.txt"); //int n = 1; Scanner sc = new Scanner(f); while(sc.hasNextLine()){ String desc = sc.nextLine(); String A = sc.nextLine(); String B = sc.nextLine(); String C = sc.nextLine(); String h = sc.nextLine(); int a = Integer.parseInt(h); String blank = sc.nextLine(); q.add(new Question(desc, A,B,C,a) ); } sc.close(); //ensure it's 0. currentQuestionIndex = 0; //sets up your first question object. setCurrentQuestion( q.get(currentQuestionIndex) ); }
downvote count: 0

http://stackoverflow.com/comment/41664387
score: 0
has text: @meda MySQLWorkbench
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26514740

http://stackoverflow.com/a/27127732
type: Answer
has body: Put the last line outside the loop
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26637045
accepted answer of: http://stackoverflow.com/q/26637045
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/41871722
comment on: http://stackoverflow.com/q/26631739
has text: As Stephen says, the issue almost certainly won't be related to performance, although the driver makes all the difference. There *is* a difference in readability and maintainability.
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/comment/41739583
has text: @jdog1218 add part of your text file .then it's clear to viewers
comment on: http://stackoverflow.com/a/26559344
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41897638
score: 0
type: Comment
type: QuestionComment
has text: I am confused by jon and The Lost Mind's answer. They appear contradictory to me. Correct me if i am wrong.
comment on: http://stackoverflow.com/q/26632799

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/26578465
type: Tag
tags question: http://stackoverflow.com/q/26569904

http://stackoverflow.com/a/27263030
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26576718
score: 8
answers question: http://stackoverflow.com/q/26576718
upvote count: 8
has comment: http://stackoverflow.com/comment/43007456
type: Answer
has body: Interesting question, If we leave apart all the performance deciding attributes finally it boils down to how much work you are doing in the servlet or how much time it takes if it has highest I/O, CPU and memory. Now lets move down with you list with the above statement in mind;- Number of HTTP connections the server can allow per port There are limit for file descriptors but that again gets triggered by how much time a servlet is taking complete a request or how much time it takes from request first byte receive to finish sending the entire response. Because if it take only 1ms and you are using Netty and persistent connection, you can reach a really high >> 6000. Number of servlets in pool Theoretically >> 6000. But how many thread are processing your requests? Is there a thread pool that is burning your requests ? So you want to increase threads, but how much lets say 2000 concurrent threads. Is your CPU behaving poor with context switching ? Is it I/O bound? if yes it makes sense to context switch but then you will be hitting those network limits because a lot of thread waiting on network I/O, so ultimately how much time you spent on a piece of work. DB If it oracle, bless you with connection management, you definitely need rigorous monitoring here. Now this is just another limiting factor and can be considered as an just another blocking I/O. By definition of I/O, latency/throughput matters and becomes a bottleneck the moment it becomes the bigger than the smallest piece of work. So, finally, you need to break down following or more attributes for all the servlets Is it CPU bound? If yes, how much cycles it takes or can it be converted safely to some time unit. e.g. 1ms for just the compute piece of work. Is it I/O bound, If yes similarly find the unit. and others A long list of what you have, e.g. CPU, Memory, GB/s Now you know how much work needs to be done and all you do is divide by what you have and keep tuning , so that you find out the optimal and also f…

http://stackoverflow.com/comment/41835676
has text: Apparently, this works. Thank you. I tried it before and could not get the MouseReleased event to fire. It seems like the MouseReleased event will not get fired once a DragAndDrop gesture is hapenning. The tab graphic setOnDragDetected method calls contentTab.getTabPane().startDragAndDrop(TransferMode.MOVE);, then some data gets added to the DragBoard content. After, the MouseReleased does not get executed, any idea why?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26611309

http://stackoverflow.com/comment/41935877
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26667229
has text: I've seen this way but its not what i am doing and doesn't work on this
score: 0

http://stackoverflow.com/comment/41882161
comment on: http://stackoverflow.com/a/26637347
type: AnswerComment
type: Comment
score: 1
has text: you can define your method as def method(uuidOpt : Option[UUID]) and call it either as method(None) or method(Option(UUID.fromString("<some valid uuid string here>")))

http://stackoverflow.com/comment/41799417
type: QuestionComment
has text: @Integral I don't think it has anything to do with `Double` or `Float`. Either you alter your regex, so it would split your expression only when an operator is in between 2 numbers (negative or not) or you access the `token` array more dynamically (maybe with a for loop, `token[i]`) and check if the value at `token[i]` is really a number you can cast
comment on: http://stackoverflow.com/q/26591584
score: 0
type: Comment

http://stackoverflow.com/a/45958063
score: 0
type: Answer
has body: The best solution which I found is not to return the Entity directly. In your case you are returning the 'user' entity directly in your login controller. Instead just return user.id or user.firstname, etc. It will work fine. When we return any entity the compiler goes into infinite recursive loop.
answers question: http://stackoverflow.com/q/26572245

http://stackoverflow.com/comment/41754841
comment on: http://stackoverflow.com/a/26567892
has text: I am doing this for a comp sci class and I think they just want the simplest form of the quadratic formula [link to assignment](https://www.schoology.com/docviewer/258646862/a61f78b475c24c772c8303bebcff9ba6). I also added the edit you suggested but it still has "NaN", maybe "b" somehow is negative? Thanks for the help <3
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26624657
score: 1
answers question: http://stackoverflow.com/q/26624000
has comment: http://stackoverflow.com/comment/41862396
upvote count: 1
has comment: http://stackoverflow.com/comment/41861361
has body: Try as callsmt.registerOutParameter(3, OracleTypes.CLOB); and then Clob clob = proc_stmt.getClob(3); Reader reader = clob .getCharacterStream(); char[] buffer = new char[1]; while(reader.read(buffer) &gt; 0) { log.info(buffer); } // log.info(retValue); .... the above code snippet is not compiled, this is to provide the guideline.
type: Answer
downvote count: 0

http://stackoverflow.com/a/26653044
type: Answer
score: 2
upvote count: 2
has body: If it didn't create java directory, perhaps you didn't chose to create a java maven application when you opened/imported directory with project to idea. Anyways maven's structure is determined and java sources should be in java folder. You have to create a folder manually and mark it as java sources. Go to project settings(alt+ctrl+shift+s) -> Modules -> check your module in sources find your folder and Mark as Sources
downvote count: 0
answers question: http://stackoverflow.com/q/26652784

http://stackoverflow.com/a/26653033
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26652784
answers question: http://stackoverflow.com/q/26652784
type: Answer
has body: You need to right click the java folder and choose the option: Mark Directory As -> Source Root
score: 42
upvote count: 42

http://stackoverflow.com/comment/41713905
type: QuestionComment
comment on: http://stackoverflow.com/q/26543633
has text: The fact that it works doesn't mean it is correct :) but alas. Just wanted to point to your configuration flaws and asking a clarifaction.
score: 0
type: Comment

http://stackoverflow.com/a/26638209
type: Answer
answers question: http://stackoverflow.com/q/26638038
score: 0
has body: Use composition. Create a class and implement iterable. The class will wrap a hashset and will expose add and remove method. The same remove method you can use as the iterable remove.

http://stackoverflow.com/a/26692944
downvote count: 0
answers question: http://stackoverflow.com/q/26667915
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/69412250
has body: You can specify a @+id in the first value &lt;EditText android:id="@+id/login_username" android:nextFocusDown="@+id/login_password" /&gt; &lt;EditText android:id="@+id/login_password" android:nextFocusUp="@id/login_username" android:nextFocusDown="@id/login_submit" /&gt; There is no harm to having multiple @+id's around. It could make detecting typos a bit more difficult, but if you need it, it'll work well.

http://stackoverflow.com/q/26595593
has title: How to work with filtered results using Aspose Cells
tagged with: java
tagged with: autofilter
tagged with: aspose
has comment: http://stackoverflow.com/comment/41841438
type: Question
answer count: 1
has body: In my work i am using cells-2.3.1.jar. I want to filter columns and work with those filtered values, without save to file and reload it, just working in memory. This is my code: Worksheet worksheet = workbook.getWorksheets().getSheet(0); AutoFilter autoFilter = worksheet.getAutoFilter(); autoFilter.filter(2, nameValue); autoFilter.filter(4, countryValue); // At this point if I insert workbook.save("file.xls"), this file contains the right values //But I don't need and don´t want to write to disk //However shows all the values Cells cells = worksheet.getCells(); for (int fila = 1; fila &lt;= cells.getMaxRow(); fila++) { System.out.println("Name: " + ((String) cells.getCell(fila,2).getValue()).trim()); System.out.println("Country: " + ((String) cells.getCell(fila, 4).getValue()).trim()); } Sorry for my english. Thanx in advance.
score: 0
has answer: http://stackoverflow.com/a/26595934
tagged with: aspose-cells
type: UnansweredQuestion

http://stackoverflow.com/comment/41707702
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26541596
type: Comment
has text: I run the whole code inside of the main(), that is why i do not use the this key word to access with local variables.

http://stackoverflow.com/comment/41849214
score: 0
comment on: http://stackoverflow.com/a/26619123
type: AnswerComment
type: Comment
has text: Luisluix, why did u do int result=1;

http://stackoverflow.com/comment/41888854
type: QuestionComment
comment on: http://stackoverflow.com/q/26640942
score: 0
has text: `new ColsDataset[] {cols1, cols2}` ?
type: Comment

http://stackoverflow.com/comment/41732772
type: Comment
type: QuestionComment
has text: what is the dir structure of your MyProject.war ?
comment on: http://stackoverflow.com/q/26555543
score: 0

http://stackoverflow.com/a/26537777
has body: Use Jenkins to automate your deployments. It has git SCM polling features and scripting capabilities that should solve the problem.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26533483
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26533483

http://stackoverflow.com/a/26887250
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26667578
has body: Was able to solve my problem, the aop.xml was missing in the bin folder and there was a version mismatch with the aspectjrt and aspect-weaver

http://stackoverflow.com/comment/42008580
has text: Date d = new Date(); Date currentDate = new Date(System.currentTimeMillis() - 3600 * 1000); clstmt.setDate("date", new java.sql.Date(currentDate.getTime())); clstmt = con.prepareCall("exec vcs_gauge 'vs1_bag', 'd', 'date'") This is my code.Earlier when i passed parameters as clstmt = con.prepareCall("exec vcs_gauge @gauge_name='vs1_bag',@first_rec_time='2014-09-01 10:00:00',@last_rec_time='2014-09-01 11:00:00'") ;Then data was retrieved from database.
type: AnswerComment
comment on: http://stackoverflow.com/a/26669154
score: 0
type: Comment

http://stackoverflow.com/q/26665594
tagged with: swing
tagged with: jcalendar
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: JDateChooser display language
tagged with: date
has body: I'am using JCalendar's 1.4 JDateChooser so I ask if it is possible to change display names for months and days of weeks without having to change the source code, or, since I never looked the source code, is it complicated to change it even if it can be changed. Thanks.
type: Question
has comment: http://stackoverflow.com/comment/41933518
has comment: http://stackoverflow.com/comment/41933048
has answer: http://stackoverflow.com/a/26666649
accepted answer: http://stackoverflow.com/a/26666649
tagged with: jdatechooser
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41773733
type: QuestionComment
has text: You should add some code, such as what the array looks like, what the method signature looks like, and how you are parsing it.
comment on: http://stackoverflow.com/q/26578190
type: Comment
score: 0

http://stackoverflow.com/comment/41856853
has text: Post your relevant configs?
type: QuestionComment
comment on: http://stackoverflow.com/q/26606962
score: 0
type: Comment

http://stackoverflow.com/q/26547596
has body: I've written some Java software that very frequently persists and retrieves Joda-Time DateTime objects from Redis. I just serialise and deserialise the objects at present. The software reads the objects about 50 times more often than it writes. I've not profiled serialising/deserialising Joda-Time objects, but the software has scaled well, computationally, under load and I'm happy with the performance. What hasn't scaled well is memory usage. The serialised Joda-Time objects are pretty big and a decent size Redis instance can only take about 3 days worth of customer data before I need to flush it out to a relational database on disk. A secondary issue is Redis' own backup mechanisms seem harder to manage the larger the dataset gets... Setting aside the temptation to throw more RAM at the problem, I've thought of the following ideas so far: serialise then compress the objects before persisting persist as a ISO date format string persist as some other Joda-compatible string format I will try out and profile these before deciding, but I wonder if anyone can think of a more efficient way of reducing the memory footprint of persisted Joda objects without breaking the computational bank?
has answer: http://stackoverflow.com/a/26571517
type: AnsweredQuestion
downvote count: 0
has title: Whats the most efficient way to persist a Joda-Time `DateTime` object?
type: Question
has answer: http://stackoverflow.com/a/26571265
accepted answer: http://stackoverflow.com/a/26571265
score: 3
has answer: http://stackoverflow.com/a/56235332
tagged with: java
possible better answer: http://stackoverflow.com/a/26571517
tagged with: jodatime
upvote count: 3
answer count: 3
favorite count: 0
tagged with: serialization

http://stackoverflow.com/comment/41801022
comment on: http://stackoverflow.com/q/26593033
score: 0
type: Comment
type: QuestionComment
has text: How is "Leave&#x20;ApplicationForm" wrong? `&#x20;` is the hex value for 'space'.

http://stackoverflow.com/comment/41711506
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26543463
type: Comment
has text: You can't tell regex to find a special language characters, without telling the expression which special characters is should look after. http://en.wikipedia.org/wiki/Vietnamese_alphabet

http://stackoverflow.com/q/26659069
has title: how to get string resource from string.xml file in android
has answer: http://stackoverflow.com/a/26659179
has body: I am using the following code. Although the code is working fine. I want to get string from string.xml file without initialising strings in Java code? I have no clue on what to do. Also I want to make the following: On particular list item click it starts a new activity? package com.example.listviewexample; import java.util.Arrays; import java.util.List; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ListActivity { final List&lt;String&gt; elements = Arrays.asList("Element 1", "Element 2", "Element 3", "Element 4", "Element 5"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); ListView listView = getListView(); listView.setTextFilterEnabled(true); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.activity_main,elements); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT).show(); }`` }); } }
type: Question
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/26659179
possible better answer: http://stackoverflow.com/a/26660299
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26660299
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41920469
has comment: http://stackoverflow.com/comment/41920453
tagged with: java

http://stackoverflow.com/q/26598713
has body: Sup! I am writing my own CheckBoxGroup and don't understand how to add ItemListener. private ItemListener itemListener; public void addItemListener(ItemListener itemListener){ this.itemListener = itemListener; } This is all I have about it. Really, i can't understand how to LINK itemListener with my Item class. I really can't add some more text, but stackoverflow is asking me to do that. So, there is some "blah-blah-blah". Full code here package a3ro; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Arrays; import java.util.LinkedList; import java.util.List; /** * Created by Aero on 14.10.2014. */ public class ACheckBoxGroup extends JComponent{ private List&lt;Item&gt; item; private Color foreground; private Color background; private Color trueColor; private Color falseColor; private Font font; private int width; private int height; private int fontMaxSize; private FontMetrics fm; private int fontH; private int[] heights; private static final int hC = 3; private boolean form = true; private static final boolean CIRCLE = true; private static final boolean SQUARE = false; private static final int MIN_FONT_SIZE = 8; private static final int MAX_FONT_SIZE = 32; private ItemListener itemListener; public void addItemListener(ItemListener itemListener){ this.itemListener = itemListener; } public void removeItemListener(){ this.itemListener = null; } public ACheckBoxGroup(){ item = new LinkedList&lt;Item&gt;(); //background &amp; foreground is initialize in paintComponent method trueColor = Color.green; //falseColor is null default this.setPreferredSize(new Dimension(150, 50)); fontMaxSize = 16; setFont(new Font("Dialog", Font.PLAIN, fontMaxSize)); updateSize(); fm = getFontMetrics(getFont()); fontH = fm.getHeight(); enableEvents(AWTEvent.ACTION_EVENT_MASK); addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int y = e.getY(); if (y &lt;= item.size() * fontH * hC) { item.get(y / (fontH * hC)).changeValu…
tagged with: components
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41812029
tagged with: itemlistener
score: 0
has comment: http://stackoverflow.com/comment/41811917
answer count: 1
has comment: http://stackoverflow.com/comment/41811964
has title: How can I add ItemListener to my own component?
has answer: http://stackoverflow.com/a/26598817
has comment: http://stackoverflow.com/comment/41811994
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41811886
tagged with: checkbox
has comment: http://stackoverflow.com/comment/41811858

http://stackoverflow.com/a/30209464
type: Answer
has body: JVM is: A specification :-where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Sun and other companies. An implementation :-Its implementation is known as JRE (Java Runtime Environment). Runtime Instance:- Whenever you write java command on the command prompt to run the java class, and instance of JVM is created.
answers question: http://stackoverflow.com/q/26561271
score: 0

communication
tag name: communication
tags question: http://stackoverflow.com/q/26551788
type: Tag

http://stackoverflow.com/q/26589917
tagged with: java
possible better answer: http://stackoverflow.com/a/26590423
has title: Nested AlertDialog
has answer: http://stackoverflow.com/a/26590130
has answer: http://stackoverflow.com/a/26590423
type: Question
answer count: 2
downvote count: 0
has body: I'm facing a unreasolvable (for me) problem with nested AlertDialog using the following code final AlertDialog.Builder button_cook_action = new AlertDialog.Builder(this); final EditText cookMl = new EditText(this); cookMl.setInputType(InputType.TYPE_CLASS_NUMBER); button_cook.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button_cook_action.setTitle(R.string.kitchen_recipe_button_cook) .setMessage(R.string.kitchen_recipe_button_cook_volume) .setView(cookMl) .setPositiveButton(R.string.Yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { AlertDialog.Builder builderCooking = new AlertDialog.Builder(RecipeActivity.this); builderCooking.setTitle(recipe.getName()) .setMessage("message"); builderCooking.show(); } }) .setNegativeButton(R.string.No, null) .show(); } }); The first call works fine, but when i call it for a second time it gave me : FATAL EXCEPTION: main java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. I already search in this forum but without any success. If someone has a clue. Thanks in advance :)
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26590130
upvote count: 3
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/26633442
accepted answer: http://stackoverflow.com/a/26633527
has title: Refactoring - Methods share the same code except for one function call
has answer: http://stackoverflow.com/a/26633527
favorite count: 0
has body: I have several methods in class Test which have the same code except one specific method call. Is there a possibility to merge these methods together (bellow into function foo) and call foo and tell it which method to call without doing a bigger switch or if/else statement? An important note is that foo is only called from inside the class Test (therefore foo is private) and the function foo itself calls different methods from one class Bar. Class Bar and Test are not in the same inheritance tree. class Test { /* ... */ private void foo("Parameter that specifies which method to call from class Bar") { /* merged code which was equal */ Bar bar = new Bar(); bar.whichMethod(); // Call the method (from Class Bar) specified in the Parameter /* merged code which was equal*/ } /* ... */ } Sure straight forward I'd add some kind of switch("which Method to call") statement. But is there a better way to do this?
possible better answer: http://stackoverflow.com/a/26633955
has answer: http://stackoverflow.com/a/26633955
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: refactoring
tagged with: java
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/a/37101446
has body: Here is the solution for API &lt; 21 and above Drawable drawable = yourEditText.getBackground(); // get current EditText drawable drawable.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP); // change the drawable color if(Build.VERSION.SDK_INT &gt; 16) { yourEditText.setBackground(drawable); // set the new drawable to EditText }else{ yourEditText.setBackgroundDrawable(drawable); // use setBackgroundDrawable because setBackground required API 16 } Hope it help
has comment: http://stackoverflow.com/comment/71957986
upvote count: 49
downvote count: 1
has comment: http://stackoverflow.com/comment/71957992
score: 48
type: Answer
answers question: http://stackoverflow.com/q/26574328
has comment: http://stackoverflow.com/comment/107248201

http://stackoverflow.com/q/26641130
has title: Print Contents of Array List
has answer: http://stackoverflow.com/a/26641197
score: 1
favorite count: 0
tagged with: binary-tree
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/41889445
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41889826
downvote count: 1
has body: Trying to Print the Contents of the Array List but only get the address and not the arraylist for this level order traversal program. How can I print its contents, and not the address of the code? public static&lt;T&gt; void levelOrder(BinaryTree&lt;T&gt; t) { if(t == null) return; // create ArrayList of type Binary Tree ArrayList&lt;BinaryTree&lt;T&gt;&gt; level = new ArrayList&lt;BinaryTree&lt;T&gt;&gt;(); // add root to the ArrayList level.add(t); // while there is at least one node while(!level.isEmpty()) { BinaryTree&lt;T&gt; curr = new BinaryTree&lt;T&gt;(); level.add(0,curr); // add the left node to ArrayList if(curr.getLeft() != null) level.add(curr.getLeft()); // add the right node to ArrayList if(curr.getRight() != null) level.add(curr.getRight()); // remove element at front of array list level.remove(0); } System.out.println(level); } I tried this toString method below but I receive an imcompatible type error:void cannot be compared with string public String toString(BinaryTree&lt;T&gt; t) { return levelOrder(t); } This is the full class below: import java.util.ArrayList; public class BinaryTree&lt;T&gt; { private T data; private BinaryTree&lt;T&gt; parent; private BinaryTree&lt;T&gt; left; private BinaryTree&lt;T&gt; right; // constructor public BinaryTree() { parent = left = right = null; data = null; } // make the root method public void makeR(T data) { if (!isEmpty()) { System.out.println("Can't make root. Already exists"); } else this.data = data; } // set and get methods public void setData(T data) { this.data = data; } public void setLeft(BinaryTree&lt;T&gt; tree) { left = tree; } public void setRight(BinaryTree&lt;T&gt; tree) { right = tree; } public void setParent(BinaryTree&lt;T&gt; tree) { parent = tree; } public T getData() { return data; } public BinaryTree&lt;T&gt; getParent() { return parent; } public BinaryTree&lt;T&gt; getLeft() { return left; } public BinaryTree&lt;T&gt; getRight() { return right; } // is Empty method public boolean isEm…
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26641926

http://stackoverflow.com/a/26544247
has body: random.nextInt(n.length) gives you a random index of your array. But printing the value corresponding to this index, will always give you 0. As you never store any other value in the array. You should rather do something like this : int[] list = new int[10]; int duplicates = 0; Random random = new Random(); for (int i = 0; i &lt; list.length; i++) { int nextVal = random.nextInt(list.length); System.out.println("list["+i+"] = "+ nextVal); // test duplicates for (int index = 0; index &lt; i; index++) { if (list[index] == nextVal) { duplicates++; break; } } list[i] = nextVal; } return duplicates;
accepted answer of: http://stackoverflow.com/q/26544092
score: 0
answers question: http://stackoverflow.com/q/26544092
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26594557
linked to: http://stackoverflow.com/q/22437097
tagged with: gradle
has comment: http://stackoverflow.com/comment/41805649
has body: I have some problem. 2 days ago I write app on android developer tools, compile and install on phone, all ok - all worked. But now I want to compile it - don't can, error log Error:Artifact 'com.android.support:support-annotations:20.0.0:support-annotations.jar' not found. Gradle 'test51' project refresh failed why??? I nothing changed, don't opened project don't enabled notebook. how I can fixed it? please help.
type: Question
tagged with: java
has title: android gradle error with compile - Error:Artifact
score: 0
has comment: http://stackoverflow.com/comment/41806338
has comment: http://stackoverflow.com/comment/41805935
has comment: http://stackoverflow.com/comment/41805293
type: UnansweredQuestion
tagged with: android
answer count: 0

http://stackoverflow.com/q/26528193
tagged with: mysql
accepted answer: http://stackoverflow.com/a/26528265
type: AnsweredQuestion
tagged with: jpa
has title: How to save data of a small prog?
type: Question
tagged with: oracle-database
has body: I am building a small java application that shall run locally on a system. The data I intend to input is little stuff like my daily expenses, a couple of contacts I have, and a couple of notes of things I want to remember. To save the data for this matter I think installing a database like MySQL or Oracle would be an overkill. In my past projects I always used those databases. How would I have to manage the data of a small program? Are there any ready to use solutions in the java world? Maybe with the possibility to use it together with JPA?
has answer: http://stackoverflow.com/a/26528265
score: 0
answer count: 1
tagged with: java
tagged with: database

http://stackoverflow.com/comment/41797222
has text: Provide how you consume such service in an external tool.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26590946
score: 0

http://stackoverflow.com/comment/84207429
comment on: http://stackoverflow.com/a/26601548
score: 0
type: Comment
has text: What if Manger-1 opens up the edit window and never saves his updates.
type: AnswerComment

http://stackoverflow.com/q/26636871
has title: How to Parse CSV using runtime configurable bean class in Java
answer count: 1
tagged with: runtime
has answer: http://stackoverflow.com/a/26637456
tagged with: parsing
has comment: http://stackoverflow.com/comment/41882810
type: UnansweredQuestion
tagged with: configurable-product
tagged with: java
has body: I will detailedly eplain my requirement below,. I am going to automate a manual process. I will be reading multiple CSV files from a remote location using java. There are five formats of input files are expected, each differs in their header structure. For example, Type 1 - Number, ID, Name, Phone, Address Type 2 - Number, GID, Employee Name, Address1, Address2, Phone number and so the other three types are also differs. The precondition is not all the files are expected for a particular run. I need to read these files one by one, validate it, log the validation error and i have to consolidate all the correct data from all the files together in a standard output format, in a single file The standard output format will be like, Number, Name, ID, Address I need to have the above data alone in the output file and rest of the data can be ignored. What i have tried is as follows, I have created 5 bean classes representing each type's header. I just read an input, identify its type and parsed it. I parsed line by line. public String[] parseCSV(String inputLine){ try { String[] fields; Pattern p = Pattern.compile(",(?=([^\"]*\"[^\"]*\")*(?![^\"]*\"))"); fields = p.split(inputLine); /*for ( int i = 0; i &lt; fields.length; i++ ) { System.out.println(fields[i]); }*/ return fields; } I have validated as per the validation rules and i appended each line elements into an object. I have added all the objects in to a MAP collection. Likewise, i have created 5 beans and did the same. But, what is the change needed now is,. All the headers in all the five types of rosters are configurable items. hence, i have to change my bean classes everytime when the header structures are changed. We have to create one single utility, which is configurable for all the five types of input files. To be very clear, if type 1 input comes with 8 columns and type 3 comes with 12 columns, the utility is able to parse it. We are going to have a table which has the data regarding the header structure of …
type: Question
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/26541511
tags question: http://stackoverflow.com/q/26647822
tags question: http://stackoverflow.com/q/26542596
tags question: http://stackoverflow.com/q/26628098
tags question: http://stackoverflow.com/q/26640148
tags question: http://stackoverflow.com/q/26569288
tags question: http://stackoverflow.com/q/26669344
tags question: http://stackoverflow.com/q/26610920
tags question: http://stackoverflow.com/q/26646963
tags question: http://stackoverflow.com/q/26516045
tag name: tcp
tags question: http://stackoverflow.com/q/26565665

http://stackoverflow.com/q/26536680
accepted answer: http://stackoverflow.com/a/26536782
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41700091
has comment: http://stackoverflow.com/comment/41734543
has title: Why no promotion when adding ints to List<Double>
type: Question
has comment: http://stackoverflow.com/comment/41699290
has comment: http://stackoverflow.com/comment/41700060
score: 0
tagged with: integer-promotion
answer count: 1
has body: in Java I created an ArrayList of Double and I invoked the method list.add(1), however, I get an error. If I can assign an int to a double variable like this: double num = 1; due to automatic promotion, then why can't I add a 1 to ArrayList of Double via automatic promotion?
has answer: http://stackoverflow.com/a/26536782

http://stackoverflow.com/q/26586655
has body: I’m getting really confused with dialog boxes in Android and need some advice. Everything was initially going well. I had numerous dialogs being created within MainActivity opened via a Navi Drawer. The dialogs where created very simply using code like this: private void exportDialog() { LayoutInflater inflater = this.getLayoutInflater(); final View formElementsView = inflater.inflate(R.layout.export_data, null, false); AlertDialog msgBox = new AlertDialog.Builder(this) .setView(formElementsView).setTitle("Export Responses") .setIcon(android.R.drawable.ic_menu_share) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Code... } }) .create(); msgBox.show(); } But I started to notice problems when the device resumed from lock screen. Switching/pausing/resuming worked fine, but the locked screen seemed to kill the activity context and when the app resumed the dialogs became graphically corrupt and I got the “Activity has leaked window” error message in the logs. So, I started again. I moved all the dialogs into DialogFragment classes which seems to be the ‘proper’ way to do it. This removes the error and graphical glitches. Great! But I can’t work out how to add more than one dialog listener to MainActivity. So I’ve got: public class MainActivity extends Activity implements LogInDialog.NoticeDialogListener{ but can I add more? Until I work out how to do this, I’ve altered many of the MainActivity methods and moved them into the relevant dialog classes, which works fine but seems a rather linear approach. It would be nice if MainActivity could act upon each dialog response. As you can guess, I’m not a professional developer so I’m getting rather lost! UPDATE: OK, it seems the original problem of graphic glitches and "leaked window" messages was because the dialog boxes were not being dismissed correctly. Adding the following seems to have greatly improved matters: @Override public void onDestroy() …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26586726
tagged with: android
tagged with: dialog
tagged with: java
type: Question
has title: Activity which implements multiple dialog listeners?
score: 0
answer count: 1

http://stackoverflow.com/comment/41942269
comment on: http://stackoverflow.com/q/26670425
has text: How do you create your transient variable? What type of container do you have? What is the result?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26558267
tagged with: android
has answer: http://stackoverflow.com/a/26558525
tagged with: android-intent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26558550
accepted answer: http://stackoverflow.com/a/26558550
tagged with: java
possible better answer: http://stackoverflow.com/a/26558525
tagged with: listview
has body: In the application I am building I have 2 listviews with, among other elements, 2 buttons on every row, one for eliminating that row and the other to pass to another activity using an Intent. I am detecting clicks on both buttons by setting click listeners on both buttons on the getView method of the Adapter class. The first button was something I couldn't figure out, because I needed to identify in which listview the button was clicked and the position of the clicked row which I couldn't realize how to do. The second one I thought would be easier since all I needed to do was Intents. However I needed to call a method from the activity class (had to instance it) since I couldn't make Intents in a non-activity class. This last one threw a NullPointerException. Will post all code &amp; logcat in a while, be right back, any possible help will be appreciated.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41737966
has title: Changing activities with Intent on listview button
score: 0
tagged with: android-listview

http://stackoverflow.com/q/26621995
downvote count: 0
tagged with: reflection
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41854465
upvote count: 2
has comment: http://stackoverflow.com/comment/41854414
answer count: 2
has comment: http://stackoverflow.com/comment/41854472
favorite count: 0
possible better answer: http://stackoverflow.com/a/26622171
has answer: http://stackoverflow.com/a/26622171
has answer: http://stackoverflow.com/a/26622079
has title: Creating an array of fields in Java
accepted answer: http://stackoverflow.com/a/26622079
has body: I am trying to implement program that will create an array out of the fields of a certain class and then access each field I have the following class: public class Example { public int[] a = {1,2,3}; public int[] b = {1,1,1}; public int[] c = {2,2,2}; } In a different class I want to access all of these fields and place them into the array "testArray" import java.lang.reflect.Field; public class Test { Example t = new Example(); Field[] testArray = t.getClass().getFields(); for (Field elem: testArray) { // access the fields } } How can I access the fields this way? NOTE: for some reasone this gives me an error of Syntax error on token ";", { expected after this token
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/41730844
score: 0
comment on: http://stackoverflow.com/q/26554386
type: Comment
type: QuestionComment
has text: Then call `worker2.execute()` in done method of first `worker` and close the `dialog` in `done` method of `worker2`.

http://stackoverflow.com/q/26571234
has title: Defining ArrayList gives error
type: UnansweredQuestion
tagged with: arraylist
score: -2
has body: I've been working on a program in which augmetnts can be installed. Within the ship class I have this down: public ArrayList&lt;Augment&gt; installedAugments = new ArrayList&lt;Augment&gt;(){ ArrayList IA = new ArrayList &lt;Augment&gt;(); for (Augment a:theGame.augments){ if (a.installed){ IA.add(a); } } return IA; } (the Game.augments is public) The error as Eclipse detects it is after delcaring IA they want a {, which does not make sense as I have a nearly identical function which runs perfectly well.
favorite count: 0
type: Question
answer count: 2
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26571243
has answer: http://stackoverflow.com/a/26571258
upvote count: 0

http://stackoverflow.com/a/26542032
type: Answer
accepted answer of: http://stackoverflow.com/q/26534659
upvote count: 2
answers question: http://stackoverflow.com/q/26534659
has body: Okay, so apparently Gradle didn't like my java build. I switched it to java-7-oracle by using this method
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26541511
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26542474
linked to: http://stackoverflow.com/q/19894607
tagged with: java
has answer: http://stackoverflow.com/a/26542582
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26541618
possible better answer: http://stackoverflow.com/a/26541618
tagged with: sockets
has body: I've a problem. I'm trying to create a thread for communcation with a tcp server. My problem is that i need to shutdown the thread. How can I do this? I tried .interrupt, .stop, and that didn't work. Best Regards Chat thread = new Chat(socket, reuniao[0], username); public class Chat implements Runnable{ Socket socket; boolean corre; String reuniao, username; BufferedReader input; PrintWriter out; Scanner sc; public Chat(Socket socket, String reuniao, String username) { this.socket = socket; this.reuniao = reuniao; this.username = username; corre = true; new Thread(this, "").start(); } @Override public void run() { sc = new Scanner(System.in); try { input = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { out = new PrintWriter(socket.getOutputStream(), true); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String answer = null; out.println("Download Chat#"+reuniao); try { answer = input.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("I'm ready!"); ArrayList&lt; String &gt; salaChat = new ArrayList&lt; String &gt;(); String [] chatCompleto = answer.split("#"); for(int i = 0; i &lt; chatCompleto.length; i++){ salaChat.add(chatCompleto[i]); System.out.println(chatCompleto[i]); } while(!Thread.currentThread().isInterrupted()){ if(corre == false) return; out.println("Download Chat#"+reuniao); try { answer = input.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String [] temp = answer.split("#"); for(int i = 0; i &lt; temp.length; i++){ int testa = 0; for(int j = 0; j &lt; salaChat.size(); j++){ if(temp[i].equals(salaChat.get(j))){ testa = 1; } } if(testa == 0){ salaChat.add(temp[i]); String [] aux = temp[i].split(":"); if(!username.equals(aux[0]) &amp;&amp; temp[i] != null){ System.out.println(temp[i]); } } } } }…
has title: How stop or kill a thread in java?
has comment: http://stackoverflow.com/comment/41707609
has answer: http://stackoverflow.com/a/26542474
tagged with: tcp
tagged with: multithreading

http://stackoverflow.com/comment/41864365
type: Comment
comment on: http://stackoverflow.com/a/26627232
has text: Thanks for your replay, it's really instructive for me. My `XMLCatalogResolver` (from `org.apache.xerces.util`) only implements `EntityResoler` and `XMLEntityResolver`, doesn't extends `CatalogResolver`. I added this and overrided `getResolvedEntity` method with only `System.out.print` and calling `super.getResolvedEntity` method, but my program didn't use is... I forgot to write this - I have to modify sbd else code, I'm not writing this from the begining
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41865530
comment on: http://stackoverflow.com/q/26628303
has text: `clearConsoleFunction ` is an interface . why do you want to put it into the `Map`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/131624565
type: AnswerComment
comment on: http://stackoverflow.com/a/31273697
score: 0
type: Comment
has text: the same does IBM Business Automation Workflow or App Connect Enterprise.

http://stackoverflow.com/q/26548897
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/41735516
linked to: http://stackoverflow.com/q/9460018
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/26549136
tagged with: special-characters
has comment: http://stackoverflow.com/comment/41720781
score: 0
tagged with: plsql
has title: Problems with characters executing a sentence SQL from JAVA
answer count: 1
has body: I have store in a table in oracle data base this String: CREATE OR replace PROCEDURE P_algorithm_ptcrb_2 ( s_result IN OUT VARCHAR2, i_config IN NUMBER, i_user IN NUMBER, s_name IN VARCHAR2, i_general_features IN NUMBER, i_pic IN NUMBER) AS s_aviso VARCHAR2(2000); /*TYPE array_varchar2 IS TABLE OF VARCHAR2(2) INDEX BY BINARY_INTEGER;*/ l_categories pkg_ptcrb.array_varchar2; l_bands pkg_ptcrb.array_varchar64; l_test_requirements VARCHAR2(256); l_technologies VARCHAR2(256); i_test_plan_generation NUMBER; i_error_pic NUMBER; BEGIN /* Hora de inicio */ SELECT 'Start_ ' || To_char(SYSDATE, 'HH24_MI_SS') INTO s_aviso FROM dual; dbms_output.Put_line(s_aviso); /* ********************* */ /* STEP 0_ New test plan */ /* ********************* */ s_aviso := '0.- New test plan.'; EXCEPTION WHEN OTHERS THEN Raise_application_error(-20001, 'An error was encountered - ' ||SQLCODE ||' -ERROR- ' ||SQLERRM); END p_algorithm_ptcrb_2; I need to execute this sentence from a java application to create dynamically a store procedure in oracle. I'm using hibernate and before execute the sentence I replace the character ':' to '\:' and now I have this code: CREATE OR replace PROCEDURE P_algorithm_ptcrb_2 ( s_result IN OUT VARCHAR2, i_config IN NUMBER, i_user IN NUMBER, s_name IN VARCHAR2, i_general_features IN NUMBER, i_pic IN NUMBER ) AS s_aviso VARCHAR2(2000); /*TYPE array_varchar2 IS TABLE OF VARCHAR2(2) INDEX BY BINARY_INTEGER;*/ l_categories pkg_ptcrb.array_varchar2; l_bands pkg_ptcrb.array_varchar64; l_test_requirements VARCHAR2(256); l_technologies VARCHAR2(256); i_test_plan_generation NUMBER; i_error_pic NUMBER; BEGIN /* Hora de inicio */ SELECT 'Start_ ' || To_char(SYSDATE, 'HH24_MI_SS') INTO s_aviso FROM dual; dbms_output.Put_line(s_aviso); /* ********************* */ /* STEP 0_ New test plan */ /* ********************* */ s_aviso \\:= '0.- New test plan.'; EXCEPTION WHEN OTHERS THEN Raise_application_error(-20001,'An error was encountered - ' ||SQLCODE ||' -ERROR- ' ||SQLERRM); END…

http://stackoverflow.com/q/26559700
score: -3
upvote count: 0
has answer: http://stackoverflow.com/a/26559836
tagged with: java
has body: // a program tells the maximum value we can store in (unsigned integer) a given bits .( 256 for 8 bits) int counter=0; int last= 0b11111111; for(int first=0b00000000;first&lt;=last;counter++) { first=first + 1;//adding 1(binary addition) } System.out.println("for "+ variable "bits u can store "+counter values"); //variable here 8. //(1.how to get it from user? 2.how to convert it into binary 0b00000000?) //how to do this without 0b ,actually in previous version of java //a program in which if you give 8 bit(in case of unsigned) then it give u maximum values u can store in it, not by using ((2*n)-1). //code is not only for java 8 // sorry i do not have java 8 i hope the above code will compile without error thank you in advance
has comment: http://stackoverflow.com/comment/41758658
type: Question
has title: finding maximum value from a given bits
has answer: http://stackoverflow.com/a/26559985
answer count: 3
downvote count: 3
has answer: http://stackoverflow.com/a/26559772
favorite count: 0
tagged with: binary
type: UnansweredQuestion

http://stackoverflow.com/comment/41682460
score: 0
type: AnswerComment
type: Comment
has text: hmm now it says it cannot find symbol domain
comment on: http://stackoverflow.com/a/26527790

http://stackoverflow.com/a/26559947
type: Answer
has comment: http://stackoverflow.com/comment/41743224
has comment: http://stackoverflow.com/comment/41743390
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41741960
has body: Don't use WEB-INF with Spring applications; it's always been fragile, and Spring can look in jars on the classpath. Put your files in src/main/resources/templates and don't specify any spring.view.prefix.
has comment: http://stackoverflow.com/comment/41741306
has comment: http://stackoverflow.com/comment/41740626
has comment: http://stackoverflow.com/comment/41741241
downvote count: 0
has comment: http://stackoverflow.com/comment/41740835
has comment: http://stackoverflow.com/comment/41743303
answers question: http://stackoverflow.com/q/26559913

http://stackoverflow.com/a/26585442
answers question: http://stackoverflow.com/q/26578991
score: 0
has body: You don't have to lookup the treeview with : treeview = (TreeView) iconOverview.lookup("#treeview"); You automatically retrieve the treeView with the fx:id defined in the fxml file and the annotation @FXML in the controller.
has comment: http://stackoverflow.com/comment/41819577
has comment: http://stackoverflow.com/comment/41812424
type: Answer

http://stackoverflow.com/comment/41903710
has text: For me it looks like it's not necessary, neither possible to make a switch from this if's
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26649752
score: 2

http://stackoverflow.com/q/26669333
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41939415
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/26669851
answer count: 1
has comment: http://stackoverflow.com/comment/41939424
has body: UserDetails.java @Entity @Table(name="userdetails") public class UserDetails { //@Id @GeneratedValue(strategy=GenerationType.AUTO) @Id @Embedded //@EmbeddedId private int userId; private String userName; @Embedded @AttributeOverrides({ @AttributeOverride(name="street",column=@Column(name="home_street_name")), @AttributeOverride(name="city",column=@Column(name="home_city_name")), @AttributeOverride(name="state",column=@Column(name="HOME_STATE_NAME")), @AttributeOverride(name="pincode",column=@Column(name="HOME_PINCODE")) }) private Address homeAddress; @Embedded private Address officeAddress; public Address getHomeAddress() { return homeAddress; } public void setHomeAddress(Address homeAddress) { this.homeAddress = homeAddress; } public Address getOfficeAddress() { return officeAddress; } public void setOfficeAddress(Address officeAddress) { this.officeAddress = officeAddress; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } } Address.java @Embeddable public class Address { @Column(name="street_name") private String Street; @Column(name="city_name") private String city; @Column(name="state_name") private String state; @Column(name="pin_code") private String pincode; public String getStreet() { return Street; } public void setStreet(String street) { Street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getPincode() { return pincode; } public void setPincode(String pincode) { this.pincode = pincode; } } when am running getting exception that, Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: embedded.UserDetails column: street_name (should be mapped with insert="false" update=…
score: 0
has comment: http://stackoverflow.com/comment/41939722
favorite count: 0
has title: Exception : org.hibernate.MappingException: Repeated column in mapping for entity
has answer: http://stackoverflow.com/a/26669851

http://stackoverflow.com/a/26599807
type: Answer
answers question: http://stackoverflow.com/q/26599497
score: 0
has body: From the code you pasted for MainActivity, it looks like you are mixing two different ways to handle button clicks. If you can to register the click listener from your layout xml, the method corresponding to the onClick attribute needs to be public and not declared as a method inside your button1 listener. An alternative is to listen to click events solely with your Java code. If you do this, then remove the onClick attribute from your layout XML for that button. There are many, many examples out there. button1.setOnClickListener(new View.OnClickListener(){ public void onClick(View view){ //TODO -- In your case, start the "Intro" activity } } It might help if you extract that method to start the Intro activity to a method outside of the click listener (i.e., as a method of MainActivity).

soap
tags question: http://stackoverflow.com/q/26547870
tags question: http://stackoverflow.com/q/26603096
type: Tag
tags question: http://stackoverflow.com/q/26637338
tags question: http://stackoverflow.com/q/26545439
tags question: http://stackoverflow.com/q/26527602
tags question: http://stackoverflow.com/q/26602463
tags question: http://stackoverflow.com/q/26561771
tags question: http://stackoverflow.com/q/26599983
tags question: http://stackoverflow.com/q/26607303
tag name: soap
tags question: http://stackoverflow.com/q/26579409

http://stackoverflow.com/q/26668142
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44751789
tagged with: java
tagged with: ivy
has title: can not import class from apache ivy dependencies in eclipse project build path
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26669829
tagged with: ant
has answer: http://stackoverflow.com/a/26706265
score: 0
has body: Hi i'm new to apache ant and ivy.i recently known ant does not support dependency management.so i hear about IVY ,a dependency manager for ant.Now the problem is , i have added ivy dependency to ivy.xml file <info organisation="com.mlen" module="testApp"/> <dependency org="net.sourceforge.jdatepicker" name="jdatepicker" rev="1.3.2"/> Which is a jdatepicker for swing application. Now the problem is when i try to access the dependency class, it does not import classes. ivy downloaded the dependency to lib folder under project dir. My build.xml file <!-- xmlns:ivy="antlib:org.apache.ivy.ant">--> <property name="src.dir" value="src"/> <property name="lib.dir" value="lib"/> <property name="build.dir" value="build"/> <property name="classes.dir" value="${build.dir}/classes"/> <property name="jar.dir" value="${build.dir}/jar"/> <property name="main-class" value="com.mlen.testApp.HelloWorld"/> <fileset dir="${lib.dir}" includes="**/*.jar"/> <delete dir="${build.dir}"/> <ivy:retrieve/> <mkdir dir="${classes.dir}"/> <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/> <fileset dir="${src.dir}" excludes="**/*.java"/> <mkdir dir="${jar.dir}"/> <attribute name="Main-Class" value="${main-class}"/> <attribute name="Class-Path" value="log4j-1.2.17.jar"/> And finally my main class. public class HelloWorld extends JFrame { public HelloWorld(){ UtilDateModel model = new UtilDateModel(); JDatePanelImpl datePanel = new JDatePanelImpl(model); JDatePickerImpl datePicker = new JDatePickerImpl(datePanel); add(datePicker); setSize(300, 200); setVisible(true); } public static void main(String[] args) { new HelloWorld(); } } Why is not importing to class. am i doing it right????

http://stackoverflow.com/comment/41748758
type: QuestionComment
comment on: http://stackoverflow.com/q/26564250
has text: possible duplicate of [where is a static method and a static variable stored in java. In heap or in stack memory](http://stackoverflow.com/questions/8387989/where-is-a-static-method-and-a-static-variable-stored-in-java-in-heap-or-in-sta)
score: 0
type: Comment

http://stackoverflow.com/a/26595669
has comment: http://stackoverflow.com/comment/41811006
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41810470
accepted answer of: http://stackoverflow.com/q/26595265
answers question: http://stackoverflow.com/q/26595265
type: Answer
has comment: http://stackoverflow.com/comment/41810565
has comment: http://stackoverflow.com/comment/41806171
has comment: http://stackoverflow.com/comment/41811104
has comment: http://stackoverflow.com/comment/41806044
has comment: http://stackoverflow.com/comment/41808785
has body: A possible way would be adding a new field to the class Die that will represent the lock: public class Die { // omitted existing fields private boolean locked = false; void roll() { if (!locked) { face = (int)(Math.random() * 6 + 1); } } // omitted existing getter and setter public void setLocked(final boolean locked) { this.locked = locked; } public boolean isLocked() { // this getter is maybe not necessary return locked; } } This lock prevents the roll method from changing the current value. And your listener for the first checkbox could look like this: Dice1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { die1.setLocked(Dice1.isSelected()); } }); This listener set the current state of the checkbox to the locked field. Therefore, if the checkbox is selected, then the locked field is set to true and method call die1.roll() won't change it's current value. That way you don't have to change your current roll() and draw(dk) calls. Don't forget to declare your Dice1 component as final, or else it won't be possible to use it inside the listener: final JCheckBox Dice1 = new JCheckBox("Dice 1"); It might also be necessary to declare die1 as final, as well.
has comment: http://stackoverflow.com/comment/41808968
score: 0

http://stackoverflow.com/comment/42183065
comment on: http://stackoverflow.com/a/26626603
type: AnswerComment
has text: @nomoa Yup, i like it way more now! (thus the upvote). If you have any source on how the "protect the field" approach is good practise i would enyoj raeding it.
score: 0
type: Comment

http://stackoverflow.com/comment/41744404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26562085
has text: I didn't get your question. Member_Registration and Login both tables is in ADGSS database.
score: 0

http://stackoverflow.com/a/26543591
score: 0
answers question: http://stackoverflow.com/q/26543498
type: Answer
has body: You should instanciate your streaming Class so that you can respond to its running methods as you like. Or change your code to public ImageShower(final VideoStream localStream) {}

http://stackoverflow.com/a/26587803
has body: Try this. It checks if the number contains a . char which would make it a double try { if(!NumOfUnitsField.getText().contains(".")){ throw new NumberFormatException("Not a double"); } double itemVolume = Double.parseDouble(NumOfUnitsField.getText()); } catch (NumberFormatException exception) { SetErrorField("Input must be the appropriate type (real number for volume, integer for units)"); } EDIT: combined with codeboxs answer a solution would be try { Pattern p = Pattern.compile("\\d+\\.\\d+"); if(!p.matcher(NumOfUnitsField.getText()).matches()){ throw new NumberFormatException("Not a double"); } double itemVolume = Double.parseDouble(NumOfUnitsField.getText()); } catch (NumberFormatException exception) { SetErrorField("Input must be the appropriate type (real number for volume, integer for units)"); }
accepted answer of: http://stackoverflow.com/q/26587698
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26587698
has comment: http://stackoverflow.com/comment/41790530
has comment: http://stackoverflow.com/comment/41790983
has comment: http://stackoverflow.com/comment/41791033
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41790554

http://stackoverflow.com/a/26626181
answers question: http://stackoverflow.com/q/26626106
has comment: http://stackoverflow.com/comment/41862251
score: 1
has body: May be you try this way.. Instead of this code System.out.println("Enter name"); //Problem here, name input gets skipped name1 = in.nextLine(); try this System.out.println("Enter name"); name1 = in.next();
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/41862849
has comment: http://stackoverflow.com/comment/41861705
type: Answer

http://stackoverflow.com/a/26636090
score: 1
answers question: http://stackoverflow.com/q/26635906
has comment: http://stackoverflow.com/comment/41880833
upvote count: 1
has comment: http://stackoverflow.com/comment/41881093
has body: mileage=(fillUpArray(scan).get(i+1).getOdometer()-fillUpArray(scan).get(i).getOdometer())/fillUpArray(scan).get(i+1).getGallons(); The above line tries to call getOdometer() and getGallons() using an instance Object class. You have to downcast to FillUp object before calling that method. The modified code will be: mileage=((FillUp)fillUpArray(scan).get(i+1).getOdometer()-(FillUp)fillUpArray(scan).get(i).getOdometer())/(FillUp)fillUpArray(scan).get(i+1).getGallons(); Note : better practice would be to return the same list of Objects as desired.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/44968221
type: Comment
type: QuestionComment
has text: I never got this to work with logback, but succeeded in getting my application to use log4j2, and the Tomcat container to use JUL. The trick to getting it working 100% is to make sure your transitive dependencies don't include an SLFJ logging implementation by adding "exclude" clauses to their "dependency" declarations in your POM file (if you are using Maven). In my log4j2.xml file, I send the log events from certain dependencies to different files by filtering the package namespaces, and keep the logs separate in that manner.
score: 0
comment on: http://stackoverflow.com/q/26636958

http://stackoverflow.com/a/26596928
answers question: http://stackoverflow.com/q/26596857
score: 3
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: The method requires an InputStream as argument, you cannot pass in a File or an URL instead. Simply pass in an InputStream: recognizer.startRecognition(new FileInputStream("D:/audio.mp3"));
accepted answer of: http://stackoverflow.com/q/26596857
downvote count: 0

http://stackoverflow.com/q/26634777
has answer: http://stackoverflow.com/a/26661823
accepted answer: http://stackoverflow.com/a/26661823
has body: I'm creating a Payment for the REST API through the PayPal SDK. Everything seems to work fine, the redirect to paypal, the payment itself. But when I return to my shop from paypal, the returnUrl has a "/" added to its end. Instead of http://192.168.41.174/confirm I'm being redirected to http://192.168.41.174/confirm/ The payload of the payment creation request is: { "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "currency": "EUR", "total": "21.27", "details": { "shipping": "4.99", "subtotal": "16.28" } }, "description": "Thank you for your purchase!" } ], "redirect_urls": { "return_url": "http://192.168.41.174/confirm", "cancel_url": "http://192.168.41.174/checkout" } } So I can pretty much exclude an error on my side. Except if there is another configuration for return URLs that I don't know of? If I manually remove the added slash, but keep the parameters, the payment can be processed and even captured. It's only the added slash out of nowhere that doesn't work.
tagged with: paypal
type: AnsweredQuestion
has title: Slash ("/") added to my return URL
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: rest

http://stackoverflow.com/comment/41940117
comment on: http://stackoverflow.com/q/26669649
score: 0
type: Comment
has text: @PramodYadav: The results for $response[data] is coming up properly if I just change response.getJSONArray("success"); to response.getJSONArray("data"); How?
type: QuestionComment

http://stackoverflow.com/comment/42071404
comment on: http://stackoverflow.com/a/26596612
type: Comment
has text: No work around. You should not use inner class in this case. Make the inner class an independent one (use new java file for this class) and remove static
score: 0
type: AnswerComment

distinct
tag name: distinct
type: Tag
tags question: http://stackoverflow.com/q/26629542

http://stackoverflow.com/comment/41926466
type: QuestionComment
has text: some simple debugging would have found the cause of the problem. Coming on to the internet to find the answer probably took you more time, and didn't teach you a valuable skill
comment on: http://stackoverflow.com/q/26657634
score: 0
type: Comment

http://stackoverflow.com/a/26554171
has body: What about Heap? Then just merge that heaps.
answers question: http://stackoverflow.com/q/26553628
type: Answer
score: 0

http://stackoverflow.com/q/26602291
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41818004
has comment: http://stackoverflow.com/comment/41818015
has answer: http://stackoverflow.com/a/26602398
answer count: 6
has title: how to get the current date and time of the system in java
type: Question
has comment: http://stackoverflow.com/comment/41817936
has answer: http://stackoverflow.com/a/26602477
favorite count: 0
has comment: http://stackoverflow.com/comment/41817969
has answer: http://stackoverflow.com/a/26602525
score: 0
accepted answer: http://stackoverflow.com/a/26602398
possible better answer: http://stackoverflow.com/a/26602330
has comment: http://stackoverflow.com/comment/41817933
has answer: http://stackoverflow.com/a/26602330
has comment: http://stackoverflow.com/comment/41817965
has comment: http://stackoverflow.com/comment/41817995
upvote count: 2
has body: I need to get the current date and time of the system in Java and the put a condition that if its 12 PM then send mail to some people. Basically a timer. So how can I achieve it ? I don't want to use quartz timer or crontab expression but want to to do it in Java only. Please explain with the help of an example.
has comment: http://stackoverflow.com/comment/41817949
has answer: http://stackoverflow.com/a/26602368
downvote count: 2
has answer: http://stackoverflow.com/a/26602333

http://stackoverflow.com/comment/41779742
type: QuestionComment
comment on: http://stackoverflow.com/q/26581528
has text: without unmasking, Overridden method is working fine. But Overloaded method is not working why like this?
score: 0
type: Comment

http://stackoverflow.com/comment/41893824
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26643725
has text: Read the exception - they don't just give you all that info for fun you know, it's actually a key diagnostic tool. In your case something is null at line 57 of DiceSimulator.java
type: Comment

http://stackoverflow.com/a/26594883
has body: Just to add to what @JoriO posted, Can you please test to see if the web element exists before clicking on it using Selenium? If it doesn't exists, add a thread sleep statement after driver.get(url)... Reason being that Selenium may try to click before the driver finishes loading the page. This has fixed most of the problems I have experienced using Selenium error "No Such Element Exception"
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/26522739
type: Answer

http://stackoverflow.com/comment/41891740
has text: Or better yet, remove the parameters from the getter.
comment on: http://stackoverflow.com/a/26642504
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42524681
type: Comment
has text: I suggest that you try to change that from your activity, if that succeeds than you have your problems in your fragment. If not than you must have some piece of code in activity that doesn't allow you to change that.
score: 0
comment on: http://stackoverflow.com/q/26542995
type: QuestionComment

http://stackoverflow.com/comment/41845509
has text: It would help if you gave a hint about what the user was doing. What is the application that the user is logging on to? What scenario do you want to handle?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26601279

http://stackoverflow.com/comment/41850670
type: Comment
comment on: http://stackoverflow.com/a/26519276
score: 1
type: AnswerComment
has text: OK, got my answer! setScrollWhenFocused :)

http://stackoverflow.com/comment/42022706
score: 0
comment on: http://stackoverflow.com/a/26714370
type: AnswerComment
type: Comment
has text: All of them, not just the Store/Publisher, correct?

http://stackoverflow.com/a/26589898
accepted answer of: http://stackoverflow.com/q/26589524
type: Answer
answers question: http://stackoverflow.com/q/26589524
upvote count: 2
has body: A java.io.File represents a name of a file physically existing (or not) on some attached storage device. A ZipEntry on the other hand is just some meta-data that help you access the content of the specific entry inside the .zip file. To answer your first question: if you MUST have a java.io.File instance, then the quickest way is to extract the whole zip file (or the parts you want) onto the disk, and then use File from then on. But, quite possibly the thing you want to do doesn't need to use a File, and could work with an InputStream instead. In that case you can just provide it the stream instance you have there. This will deliver better performance, and avoids working with the file system (create files, use them, make sure to clean up, etc).
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26573720
tagged with: java
tagged with: listview
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41765334
accepted answer: http://stackoverflow.com/a/26573919
tagged with: android
has body: I have an Android application with an AsyncTask which is responsible for downloading a file from the internet. This AsyncTask is executed when clicking on an item in a Listview. So I have a custom adapter and in the OnItemClickListener of the Listview, I start the download and execute the AsyncTask. Now, my adapter contains the following code to start the AsyncTask named FileDownloader: @Override public void onClick(View view) { try { FileDownloader fd = new FileDownloader(activity); // some irrelevant code here String filepath = fd.execute("http://myurl.com/img.png", PDFFileName, GameHistoryAdapter.this.gameInfo.toString()).get(); } catch(Exception e) { e.printStackTrace(); } } Activity is a private field that is passed to the adapter in the constructor of the adapter: public GameHistoryAdapter(Activity a, int selectedIndex) { this.activity = a; } The FileDownloader class contains an OnPreExecute method where I want to show the progress dialog on the activity: @Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(activity); dialog.setMessage("Downloading..."); dialog.setIndeterminate(true); dialog.setCancelable(true); dialog.show(); } But whatever I try, the dialog does not appear. When I create an alert dialog in the OnPostExecute method of the AsyncTask, the dialog will show. @Override protected void onPostExecute(String res) { super.onPostExecute(res); dialog.hide(); new AlertDialog.Builder(activity) .setTitle(activity.getString(R.string.save_pdf_title_text)) .setMessage(activity.getString(R.string.save_pdf_text) + PDFFileName) .setPositiveButton(activity.getString(R.string.close_text), null) .setIcon(android.R.drawable.ic_dialog_info) .show(); } Does anyone know why the dialog is not appearing on my activity?
tagged with: android-asynctask
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
has title: Progress Dialog not showing up in AsyncTask
has answer: http://stackoverflow.com/a/26573919
tagged with: dialog

http://stackoverflow.com/q/26653498
tagged with: centos
score: 0
tagged with: linux
tagged with: yum
tagged with: centos7
has body: I had an old link a rmp.bin file to a version of JDK I don't think exists in any repro's anymore so I downloaded it onto my box and tried to install it but I keep getting the error below. How do I determine what the issue is? I assumed that since I had the actual .bin file that yum would have everything it needed? sudo yum install jdk-6u45-linux-x64-rpm.bin Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 epel/x86_64/metalink | 14 kB 00:00:00 epel | 4.4 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/3): extras/7/x86_64/primary_db | 33 kB 00:00:00 (2/3): updates/7/x86_64/primary_db | 4.2 MB 00:00:00 (3/3): epel/x86_64/primary_db | 3.4 MB 00:00:01 (1/2): epel/x86_64/updateinfo | 105 kB 00:00:00 (2/2): epel/x86_64/pkgtags | 1.3 MB 00:00:00 Loading mirror speeds from cached hostfile * base: mirror.fdcservers.net * epel: mirror.nexcess.net * extras: mirror.fdcservers.net * updates: mirror.fdcservers.net No package jdk-6u45-linux-x64-rpm.bin available. Error: Nothing to do
has answer: http://stackoverflow.com/a/26653563
type: Question
type: AnsweredQuestion
tagged with: java
has title: Yum No Package available Java JDK
answer count: 1
accepted answer: http://stackoverflow.com/a/26653563

http://stackoverflow.com/comment/41721618
comment on: http://stackoverflow.com/a/26544772
has text: thats right. now for each question you need to load your imagebuttons with answers programatically (something like **.settext(text)** or **.setimagedrawable(drawable)**
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26621830
has comment: http://stackoverflow.com/comment/41855422
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41855001
tagged with: swing
linked to: http://stackoverflow.com/q/2561690
score: 1
has comment: http://stackoverflow.com/comment/41855109
tagged with: java
has body: I have a game board, with 8 pieces that I would like to be able to move them anywhere on the jpanel. Currently, I can only do flow or grid layout, however this does not yield the desired results. The long term goal, is to be able to independently click on a piece and drag it to desired location/position. (including on top of other pieces) Any suggestions or input would be most welcome... (Thanks to Hovercraft Full Of Eels, MadProgrammer, peeskillet, Andrew Thompson for their earlier suggestions).... import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Image; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JLayeredPane; import javax.swing.JPanel; public class FireflyGameBoard extends JFrame implements MouseListener, MouseMotionListener { JLayeredPane layeredPane; JPanel gameBoard; // JPanel background; JLabel gamePiece; int xAdjustment; int yAdjustment; ImageIcon bgicon; Image bg; String Rimagepath = "/Users/yournamehere/Documents/workspace/MotionGraphicsTest/resources/"; public FireflyGameBoard() { Dimension boardSize = new Dimension(1920, 1080); bgicon = new ImageIcon(Rimagepath + "Backdroptest.png"); bg = bgicon.getImage(); ImagePanel background = new ImagePanel(new ImageIcon(Rimagepath + "Backdroptest.png").getImage()); // Use a Layered Pane for this this application layeredPane = new JLayeredPane(); getContentPane().add(layeredPane); layeredPane.setPreferredSize(boardSize); layeredPane.addMouseListener(this); layeredPane.addMouseMotionListener(this); // Add a chess board to the Layered Pane gameBoard = new ImagePanel(bg); layeredPane.add(background, JLayeredPane.DEFAULT_LAYER); layeredPane.add(gameBoard, JLayeredPane.MODAL_LAYER); gameBoard.setLayout(new FlowLayout()); gameBoard.setPreferredSize(boardSi…
tagged with: jpanel
upvote count: 1
has answer: http://stackoverflow.com/a/26624184
type: Question
linked to: http://stackoverflow.com/q/26513957
has comment: http://stackoverflow.com/comment/41854114
linked to: http://stackoverflow.com/q/11201734
downvote count: 0
answer count: 1
favorite count: 0
has title: JLayeredPanel layout manager free moving objects

http://stackoverflow.com/a/26575393
has body: Here you are assigning swap to be equal to true. while (swap = true) { I guess you want to compare it instead. boolean swap = true; while (swap == true){ //Or better while (swap){ swap = false;
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41768905
answers question: http://stackoverflow.com/q/26575286
type: Answer

http://stackoverflow.com/q/26586506
score: 4
linked to: http://stackoverflow.com/q/1998544
answer count: 2
has answer: http://stackoverflow.com/a/46857444
has comment: http://stackoverflow.com/comment/41790121
has body: I completely get this question Method has the same erasure as another method in type and the answer to it. Please can anyone help me understand the below? Trying hard to digest, why the 2nd code snippet below gives compiler error? Code 1: Compiles fine class Parent { public void set(Collection&lt;Integer&gt; c) { } } class Child extends Parent { public void set(Collection&lt;Integer&gt; c) {} } Code 2: Compiler Error at set method in Child class. class Parent { public void set(Collection&lt;?&gt; c) { } } class Child extends Parent { public void set(Collection&lt;Integer&gt; c) {} } Compiler Error is Name clash: The method set(Collection) of type Child has the same erasure as set(Collection) of type Parent but does not override it
favorite count: 0
linked to: http://stackoverflow.com/q/502614
has title: Method has the same erasure as another method in type - part 2
has comment: http://stackoverflow.com/comment/41788260
tagged with: generics
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26586815
downvote count: 1
type: Question
upvote count: 5
tagged with: java
tagged with: overriding

http://stackoverflow.com/a/33597750
downvote count: 0
score: 23
has comment: http://stackoverflow.com/comment/138541096
upvote count: 23
type: Answer
answers question: http://stackoverflow.com/q/26548505
has body: I also faced a similar issue. But, it was due to the invalid password provided. Also, I would like to say your code seems to be old-style code using spring. You already mentioned that you are using spring boot, which means most of the things will be auto configured for you. hibernate dialect will be auto selected based on the DB driver available on the classpath along with valid credentials which can be used to test the connection properly. If there is any issue with the connection you will again face the same error. only 3 properties needed in application.properties file: # Replace with your connection string spring.datasource.url=jdbc:mysql://localhost:3306/pdb1 # Replace with your credentials spring.datasource.username=root spring.datasource.password=

http://stackoverflow.com/comment/98305931
type: Comment
score: 0
has text: For an environment variable, I would recommend "SPRING_MAIN_BANNER_MODE", with an underscore instead of a "-", in case the server doesn't support dashes in environment variables.
type: AnswerComment
comment on: http://stackoverflow.com/a/26586028

rabbitmq
tags question: http://stackoverflow.com/q/26650128
tags question: http://stackoverflow.com/q/26654062
tag name: rabbitmq
type: Tag
tags question: http://stackoverflow.com/q/26536091
tags question: http://stackoverflow.com/q/26523599
tags question: http://stackoverflow.com/q/26617649
tags question: http://stackoverflow.com/q/26555066

http://stackoverflow.com/comment/42806160
score: 0
type: AnswerComment
has text: @AleksandrM I was trying to use struts2 tag '<s:property value="userId">' into another struts2 tag '<s:if test', but as @Pankaj@ said we cannot do that so, first I set the the value using the set tag '<s:set name="userId" value="userId" />' then I retrieved that value in java scriptless <% request.getParameter()%>
type: Comment
comment on: http://stackoverflow.com/a/26561815

http://stackoverflow.com/comment/41684815
type: Comment
has text: If there is some issue with my asking another but indeed related question, then do tell me citing appropriate SO guidelines.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26529089

http://stackoverflow.com/comment/41718579
comment on: http://stackoverflow.com/q/26547522
score: 0
type: Comment
type: QuestionComment
has text: @Olavi no i dont have. But the user will input 051132 as text. he will not include 19 or 20 infront.

http://stackoverflow.com/a/26549401
has body: while(rs.next()) { arr.add(rs.getString("chair_id")); } This gives you the value of the first column for all the rows in your rs
accepted answer of: http://stackoverflow.com/q/26549300
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26549300

http://stackoverflow.com/a/26573884
score: 110
upvote count: 110
type: Answer
has comment: http://stackoverflow.com/comment/100587351
answers question: http://stackoverflow.com/q/26551439
has body: Create a property file src/main/resources/project.properties with the below content version=${project.version} artifactId=${project.artifactId} Now turn on maven resource filtering src/main/resources true so that this file is processed into target/classes/project.properties with some content similar to this version=1.5 artifactId=my-artifact Now you can read this property file to get what you want and this should work every time. final Properties properties = new Properties(); properties.load(this.getClassLoader().getResourceAsStream("project.properties")); System.out.println(properties.getProperty("version")); System.out.println(properties.getProperty("artifactId"));
accepted answer of: http://stackoverflow.com/q/26551439
has comment: http://stackoverflow.com/comment/117426070
has comment: http://stackoverflow.com/comment/105712939
has comment: http://stackoverflow.com/comment/89918874
has comment: http://stackoverflow.com/comment/70347539
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/62550010
has comment: http://stackoverflow.com/comment/62478945

http://stackoverflow.com/comment/41812063
has text: Oooh, I see. I tried putting it there, but it gives me an error, because the variable "header" doesn't exists. But, if I do set it again, I will end up with just 1 headline again, won't I?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26598472
type: QuestionComment

http://stackoverflow.com/a/26555114
type: Answer
has comment: http://stackoverflow.com/comment/41733598
has comment: http://stackoverflow.com/comment/41734050
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26554746
downvote count: 0
has body: Java's globbing engine is consistent with POSIX globbing, which works a bit differently (and more sanely) than cmd.exe wildcards. POSIX globbing is consistent with the fact that the '.' character is not special in POSIX filenames, contrary to Windows tradition inherited from DOS. Thus, a '*' in a glob pattern can match zero or more characters, including any number of '.' characters, and a '.' appearing in a glob pattern must match a '.' in the filename. This is all covered by the API docs for FileSystem.getPathMatcher(String), by the way, specifically: *.* Matches file names containing a dot and The * character matches zero or more characters of a name component without crossing directory boundaries. Note no special handling documented for the '.' character. Although you can match a single non-dot character with a glob pattern (i.e. "[!.]"), there is no subpattern repetition operator in glob syntax. On the other hand, you can match filenames without extensions pretty easily with regex. This pattern will do it: "[^.]*", supposing that you use Matcher.matches() (as opposed to Matcher.find(), which does not require the whole string to match the pattern.)

http://stackoverflow.com/comment/41702383
comment on: http://stackoverflow.com/a/26537369
score: 0
type: AnswerComment
has text: That's the answer I think.
type: Comment

http://stackoverflow.com/comment/41726488
has text: @nitiger Yes, in a code review I would reject code needlessly using Integer instead of int. Objects incur a huge relative overhead (unless your language specifies some clever tricks, ha ha) for storage of a primitive value.
comment on: http://stackoverflow.com/q/26539546
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26577533
score: 0
answers question: http://stackoverflow.com/q/26557926
has body: Have you add to your servlet-context.xml &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt; to use @Transaction? And also check if @Autowired working right way for example System.out.println(sessionFactory) in your class.java to be sure that isn't null.
type: Answer
has comment: http://stackoverflow.com/comment/41984231

http://stackoverflow.com/q/26664577
has title: Error with bracket placement
type: AnsweredQuestion
upvote count: 0
has body: I am getting this error : Syntax error on token "}", { expected after this token I am not sure what the problem is here and I've checked that the brackets match, or so I think, so I am not entirely clear of how to fix this problem import java.awt.*; public class Player extends Entity { private int directionX, directionY; private Main instance; private Rectangle hitbox; private int life = 3; public Player(Main instance, int x, int y){ super(x , y); this.instance = instance; width = 16; height = 16; hitbox = new Rectangle(x, y, width, height); } public void draw(Graphics g){ move(); g.setColor(Color.WHITE); g.fillOval(hitbox.x, hitbox.y, hitbox.width, hitbox.height); g.setColor(Color.WHITE); g.drawString("Lives: " + life, 20, 20); } private void move(){ if(!instance.getStage().isCollided(hitbox)){ directionY = 1; } else { directionY = 0; hitbox.x += directionX; hitbox.y += directionY; } } // &lt;&lt;&lt;&lt;&lt;&lt; Getting error here &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; if(instance.getEnemyManager().isCollided(hitbox)){ if(life &gt; 0){ life--; hitbox.x = 800 / 2 - width / 2; y = 390; } else { instance.setGameOver(true); } } public void setdirectionX(int value){ directionX = value; } public void setdirectionY(int value){ directionY = value; } } If anyone could answer this question I'd be very happy to know.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26664610
type: Question
answer count: 2
score: -1
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/26664622
has answer: http://stackoverflow.com/a/26664610
possible better answer: http://stackoverflow.com/a/26664622

http://stackoverflow.com/q/26566918
tagged with: garbage-collection
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/53863543
has title: What happens in memory when the Activity is destroyed while its AsyncTask is running?
answer count: 2
has body: I've been playing around with an app I created. Activity A(1st Activity) has a button that executes an AsyncTask. This AsyncTask's doInBackground() performs calculations on selected values in Activity A, and its onPostExecute() starts Activity B. I click the button, then before Activity B can be started I press back to destroy Activity A. The app closes, then relaunches with Activity B populated with calculations from my AsyncTask. this awesome blog explains memory leaks with Threads when the screen is rotated, and I'm applying those lessons here with my AsyncTask and back button press. However, I'm still a little confused. Pressing back on an Activity destroys it. My asynctask is running on an activity that was destroyed, should throw a NPE since it's accessing list elements inside that activity. But it didn't. What does destroyed really mean then? I thought it meant that the Activity A reference and its view hierarchy would be set to null to allow the garbage collector to sweep it up sometime and recycle the memory. The blog states it didn't, hence the memory leak. So wait, Activity A didn't get destroyed? But I saw it disappear... This is a conceptual question rather than a code question so far, but as requested: private class MyAsyncTask extends AsyncTask&lt;ArrayList&lt;Train&gt;, Void, Void&gt; { protected void onPreExecute() { // Runs on the UI thread before doInBackground spinWait.setVisibility(ProgressBar.VISIBLE); waitMsg.setText("Calculating Schedules...."); spinWait.bringToFront(); waitMsg.bringToFront(); } @Override protected Void doInBackground(ArrayList&lt;Train&gt;... lolTrains) { try { calcSchedules(lolTrains[0]); } catch (Exception e) { Log.d("DEBUG", "Calculating schedules failed, " + e.getMessage()); } return null; } @Override protected void onPostExecute(Void v) { // This method is executed in the UIThread spinWait.setVisibility(View.GONE); waitMsg.setVisibility(View.GONE); // if schedules is empty, show error dialog if (schedules.size() == 0) {…
has comment: http://stackoverflow.com/comment/41755115
score: 0
has answer: http://stackoverflow.com/a/26567128
has comment: http://stackoverflow.com/comment/41755173
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/41772885
has comment: http://stackoverflow.com/comment/41759082
has comment: http://stackoverflow.com/comment/41756694
has comment: http://stackoverflow.com/comment/41763840
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/41732171
has text: Are you really a ruby developer?
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26555187

http://stackoverflow.com/comment/41868081
type: AnswerComment
has text: There are 2 optimal solutions for this problem: 1) creating a desktop application that takes care of all printing 2) get php to print to the printer directly using TCP (after creating a PDF, as PCL and PostScript are close to impossible to generate yourself)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26629526

http://stackoverflow.com/a/26522679
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26522615
score: 3
downvote count: 0
has body: traverse from last index (a.length - 1) to 0 return the index when you first encountered the key.

http://stackoverflow.com/comment/41899761
type: Comment
type: QuestionComment
has text: I am looking to only fill lotto[] when boolean returns true.
comment on: http://stackoverflow.com/q/26647330
score: 0

http://stackoverflow.com/comment/41716303
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26546464
type: Comment
has text: Sorry, I forgot the return type: int and String! I modified the post

http://stackoverflow.com/comment/41891066
type: Comment
has text: I did that and got the following error"Failed to load Main-Class manifest attribute from test2.jar"
score: 0
comment on: http://stackoverflow.com/a/26641391
type: AnswerComment

rest
tags question: http://stackoverflow.com/q/26565682
tags question: http://stackoverflow.com/q/26555672
tags question: http://stackoverflow.com/q/26667375
tags question: http://stackoverflow.com/q/26638388
tags question: http://stackoverflow.com/q/26586269
tags question: http://stackoverflow.com/q/26623417
tags question: http://stackoverflow.com/q/26634777
tags question: http://stackoverflow.com/q/26523177
tags question: http://stackoverflow.com/q/26666956
tags question: http://stackoverflow.com/q/26550124
tags question: http://stackoverflow.com/q/26588310
tags question: http://stackoverflow.com/q/26591055
tags question: http://stackoverflow.com/q/26520187
tags question: http://stackoverflow.com/q/26556861
tags question: http://stackoverflow.com/q/26590431
tags question: http://stackoverflow.com/q/26594717
tags question: http://stackoverflow.com/q/26548399
tags question: http://stackoverflow.com/q/26569465
tags question: http://stackoverflow.com/q/26620609
tags question: http://stackoverflow.com/q/26529646
tags question: http://stackoverflow.com/q/26586518
tags question: http://stackoverflow.com/q/26659668
tags question: http://stackoverflow.com/q/26618786
tags question: http://stackoverflow.com/q/26564464
tags question: http://stackoverflow.com/q/26621838
tags question: http://stackoverflow.com/q/26604413
tags question: http://stackoverflow.com/q/26645730
tags question: http://stackoverflow.com/q/26592787
tags question: http://stackoverflow.com/q/26552331
tags question: http://stackoverflow.com/q/26574992
tags question: http://stackoverflow.com/q/26566561
tags question: http://stackoverflow.com/q/26543703
tags question: http://stackoverflow.com/q/26596570
tags question: http://stackoverflow.com/q/26633163
tags question: http://stackoverflow.com/q/26654634
tags question: http://stackoverflow.com/q/26590123
tags question: http://stackoverflow.com/q/26621815
tags question: http://stackoverflow.com/q/26652990
type: Tag
tags question: http://stackoverflow.com/q/26546373
tags question: http://stackoverflow.com/q/26667319
tags question: http://stackoverflow.com/q/26526200
tags question: http://stackoverflow.com/q/26625142
tags question: http://stackoverflow.com/q/26521932
tags question: http://stackoverflow.com/q/26633523
tags question: http://stackoverflow.com/q/26635728
tag name: rest
tags question: http://stackoverflow.com/q/26613035
tags question: http://stackoverflow.com/q/26606307
tags question: http://stackoverflow.com/q/26666071
tags question: http://stackoverflow.com/q/26612551
tags question: http://stackoverflow.com/q/26595887
tags question: http://stackoverflow.com/q/26590042
tags question: http://stackoverflow.com/q/26575541
tags question: http://stackoverflow.com/q/26576301
tags question: http://stackoverflow.com/q/26607054
tags question: http://stackoverflow.com/q/26515552

http://stackoverflow.com/comment/41828011
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26607928
has text: have you tested the app on the real device ? emulators are unreliable
type: Comment

http://stackoverflow.com/q/26566773
linked to: http://stackoverflow.com/q/15847036
has answer: http://stackoverflow.com/a/26566883
type: Question
accepted answer: http://stackoverflow.com/a/26566794
has title: How to use .nextInt() and hasNextInt() in a while loop
tagged with: while-loop
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26567018
has answer: http://stackoverflow.com/a/26566794
score: 6
tagged with: input
linked to: http://stackoverflow.com/q/16136400
upvote count: 6
linked to: http://stackoverflow.com/q/7613526
type: AnsweredQuestion
has body: So I want my program to read an input, which has some integers in one line, for example: 1 1 2 Then it should read every integer separately and print it in a new line. The number of integers the program has to read is not given in advance, so what I am trying to do is use a while loop, which ends after there are no more integers to read. This is the code I wrote: while (scan.hasNextInt()) { int x = scan.nextInt(); System.out.println(x); } but it's not working correctly, because the loop never ends, it just wants the user to input more integers. What am I missing here?
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/26566883
linked to: http://stackoverflow.com/q/16873134
tagged with: java

http://stackoverflow.com/comment/41870870
score: 0
has text: Instead of checking content isEmpty, alternate way to do
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26631382

http://stackoverflow.com/q/26525073
has comment: http://stackoverflow.com/comment/41693837
downvote count: 0
has comment: http://stackoverflow.com/comment/41709707
tagged with: java
has comment: http://stackoverflow.com/comment/41679492
type: Question
has answer: http://stackoverflow.com/a/37964383
has body: I have a class that exctend SimpleUrlAuthenticationSuccessHandler. I tried to autowired another one of my class, annotated as @Component, but when I call this class (the extended one) I get this error: java.lang.NullPointerException com.springgestioneerrori.loginhandler.CustomAuthenticationSuccessHandler.onAuthenticationSuccess(CustomAuthenticationSuccessHandler.java:33) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.successfulAuthentication(AbstractAuthenticationProcessingFilter.java:329) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.successfulAuthentication(AbstractAuthenticationProcessingFilter.java:294) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:219) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) this is the class that extends S…
has comment: http://stackoverflow.com/comment/41679782
upvote count: 3
has title: Can I "autowired" in a class extending another one (SimpleUrlAuthenticationSuccessHandler)?
answer count: 1
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41682895
has comment: http://stackoverflow.com/comment/41680052
score: 3

http://stackoverflow.com/a/26595435
answers question: http://stackoverflow.com/q/26594609
score: 1
upvote count: 1
has body: I did this recently in an app I made. What I did was to add a MouseInputAdapter to the background, in my case the JPanel all the components were sitting on. Then if you clicked anywhere on the window that wasn't another component, the click went "through" to the background and the input adapter got it, allowing me to drag the whole window. To make that work you have to add the input adapter as both a MouseListener and a MouseMotionListener. Here's the controller: GuiController( SView sView, Window win ) { view = sView; ... DragFrame dragListener = new DragFrame( win ); view.addMouseListener( dragListener ); view.addMouseMotionListener( dragListener ); } Window is the top level window that the listener needs to move. It's actually a JFrame that I called setUndecorated( true ); on. SView is a kind of JPanel: public class SView extends javax.swing.JPanel { ... My input adapter: private static class DragFrame extends MouseInputAdapter { private final Window window; int originalX; int originalY; int frameX; int frameY; public DragFrame( Window win ) { if( win == null ) throw new IllegalArgumentException( "window cannot be null here."); window = win; } @Override public void mousePressed( MouseEvent e ) { Point loc = window.getLocationOnScreen(); frameX = loc.x; frameY = loc.y; originalX = e.getXOnScreen(); originalY = e.getYOnScreen(); // System.out.println( this ); } @Override public void mouseDragged( MouseEvent e ) { int newX = frameX + e.getXOnScreen() - originalX; int newY = frameY + e.getYOnScreen() - originalY; window.setLocation( newX, newY ); // System.out.println( this ); } @Override public String toString() { return "DragFrame{" + "originalX=" + originalX + ", originalY=" + originalY + ", frameX=" + frameX + ", frameY=" + frameY + '}'; } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41862702
has text: well, if you override the toString method, it should be fine. Also do 1) and 3)
comment on: http://stackoverflow.com/a/26624969
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/129463027
type: AnswerComment
comment on: http://stackoverflow.com/a/58673555
score: 0
type: Comment
has text: Very good answer, I would complement it with: If you are using ssh tunnel or vpn to access your db, check that you are on line

http://stackoverflow.com/comment/41933407
score: 0
comment on: http://stackoverflow.com/q/26665062
type: Comment
type: QuestionComment
has text: Are you using Apache or HttpsUrlConnection? Looks like Apache right? Why set to SSL rather than TLS?

http://stackoverflow.com/a/49070410
type: Answer
answers question: http://stackoverflow.com/q/26591896
score: 0
has body: You've a composite naturalId key (email,nick) so you can have multiples results with simple email arg. you've to use session .byNaturalId(User.class) .with(LockOptions.READ) .using("email", "admin@mail.com") .using("nick", "admin") .load(); You can also use Metamodel session .byNaturalId(User.class) .with(LockOptions.READ) .using(User_.email.getName(), "admin@mail.com") .using(User_.nick.getName(), "admin") .load();

http://stackoverflow.com/q/26568205
downvote count: 0
tagged with: rmi
tagged with: java
possible better answer: http://stackoverflow.com/a/26575088
has comment: http://stackoverflow.com/comment/41762174
has comment: http://stackoverflow.com/comment/41755415
type: Question
has comment: http://stackoverflow.com/comment/41755949
upvote count: 32
tagged with: arraylist
has answer: http://stackoverflow.com/a/26575282
accepted answer: http://stackoverflow.com/a/26575282
answer count: 2
has title: resolve a java.util.ArrayList$SubList notSerializable Exception
has answer: http://stackoverflow.com/a/26575088
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/41755833
score: 32
has body: I am using SubList function on an object of type List. The problem is that I am using RMI and because the java.util.ArrayList$SubList is implemented by a non-serializable class I got the Exception described above when I try to pass the resulting object to a remote function taking as an argument a List as well. I've seen that I should copy the resulting List to a new LinkedList or ArrayList and pass that. Does anyone know a function that helps as to easily do that for this for example ? List&lt;String&gt; list = originalList.subList(0, 10);
type: AnsweredQuestion

ios
tags question: http://stackoverflow.com/q/26668753
type: Tag
tags question: http://stackoverflow.com/q/26598511
tag name: ios
tags question: http://stackoverflow.com/q/26654550

http://stackoverflow.com/a/26578635
answers question: http://stackoverflow.com/q/26578401
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41774567
type: Answer
has body: If I understand your question, then you could add a while loop to progress past the duplicates after you report one. Like, public static void main(String[] args) { int[] values = { 8, 5, 9, 8, 6, 13, 33, 1, 98, 12, 8, 1 }; Arrays.sort(values); for (int i = 1; i &lt; values.length; i++) { if (values[i] == values[i - 1]) { System.out.println("Duplicates in Array: " + values[i]); while (values[i] == values[i - 1]) { // &lt;-- add this i++; } } } } Output is Duplicates in Array: 1 Duplicates in Array: 8
accepted answer of: http://stackoverflow.com/q/26578401
upvote count: 2

http://stackoverflow.com/comment/41823465
type: QuestionComment
comment on: http://stackoverflow.com/q/26593811
score: 0
has text: You can download the required JAR's from https://truevfs.java.net/kick-start/maven.html or https://truevfs.java.net/kick-start/no-maven.html. The import is import net.java.truevfs.access.TFile;
type: Comment

buttonclick
type: Tag
tag name: buttonclick
tags question: http://stackoverflow.com/q/26631419

http://stackoverflow.com/comment/41844311
score: 0
has text: @MarsAtomic I see nothing tagged as android here.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26614442

http://stackoverflow.com/a/26638070
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26637338
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26637338
downvote count: 0
has body: JAXB2 Inheritance Plugin allows you to make your classes implement a given interface or extends a certain class. Customization directly in the schema: &lt;xs:complexType name="WillBeMadeCloneableType"&gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;inheritance:implements&gt;java.lang.Cloneable&lt;/inheritance:implements&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;!-- ... --&gt; &lt;/xs:complexType&gt; Or in an external binding file: &lt;jaxb:bindings node="xsd:simpleType[@name='MyType']"&gt; &lt;inheritance:implements&gt;java.lang.Cloneable&lt;/inheritance:implements&gt; &lt;/jaxb:bindings&gt; You can also use generics. Customizing WSDLs is a bit trickier, but is also possible. Disclosure: I am the author of the JAXB2 Inheritance plugin which is the part of the JAXB2 Basics package. Documentation is currently being moved to GitHub. Please check the following links: Actual documentation on the plugin Using JAXB2 Basics plugins

http://stackoverflow.com/comment/41710352
type: Comment
has text: I would sugest mentioning `LockSupport` instead of wait/notify. It is a 1-for-1 replacement for wait/notify, but doesn't suffer from race conditions.
comment on: http://stackoverflow.com/a/26543187
score: 0
type: AnswerComment

http://stackoverflow.com/comment/133594429
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26632994
has text: @GismoRanas Could you please provide the reference code snippet. Tried with public MongoItemReader<Customer> reader( @Value("#{stepExecutionContext['offset']}") Integer offset, @Value("#{stepExecutionContext['pageSize']}") Integer pageSize ) { MongoItemReader<Customer> reader = new MongoItemReader<>(); reader.setTemplate(mongoTemplate); reader.setCollection("myCollection"); reader.setQuery("{}"); reader.setPageSize(pageSize); reader.setCurrentItemCount(offset); reader.setTargetType(Customer.class); return reader; }
score: 0

http://stackoverflow.com/q/26590925
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26608339
accepted answer: http://stackoverflow.com/a/26608339
tagged with: windows-services
type: Question
type: AnsweredQuestion
tagged with: apache-commons
has body: I use Apache Commons Daemon to make my Java program run as a windows service. I want the service to start automatically after installation, i.e: Startup Type will be 'Automatically' and Service Status will be 'Started'. I managed to make the Startup Type 'Automatically' (by the param: --Startup=auto), but it does not start automatically. I have to manually click on 'Start' button at the first time and only then it works. How can I set the Status to be 'Started' without the user has to start is manually? Here is my full deployment line: myService.exe //IS//MyService --Install=C:\MyService\bin\myService.exe --Description="My Java Service" --Jvm=auto --Classpath=C:\MyService\classes --StartMode=jvm --StartClass=Test.Service.MyService --StartMethod=windowsService --StartParams=start --StopMode=jvm --StopClass=Test.Service.MyService --StopMethod=windowsService --StopParams=stop --LogPath=C:\MyService\logs --StdOutput=auto --StdError=auto --Startup=auto Thanks
has title: Windows service with Apache Commons Daemon set automatically to start
score: 0

http://stackoverflow.com/a/26558293
upvote count: 1
has body: First, you need to fix your program: rather than declaring an array of arrays Array[], declare an array of base classes Kind, like this: Kind[] kind = new Kind[4]; kind[0] = new Fruit(xxx,yyy,zzz); kind[1] = new Veg(xxx,yyy,zzz); kind[2] = new Fruit(xxx,yyy,zzz); kind[3] = new Veg(xxx,yyy,zzz); Now if you would like to print different things for Fruit and Veg subclasses of Kind, override toString of the two classes as needed. This would let you go through instances of your base class Kind, and printing would be dispatched to the method in the appropriate class: public class Fruit extends Kind { @Override public string toString() { return "Fruit "+ ... // Fill in the text that you wish to print } } public class Veg extends Kind { @Override public string toString() { return "Veg "+ ... // Fill in the text that you wish to print } } Printing can be done like this: for (Kind item : kind) { System.out.println(item.toString()); } The call of toString() above is optional - you can call System.out.println(item); as well. I added the call of toString() to show that there is no "magic" in there.
has comment: http://stackoverflow.com/comment/41738756
accepted answer of: http://stackoverflow.com/q/26558238
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41737678
answers question: http://stackoverflow.com/q/26558238
score: 1

http://stackoverflow.com/a/26658371
type: Answer
answers question: http://stackoverflow.com/q/26658230
upvote count: 4
score: 4
has body: Your layout file inflated by setContentView() in MainActivity.onCreate(MainActivity.java:17) has an ImageButton on line 22 (Binary XML file line #22) and it has an attribute that expects a Drawable but the value is not a Drawable (Resource is not a Drawable (color or path)). Likely it's the android:background since it's handled by the View constructor (View.&lt;init&gt;). Often errors like these are caused by having an unsupported style reference in place of a Drawable. In particular, the resource value read is a dimen resource (TypedValue type 5), not a drawable.
downvote count: 0

http://stackoverflow.com/q/26523360
tagged with: authentication
type: Question
tagged with: dropbox
has body: I want to create my DbxRequestConfig Object with a StandardHttpRequestor, because I need it to use a Proxy. The Proxy is a http Proxy, Port 80, and needs authentication. Proxyaddress: http://myproxy.com Proxyport: 80 Proxyusername: username Proxypassword: password So I tried to use the global Java Proxy setup: System.setProperty("http.proxy","proxyaddress") //... http.proxyUser, http.ProxyPassword //and so on It did not work. After looking into the StandardHttpRequestor I realized I need to use this Object as well as a Proyx Object: Proxy proxy = new Proxy(Proxy.Type.HTTP,new InetSocketAddress(ip,port)); StandardHttpRequestor requ = new StandardHttpRequestor(proxy); Which is wrong, because it has no authentication. For authentication, the net and google show me the following. Putting all together, my current code looks like the following: String ip = "http://myproxy.com"; int port = 80; final String authUser = "username"; final String authPassword = "password"; Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(authUser, authPassword.toCharArray()); } }); System.setProperty("http.proxyUser", authUser); System.setProperty("http.proxyPassword", authPassword); Proxy proxy = new Proxy(Proxy.Type.HTTP,new InetSocketAddress(ip,port)); StandardHttpRequestor requ = new StandardHttpRequestor(proxy); return requ; But this does not work as well. What am I doing wrong? I can't seem to get the Proxy to work.
has title: Dropbox Java: Use Proxy with authentication
tagged with: dropbox-api
tagged with: proxy
has answer: http://stackoverflow.com/a/26529027
accepted answer: http://stackoverflow.com/a/26529027
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41703087
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/41813747
type: Comment
has text: It seems that in basic input or output stream the byte is from 0-255 ,so in data transform level you can not tell the client that is end.Otherwise you close the socket or use the application logic data replace the end , not only the -1 in client.It may be some special characters.
comment on: http://stackoverflow.com/a/26599542
type: AnswerComment
score: 0

http://stackoverflow.com/q/26644686
score: 1
favorite count: 0
has body: I am getting a expected .class error while trying to compile the file to run my program. I have one java file(main) calling to another java file with the class name Sales. HEre is my code for the two java files import java.util.Scanner; public class Sales { double product1 = 2.98; double product2 = 4.50; double product3 = 9.98; double product4 = 4.49; double product5 = 6.87; double sale = 0; public void printHello() { Scanner input = new Scanner (System.in); System.out.print("Please enter a product number."); int userInput = input.nextInt(); while(userInput != 0) { if(userInput &gt;= 1 &amp;&amp; userInput &lt;= 5) { switch(userInput) { case 1: product1++; sale += 2.98; System.out.print("How many were sold?"); userInput = input.nextInt(); break; case 2: product2++; sale += 4.50; System.out.print("How many were sold?"); userInput = input.nextInt(); break; case 3: product3++; sale += 9.98; System.out.print("How many break; were sold?"); userInput = input.nextInt(); break; case 4:product4++; sale += 4.49; System.out.print("How many were sold?"); userInput = input.nextInt(); break; case 5: product5++; sale += 6.87; System.out.print("How many were sold?"); userInput = input.nextInt(); break; }//end switch } //end if else if (userInput != 0) System.out.println("ERROR: Incorrect Product Number, Please Try Again"); System.out.print("Please enter a Product Number"); userInput = input.nextInt(); }//end while } //end main public void printSales(double product1,double product2,double product3,double product4,double product5) { System.out.println(); System.out.printf("Product 1: $%.2f\n", product1); System.out.printf("Product 2: $%.2f\n", product2); System.out.printf("Product 3: $%.2f\n", product3); System.out.printf("Product 4: $%.2f\n", product4); System.out.printf("Product 5: $%.2f\n", product5); System.out.printf("The total Cost is: %.2f\n", sale); } //end printSales } //end class then my main : public class SalesTest { public static void main(String[] args) { Sales mySales …
has comment: http://stackoverflow.com/comment/41895390
has title: .class calling error when compiling
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26644704
has comment: http://stackoverflow.com/comment/41895393
tagged with: java
has comment: http://stackoverflow.com/comment/41895583
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26644704
answer count: 1

http://stackoverflow.com/a/52234104
upvote count: 17
score: 17
answers question: http://stackoverflow.com/q/26619566
downvote count: 0
has comment: http://stackoverflow.com/comment/96714135
type: Answer
has body: Suppose you want to ask the user if he want to exit the application without saving the work. If the user choose no, you cannot avoid the application to close within the stop method. In this case you should add an EventFilter to your window for an WINDOW_CLOSE_REQUEST event. In your start method add this code to detect the event: (Note that calling Platform.exit(); doesn't fire the WindowEvent.WINDOW_CLOSE_REQUEST event, see below to know how to fire the event manually from a custom button) // *** Only for Java &gt;= 8 **** // ==== This code detects when an user want to close the application either with // ==== the default OS close button or with a custom close button ==== primaryStage.getScene().getWindow().addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, this::closeWindowEvent); Then add your custom logic. In my example i use an Alert popup to ask the user if he/she want to close the application without saving. private void closeWindowEvent(WindowEvent event) { System.out.println("Window close request ..."); if(storageModel.dataSetChanged()) { // if the dataset has changed, alert the user with a popup Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.getButtonTypes().remove(ButtonType.OK); alert.getButtonTypes().add(ButtonType.CANCEL); alert.getButtonTypes().add(ButtonType.YES); alert.setTitle("Quit application"); alert.setContentText(String.format("Close without saving?")); alert.initOwner(primaryStage.getOwner()); Optional&lt;ButtonType&gt; res = alert.showAndWait(); if(res.isPresent()) { if(res.get().equals(ButtonType.CANCEL)) event.consume(); } } } The event.consume() method prevents the application from closing. Obviously you should add at least a button that permit the user to close the application to avoid the force close application by the user, that in some cases can corrupt data. Lastly, if you have to fire the event from a custom close button, you can use this : Window window = Main.getPrimaryStage() // Get the primary stage from your Applicati…

http://stackoverflow.com/a/26569169
upvote count: 3
score: 3
has body: There are a couple of issues you need to consider here: Each Bar object needs its own variables to keep track of its state. This means that the member variables in Bar should not be static. A custom component needs to override getPreferredSize() in order to tell its parent container how much space the custom component wants to take. The parent container is responsible for determining the position of the components it contains. (More appropriately, this is the responsibility of the LayoutManager.) This means it is inappropriate to have the x and y positions in the custom component. In paintComponent(Graphics g), you are only allowed to draw within the area that is owned by the component. The coordinates are relative to the top left corner of the component, not relative to the top left of the container which holds it. This means that you need to draw a rectangle covering the full component: g.drawRectangle(0, 0, getWidth(), getHeight()); You can reduce some of the complexity of your code by using an array or List to store the Bar objects inside your custom panel. For example, you will then be able to paint each Bar in a simple for loop.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26569082

http://stackoverflow.com/comment/41706075
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26540392
has text: @Mr_Wizerman69 yes DnR comment describe it better

http://stackoverflow.com/comment/41816301
has text: Oh my goodness! I can't believe I didn't see that, thank you so much. It is now calculating the way that it should be. As far as my second issue, I will keep trying at it to see what I can do. If you want a runnable example I would be happy to post it. My main concern for now was the validation.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26601157

http://stackoverflow.com/comment/41714166
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26544961
score: 0
has text: @StackOver that's normal, but the server needs a way to identify you. That is what cookies do (it would be a really bad idea to use the IP). Deleting the cookie (or whatever is used to track the session) basically means a one-sided termination of the session because you lose your "ticket", so to say, and you need to re-authenticate to get a new one (= new session)

http://stackoverflow.com/q/26607365
accepted answer: http://stackoverflow.com/a/26793044
tagged with: digital-signature
has answer: http://stackoverflow.com/a/26793044
has body: My application is using java security APIs to sign a file and verify it. While signing , I am using PFX file and password as inputs and after signing I am generating a signature file using the bytes. While verification process I am using signature file ,certificate file and the signed file as inputs. Please find the code I am using in verification below: // KeyFilePath= path of certificate file // fileToVerify = path of signed file // signatureFilePath = path of signature file InputStream inputStream = new FileInputStream(KeyFilePath); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); X509Certificate x509Certificate = (X509Certificate) certificateFactory.generateCertificate(inputStream); // input the signature bytes String sigFile = signatureFilePath; FileInputStream sigFileInputStream = new FileInputStream(sigFile); byte[] sigToVerify = new byte[sigFileInputStream.available()]; sigFileInputStream.read(sigToVerify); sigFileInputStream.close(); PublicKey pubKey = x509Certificate.getPublicKey(); Signature signature = Signature.getInstance(signAlgorithm); signature.initVerify(pubKey); // Update and verify the data try { FileInputStream dataFileInputStream = new FileInputStream(fileToVerify); BufferedInputStream bufferedInputStream = new BufferedInputStream(dataFileInputStream); byte[] buffer = new byte[IVerifyDigitalSignature.BYTE_SIZE]; int bufferedInputStreamLength; while (bufferedInputStream.available() != IVerifyDigitalSignature.ZERO_LENGTH) { bufferedInputStreamLength = bufferedInputStream.read(buffer); signature.update(buffer, IVerifyDigitalSignature.ZERO_LENGTH, bufferedInputStreamLength); } bufferedInputStream.close(); // Verify the Signature x509Certificate.verify(pubKey); verifyDigitalSignature = signature.verify(sigToVerify); Please help me in resolving the same as it is yet not closed.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42096216
has comment: http://stackoverflow.com/comment/42131559
type: Question
has comment: http://stackoverflow.com/comment/42096308
has comment: http://stackoverflow.com/comment/42090052
answer count: 1
has title: My code can verify self signed certificate but is failing when VeriSign issued certificate is used
tagged with: security
score: 0
has comment: http://stackoverflow.com/comment/42129619

http://stackoverflow.com/a/26657579
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/77448289
answers question: http://stackoverflow.com/q/26615851
downvote count: 0
has body: With EclipseLink, I used have used properties.put("eclipselink.ddl-generation", "drop-and-create-tables"); properties.put("eclipselink.ddl-generation.output-mode", "database"); properties.put("eclipselink.deploy-on-startup", "true"); Then JpaHelper.getEntityManagerFactory(em).refreshMetadata(properties); This drops and recreates tables for all entities in the persistence unit. As mentioned elsewhere, calling this multiple times is expensive - you are better off clearing data before/after a test using the JPA bulk delete queries: "DELETE from EntityName entity"

http://stackoverflow.com/q/26603651
has answer: http://stackoverflow.com/a/26603737
score: 0
has answer: http://stackoverflow.com/a/26603723
has body: So we have: if (arguments.length != 1 &amp;&amp; arguments.length != 2) { throw new IllegalArgumentException("Wrong number of arguments in " + string); } If arguments is of length 1 it passes this if block but why. The evaluation should work after my knowledge like this: if (args != 1 == true) AND (args != 2 == true) Meaning args.length = [0, 3, 4, ...] should be only valid valid to pass. But it skipps the if even if it is with args.legth == 1. How is this possible?
has title: Conditional if evaluation with &&
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26603711
type: Question
has answer: http://stackoverflow.com/a/26603711
accepted answer: http://stackoverflow.com/a/26603723
tagged with: if-statement
tagged with: java
answer count: 3
tagged with: arrays

http://stackoverflow.com/q/26551416
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26551898
accepted answer: http://stackoverflow.com/a/26551467
tagged with: listview
answer count: 3
has body: I know there are a lot of posts on how to make an Android ListView, but even after looking through most of them I can't figure out what my problem is. I'm completely new to Android and obviously a bit overwhelmed. The activity runs but without showing any content. This is my Activity: package com.example.myfirstapp; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; public class HistoryActivity extends Activity { CustomRowAdapter customRowAdapter; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); listView = (ListView)findViewById(R.id.listView); customRowAdapter = new CustomRowAdapter(getApplicationContext()); listView.setAdapter(customRowAdapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.history, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } this is activity_history.xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="vertical"&gt; &lt;ListView android:id="@+id/listView" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; The xml for the input in the ListView (custom_row.xml): &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent…
score: 1
has title: Android ListView with ArrayAdapter doesn't show anything
favorite count: 0
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/26551467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41725152
possible better answer: http://stackoverflow.com/a/26551461
tagged with: java
has answer: http://stackoverflow.com/a/26551461

http://stackoverflow.com/q/26538980
favorite count: 0
type: Question
has body: I was very surprised when I noticed that following code compiles without warnings and prints Integer / String: public final class GenericsTest { private static &lt;T&gt; void method(T arg1, T arg2) { System.out.println(arg1.getClass().getSimpleName()); System.out.println(arg2.getClass().getSimpleName()); } public static void main(String[] args) { method(1, "1"); } } I expected a compilation error. Is there a reason why this code compiles? What is the correct way to ensure that arguments have the same type? Edit: What about bounded type parameters? The best I can think of is this: private static &lt;T, U extends T&gt; void method(T arg1, U arg2) { System.out.println(arg1.getClass().getSimpleName()); System.out.println(arg2.getClass().getSimpleName()); } Unfortunately, java doesn't allow cyclic constraints. &lt;T extends U, U extends T&gt; doesn't compile. Is this a dead end?
accepted answer: http://stackoverflow.com/a/26539101
has answer: http://stackoverflow.com/a/26558638
tagged with: generics
upvote count: 11
has comment: http://stackoverflow.com/comment/41703365
has answer: http://stackoverflow.com/a/65847316
possible better answer: http://stackoverflow.com/a/26558745
tagged with: java
has answer: http://stackoverflow.com/a/26558745
has title: How to write a generic method that takes two arguments of the same types in java?
score: 11
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26539101

http://stackoverflow.com/comment/41881020
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26636859
has text: `product =Data.getData();` How does this compile? `getData` returns a `String` and product is a `JSONObject`.

http://stackoverflow.com/comment/41795646
type: Comment
type: QuestionComment
has text: You need a language tag. If this is java, give it a java tag so the java people can find it.
comment on: http://stackoverflow.com/q/26590181
score: 0

http://stackoverflow.com/comment/42012631
comment on: http://stackoverflow.com/a/26676509
type: Comment
has text: When you extend `ActionBarActivity` you can't add Material theme. I have wrote in the answer, you need `Theme.AppCompat`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41926926
has text: @YuZhang , yes it is compatible .
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26655628
score: 0

http://stackoverflow.com/comment/41729300
comment on: http://stackoverflow.com/q/26553628
type: Comment
type: QuestionComment
has text: I need to know the position that the elements are equal at
score: 0

http://stackoverflow.com/q/26650948
has title: Custom code generation for JPA entities from database
tagged with: entity
favorite count: 0
has answer: http://stackoverflow.com/a/26658585
has body: I'm here asking for a simple way to add some custom code in the JPA Entity generated by Eclipse from database. Basically what I want to achieve is to add public String properties containing the names of the entity properties, and use them when I need to provide "property name" as String and be sure that there won't be runtime access errors. Something like this @Entity @Table(name="clients") @NamedQuery(name="ClientModel.findAll", query="SELECT c FROM ClientModel c") public class ClientModel implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="id_client") private long idClient; public String name; public ClienteModel() { } public long getIdClient() { return this.idClient; } public void setIdClient(long idClient) { this.idClient = idClient; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } //CUSTOM CODE public static final String idClientProperty = "idClient"; public static final String nameProperty = "name"; } So i could use property name like ClientModel.nameProperty and be compile-time safe of his existence and in case of names refactoring after a further entity generation. I'm aware of the existence of Telosys Tools &amp; co., but I hoped there could be something simplier/faster (like a custom class provided as plugin in WSDL_to_entity generation with JAXB) Thank you.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26658585
upvote count: 5
tagged with: java
type: Question
score: 5
tagged with: jpa
downvote count: 0
answer count: 1

http://stackoverflow.com/a/26579730
answers question: http://stackoverflow.com/q/26579729
has comment: http://stackoverflow.com/comment/41776912
score: 10
upvote count: 11
type: AcceptedAnswer
downvote count: 1
type: Answer
has body: Unfortunately, naive encoding/decoding of a Shape to XML using XMLEncoder/Decoder often destroys all the vital information of the Shape! So to do this, still using the above mentioned classes, we serialize and restore properly constructed beans that represent the parts of the shape as obtained from a PathIterator. These beans are: PathBean which stores the collection of PathSegment objects that form the shape of the Java-2D Shape. PathSegment which stores the details of a particular part of the path (segment type, winding rule &amp; coords). SerializeShapes GUI A GUI to demonstrate storing and restoring shapes. Click the Ellipse (Ellipse2D), Rectangle (Rectangle2D) or Face (Area) buttons a couple of times. Exit the GUI. The shapes will be serialized to disk. Restart the GUI. The randomly drawn shapes from last time will be restored from disk &amp; reappear in the GUI. The selected shape will be filled in green, other shapes in red. package serialize2d; import java.awt.*; import java.awt.event.*; import java.awt.font.FontRenderContext; import java.awt.geom.AffineTransform; import java.awt.geom.*; import java.awt.image.BufferedImage; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Enumeration; import java.util.Random; import java.util.Vector; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.event.*; /** A GUI to make it easy to add/remove shapes from a canvas. It should persist the shapes between runs. */ public class SerializeShapes { JPanel ui; JPanel shapePanel; Random rand; JPanel shapeCanvas; DefaultListModel&lt;Shape&gt; allShapesModel; ListSelectionModel shapeSelectionModel; RenderingHints renderingHints; SerializeShapes() { initUI(); } public void initUI() { if (ui != null) { return; } renderingHints = new RenderingHints(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); renderingHints.put(Ren…
accepted answer of: http://stackoverflow.com/q/26579729
has comment: http://stackoverflow.com/comment/70046696
has comment: http://stackoverflow.com/comment/41776897

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/26527054
type: Tag
tags question: http://stackoverflow.com/q/26645948
tags question: http://stackoverflow.com/q/26649043

http://stackoverflow.com/comment/41879655
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26636019
has text: "The row"? Which one? And if there is only one, why are you using a 2D array?
score: 0

http://stackoverflow.com/comment/41821079
type: QuestionComment
comment on: http://stackoverflow.com/q/26604023
type: Comment
score: 2
has text: Why did you not follow the advice given by @kocko on [your previous question](http://stackoverflow.com/a/26507271/1225328)? Because this is actually the design you need...

combobox
tags question: http://stackoverflow.com/q/26571244
tags question: http://stackoverflow.com/q/26667039
type: Tag
tags question: http://stackoverflow.com/q/26631041
tag name: combobox
tags question: http://stackoverflow.com/q/26559440
tags question: http://stackoverflow.com/q/26643745

http://stackoverflow.com/a/26700553
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26653786
type: Answer
score: 2
has body: For each known IP address, you can send the SNMP v3 discovery message (it supports GET/GET-BULK and so on), https://docs.lextudio.com/sharpsnmplib/tutorials/device-discovery.html SNMP v3 enabled entities must respond to that according to the standard. So for snmp4j, you should see if there is just a method to do so.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26653786

http://stackoverflow.com/a/30114352
answers question: http://stackoverflow.com/q/26623120
score: 0
has body: Embedded fonts can be extracted and made available manually, like so: Mapper fontMapper = new IdentityPlusMapper(); wordMLPackage.setFontMapper(fontMapper); FontTablePart fontTablePart= wordMLPackage.getMainDocumentPart().getFontTablePart(); fontTablePart.processEmbeddings(); Set&lt;String&gt; fontsInUse = wordMLPackage.getMainDocumentPart().fontsInUse(); // Make each embedded font available to the font mapper. for(String s : fontsInUse) { PhysicalFont physicalFont = PhysicalFonts.get(s); fontMapper.put(s, physicalFont); } // Now you can access your fonts, such as 'Comic Sans' or 'Arial Unicode MS'. PhysicalFont font = PhysicalFonts.getPhysicalFonts().get( "Comic Sans MS"); fontMapper.put(Mapper.FONT_FALLBACK, font);
type: Answer

http://stackoverflow.com/q/26617926
tagged with: java
possible better answer: http://stackoverflow.com/a/26618011
type: Question
has answer: http://stackoverflow.com/a/26618017
has title: when user inputs string program returns you to the start of the loop, when integer program continues
has answer: http://stackoverflow.com/a/26618065
has body: Bellow you can see the part of the code i am having trouble with. So far when user inputs "a" the program returns an error. I would like the program to return "Wrong entry try again!" and goes back to the start od do statment. do{ System.out.println("Vnesi dožino besede, ki jo iščeš"); Scanner in = new Scanner(System.in); dolzina = in.nextInt(); }while (dolzina&lt;0);
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41847096
has comment: http://stackoverflow.com/comment/41847109
accepted answer: http://stackoverflow.com/a/26618017
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26618011

http://stackoverflow.com/comment/41953639
score: 0
type: Comment
has text: Can you show me a code snippet of what you mean by "Check the PHOTO_ID under Columns"?
type: AnswerComment
comment on: http://stackoverflow.com/a/26668571

http://stackoverflow.com/q/26641291
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26641335
has comment: http://stackoverflow.com/comment/41889674
has title: In Java,how can the letters in strings be doubled?
has body: I'm a beginner no matter how you look at it, so bear with me here. The project is about having a string in the code and then doubling every letter in it, while tripling the exclamation points. Nothing else is doubled. It's supposed to take something like this: The quick brown fox jumps over the lazy dog 3 times! ...and turn it into this: Tthhee qquuiicckk bbrroowwnn ffooxx jjuummppss oovveerr tthhee llaazzyy ddoogg 3 ttiimmeess!!! This is the code I tried, though it prints in numbers and takes a bunch of loops to complete instead of one: String s = "The quick brown fox jumps over the lazy dog 3 times!"; String output = ""; int i = 0; while (i &lt; s.length()) { char c = s.charAt(i); if (s.charAt(i) == '!') { output += c + c + c; i++; } if (Character.isLetter(c) == true) { output += c + c; i++; } else { i++; } System.out.println(output); }
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26641808
answer count: 8
accepted answer: http://stackoverflow.com/a/26641357
has answer: http://stackoverflow.com/a/26641420
has comment: http://stackoverflow.com/comment/41889618
favorite count: 0
has answer: http://stackoverflow.com/a/26641413
has answer: http://stackoverflow.com/a/26641384
has answer: http://stackoverflow.com/a/26641700
has answer: http://stackoverflow.com/a/26641464
upvote count: 2
possible better answer: http://stackoverflow.com/a/26641700
has answer: http://stackoverflow.com/a/26641357
downvote count: 1

http://stackoverflow.com/q/26577664
has comment: http://stackoverflow.com/comment/41772969
has body: i'm currently trying to create a while loop for my program, a Guessing game. I've set it up so the user can create a max value i.e 1-500 and then the user can proceed to guess the number. When the number has been guessed, the User can press 1, to close, anything else to continue running the loop again. My problem, is that the code gives me an error when trying to continue the loop, no compiling errros This is my Code: import java.util.Random; import java.util.Scanner; public class Gættespil2 { public static void main(String[] args) { Random rand = new Random(); int TAL = rand.nextInt(20) + 1; int FORSØG = 0; Scanner input = new Scanner (System.in); int guess; int loft; boolean win = false; boolean keepPlaying = true; while ( keepPlaying ) { Scanner tastatur = new Scanner(System.in); System.out.print("Indsæt loftets højeste værdi : "); loft = tastatur.nextInt(); TAL = (int) (Math.random() * loft + 1); while (win == false) { System.out.println(" Gæt et tal mellem 1 og "+ loft + "):: "); guess = input.nextInt(); FORSØG++; if (guess == TAL) { win = true; } else if (guess &lt; TAL) { System.out.println("Koldere, gæt igen"); } else if (guess &gt; TAL) { System.out.println("Varmere, Gæt igen!!"); } } System.out.println(" Tillykke du vandt...endeligt!!! "); System.out.println(" tallet var" + TAL); System.out.println(" du brugte " + FORSØG + " forsøg"); System.out.println("Slut spillet? tast 1."); System.out.println("tryk på hvadsomhelst for at spille videre"); int userInt = input.nextInt(); if( userInt == 1) { keepPlaying = false; } } } }
type: Question
has comment: http://stackoverflow.com/comment/41772876
has answer: http://stackoverflow.com/a/26577918
has comment: http://stackoverflow.com/comment/41772773
score: 0
tagged with: java
has title: Guessing Game, with a While loop
answer count: 1
accepted answer: http://stackoverflow.com/a/26577918
has comment: http://stackoverflow.com/comment/41772855
type: AnsweredQuestion
tagged with: game-engine
has comment: http://stackoverflow.com/comment/41772757

http://stackoverflow.com/comment/41842011
has text: This sounds wonderful, however (this is sort of a dumb question), would I declare the map within the `Action` interface, and then set the map's values in the classes implementing Action?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26615169
type: AnswerComment

http://stackoverflow.com/comment/41746158
type: Comment
comment on: http://stackoverflow.com/q/26563172
score: 0
type: QuestionComment
has text: not a error but it will act as endless loop

http://stackoverflow.com/q/26568825
has comment: http://stackoverflow.com/comment/41756786
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26568906
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41756768
tagged with: interrupt
has title: Interrupting a BlockingQueue in a Thread
has comment: http://stackoverflow.com/comment/41756840
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26569351
has body: I'm writing a program that has 3 threads. One reads a text file and inputs the words into a ArraylistBlockingQueue of size 2. The next one takes that list and reverses every other word inside of it. The last thread takes the words and writes them to a new text file. I have everything working except I cannot figure out how to interrupt and stop my threads. The program writes the text file but never ends. Main method JFileChooser chooser = new JFileChooser(); File selectedFile = null; File outFile = new File("output.txt"); int returnValue = chooser.showOpenDialog(null); if (returnValue == JFileChooser.APPROVE_OPTION) { selectedFile = chooser.getSelectedFile(); } BlockingQueue text = new ArrayBlockingQueue(2); BlockingQueue out = new ArrayBlockingQueue(2); Thread input = new Thread(new inputClass(selectedFile, text)); Thread reverse = new Thread(new reverseClass(text, out)); Thread output = new Thread(new outputClass(out, outFile)); chooser.setSelectedFile(outFile); if (chooser.showSaveDialog(chooser) == JFileChooser.APPROVE_OPTION) { input.start(); reverse.start(); output.start(); } Input @Override public void run() { try { Scanner s = new Scanner(f); while (isRunning) { try { if(s.hasNext()){ text.put(s.next()); } else { text.put(END); } } catch (InterruptedException ex) { Logger.getLogger(inputClass.class.getName()).log(Level.SEVERE, null, ex); } } } catch (FileNotFoundException ex) { Logger.getLogger(inputClass.class.getName()).log(Level.SEVERE, null, ex); } Reverse Class @Override public void run() { String original; String temp = ""; String character = ""; int count = 1; // keeps track of whether or not a word should be reversed while (isRunning) { try { original = text.take(); if(original.equalsIgnoreCase(END)){ Thread.currentThread().interrupt(); } int length = original.length() - 1; //if count is even then the word should be reversed. if ((count % 2) == 0) { // reverses the original string if a ? or . appears if (original.contains("?") || original.contains("."…
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41756767
has answer: http://stackoverflow.com/a/26568858

http://stackoverflow.com/comment/41906561
has text: I am using maven so should i make and entry in pom.xml and add it to the repo ?how can i check if the jar is referred from other projects?
type: AnswerComment
comment on: http://stackoverflow.com/a/26651085
type: Comment
score: 0

http://stackoverflow.com/q/26642153
score: 31
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/69681735
tagged with: java
has comment: http://stackoverflow.com/comment/41895886
tagged with: finalize
has comment: http://stackoverflow.com/comment/41896669
type: Question
has answer: http://stackoverflow.com/a/26645534
has comment: http://stackoverflow.com/comment/41895121
has comment: http://stackoverflow.com/comment/41891476
downvote count: 0
has comment: http://stackoverflow.com/comment/116819502
favorite count: 0
has answer: http://stackoverflow.com/a/26642973
answer count: 3
linked to: http://stackoverflow.com/q/56139760
has body: We recently upgraded our message processing application from Java 7 to Java 8. Since the upgrade, we get an occasional exception that a stream has been closed while it is being read from. Logging shows that the finalizer thread is calling finalize() on the object that holds the stream (which in turn closes the stream). The basic outline of the code is as follows: MIMEWriter writer = new MIMEWriter( out ); in = new InflaterInputStream( databaseBlobInputStream ); MIMEBodyPart attachmentPart = new MIMEBodyPart( in ); writer.writePart( attachmentPart ); MIMEWriter and MIMEBodyPart are part of a home-grown MIME/HTTP library. MIMEBodyPart extends HTTPMessage, which has the following: public void close() throws IOException { if ( m_stream != null ) { m_stream.close(); } } protected void finalize() { try { close(); } catch ( final Exception ignored ) { } } The exception occurs in the invocation chain of MIMEWriter.writePart, which is as follows: MIMEWriter.writePart() writes the headers for the part, then calls part.writeBodyPartContent( this ) MIMEBodyPart.writeBodyPartContent() calls our utility method IOUtil.copy( getContentStream(), out ) to stream the content to the output MIMEBodyPart.getContentStream() just returns the input stream passed into the contstructor (see code block above) IOUtil.copy has a loop that reads an 8K chunk from the input stream and writes it to the output stream until the input stream is empty. The MIMEBodyPart.finalize() is called while IOUtil.copy is running, and it gets the following exception: java.io.IOException: Stream closed at java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:142) at java.io.FilterInputStream.read(FilterInputStream.java:107) at com.blah.util.IOUtil.copy(IOUtil.java:153) at com.blah.core.net.MIMEBodyPart.writeBodyPartContent(MIMEBodyPart.java:75) at com.blah.core.net.MIMEWriter.writePart(MIMEWriter.java:65) We put some logging in th…
accepted answer: http://stackoverflow.com/a/26645534
upvote count: 31
tagged with: finalizer
has title: finalize() called on strongly reachable objects in Java 8
linked to: http://stackoverflow.com/q/24376768
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/41895520
tagged with: java-8
possible better answer: http://stackoverflow.com/a/69681735
has comment: http://stackoverflow.com/comment/41891375

http://stackoverflow.com/q/26624116
type: Question
tagged with: mongodb
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/41858187
score: 12
has title: How can I import data to Mongodb from Json file using java
answer count: 7
tagged with: shell
has answer: http://stackoverflow.com/a/65430428
favorite count: 0
tagged with: command-line
has answer: http://stackoverflow.com/a/26628201
has answer: http://stackoverflow.com/a/42536388
has answer: http://stackoverflow.com/a/26626377
has comment: http://stackoverflow.com/comment/41858115
has answer: http://stackoverflow.com/a/36940709
possible better answer: http://stackoverflow.com/a/26628201
type: AnsweredQuestion
has body: I am struggling with importing data into Mongodb from a Json file. I can do the same in command line by using mongoimport command. I explored and tried lot but not able to import from Json file using java. sample.json { "test_id" : 1245362, "name" : "ganesh", "age" : "28", "Job" : {"company name" : "company1", "designation" : "SSE" } } { "test_id" : 254152, "name" : "Alex", "age" : "26", "Job" : {"company name" : "company2", "designation" : "ML" } } Thank for your time. ~Ganesh~
has answer: http://stackoverflow.com/a/34636919
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/45589356
accepted answer: http://stackoverflow.com/a/26626377

http://stackoverflow.com/comment/41761253
has text: I already use but I am getting exception
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26563562

http://stackoverflow.com/comment/41699338
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26536681
has text: as a start you can start by sketcing out a sample input and output
score: 0

http://stackoverflow.com/comment/41660210
comment on: http://stackoverflow.com/q/26515178
type: QuestionComment
type: Comment
has text: preparing a statement "compiles" the query, so the db merely has to stuff in parameters' values at run-/query-time. it becomes semi-static in that you can reuse that same statement without having to go through a recompile phase. but yes, the preparation will be lost when the db connection is closed.
score: 1

http://stackoverflow.com/comment/41738502
score: 1
has text: Reference "cycles" do not cause a problem for Java GC. Only if there is a definite path from some "root" (stack var, static var, etc) to an object is the object kept and not collected.
comment on: http://stackoverflow.com/q/26558809
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26576938
type: Question
has answer: http://stackoverflow.com/a/26577240
upvote count: 2
has body: I would like to make some clean up on a bean when I shutdown a CDI application. For example, I would like to close an IO connection. Of course, here, the bean is marked as @ApplicationScoped. To manage this I wrote an extension and observe the BeforeShutdown event, and then I select my bean to call a clean up method : public void beforeShutdown(@Observes BeforeShutdown beforeShutdown) { SomeBean obj = CDI.current().select(SomeBean.class).get(); obj.cleanup(); } My problem is that I have access to a new instance in this method. Not the instance I got in the whole application. If you want to see this instance problem, I've made a repo on github to show it : https://github.com/hasalex/cdi-extension-demo. So I have 2 questions : Why do I get a new instance ? Is there an other way to cleanup my bean at the end of the application ? (in SE and in WildFly environments)
answer count: 1
favorite count: 0
tagged with: cdi
tagged with: weld
has title: Why has an @ApplicationScoped bean a new instance in the BeforeShutdown phase of my CDI extension ?
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26577240

http://stackoverflow.com/comment/41765799
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26573066
has text: Win server 08 yes it is reproducible but only on prod env i could never make it on test env. 260 is not too much but i have many waiting threadsqnd also why it never reduces...
type: Comment

http://stackoverflow.com/comment/41833700
has text: Go to inspect mod with your browser and see if there is any rule that overrides this CSS
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26610561
type: QuestionComment

http://stackoverflow.com/comment/41689090
has text: probably you have to download it : https://developer.android.com/tools/support-library/setup.html
type: Comment
comment on: http://stackoverflow.com/a/26519539
score: 0
type: AnswerComment

http://stackoverflow.com/a/26565256
downvote count: 0
has body: You can use the JColorChooser like this: Color newColor = JColorChooser.showDialog(null, "Choose a color", Color.RED); The first argument is the parent java.awt.Component instance. Could also be null. The second argument is the title for the dialog. The third argument is the color it should select as default. The dialog returns the selected color if the user presses ok or null if he clicked on cancel. See this page for more information: http://docs.oracle.com/javase/tutorial/uiswing/components/colorchooser.html. Edit: include ColorChooser into existing contentpane The above code shows how to create a pop up with for the JColorChooser, but it is also possible to "include" it into the existing contentpane. This is the code to initialize both components (JButton and JColorChooser): button = new JButton("Choose color"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { toggleColorChooser(); // show and hide the color chooser } }); button.setBounds(10, 11, 150, 23); contentPane.add(button); colorChooser = new JColorChooser(Color.BLACK); // default color is black colorChooser.setBorder(null); colorChooser.getSelectionModel().addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorChanged(); // change background color of "button" } }); The button will be added immediately, but the color chooser not yet. It will be added in the toggleColorChooser method: protected void toggleColorChooser() { if (toggled) { contentPane.remove(colorChooser); } else { colorChooser.setBounds(button.getX(), button.getY() + 20, 600, 300); colorChooser.setVisible(true); contentPane.add(colorChooser); } toggled = !toggled; contentPane.validate(); contentPane.repaint(); } The color chooser will be added to the panel beneath the button. You may change the bounds if you have a different layout or if you're using a layout manager. As you can see, you'll need a variable called toggled. Just add it as class variable: private bo…
type: Answer
upvote count: 13
score: 13
answers question: http://stackoverflow.com/q/26565166

http://stackoverflow.com/a/26574076
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26573950
answers question: http://stackoverflow.com/q/26573950
type: Answer
downvote count: 0
score: 1
has body: use the constructor that lets you enter textview id and give the id of your textview that you specified int the layout ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.activity_feedbackresults, R.id.textviewId, arr);

http://stackoverflow.com/comment/41861988
score: 0
type: Comment
type: QuestionComment
has text: Do you use transaction manager?
comment on: http://stackoverflow.com/q/26625793

http://stackoverflow.com/comment/41890030
comment on: http://stackoverflow.com/q/26641556
has text: Use a [LinkedList<Example>](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41905701
has text: sir, I need to add buttons to JxTreeTable. How to do this? help me..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26650653

http://stackoverflow.com/q/26626655
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41862888
has answer: http://stackoverflow.com/a/26627515
tagged with: android-mediaplayer
has title: auto rotate stops music when app rotates
score: 0
has body: I added android:screenOrientation="portrait" To the activity in the manifest but the app still rotates if the device is turned. Cannot add all of code yet, on phone. But will add when i get back home.
answer count: 2
has answer: http://stackoverflow.com/a/26628090
accepted answer: http://stackoverflow.com/a/26628090
possible better answer: http://stackoverflow.com/a/26627515
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41862699
has comment: http://stackoverflow.com/comment/41862658

http://stackoverflow.com/q/26535441
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41700589
accepted answer: http://stackoverflow.com/a/26535681
tagged with: java
has title: Java Extracting class information from a generic type
score: -1
upvote count: 0
answer count: 1
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26535681
has body: How can I assign value to Class&lt;T&gt; - without having to pass it explicitly? I know about type erasure story. But I am wondering: doesn't Java compiler see Class&lt;T&gt; c and realize that I am talking about &lt;T&gt;, shouldn't I be able to use this variable without initialization! OR shouldn't it be automatically initialized as a primitive. Why wasn't it designed that way? static class D&lt;T&gt; { T t; Class&lt;T&gt; c; D(T t) { this.t = t; method(t.getClass()); // no error! c = t.getClass(); // error! } void q() { method(c); // no error at compile time } } static &lt;K&gt; void method(Class&lt;K&gt; clazz) { }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41700616

http://stackoverflow.com/comment/41915133
type: AnswerComment
has text: ok, great, but as mentioned in the OP I'm aware of this option but it won't work as those file are not picked up by Jenkins and are not displayed...
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26655914

http://stackoverflow.com/comment/41662781
type: Comment
type: QuestionComment
score: 1
has text: Try to find where it goes from 6 to 0 in the debugger.
comment on: http://stackoverflow.com/q/26516302

http://stackoverflow.com/q/26585755
tagged with: android
has answer: http://stackoverflow.com/a/26586896
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41787000
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26586393
accepted answer: http://stackoverflow.com/a/26586393
has title: How to get margins of a TextView?
has comment: http://stackoverflow.com/comment/41787753
type: Question
score: 3
has comment: http://stackoverflow.com/comment/41786909
possible better answer: http://stackoverflow.com/a/26586896
has body: I'm trying to get top and left margins of a textview which I gave hardcoded margins. Why I'm doing this? Because I wanna loop through all the textviews I placed BELOW this textview so I can programmaticaly add radiobutton groups at these exact margins. textView[0] = new TextView(context); relativeLayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textView[0].setId(1); // changed id from 0 to 1 textView[0].setText(naam[0].toUpperCase()); relativeLayoutParams.setMargins(24, 39, 0, 0); int tyo = relativeLayoutParams.getTop(); //Trying to get top margins.
answer count: 2
downvote count: 0
favorite count: 0

datamapper
tag name: datamapper
tags question: http://stackoverflow.com/q/26515251
type: Tag

http://stackoverflow.com/comment/41891356
type: QuestionComment
comment on: http://stackoverflow.com/q/26639915
has text: It's very strange.. Could you provide a working example which allow to reproduce it?
score: 0
type: Comment

http://stackoverflow.com/q/26549577
tagged with: pdfnet
possible better answer: http://stackoverflow.com/a/26549794
has answer: http://stackoverflow.com/a/26552313
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26552313
has body: I have started a java project. I want to use a library which is called PDFnet. But It gives error. Where do I make wrong? public class MainClass { public static void main(String[] args) { //System.out.println(System.getProperty("java.library.path")); //System.loadLibrary("C:\\Users\\BDagli\\Downloads\\PDFNetC64\\Lib\\PDFNet"); boolean uninstallPrinterWhenDone = false; // change this to test the uninstallation functions PDFNet.initialize(); C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;Files\Java\jdk1.7.0_71\bin;..... Exception in thread "main" java.lang.UnsatisfiedLinkError: no PDFNetC in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at pdftron.PDF.PDFNet.&lt;clinit&gt;(PDFNet.java:21) at com.pdf.net.MainClass.main(MainClass.java:19)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/68595874
tagged with: java
tagged with: unsatisfiedlinkerror
has title: Can not compile a project with PDFNet jar in jdk 1.7
type: Question
has answer: http://stackoverflow.com/a/26549794
has comment: http://stackoverflow.com/comment/41721805

http://stackoverflow.com/comment/41756758
type: AnswerComment
score: 0
type: Comment
has text: Thank you I downloaded the Eclipse platform to try and use for running the programs. I got it to work, but I don't really understand anything yet about how to use it.
comment on: http://stackoverflow.com/a/26567537

http://stackoverflow.com/q/26542359
has title: android Date and SimpleDateFormat output wrong
has comment: http://stackoverflow.com/comment/41708943
answer count: 1
has comment: http://stackoverflow.com/comment/41708972
has comment: http://stackoverflow.com/comment/41709000
accepted answer: http://stackoverflow.com/a/26542475
has comment: http://stackoverflow.com/comment/41708960
has body: I do not know why different input but the output is duplicate, here is my code Date d = new Date(1409716800); Date d1 = new Date(1409716801); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy-HH:mm:ss"); String formattedDate = sdf.format(d); String formattedDate1 = sdf.format(d1); Log.d("time", formattedDate); Log.d("time", formattedDate1); The output is 10-24 06:12:50.508: D/time(29097): 17.01.70-07:35:16 10-24 06:12:50.508: D/time(29097): 17.01.70-07:35:16 can anyone tell me why the output are duplicate? My timezone is GMT+7
tagged with: android
has comment: http://stackoverflow.com/comment/41709006
linked to: http://stackoverflow.com/q/16708785
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41708916
type: Question
has answer: http://stackoverflow.com/a/26542475
tagged with: simpledateformat
tagged with: date
has comment: http://stackoverflow.com/comment/41711812

http://stackoverflow.com/q/26526801
has comment: http://stackoverflow.com/comment/41680784
answer count: 1
has title: Add MouseListener wihout extend Swing Component
has comment: http://stackoverflow.com/comment/41680948
has comment: http://stackoverflow.com/comment/41681443
has comment: http://stackoverflow.com/comment/41681560
has comment: http://stackoverflow.com/comment/41680911
has comment: http://stackoverflow.com/comment/41698750
has comment: http://stackoverflow.com/comment/41683187
tagged with: mouselistener
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41681846
has comment: http://stackoverflow.com/comment/41680842
tagged with: java
linked to: http://stackoverflow.com/q/14574045
has comment: http://stackoverflow.com/comment/41684600
has body: I'am trying to make a little game for academic stuff. What I want to do is to make a random number of balls move inside a JPanel, with random directions, but when I click inside of the ball it should sysout the actual coords of the ball. Here is my class without the move methods (I already made it but don't need to post it for this question): public class Ball implements Runnable { int x = UserInterface.BALL_START; int y = 0; int size = 10; Color color; public Ball() { Random random = new Random(); int r, g, b; r = random.nextInt(256); g = random.nextInt(256); b = random.nextInt(256); color = new Color(r,g,b); y = random.nextInt(500); } public void run() { int vx = (new Random()).nextInt(10) + 1; while (x &lt; UserInterface.BALL_END) { x += vx; try { Thread.sleep(15); } catch (InterruptedException e) { e.printStackTrace(); } } x = UserInterface.BALL_END; } public int getX() { return x; } public void paint(Graphics g) { g.setColor(color); g.fillOval(x - size / 2, y - size / 2, size, size); } } How can I add a mouselistener to the ball class without make it as a JComponent or JLabel or JPanel?
has answer: http://stackoverflow.com/a/26539049
type: Question
score: 0

http://stackoverflow.com/comment/70704637
has text: Are you directly connected to the internet (or behind a corporate proxy) , did the dependency get resolved in the POM ? , can you run mvn clean compile and report what you get as error ?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26562869

http://stackoverflow.com/comment/41934841
type: Comment
has text: The printing is just to make sure that the characters have been properly stored inside the array nArray.
comment on: http://stackoverflow.com/q/26666633
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41852516
has text: Note that this isn't a site for providing "general critiques".
score: 0
comment on: http://stackoverflow.com/q/26620908
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41925066
type: Comment
type: QuestionComment
has text: @Pshemo caps got pressed by mistake
comment on: http://stackoverflow.com/q/26661454
score: 2

http://stackoverflow.com/comment/41798268
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26591706
type: Comment
has text: A duration is not a date. A `Calendar` (and a `SimpleDateFormat)` is not suited to display a duration.

http://stackoverflow.com/a/41178692
has body: You can uninstall the plugins in the bottom of the configure. Then restart the idea.
type: Answer
answers question: http://stackoverflow.com/q/26663785
score: 0

http://stackoverflow.com/comment/41690428
has text: It is just a java application running on a unix box.
comment on: http://stackoverflow.com/q/26531913
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41839247
type: Comment
type: QuestionComment
has text: Yup, thank you for the help :) Just curious, any idea what the intention was with this code?
comment on: http://stackoverflow.com/q/26613168
score: 0

http://stackoverflow.com/comment/41873323
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26632400
type: AnswerComment
has text: Wow.. Its a pity only one upvote is allowed per answer.. :)

http://stackoverflow.com/comment/41953860
comment on: http://stackoverflow.com/q/26669801
score: 0
has text: Yeah I did that. I changed but still it did not work out.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26527398
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26527196
answers question: http://stackoverflow.com/q/26527196
has body: This part of code must be in some method, not just in the class body. Transfer this part of code in other needed place (I don't know logic, so I can't say where it should be): Contact contact = new Contact (); contact.setID(Integer.parseInt(cursor.getString(0))); contact.setName(cursor.getString(1)); contact.setPhone(cursor.getString(2));

http://stackoverflow.com/q/26603929
type: AnsweredQuestion
score: -5
tagged with: java
tagged with: file
upvote count: 1
accepted answer: http://stackoverflow.com/a/26603995
has comment: http://stackoverflow.com/comment/41820931
has title: How to check if directory contains file which name contains certain string?
type: Question
has answer: http://stackoverflow.com/a/26604005
has comment: http://stackoverflow.com/comment/41821210
has comment: http://stackoverflow.com/comment/41820922
possible better answer: http://stackoverflow.com/a/26604005
answer count: 2
tagged with: dir
linked to: http://stackoverflow.com/q/1844688
has body: I have to find a file ard12333.txt but the number part is variable so I should check if the file contains the string "ard" and then extrapolate the number part. How to do that?
favorite count: 0
has answer: http://stackoverflow.com/a/26603995
downvote count: 6

http://stackoverflow.com/comment/41891092
score: 0
type: Comment
type: AnswerComment
has text: If I used code instead of an IDE, I wouldn't have been able to design the JFrame the way I designed it. And, I tell you, letting the SDK do such complex JFrame coding and focusing on the required code is pure nirvana. :)
comment on: http://stackoverflow.com/a/26631455

http://stackoverflow.com/q/26592310
has body: I have a problem where every time I redeploy my app, any existing sessions are broken and the requests result in a ViewExpiredException. None of the advice in related questions or outside mailing list / forum posts seems to fix this issue. I can redeploy the same WAR file completely unchanged and the behavior is the same. I'm using Apache MyFaces 2.2.0, Tomcat 7.0.56 and Primefaces 5.0. The message of the exception is No saved view state could be found for the view identifier: with whatever page would be requested. Primefaces' menubar is used for navigation, which seems to be implemented as a &lt;form&gt; with POST requests. These messages occur both with those navigation options and other AJAX that uses POST. I have tried: Setting explicit org.apache.myfaces.SECRET and org.apache.myfaces.MAC_SECRET values, as seen in this document. Both client and server values for the javax.faces.STATE_SAVING_METHOD parameter. Ensuring all beans and their transitive fields are serializable. No serialization errors are reported in the logs. Using a filter to add no-cache headers, e.g. as suggested in this answer. Session persistence is not disabled, that is my context.xml has &lt;Manager pathname="" /&gt; commented out.
tagged with: primefaces
has answer: http://stackoverflow.com/a/26604079
tagged with: jsf-2.2
has answer: http://stackoverflow.com/a/26805204
has comment: http://stackoverflow.com/comment/41806713
has comment: http://stackoverflow.com/comment/41803949
answer count: 2
possible better answer: http://stackoverflow.com/a/26604079
downvote count: 0
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/26805204
has title: Preventing ViewExpiredException with JSF 2 after redeploy
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/26661144
favorite count: 0
tagged with: colors
has answer: http://stackoverflow.com/a/26847978
tagged with: drawing
has title: Coloring shapes in order with extra colors
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26847978
score: 1
tagged with: java
has body: I'm making a program that allows the user to draw multiple shapes on the screen and choose the desired color. At the current moment I have nine preset colors that the user can choose from. I plan on using a JColorChooser to allow the user to select different colors. However, I cannot figure out a way to store extra colors that may be chosen so that when the drawn shapes are repainted they will remain the same color that they were drawn with. I have come up with a way to redraw the shapes in the order that they were drawn and with the color that they were drawn with, as shown below: private List&lt;Shape&gt; shapeList = new ArrayList&lt;Shape&gt;(); private List&lt;Integer&gt; opNumList = new ArrayList&lt;Integer&gt;(); @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int index = 0; Graphics2D g2 = (Graphics2D) g.create(); if (!opNumList.isEmpty()) { for (Shape s : shapeList) { switch (opNumList.get(index)) case 0: g2.setColor(Color.red); g2.draw(s); break; case 1: g2.setColor(Color.red); g2.fill(s); break; case 2: g2.setColor(Color.orange); g2.draw(s); break; case 3: g2.setColor(Color.orange); g2.fill(s); break; case 4: g2.setColor(Color.yellow); g2.draw(s); break; case 5: g2.setColor(Color.yellow); g2.fill(s); break; case 6: g2.setColor(Color.green); g2.draw(s); break; case 7: g2.setColor(Color.green); g2.fill(s); break; case 8: g2.setColor(Color.blue); g2.draw(s); break; case 9: g2.setColor(Color.blue); g2.fill(s); break; case 10: g2.setColor(purple); g2.draw(s); break; case 11: g2.setColor(purple); g2.fill(s); break; case 12: g2.setColor(brown); g2.draw(s); break; case 13: g2.setColor(brown); g2.fill(s); break; case 14: g2.setColor(Color.white); g2.draw(s); break; case 15: g2.setColor(Color.white); g2.fill(s); break; case 16: g2.setColor(Color.black); g2.draw(s); break; case 17: g2.setColor(Color.black); g2.fill(s); break; default: return; } index++; } } } @Override public void mouseReleased(MouseEvent ev) { if (color == Color.red) {…
linked to: http://stackoverflow.com/q/4234985
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/78177947
has text: Hibernate is one of JPA implementations, so once you're using Hibernate, you're using JPA :)
type: AnswerComment
comment on: http://stackoverflow.com/a/26601720
score: 3
type: Comment

http://stackoverflow.com/q/26608003
has comment: http://stackoverflow.com/comment/41828261
tagged with: surfaceview
has answer: http://stackoverflow.com/a/26608213
has answer: http://stackoverflow.com/a/26608084
score: 0
has comment: http://stackoverflow.com/comment/41828066
has answer: http://stackoverflow.com/a/26608558
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/41828950
has comment: http://stackoverflow.com/comment/41828772
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2884501
has body: I'm trying to change from menu activity to any other activity and the whole app stops responding, no idea why. This is the code I use(I call it from the SurfaceView class instance of the activity): Intent intent = new Intent(menuActivity, ExitActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("EXIT", true); menuActivity.startActivity(intent); Log: 10-28 13:03:38.278: E/AndroidRuntime(6185): FATAL EXCEPTION: main 10-28 13:03:38.278: E/AndroidRuntime(6185): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.app.LoadedApk.makeApplication(LoadedApk.java:501) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4224) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.app.ActivityThread.access$1400(ActivityThread.java:140) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.os.Handler.dispatchMessage(Handler.java:99) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.os.Looper.loop(Looper.java:137) 10-28 13:03:38.278: E/AndroidRuntime(6185): at android.app.ActivityThread.main(ActivityThread.java:4921) 10-28 13:03:38.278: E/AndroidRuntime(6185): at java.lang.reflect.Method.invokeNative(Native Method) 10-28 13:03:38.278: E/AndroidRuntime(6185): at java.lang.reflect.Method.invoke(Method.java:511) 10-28 13:03:38.278: E/AndroidRuntime(6185): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 10-28 13:03:38.278: E/AndroidRuntime(6185): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 10-28 13:03:38.278: E/AndroidRuntime(6185): at dalvik.system.NativeStart.main(Native Method) 10-28 13:03:38.278: E/AndroidRuntime(6185): Caused by: java.lang.NullPoin…
tagged with: java
has comment: http://stackoverflow.com/comment/41828193
type: Question
has title: Cannot change activity android
tagged with: crash
answer count: 3

http://stackoverflow.com/comment/41728177
score: 0
comment on: http://stackoverflow.com/a/26540271
type: Comment
has text: I'm having multiple errors i will post details above in my post if you can help.
type: AnswerComment

http://stackoverflow.com/q/26574891
tagged with: button
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: In a new Java application I'm developing, a button that I created doesn't seem to work... The error message I get is : "button3 cannot be resolved or is not a field". Here is all the code: package com.example.trueorfalsetest; import com.example.trueorfalsetest.R; import android.support.v7.app.ActionBarActivity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity123_456 extends ActionBarActivity implements OnClickListener { @SuppressWarnings("unused") private TextView mTextView; private Button mButton3; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_activity123_456); mButton3 = (Button) findViewById(R.id.button3); mButton3.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.button3: showThreeButtonDialog(); break; } } private void showThreeButtonDialog() { Intent myIntent = new Intent(MainActivity123_456.this, MainActivity123.class); MainActivity123_456.this.startActivity(myIntent); } } and <?xml version="1.0" encoding="utf-8"?> True or False Test 5 x 3 = 15 True False True or False Test This application is running on an iPhone. True or False Test The capital of Canada is Ottawa. MainActivity123_456 Congratulations! You won! Thank you for playing! Back to the First Question and finally <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context…
has comment: http://stackoverflow.com/comment/41767708
answer count: 0
type: UnansweredQuestion
has title: Android SDK Button not working
type: Question
has comment: http://stackoverflow.com/comment/41767524
tagged with: java
has comment: http://stackoverflow.com/comment/41767664
score: 0

http://stackoverflow.com/comment/41841219
score: 3
has text: I would suspect this is because it was easier to define a single new method for the Collection interface to return the new Stream type, and add all the map, filter, reduce functions to that new type, than to add default methods for each one to Collection. Remember that default interface methods are required for older Collection implementations to participate in the new API.
comment on: http://stackoverflow.com/q/26614825
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26672478
type: Answer
score: 0
has body: Use Set to remove redundancy Set&lt;Integer&gt; num = new HashSet&lt;Integer&gt;(); num.add(123); num.add(123); num.add(1); num.add(1); Integer sum=0; for(Object a: num.toArray()){ sum+=(Integer)a; } System.out.println(sum); //124
answers question: http://stackoverflow.com/q/26671929

webdav
tags question: http://stackoverflow.com/q/26531993
tag name: webdav
type: Tag

http://stackoverflow.com/q/26513931
has comment: http://stackoverflow.com/comment/41666934
has body: How to stop JMS consumers in WebLogic? I need to programmatically notify WebLogic to stop JMS listeners (MDBs). What I mean by that is to stop consumption of messages of the queue, and start it again later also by code. The Admin Console might have an option for that (maybe stop the factory?), but we need to do it in the code. Something equivalent to Spring's DefaultMessageListenerContainer.stop().
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26533585
has comment: http://stackoverflow.com/comment/41693300
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41686561
tagged with: weblogic
answer count: 1
favorite count: 0
has title: How to programmatically stop JMS listeners from consuming?
tagged with: jms
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26533585

http://stackoverflow.com/comment/41952989
has text: I know it's suggested to separate the configurations, but it's not necessary. Nevermind. With JpaTransactionManager it works.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26660437

http://stackoverflow.com/comment/41842743
type: Comment
has text: See [this tutorial](http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html), and in particular scroll down to the `Planet` example. Basically, some of the stuff you have outside the `enum`'s curly braces needs to be inside.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26615579

http://stackoverflow.com/comment/41931874
has text: @cYrixmorten cool that's perfect. I quickly realized having two different classes to deal with roughly doubled my code, and the datastore I was pulling the businesses from got updated, meaning to continue using my SimpleEntity class I would have to update the entire thing, as well as the code using it. This is way more efficient.
score: 0
comment on: http://stackoverflow.com/q/26600598
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41745219
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26561020
type: AnswerComment
has text: Please delete your question then, as this is not useful to anyone else.

http://stackoverflow.com/comment/41707360
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26541370
score: 1
has text: Don't name your class File -- name it something else. Like MyFile that way it won't conflict with java.io.File

http://stackoverflow.com/q/26529289
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41685310
score: -4
downvote count: 4
has answer: http://stackoverflow.com/a/26529713
upvote count: 0
has answer: http://stackoverflow.com/a/26529744
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41685415
answer count: 2
tagged with: android
has body: In my Android app I have json, which looks like : { "Records": [ { "RowIndex": "0", "NameValue": { "Name": "PropertyName1", "Value": "PropertyValue1" } }{ "RowIndex": "1", "NameValue": { "Name": "PropertyName2", "Value": "PropertyValue2" } } ] } I need to parce this json to object, which looks like: public class MyClass { public String PropertyName1; public String PropertyName2; } And result after parsing should be: public String PropertyName1 = "PropertyValue1"; public String PropertyName2 = "PropertyValue2"; Basically, the first json is equivalent of: { "PropertyName1" : "PropertyValue1", "PropertyName2" : "PropertyValue2" } Question: How can I parce first json without usage swith/case to search for the necessary Property?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41685644
has title: Parse json to necessary object

http://stackoverflow.com/q/26625793
type: UnansweredQuestion
has body: I've scheduled a job with annotation @Scheduled, which was supposed to process data and save it to database using spring data jpa. The save method was invoked without any exceptions but there was no insert to database. In the same annotated method I invoked findAll method which worked fine and fetched data. What could be a reason? @Repository public interface PossibleOfferLinkRepository extends PagingAndSortingRepository<PossibleOfferLink, Long> { } @Configuration @ComponentScan @EnableAutoConfiguration @Import({Scheduler.class}) @EntityScan(basePackages="model_package") public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } @EnableScheduling @ConditionalOnProperty(value= "property_name") public class Scheduler { ... @Scheduled(fixedRate=100000) public void scheduleCrawlerJob() throws MalformedURLException { Iterable<PossibleOfferLink> links = repo.findAll(); PossibleOfferLink link = repo.save(new PossibleOfferLink(new URL("..."))); } } Maven org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-batch org.springframework.boot spring-boot-starter-test test com.h2database h2 1.4.182 com.google.guava guava ${guava.version} org.easytesting fest-assert ${easytesting.version}
upvote count: 7
tagged with: spring
has comment: http://stackoverflow.com/comment/41860842
has title: Job run in @Scheduled does not invoke spring data jpa save
has answer: http://stackoverflow.com/a/26626833
has comment: http://stackoverflow.com/comment/41861096
score: 7
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/23118789
has comment: http://stackoverflow.com/comment/41860982
type: Question
has answer: http://stackoverflow.com/a/61771663
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/50663385
tagged with: spring-data-jpa
answer count: 3
has comment: http://stackoverflow.com/comment/41861988
has comment: http://stackoverflow.com/comment/41862284
has comment: http://stackoverflow.com/comment/41862793

http://stackoverflow.com/q/26597347
tagged with: java
has title: how can i save the avg to a text file and be printed out
has comment: http://stackoverflow.com/comment/41809123
upvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
score: -2
has comment: http://stackoverflow.com/comment/41809186
has answer: http://stackoverflow.com/a/26597489
has comment: http://stackoverflow.com/comment/41809094
has comment: http://stackoverflow.com/comment/41809087
downvote count: 2
has body: how wold i take the avg of the fallowing program and save the out come to a text file to be printed out import java.util.Scanner; public class freethrowpercent { public static void main(String[] args) { double freethrowsmade = 1; double freethrowsmissed = 0; Scanner input = new Scanner(System.in); System.out.println("enter 1 if freethorw is made enter 0 for freethrows missed"); freethrowsmade = input.nextDouble() + 1; freethrowsmissed = input.nextDouble() + 0; double answer = freethrowsmade / 2 * 100; System.out.println("percent is" + answer); } if that is possable
answer count: 1
has comment: http://stackoverflow.com/comment/41809117

http://stackoverflow.com/q/26569859
has body: Ok so this is my simple java calculator everything works fine I just need help with allowing decimals. Thanks a lot to who ever helps me with this, this is for a school project so I need an answer pretty fast :) import java.util.Scanner; public class javaProject { public static void main(String[] args) { int x; int y; String whatOp; Scanner input = new Scanner(System.in); System.out.println("please enter the first number"); x = input.nextInt(); System.out.println("please enter the second number"); y = input.nextInt(); Scanner op = new Scanner(System.in); System.out.println("Please enter the operation you want to use"); whatOp = op.next(); if (whatOp.equals("+")) { System.out.println("The answer is " + (x + y)); } else if (whatOp.equals("-")) { System.out.println("The answer is " + (x - y)); } else if (whatOp.equals("*")) { System.out.println("The answer is " + (x * y)); } else if (whatOp.equals("/")) { System.out.println("The answer is " + (x / y)); } else { System.out.println("Thats not a choice!"); } } }
type: UnansweredQuestion
score: 2
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26569896
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41758502
has answer: http://stackoverflow.com/a/26569889
answer count: 6
has comment: http://stackoverflow.com/comment/41758503
has answer: http://stackoverflow.com/a/26569992
has title: Simple Java Calculator (Need Decimal Help)
has answer: http://stackoverflow.com/a/26569888
linked to: http://stackoverflow.com/q/3730019
favorite count: 0
has answer: http://stackoverflow.com/a/26569942
has answer: http://stackoverflow.com/a/26569928

http://stackoverflow.com/comment/41878912
comment on: http://stackoverflow.com/a/26635526
score: 0
type: AnswerComment
type: Comment
has text: Thank you so much for responding! So that means that exception has nothing to do with the certificates not set up properly? They are all in .cer format and I imported them using my keytool to a keystore I created and I specified the path to it as a System property along with the password. Company says they have their server up and running. Maybe those errors about the cipher suite are causing the issue. I'm using a Mac OS 10.10 to do this. How can I make sure there is no firewall between me and the server? Sorry about the many questions but I'm pretty new with this. Thanks again!

http://stackoverflow.com/comment/41688924
score: 0
comment on: http://stackoverflow.com/q/26530949
type: Comment
type: QuestionComment
has text: But in that case I am not sure why you even need `ListDemo<T>` class. You could simply use `List<Integer> list = new ArrayList<>(); list.add(1)` or `List<String> list = new ArrayList<>(); list.add("foo");`

http://stackoverflow.com/a/26650085
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26649536
has body: Fixed it by adding a new function and a static variable, Like so: private static String gg = null; public static File lookup(File file, String name) { gg = null; return new File(lookupFile(file, name)); } private static String lookupFile(File file, String name) { File[] list = file.listFiles(); if(list != null) { for (File fil : list) { String n = fil.getName().replace(name, ""); if (n.length() != 0) { if(fil.isDirectory()) lookupFile(fil , name); } else if (n.length() == 0) { String g = fil.toPath().toString(); System.out.println(fil.getName()); System.out.println(g); gg = g; return gg; } } } return gg; }
answers question: http://stackoverflow.com/q/26649536
score: 0

http://stackoverflow.com/q/26661875
answer count: 1
has title: Why is my answer showing as Infinity?
tagged with: java
accepted answer: http://stackoverflow.com/a/26661922
has body: I am sort-of new to this so bear with me. I am creating a program that allows the user to enter in the scores of a piece of coursework and an exam score and then total grade will be calculated. The values entered have to be between 1 and 10. The coursework is work 40% and the exam is worth 60%. The values 1-10 have to be converted into percentages and this is where I believe the infinity error is occurring. This is my code (there will be 'if' and 'else' statements later in the code but I think I'll be ok with that. Also ignore Final Classification at the bottom): import javax.swing.JOptionPane; public class Question3 { public static void main(String[] args) { String Coursework, Exam; Coursework = JOptionPane.showInputDialog("Please enter coursework score out of 10:"); Exam = JOptionPane.showInputDialog("Please enter exam score out of 10"); double CourseworkDoub, ExamDoub, CourseworkPerc, ExamPerc, FinalMark; CourseworkDoub = Double.parseDouble(Coursework); CourseworkPerc = (CourseworkDoub / 0.25); ExamDoub = Double.parseDouble(Exam); ExamPerc = (ExamDoub / (10 / 60)); FinalMark = (CourseworkPerc + ExamPerc); JOptionPane.showMessageDialog(null, "Final mark: " + FinalMark + "\nFinal classification is a ", "Result", JOptionPane.INFORMATION_MESSAGE); } } CourseworkPerc and ExamPerc seem to be the problem. I want to be able to show the percentage to 2 decimal places. For example, 5 out of 10 in the coursework (worth 40%) = 20.00% and 5 out of 10 in the exam (worth 60%) = 30.00% therefore the overall grade is 50.00% Hopefully this makes sense. Appreciate any advice given. Thanks
tagged with: percentage
has comment: http://stackoverflow.com/comment/41925780
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26661922
upvote count: 2
tagged with: double

http://stackoverflow.com/q/26653469
tagged with: java
tagged with: javafx
upvote count: 1
answer count: 0
type: UnansweredQuestion
has body: In my project, I have use jdk8 in javafx project theme will appear in After that i will change jdk8u25 how to resolve that problems. I am also ref for this How to set JavaFX default skin http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/
has title: How to set default javafx themes
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41919795
favorite count: 0
has comment: http://stackoverflow.com/comment/41936942
linked to: http://stackoverflow.com/q/17297777
type: Question
tagged with: java-8

http://stackoverflow.com/comment/41896842
score: 0
has text: post the exact exception please
comment on: http://stackoverflow.com/q/26645449
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27551556
type: Answer
score: 1
upvote count: 1
has body: So, what's the most efficient way of implementing k-Buckets? That depends. If you want to do an implementation with bells and whistles (e.g. bucket splitting, multi-homing) then you need a flexible list or a tree. In my experience a copy on write array + binary search works well for the routing table because you rarely modify the total number of buckets, just the content of buckets. With CoW semantics you need less locking since you can just fetch a current copy of the array, retrieve the bucket of interest and then lock on the bucket. Or use an atomic array inside each bucket. But of course such optimizations are only necessary if you expect high throughput, most DHT nodes see very little traffic, a few packets per second at most, i.e. there's no need to involve multiple threads unless you implement a specialized node that has so much throughput that multiple threads are needed to process the data. CoW works less well for routing-table-like lookup caches or the ephemeral visited-node/target node sets built during a lookup since those get rapidly modified. ConcurrentSkipListMaps can be a better choice if you are expecting high load. If you want a simplified, approximate implementation then just use a fixed-size array of 160 elements where the array index is the shared-prefix-bits count relative to your node ID. This performs reasonably well but doesn't allow for some of the optimizations proposed by the full kademlia paper.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26564506
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26564506

http://stackoverflow.com/q/26646089
type: AnsweredQuestion
tagged with: clone
has body: Given the following codes: ArrayList&lt;String&gt; original = new ArrayList&lt;String&gt;(); original.add("one"); original.add("two"); original.add("three"); Cache ch = new Cache(); ch.store(original); original.remove(0); original.remove(0); System.out.println("modified list is"+original); System.out.println("cache list is"+ch.getCache()); and a Cache class: public class Cache { private ArrayList&lt;String&gt; clone = new ArrayList&lt;String&gt;(); public void store(ArrayList&lt;String&gt; original){ this.clone = original; } public ArrayList&lt;String&gt; getCache(){ return this.clone; } } And the output is : modified list is[three] cache list is[three] Actually, I want to use the cache to store the original list contains"one, two ,three". When it stores that list, and a remove is implemented with the 'original' list, it does not affect the one stored in the cache, means it still contains "one,two,three". So how to do it?
tagged with: java
accepted answer: http://stackoverflow.com/a/26646126
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26646294
possible better answer: http://stackoverflow.com/a/26646170
has answer: http://stackoverflow.com/a/26646170
downvote count: 0
has title: make deep copy in java
has comment: http://stackoverflow.com/comment/41897664
answer count: 3
score: 1
has answer: http://stackoverflow.com/a/26646126
favorite count: 0

http://stackoverflow.com/q/26638274
type: UnansweredQuestion
upvote count: 0
tagged with: java
has title: error in Java Core in class thu_nghiem
type: Question
has answer: http://stackoverflow.com/a/47440571
answer count: 2
has body: I have class IP. package DES; public class IP { private int a[] ={58,50,42,34,26,18,10}; public void hoanvi(int x[]) { int y[] = new int[7]; for(int i=0;i&amp;lt;7;i++) y[i] = x[i]; for(int i=0;i&amp;lt;7;i++) { int z = a[i]; x[i] = y[z]; } } in main I writte: import DES.*; public class thu_nghiem { public static void main(String[] args) { int a[]={58,50,42,34,26,18,10}; IP b = new IP(); b.hoanvi(a); System.out.println(a[6]); } } JVM messeage error ! Why ?
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/26638435
favorite count: 0

http://stackoverflow.com/comment/41888863
comment on: http://stackoverflow.com/q/26640942
score: 1
type: Comment
type: QuestionComment
has text: Use `List<ColsDataset>` not `ColsDataset[]`... Un/Marshalling does not work with primitive array types.

http://stackoverflow.com/comment/41919303
comment on: http://stackoverflow.com/q/26639915
score: 0
has text: @SlavaSemushin, I've made some edits and linked to a project that is giving me the same problems. Any advice is much appreciated.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41716544
comment on: http://stackoverflow.com/q/26546792
type: Comment
type: QuestionComment
has text: line 69 in ClosetMainActivity.java is GlobalVariable globalVariable = (GlobalVariable)ClosetMainActivity.this.getApplicationContext();
score: 0

http://stackoverflow.com/q/26662948
tagged with: java
type: Question
tagged with: wso2
tagged with: wso2-api-manager
tagged with: svn
has body: I have setup a distributed, clustered WSO2 API Manager 1.6.0 environment with SVN-based Deployment Synchronizing. The SVN Jar will execute upon start-up, picking up any new additions to the SVN respository. TID: [0] [AM] [2014-10-30 14:52:57,790] INFO {org.apache.synapse.rest.API} - Initializing API: admin--TestAPI_Phil:v0.1 {org.apache.synapse.rest.API} TID: [0] [AM] [2014-10-30 14:52:57,798] INFO {org.apache.synapse.deployers.APIDeployer} - API named 'admin--TestAPI_Phil:v0.1' has been deployed from file : /opt/wso2am-1.6.0/repository/deployment/server/synapse-configs/default/api/admin--TestAPI_Phil_v0.1.xml {org.apache.synapse.deployers.APIDeployer} However, after a few minutes, and the svnClientBundle jar performs its job, it goes to sleep, and will not reactivate upon update, even though the Store/Publisher says that the Gateways have been updated: TID: [0] [AM] [2014-10-30 15:21:06,965] INFO {org.apache.synapse.rest.API} - Initializing API: admin--TestAPI-2:v0.1 {org.apache.synapse.rest.API} TID: [0] [AM] [2014-10-30 15:21:20,115] INFO {org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask} - Sent [SynchronizeRepositoryRequest{tenantId=-1234, tenantDomain='carbon.super', messageId=a3e77858-985d-4616-9b50-d6c9b47c0bf2}] {org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask} The Gateways do not pick up the new API being pushed out. How would I go about making WSO2 realize there is an update, or script using the svnClientBundle-1.0.0.jar to periodically check the SVN repository? Should I make a BeanShell script? GitHub Gists with the full log output are located here: https://gist.github.com/predatorian3/024193918330af2140bb I have also followed hte documentation: https://docs.wso2.com/display/AM140/SVN-Based+Deployment+Synchronizer https://docs.wso2.com/display/CLUSTER420/SVN-based+Deployment+Synchronizer https://docs.wso2.com/display/CLUSTER420/Clustering+API+Manager#ClusteringAPIManager-Installingandconfiguringthedatabases The Documentation for…
has answer: http://stackoverflow.com/a/26714370
score: 0
answer count: 1
has title: WSO2 - svnClientBundle.jar goes to sleep after inactivity and does not resume function
accepted answer: http://stackoverflow.com/a/26714370
type: AnsweredQuestion

http://stackoverflow.com/q/26530592
tagged with: java
has answer: http://stackoverflow.com/a/26531277
tagged with: set
has comment: http://stackoverflow.com/comment/41687846
type: Question
tagged with: tree
score: 0
answer count: 1
has body: i have scrathing my head few days about this problem. I have CSV file with structure Parent Child ParA ChildA ParB ChildB ParB ChildC ChildC ChildE ChildC ChildE . . So,there is more that one roots, and i want to make List or Set, with this structure: Set made of Lists: 0 ParA ChildA, 1 ParB ChildB,ParB ChildC, ChildC ChildE . . I am working in Java. I made Set made of unique parents, and i dont know how to add every child to each parent. End Result is Set which each element will be Diagram with parent-child structure. Thanks.
has title: Putting parent-child structure from CSV file in List
tagged with: http://stackoverflow.com/tag/csv
accepted answer: http://stackoverflow.com/a/26531277
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/comment/111230277
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27276523
has text: When migrating legacy code to newer mysql db and drivers, I found that setting serverTimezone=UTC skews all of the queries for the shift. My servers and application are in Eastern timezone (America/Detroit). I solved my problem by using serverTimezone=serverTimezone=EST5EDT. My connection string for mysql driver version 8 is: jdbc:mysql://localhost:3306/dbname?useLegacyDatetimeCode=false&amp;serverTimezone=EST5EDT&amp;useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true

http://stackoverflow.com/comment/41663014
type: QuestionComment
has text: I am pretty new to java, and using BlueJ. I am not sure how to use the debugger, unfortunately
comment on: http://stackoverflow.com/q/26516302
score: 0
type: Comment

http://stackoverflow.com/comment/41673959
has text: You fill in the array with `temp` when there is no duplicate, but where do you handle if there is duplicate?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26522603
score: 0

http://stackoverflow.com/q/26642074
type: Question
has answer: http://stackoverflow.com/a/26644322
answer count: 1
score: 0
has body: Can someone tell me why this code is not saving the picture to the gallery anymore? I had it working at some point, then i changed something somewhere else, and now this doesn't work. private void openImageIntent() { // Determine Uri of camera image to save. final File storageDir = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); final String fname = ClassName.getUniqueImageFilename(); final File sdImageMainDirectory = new File(storageDir, fname); outputFileUri = Uri.fromFile(sdImageMainDirectory); // Camera. final List&lt;Intent&gt; cameraIntents = new ArrayList&lt;Intent&gt;(); final Intent captureIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); final PackageManager packageManager = getPackageManager(); final List&lt;ResolveInfo&gt; listCam = packageManager.queryIntentActivities( captureIntent, 0); for (ResolveInfo res : listCam) { final String packageName = res.activityInfo.packageName; final Intent intent = new Intent(captureIntent); intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name)); intent.setPackage(packageName); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); cameraIntents.add(intent); } // Filesystem. final Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_GET_CONTENT); // Chooser of filesystem options. final Intent chooserIntent = Intent.createChooser(galleryIntent, "Chose a source"); // Add the camera options. chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[] {})); startActivityForResult(chooserIntent, REQUEST_IMAGE_CAPTURE); } private static String getUniqueImageFilename() { // TODO Auto-generated method stub String fileName = "img_" + System.currentTimeMillis() + ".jpg"; return fileName; } This is the error i get: 10-29 23:53:50.692: E/BitmapFactory(12547): Unable to decode stream: java.io.FileNotFoundException: /file:/storage/emulated/0/DCIM/img_141462322…
accepted answer: http://stackoverflow.com/a/26644322
tagged with: android
has title: Camera not saving image
type: AnsweredQuestion
tagged with: java

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/26649389
tag name: httpsurlconnection

http://stackoverflow.com/a/26749172
type: Answer
accepted answer of: http://stackoverflow.com/q/26658072
has body: On Mac OS X, the JDK will not search the path for files ending in .so, or anything else than .dylib or .jnilib. We need to make sure filenames of native libraries end with .dylib or .jnilib. Reference: https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html
answers question: http://stackoverflow.com/q/26658072
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26576330
linked to: http://stackoverflow.com/q/9482731
downvote count: 0
has answer: http://stackoverflow.com/a/65425217
possible better answer: http://stackoverflow.com/a/26577939
answer count: 3
has title: using MySQL event scheduler with Java
has comment: http://stackoverflow.com/comment/41780176
has answer: http://stackoverflow.com/a/26587139
has body: I am trying to create events using Java code with hibernate. I verified my syntax for CREATE EVENT in MySQL Workbench, and I verified my Java code with a simple UPDATE query. But when I am trying to use both it just doesn't work. I am not getting any error message, just that 0 rows were affected. My code is as follows: String sql = "CREATE EVENT IF NOT EXISTS test_event ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 20 SECOND ON COMPLETION PRESERVE ENABLE DO UPDATE my_table SET last_error_message='my test' WHERE ID=17;"; session.beginTransaction(); SQLQuery query = session.createSQLQuery(sql); int result = query.executeUpdate(); session.getTransaction().commit(); .... session.close(); thanks a lot
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26587139
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
has answer: http://stackoverflow.com/a/26577939
type: Question

http://stackoverflow.com/comment/41720744
type: Comment
comment on: http://stackoverflow.com/q/26548294
score: 0
has text: You need to consider this scenario for NATed firewalls. The firewall may create different port mappings for different destinations. More precisely, when Client A sends a packet to server, A's firewall may give it some port(say 51000). When Client A sends packet to Client B after knowing its IP & port, the firewall may use some different port mapping(say 51001). So B might be sending packet to port 51000, as server identifies this & informs B, but firewall at A will accept the packet only if B sends a packet to port 51001. At port 51000, only server could reply back & accepted by A's firewall.
type: QuestionComment

http://stackoverflow.com/comment/41823172
score: 3
type: Comment
comment on: http://stackoverflow.com/a/26601117
has text: Well, after some more testing I found out that when you create a thread it doesn't take default stack size (from 256k to 1M) from a native memory, it takes almost nothing. So the Xss JVM param is about MAXIMUM stack size in memory per thread, not initial on creation. Therefore creating 10 or 1000 threads doesn't make alot difference looking from a memory perspective.
type: AnswerComment

cocos2d-android
type: Tag
tags question: http://stackoverflow.com/q/26610383
tag name: cocos2d-android

http://stackoverflow.com/q/26517169
has comment: http://stackoverflow.com/comment/41664383
has body: I have a java web application that runs with tomcat7 and logs with log4j. I want to send my logs to rsyslog. I have use the appeneder in my log4j.xml file. But I still don't see the logs that I've implemented in my java application in rsyslog. I can see them in catalina.out but not on rsyslog. Do I have to define new rules for rsyslog configuration? Thanks in advance. Updated log4j.xml : <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'> <!-- <category name ="my.package" /> --> <level value ="debug" /> <level value="info"/> <appender-ref ref="SYSLOG"/>
has comment: http://stackoverflow.com/comment/41992618
has title: Log tomcat logs to rsyslog
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: log4j2
tagged with: rsyslog
type: Question
has comment: http://stackoverflow.com/comment/42026196
has comment: http://stackoverflow.com/comment/42332482
has comment: http://stackoverflow.com/comment/41683727
has comment: http://stackoverflow.com/comment/42293664
upvote count: 1
tagged with: tomcat
tagged with: log4j
favorite count: 0

http://stackoverflow.com/a/26519980
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41706611
has comment: http://stackoverflow.com/comment/41686971
has comment: http://stackoverflow.com/comment/41706625
has body: It seems like you just need to do... String s[] = scanner.nextLine().split(","); Collections.addAll(data, s);
answers question: http://stackoverflow.com/q/26519816
downvote count: 0

http://stackoverflow.com/q/26590446
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26590587
tagged with: java
has title: Find all repeated values
type: Question
has comment: http://stackoverflow.com/comment/41795745
downvote count: 4
upvote count: 0
has body: I am writing a code to find duplicate values which have been entered in an array. But i am not able to get code right. Can anyone suggest me with an improvised code then this (using Arraylist)? package com.Test1.java; import java.util.Arrays; import java.util.Scanner; public class Test1 { private static Scanner s; public static void main(String[] args) { int n; s = new Scanner(System.in); System.out.println("Enter the number of values you want to enter:"); n=s.nextInt(); int number[]=new int[n]; System.out.println("Enter the values:"); for(int i=1;i&lt;=number.length;i++) { number[i]=s.nextInt(); } System.out.println(“The Values Entered Are:”); Arrays.sort(number); for(int j=1;j&lt;=number.length;j++) { if(number[j]==number[j-1]) { System.out.println("The dupliclate number is"+number[j]); } } } } I am getting this error output: How many values you want to Enter: 5 Enter the values: 1 2 2 3 4 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at com.Test1.java.Test1.main(Test1.java:17)**
has comment: http://stackoverflow.com/comment/41795924
favorite count: 0
accepted answer: http://stackoverflow.com/a/26590587
answer count: 3
possible better answer: http://stackoverflow.com/a/26590523
has answer: http://stackoverflow.com/a/26590523
has comment: http://stackoverflow.com/comment/41795662
score: -4
linked to: http://stackoverflow.com/q/17967114
has answer: http://stackoverflow.com/a/26590526

http://stackoverflow.com/q/26592803
score: 0
tagged with: android-listview
tagged with: android
has body: So im trying to update a list with the information provided from a server communicated by JSON. This is the class doing the communication: package com.example.simon_000.buddy; public class TCPConnection { private RunOnThread thread; private Receive receive; private MainActivity ma; private Socket socket; private DataInputStream input; private DataOutputStream output; private InetAddress address; private int connectionPort; private String ip; private Exception exception; public static String id; public static ArrayList&lt;members&gt; memberList = new ArrayList&lt;members&gt;(); public static ArrayList&lt;String&gt; groupsList = new ArrayList&lt;String&gt;(); public static ArrayList&lt;String&gt; namesList = new ArrayList&lt;String&gt;(); public TCPConnection(String ip, int connectionPort, MainActivity ma) { this.ip = ip; this.connectionPort = connectionPort; thread = new RunOnThread(); this.ma = ma; } public void connect() { thread.start(); thread.execute(new Connect()); } public void disconnect() { thread.execute(new Disconnect()); } public void send(String expression) { thread.execute(new Send(expression)); } private class Receive extends Thread { public void run() { String result; try { while (receive != null) { result = (String) input.readUTF(); newMessage(result); } } catch (Exception e) { // IOException, ClassNotFoundException receive = null; } } } public void newMessage(final String answer) { ma.runOnUiThread(new Runnable() { public void run() { String message = answer; String type; JSONObject jObj = null; try { Log.d("TEST", message); jObj = new JSONObject(message); type = jObj.getString("type"); if (type.equals("groups")) { recevieGroups(jObj); } else if (type.equals("register")) { recevieID(jObj); } else if (type.equals("members")) { receiveMembers(jObj); } else if (type.equals("location")) { receiveLocations(jObj); } else if (type.equals("locations")) { receiveLocations(jObj); } } catch (JSONException e) { e.printStackTrace(); } } }); } public void receive…
type: AnsweredQuestion
tagged with: android-fragments
has answer: http://stackoverflow.com/a/26592987
accepted answer: http://stackoverflow.com/a/26592987
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 1
has title: trying to update list in fragment with JSON info

http://stackoverflow.com/a/26568160
has body: OK,It is clear from HBase Api Pagination doc that the pagination filter does not guarantee to give rows &lt;= pagination factor since the filter is applied for each region server
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26562014

http://stackoverflow.com/comment/41871036
has text: Why don't you just use the `getValueAt(Object node, int column)`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26591255
score: 0

http://stackoverflow.com/a/26522187
score: 2
downvote count: 0
has body: You don't need Spring for that. That's the whole point of dependency injection: you're able to inject whatever you want, explicitely, in your unit tests. Unit tests should not use Spring. // constructor injection B mockB = mock(B.class); A aUnderTest = new A(mockB); or // setter injection B mockB = mock(B.class); A aUnderTest = new A(); aUnderTest.setB(mockB); or // Field injection, requiring reflection, done by Mockito @Mock private B mockB; @InjectMocks private A aUnderTest; @Before public void initMocks() { MockitoAnnotations.initMocks(this); }
answers question: http://stackoverflow.com/q/26522043
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41674601
has comment: http://stackoverflow.com/comment/41674326

http://stackoverflow.com/comment/41850627
type: AnswerComment
has text: @AndyThomas: Won't modifying the constructor result in a different "class signature" such that the deserializer doesn't know which class was serialized?
type: Comment
comment on: http://stackoverflow.com/a/26619453
score: 0

http://stackoverflow.com/comment/41902818
comment on: http://stackoverflow.com/q/26647086
score: 0
has text: I already take different Icon ..could you please give email Id ?? ..so that I will send my code >actually my problem is that third parent don't have child but it show + sign on row why
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26597164
answers question: http://stackoverflow.com/q/26597099
score: 0
type: Answer
has body: The easiest way would be to give up on using Scanner to do the word breaking! Read in a whole line, then use String.split(" ") to break the line into words. If you're dead keen on sticking with Scanner for all aspects, you can use one Scanner to read in the next line, and then use another Scanner to do the word breaking on what you just read in: String wholeLine = scan.nextLine(); Scanner innerScan = new Scanner(wholeLine); lineNum++; while (innerScan.hasNext()) System.out.println("Word: " + innerScan.next() + " line: " + lineNum); That saves you worrying about regular expressions for the String.split().

http://stackoverflow.com/q/26566607
type: Question
has comment: http://stackoverflow.com/comment/41752630
has comment: http://stackoverflow.com/comment/41752515
tagged with: java
has comment: http://stackoverflow.com/comment/41753361
has comment: http://stackoverflow.com/comment/41752339
has comment: http://stackoverflow.com/comment/41753133
has comment: http://stackoverflow.com/comment/41752264
has comment: http://stackoverflow.com/comment/41752611
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41752381
has comment: http://stackoverflow.com/comment/41752984
has comment: http://stackoverflow.com/comment/41752773
has comment: http://stackoverflow.com/comment/41752280
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41752659
tagged with: android
has comment: http://stackoverflow.com/comment/41752403
has title: Play video Intent in android
has comment: http://stackoverflow.com/comment/41753013
score: 2
tagged with: video
has comment: http://stackoverflow.com/comment/41754770
has comment: http://stackoverflow.com/comment/41754802
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41752859
has body: In my App I want that when user clicks a button, an intent should start and shows list of video players in the phone. By choosing one of them a video should start to play. I use this code: Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(path))); intent.setDataAndType(Uri.parse(String.valueOf(path)), "video/mp4"); startActivity(intent); With this code when I click on the button, MXPlayer started directly and plays video. In the end of video, My App closes entirely! but I want to see a list of players and after end of video back to my App! How can I do this? EDIT(Whole Code): public class MenuActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); l_video.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String file_name="34743773"; File path = new File(Environment.getExternalStorageDirectory() + File.separator + "AAAAA"+ File.separator +file_name+".mp4"); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(path))); intent.setDataAndType(Uri.parse(String.valueOf(path)), "video/*"); startActivity(intent); } }); } }
tagged with: android-intent

http://stackoverflow.com/q/26550752
has answer: http://stackoverflow.com/a/26550954
score: 0
has body: I'm beginner with Mockito and I have problem with creating stub. I have the following interface: public interface IMsgField { public String getName(); public Object getValue(); } One class implements above interface as follows public final class CMsgField implements IMsgField { private String name; private Object value; public CMsgField(String name, Object value) { this.name = name; this.value = value; } . . . } And I have one more class : class FieldsWrapper { private Map&lt;String, IMsgField&gt; fields = new HashMap&lt;String, IMsgField&gt;(); . . . public Map&lt;String, IMsgField&gt; getFields() { return fields; } } I've created the following junit test: @Test public void test() { FieldsWrapper fieldsWrapper = mock(FieldsWrapper.class); stub(fieldsWrapper.getFields()).toReturn(new HashMap&lt;String, IMsgField&gt;()); stub(fieldsWrapper.getFields().get("id_object")).toReturn(new CMsgField("id_object", "100")); . . . } And when I ran this test I received the following exception at last line in above test : org.mockito.exceptions.misusing.WrongTypeOfReturnValue: CMsgField cannot be returned by getFields() getFields() should return Map ... I don't why, please help me with this problem. Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/41723817
tagged with: java
accepted answer: http://stackoverflow.com/a/26550954
answer count: 3
tagged with: mockito
has title: Mockito, JUnit and Map nested in another class
tagged with: junit
has answer: http://stackoverflow.com/a/26550892
possible better answer: http://stackoverflow.com/a/26550892
tagged with: dictionary
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26550967

http://stackoverflow.com/a/26616290
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26615801
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41844595
score: 2
has comment: http://stackoverflow.com/comment/41844424
upvote count: 2
answers question: http://stackoverflow.com/q/26615801
has body: Create two different classes that implement your interface, and use a different class in each project: Project C interface I { averageCalculation(); } class CClassForA implements I{ averageCalculation(){...} // for A } class CClassForB implements I{ averageCalculation(){...} // for B } Project A { I i1 = new CClassForA(); i1.averageCalculation(); } Project B { I i2 = new CClassForB(); i2.averageCalculation(); }

http://stackoverflow.com/q/26546139
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26548131
accepted answer: http://stackoverflow.com/a/26548131
has body: I have problems with manually (through my java code) selecting items in a JTree. I did google the problem and found solutions here and here: Java: How to programmatically select and expand multiple nodes in a JTree? http://www.coderanch.com/t/543214/GUI/java/Select-node-Jtree This code worked for me only partially. Once I tried selecting deeper nested nodes, I ran into problems. Since my production code is very cluttered I built an example and reproduced my exact problem in it. DummyView.java package de.fortis.tcws.client.controller; import java.awt.BorderLayout; import java.awt.Dimension; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; public class DummyView extends JFrame { private static final long serialVersionUID = 7301762327073611779L; private static final String ROOT_NAME = "Root"; public JTree tree; public DefaultTreeModel model; public JPanel right; public DummyView() { super(); initGui(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void initGui() { setSize(1600, 800); tree = new JTree(); tree.setEditable(false); tree.addTreeSelectionListener(new DumSelectionListener()); tree.addTreeExpansionListener(new DumExpansionListener()); DefaultMutableTreeNode root = new DefaultMutableTreeNode(ROOT_NAME); tree.setModel(model = new DefaultTreeModel(root, true)); refreshNode(root); tree.setPreferredSize(new Dimension(200, 800)); getContentPane().add(new JScrollPane(tree), BorderLayout.WEST); JScrollPane rightPan = new JScrollPane(right = new JPan…
type: Question
tagged with: treenode
tagged with: jtree
tagged with: java
has title: How to manually select a node in a JTree [problems with nested nodes]
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/10242896
favorite count: 0

http://stackoverflow.com/q/26559777
has title: JFrame closes immediately
downvote count: 0
answer count: 1
has body: I am attempting to make a pong game but every time I try to launch it to test the buffer strategy, it immediately closes. I tried resolving this by adding a start and stop synchronized void, but it did not seem to work. Normally this kind of thing can be easy to fixed but I am baffled. package pong; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import javax.swing.JFrame; public class Game extends Canvas implements Runnable { private static final long serialVersionUID = 1L; JFrame frame; //game window stuff public final int WIDTH = 400; public final int HEIGHT = WIDTH / 16 * 9; public final Dimension gameSize = new Dimension(WIDTH, HEIGHT); public final String TITLE = "Pong InDev"; BufferedImage Image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); static boolean gameRunning = false; //Is game running? public void run() { while (gameRunning) { tick(); render(); } } //attempted to fix problem public synchronized void start1() { gameRunning = true; new Thread(this).start(); System.exit(0); //End start method } public static synchronized void stop() { gameRunning = false; //End stop method } public Game() { frame = new JFrame(); setPreferredSize(gameSize); setMinimumSize(gameSize); setMaximumSize(gameSize); frame.add(this, BorderLayout.CENTER); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setResizable(false); frame.setTitle(TITLE); frame.setLocationRelativeTo(null); frame.setLayout(new BorderLayout()); } public void tick() { } public void render() { BufferStrategy bs = getBufferStrategy(); if(bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.drawImage(Image, 0, 0, getWidth(), getHeight(), null); g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.dispose(); bs.show(); } public static void main…
favorite count: 0
type: Question
score: 3
has answer: http://stackoverflow.com/a/26559796
tagged with: pong
tagged with: jframe
upvote count: 3
tagged with: multithreading
tagged with: swing
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/41761941
has text: Yes , i know required attributes should be in the constructor of the UserBuilder class , but defining required attributes as final does not effect code performance ??
comment on: http://stackoverflow.com/q/26571817
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42766848
has text: Thanks, I'll give this a try. The only issue is that I have used guava optional throughout my application. As long is dropwizard and JDBI are fully compatible with java 8 optional I don't see it being a problem.
score: 0
comment on: http://stackoverflow.com/a/27126731
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41722681
comment on: http://stackoverflow.com/q/26550150
type: QuestionComment
has text: Please include some sample code of what you've tried so far.
score: 0
type: Comment

http://stackoverflow.com/comment/41759568
comment on: http://stackoverflow.com/q/26570543
has text: @KickButtowski That's irrelevant to the question. The meaning of `readInt()` is obvious, even assuming that it is a custom method.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/41704642
type: Comment
has text: @cyngus It's not "JVM vagaries"; pooled boxes are specified by the JLS for [-128..127].
type: QuestionComment
comment on: http://stackoverflow.com/q/26539546
score: 0

http://stackoverflow.com/q/26621360
possible better answer: http://stackoverflow.com/a/26621676
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/41853580
has title: JAVA converting from String to Binary and then back to String in file
tagged with: file-io
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/917163
score: 3
has body: I want to read text from file which is "Hello" and then I want to convert this text to corresponding Binary form like: 01001000 01100101 01101100 01101100 01101111 Now, I after binary conversion, I want to again convert the same 01001000 01100101 01101100 01101100 01101111 to Hello and write it to file And How can the same be done for multiple words like "Hello World my name is XYZ" How can I possibly do that? Please help
has comment: http://stackoverflow.com/comment/41853247
downvote count: 0
tagged with: string
favorite count: 0
tagged with: binary
duplicate of: http://stackoverflow.com/q/917163
type: Question
has answer: http://stackoverflow.com/a/26621553
answer count: 2
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26621676
has comment: http://stackoverflow.com/comment/41853215
accepted answer: http://stackoverflow.com/a/26621553

http://stackoverflow.com/a/26580575
has body: What if none of those if is validated You have to provide a return value to solve this issue public static int playGame(String userChoose) { System.out.println("Enter your choice."); userChoose=kbd.nextLine().toLowerCase(); String computerChoose=computerChoose(); if (userChoose.equals(computerChoose)) { return 3; } else if (userChoose.equals("rock")) { if (computerChoose.equals("scissors")) return 1; else if (computerChoose.equals("paper")) return 2; } else if (userChoose.equals("paper")) { if (computerChoose.equals("scissors")) return 2; else if (computerChoose.equals("rock")) return 1; } else if (userChoose.equals("scissors")) { if (computerChoose.equals("paper")) return 1; else if (computerChoose.equals("rock")) return 2; } else return -1; }
answers question: http://stackoverflow.com/q/26580529
type: Answer
score: 0

http://stackoverflow.com/q/26638445
type: Question
score: 0
has answer: http://stackoverflow.com/a/26638831
accepted answer: http://stackoverflow.com/a/26638831
answer count: 1
has body: I'm creating a simple control to browse for and sample Audio files. I want to use an ObjectProperty&lt;File&gt; so that I can bind some properties of the button responsible for playing the file: PlayButton.disableProperty.bind(this.BGMFile.isNull()); PlayButton.textProperty.bind(this.BGMFile.asString()); So then there will be three things that I will need to override, two of which I have successfully done, and so will not get into The third is the asString method: new SimpleObjectProperty&lt;File&gt;(this, "BGM File", null){ /*yadda yadda overrides*/ @Override public StringBinding asString(){ if (super.get() != null &amp;&amp; super.get().exists()) return (StringBinding) Bindings.format( super.get().getName(), this ); else return (StringBinding) Bindings.format("[NONE]", this); } } This feels correct to me, and I even ripped the code from grepCode here, but when I browse for a file using the FileChooser I have setup and select the file I want to use, and then set it to the SimpleProperty the button text stays as [NONE]. This is the code for browsing for the file: this.btnBrowseBGM.setOnAction((ActionEvent E) -&gt; { FileChooser FC = new FileChooser(); FC.getExtensionFilters().add(Filters.AudioExtensions()); FC.setTitle("Browse for Background Audio File"); File F = FC.showOpenDialog(this.getScene().getWindow()); if (F != null &amp;&amp; F.exists()) try { this.BGMFile.set(Files.copy( F.toPath(), Paths.get("Settings/Sound/", F.getName()), StandardCopyOption.REPLACE_EXISTING ).toFile()); } catch(IOException ex) { Methods.Exception( "Unable to copy file to Settings Sound Directory.", "Failed to copy Sound File", ex); this.BGMFile.set(F); } else this.BGMFile.set(null); E.consume(); }); Because the path doesn't exist it yells at me (which I expected) but it still should be setting the BGMFile property to F. I know it does because the toggle button becomes active and pressing it plays the sound file. So what am I missing/doing wrong here? EDIT: I think I may have an idea: O…
tagged with: binding
has title: How do I properly bind a .Text property to the Overridden .asString() method of a SimpleObjectProperty?
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: file
tagged with: object-property

http://stackoverflow.com/q/26625741
tagged with: sqlite
has body: I've got this method in one class filling an Intent with data and then pass it back to the activity that started the method. Here I am using the intent to add the item to my database in onActivityResult() But as the title indicates I'm getting an "failure delivering result resultinfo" error. Can anyone see why I get this error? Heres the essential part of my code: from class 1, receiving the Intent : @Override protected void onActivityResult(int reqCode, int resCode, Intent data){ super.onActivityResult(reqCode, resCode, data); if(reqCode == ENTER_DATA_REQUEST_CODE &amp;&amp; resCode == RESULT_OK){ hkDBhelper.addItem(data.getExtras().getString("tag_grocery_foodItem"), data.getExtras().getString("tag_grocery_weight"), data.getExtras().getString("tag_grocery_price"), data.getExtras().getString("tag_grocery_brand"), data.getExtras().getString("tag_grocery_category")); hkCursorA.changeCursor(hkDBhelper.listAll()); } } Edit: added: @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.addItem) { startActivityForResult(new Intent(this, AddFood.class), ENTER_DATA_REQUEST_CODE); return true; } return super.onOptionsItemSelected(item); } And class 2, sending the Intnet: public void addItem(){ setFood = itemFood.getText().toString(); setWeight = itemWeight.getText().toString(); setPrice = itemPrice.getText().toString(); setBrand = itemBrand.getText().toString(); setCategory = catagorySpinner.getSelectedItem().toString(); if(setFood.length() != 0 &amp;&amp; setWeight.length() != 0 &amp;&amp; setPrice.length() != 0 &amp;&amp; setBrand.length() != 0 &amp;&amp; setCategory.length() != 0){ Intent newIntent = getIntent(); newIntent.putExtra("tag_grocery_foodItem", setFood); newIntent.putExtra("tag_grocery_weight", setWeight); newIntent.putExtra("tag_grocery_price", setPrice); newIntent.putExtra("tag_grocery_brand", setBrand); newIntent.putExtra("tag_grocery_category", setCategory); this.setResult(RESULT_OK, newIntent); finish(); }…
has comment: http://stackoverflow.com/comment/41861150
favorite count: 0
has comment: http://stackoverflow.com/comment/41861044
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41860847
upvote count: 1
tagged with: android-intent
has comment: http://stackoverflow.com/comment/41860907
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26626062
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/29164732
has title: onActivityResult() and: failure delivering result resultinfo who=null request=1 result=-1 data=intent (has extras)
tagged with: onactivityresult
tagged with: android

http://stackoverflow.com/a/26531631
has body: No. This is not the way you can do it. You can not store an int in a list that wants a element of type T. ListDemo&lt;T&gt; and List&lt;T&gt;, in both these cases, the type parameter T is different. You need to do this: List&lt;Integer&gt; listDemo = new ArrayList&lt;&gt;(); Then, and only Then, you cad add integers in your list.
has comment: http://stackoverflow.com/comment/41690263
type: Answer
answers question: http://stackoverflow.com/q/26530949
score: 0

http://stackoverflow.com/comment/41876913
type: QuestionComment
has text: You're right about "y-1"(fixed it), but i made the if statement say x.size() == 0 so, if I'm getting "Empty" as the output, then the ArrayList is empty so the Scanner isn't reading or PrintWriter isn't writing.
score: 0
comment on: http://stackoverflow.com/q/26634533
type: Comment

http://stackoverflow.com/a/26554537
has body: Well, your run method calls Node n = getSilentNeigh(); This call may return null, and you use the n variable without checking that it's not null. @Override public void run() { while(flag() &gt; 1); Node n = getSilentNeigh(); // this call can return null System.out.println(name + " sends token to " + n.getName()); // you are probably getting // NullPointerException here n.sendToken(this, "token"); }
downvote count: 0
has comment: http://stackoverflow.com/comment/41730776
type: Answer
answers question: http://stackoverflow.com/q/26554478
score: 1
upvote count: 1

http://stackoverflow.com/q/26541220
favorite count: 0
has body: I'm developing a Java EE 7 application (persistence provider is Hibernate 4.3.5, DB is Oracle 11g) in which I'm using a entity class with a Long field that represents the millis of a date. It's been done that way to avoid the problems of using DBs' date datatypes (e.g. timezone handling). Here's the relevant entity class code: import java.util.Date; @Table @Entity public class Transference implements Serializable { private static final long serialVersionUID = 1L; // ... elided fields private Date dateTime; // ... elided setters and getters @Column(name = "datetime") @Convert(converter = DateConverter.class) @NotNull public Date getDateTime() { return dateTime; } } Attribute in the metamodel class: public static volatile SingularAttribute&lt;Transference, Date&gt; dateTime; Here's the straightforward JPA 2.1 converter: import java.util.Date; @Converter public class DateConverter implements AttributeConverter&lt;Date, Long&gt; { @Override public Long convertToDatabaseColumn(Date attribute) { return (attribute == null)? null : attribute.getTime(); } @Override public Date convertToEntityAttribute(Long dbData) { return dbData == null? null : new Date(dbData); } } Table definition: CREATE TABLE transference ( -- fields ... datetime NUMBER(20) NOT NULL, -- constraints... ); Persisting and reading the field value works like a charm. The problem comes when I try to use a predicate in a CriteriaQuery that compares the field with a value: private List&lt;Transference&gt; queryResultList() { CriteriaBuilder cb = this.entityManager.getCriteriaBuilder(); CriteriaQuery&lt;Transference&gt; cq = cb.createQuery(Transference.class); Root&lt;Transference&gt; root = cq.from(Transference.class); List&lt;Predicate&gt; predicates = new ArrayList&lt;&gt;(); // Predicates with other fields... if (this.dateTo != null) { Path&lt;Date&gt; pathDateTo = root.get(Transference_.dateTime); Predicate predDateTo = cb.greaterThanOrEqualTo(pathDateTo, this.dateTo); predicates.add(predDateTo); } Order or…
has title: JPA Criteria Query with predicate that compares a field annotated @Convert gets a ORA-00932 upon execution
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26541375
has answer: http://stackoverflow.com/a/26565086
has comment: http://stackoverflow.com/comment/41737022
tagged with: oracle11g
type: Question
possible better answer: http://stackoverflow.com/a/26541375
upvote count: 5
tagged with: java
tagged with: ora-00932
has comment: http://stackoverflow.com/comment/41733418
score: 5
accepted answer: http://stackoverflow.com/a/26565086
answer count: 3
tagged with: jpa-2.1
has answer: http://stackoverflow.com/a/26555200
downvote count: 0

http://stackoverflow.com/a/26639066
type: Answer
accepted answer of: http://stackoverflow.com/q/26637340
answers question: http://stackoverflow.com/q/26637340
has body: To answer the question directly, you can use TypedString as the method parameter type. The reason the value is being changed is because Retrofit is handing the String to Gson in order to encode as JSON. Using TypedString or any TypedOutput subclass will prevent this behavior, basically telling Retrofit you will handle creating the direct request body yourself. However, that format of payload is called form URL encoding. Retrofit has native support for it. Your method declaration should actually look like this: @FormUrlEncoded @POST("/oauth/token") void getAccessToken( @Field("param1") String param1, @Field("param2") String param2, @Field("param3") String param3, Callback&lt;Response&gt; callback);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44757065
score: 8
upvote count: 8

http://stackoverflow.com/q/26513962
has title: array of arraylist type error
has answer: http://stackoverflow.com/a/26514033
tagged with: arrays
has comment: http://stackoverflow.com/comment/41657900
tagged with: typeerror
has answer: http://stackoverflow.com/a/26514023
has answer: http://stackoverflow.com/a/26514101
has body: void radix(int[] arr, int maxDigit){ int exp = 1; for (int i=0; i&lt;maxDigit; i++) { ArrayList[] bucket = new ArrayList[10]; for (int n=0; n&lt;10; n++){ bucket[n] = new ArrayList&lt;Integer&gt;(); } for (int j=0; j&lt;arr.length; j++){ bucket[(arr[j]%exp)%10].add(arr[j]); } int ind=0; for (int k=0; k&lt;10; k++){ for (int n : bucket[k]){ arr[ind] = n; ind++; } } exp*=10; } } above is my attempt for a radix sort in java. I keep having an error at this for loop: for (int n : bucket[k]) Saying that Object can't be converted to int. However, I declared the array to have an arrayList as its element, so bucket[k] should be an arraylist. Can anyone please explain why this happens and how I could get around this problem? I would appreciate any help. Thanks
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: arraylist
answer count: 3

http://stackoverflow.com/comment/41685712
type: AnswerComment
comment on: http://stackoverflow.com/a/26529238
score: 0
type: Comment
has text: Then you have 500000001 times 4byte ;) is the data formatted?

http://stackoverflow.com/q/26640636
tagged with: android
tagged with: line
has body: In an application I am developing I have a number of lines represented by Latitude and Longitude values. I want to check if another line intersects any of these lines at any point. Say I have the line A-B I want to know if it intersects the line C-D at any point. The first and second examples above would lead to no intersection whereas the third example would. For my scenario the actual intersection point is not necassary for the application to function, so a simple yes/no to the intersection is all that is needed. I understand that working with Latitude and Longitude values is not strictly accurate seeing as the world is an ellipsoid so the values would need converting first. However, to prove the concept I am working on, a line intersection algorithm that works for any orientation of line segments is what I am looking for. I have seen several algorithms but have not managed to get any to work in practice. Currently I have been looking at the method mentioned here How to compute line segment intersections on a map I am using the code below and just using simple coordinates to prove it works, but from my testing it returns points of intersection even if they do not exist. double lineABxLength = bX - aX; double lineCDxLength = dX - cX; double lineAByLength = bY - aY; double lineCDyLength = dY - cY; double lineDenomiter = (lineABxLength * lineCDyLength) - (lineAByLength * lineCDxLength); double a = (aX * aY) - (bY * aX); double b = (dX * cY) - (dY * cX); double xIntersection = ((a * lineCDxLength) - (b * lineABxLength)) / lineDenomiter; double bIntersection = ((a * lineCDyLength) - (b * lineAByLength)) / lineDenomiter;
linked to: http://stackoverflow.com/q/16333650
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41889845
has comment: http://stackoverflow.com/comment/41888460
tagged with: math
tagged with: intersection
has comment: http://stackoverflow.com/comment/41888438
linked to: http://stackoverflow.com/q/16314069
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11650024
score: 2
answer count: 0
has title: How to find if an intersection occurs between two line segments represented by a Latitude and Longitude
downvote count: 0
has comment: http://stackoverflow.com/comment/41888921
favorite count: 0
type: Question

http://stackoverflow.com/q/26652248
answer count: 1
has body: I'm new to SWT and want to make an application with two vertical composites (or somethink like that). The the composite at the buttom caintains a simple Table. Now I need a variable height for the complete table - the user should determine the height by using the Mouse - just like it's possible to resize the eclipse views. The composite on the top should adjust the space. Is somethinkg like that possible with SWT? If yes, I would be thankful for every suggestion.
type: AnsweredQuestion
tagged with: java
tagged with: swt
type: Question
accepted answer: http://stackoverflow.com/a/26652579
tagged with: resize
has title: SWT: Resize Table (height) using a MouseListener
score: 0
has answer: http://stackoverflow.com/a/26652579

http://stackoverflow.com/a/26524672
answers question: http://stackoverflow.com/q/26524583
downvote count: 0
has comment: http://stackoverflow.com/comment/41678378
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41691219
has body: Your solution doesn´t work as you are reseting the value of variable every time you click button. You have to define it once and than just increase the valu of it. Solution: int count = 0; button_help.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { count++; System.out.println(count); } });
score: 3

import
type: Tag
tags question: http://stackoverflow.com/q/26575805
tags question: http://stackoverflow.com/q/26553986
tag name: import
tags question: http://stackoverflow.com/q/26624455
tags question: http://stackoverflow.com/q/26563094
tags question: http://stackoverflow.com/q/26521259
tags question: http://stackoverflow.com/q/26557321
tags question: http://stackoverflow.com/q/26657869
tags question: http://stackoverflow.com/q/26591231

http://stackoverflow.com/a/26667273
accepted answer of: http://stackoverflow.com/q/26667243
type: Answer
answers question: http://stackoverflow.com/q/26667243
upvote count: 6
has comment: http://stackoverflow.com/comment/41936361
downvote count: 1
has body: ^ Is not the power but the Binary XOR. Binary XOR Operator copies the bit if it is set in one operand but not both. You want Math.pow(x, y);
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/41728741
type: QuestionComment
has text: overide getPreferredSIze for JPanel, then all coordinates are from getHeight/weight incl. repainting on resize (forgot for pixels perfect, e.g. to divide 10 by 3:-), all block are only shapes, put all Object to the Array, inside paintCOmponent to loop inside array of Object, here are a few code examples about
score: 0
comment on: http://stackoverflow.com/q/26551714
type: Comment

http://stackoverflow.com/comment/41683239
comment on: http://stackoverflow.com/q/26528258
type: Comment
type: QuestionComment
has text: @lupz the code is readable. If you view the image, and then zoom in, you can read it. (But certainly you shouldn't have to do this, and OP ought to include the code.)
score: 1

http://stackoverflow.com/a/26549350
score: -1
answers question: http://stackoverflow.com/q/26549183
has body: you can simply use this: String[] strArray = {"green apple", "red apple", "yellow apple"}; for (String s : strArray) if (s.contains("apple")) System.out.println(s);
downvote count: 2
type: Answer
upvote count: 1

http://stackoverflow.com/q/26639378
answer count: 2
upvote count: 1
tagged with: program-entry-point
has body: I'm studying i saw following in my sample test. I'm not quite sure why below code print "First". When i debug it seems as MyRunnable.run is called twice. Does this mean run method is always called twice even in other scenario? public class currentThreadName { public static void main(String[] args) { Thread.currentThread().setName("First"); MyRunnable mr = new MyRunnable("MyRunnable"); mr.run(); } } class MyRunnable implements Runnable { MyRunnable(String name) { new Thread(this, name).start(); } public void run(){ System.out.println(Thread.currentThread().getName()); } }
favorite count: 0
has title: Thread name and calling run method twice
tagged with: runnable
type: UnansweredQuestion
tagged with: multithreading
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26639420
type: Question
has answer: http://stackoverflow.com/a/26639439

http://stackoverflow.com/comment/41795123
comment on: http://stackoverflow.com/q/26590141
score: 0
type: Comment
type: QuestionComment
has text: So you want to swap 2 columns and then write the data back to the same file?

pom.xml
tags question: http://stackoverflow.com/q/26603420
tags question: http://stackoverflow.com/q/26521350
type: Tag
tag name: pom.xml
tags question: http://stackoverflow.com/q/26586046
tags question: http://stackoverflow.com/q/26551439

http://stackoverflow.com/comment/41900922
has text: call your app ROOT and copy it in the webapps
score: 0
comment on: http://stackoverflow.com/q/26648103
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41889815
comment on: http://stackoverflow.com/a/26641417
has text: @Michael: your comment confuses me. What do you mean by "take out the boolean and void. put them on the top"?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/41846168
type: AnswerComment
comment on: http://stackoverflow.com/a/26617049
score: 1
type: Comment
has text: @Mike, that's my point. The Random() object *should* be reused, not recreated, otherwise you don't get a good random distribution.

http://stackoverflow.com/q/26656421
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/50886259
tagged with: eclipse
has answer: http://stackoverflow.com/a/50886259
has answer: http://stackoverflow.com/a/26657513
downvote count: 0
tagged with: tomcat
type: AnsweredQuestion
has title: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
score: 3
has body: I am converting a Spring web project to a Maven project and I am getting this error: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object; Apart from this error, seems that I have a lot of problems with dependencies, I am trying to fix them but I am a complete newbie into Maven: oct 30, 2014 3:53:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile> INFO: validateJarFile(C:\Users\a\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\revista2_local\WEB-INF\lib\el-api-2.2.jar) jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class> oct 30, 2014 3:53:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile> INFO: validateJarFile(C:\Users\a\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\revista2_local\WEB-INF\lib\jboss-el-api_2.2_spec-1.0.0.Final.jar) jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class> oct 30, 2014 3:53:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\a\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\revista2_local\WEB-INF\lib\jboss-javaee-5.0.0.GA.jar) jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class> oct 30, 2014 3:53:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\a\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\revista2_local\WEB-INF\lib\jboss-servlet-api_3.0_spec-1.0.0.Final.jar) jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class oct 30, 2014 3:53:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\a\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\revista2_local\WEB-INF\lib\jsp-api-2.1.jar) jar not loaded. See Servlet Spec…
tagged with: dependencies
linked to: http://stackoverflow.com/q/10846184
favorite count: 0
accepted answer: http://stackoverflow.com/a/26657513
type: Question
answer count: 2
tagged with: maven

char
tags question: http://stackoverflow.com/q/26593228
tags question: http://stackoverflow.com/q/26643189
tags question: http://stackoverflow.com/q/26560483
type: Tag
tags question: http://stackoverflow.com/q/26659486
tags question: http://stackoverflow.com/q/26626167
tags question: http://stackoverflow.com/q/26620362
tags question: http://stackoverflow.com/q/26537270
tags question: http://stackoverflow.com/q/26618863
tags question: http://stackoverflow.com/q/26647822
tags question: http://stackoverflow.com/q/26599444
tags question: http://stackoverflow.com/q/26616891
tags question: http://stackoverflow.com/q/26665162
tags question: http://stackoverflow.com/q/26610920
tag name: char
tags question: http://stackoverflow.com/q/26559098
tags question: http://stackoverflow.com/q/26629924
tags question: http://stackoverflow.com/q/26557604
tags question: http://stackoverflow.com/q/26555346

http://stackoverflow.com/comment/86158046
type: AnswerComment
type: Comment
has text: "works for the moment" might the most used sentence in software engineering
score: 8
comment on: http://stackoverflow.com/a/26607311

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/26654502
tags question: http://stackoverflow.com/q/26630570
type: Tag
tags question: http://stackoverflow.com/q/26648409
tags question: http://stackoverflow.com/q/26527609
tags question: http://stackoverflow.com/q/26572261
tags question: http://stackoverflow.com/q/26546208
tags question: http://stackoverflow.com/q/26651771

null-layout-manager
tags question: http://stackoverflow.com/q/26539026
type: Tag
tags question: http://stackoverflow.com/q/26598678
tags question: http://stackoverflow.com/q/26654654
tags question: http://stackoverflow.com/q/26627083
tag name: null-layout-manager

http://stackoverflow.com/a/26604969
score: 0
has body: I got it working by using some SQL in the query of the report and just printing that field SQL looks like this Select LAST_DAY('2014-09-14') lastDay, DATE_ADD((DATE_ADD(LAST_DAY('2014-09-14') ,INTERVAL 1 DAY)) ,INTERVAL -1 MONTH) firstDay Note: replace '2014-09-14'with input parameter on reprot eg. $P{dateEntered}
type: Answer
answers question: http://stackoverflow.com/q/26603650

http://stackoverflow.com/q/26632067
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26632217
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41872505
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has title: Please help me understand why my code doesn't work
type: UnansweredQuestion
downvote count: 1
has body: this class is a test to see if my 2 methods (the "endfinder"s) are working (unfortunately they are not). endfinder() is meant to return the index of the next non space character in the provided string; endfinder2() is meant to return the endpoint of the word starting with the index found by endfinder. They're meant to be used to pull out words from a string with multiple words separated by spaces. I've gone over it for a few hours and there must be some obvious answer but I feel like I'm slowly going insane. I've removed all of the outputs I used to test the code in many attempts to figure out what was wrong to make it cleaner. Basically, what I've found is that endfinder() always returns 0 for some reason and endfinder2() runs until it reaches the break (I assume that's what happens as it used to loop infinitely before I added it in). The result I want is start = 3, end = 6 which would make it output "[one]". The result I get: [ one two three] start = 0, end = 17. Here's my code: import java.io.*; import java.util.*; public class test { static String answer, container; static int start = 0, end = 1; public static int endfinder(String perspective) { int holder = start; while (perspective.substring(holder, (holder + 1)) == " ") { holder++; if (holder == perspective.length()) break; } return holder; } public static int endfinder2(String perspective) { int holder = end; while (perspective.substring(holder, (holder + 1)) != " ") { holder++; if (holder == perspective.length()) break; } return holder; } public static void main(String Args[]) { System.out.println(); System.out.println(); container = " one two three"; start = endfinder(container); end = start + 1; end = endfinder2(container); System.out.println("[" + container.substring(start, end) + "]"); System.out.println(); System.out.println("start: [" + start + "] end: [" + end + "]"); System.out.println(); } }
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/41872259

http://stackoverflow.com/a/26565812
has comment: http://stackoverflow.com/comment/41751151
type: Answer
has comment: http://stackoverflow.com/comment/41751281
downvote count: 0
score: 1
has body: The main problem - you have too complicated threads management: several threads tries to read from console input simultaneously: user 1 reader thread and user 2 read thread. You should introduce a single router thread, responsible for communication with administrator and manage all messages between spawned threads via shared concurrent structure(s). For such tasks it would be better to use any existent frameworks, e.g. netty or nirvana messaging.
upvote count: 1
answers question: http://stackoverflow.com/q/26565433

http://stackoverflow.com/comment/41785519
type: AnswerComment
has text: When using View.Gone. The element is removed complete from view. Android recalculates the view. Use View.INVISIBLE. To hide
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26584835

http://stackoverflow.com/a/26566131
accepted answer of: http://stackoverflow.com/q/26566054
has body: When you use Set for storing rectangles, you can never be sure about the order in which shapes will be rendered as Set don't maintain order of objects inside. Try using List or Map instead.
answers question: http://stackoverflow.com/q/26566054
type: Answer
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/47612672
comment on: http://stackoverflow.com/a/29704475
score: 2
type: AnswerComment
has text: The question is about the embedded Maven, i.e. the one that Eclipse uses internally to update the project. The external one, i.e. one used for run configurations, works perfectly fine.
type: Comment

http://stackoverflow.com/comment/41893431
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26643153
has text: Setting size-11 is simply masking your real problem and causing your list to only be semi sorted. The real problem is with construction of new SortTask(inputComp, temp, low, high), inside pool.invoke. Maybe change your code and ask a different question. Using size-11 simply means you never try this construction so your SortTask is never instantiated or executed

http://stackoverflow.com/comment/41704902
comment on: http://stackoverflow.com/a/26539844
score: 0
type: AnswerComment
type: Comment
has text: Thanks a lot bud, you saved the day! Ive been researching how to add to an arraylist of arraylists and ive hit so many dead ends. I fear to ask any more questions here in case i get my ability to question discontinued :(

http://stackoverflow.com/a/26638227
answers question: http://stackoverflow.com/q/26637856
accepted answer of: http://stackoverflow.com/q/26637856
upvote count: 1
has body: If you want to avoid using static methods, you need to pass variables as a parameter to the constructor of objects. In your example, it would work like this: public class Arena { private final Main plugin; public Arena(Plugin plugin) { this.plugin = plugin; } } And then you can create an Arena from your main plugin class, and pass in this as a parameter: public class Main extends JavaPlugin { @Override public void onEnable() { Arena arena = new Arena(this); } }
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/41754799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26566791
has text: I think I really misunderstood. The InputStreamReader is just an object and indeed does not have any ID, just some pseudo memory address like `java.io.BufferedReader@55f96302` which has no relation to the native process it is reading from.
score: 0

http://stackoverflow.com/q/26613614
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41838800
has answer: http://stackoverflow.com/a/26613652
accepted answer: http://stackoverflow.com/a/26613652
answer count: 1
downvote count: 0
has body: I have the following code public static void main(String[] args){ //find sign of 32 bit integer int a=0x6348987C; a=a&gt;&gt;31; int one=a&amp;1; if( one==0 ) { System.out.println("Positive"); } else { System.out.println("Negative"); } } If I change the comparison line with if( a&amp;1 ==0 ) the compilation fails with operator &amp; cannot be applied to int,boolean, mking me wonder what is the resulting type of the shift operator.
favorite count: 0
has title: What type is bit shift operator output?
type: AnsweredQuestion
tagged with: bit-shift
score: 1
tagged with: java

viber
type: Tag
tags question: http://stackoverflow.com/q/26579431
tag name: viber

http://stackoverflow.com/comment/41881614
comment on: http://stackoverflow.com/q/26637168
type: QuestionComment
score: 1
has text: How would you convert a date to milliseconds do you mean time?
type: Comment

http://stackoverflow.com/comment/41749080
has text: @cow12331 So make the variable `final`. I.e., `final ArrayList<StreamStatus> list = new ArrayList<StreamStatus>();`.
type: QuestionComment
comment on: http://stackoverflow.com/q/26564734
score: 0
type: Comment

http://stackoverflow.com/comment/41706380
has text: I figured out that the problem is in the markItemOnLoan method. How should I go about comparing the title from the input with the title from the media item?
comment on: http://stackoverflow.com/a/26533841
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26589706
tagged with: java
has comment: http://stackoverflow.com/comment/41794703
has comment: http://stackoverflow.com/comment/41795409
score: 0
tagged with: liferay
has comment: http://stackoverflow.com/comment/41796413
answer count: 3
has comment: http://stackoverflow.com/comment/41798218
tagged with: jsp
tagged with: jquery
has answer: http://stackoverflow.com/a/26601363
has answer: http://stackoverflow.com/a/53258485
tagged with: getter-setter
possible better answer: http://stackoverflow.com/a/53039659
has answer: http://stackoverflow.com/a/53039659
accepted answer: http://stackoverflow.com/a/26601363
has comment: http://stackoverflow.com/comment/41794526
has body: I'm trying to pass a value ferm a jsp back to the bean. I create an action url with several parameters and they are all set correctly but the company name is set to "companyName, companyName" instead of just "companyName" This is my url var url="&lt;liferay-portlet:actionURL&gt;&lt;liferay-portlet:param name='struts.portlet.action' value='/reg/submitStep1'/&gt;&lt;liferay-portlet:param name='isSimplified' value='true'/&gt;&lt;/liferay-portlet:actionURL&gt;&amp;customerNo=" + custNo + "&amp;companyName=" + companyName; I get the company name variable from the text field using jquery. The text input's id is companyName var companyName = $('#companyName').val(); When I print it out using console.log(companyName); the value is fine, not concatenated twice. In the setter, however, the value of the String is set to "companyName, companyName". All otherparameters (isSimplified, customerNo) are fine. Any idea why this is happening?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41797846
type: Question
has title: Setter concatenates value twice separated by comma

http://stackoverflow.com/a/53888853
score: 0
has body: I tried with a lot of solutions a no one worked for me. Finally, I found this: public class MyApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } } And was the only solution for my problem. Maybe someone is having the same problem and this could help :)
answers question: http://stackoverflow.com/q/26655541
type: Answer

http://stackoverflow.com/a/26532007
answers question: http://stackoverflow.com/q/26531214
has body: I think you need to specify both, min and max heap size, try this: activator -J-Xmx2048m -J-Xms2048m start
score: 0
has comment: http://stackoverflow.com/comment/41690404
has comment: http://stackoverflow.com/comment/41690494
type: Answer

http://stackoverflow.com/q/26585067
tagged with: groovy
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has body: I'm trying to create a Cucumber step definition in Groovy that finds a certain node in an XML document (a Solr search result) by the value of a mandatory 'url' tag and returns this node's position in the list of results. This is my scenario: Given I seach for "pris" Then I should see this link in the results: "/7292/pris-forbruk-og-inntekt" Then I will see the position of this url: "/7292/pris-forbruk-og-inntekt" This is my step definition: Then(~'^I should see this link in the results: "([^"]*)"$') { String tekst -> assertThat(browser.getPageSource(), containsString(tekst)) } Then(~'^I will see the position of this url: "([^"]*)"$') { String text -> pageSource = browser.getPageSource() //Prints the position of the relevant search result def xpathString = "count(/response/result/doc/str[.='" + text + "']/parent::*/preceding-sibling::*)" //+1 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder() doc = builder.parse(new InputSource(new ByteArrayInputStream(pageSource.getBytes("utf-8")))) expr = XPathFactory.newInstance().newXPath().compile(xpathString) posisjon = expr.evaluate(doc) println "The position of this result is: " + posisjon.toString() println xpathString } Both tests return a green cuke, so I know that the string is found in the XML. Here's an example of the XML result I'm evaluating: 0 75 true pris xml /nasjonalregnskap/nokkeltall/priser-og-prisindekser 3730 Priser og prisindekser nokkeltallsside 2010-11-23T11:35:00Z Nasjonalregnskap no statistikk /7292/pris-forbruk-og-inntekt 7292 Pris, forbruk og inntekt publikasjon 2002-06-13T10:00:00Z Befolkning no statistikk When I run this test (we're using Maven to build and run, so I have limited debugging options afaik) I get this output from the two println commands: The position of this result is: 0 count(/response/result/doc/str[.='/7292/pris-forbruk-og-inntekt']/parent::*/preceding-sibling::*) However, when I evaluate this Xpath query to the exact same XML document in Altova XMLspy, I get the exp…
has comment: http://stackoverflow.com/comment/41788534
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26633002
has title: Xpath query unexpectedly returns 0 in Java/groovy, works in other interpreter
tagged with: java
has comment: http://stackoverflow.com/comment/41785974
type: Question
tagged with: cucumber
has answer: http://stackoverflow.com/a/26633002
score: 0

http://stackoverflow.com/a/26581507
has comment: http://stackoverflow.com/comment/41779557
has comment: http://stackoverflow.com/comment/41779507
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26581372
upvote count: 2
has body: I have executed your code and observed that all threads are running properly 10 in this case. Since threads are invoked in random order that is why this behavior might be seen but I an sure that all threads for running fine and executing the functionality you require. Any how in output i saw that in for loop the value should start from 0 to 9 but here even this is random, may be because some threads are sleeping while executing and giving way to other threads. Hope this helps Thanks.

http://stackoverflow.com/a/55338237
downvote count: 0
score: 17
has comment: http://stackoverflow.com/comment/109003775
has comment: http://stackoverflow.com/comment/100116592
has comment: http://stackoverflow.com/comment/97661785
has body: Solution using @Bean: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InjectionPoint; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @Configuration public class LoggerConfiguration { @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public Logger logger(InjectionPoint injectionPoint){ return LoggerFactory.getLogger(injectionPoint.getMethodParameter().getContainingClass()); } } After that, just inject the Logger using Constructor Injection (field injection will not work): @Service class SomeService { private Logger logger; public SomeService(Logger logger;) { this.logger = logger; } public void someMethod() { logger.error("Some log"); } }
has comment: http://stackoverflow.com/comment/97777419
upvote count: 17
type: Answer
answers question: http://stackoverflow.com/q/26517309

http://stackoverflow.com/comment/41754958
has text: It depends on the VM software. You probably need to enable a port forward, and you still have to enable remote host support for mysql.
comment on: http://stackoverflow.com/q/26568003
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26665590
score: 0
has body: OMG i downloaded the wrong lwjgl. i had to re-download to get the correct lwjgl to get the proper natives. to anyone who does this, you must NOT download the "lwjgl source" file, just the "lwjgl" file.
answers question: http://stackoverflow.com/q/26642760
type: Answer

http://stackoverflow.com/a/26667195
has comment: http://stackoverflow.com/comment/42023469
has comment: http://stackoverflow.com/comment/41967668
downvote count: 0
has comment: http://stackoverflow.com/comment/41961864
has comment: http://stackoverflow.com/comment/41938178
score: 1
has comment: http://stackoverflow.com/comment/41960615
has comment: http://stackoverflow.com/comment/41976597
has body: Why would a thread reject a task based upon the object's label? The thread that picks up the task from the queue must act like a worker thread. You must design/write in a manner, that the thread picks up the object (or task) from the queue, reads its label, and processes it based on its label. You must not have a any correspondence between a object type and a thread type. Each thread should be written to handle any object.
has comment: http://stackoverflow.com/comment/41966063
answers question: http://stackoverflow.com/q/26667128
has comment: http://stackoverflow.com/comment/41947711
upvote count: 1
type: Answer

http://stackoverflow.com/comment/41719344
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26546271
has text: [JRadioButton or JComboBox as TableCellEditor - // comment out the two preceding lines](http://stackoverflow.com/a/10616768/714968)
type: Comment

http://stackoverflow.com/comment/59029390
has text: Do you know how to store the users in a database and check their credentials at this point?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26701612
type: AnswerComment

http://stackoverflow.com/q/26565705
has answer: http://stackoverflow.com/a/26565740
possible better answer: http://stackoverflow.com/a/26565761
linked to: http://stackoverflow.com/q/2932392
upvote count: 2
has answer: http://stackoverflow.com/a/26565761
duplicate of: http://stackoverflow.com/q/2932392
downvote count: 1
linked to: http://stackoverflow.com/q/3958955
has answer: http://stackoverflow.com/a/26565815
has body: The question is clear. Code should be in Java and without using Regex (In case someone didn't notice, that's not a duplicate, I'm asking for a way to do it without regex). input: This is a string with more than one space between words. output: This is a string with more than one space between words. Is there a better way than doing it this way ? public static String delSpaces(String str){ StringBuilder sb = new StringBuilder(str); ArrayList&lt;Integer&gt; spaceIndexes = new ArrayList&lt;&gt;(); for ( int i=0; i &lt; sb.length(); i++ ){ if ( sb.charAt(i) == ' ' &amp;&amp; sb.charAt(i-1) == ' '){ spaceIndexes.add(i); } } for (int i = 0; i &lt; spaceIndexes.size(); i++){ sb.deleteCharAt(spaceIndexes.get(i)-i); } return new String(sb.toString()); }
type: AnsweredQuestion
has title: Given a sentence with multiple spaces between words. Remove the extra spaces so that the sentence will have exactly one space between words
score: 1
tagged with: java
tagged with: whitespace
accepted answer: http://stackoverflow.com/a/26565740
type: Question
tagged with: string
favorite count: 0
answer count: 3
tagged with: space

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/26653125
tag name: session-timeout

http://stackoverflow.com/comment/58031395
score: 0
type: Comment
has text: As you tell me "It is the servers responsibility". if it is done in server side (for example we can do it in tomcat), why spring security have X.509 Authentication?
type: AnswerComment
comment on: http://stackoverflow.com/a/26636512

http://stackoverflow.com/comment/41760074
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26566945
has text: @ArcRanges you can't without using sorting.
type: Comment

http://stackoverflow.com/comment/41779196
has text: just for my understanding static initializer block is executed first followed by the constructor followed by the instance variables right. so even if he initializes the arrray size in the instance vaiable section,max would have already been initialsed in the constructor. so primes would be set to the size of max.
type: AnswerComment
comment on: http://stackoverflow.com/a/26581244
score: 0
type: Comment

http://stackoverflow.com/comment/41939681
score: 0
comment on: http://stackoverflow.com/q/26650315
has text: try Matrix m = tiv.getImageMatrix(); float[] pts = {0, 0}; m.mapPoints(pts); and see whats in 'pts'
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41769106
comment on: http://stackoverflow.com/a/26575745
type: Comment
score: 1
type: AnswerComment
has text: He "could", not should. The JFormattedTextField that was already mentioned is probably a much better idea.