http://stackoverflow.com/comment/42997327
comment on: http://stackoverflow.com/q/27262125
has text: @MattCoubrough, Any hint on how I can construct a BFS tree for this? Given that I have the tree I would be able to do preorder traversal on it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43029986
type: Comment
comment on: http://stackoverflow.com/a/27280497
has text: Done! Thanks for your precious help and time sir.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42929713
type: QuestionComment
score: 0
has text: "java.lang.IllegalArgumentException: id to load is required for loading" would be the first exception I would try to tackle. This simply shows incorrect use of the api function. You are not passing in the required id to load.
comment on: http://stackoverflow.com/q/27225606
type: Comment

http://stackoverflow.com/a/27154945
has body: Set a break point, highlight the Exception instance, and then expand it and click on stackTrace.
type: Answer
answers question: http://stackoverflow.com/q/27154494
score: 2
has comment: http://stackoverflow.com/comment/42804332
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42804440

http://stackoverflow.com/comment/42892635
comment on: http://stackoverflow.com/a/27189698
type: Comment
has text: @viku No problem, I was once a new user too ;)
type: AnswerComment
score: 0

jhipster
tag name: jhipster
tags question: http://stackoverflow.com/q/27241323
type: Tag

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/27159823
tags question: http://stackoverflow.com/q/27309196
tags question: http://stackoverflow.com/q/27230010
tags question: http://stackoverflow.com/q/27271604
tags question: http://stackoverflow.com/q/27164945
tags question: http://stackoverflow.com/q/27260007
tags question: http://stackoverflow.com/q/27158787
tags question: http://stackoverflow.com/q/27193633
tags question: http://stackoverflow.com/q/27200145
tags question: http://stackoverflow.com/q/27275127
tags question: http://stackoverflow.com/q/27236990
tags question: http://stackoverflow.com/q/27270121
tags question: http://stackoverflow.com/q/27169510
tags question: http://stackoverflow.com/q/27171922
tags question: http://stackoverflow.com/q/27286036
tags question: http://stackoverflow.com/q/27206324
tags question: http://stackoverflow.com/q/27271179
tags question: http://stackoverflow.com/q/27174373
tags question: http://stackoverflow.com/q/27311138
tags question: http://stackoverflow.com/q/27178461
tags question: http://stackoverflow.com/q/27192695
tags question: http://stackoverflow.com/q/27299226
tags question: http://stackoverflow.com/q/27253555
tags question: http://stackoverflow.com/q/27254147
tags question: http://stackoverflow.com/q/27238908
tags question: http://stackoverflow.com/q/27250286
tags question: http://stackoverflow.com/q/27164216
tags question: http://stackoverflow.com/q/27255828
tags question: http://stackoverflow.com/q/27277724
tags question: http://stackoverflow.com/q/27248208
tags question: http://stackoverflow.com/q/27244431
tags question: http://stackoverflow.com/q/27201201
tags question: http://stackoverflow.com/q/27248294
tags question: http://stackoverflow.com/q/27288261
tags question: http://stackoverflow.com/q/27312795
tags question: http://stackoverflow.com/q/27200634
tags question: http://stackoverflow.com/q/27214795
tags question: http://stackoverflow.com/q/27269414
tags question: http://stackoverflow.com/q/27309645
tags question: http://stackoverflow.com/q/27264532
tags question: http://stackoverflow.com/q/27209488
tags question: http://stackoverflow.com/q/27172566
type: Tag
tags question: http://stackoverflow.com/q/27234519
tags question: http://stackoverflow.com/q/27247005
tags question: http://stackoverflow.com/q/27313358
tags question: http://stackoverflow.com/q/27278078
tags question: http://stackoverflow.com/q/27297879
tags question: http://stackoverflow.com/q/27201763
tags question: http://stackoverflow.com/q/27290226
tags question: http://stackoverflow.com/q/27191213
tags question: http://stackoverflow.com/q/27249674
tags question: http://stackoverflow.com/q/27272391
tags question: http://stackoverflow.com/q/27181507
tags question: http://stackoverflow.com/q/27279579
tags question: http://stackoverflow.com/q/27272228
tags question: http://stackoverflow.com/q/27295167
tags question: http://stackoverflow.com/q/27209358
tags question: http://stackoverflow.com/q/27227838
tags question: http://stackoverflow.com/q/27275280
tags question: http://stackoverflow.com/q/27311083
tags question: http://stackoverflow.com/q/27162857
tags question: http://stackoverflow.com/q/27266296
tags question: http://stackoverflow.com/q/27167816
tags question: http://stackoverflow.com/q/27163925
tags question: http://stackoverflow.com/q/27212266
tags question: http://stackoverflow.com/q/27302247
tags question: http://stackoverflow.com/q/27153808
tags question: http://stackoverflow.com/q/27301869
tags question: http://stackoverflow.com/q/27201791
tags question: http://stackoverflow.com/q/27307478
tags question: http://stackoverflow.com/q/27188753
tags question: http://stackoverflow.com/q/27247767
tags question: http://stackoverflow.com/q/27274474
tags question: http://stackoverflow.com/q/27268598
tags question: http://stackoverflow.com/q/27279322
tags question: http://stackoverflow.com/q/27285446
tags question: http://stackoverflow.com/q/27212598
tags question: http://stackoverflow.com/q/27266675
tags question: http://stackoverflow.com/q/27206187

http://stackoverflow.com/q/27252404
score: 4
accepted answer: http://stackoverflow.com/a/27252504
has comment: http://stackoverflow.com/comment/42979156
linked to: http://stackoverflow.com/q/22519482
tagged with: javac
has comment: http://stackoverflow.com/comment/134142278
has body: If a public class is defined in a file with the wrong filename, javac will throw an error: square_supplies.java:5: error: class Answer is public, should be declared in a file named Answer.java Is there a flag to turn off this behaviour? If it's not possible for javac, is there another java compiler where this can be turned off?
has comment: http://stackoverflow.com/comment/42979493
has answer: http://stackoverflow.com/a/27252504
favorite count: 0
has comment: http://stackoverflow.com/comment/42982841
has comment: http://stackoverflow.com/comment/42979111
has comment: http://stackoverflow.com/comment/42979697
has comment: http://stackoverflow.com/comment/42979419
downvote count: 2
has comment: http://stackoverflow.com/comment/42979400
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42978992
has comment: http://stackoverflow.com/comment/42979311
tagged with: java
has comment: http://stackoverflow.com/comment/42979452
type: Question
has comment: http://stackoverflow.com/comment/42979279
has comment: http://stackoverflow.com/comment/42978977
linked to: http://stackoverflow.com/q/2134784
has comment: http://stackoverflow.com/comment/42979161
answer count: 1
has title: How to disable javac file name checking?

http://stackoverflow.com/a/27241002
has comment: http://stackoverflow.com/comment/42958512
score: 1
has comment: http://stackoverflow.com/comment/42958609
type: Answer
has comment: http://stackoverflow.com/comment/42958498
has body: Your denominator: ((other.real * other.real) - (other.complex * other.complex)) Shouldn't it be: ((other.real * other.real) + (other.complex * other.complex)) Since you get this by multiplying a complex number by its conjugate: (a + bi) * (a - bi) = (a * a) - (b * b * i * i) But since i * i is -1, this becomes: (a + bi) * (a - bi) = (a * a) + (b * b) Also, as an aside, I get bad feelings in the back of my neck when I see Strings being used to represent numeric values. Why use Strings? Why not float or BigDecimal?
upvote count: 1
has comment: http://stackoverflow.com/comment/42958470
accepted answer of: http://stackoverflow.com/q/27240940
answers question: http://stackoverflow.com/q/27240940
has comment: http://stackoverflow.com/comment/42958564
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42926403
has text: well boolean is a true|false value... that's a single bit of information and path can't fit into a boolean value... you can probably make a method that returns a boolean value based on some state of the path that you want to do tests on.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27222443

http://stackoverflow.com/comment/42835140
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27171809
has text: http://stackoverflow.com/a/2684496/2078908

http://stackoverflow.com/comment/78718578
type: Comment
has text: could you help me out with the approach you have followed?
comment on: http://stackoverflow.com/q/27285442
score: 0
type: QuestionComment

http://stackoverflow.com/q/27173893
has answer: http://stackoverflow.com/a/30199752
score: 0
has body: I have a field of the type CHAR and want to push a message to a queue in form of a java object. I know how to map varchar (by strings) but I don't know how to map a CHAR from the Oracle DB to java. In detail: I create a POJO Event that implements SQLData and hence contains the methods readSQL(SQLInput stream, String sqlType) and writeSQL(SQLOutput stream). But neither SQLOutput nor SQLInput offers a write/read method to write/read chars. How do I do that? Thanks for your help.
answer count: 1
has title: Oracle AQ - Write Custom Message that contains Char
tagged with: jms
type: UnansweredQuestion
tagged with: oracle-database
tagged with: java
type: Question

http://stackoverflow.com/q/27188457
has title: Read multiline value in ANTLR untill a special symbol occurs
upvote count: 3
tagged with: java
tagged with: antlr
accepted answer: http://stackoverflow.com/a/27197573
type: Question
answer count: 1
downvote count: 0
has body: How can i read a multiline text in ANTLR untill a special symbol occurs. Like as in below text:- @Description(" Hi There I am. ") I need to read it as key -> @Description and value -> "Hi There I am". I tried it with following grammar KEY : '@' [a-zA-Z] (~[(\r\n] | '\\)')* ; VALUE : '(' ~[\r\n]* ; I tried many variations of VALUE grammar but no luck.
tagged with: antlr4
favorite count: 0
tagged with: antlrworks
has answer: http://stackoverflow.com/a/27197573
has comment: http://stackoverflow.com/comment/42877977
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/27176052
upvote count: 3
has body: There are two types of constructor for TreeSets - ones where you specify an explicit Comparator, and ones where you do not. In the latter case, the set will use the natural ordering of its elements, which requires that they implement Comparable. This is why you get the runtime exception, which is relatively clear (once you understand the background). Since you can't make ArrayLists implement Comparable, you need to provide your own Comparator when you're constructing the TreeSet to assign to coords. This should be straightforward for you to implement (it's just a single function that takes two objects, and decides which one "comes first"), and you can put whatever custom ordering logic in there that you want.
accepted answer of: http://stackoverflow.com/q/27175963
answers question: http://stackoverflow.com/q/27175963
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer

http://stackoverflow.com/a/27264805
has body: For the third case, eachLine.split("--------") will return an array with length 1 so when you access that array with index 1, ie eachLine.split("--------")[1] it gives an exception. You can fist check if the array returned by the split function is greater than 1 if(eachLine.split("--------").length &gt; 1 &amp;&amp; !(eachLine.split("--------")[1].isEmpty())) { tempString=eachLine.split("--------")[1].split("::=&gt;")[0]; System.out.println(input1+" "+tempString); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27264436

http://stackoverflow.com/comment/42888239
comment on: http://stackoverflow.com/q/27202640
score: 5
has text: If you have an abstract method, it means that this method is not yet implemented, so by definition the class is incomplete and hence is (and must be) abstract.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43080494
type: AnswerComment
type: Comment
score: 0
has text: [Thilo's answer](http://stackoverflow.com/a/27309373/2390644) is slightly better as it iterates over the `entrySet` method to eliminate an extra call to `hm1.get(key)`.
comment on: http://stackoverflow.com/a/27309422

http://stackoverflow.com/a/27224407
downvote count: 0
score: 1
upvote count: 1
has body: It seems that you are expecting persistence (not clustering as @tsykora suggested). The link with programmatic configuration is right, but you'd probably want to use SingleFileStore (as the simplest persistent store). DefaultCacheManager manager = new DefaultCacheManager(); Configuration c = new ConfigurationBuilder().persistence() .addSingleFileStore() .location("/tmp/myDataStore") .maxEntries(5000); manager.defineConfiguration("myCache", c); Cache&lt;Object, Object&gt; cache = manager.getCache("myCache"); (code not tested but this is the idea).
type: Answer
answers question: http://stackoverflow.com/q/27176507

http://stackoverflow.com/q/27158148
has comment: http://stackoverflow.com/comment/42810586
tagged with: jframe
has comment: http://stackoverflow.com/comment/42810547
has comment: http://stackoverflow.com/comment/42810624
tagged with: swing
has answer: http://stackoverflow.com/a/27158338
accepted answer: http://stackoverflow.com/a/27158338
type: AnsweredQuestion
tagged with: java
has body: I am using Netbeans and have previously had this up and running but I messed with some of the code and now it isnt.. Could somebody please tell me what I am doing wrong? public class OrderGUI extends javax.swing.JFrame { ArrayList orders = new ArrayList&lt;&gt;(); public static void main(String args[]) { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(OrderGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(OrderGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(OrderGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(OrderGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { OrderGUI gui = new OrderGUI(); gui.setVisible(true); gui.setTitle("Flexbox Order System"); gui.setResizable(false); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); } }
has comment: http://stackoverflow.com/comment/42810489
has title: How do I get JFrame to display my GUI?
type: Question
tagged with: user-interface
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42810619
has comment: http://stackoverflow.com/comment/42810565

http://stackoverflow.com/comment/43036754
type: Comment
comment on: http://stackoverflow.com/a/27284168
type: AnswerComment
has text: understand! Thank you guys!
score: 0

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

http://stackoverflow.com/q/27156180
has comment: http://stackoverflow.com/comment/42806738
has answer: http://stackoverflow.com/a/27156360
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42807735
has comment: http://stackoverflow.com/comment/42806882
answer count: 1
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42806814
has title: Loop test results in null, crashes program
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42807209
has comment: http://stackoverflow.com/comment/42807027
has comment: http://stackoverflow.com/comment/42806974
tagged with: java
tagged with: loops
type: Question
has body: I've been sifting through my code for a project and can't get this method to work as it's designed. What should be happening is that the system searches an array passed as a parameter for a user-inputted value. The following is the entire method as is written (there is some random text I've thrown in for debugging): public static void updatePC(int ARRAY_SIZE, int count, String[] customerName, String[] customerID, String[] os, String[] typeOfProblem, int[] turnAroundTime) { Scanner keyboard = new Scanner(System.in); String toUpdate; String[] customerIDClone = new String[count]; int intToUpdate = -1, loop = count, n; char correct = 'n'; customerIDClone = Arrays.copyOf(customerID, count); while (correct == 'n') { System.out.println("Please enter the customer ID of the work order you wish to modify"); toUpdate = keyboard.nextLine(); if (Arrays.asList(customerIDClone).contains(toUpdate) == true) { intToUpdate = Integer.parseInt(toUpdate); } while (Arrays.asList(customerIDClone).contains(toUpdate) == false) { System.out.println("The customer ID you entered was not found. Please try again."); toUpdate = keyboard.nextLine(); intToUpdate = Integer.parseInt(toUpdate); } System.out.println("Beginning search loop. The value to find is " + toUpdate); for (n = 0; n &lt; loop; n++); { System.out.println("Loop loop looooooooop"); System.out.println(customerID[n]); System.out.println(customerID[0]); if (customerID[count].equals(toUpdate)) { System.out.println("Found it!"); count = n; } } System.out.println("Testing run 1."); } System.out.println(""); System.out.println("--"); System.out.println(" Name: " + customerName[count]); System.out.println(" Customer ID: " + customerID[count]); System.out.println(" OS: " + os[count]); System.out.println(" Type of Problem: " + typeOfProblem[count]); System.out.println("Expected Turnaround Time: " + turnAroundTime[count]); System.out.println("--"); System.out.println("Is this new record correct? Please enter y or n. "); correct = keyboard.next(…
tagged with: arrays

null
tags question: http://stackoverflow.com/q/27198530
tags question: http://stackoverflow.com/q/27268795
tags question: http://stackoverflow.com/q/27167284
tags question: http://stackoverflow.com/q/27225454
tag name: null
tags question: http://stackoverflow.com/q/27300339
tags question: http://stackoverflow.com/q/27160206
tags question: http://stackoverflow.com/q/27279025
tags question: http://stackoverflow.com/q/27216974
tags question: http://stackoverflow.com/q/27251517
tags question: http://stackoverflow.com/q/27211713
type: Tag
tags question: http://stackoverflow.com/q/27168201
tags question: http://stackoverflow.com/q/27290978
tags question: http://stackoverflow.com/q/27238689
tags question: http://stackoverflow.com/q/27157678
tags question: http://stackoverflow.com/q/27218470
tags question: http://stackoverflow.com/q/27169352

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/27311049
tags question: http://stackoverflow.com/q/27279880
tags question: http://stackoverflow.com/q/27225596
tags question: http://stackoverflow.com/q/27219852
tag name: jfreechart
tags question: http://stackoverflow.com/q/27240568

http://stackoverflow.com/q/27275203
has answer: http://stackoverflow.com/a/27275655
has comment: http://stackoverflow.com/comment/43020365
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43020162
has title: connection reset on HttpsUrlConnection with valid URL
upvote count: 1
has comment: http://stackoverflow.com/comment/43020846
favorite count: 0
has comment: http://stackoverflow.com/comment/43019771
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27275489
has comment: http://stackoverflow.com/comment/43019688
has comment: http://stackoverflow.com/comment/43020083
has body: I have a known valid URL. I can navigate to it in my browser and get the JSON that I expect. In fact, before downgrading java to 1.6 the HttpURLConnection hit the server and got the JSON successfully. Now I get a connection reset exception on the connect method. Relevant code: URL url = new URL(urlBuilder.toString()); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); BufferedReader bufferReader = new BufferedReader(new InputStreamReader(connection.getInputStream())); I won't bore you with the actual URL, because it's internal to my company and you won't be able to hit it, but it's an https URL that returns this JSON when accessed through Chrome {"result_code":"S","result_msg":"No reviews in database for this provider"} Which is what I would expect. I know the URL is being generated in the code correctly, because I'm using what the code generates to test in the browser. Things I've already tried: -HttpUrlConnection instead of Https. This is what was used before the downgrade to 1.6. It worked then, but stopped working after the upgrade. -The third and fourth lines were also originally not part of the code. I added them after looking up a few guides. Edit: Stacktrace by request SEVERE: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at sun.security.ssl.InputRecord.readFully(InputRecord.java:442) at sun.security.ssl.InputRecord.read(InputRecord.java:480) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927) at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1705) at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:122) at sun.security.ssl.Handshaker.kickstart(Handshaker.java:919) at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1423) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocket…
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43020046

http://stackoverflow.com/comment/43005251
type: QuestionComment
has text: The print statement is not working how? How can it not work? What are you expecting it to do? NB the suggestion in the quotation seems like amazingly poor design to me.
score: 1
comment on: http://stackoverflow.com/q/27267107
type: Comment

http://stackoverflow.com/q/27229628
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/42962067
favorite count: 0
tagged with: eclipse-rcp
has body: We have a requirement that few view part should restore state after restart of eclipse RCP application, but few views should not restore the state . In eclipse 3.x it was quite easy, we just have to configure restorable false for the views which does not require restore. Is there any way to achieve the same behaviour in eclipse 4 as well. I.e., view will not persist the state after restarting of application(we need to save/ restore state so we can not use -clearPersistedState parameter).
has comment: http://stackoverflow.com/comment/42938351
has title: Stop restoring view in eclipse E4
answer count: 0

http://stackoverflow.com/a/27160588
has comment: http://stackoverflow.com/comment/42815242
answers question: http://stackoverflow.com/q/27160543
score: 1
accepted answer of: http://stackoverflow.com/q/27160543
has body: Create a reference to the button... DragButton zButton = new DragButton("Z"); Modify its properties... zButton.setBackground(Color.GREEN); Add the button... frame1.getContentPane().add(zButton); Many of the methods in Java don't support method chaining, sometimes it would be nice, sometimes not, seek out the designers of the original AWT API and ask them why...
downvote count: 0
has comment: http://stackoverflow.com/comment/42814939
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42815101
type: Answer
upvote count: 1

http://stackoverflow.com/q/27223494
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42925372
has title: How to "mask" certain ArrayList elements from showing in a for (X : X) loop in Java
has comment: http://stackoverflow.com/comment/42925585
accepted answer: http://stackoverflow.com/a/27223804
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42925396
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27223804
has body: I am trying to create a Java class, extending ArrayList, which basically fills the list capacity with null elements upon creation, so when I add a new element to it, it doesn't actually creates it, it simply sets an already existing null to the desired value. Here is my constructor: NullArrayList(int initialCapacity) { super(listSize = initialCapacity); for (int i = 0; i &lt; listSize; i++) super.add(null); } The thing is when I put the list through a for(X : X) loop, it access all the null elements which I dont care about (yet). Of course I know I could just insert if (x != null) but I would like anybody to be able to use my class without always having to put an if statement in the loop (that would be a major design flaw). So I was wondering if there wasn't anyway, maybe with an Iterator(?), to change the behaviour of the for each loop so that it skips the elements I want it to skip.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42925416
tagged with: java

http://stackoverflow.com/q/27246772
has body: Hello I am developing a new feature of my app where I have to write a String parser. I am still designing the solution and not sure what is the best approach for it. Example : I can get a String looking like "!CALC(${value-1}*!CALC(${value-2}-{value-3}))" The "!" sign indicates the beginning of a function and the "&amp;" sign indicates the beginning of a parameter. As you can see I can also have a function call inside another function and the result of that function to be treated as a parameter afterwards. I have already implemented the method for performing the CALC but I am still not a 100% sure how to properly parse the String. Any suggestions or examples will be highly appreciated.
tagged with: java
type: Question
tagged with: expression
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27251402
tagged with: parsing
type: UnansweredQuestion
tagged with: android
has title: Android Expressions in a String

http://stackoverflow.com/q/27169234
has answer: http://stackoverflow.com/a/27169350
answer count: 12
has answer: http://stackoverflow.com/a/27169507
has answer: http://stackoverflow.com/a/27169487
has body: I have a problem with sorting strings which include integers. If I use the below code I get sorting like: 1some, 2some, 20some, 21some, 3some, some However I want it sorted like: 1some, 2some, 3some, 20some, 21some, some How can I do this? Thanks! Collections.sort(selectedNodes, new Comparator&lt;DefaultMutableTreeNode&gt;() { @Override public int compare(DefaultMutableTreeNode o1, DefaultMutableTreeNode o2) { return o1.getUserObject().toString() .compareTo(o2.getUserObject().toString()); } });
has comment: http://stackoverflow.com/comment/42829669
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27173320
has answer: http://stackoverflow.com/a/58777625
has comment: http://stackoverflow.com/comment/42829819
tagged with: java
has answer: http://stackoverflow.com/a/51374219
has answer: http://stackoverflow.com/a/56901608
has answer: http://stackoverflow.com/a/27170019
score: 15
type: Question
upvote count: 15
accepted answer: http://stackoverflow.com/a/27169507
has answer: http://stackoverflow.com/a/27169497
has answer: http://stackoverflow.com/a/76643510
has comment: http://stackoverflow.com/comment/42829672
downvote count: 0
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/27169559
has comment: http://stackoverflow.com/comment/122153729
has title: How to sort Alphanumeric String
has answer: http://stackoverflow.com/a/54707742
possible better answer: http://stackoverflow.com/a/27169350
has comment: http://stackoverflow.com/comment/42829754

http://stackoverflow.com/comment/67057038
type: QuestionComment
has text: I'm guessing you've come from a python background. I'm only new to java but I'm finding that the presence of scopes in java somewhat hobbles your capability to make good use of EAFP. See in your example above `Cell` is out of scope before you can use it.
comment on: http://stackoverflow.com/q/27211744
score: 0
type: Comment

http://stackoverflow.com/comment/42832584
comment on: http://stackoverflow.com/a/27170860
type: AnswerComment
has text: Ok. Let me tell you what I understand. Java `int` is 32-bit = 4 bytes. Now if those bytes are unsigned(which they are since I have never seen a negative IP in my life) they get values from 0-255. Right? My problem is the bitwise operations. I also do not understand the concept of masking.
type: Comment
score: 0

http://stackoverflow.com/comment/43045102
type: Comment
comment on: http://stackoverflow.com/a/27276391
has text: I created an empty JavaFX project (which just shows an empty scene), and with this project the build succeeds. It also creates .app, .dmg, and .pkg files. And according to the size, the JRE is included. Any ideas why it doesn't work with my project?
score: 0
type: AnswerComment

http://stackoverflow.com/q/27175418
has title: Nothing is being returned? Can I not assign a two-dimensional array all the values of a pre-existing one?
tagged with: point
tagged with: arrays
has comment: http://stackoverflow.com/comment/42853623
score: 0
tagged with: multidimensional-array
has body: I am trying to return an array of points by looping through an existing two-dimensional point array. findMatches(b) contains an array of arrays of points from a board. If I could just access and alter these points directly so as to return them all to the point array I am returning, that would be great, but I don't suppose it is that easy. Here is my code: public static Point[] findPossibleSwaps(Board b) { Point[][] nums = new Point[findMatches(b).length][]; nums = findMatches(b); Point[] foundSwaps = new Point[3]; int xH = 0; int yV = 0; int index = 0; int x = 0; int y = 0; for(int a = 0; a&lt;nums.length; a++) { Point [] lop = nums[a]; for(int h = 0; h&lt;lop.length; h++) { Point qo = new Point(x,y); qo = lop[h]; if(qo.x!=0) { xH = qo.x-1; foundSwaps [index] = new Point(xH,qo.y); index++; } if(qo.y!=0) { yV = qo.y-1; foundSwaps [index] = new Point(qo.x,yV); index++; } } } return foundSwaps; } Thanks everyone
has comment: http://stackoverflow.com/comment/42845832
has comment: http://stackoverflow.com/comment/42846074
tagged with: initialization
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42840279
tagged with: java
type: Question

http://stackoverflow.com/q/27273206
has body: How I can use Cursor in asyncTask for show in listView , because my data for fetch is huge(metadata) and I should use from asyncTask .I need to a link for tutorial use Cursor in asyncTask. I have bellow code . My Struct_Search.class : public class Struct_Search { public int MetaData; public String Value; public String Name; public int Number; } And in my MainActivity.class : try { cursor = sql.rawQuery( "SELECT MetaDataID,Data,CategoryID,ParentID FROM BOOK WHERE DATA LIKE '" + "%" + editable + "%'", null); array = new ArrayList&lt;String&gt;(); if (cursor != null) { if (cursor.moveToFirst()) { do { Struct_Search note = new Struct_Search(); note.MetaData = cursor.getInt(cursor.getColumnIndex("MetaDataID")); note.Value = cursor.getString(cursor.getColumnIndex("DATA")); note.Number = cursor.getInt(cursor.getColumnIndex("CategoryID")); ParentID = cursor.getInt(cursor.getColumnIndex("ParentID")); CursorSecond = sql.rawQuery("SELECT name FROM ContentList WHERE id ="+ ParentID, null); if (CursorSecond != null) { do { CursorSecond.moveToFirst(); note.NameSureh = CursorSecond.getString(CursorSecond.getColumnIndex("name")); CursorSecond.close(); } while (CursorSecond.moveToNext()); } notes.add(note); } while (cursor.moveToNext()); } adapter.notifyDataSetChanged(); } } catch (Exception e) { } finally { cursor.close(); }
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/27273382
downvote count: 2
has comment: http://stackoverflow.com/comment/43015995
tagged with: android-cursor
upvote count: 1
has comment: http://stackoverflow.com/comment/43016109
type: AnsweredQuestion
tagged with: java
has title: How to use Cursor in asyncTask for fetch huge data?
score: -1
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27273375
has answer: http://stackoverflow.com/a/27273382
has answer: http://stackoverflow.com/a/27273375
has comment: http://stackoverflow.com/comment/43016182
tagged with: android-listview
tagged with: android

http://stackoverflow.com/q/27301716
has comment: http://stackoverflow.com/comment/43067732
upvote count: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/43067914
favorite count: 0
accepted answer: http://stackoverflow.com/a/27432860
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43066975
tagged with: java
has body: I want to implement the following HashMap with SQL HashMap&lt;key, ArrayList&lt;posting&gt;&gt; The posting class definition is: public class Posting { public int documentId; public double score; public Posting(int docId, double scr){ documentId = docId; score = scr; } } Then I create a table with name hashMap and with columns (keyId,key). The keyId is auto-increment Id. Also, each key only insert one time in the hashMap table. Then I create a table with name posting. The columns of this table are (keyId, docId, score). Do you think it is an efficient (space and time) way for implementing hashmap? My second Idea is that I create a table with name hashMap and with columns (key, postingName) and key is the primary-key. postingName is the name of the table with columns (docId, score). In the second implementation I convert each array list to a table. Do you think which one is efficient? Is there any better way to implement this hashmap? Note that the size of my hashmap is so huge. I want to store about 16.3G data. I only want to store my HashMap to Mysql database then retrieve the data from database to HashMap. I appreciate your ideas.
tagged with: mysql
has title: Looking for efficient way to store HashMap<key,ArrayList > in SQL
downvote count: 1
type: Question
tagged with: hashmap
score: -1
has comment: http://stackoverflow.com/comment/43067105
tagged with: arraylist
has answer: http://stackoverflow.com/a/27432860

http://stackoverflow.com/comment/42920832
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27218687
has text: Why did you give this a "delete" tag?

http://stackoverflow.com/comment/43002135
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27265147
type: Comment
has text: @Christian.tucker Great. Since it worked, I wrote an answer.

http://stackoverflow.com/q/27226312
has comment: http://stackoverflow.com/comment/42930481
possible better answer: http://stackoverflow.com/a/27226594
has answer: http://stackoverflow.com/a/27226594
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42930484
type: Question
has comment: http://stackoverflow.com/comment/42930714
linked to: http://stackoverflow.com/q/20561249
has body: Hello I have been looking at other threads like mine and I can't seem to get my code working! I need to send the JS array containing ints to a servlet this is current code: Javascript code: function sendReminderEmails(){ $("#sendReminderEmails").click(function(){ var people = null; var peopleBatch1 = null; $.ajax({ type: "POST", url:"getAllUnregisteredPeople", async: false, success: function(data){ people =JSON.parse(data); } }); peopleBatch1 = people.splice(0,200); $.post("sendReminderEmails", {people:peopleBatch1, mode : "insert"} , function(data){ }); }); } Servlet Code: protected void doPost(HttpServletRequest request, HttpServletResponse response){ String peopleIDs[] = request.getParameterValues("people"); } It keeps returning null! Can someone tell me if I am doing something wrong ?
tagged with: arrays
linked to: http://stackoverflow.com/q/3831680
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/42930662
has title: Sending an javascript array to a servlet
has answer: http://stackoverflow.com/a/27226621
accepted answer: http://stackoverflow.com/a/27226621
tagged with: servlets
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/19568142
has comment: http://stackoverflow.com/comment/42930824

http://stackoverflow.com/q/27293745
tagged with: cups
has title: Printing on "Bixolon Thermal Printer" using JAVA, "No pages found!" error
has comment: http://stackoverflow.com/comment/44331143
tagged with: bixolon-printer
type: UnansweredQuestion
tagged with: thermal-printer
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27960654
has answer: http://stackoverflow.com/a/27690533
type: Question
answer count: 2
downvote count: 0
tagged with: printing
has comment: http://stackoverflow.com/comment/43793961
has body: I have been trying to use a thermal-printer "Bixolon SRP-F310" and print some text using JAVA's PrintService. Printer is detected and there is no exception while calling the print function. I can see in the web interface of Cups that the print event is called. However the printer doesn't print and the error message "No pages found!" can be seen in the web-interface of Cups. Any help will be appreciated. I have included the screenshot of the Cups web-interface and the error logs. import javax.print.*; import java.util.Arrays; import java.util.List; public class Printer { static Printer INSTANCE; public static void main(String[] args) { INSTANCE = new Printer(); List&lt;PrintService&gt; services = INSTANCE.getServicesByName("BIXOLON_SRP-F310"); if(services == null) { throw new RuntimeException("No printer services available"); } INSTANCE.printServices(services); try { INSTANCE.print(services.get(0), "Hello"); } catch (Exception e) { e.printStackTrace(); } } public List&lt;PrintService&gt; getServicesByName(String serviceName) { //Find printer service by name AttributeSet aset = new HashAttributeSet(); aset.add(new PrinterName(serviceName, null)); return Arrays.asList(PrintServiceLookup.lookupPrintServices(null, aset)); } public void print(PrintService service, String printData) throws Exception { if(service == null) { throw new Exception("Service is not valid"); } if(printData == null) { throw new Exception("Nothing to print"); } PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); pras.add(new Copies(1)); pras.add(new PrinterResolution(180,180,PrinterResolution.DPI)); DocPrintJob job = service.createPrintJob(); DocAttributeSet das = new HashDocAttributeSet(); das.add(new PrinterResolution(180,180,PrinterResolution.DPI)); byte[] desc = printData.getBytes(); Doc doc = new SimpleDoc(desc, DocFlavor.BYTE_ARRAY.AUTOSENSE, das); try { job.print(doc, pras); } catch (Exception e) { e.printStackTrace(); } } public void printServices(List&lt;PrintService&gt; ser…
favorite count: 0

http://stackoverflow.com/a/27164574
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27164230
has body: To get the count of ID in string and divide it into multiple Integer arrays you can do something like this. String str = "1234,567,123,4567,890"; String strArray[] = str.split(","); if (strArray.length &gt; 500) { Integer[][] ids = new Integer[300][2]; int j = 0; int i = 0; for (String s : strArray) { if (i &lt; 2) { ids[j][i] = Integer.parseInt(s); } else { i = 0; j = j + 1; } } } }

amazon-elastic-beanstalk
tags question: http://stackoverflow.com/q/27168076
tag name: amazon-elastic-beanstalk
type: Tag

http://stackoverflow.com/q/27284164
favorite count: 0
tagged with: multithreading
upvote count: 1
has body: I am trying to utilize LoadingCache from the Guava library to cache a LinkedList. LoadingCache&lt;Integer, LinkedList&lt;String&gt;&gt; cache; I've setup a CacheLoader to handle misses, which is working fine. However there is another system that needs to submit updates to existing cache entries. Each update needs to be appended to the LinkedList and will arrive at a fairly quick rate (thousands per minute). Finally, it needs to be thread safe. Here is a naive approach that illustrates the logic but is not thread safe: public void add(Integer key, String value) { LinkedList&lt;String&gt; list = cache.get(key); list.add(value); cache.put(key, list); } Any advice on how to make this work? I can look at other libraries but Guava 14 is already a dependency of this codebase and would be very convenient.
type: AnsweredQuestion
tagged with: linked-list
has title: How to update a LinkedList value stored in cache using Guava's LoadingCache
tagged with: guava
score: 1
tagged with: java
tagged with: caching
type: Question
has answer: http://stackoverflow.com/a/27284649
accepted answer: http://stackoverflow.com/a/27284649
answer count: 1
downvote count: 0

http://stackoverflow.com/q/27274306
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: We have from some time this routine.. We are using Hibernate and MySQL. Student-&gt;School the student table has a relationship with school. But in DB is not mandatory the FK could be null.. We did like this I know is not the best approach but. currentSession.save(student); currentSession.save(student.getSchool()); currentSession.flush(); transaction.commit(); I have checked the SQL generates by Hibernate.. and i see. Hibernate: insert into student (C24, C01, C02, C03, C04, c07, c08, c09, c10, c11, C12, C13, C14, C15, c16, C17, C18, c19, C20, C21, C22, C23, C25, C26, C27, C28, C29, C30, C31, C32, C33, C34, C35,school_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select last_insert_id() Hibernate: insert into school (C01, C02, C03, C04, C05, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: select last_insert_id() This is OK with me is Student table the School column is NULL later I see.. Hibernate: update student set school_id=? where ID=? This i OK a extra sentence by using NULL but is still OK with me.. Here I am updating the relationship. But the next sentence I don't get it.. why Hibernate would do such thing.. Update the same ID it's have previously being insert? We are using auto-increment approach in both tables. Hibernate: update school set id=? where ID=? I'm missing something?
has comment: http://stackoverflow.com/comment/43042906
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43018962
has title: Java Hibernate confused about table updates same ID statement
tagged with: one-to-many
tagged with: many-to-one

http://stackoverflow.com/q/27263855
score: -2
tagged with: data-structures
tagged with: trie
has body: Can any one help me how to add word in a Trie really new to data structure /** * This method adds a word to the Trie * * @param s - word to add to the Trie * @param data - Data associated with word s */ public void addWord(String s, E data) { }
answer count: 1
has comment: http://stackoverflow.com/comment/43001099
has comment: http://stackoverflow.com/comment/43020337
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27265860
has comment: http://stackoverflow.com/comment/43003101
tagged with: java
has title: Need to add words in a Trie
downvote count: 3
upvote count: 1
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/43009684

http://stackoverflow.com/comment/42901658
type: QuestionComment
comment on: http://stackoverflow.com/q/27209692
score: 0
has text: @AnubianNoob I do have it installed. I have Git installed on my computer, and EGit plugin for eclipse.
type: Comment

http://stackoverflow.com/comment/61707846
has text: My case was a bit different. I was looping through the map twice, that produced the exact error above. Very wired and does not make sense to me, but once I removed my second iteration everything works.
type: AnswerComment
comment on: http://stackoverflow.com/a/27280855
score: 0
type: Comment

http://stackoverflow.com/q/27154062
accepted answer: http://stackoverflow.com/a/27163582
has title: Saving data in a .db file - java.io.File
has answer: http://stackoverflow.com/a/27163582
has body: I'm trying to save the data of a JAVA program in a .db file but isn't working. The following message error appears: "java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source) at java.io.ObjectInputStream.readStreamHeader(Unknown Source) at java.io.ObjectInputStream.&lt;init&gt;(Unknown Source) at server.server.main(server.java:27) Running" My program is a Client-Server model working with JAVA RMI. I have 2 clients, 2 interfaces and then multiple classes including a server class and an implementation class with all the methods. The "save" method is in the implementation class as follows: public void save() { ObjectOutputStream out; try { out = new ObjectOutputStream(new FileOutputStream(new java.io.File("C:/Users/Myself/Desktop/Hospital.db"))); out.writeObject(this); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } In the server class: try { ObjectInputStream in; try { in = new ObjectInputStream(new FileInputStream(new java.io.File("C:/Users/Myself/Desktop/Hospital.db"))); read = (implementation)in.readObject(); in.close(); System.out.println(read); } catch (FileNotFoundException e) { // TODO Auto-generated catch block read = new implementation(); e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block read = new implementation(); e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block read = new implementation(); e.printStackTrace(); } The "save" method is then used in both clients.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42802552
tagged with: eclipse
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42803350
tagged with: java-io
score: 0

http://stackoverflow.com/comment/42848792
has text: What's wrong about your current approach (besides that there are syntax errors and you didn't read http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java yet)?
comment on: http://stackoverflow.com/q/27180005
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27243279
type: UnansweredQuestion
score: -3
tagged with: swing
has title: Create Polygon with Mouse Listener Java
tagged with: java
downvote count: 3
type: Question
upvote count: 0
answer count: 1
has body: import java.awt.event.*; import java.awt.*; import javax.swing.*; import java.util.*; import javax.swing.event.*; import javax.swing.JPanel; public class Triangle extends JFrame { public Triangle() { add(new PolygonsPanel()); } public static void main(String [] args) { Triangle t = new Triangle(); t.setSize(500,500); t.setTitle("Triangle"); t.setVisible(true); t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); t.setLocationRelativeTo(null); } } class PolygonsPanel extends JPanel implements MouseListener { private int x1,x2,x3,y1,y2,y3; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Polygon p = new Polygon(); p.addPoint(x1,y1); p.addPoint(x2,y2); p.addPoint(x3,y3); this.addMouseListener(this); g.drawPolygon(p); } public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { int i = 0; if(i==0) { int x1= e.getX(); int y1= e.getY(); i++; } else if(i==1) { int x2= e.getX(); int y2= e.getY(); i++; } else if(i==2) { int x3= e.getX(); int y3= e.getY(); i++; } } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } } I want to make triangle using polygon and set the coordinate by click the mouse. compiler did't show error, can anybody help ? ..........................................................................................................................................................................................................
has answer: http://stackoverflow.com/a/27243573
favorite count: 0

http://stackoverflow.com/comment/49968960
comment on: http://stackoverflow.com/a/30386335
score: 0
type: AnswerComment
has text: I keep getting this error: java.lang.ClassCastException: javax.json.JsonValue$2 cannot be cast to javax.json.JsonString every single time I try and parse "success" from the return value, JsonObject. Here is the actual call that throws the error, any thoughts? JsonString response = jsonObject.getJsonString("success");
type: Comment

http://stackoverflow.com/comment/42870546
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27192215
type: Comment
has text: A Lucene BooleanQuery consisting of TermQueries would score each document according to the number of matching words, that sounds a lot like what you're looking for.

http://stackoverflow.com/q/27184083
tagged with: sapui5
tagged with: java
type: Question
has title: Print SAPUI5 VizFrame Bullet chart vertically
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: css
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: Hi I have a question about Viz charts in UI5. I´m searching for a way to rotate the Viz Bullet chart while printing in a new window. If I open it in a new window window.open(); the CSS for the chart rotation is lost. Is there a command to rotate it vertical in the new window? Here's an example for Viz Bullet chart SAP Bullet Viz Sample &amp; Printing Example Is there a way to use something like this @media print { @page {size: landscape}} but only on the chart and not the whole page?
tagged with: charts
score: 1

http://stackoverflow.com/q/27249023
tagged with: heuristics
has comment: http://stackoverflow.com/comment/42972646
has comment: http://stackoverflow.com/comment/42983836
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/65854843
score: 6
favorite count: 0
has title: Heuristic for A*-Algorithm with irregular distances between nodes
has comment: http://stackoverflow.com/comment/42984310
linked to: http://stackoverflow.com/q/430142
has comment: http://stackoverflow.com/comment/42979607
has comment: http://stackoverflow.com/comment/42981379
upvote count: 8
type: Question
linked to: http://stackoverflow.com/q/39256309
has answer: http://stackoverflow.com/a/27481044
has comment: http://stackoverflow.com/comment/42972468
has comment: http://stackoverflow.com/comment/42975814
tagged with: a-star
has answer: http://stackoverflow.com/a/27251976
downvote count: 2
has comment: http://stackoverflow.com/comment/42983985
has comment: http://stackoverflow.com/comment/42981410
has comment: http://stackoverflow.com/comment/42983308
has comment: http://stackoverflow.com/comment/42972350
has comment: http://stackoverflow.com/comment/42975900
has comment: http://stackoverflow.com/comment/42974144
has body: I am currently working on an implementation of the A* Algorithm with irregular distances between two nodes. The graph containing the nodes is a directed and weighted graph. Every node is connected to at least one other node, there may also be symmetrical connections with different distances. A node is nothing more than a label and doesn't contain any special information What I need is a heuristic to determine the shortest path from any node A to another node B as accurate as possible. I tried to use a heuristic that returns the distance to the nearest neighbor of a node, but of course that wasn't as effective as no heuristic at all (= Dijkstra). My implementation of the A* Algorithm consists mainly of 2 classes, the class for the algorithm itself (AStar) and one for the nodes (Node). The code is heavily based on the Wikipedia pseudocode. Source code of AStar.java public class AStar { private AStar() {} private static Node[] reconstructPath(Map&lt;Node, Node&gt; paths, Node current) { List&lt;Node&gt; path = new ArrayList&lt;Node&gt;(); path.add(0, current); while (paths.containsKey(current)) { current = paths.get(current); path.add(0, current); } return path.toArray(new Node[0]); } public static Node[] calculate(Node start, Node target, IHeuristic heuristic) { List&lt;Node&gt; closed = new ArrayList&lt;Node&gt;(); PriorityQueue&lt;Node&gt; open = new PriorityQueue&lt;Node&gt;(); Map&lt;Node, Double&gt; g_score = new HashMap&lt;Node, Double&gt;(); Map&lt;Node, Double&gt; f_score = new HashMap&lt;Node, Double&gt;(); Map&lt;Node, Node&gt; paths = new HashMap&lt;Node, Node&gt;(); g_score.put(start, 0d); f_score.put(start, g_score.get(start) + heuristic.estimateDistance(start, target)); open.set(start, f_score.get(start)); while (!open.isEmpty()) { Node current = null; // find the node with lowest f_score value double min_f_score = Double.POSITIVE_INFINITY; for (Entry&lt;Node, Double&gt; entry : f_score.entrySet()) { if (!closed.contains(entry.getKey()) &amp;&amp; entry.…
has comment: http://stackoverflow.com/comment/42973018
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/42984181
has comment: http://stackoverflow.com/comment/42973344
has answer: http://stackoverflow.com/a/27482548
has comment: http://stackoverflow.com/comment/42973961
answer count: 4
has comment: http://stackoverflow.com/comment/42975192
has answer: http://stackoverflow.com/a/27251702
has comment: http://stackoverflow.com/comment/42976535
tagged with: path-finding
has comment: http://stackoverflow.com/comment/42974735
has comment: http://stackoverflow.com/comment/42973228

http://stackoverflow.com/q/27250108
has body: No [ManagedType] was found for the key class [java.lang.Object] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific java.lang.Object property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element. at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:173) ~[org.eclipse.persistence.jpa-2.5.2.jar:na] at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:495) ~[org.eclipse.persistence.jpa-2.5.2.jar:na] It's strange because reverting to Spring Data JPA 1.4.3.RELEASE fixed the problem. But we would like to understand what is causing this. The interface repository we're using looks like this @Repository public interface BaseRepository<T, K extends Serializable> extends JpaRepository<T, K>, QueryDslPredicateExecutor<T> { } and @Repository public interface PersonRepository extends BaseRepository<Person, Long> { } In the meantime, we'll use the old version, but I'm not sure where to look in order to fix this. Any ideas?
answer count: 2
tagged with: jpa
has comment: http://stackoverflow.com/comment/43003870
downvote count: 0
accepted answer: http://stackoverflow.com/a/27260642
possible better answer: http://stackoverflow.com/a/27266347
favorite count: 0
tagged with: spring-data-jpa
has comment: http://stackoverflow.com/comment/42974418
has answer: http://stackoverflow.com/a/27260642
tagged with: spring
score: 2
has title: Why does my intermediate repository interface cause trouble after upgrading from Spring Data JPA 1.4.x to a more recent version (e.g. 1.7.1)?
has comment: http://stackoverflow.com/comment/42974653
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27266347
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42974773

http://stackoverflow.com/a/27282119
has body: You have issue here: front.setNext(first); you cannot make any operation on null object (and in condition you have front is null). Probably here should be: front = first;
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27282065
answers question: http://stackoverflow.com/q/27282065
has comment: http://stackoverflow.com/comment/43032708
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/43069697
comment on: http://stackoverflow.com/a/27296233
has text: That looks correct, although it's better to use StandardCharsets.ISO_8859_1 and StandardCharsets.UTF_8 instead of String literals, both because Strings are subject to typos and because using standard charsets removes the need to catch an exception.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42893106
comment on: http://stackoverflow.com/a/27205189
has text: @zapl Actually that can easily be solved by amending the y<5 to something else, and I suspect OP himself might actually wants a 5 starts at odd rows too.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42998042
comment on: http://stackoverflow.com/q/27262754
type: Comment
type: QuestionComment
has text: Have a look at the `StringTokenizer` API: https://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html - examples: http://www.mkyong.com/java/java-stringtokenizer-example/
score: 1

http://stackoverflow.com/comment/131348933
has text: this feature is now in the java SE12, see here: https://docs.oracle.com/en/java/javase/13/language/switch-expressions.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/60761288
type: Comment

http://stackoverflow.com/a/27294731
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27294667
downvote count: 0
has body: Just use it as a String. That's the easiest way to go for the task at hand. public class Test022 { public static void main(String[] args) { String s = "123454466666666666666665454545454454544598989899545455454222222222222222"; int sum = 0; for (int i=0; i&lt;s.length(); i++){ sum += s.charAt(i) - '0'; } System.out.println(sum); } }
upvote count: 2

http://stackoverflow.com/a/27252056
upvote count: 3
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27212600
has comment: http://stackoverflow.com/comment/43150908
score: 2
has body: First, you should close your session once you get an exception, because the Persistence Context might be left in an inconsistent state. So you shouldn't update on any exception. Quoting the Session JavaDoc: If the Session throws an exception, the transaction must be rolled back and the session discarded. The internal state of the Session might not be consistent with the database after the exception occurs. In your example you can simply call merge because it works for both in sert/updates: statelessSession.merge(entity); Update Since you are using MS SQL you might be using IDENTITY generator which disables JDBC batching. Latest MS SQL versions added support for Seqeuneces which are more friendly with batching anyway. You need to enable Hibernate batching support, like: hibernate.jdbc.batch_size=30 If you don't set this property, the default value is 0, so there's no default JDBC batching.
has comment: http://stackoverflow.com/comment/43218267

http://stackoverflow.com/comment/43093842
type: Comment
has text: Works! Thanks zillion times!
comment on: http://stackoverflow.com/a/27289479
type: AnswerComment
score: 0

http://stackoverflow.com/a/27269773
has comment: http://stackoverflow.com/comment/43093852
has body: This initial launch will launch GenericUpdater which is a JWrapper class which will in turn then launch your app. You can find the logs for GU and also for anything happening in your app in the folder described on the following page: http://www.jwrapper.com/guide-where-your-app-is-installed-and-logs.html they should have some more information about whats going on.
answers question: http://stackoverflow.com/q/27258590
has comment: http://stackoverflow.com/comment/43021829
has comment: http://stackoverflow.com/comment/43061714
score: 0
has comment: http://stackoverflow.com/comment/43064083
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27258590
type: Answer

http://stackoverflow.com/comment/45545063
type: Comment
comment on: http://stackoverflow.com/a/27216633
has text: Version 3.5.0 and up requires Java 8. Latest version on Java 7 is 3.4.1. http://nlp.stanford.edu/software/tagger.shtml#History
score: 0
type: AnswerComment

http://stackoverflow.com/q/27196796
answer count: 1
has body: If I look inside the JAR file there are no dependencies in it. I am using Netbeans 8.0 as IDE and the JDK 8 Update 25. This is my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany XmppMinimalClient 1.0-SNAPSHOT jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> org.apache.maven.plugins maven-jar-plugin 2.4 com.mycompany.xmppminimalclient.XmppMinimalClient true <addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> jar-with-dependencies make-assembly package org.igniterealtime.smack smack-core 4.0.5 org.igniterealtime.smack smack-tcp 4.0.5
linked to: http://stackoverflow.com/q/1729054
accepted answer: http://stackoverflow.com/a/27196814
has title: Why are the dependencies not included in the JAR file?
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27196814
tagged with: java
duplicate of: http://stackoverflow.com/q/1729054
type: Question
score: 0

http://stackoverflow.com/a/27213859
has comment: http://stackoverflow.com/comment/42923299
has body: "Clip.start() method returns immediately, and the system playbacks the sound file in a background thread." (from this question which discusses how to play sounds after each other). Since the threads you create effectively run "make clip object and start it", they actually do hardly anything. Even the I/O operations (opening the stream) are done at forehand (in the main GUI thread). Your assumption that the GUI has to wait for a clip to finish does not appear to be valid. And I doubt they can be conflicting on the same thread if they overlap. Can you confirm the GUI is more responsive with multi-threading? My guess is that it is actually less responsive since creating and starting new threads is not cheap.
has comment: http://stackoverflow.com/comment/42911937
score: 0
has comment: http://stackoverflow.com/comment/42918481
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42912339
answers question: http://stackoverflow.com/q/27208568
accepted answer of: http://stackoverflow.com/q/27208568
type: Answer

http://stackoverflow.com/q/27212872
tagged with: java
tagged with: methods
has title: Trouble with methods from libraries in Java?
tagged with: libraries
has body: So my class extends Actor, and I want to use the method getLocation() which requires Location from Actor, but it sends me to getLocation() of java.awt.Point which requires Point public class Myplayer extends Actor Location myLocation = player.getLocation(); The Error: incompatible types: java.awt.Point cannot be converted to ch.aplu.jgamegrid.Location Here are links to the two libraries: Actor: http://www.aplu.ch/classdoc/jgamegrid/index.html getLocation public Location getLocation() Returns the current location (horizontal and vertical coordinates). Returns: a clone of the current location (cell indices) Point: http://docs.oracle.com/javase/7/docs/api/java/awt/Point.html#getLocation%28%29 getLocation public Point getLocation() Returns the location of this point. This method is included for completeness, to parallel the getLocation method of Component. Returns: a copy of this point, at the same location How I can fix this, without using Point? EDIT: import ch.aplu.jgamegrid.*; import java.awt.Color; import java.util.*; public class MyPlayer extends Actor private Players player public Location myLocation() { return player.getLocation();
has comment: http://stackoverflow.com/comment/42906702
type: Question
has answer: http://stackoverflow.com/a/27218914
has comment: http://stackoverflow.com/comment/42906375
score: 0
has comment: http://stackoverflow.com/comment/42906436
answer count: 1
tagged with: incompatibility
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42906632
tagged with: incompatibletypeerror

http://stackoverflow.com/comment/42974773
has text: @nadir the solution solved the problem, if you post it as an answer I will mark it as accepted.
comment on: http://stackoverflow.com/q/27250108
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43099096
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27303568
has text: By 'logging yourself' I guess you are referring to a console `printf` statement. That logging however would not appear on the HTML generated by the junit xml formatter would it?
score: 1

http://stackoverflow.com/comment/43086153
score: 2
has text: actually my issue not to copy file permission but to inherit it from the destination folder.
type: AnswerComment
comment on: http://stackoverflow.com/a/27312456
type: Comment

http://stackoverflow.com/q/27178923
type: Question
has comment: http://stackoverflow.com/comment/42846797
has comment: http://stackoverflow.com/comment/42846997
has comment: http://stackoverflow.com/comment/42848174
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42846678
has comment: http://stackoverflow.com/comment/42847777
favorite count: 0
has title: Connection reset in sockets
has comment: http://stackoverflow.com/comment/42846863
score: -1
type: UnansweredQuestion
tagged with: sockets
tagged with: socketexception
has comment: http://stackoverflow.com/comment/42846670
downvote count: 1
has body: I have a game like blackjack that I have a server and players. When I execute the server and the players in the same computer it works perfect. But when I execute the players in one pc and the server in another pc it works so rare. After some writebytes from server and some readLines from users it gives me "Java.net.SocketException: Connection reset". Why is this happening? Socket registre = null; try{ registre = new Socket(IP,port); } catch(java.net.ConnectException e){ System.out.println("Servidor de partida incorrecte."); break; } catch(java.net.UnknownHostException e){ System.out.println("Servidor de partida incorrecte."); break; } catch(java.net.SocketException e){ System.out.println("Servidor de partida incorrecte."); break; } DataOutputStream sendToServer = new DataOutputStream(registre.getOutputStream()); BufferedReader receiveFromServer = new BufferedReader(new InputStreamReader(registre.getInputStream())); numCartes = 2; sendToServer.writeBytes("JUG"+"/"+portJug+ '\n'); boolean llistaJugadors = false; servidorJoc = receiveFromServer.readLine().trim(); System.out.println(servidorJoc); System.out.println("----------------------------------"); while(!llistaJugadors){ servidorJoc = receiveFromServer.readLine().trim(); if (servidorJoc.equalsIgnoreCase("exit")){ llistaJugadors=true; } else{ System.out.println(servidorJoc); } } System.out.println("----------------------------------"); boolean jocAcabat= false; jugant = true; boolean canviant = false; String torn=null; boolean unCanviEfectuat=false; torn = receiveFromServer.readLine().trim(); System.out.println(torn); String[] jug = torn.split("-"); jugador = jug[1]; jug = torn.split(":"); float puntuacio = Float.parseFloat(jug[1]); if (puntuacio&gt;=7.5){ jugant=false; } while (!jocAcabat){ if (canviant==false &amp;&amp; jugant){ torn = receiveFromServer.readLine().trim(); System.out.println(torn); if (llegirMes==1){ String[] infor = torn.split(":"); float passat = Float.parseFloat(infor[1]); if (passat&gt;=7.5){…
tagged with: java
has answer: http://stackoverflow.com/a/27179796

http://stackoverflow.com/q/27183429
has answer: http://stackoverflow.com/a/55622686
tagged with: lambda
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27183480
accepted answer: http://stackoverflow.com/a/27183480
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27183509
tagged with: methods
has answer: http://stackoverflow.com/a/27183509
type: Question
answer count: 3
upvote count: 1
has title: Java: method which receives pointer to other method (lambda)
tagged with: reference
favorite count: 0
tagged with: c++
has body: Recently I've been trying to familiarize myself with the usage of lambdas in Java 8. I've found that I can pass to some method a pointer to another method, like this: List&lt;Integer&gt; numbers = asList(1,2,3,4,5,6,7,8,9); forEach(System.out::println, numbers); This is clear for me. However, how can I create a method which expects such pointer? Should it work like in eg. C++? Or maybe my expectations are too big?

http://stackoverflow.com/comment/42985497
has text: i have @Override protected void onStop() { super.onStop(); try{ Log.e("ENTRO ","ENTRO"); Intent i = new Intent(); i.setAction("com.example.android.kontacktestbeacons.BeaconsBroadcast"); LocalBroadcastManager.getInstance(this).sendBroadcast(i); }catch (Exception e){Log.e("ERROR","ERRR");} }
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27255378

http://stackoverflow.com/a/27205026
has body: There is a method setMouseTransparent which you can use on the front layer.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27203694

http://stackoverflow.com/q/27209643
favorite count: 0
has answer: http://stackoverflow.com/a/27209677
has answer: http://stackoverflow.com/a/27209664
type: UnansweredQuestion
has title: Unreachable Code in Java Code?
upvote count: 1
has answer: http://stackoverflow.com/a/27209770
downvote count: 1
has body: I have a program that has one error and I can't find out how to fix it. The error tells me that this line is unreachable code. continue;inputUrname = JOptionPane.showInputDialog("Enter User Name"); Why is this? switch ((str1 = loginChoice).hashCode()) { case 73596745: if (str1.equals("Login")) { break; } break; case 278621961: if (!str1.equals("Create Account")) { continue;inputUrname = JOptionPane.showInputDialog("Enter User Name"); if (inputUrname != null) { inputPass = JOptionPane.showInputDialog("Enter Password"); }
has comment: http://stackoverflow.com/comment/42901034
tagged with: java
type: Question
score: 0
answer count: 3

http://stackoverflow.com/q/27224313
has title: Configure Akka router from configuration file in Java
has body: Just started to learn about akka capabilities. I am trying to run a program that uses akka router that based on consistent hashing. My environment is: Java 7 update 67, akka-actor_2.10 version 2.3.7. My configuration file: MyRouter{ akka.actor.deployment{ /exampleRouter { router = consistent-hashing-pool nr-of-instances = 5 } } } Main.java: public class Main { public static void main(String... args){ ActorSystem system = ActorSystem.create("ExampleRouter", ConfigFactory.load().getConfig("MyRouter")); ActorRef router = system.actorOf(Props.create(AcceptorActor.class).withRouter(new FromConfig()), "exampleRouter"); for (int i = 0; i &lt; 10; i++){ router.tell(new RevisionContent("Hi", new Object()), router); router.tell(new RevisionContent("Hello", new Object()), router); } } } The startup fails with the following exception: Exception in thread "main" akka.ConfigurationException: configuration problem while creating [akka://ExampleRouter/user/exampleRouter] with router dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] and routee dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:752) at akka.actor.dungeon.Children$class.makeChild(Children.scala:207) at akka.actor.dungeon.Children$class.attachChild(Children.scala:42) at akka.actor.ActorCell.attachChild(ActorCell.scala:369) at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:553) at study.Main.main(Main.java:16) Caused by: akka.ConfigurationException: Configuration missing for router [akka://ExampleRouter/user/exampleRouter] in 'akka.actor.deployment' section. at akka.routing.FromConfig.verifyConfig(RouterConfig.scala:297) at akka.routing.RoutedActorRef.&lt;init&gt;(RoutedActorRef.scala:40) at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:750) ... 5 more I wrote my code following this example. Please advice.
type: Question
accepted answer: http://stackoverflow.com/a/27227103
has comment: http://stackoverflow.com/comment/42928776
upvote count: 5
score: 5
tagged with: akka
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27227103
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42928980

http://stackoverflow.com/q/27157326
has body: I want to load class (which use run time annotation), and check the type of the annotation. The annotations are related to the fields. The class is not in the classpath and not in eclipse project For this issue I needed to compile the class with it's annotation classes. I loaded the class using this link: http://www.java2s.com/Tutorial/Java/0125__Reflection/URLclassloader.htm After loading the class, I'm trying to get for each field it's annotations and check the annotation type: Field[] fields = obj.getClass().getFields(); for (Field field : fields) { Annotation[] ann = field.getAnnotations(); for (Annotation annotation : ann) { if (annotation.equals(Example.class)) { System.out.println("Example annotation"); } } } I expect to see the print "Example annotation" but I didnt get it. The test.class and Example.class have the following java source code: public class Test { @Example (size = 5) public int x; @Example (size = 3) public int y; } public @interface Example { int size(); } The 2 classes where saved on different partition, and I compiled them with javac (and got 2 .class files) I read: 1. Java - loading annotated classes But didnt get the solution. So what Am I doing wrong ? (why cany I see "Example annotation") ? Thanks
has answer: http://stackoverflow.com/a/27158400
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12021543
tagged with: annotations
has title: Java how to check type of annotation when loading class
tagged with: reflection
tagged with: java
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/27157428

http://stackoverflow.com/q/27186620
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/42860402
has title: How to persist the change in JAXB object to its corresponding XML file?
has comment: http://stackoverflow.com/comment/42859977
has body: I am new to JAXB. Server is sending a few xmls which need to be replaced in the client. My requirement is to back up some element's data from previous XML tables' JAXB objects and update into the new xmls' object once they are successfully replaced in the client. I don't have problem in backing up the data but while updating the data, only JAXB object is updated while I need to persist in the corresponding XMLs too. Is there any way JAXB supports to accomplish this?
answer count: 0

http://stackoverflow.com/a/27274121
has body: AS/400 connections use a lot of network ports which must be available to you. Try disabling all firewalls between you and the server and try again. This include the software firewall (may be part of the antivirus suite) on the Windows system
has comment: http://stackoverflow.com/comment/43017638
upvote count: 2
answers question: http://stackoverflow.com/q/27274007
type: Answer
has comment: http://stackoverflow.com/comment/43019917
has comment: http://stackoverflow.com/comment/43080751
has comment: http://stackoverflow.com/comment/43092253
has comment: http://stackoverflow.com/comment/51104833
has comment: http://stackoverflow.com/comment/43022074
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43020515

http://stackoverflow.com/comment/43047197
type: AnswerComment
score: 0
has text: @Ashfaq have tick mark in left side of my answer.just click that.
comment on: http://stackoverflow.com/a/27289864
type: Comment

http://stackoverflow.com/q/27216766
upvote count: 1
tagged with: eclipse
answer count: 1
has comment: http://stackoverflow.com/comment/42913396
has answer: http://stackoverflow.com/a/27217274
tagged with: dagger
accepted answer: http://stackoverflow.com/a/27217274
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: How do I use Dagger?
type: Question
has comment: http://stackoverflow.com/comment/42913284
tagged with: java
has body: I've recently heard of the concept of Dependency Injection so I decided to learn about it. So, this is very stupid, rookie quesiton, and I tried hard to find some clues around the web not to ask it but I've given up: How do I use Dagger? I downloaded the JARs, added them to the Java project (which is basically the coffee example) with Add External JARs... (I'm using Eclipse). Got some compiler errors about missing library javax.inject but I managed to find it somewhere and added it aswell. Also removed some @Override tags because the compiler didn't like them. Now I'm getting this thing in the console Exception in thread "main" java.lang.IllegalStateException: Module adapter for class coffee.DripCoffeeModule could not be loaded. Please ensure that code generation was run for this module. and I have no idea what that means. I only want to see some working code but I barely know what I'm doing. Help please. EDIT: also I've been seeing stuff like dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.squareup.dagger:dagger:1.2.+' provided 'com.squareup.dagger:dagger-compiler:1.2.+' } (for example here) but with no explanation whatsoever. What do I do with that?

http://stackoverflow.com/comment/49599622
has text: Did you find a solution to this problem? I have the exact same problem, in fact my published version also has this problem. So purchases go through but my OnIabPurchaseFinishedListener is never called, so the purchase is never activated immediately. The funny part is that the purchase is registered on the Google server, so if the user re-opens the app, he can see the purchase.
type: QuestionComment
comment on: http://stackoverflow.com/q/27242746
type: Comment
score: 2

http://stackoverflow.com/comment/42999270
score: 1
comment on: http://stackoverflow.com/q/27263496
has text: Well, to start with, don't put it the `paintComponent` method!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27222808
type: Question
has comment: http://stackoverflow.com/comment/42924316
downvote count: 0
has title: Hibernate Mapping throws Constraint violation
has comment: http://stackoverflow.com/comment/42961343
tagged with: sql-server
upvote count: 1
has comment: http://stackoverflow.com/comment/42967818
favorite count: 0
type: UnansweredQuestion
has body: I have a database structure where many to many mapping is required. I have implemented it using the @ManyToMany annotation as follows: @Entity @Table(name="trans.documentfiles") public class DocumentFile extends GenericEntity { private DocumentType documentType; private DocumentFormat documentFormat; private Set&lt;DocumentGroup&gt; docgroups; /** * @return the documentType */ @ManyToOne(fetch = FetchType.LAZY, cascade=CascadeType.ALL) @JoinColumn(name = "filetypeid", nullable = false) public DocumentType getDocumentType() { return documentType; } /** * @param documentType the documentType to set */ public void setDocumentType(DocumentType documentType) { this.documentType = documentType; } /** * @return the docgroups */ @ManyToMany(mappedBy = "files") public Set&lt;DocumentGroup&gt; getDocgroups() { return docgroups; } /** * @param docgroups the docgroups to set */ public void setDocgroups(Set&lt;DocumentGroup&gt; docgroups) { this.docgroups = docgroups; } } DocumentGroup.java is as follows @Entity @Table(name="trans.document") public class DocumentGroup extends GenericEntity { private Set&lt;DocumentFile&gt; files = new HashSet&lt;DocumentFile&gt;(); /** * @return the files */ @ManyToMany( fetch = FetchType.LAZY, cascade = CascadeType.ALL ) @JoinTable(name = "trans.documentlink", joinColumns = {@JoinColumn(name = "documentid", referencedColumnName="id")}, inverseJoinColumns = {@JoinColumn(name = "fileid", referencedColumnName="id")}) public Set&lt;DocumentFile&gt; getFiles() { return files; } /** * @param files the files to set */ public void setFiles(Set&lt;DocumentFile&gt; files) { this.files = files; } } I have created relationships between the DocumentFile table and DocumentType tables in sql. I have not created any relationship between DocumentFile and DocumentGroup in sql. I want to delete records from the ocumentLinks table without deleting either the DocumentGroup record or the DocumentFile record nor the DocumentType record. I want to delete the parents i…
answer count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27236853
answer count: 3
has body: Get a Connection from the pool (this may throw an exception) Create a Statement out of the connection (also may throw an exception) Execute an SQL query using that statement and store it in a ResultSet (can throw as well) Do stuff with the query results Close ResultSet (exception!) Close Statement (exception!) Close Connection (exception!) Look at this code: Connection conn = null; Statement st = null; ResultSet set = null; try { conn = Database.getConnection(); st = conn.createStatement(); set = st.executeQuery("SELECT * FROM THING"); // &lt;-- Do stuff } catch (Exception e) { } finally { // Close set if possible if (set != null) { try { set.close(); } catch (Exception e) { } } // Close statement if possible if (st != null) { try { st.close(); } catch (Exception e) { } } // Close connection if possible if (conn != null) { try { conn.close(); } catch (Exception e) { } } } The finally block is where I close my stuff. As you can see, it is very messy. My question would be: is this the right way to clean up those resources?
has comment: http://stackoverflow.com/comment/42951392
favorite count: 0
tagged with: exception
has title: Closing resources that may throw exceptions
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27236951
has answer: http://stackoverflow.com/a/27236944
type: Question
has answer: http://stackoverflow.com/a/27237065
possible better answer: http://stackoverflow.com/a/27236944
has answer: http://stackoverflow.com/a/27236951
upvote count: 3

http://stackoverflow.com/a/27273868
type: Answer
answers question: http://stackoverflow.com/q/27273581
has body: ScheduledExecutorService.scheduleAtFixedRate returns a ScheduledFuture. If we call ScheduledFuture.get() the thread will block and wait for the periodic task completion, which may happen upon task cancellation or if the task throws an exception. In the latter case get() will throw java.util.concurrent.ExecutionException with wrapped original exception
upvote count: 4
has comment: http://stackoverflow.com/comment/43017485
downvote count: 0
score: 4

http://stackoverflow.com/comment/42940087
type: Comment
has text: Do you have `<h:form>` around `<p:fileUpload>` when using dialog?
comment on: http://stackoverflow.com/q/27231485
score: 0
type: QuestionComment

http://stackoverflow.com/comment/95046789
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/52989113
type: Comment
has text: While I generally agree, there need to be a normal way to instantiate the entry interface first. If not, it'll be of no use :-(

http://stackoverflow.com/q/27261630
tagged with: reflection
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43027722
has comment: http://stackoverflow.com/comment/43019309
has answer: http://stackoverflow.com/a/27275219
has comment: http://stackoverflow.com/comment/43019709
has comment: http://stackoverflow.com/comment/43010797
type: Question
has comment: http://stackoverflow.com/comment/43027912
has answer: http://stackoverflow.com/a/27270514
has comment: http://stackoverflow.com/comment/43011036
tagged with: struts2
has comment: http://stackoverflow.com/comment/43043956
has title: Reflection in Struts 2
answer count: 2
tagged with: ognl
has comment: http://stackoverflow.com/comment/43005735
downvote count: 0
has comment: http://stackoverflow.com/comment/43010480
has comment: http://stackoverflow.com/comment/43011276
favorite count: 0
has comment: http://stackoverflow.com/comment/43011130
has body: I have an action class which has approximately 30 variables. Getters and setters for these fields mess up my code and adds unnecessary lines. Is there a way to reflect all the private fields and make them "visible" for Struts?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43011047
tagged with: private-members
has comment: http://stackoverflow.com/comment/43010717
score: 2

http://stackoverflow.com/q/27195070
answer count: 4
has title: How to count occurrence of each character in the alphabet with a file
linked to: http://stackoverflow.com/q/15021163
has body: I would like to know how to go about starting a program that reads in a file and goes line by line counting the occurrence of each letter in the alphabet.I know I would like to use an array that holds the alphabets, but I am not sure how to go about reading each line and then printing the count out for each alphabetical occurrence.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42875404
has answer: http://stackoverflow.com/a/27195691
has comment: http://stackoverflow.com/comment/42875395
possible better answer: http://stackoverflow.com/a/27195352
tagged with: java
has comment: http://stackoverflow.com/comment/42875420
type: Question
has comment: http://stackoverflow.com/comment/42875362
has answer: http://stackoverflow.com/a/27195352
has answer: http://stackoverflow.com/a/27195138
accepted answer: http://stackoverflow.com/a/27195138
has answer: http://stackoverflow.com/a/27195488
score: 0

http://stackoverflow.com/q/27259948
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27260442
type: Question
has title: Synchronized Neighbours
score: 0
tagged with: java
tagged with: multithreading
answer count: 1
accepted answer: http://stackoverflow.com/a/27260442
has body: I have an array of object of type A. Each object has a value and a reference to the next object in the array. It also has a method process, which manipulates the value of the object, and the value of the following (next) object. public class A{ private int value; private A next; public void process(){ //manipulates the value of this and of next } } In my main method I have created multiple Threads of type B, which call the process-method of some objects in the array. Therefore I want to create a lock around the value. Multiple Threads shouldn't be allowed to simultaneously manipulate the value of a certain objects. But the problem is, if I declare the process-method synchronized, than still a thread processing array[0] and a thead processing array[1] are able to manipulate the value of array[1]. A call of array[1].process(), should wait, until all array[0].process() and array[1].process() finished. How can I create a lock around each neighbour pair?

http://stackoverflow.com/comment/42973438
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27246748
has text: Apologies for slight confusion hmParam vs cgiData, I created cgiData as a copy of same data to examine what was in the hashMap with the iterator, as I said this worked OK, but I couldn't get an individual value by key.

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

java
tags question: http://stackoverflow.com/q/27275017
tags question: http://stackoverflow.com/q/27176557
tags question: http://stackoverflow.com/q/27189545
tags question: http://stackoverflow.com/q/27211582
tags question: http://stackoverflow.com/q/27208702
tags question: http://stackoverflow.com/q/27263855
tags question: http://stackoverflow.com/q/27220547
tags question: http://stackoverflow.com/q/27170632
tags question: http://stackoverflow.com/q/27305812
tags question: http://stackoverflow.com/q/27175963
tags question: http://stackoverflow.com/q/27273290
tags question: http://stackoverflow.com/q/27310547
tags question: http://stackoverflow.com/q/27263243
tags question: http://stackoverflow.com/q/27313352
tags question: http://stackoverflow.com/q/27245669
tags question: http://stackoverflow.com/q/27306965
tags question: http://stackoverflow.com/q/27269691
tags question: http://stackoverflow.com/q/27220044
tags question: http://stackoverflow.com/q/27309645
tags question: http://stackoverflow.com/q/27236018
tags question: http://stackoverflow.com/q/27246040
tags question: http://stackoverflow.com/q/27155970
tags question: http://stackoverflow.com/q/27275444
tags question: http://stackoverflow.com/q/27158548
tags question: http://stackoverflow.com/q/27206706
tags question: http://stackoverflow.com/q/27266469
tags question: http://stackoverflow.com/q/27188424
tags question: http://stackoverflow.com/q/27224283
tags question: http://stackoverflow.com/q/27267972
tags question: http://stackoverflow.com/q/27311073
tags question: http://stackoverflow.com/q/27212053
tags question: http://stackoverflow.com/q/27263454
tags question: http://stackoverflow.com/q/27191151
tags question: http://stackoverflow.com/q/27153321
tags question: http://stackoverflow.com/q/27256087
tags question: http://stackoverflow.com/q/27289768
tags question: http://stackoverflow.com/q/27169493
tags question: http://stackoverflow.com/q/27310992
tags question: http://stackoverflow.com/q/27299818
tags question: http://stackoverflow.com/q/27225774
tags question: http://stackoverflow.com/q/27209669
tags question: http://stackoverflow.com/q/27190125
tags question: http://stackoverflow.com/q/27308481
tags question: http://stackoverflow.com/q/27258485
tags question: http://stackoverflow.com/q/27230938
tags question: http://stackoverflow.com/q/27214014
tags question: http://stackoverflow.com/q/27208123
tags question: http://stackoverflow.com/q/27309066
tags question: http://stackoverflow.com/q/27232641
tags question: http://stackoverflow.com/q/27222839
tags question: http://stackoverflow.com/q/27174094
tags question: http://stackoverflow.com/q/27283455
tags question: http://stackoverflow.com/q/27191085
tags question: http://stackoverflow.com/q/27191016
tags question: http://stackoverflow.com/q/27291004
tags question: http://stackoverflow.com/q/27265351
tags question: http://stackoverflow.com/q/27188446
tags question: http://stackoverflow.com/q/27236849
tags question: http://stackoverflow.com/q/27206599
tags question: http://stackoverflow.com/q/27268522
tags question: http://stackoverflow.com/q/27239028
tags question: http://stackoverflow.com/q/27208796
tags question: http://stackoverflow.com/q/27306986
tags question: http://stackoverflow.com/q/27276939
tags question: http://stackoverflow.com/q/27169721
tags question: http://stackoverflow.com/q/27179962
tags question: http://stackoverflow.com/q/27306165
tags question: http://stackoverflow.com/q/27261334
tags question: http://stackoverflow.com/q/27156798
tags question: http://stackoverflow.com/q/27222283
tags question: http://stackoverflow.com/q/27160828
tags question: http://stackoverflow.com/q/27187418
tags question: http://stackoverflow.com/q/27169947
tags question: http://stackoverflow.com/q/27193955
tags question: http://stackoverflow.com/q/27206994
tags question: http://stackoverflow.com/q/27191853
tags question: http://stackoverflow.com/q/27183146
tags question: http://stackoverflow.com/q/27273849
tags question: http://stackoverflow.com/q/27311168
tags question: http://stackoverflow.com/q/27221848

http://stackoverflow.com/q/27215611
tagged with: java
has answer: http://stackoverflow.com/a/27215660
tagged with: loops
has title: How can I make an if statement in a for-loop only occur for the first occurence after searching through elements in a 2D array?
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/27215660
upvote count: 0
tagged with: arrays
type: AnsweredQuestion
has body: For example here is my code and attempt so far: public void probeClicked(){ for (int i = 0; i &lt; buttons.length; i++) { for (int j = 0; j &lt; buttons[0].length; j++) { if (counts[i][j]==MINE){ buttons[i][j].setText("M"); buttons[i][j].setEnabled(false); JOptionPane.showMessageDialog(frame, "Probe clicked! 1 Mine has been revealed."); break; } else{ continue; } } } I want to make it so that, as soon as it finds ONE mine, it breaks out of the loop and the method is finished.
favorite count: 0
type: Question
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/27215744
score: -2
has answer: http://stackoverflow.com/a/27215744
tagged with: 2d

http://stackoverflow.com/q/27216506
has body: I'm doing a C++ implementation of Singly Linked List that I've already done in Java. The Fraction of my Java code is as follows : class Node { int info; Node next; Node() { next=null; } } class Op { Node front= null; void display() { Node rear=front; if(rear==null) System.out.println("List is empty"); else { while(rear!=null) { System.out.print("["+rear.info+"|"+rear.next+"]"+"---&gt;"); rear=rear.next; } System.out.println(); } } } next stores the address of the next Node in the list, front points to the first node in the list and rear is used to sequentially travel the list. Below is the C++ code that I'm trying to implement : class Node { public: int info; Node *next; Node() { next = NULL; } }; class Op { public: Node *front = NULL; //error line. }; int main() { return 0; } I'm using the Turbo C++ 3.0 compiler and the error it gives is : Cannot initialize a class member here I'm aware that the above problem can be resolved if I use C++11 but unfortunately the code has to be in Turbo C++ 3.0. The front has to be NULL in order to check if the list id empty or not. How do I solve this issue?
linked to: http://stackoverflow.com/q/15451840
type: Question
tagged with: turbo-c++
score: 0
has answer: http://stackoverflow.com/a/27216564
has answer: http://stackoverflow.com/a/27216644
has comment: http://stackoverflow.com/comment/42912895
has title: Unable to write the same Java code in C++ because "cannot initialize class member here" ERROR
has answer: http://stackoverflow.com/a/27216707
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27216550
answer count: 4
tagged with: c++
tagged with: linked-list
tagged with: java

http://stackoverflow.com/a/27344070
has body: There's a mismatch in how you use the objects and how you've set them up in your domain-objects/repository structure. Here's what you effectively do: In contrast to what you asked in the original headline of your question ("GETing and POSTing nested entities in RestRepository"), on the HTTP level, Address and CityZipState are not embedded, they're siblings. By providing repositories for both Address and CityStateZip you basically elevate the concepts to aggregate roots, which Spring Data REST translates into dedicated HTTP resources. In your HTTP communication you now treat CityStateZip like a value object, as you don't refer to it by its identifier which - in a REST context - is the URI you get returned in the Location header of the first request. So if you want to keep the domain types / repositories structure as is, you need to change your HTTP interaction as follows: POST $zipsUri { "zipCode" : "28899" , "city" : "Ada", "stateProv" : "NC" } 201 Created Location: $createdZipUri Now you can use the returned URI to create the Address: POST $addressesUri { "streetNo" : "985" , "streetName" : "Bellingham", "plus4Zip" : 2212, "cityStateZip" : $createdZipUri } 201 Created Location: $createdAddressUri So what you basically express is: "Please create an address with these details but refer to this CityZipState." Another option would be to change your domain types / repositories structure to either not expose the repository or turn CityStateZip into a value object. The error you run into is caused by Jackson not being able to marshal Hibernate proxies out of the box. Make sure you have the Jackson Hibernate module on the classpath. Spring Data REST will automatically register it for you then. You might wanna switch to eager loading for the cityStateZip property in Address as it effectively removeds the need to create a proxy at all and the target object is basically a set of primitives so that there's not big price to pay for the additional join.
has comment: http://stackoverflow.com/comment/43174090
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/27304504
answers question: http://stackoverflow.com/q/27304504
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43180202
type: Answer

http://stackoverflow.com/q/27197474
downvote count: 1
accepted answer: http://stackoverflow.com/a/27208482
has answer: http://stackoverflow.com/a/27197562
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/27197562
has comment: http://stackoverflow.com/comment/42881403
tagged with: eclipse
type: Question
has body: I made a Flappy Bird remake and I just got done with it not too long ago, everything worked as expected, but when I try to add Google's ads, the ads display, but the game doesn't execute and run, it's just a black screen. I'm using LibGDX for my game also. Here's the MainActivity.java code and Main.xml code. MainActivity.java : package com.kensleeinc.SuperBird; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.kilobolt.ZombieBird.R; import com.kilobolt.ZombieBird.ZBGame; public class MainActivity extends AndroidApplication { private AdView adView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = false; initialize(new ZBGame(), cfg); super.onCreate(savedInstanceState); setContentView(R.layout.main); AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } } Main.xml : &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;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_alignParentLeft="true" ads:adSize="BANNER" ads:adUnitId="@string/ad_unit_id"/&gt; &lt;/RelativeLayout&gt; Can anyone help me with this? Thanks! Heres my log.txt - 11-28 19:41:07.521: E/AndroidRuntime(2889): FATAL EXCEPTION: main 11-28 19:41:07.521: E/AndroidRuntime(2889): Process: com.kilobolt.ZombieBird, PID: 2889 11-28 19:4…
answer count: 2
has comment: http://stackoverflow.com/comment/42879892
upvote count: 0
has answer: http://stackoverflow.com/a/27208482
tagged with: android
tagged with: ads
has title: Google Ads Stopped My Game From Displaying
favorite count: 0
has comment: http://stackoverflow.com/comment/42880198
tagged with: adsense

http://stackoverflow.com/comment/42875683
score: 0
type: QuestionComment
type: Comment
has text: 1. Consider using a `JTable`. 2. *Consider editing you previous [old question](http://stackoverflow.com/questions/27178150/creating-a-dynamic-scrollable-list-in-jframe) instead of making a new one.*
comment on: http://stackoverflow.com/q/27195204

http://stackoverflow.com/comment/42977772
score: 0
comment on: http://stackoverflow.com/q/27251755
has text: *without changing my code*
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27273062
score: 0
type: AcceptedAnswer
has body: Just an addition to this and I realise it's not the question you asked, but it looks like you also want to convert your split array to a list, do this instead of the for loop you have String splitString = "####"; List&lt;String&gt; splitList = Arrays.asList(splitString.split("#",-1));
type: Answer
accepted answer of: http://stackoverflow.com/q/27272757
answers question: http://stackoverflow.com/q/27272757

http://stackoverflow.com/comment/42929507
type: QuestionComment
type: Comment
score: 1
has text: Well if you can confirm that you can use Java 8, I'll write it up as an answer... but it would also be useful if you'd give concrete examples, and also say what form your input data is in. (`java.util.Date` isn't a great starting point.)
comment on: http://stackoverflow.com/q/27225505

http://stackoverflow.com/a/27231946
has comment: http://stackoverflow.com/comment/42941645
has comment: http://stackoverflow.com/comment/42963742
has comment: http://stackoverflow.com/comment/42941345
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27231852
has comment: http://stackoverflow.com/comment/42962547
answers question: http://stackoverflow.com/q/27231852
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/42941998
has comment: http://stackoverflow.com/comment/42946771
upvote count: 6
has comment: http://stackoverflow.com/comment/42941093
has comment: http://stackoverflow.com/comment/42942815
has comment: http://stackoverflow.com/comment/42979688
has comment: http://stackoverflow.com/comment/42941690
has body: Change &lt;url-pattern&gt;/*&lt;/url-pattern&gt; to &lt;url-pattern&gt;/&lt;/url-pattern&gt; Currently, your mapped DispatcherServlet is marked as handling all requests because of /*. This means that it will also attempt to handle a request dispatched to /WEB-INF/jsp/test1.jsp. It obviously doesn't have a handler for that and will fail. The pattern / is special in that it is the default fallback if no other pattern matches. If there's a Servlet that maps to the request path, that Servlet will be chosen before your mapped DispatcherServlet. Most (probably all) Servlet containers come mapped with a Servlet to handle rendering JSPs with the url-pattern of *.jsp. That will take precedence over your DispatcherServlet mapped to /. If you're still getting 404 after these changes, then there are a few possibilities. Spring logs at the INFO level any handler methods (@RequestMapping annotated methods within @Controller beans) it registers. If you don't see any of those in your logs, then your web application hasn't been deployed correctly/successfully. If your Servlet container is embedded in your IDE, check the appropriate tab/view on the apps that are deployed. If it's standalone, check that your generated .war file is in the appropriate directory and expanded correctly.
has comment: http://stackoverflow.com/comment/42956993
downvote count: 0
has comment: http://stackoverflow.com/comment/42940972

http://stackoverflow.com/q/27295827
has body: Is there any function/utility/tool that unroles a loop (of n iterations) for a given number. (Java language) For example: the utilityhas to unroll 3 times the next loop: for(int i=0; i&lt;10; i++){ int k = k + 1; } The tansformed code has to be: k = k + 1; k = k + 1; k = k + 1; for(int i=3; i&lt;10; i++){ int k = k + 1; } Thanks Itamar.
has answer: http://stackoverflow.com/a/27295945
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has title: Unrolling loop for a given number
has comment: http://stackoverflow.com/comment/43056136
has answer: http://stackoverflow.com/a/27296037
answer count: 2
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/42844889
score: 0
type: Comment
has text: one table only? are you new to sql?
comment on: http://stackoverflow.com/a/27177882
type: AnswerComment

http://stackoverflow.com/comment/43012489
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27230710
score: 0
has text: Bcz its complexity is exponential and I want to reduce it.

http://stackoverflow.com/q/27180954
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: linked-list
has comment: http://stackoverflow.com/comment/42850420
has body: From Cracking the Coding Interview. Problem 2.1: Write code to remove duplicates from an unsorted linked list. This is the solution that they provide: public static void removeDuplicates(Node n) { Hashtable&lt;Integer, Boolean&gt; table = new Hashtable&lt;Integer, Boolean&gt;(); Node previous = n; while (n != null) { if (table.containsKey(n.data)) { previous.next = n.next; } else { table.put(n.data, true); previous = n; } n = n.next; } } My question is: When you do n=n.next, wouldn’t you lose the head of the list (first node)? How would you access to this list again with the duplicates removed if you don’t have access to the head? And also isn’t it better to use a Set instead of a Table? I don’t think you need Key and Value. I think you only need the Key, right? Thank you
tagged with: java
has answer: http://stackoverflow.com/a/57739476
type: Question
has title: Remove duplicates in list from Cracking the Coding Interview
answer count: 2
has answer: http://stackoverflow.com/a/27187918
downvote count: 0
has comment: http://stackoverflow.com/comment/42850394
favorite count: 0

http://stackoverflow.com/comment/43213196
comment on: http://stackoverflow.com/a/27279575
type: AnswerComment
score: 0
type: Comment
has text: Em...It's not the same what I want, there is no option to add Cutom.css to Deafault.

http://stackoverflow.com/q/27159057
has comment: http://stackoverflow.com/comment/42812100
tagged with: java
has comment: http://stackoverflow.com/comment/42812096
has comment: http://stackoverflow.com/comment/42812161
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42812075
has comment: http://stackoverflow.com/comment/42812047
linked to: http://stackoverflow.com/q/5554734
has answer: http://stackoverflow.com/a/27159312
duplicate of: http://stackoverflow.com/q/5554734
score: 0
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/27159074
favorite count: 0
has comment: http://stackoverflow.com/comment/42812004
has comment: http://stackoverflow.com/comment/42812024
has answer: http://stackoverflow.com/a/27159078
has comment: http://stackoverflow.com/comment/42812135
type: UnansweredQuestion
has body: I need to print this array for a tic tac toe program I am writing for APCS. I am getting an ArrayIndexOutOfBoundsException. String[][] ticBoard = { {"-","-","-"}, {"-","-","-"}, {"-","-","-"} }; for(int d = 0; d &lt; ticBoard.length; d++){ for(int r = 0; r &lt; ticBoard.length; d++){ System.out.print(ticBoard[d][r]); } }
has title: How can I print a 2d Array?

http://stackoverflow.com/a/27195292
has comment: http://stackoverflow.com/comment/42880995
has comment: http://stackoverflow.com/comment/42879417
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42887322
has comment: http://stackoverflow.com/comment/42881227
score: 1
has comment: http://stackoverflow.com/comment/42887011
downvote count: 1
has comment: http://stackoverflow.com/comment/42880483
answers question: http://stackoverflow.com/q/27190592
has body: In C# you can implement this in the next way: IEnumerable &lt;int&gt; Fibonacci() { var a = 0; var b = 1; while (true) { var t = b; yield return b = a + b; a = t; } }
has comment: http://stackoverflow.com/comment/42880971

http://stackoverflow.com/comment/42956985
has text: In the future I want to be able to do java MyProgram PathA PathB PathC .... It's a bit tedious to add quotes to all these paths. I basically want to be able to copy and paste all these paths without needing to change anything.
type: QuestionComment
comment on: http://stackoverflow.com/q/27240231
score: 0
type: Comment

http://stackoverflow.com/a/27304593
has comment: http://stackoverflow.com/comment/43072297
has comment: http://stackoverflow.com/comment/43072620
has comment: http://stackoverflow.com/comment/43072157
answers question: http://stackoverflow.com/q/27304520
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43072171
has comment: http://stackoverflow.com/comment/43072610
type: Answer
has comment: http://stackoverflow.com/comment/43072906
upvote count: 2
has body: Use the collection shuffle: ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); for(int i = 0; i &lt; images.length; i++) { numbers.add(i+1); } Collections.shuffle(numbers);
has comment: http://stackoverflow.com/comment/43072387

http://stackoverflow.com/q/27308854
possible better answer: http://stackoverflow.com/a/27309337
has answer: http://stackoverflow.com/a/27309337
type: Question
answer count: 2
upvote count: 0
tagged with: sorting
favorite count: 0
tagged with: selection-sort
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/27309349
has title: 2D array integer column in descending order
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27309349
tagged with: java
score: -1
has body: I am having trouble with "//Clinton's delegates in order from highest to lowest". I realize that it's currently in ascending order (I was more familiar with this), but it still isn't looping enough times to even do the ascending order properly. I would like for the third column to be in descending order --> Integer.parseInt(primary[row][2]). import java.io.*; public static void main(String[] args) throws IOException { //Read text file FileReader fr = new FileReader("primary1.txt"); BufferedReader br = new BufferedReader(fr); //2D array String[][] primary = new String[44][5]; //Section break System.out.println("1. The file contents are:\n"); //Add column titles System.out.println("States\t\t\t\tCandidate#1\tVotes\t\tCandidate#2\tVotes"); //Set delimiter as "/" String line; int i=0; while((line=br.readLine())!=null){ primary[i]=line.split("/"); i++; } //Print text file for(int row=0; row&lt;primary.length; row++){ for(int col=0; col&lt;primary[row].length; col++){ //Add space between columns System.out.print(primary[row][col] + "\t\t"); } //Newline System.out.println(""); } //Clinton's delegates in order from highest to lowest int temp=0; for(int row=0; row&lt;primary.length-1; row++){ //Parse Integer int delC = Integer.parseInt(primary[row][2]); int delC1 = Integer.parseInt(primary[row+1][2]); if(delC &gt; delC1){ temp=delC1; delC1=delC; delC=temp; } System.out.println(temp); } }

http://stackoverflow.com/q/27194554
upvote count: 1
favorite count: 0
tagged with: timer
has comment: http://stackoverflow.com/comment/42874994
has answer: http://stackoverflow.com/a/27194595
type: UnansweredQuestion
has body: public void playMet(){ int tempo = Integer.parseInt(met_speed.getText()); tempo = tempo/60; int delay = tempo*1000; new Timer(delay, new ActionListener(){ public void actionPerformed(ActionEvent e){ if(Play.isSelected()){ System.out.println("beep"); playSound("Click1.wav"); } } }).start(); } Here's the code for my class. It grabs the value from the JTextField/60*1000 which is the milisecond value for when the beep should run. I tested it with only the System.out.println("beep"); line and it worked fine, but when I actually played a sound it delays or skips or doubles the sound. playSound(): public void playSound(String filename){ try { Clip clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudioInputStream(new File(filename))); clip.start(); } catch (Exception exc) { exc.printStackTrace(System.out); } } I'm not sure what's really going on here, any suggestions? edit: public void playMet(){ int tempo = Integer.parseInt(met_speed.getText()); tempo = tempo/60; int delay = tempo*1000; try { Clip clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudioInputStream(new File("Click1.wav"))); clip.start(); } catch (Exception exc) { exc.printStackTrace(System.out); } new Timer(delay, new ActionListener(){ public void actionPerformed(ActionEvent e){ if(Play.isSelected()){ System.out.println("beep"); clip.start(); } } }).start(); } Edit 2: tried a different approach public void playMet(){ int tempo = Integer.parseInt(met_speed.getText()); tempo = tempo/60; int delay = tempo*1000; if(Play.isSelected()){ try { FileInputStream in = new FileInputStream(new File("Click1.wav")); AudioStream as = new AudioStream(in); AudioPlayer.player.start(as); Thread.sleep(tempo*1000); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } playMet(); } else System.out.println("not playing"); } Not it plays at the correct speed consistently, but it freezes and the play button can no loner be toggled. If I remove the playMet() towards the end it works but only plays once. If I mak…
downvote count: 0
linked to: http://stackoverflow.com/q/9999961
score: 1
tagged with: java
has title: Java Metronome Timer() inconsistent
has answer: http://stackoverflow.com/a/27194589
type: Question
has comment: http://stackoverflow.com/comment/42876052
answer count: 2

http://stackoverflow.com/a/27298728
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27298551
has body: Here is a working version of your code. As mentioned in previous answers, the System.in reads in characters so you cannot read in numbers directly. Below The code is leveraging the BufferedReader API whitch works on an InputStream. public class App { public static void main(String[] args) throws IOException { System.out.println("Hello, come and play a game with me!"); int x = 5; int guess; do { System.out.println("Please input a number..."); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); guess = Integer.parseInt(br.readLine()); if(guess &lt; 5){ System.out.println("You guessed the number!"); break; } } while(guess&gt;5); } }

http://stackoverflow.com/q/27204997
has comment: http://stackoverflow.com/comment/42893570
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42892646
tagged with: android
has comment: http://stackoverflow.com/comment/42893073
has title: How to create login and signup different activity in android?
tagged with: java
type: Question
has body: I want user to create account before log in by clicking sign up text, and it will proceed to register page. After user register account, they may use the account to log in the system. Can someone help me to fix it? My problem is I can't register account to login. Application will not responding when I click "submit" button in register activity. I not sure what problem in my coding. I am newbie in android java coding. Thanks for helping. MainActivity.Java public class MainActivity extends Activity { DBHandler dbhandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText txtUserName = (EditText)findViewById(R.id.editTextUsername); final EditText txtPassword = (EditText)findViewById(R.id.editTextPassword); Button btnLogin = (Button)findViewById(R.id.button_login); dbhandler = new DBHandler(this); dbhandler.open(); btnLogin.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { String username = txtUserName.getText().toString(); String password = txtPassword.getText().toString(); try{ if(username.length() &gt;= 0 &amp;&amp; password.length() &gt;= 0) { DBHandler dbUser = new DBHandler(MainActivity.this); dbUser.open(); if(dbUser.Login(username, password)) { Toast.makeText(MainActivity.this,"Successfully Logged In", Toast.LENGTH_LONG).show(); setContentView(R.layout.fragment_home); }else{ Toast.makeText(MainActivity.this,"Invalid Username/Password", Toast.LENGTH_LONG).show(); } dbUser.close(); } }catch(Exception e) { Toast.makeText(MainActivity.this,e.getMessage(), Toast.LENGTH_LONG).show(); } } }); TextView location = (TextView) findViewById(R.id.signUp); location.setMovementMethod(LinkMovementMethod.getInstance()); Spannable spans = (Spannable) location.getText(); ClickableSpan clickSpan = new ClickableSpan() { @Override public void onClick(View arg0) { setContentView(R.layout.activity_register); } }; spans.setSpan(clickSpan, 0, spans.length…
has comment: http://stackoverflow.com/comment/42892882
linked to: http://stackoverflow.com/q/4153517
score: -1
has comment: http://stackoverflow.com/comment/42892998
has comment: http://stackoverflow.com/comment/42892547
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42892616
has answer: http://stackoverflow.com/a/27205570
favorite count: 0

http://stackoverflow.com/a/27185256
type: Answer
score: 2
has body: You can just check whether Calendar.getInstance(Locale) returns a GregorianCalendar: for (Locale locale : Calendar.getAvailableLocales()) { if (locale.getCountry().length() &gt; 0 &amp;&amp; Calendar.getInstance(locale) instanceof GregorianCalendar) { addItem(locale.getDisplayName()); } }
answers question: http://stackoverflow.com/q/27183759
accepted answer of: http://stackoverflow.com/q/27183759
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/27210593
accepted answer: http://stackoverflow.com/a/27213294
has comment: http://stackoverflow.com/comment/42905894
type: AnsweredQuestion
has title: Java.IO.ISerializable Xamarin
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/42906442
tagged with: xamarin.android
type: Question
tagged with: c#
score: 5
has body: I'm trying to pass object in Android using Iserializable, but it return me "Unable to activate instance of type from native handle" exception. Below are my codes. [FBUserParcel.cs] using System; using Android.OS; using PlayCardLeh.Helpers; namespace PlayCardLeh.Android { public class FBUserParcel:Java.Lang.Object, Java.IO.ISerializable { Xamarin.Facebook.Model.IGraphUser fbUser; public FBUserParcel (Xamarin.Facebook.Model.IGraphUser user) { fbUser = user; } } } [MainActivity.cs] private async Task FindFBUser(Xamarin.Facebook.Model.IGraphUser user) { if (user != null) { Console.WriteLine ("GOT USER: " + user.Name); try { var t = await User.FindUserWithFBID (user); } catch(NotFound NotFound) { RunOnUiThread (() =&gt; { Intent i = new Intent (this,typeof (RegisterActivity)); FBUserParcel u = new FBUserParcel(user); StartActivity (i); }); } } else Console.WriteLine ("Failed to get 'me'!"); } RegisterActivity.cs protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Register); if (Intent.HasExtra ("fbUser")) { var u = Intent.Extras; u.GetSerializable ("fbUser"); } } The exception happen at "u.GetSerializable ("fbUser");". Sorry I'm kinda new to Xamarin, anyone have exprience with using Iserializable? What did I missed out in "FBUserParcel.cs" ?? Thanks Mug4n for sharing a link that discuss about the same issue. http://forums.xamarin.com/discussion/451/communicate-with-iserializable
downvote count: 0
has comment: http://stackoverflow.com/comment/53006885
favorite count: 0
tagged with: android
tagged with: xamarin
answer count: 1
has answer: http://stackoverflow.com/a/27213294
has comment: http://stackoverflow.com/comment/42904339

http://stackoverflow.com/a/27256871
answers question: http://stackoverflow.com/q/27256631
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42987599
score: 1
has body: Looks like it should be: sb.append(reg.get(minIndex).getDate()+"\n");
downvote count: 0

http://stackoverflow.com/q/27288617
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/27288657
score: 0
tagged with: java
tagged with: selenium
upvote count: 1
downvote count: 1
type: Question
has body: WebElement.sendKeys(Keys.RETURN) is not working. Error is displayed as Keys cannot be resolved to a variable. I want to automate enter key in Selenium Web Driver Please let me know a solution
answer count: 1
favorite count: 0
has title: Keys cannot be resolved to a variable
type: UnansweredQuestion

http://stackoverflow.com/comment/42814897
comment on: http://stackoverflow.com/q/27160592
type: QuestionComment
type: Comment
score: 1
has text: You're creating a large amount of short lived objects, as fast as the CPU can make them...since you're only updating the seconds, try putting a `Thread.sleep(500)` after the display...and are you displaying this on a GUI? Cause you're violating the single thread rules of most UIs...

http://stackoverflow.com/a/27263955
has comment: http://stackoverflow.com/comment/43035568
has comment: http://stackoverflow.com/comment/43000115
has comment: http://stackoverflow.com/comment/43000174
has body: I believe CardLayout is what you're looking for. With it, the programmer can choose which JPanels should be visible in the JFrame. Upon user interaction you can switch the contents of the JFrame without new JFrames or JOptionPanes popping up. Is there an easier way than using Swing for simple games? Swing has a learning curve, but with the right resources and practice you can learn to build simple GUI applications pretty quickly.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27263922
has comment: http://stackoverflow.com/comment/43000148
has comment: http://stackoverflow.com/comment/43000286

http://stackoverflow.com/comment/42998849
comment on: http://stackoverflow.com/q/27261958
score: 0
has text: Can you take a look at my nested Maps? This is the incorrect structure, but I'm not sure what the proper one is. Question has been updated.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27305193
possible better answer: http://stackoverflow.com/a/27305250
tagged with: filesystems
has answer: http://stackoverflow.com/a/27305250
type: AnsweredQuestion
type: Question
tagged with: io
has answer: http://stackoverflow.com/a/27305249
has body: Im trying to write a function that will take a string, then open a file with that string name and read the text. I know how to do this, but im having trouble with the fact that my text files are not saved in the same place as my java file. It looks like this. Project name/src/program.java Project name/resources/text.txt Im using the File class, but dont know what to put in the File constructor to open to the right place. ie. File store = new File(xxxxxxxxxtext.txt) Help me out with what goes in front of the file name please. Also, this is java 6 and im on windows 8. This is my code: public static void areaSearch(String a) { Scanner reader = null; try { reader = new Scanner(new File("../resources/" + a+ ".txt")); } catch (Exception e) { System.out.println("File: " + a +" not opended..."); }
score: 0
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/27305249
has title: How to read from a text file in java when its not saved in the same place

http://stackoverflow.com/q/27247265
type: Question
has title: Running multiple threads from within a unit test
score: 0
answer count: 1
tagged with: junit
type: UnansweredQuestion
tagged with: multithreading
has body: Below is a unit test which uses ScheduledExecutorService to execute a scheduled runnable every second : import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; public class ConcurrentRequestSimulator { private static final int NUMBER_REQUESTS = 4; @Test public void testGetToDoList() { try { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10); scheduler.scheduleAtFixedRate(new RequestThreadInvoker(), 0, 1, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } } private final class RequestThreadInvoker implements Runnable { public void run() { ExecutorService es = Executors.newCachedThreadPool(); for (int i = 1; i &lt;= NUMBER_REQUESTS; i++) { es.execute(new RequestThread()); } es.shutdown(); while (!es.isTerminated()) { } } } private final class RequestThread implements Runnable { public void run() { try { System.out.println("in RequestThread"); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } The line System.out.println("in RequestThread"); in RequestThread does not appear to be invoked as no output is displayed to console. I think the issue is that since the test runs to completion, it causes the scheduler to stop scheduling? Can the test be updated so that scheduler is not terminated and RequestThreadInvoker is invoked repeatedly once per second ? In RequestThreadInvoker I create a new instance of ExecutorService. Could this be causing the issue ?
tagged with: java
has answer: http://stackoverflow.com/a/27248156
tagged with: unit-testing

http://stackoverflow.com/q/27286528
has comment: http://stackoverflow.com/comment/43040445
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/65618159
answer count: 2
score: 3
possible better answer: http://stackoverflow.com/a/65618159
downvote count: 0
has answer: http://stackoverflow.com/a/27287000
favorite count: 0
has title: How to parse JSON with JAVA when there are random key names
has body: How do I convert some JSON to a POJO when I don't know the name of a key? This is my POJO: public class Summoner { private Details summonerDetails; public Details getSummonerDetails() { return summonerDetails; } public void setSummonerDetails(Details summonerDetails) { this.summonerDetails = summonerDetails; } } The Details class have variables like id, name, etc. -> No issues here This is the line in my Main class where I try to map the JSON to a POJO: Summoner test = new ObjectMapper().readValue(json, Summoner.class); this is a JSON response example I receive: { "randomName":{ "id":22600348, "name":"Ateuzz", "profileIconId":546, "summonerLevel":30, "revisionDate":1378316614000 } } if my POJO Details member variable name is "randomName", above code will work. but when I get a response with a different name than "randomName", it doesn't. How do I make my code work for random names? I'm using Jackson I'm sorry I can't make a little more clear my issue.
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/27287000
has comment: http://stackoverflow.com/comment/43040470
type: Question

http://stackoverflow.com/comment/42831693
type: QuestionComment
comment on: http://stackoverflow.com/q/27168951
score: 0
type: Comment
has text: @lmm how do I exclude META-INF/ files? Also, I've updated my post with some relevant (as I suppose) assembly output. Perhaps it'll further clarify what's going on.

http://stackoverflow.com/q/27205475
has comment: http://stackoverflow.com/comment/42893842
has title: java:Maze Solver using Backtracking stuck in Loop
tagged with: maze
accepted answer: http://stackoverflow.com/a/27205667
has comment: http://stackoverflow.com/comment/42893638
tagged with: backtracking
has comment: http://stackoverflow.com/comment/42893776
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42893806
tagged with: java
has answer: http://stackoverflow.com/a/27205667
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27205676
has body: i want to solve maze by backtracking,after a little googling! i see this algorithm: Recursion: Solving a Maze here it is: FIND-PATH(x, y) if (x,y outside maze) return false if (x,y is goal) return true if (x,y not open) return false mark x,y as part of solution path if (FIND-PATH(North of x,y) == true) return true if (FIND-PATH(East of x,y) == true) return true if (FIND-PATH(South of x,y) == true) return true if (FIND-PATH(West of x,y) == true) return true unmark x,y as part of solution path return false i try to implement it correctly,as below: public class main { public static void main(String[] args) { // A as a Start and B is finish Line char maze[][] = { { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' }, { '#', 'A', ' ', ' ', '#', ' ', '#', ' ', ' ', '#' }, { '#', ' ', ' ', ' ', '#', ' ', '#', ' ', '#', '#' }, { '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', '#', '#', ' ', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#' }, { '#', ' ', ' ', ' ', ' ', ' ', '#', ' ', '#', '#' }, { '#', 'B', '#', ' ', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' } }; for (int i = 0; i &lt; maze.length; i++) { System.out.println(maze[i]); } mazeTraversal(maze, 1, 1); } static boolean mazeTraversal(char m[][], int i, int j) { if (m[i][j] == '#') return false; if (m[i][j] == 'B') return true; // marking as a part of path m[i][j] = '*'; //north if ((mazeTraversal(m, i , j - 1)) == true) { return true; } //east if ((mazeTraversal(m, i + 1 , j)) == true) { return true; } //south if ((mazeTraversal(m, i , j + 1)) == true) { return true; } //west if ((mazeTraversal(m, i - 1, j)) == true) { return true; } m[i][j] = ' '; return false; } } here is the console error: (stack overflow)! Exception in thread "main" java.lang.StackOverflowError at main.mazeTraversal(main.java:35) at main.mazeTraversal(main.java:35) at main.mazeTraversal(main.java:43) at main.…
has answer: http://stackoverflow.com/a/27205676

http://stackoverflow.com/comment/42809664
comment on: http://stackoverflow.com/q/27155291
score: 0
type: Comment
type: QuestionComment
has text: Do you mean that I should change to String path = 192.168.80.2:3000;

http://stackoverflow.com/q/27175881
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42841187
accepted answer: http://stackoverflow.com/a/27176427
type: Question
has answer: http://stackoverflow.com/a/27176427
answer count: 2
possible better answer: http://stackoverflow.com/a/27175960
upvote count: 1
has answer: http://stackoverflow.com/a/27175960
has body: Im trying to count how many times each number between 0 to 9 was typed in a loop, when press -1 it will stop the loop, I made it work with the long term, Also I would have to print which of the numbers was typed the most. For now I only have the couting code: int pickedNum,counter_0=0,counter_1=0,counter_2=0,counter_3=0,counter_4=0,counter_5=0,counter_6=0,counter_7=0,counter_8=0,counter_9=0; do{ System.out.println("Please enter a numbr between 0-9 , -1 to exit:"); pickedNum=s.nextInt(); if(pickedNum==0){ counter_0++; } if(pickedNum==1){ counter_1++; } if(pickedNum==2){ counter_2++; } if(pickedNum==3){ counter_3++; } if(pickedNum==4){ counter_4++; } if(pickedNum==5){ counter_5++; } if(pickedNum==6){ counter_6++; } if(pickedNum==7){ counter_7++; } if(pickedNum==8){ counter_8++; } if(pickedNum==9){ counter_9++; } } while(pickedNum != -1); System.out.printf("The number 0 appears: %d \n" + "The number 1 appears: %d \n" + "The number 2 appears: %d \n" + "The number 3 appears: %d \n" + "The number 4 appears: %d \n" + "The number 5 appears: %d \n" + "The number 6 appears: %d \n" + "The number 7 appears: %d \n" + "The number 8 appears: %d \n" + "The number 9 appears: %d \n", counter_0,counter_1,counter_2, counter_3,counter_4,counter_5, counter_6,counter_7,counter_8,counter_9); as you can see, It works fine, But I know there is a way better option to do this thing. And as I mentioned, I also need to print the largest number counts(which number was type the most), and It will take a long way to reach that with my way of programming this. I would like to get any tip or notes to improve this to work easier and faster. Any notes would be appriciated. EDIT: Forgot to mention to use only basics, and not advanced methods, array and loops are fine.
has title: Counting how many times each number was typed
favorite count: 0
has comment: http://stackoverflow.com/comment/42841151
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/27189047
accepted answer: http://stackoverflow.com/a/27197157
upvote count: 3
has body: We have a Spring Boot (1.1.6) application deployed as a .war file to a Tomcat 7.0.52 / OpenJDK 7 server. We need to run this server under a SecurityManager. Even when we operate the server with a policy that allows AllPermission to all code (essentially the same as not running under a SecurityManager) we get exceptions thrown due to reflection activity. Here's a full stack trace of one of the exceptions. java.lang.IllegalAccessException: Class org.apache.catalina.security.SecurityUtil$1 can not access a member of class org.springframework.boot.context.web.ErrorPageFilter with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) ~[na:1.7.0_65] at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) ~[na:1.7.0_65] at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) ~[na:1.7.0_65] at java.lang.reflect.Method.invoke(Method.java:599) ~[na:1.7.0_65] at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277) ~[catalina.jar:7.0.52] at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274) ~[catalina.jar:7.0.52] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_65] at javax.security.auth.Subject.doAsPrivileged(Subject.java:536) ~[na:1.7.0_65] at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309) ~[catalina.jar:7.0.52] at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:249) ~[catalina.jar:7.0.52] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) ~[catalina.jar:7.0.52] at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) ~[catalina.jar:7.0.52] at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:191) ~[catalina.jar:7.0.52] at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:187) ~[catalina.jar:7.0.52] at java.security.AccessController.d…
answer count: 1
tagged with: tomcat
favorite count: 0
tagged with: spring
has title: SpringBoot webapp under Java SecurityManager throws exceptions when granted AllPermission
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/27197157

http://stackoverflow.com/a/27296382
type: Answer
has comment: http://stackoverflow.com/comment/43057198
has comment: http://stackoverflow.com/comment/43064258
has comment: http://stackoverflow.com/comment/43057519
has comment: http://stackoverflow.com/comment/43059112
has comment: http://stackoverflow.com/comment/43061788
has comment: http://stackoverflow.com/comment/43057256
has comment: http://stackoverflow.com/comment/43059595
has comment: http://stackoverflow.com/comment/43059873
has comment: http://stackoverflow.com/comment/43062448
has comment: http://stackoverflow.com/comment/43059011
has body: You should use asynctask while using network related tasks. Here what happens is , Whenever you press login it carries out network related task which takes some time. So at that instant the json respone is null or other value. So after sometime you have got your response , and when you click login, It works. I hope this helps :) public class LoginActivity extends Activity { Button btnLogin; Button btnLinkToRegister; EditText inputEmail; EditText inputPassword; TextView loginErrorMsg; // JSON Response node names private static String KEY_SUCCESS = "success"; private static String KEY_ERROR = "error"; private static String KEY_ERROR_MSG = "error_msg"; private static String KEY_UID = "uid"; private static String KEY_NAME = "name"; private static String KEY_EMAIL = "email"; private static String KEY_CREATED_AT = "created_at"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); // Importing all assets like buttons, text fields inputEmail = (EditText) findViewById(R.id.loginEmail); inputPassword = (EditText) findViewById(R.id.loginPassword); btnLogin = (Button) findViewById(R.id.btnLogin); btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen); loginErrorMsg = (TextView) findViewById(R.id.login_error); // Login button Click Event btnLogin.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String email = inputEmail.getText().toString(); String password = inputPassword.getText().toString(); new ProcessLogin().execute(); } }); // Link to Register Screen btnLinkToRegister.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent i = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(i); finish(); } }); } private class ProcessLogin extends AsyncTask&lt;String, String, JSONObject&gt; { private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDi…
has comment: http://stackoverflow.com/comment/43060335
has comment: http://stackoverflow.com/comment/43062037
has comment: http://stackoverflow.com/comment/43063801
score: 0
answers question: http://stackoverflow.com/q/27295970

http://stackoverflow.com/q/27160193
linked to: http://stackoverflow.com/q/13102045
has answer: http://stackoverflow.com/a/27160301
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42814218
has comment: http://stackoverflow.com/comment/42814304
has body: Need help understanding how to make this function properly. It will only run as "New" not "Void()" and when I get to the Scan.line it crashes. I also have to learn how to plot linear functions such as y = mx + b and such. This is my first time doing a project so big and I am yearning to really develop my analytic thinking skills in order to progress as a programmer. Please some help would much be appreciated. import java.util.Scanner; public static class Calculator { int Number1; int Number2; String Operation; int Final; public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println ("Enter your first number: "); Number1 = scan.nextInt(); System.out.println ("Number 1: " + Number1 + " Number 2: " + Number2); System.out.println ("Ener your second number: "); Number2 = scan.nextInt(); System.out.println ("Number1: " + Number1 + " Number 2: " + Number2); System.out.println ("Enter numericle operation you wish to preform: "); Operation = scan.nextLine(); if ( Operation == "+" ) { Final = (Number1 + Number2); System.out.print("Ans: " + Final); } if ( Operation == "-" ) { Final = (Number1 - Number2); System.out.print("Ans: " + Final); } if ( Operation == "*" ) { Final = (Number1 * Number2); System.out.print("Ans: " + Final); } if ( Operation == "/" ) { Final = (Number1 / Number2); System.out.print("Ans: " + Final); } } }
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/513832
has title: Basic Calculator
has comment: http://stackoverflow.com/comment/42814266
has comment: http://stackoverflow.com/comment/42814185
upvote count: 2
has comment: http://stackoverflow.com/comment/42814237
has comment: http://stackoverflow.com/comment/42814316
answer count: 1
has comment: http://stackoverflow.com/comment/42814239
tagged with: calculator
accepted answer: http://stackoverflow.com/a/27160301
favorite count: 0
downvote count: 5
score: -3
has comment: http://stackoverflow.com/comment/42814213

http://stackoverflow.com/q/27204843
has answer: http://stackoverflow.com/a/27204864
type: UnansweredQuestion
tagged with: size
score: -1
tagged with: java
downvote count: 2
has body: Lets assume that there is a variable "x" of type int. If size() method of ArrayList returns a number which is too big to be stored in an int how will Java store it. Will there be upcasting of int to double or will there be some exception.
upvote count: 1
has comment: http://stackoverflow.com/comment/42892214
type: Question
tagged with: arraylist
answer count: 1
has title: If size() method of ArrayList returns a number which is too big to be stored in an int how will Java store it
has comment: http://stackoverflow.com/comment/42892367
favorite count: 0

http://stackoverflow.com/comment/43116272
comment on: http://stackoverflow.com/q/27259397
score: 0
type: QuestionComment
type: Comment
has text: Peter, I ended up using your solution, and implemented one of your suggestions, the named pipe. This was a handful for me at my experience level but I took my time and got everything working smoothly. Thanks very much for your comment!

http://stackoverflow.com/comment/43010872
has text: Thanks, would I need to set the path and java home back again afterwards?
comment on: http://stackoverflow.com/a/27270384
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/27238914
type: Answer
score: 2
upvote count: 2
has body: You can check only if particular header exist and if it's equal/not equal to a value. For example: @RequestMapping(value = "/hello", headers = "my-header=my-value", method = RequestMethod.POST) ... @RequestMapping(value = "/hello", headers = "my-header!=my-value", method = RequestMethod.POST) You can't unfortunately check any additional conditions. To find out more about the details look at HeadersRequestCondition class. The only option you have is to create custom RequestMappingHandlerMapping and change behavior how request is mapped to methods.
answers question: http://stackoverflow.com/q/27231292
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27231292

http://stackoverflow.com/comment/42995324
score: 0
comment on: http://stackoverflow.com/q/27254895
type: Comment
type: QuestionComment
has text: You can use the validateXxx() form to include multiple validation methods into one class... Dave pointed out the redirect limitation but if you insist on this separation you could chain...

http://stackoverflow.com/a/27291014
answers question: http://stackoverflow.com/q/27276302
score: 0
has comment: http://stackoverflow.com/comment/43107528
accepted answer of: http://stackoverflow.com/q/27276302
type: Answer
has body: I think this is a bug: the AnnotationActionEndpointMapping should also call shouldIntercept on its smart interceptor chain. Could you please create a JIRA for this here, possibly linking to this SO question? Or better yet, provide a pull request?
has comment: http://stackoverflow.com/comment/43057775
type: AcceptedAnswer

http://stackoverflow.com/comment/42900628
has text: First, don't use System.out to print info in Android. Use `Log.i("MyTag", "message")`, or other methods on the `Log` class. Second, there's not a really easy way to get your hands on a context in a static method. Generally, static methods take a Context as an argument, and if you're calling it from a Service or Activity, you just pass `this`.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27209358

http://stackoverflow.com/comment/43082845
type: Comment
comment on: http://stackoverflow.com/a/27291916
has text: I am curious Why a HttpServletRequest instance's value may be affected by other requests.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43077025
comment on: http://stackoverflow.com/q/27307342
type: Comment
type: QuestionComment
score: 0
has text: All of your methods are calling themselves, therefore creating an infinite loop - rethinking what you want these methods to return.

junit
tags question: http://stackoverflow.com/q/27222339
type: Tag
tags question: http://stackoverflow.com/q/27206929
tags question: http://stackoverflow.com/q/27255278
tags question: http://stackoverflow.com/q/27229725
tags question: http://stackoverflow.com/q/27247265
tags question: http://stackoverflow.com/q/27303054
tags question: http://stackoverflow.com/q/27249038
tags question: http://stackoverflow.com/q/27245737
tags question: http://stackoverflow.com/q/27245127
tags question: http://stackoverflow.com/q/27267041
tags question: http://stackoverflow.com/q/27280653
tags question: http://stackoverflow.com/q/27294345
tags question: http://stackoverflow.com/q/27174697
tags question: http://stackoverflow.com/q/27191151
tags question: http://stackoverflow.com/q/27289274
tags question: http://stackoverflow.com/q/27248795
tags question: http://stackoverflow.com/q/27223063
tags question: http://stackoverflow.com/q/27298420
tags question: http://stackoverflow.com/q/27281306
tags question: http://stackoverflow.com/q/27157146
tags question: http://stackoverflow.com/q/27292881
tag name: junit
tags question: http://stackoverflow.com/q/27213742
tags question: http://stackoverflow.com/q/27293488
tags question: http://stackoverflow.com/q/27311073
tags question: http://stackoverflow.com/q/27169721
tags question: http://stackoverflow.com/q/27256429
tags question: http://stackoverflow.com/q/27188520
tags question: http://stackoverflow.com/q/27225140
tags question: http://stackoverflow.com/q/27299618
tags question: http://stackoverflow.com/q/27210074
tags question: http://stackoverflow.com/q/27178848
tags question: http://stackoverflow.com/q/27205678
tags question: http://stackoverflow.com/q/27248618
tags question: http://stackoverflow.com/q/27218448
tags question: http://stackoverflow.com/q/27172370
tags question: http://stackoverflow.com/q/27279025
tags question: http://stackoverflow.com/q/27152836
tags question: http://stackoverflow.com/q/27255084
tags question: http://stackoverflow.com/q/27168769
tags question: http://stackoverflow.com/q/27311142
tags question: http://stackoverflow.com/q/27255487
tags question: http://stackoverflow.com/q/27283185
tags question: http://stackoverflow.com/q/27204766
tags question: http://stackoverflow.com/q/27260714

http://stackoverflow.com/comment/43362391
type: Comment
comment on: http://stackoverflow.com/q/27295160
score: 0
has text: I've opened an issue in JIRA. https://jira.spring.io/browse/SPR-12524
type: QuestionComment

http://stackoverflow.com/comment/42967412
type: Comment
has text: sorry, m not getting your logic..i think first we need to create xml file for every selected method.look we have add(),div(),sub() methods as output but I want to execute only add(),sub() methods..then what should be the next step ..from this jsp page where should I redirect the control..??
type: AnswerComment
comment on: http://stackoverflow.com/a/27246138
score: 0

http://stackoverflow.com/a/27304571
answers question: http://stackoverflow.com/q/27304510
score: 0
has comment: http://stackoverflow.com/comment/43072581
type: Answer
has body: PapersOrdered.put(roomNo, room.getPapers()); It appears that you are calling an instance method (put) on a class. Where is PapersOrdered defined? Is it a type or a field? It isn't declared in addPapers.

http://stackoverflow.com/comment/42946205
type: QuestionComment
has text: @CasimiretHippolyte: What if movie name itself contains 4 digits like `Death Race 2000`
comment on: http://stackoverflow.com/q/27234588
score: 0
type: Comment

http://stackoverflow.com/comment/43020962
comment on: http://stackoverflow.com/a/27265429
score: 0
type: AnswerComment
type: Comment
has text: If it was a NullPointerException the stacktrace would say NullPonterException. The fatal signal is related to something happening in the WebView. It may have something to do with the state of the webview when calling a certain function. For example see my question (http://stackoverflow.com/questions/18755318/webview-destroy-causing-fatal-signal-11-crash). I had a fatal signal when calling `WebStorage.getInstance().deleteAllData()` after destroying all WebViews. My guess is this guy has a similar issue.

build
tags question: http://stackoverflow.com/q/27197005
tags question: http://stackoverflow.com/q/27186737
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/27261354
tags question: http://stackoverflow.com/q/27311914

http://stackoverflow.com/q/27196656
has body: How to do a basic mathematical operation with Pig Latin? I entered the Grunt shell and tried for example dump 1+2;, but got 2014-11-28 23:23:48,011 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2997: Encountered IOException. No previously defined alias found. Please define an alias and use 'dump' operator. Update Doing A = 1 + 2 DUMP A I get: grunt&gt; A = 1 + 2 DUMP A &gt;&gt; [ENTER] &gt;&gt; [ENTER] ...
has title: Basic mathematical operation
possible better answer: http://stackoverflow.com/a/27197423
tagged with: java
tagged with: hadoop
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27197945
favorite count: 0
type: Question
score: 1
tagged with: apache-pig
accepted answer: http://stackoverflow.com/a/27197945
has answer: http://stackoverflow.com/a/27197423
answer count: 2
upvote count: 1

http://stackoverflow.com/q/27226413
tagged with: alfresco-share
has body: I've a problem with the visualization of MS Word tables in my Alfresco Share. The tables are always showing outside of the margin, I think it's a problem with OpenOffice (default suite in Alfresco Share). Please find attached a picture with the error and my source code: int nCols = 4; XWPFTable table = doc.createTable(numeroPropuestas+1, nCols); // se le suma uno para añadr la cabecera // Set the table style. If the style is not defined, the table style // will become "Normal". CTTblPr tblPr = table.getCTTbl().getTblPr(); CTTblWidth width = table.getCTTbl().addNewTblPr().addNewTblW(); width.setType(STTblWidth.DXA); width.setW(BigInteger.valueOf(9072)); CTString styleStr = tblPr.addNewTblStyle(); styleStr.setVal("StyledTable"); // Get a list of the rows in the table List&lt;XWPFTableRow&gt; rows = table.getRows(); int rowCt = 0; int colCt = 0; int filasArrays = 0; for (XWPFTableRow row : rows) { // ArrayList&lt;String&gt; alFila = new ArrayList&lt;String&gt;(); if (rowCt != 0){ alFila.add(lDescripcion.get(filasArrays)); alFila.add(lTipo.get(filasArrays)); alFila.add(lClasificacion.get(filasArrays)); alFila.add(lResponsable.get(filasArrays)); filasArrays ++; } // get table row properties (trPr) CTTrPr trPr = row.getCtRow().addNewTrPr(); // set row height; units = twentieth of a point, 360 = 0.25" CTHeight ht = trPr.addNewTrHeight(); ht.setVal(BigInteger.valueOf(360)); // get the cells in this row List&lt;XWPFTableCell&gt; cells = row.getTableCells(); // add content to each cell for (XWPFTableCell cell : cells) { // get a table cell properties element (tcPr) CTTcPr tcpr = cell.getCTTc().addNewTcPr(); // set vertical alignment to "center" CTVerticalJc va = tcpr.addNewVAlign(); va.setVal(STVerticalJc.CENTER); // create cell color element CTShd ctshd = tcpr.addNewShd(); ctshd.setColor("auto"); ctshd.setVal(STShd.CLEAR); if (rowCt == 0) { // header row ctshd.setFill("A7BFDE"); } else if (rowCt % 2 == 0) { // even row ctshd.setFill("D3DFEE"); } else { // odd row ctshd.setFi…
tagged with: alfresco
has comment: http://stackoverflow.com/comment/43044292
has comment: http://stackoverflow.com/comment/42949406
downvote count: 0
has title: POI previsualization error with table
has comment: http://stackoverflow.com/comment/42964768
favorite count: 0
has comment: http://stackoverflow.com/comment/42969943
has comment: http://stackoverflow.com/comment/42942335
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42964757
tagged with: apache-poi
answer count: 0
upvote count: 3
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/27278892
tagged with: jmx
tagged with: log4j2
tagged with: logging
tagged with: java
has body: I need to change programatically log level in log4j2 in my application. I know that there are several options for this: Relying on core log4j classes Using JConsole Are there any solution to change log level without relying on core classes? JConsole is also isn't an option as I need to change it directly from my application.
type: Question
answer count: 1
has title: How to change programatically log level in log4j2
has answer: http://stackoverflow.com/a/27283814
tagged with: log4j
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42843777
score: 0
comment on: http://stackoverflow.com/q/27172136
has text: Are you sure that your data isn't in Sheet 1 or Sheet 2?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42915424
type: AnswerComment
comment on: http://stackoverflow.com/a/27205982
score: 0
type: Comment
has text: AudioFormat.Encoding is basically an enum of the formats javax.sound.sampled supports. If you convert the file with an audio editor, you can choose any of those formats. If you don't know what A-law, u-law, PCM, etc is, you should Google it because there are Wikipedia articles and such. ; ) PCM is the simplest format. A very standard format is 16-bit PCM with a sample rate of 44,100Hz.

http://stackoverflow.com/comment/42978218
type: Comment
has text: yes it works fine on windows but my question is if it's built to run on linux then is there any tool or procedure to run that application on windows without changing the file paths it's accessing?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27243966

http://stackoverflow.com/a/27160519
answers question: http://stackoverflow.com/q/27160323
upvote count: 3
score: 3
has body: Try using mxGraphComponent.setConnectable(false), it should disable connection handler in the graph component.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27160323
type: Answer

http://stackoverflow.com/comment/42831829
type: AnswerComment
comment on: http://stackoverflow.com/a/27170268
type: Comment
score: 0
has text: Ok, this is what I'm gonna do. Thank you :)

http://stackoverflow.com/q/27241713
type: Question
has answer: http://stackoverflow.com/a/27241768
tagged with: arraylist
score: 0
answer count: 2
tagged with: text-files
has title: Outputing duplicate values in 2 arraylists
has answer: http://stackoverflow.com/a/27241831
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42959836
has body: Hey guys I'm kind of at a cross roads here, I have two different arrayLists of different lengths and different values. I'm trying to find any common values between the two and output those to an output text file name "output.txt". I know both of the arraylist are filled with values from other textfiles, but the code I have right not with just generating an empty output textfile and I can't figure out why the program isn't outputing the duplicate values into the textfile "output.txt" Heres the code I'm using right now: public static void duplciates(){ //compares the two arrayLists dictionary and phoneWords and adds the duplicates to the duplicates arraylist for(String term: dictionary){ if(phoneWords.contains(term)){ duplicates.add(term); } } } public static void openOutputFile (){ try{ writer = new FileWriter("E:\\output.txt"); } catch(Exception e){ System.out.println("you have an error"); } } public static void writeArrayToFile(){ for(String str: duplicates){ try { writer.write(str); } catch (IOException e) { e.printStackTrace(); } } } If you guys have any ideas about what is wrong let me know, o if you have any better ideas on how to compare the two arraylists for the duplicate values let me know!
tagged with: java

http://stackoverflow.com/comment/42851537
has text: Its indeed <friend> , I lost the output so wrote it manually. Sorry about that. I mentioned Maven just because earlier I was getting some MessageWriter error and some threads suggested to add some dependencies in maven. For messagewriter error I imported few jackson jars. I'll edit the question to list the jars.
comment on: http://stackoverflow.com/q/27181507
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42851371
type: Comment
has text: I think this is what you are looking for: http://stackoverflow.com/questions/5820287/android-textview-has-height-and-width-of-0
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27181268

http://stackoverflow.com/q/27190103
has answer: http://stackoverflow.com/a/27190416
has comment: http://stackoverflow.com/comment/42972330
has answer: http://stackoverflow.com/a/27265356
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42920076
has comment: http://stackoverflow.com/comment/42937712
type: UnansweredQuestion
tagged with: spring
has body: I use hibernate 4, spring 4, and I want to use @Transaction annotation, but it doesn't work. The user object still saved on sqlServer. Any idea what I'm doing wrong? [applicationContext.xml] <tx:annotation-driven transaction-manager="transactionManager" /> <context:component-scan base-package="SpringDAO"/> <context:component-scan base-package="SpringTest"/> <context:component-scan base-package="service"/> hibernate.cfg.xml org.hibernate.dialect.MySQL5Dialect true false true com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc:sqlserver://127.0.0.1:1433;databaseName=test XXX XXX [hibernate.cfg.xml] <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> <mapping class="SpringDAO.User" /> </hibernate-configuration> package SpringDAO; @Repository("UserDAO3") public class UserDAO3 { SessionFactory sessionFactory; @Autowired public void setSessionFactory(SessionFactory value){ this.sessionFactory = value; } public SessionFactory getSessionFactory(){ return this.sessionFactory; } @Transactional(readOnly = true) public boolean insert(Object user){ Session sess = this.sessionFactory.getCurrentSession(); sess.save(user); return true; } } package service; @Service("UserService") public class UserService { public boolean addAction(User user){ boolean result = true; UserDAO3 dao = (UserDAO3)SpringUtil.getBean("UserDAO3"); List<User> users = dao.searchAllUser(); for(User selectedUser : users){ if(selectedUser.getName().equals(user.getName())){ result = false; break; } } result = dao.insert(user); return result; } }
has comment: http://stackoverflow.com/comment/42874607
has answer: http://stackoverflow.com/a/27265901
tagged with: java
has title: Spring 4 hibernate 4 @Transactional(read-only="true") does not work
has comment: http://stackoverflow.com/comment/42969707
type: Question

http://stackoverflow.com/q/27261510
has comment: http://stackoverflow.com/comment/42996270
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/42996051
tagged with: arrays
has body: just a little question regarding efficiency using arrays. For example, I have JButton btn_mode[] = new JButton[2]; Would it make sense to set the Buttontext with an String array rather then putting the text in "by hand"? Like: String btnText[] = {"Mode 1", "Mode 2"}; for(int i = 0; i &lt;= 1; i++) { btn_mode[i] = new JButton(btnText[i]); } Or is it - in these few amounts - better to simply go with: btn_mode[0] = new JButton("Mode 1"); btn_mode[1] = new JButton("Mode 2"); Thanks in advance!
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42996076
has answer: http://stackoverflow.com/a/27261546
has title: Optimized array efficiency
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42996008
tagged with: java
accepted answer: http://stackoverflow.com/a/27261546

http://stackoverflow.com/q/27157196
favorite count: 0
has body: This mine sweeper game is the conventional game however the person starts with three lives and can get three more if he can find the shield. Also an immortality can also be found which is very rare and gives the user infinite amount of lives. So the problem is that when I reset the game and for example click on a a bomb then I lose more than one life. However at the beginning everything works perfectly. This problem is not only for that but for mostly everything. So here is the code : if (e.getSource() == btnReset) { // miss = 0; // System.out.println(miss); getMines(); lives = 3; System.out.println(" lives = " +lives); for (int x = 0; x &lt; BOARD_HEIGHT; x++) { for (int y = 0; y &lt; BOARD_WIDTH; y++) { btn[x][y].addActionListener(this); btn[x][y].setBackground(null); } } } }
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42808761
upvote count: 0
tagged with: java
type: Question
has title: MineSweeper Game
tagged with: actionlistener
has answer: http://stackoverflow.com/a/27157863
downvote count: 3
has comment: http://stackoverflow.com/comment/42810144
answer count: 1
tagged with: user-interface

http://stackoverflow.com/q/27270471
has body: i have this code in file Abc.java and want to run it from another Java program. I tried but it is not taking user input. public class Abc public static void main(String args[]) { Scanner scan = new Scanner(System.in); int s; System.out.println("Enter a value.."); s = scan.nextInt(); System.out.println(" "+s); } } which approach I can use to accomplish my task?
has comment: http://stackoverflow.com/comment/43010928
has title: How to run java code from another java program?
tagged with: class
tagged with: calling-convention
score: 0
has answer: http://stackoverflow.com/a/27270546
possible better answer: http://stackoverflow.com/a/27270554
favorite count: 0
has answer: http://stackoverflow.com/a/27270554
tagged with: input
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43010974
accepted answer: http://stackoverflow.com/a/27270546
tagged with: java
upvote count: 1
downvote count: 1
type: Question
answer count: 2

http://stackoverflow.com/comment/43002106
score: 0
type: AnswerComment
has text: But when you update your google play service every time you have to change your version number so the best way to use like this:<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
type: Comment
comment on: http://stackoverflow.com/a/27265176

http://stackoverflow.com/comment/43011408
comment on: http://stackoverflow.com/q/27269719
score: 0
type: Comment
type: QuestionComment
has text: sorry are you sure that question in present form can be answerable here, everything depends of your code, for better help sooner post an SSCCE/MCVE, short, runnable, compilable, with hardcoded value in local variables

http://stackoverflow.com/comment/42844986
score: 0
type: Comment
has text: No, in the code you just gave me, you have `android:onClick="gotoPathFinder` - that's wrong. Change it to `android:onClick="gotoSecond`. Read my answer!
type: AnswerComment
comment on: http://stackoverflow.com/a/27178091

http://stackoverflow.com/comment/42823286
has text: In the for loop to create two list and return.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27164881
score: 0

http://stackoverflow.com/comment/42985673
type: QuestionComment
has text: Ok. "you should be safe" of course depends on what you mean by safe I guess. Just by avoiding to leak `this` from the constructor doesn't imply that you don't have data races.
score: 0
comment on: http://stackoverflow.com/q/27254152
type: Comment

http://stackoverflow.com/comment/43085745
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27312350
type: QuestionComment
has text: that ile is a class the process a file and parse the data line by line and then parse values from each line.

http://stackoverflow.com/a/27207465
has body: When I have that kind of issues (casting a plain class to a parameterized one?) I use double casting, in order to bypass the compiler complain. So in your case I guess you could write (Class&lt;PrintablePredicate&lt;Miner&gt;&gt;)(Class&lt;?&gt;) PrintablePredicate.class when passing the PrintablePredicate.class parameter to the bindContentBidirectional function. Edit: I found out that simply casting PrintablePredicate.class to Class (I don't undestand why though, it seems kinda unnecessary on my opinion since *.class are already of type Class) or assigning it to a variable before passing it to the method works for this case (using javac 1.8.0_25). Therefor maybe you should just use this instead of the code above: (Class)PrintablePredicate.class So your error might be due to a compiler bug similar to this one from OpenJDK (yeah, which doesn't make sense because it's a bug): https://bugs.openjdk.java.net/browse/JDK-8028682 As a summary then after my findings, this "double casting" trick stuff (or just assigning an object to a variable) can help you "make it easier" for the compiler to "understand" your code when it has a bug such as this one seems (lol, it's kind of funny having to do that I guess, but it just shows you that sometimes you cannot even trust the compiler).
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42898195
has comment: http://stackoverflow.com/comment/42897603
has comment: http://stackoverflow.com/comment/42900198
accepted answer of: http://stackoverflow.com/q/27206953
answers question: http://stackoverflow.com/q/27206953
has comment: http://stackoverflow.com/comment/42897881
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42898357
type: Answer

http://stackoverflow.com/comment/42891532
score: 0
has text: A shrug report - `but the program is not working`???? http://foldoc.org/shrug+report
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27204455

http://stackoverflow.com/a/27196049
accepted answer of: http://stackoverflow.com/q/27196018
upvote count: 1
has body: Yes, exactly. It's essentially the same (from the result standpoint) as providing default values of arguments in C++.
type: Answer
answers question: http://stackoverflow.com/q/27196018
has comment: http://stackoverflow.com/comment/42877166
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42877656
has comment: http://stackoverflow.com/comment/42877373
type: AcceptedAnswer

http://stackoverflow.com/comment/121215896
type: Comment
has text: `Object c =` & explicit/implicit is what was missing in my answer. Upvote
type: AnswerComment
comment on: http://stackoverflow.com/a/27166931
score: 0

server
tags question: http://stackoverflow.com/q/27232920
tags question: http://stackoverflow.com/q/27286638
type: Tag
tags question: http://stackoverflow.com/q/27160335
tags question: http://stackoverflow.com/q/27234732
tags question: http://stackoverflow.com/q/27304494
tags question: http://stackoverflow.com/q/27231700
tag name: server
tags question: http://stackoverflow.com/q/27251567
tags question: http://stackoverflow.com/q/27232940
tags question: http://stackoverflow.com/q/27235197
tags question: http://stackoverflow.com/q/27233739

http://stackoverflow.com/q/27247475
has answer: http://stackoverflow.com/a/27247903
tagged with: java
has body: I got a spring + hibernate project that uses spring security for authentication and everything works like a charm. i have the spring-security.xml below : &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="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 http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; &lt;!-- enable use-expressions --&gt; &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/home" access="isAuthenticated()" /&gt; &lt;intercept-url pattern="/home/**" access="isAuthenticated()" /&gt; &lt;form-login login-page="/" authentication-failure-url="/?error" username-parameter="username" password-parameter="password" default-target-url="/home" /&gt; &lt;!-- access denied page --&gt; &lt;access-denied-handler error-page="/403" /&gt; &lt;!-- logout handling --&gt; &lt;logout invalidate-session="true" logout-success-url="/?logout" delete-cookies="JSESSIONID,SPRING_SECURITY_REMEMBER_ME_COOKIE" /&gt; &lt;!-- enable csrf protection &lt;csrf /&gt; --&gt; &lt;remember-me services-ref="rememberMeServices" key="clarkerpi" /&gt; &lt;/http&gt; &lt;beans:bean id="rememberMeServices" class="org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices"&gt; &lt;beans:property name="tokenRepository" ref="customTokenRepository" /&gt; &lt;beans:property name="userDetailsService" ref="userDetailsService" /&gt; &lt;beans:property name="key" value="clarkerpi" /&gt; &lt;/beans:bean&gt; &lt;authentication-manager alias="authenticationManager"&gt; &lt;authentication-provider ref="authenticationProvider" /&gt; &lt;/authentication-manager&gt; &lt;beans:bean id="authenticationProvider" class="org.springframework.security.authentication.dao.Da…
type: Question
answer count: 2
upvote count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27249399
has title: Spring Security + Remember me support + auto redirect
tagged with: cookies
score: 1

http://stackoverflow.com/q/27238689
score: 0
tagged with: java
tagged with: null
has comment: http://stackoverflow.com/comment/42954164
has body: I'm trying to write a method that uses a board and check to see if at any given point on the board, a swap between one point to right or below, causes a "match" to occur on the board. The points that cause the swap are then added to a Point[] and returned. My array returns, but it only returns, [null],[null],[null]. Why is it not returning points? Thanks public static Point[] findPossibleSwaps(Board b) { Point[] swaps = new Point[3]; int x = 0; int y = 0; Point normal = new Point (x,y); Point hor = new Point (x+1, y); Point ver = new Point (x, y+1); int count = 0; for(y = 0; y &lt; b.getSize()-1; y++) { for(x = 0; x &lt; b.getSize()-1; x++) { b.swapSquares(normal,hor); if (b.hasMatches() &amp;&amp; (x)!=b.getSize()-1) { swaps[count] = new Point(x+1,y); count++; } b.swapSquares(hor, normal); b.swapSquares(normal, ver); if (b.hasMatches() &amp;&amp; y!=b.getSize()-1) { swaps[count] = new Point(x,y+1); count++; } b.swapSquares(ver, normal); } } return swaps; }
has comment: http://stackoverflow.com/comment/42954022
type: UnansweredQuestion
tagged with: point
answer count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42954071
tagged with: return
type: Question
has title: Why is my Point array only returning null in Java?
has comment: http://stackoverflow.com/comment/42954843
has comment: http://stackoverflow.com/comment/42954238

http://stackoverflow.com/comment/42810026
type: QuestionComment
has text: @Pav And have you tried to add that other pattern?
comment on: http://stackoverflow.com/q/27157909
score: 0
type: Comment

http://stackoverflow.com/q/27200001
type: Question
tagged with: java
tagged with: date
tagged with: struts2
score: 0
answer count: 2
has body: When i selecting the date format from date picker it showing in "dd/MM/yyyy" format. Passing the date into java class it become "MM/dd/yyyy". Due to this reason i can't pass the day above 12 ,it showing input error. Example: 11/08/2014 in jsp the same date showing in java class is Sat Nov 08 00:00:00 IST 2014
has comment: http://stackoverflow.com/comment/42892797
tagged with: datepicker
linked to: http://stackoverflow.com/q/20640911
has answer: http://stackoverflow.com/a/27200026
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27224716
has title: Date change issue in struts2

android
tags question: http://stackoverflow.com/q/27300916
tags question: http://stackoverflow.com/q/27217526
tags question: http://stackoverflow.com/q/27283663
tags question: http://stackoverflow.com/q/27153981
tags question: http://stackoverflow.com/q/27193641
tags question: http://stackoverflow.com/q/27268645
tags question: http://stackoverflow.com/q/27293034
tags question: http://stackoverflow.com/q/27217280
tags question: http://stackoverflow.com/q/27206963
tags question: http://stackoverflow.com/q/27233739
tags question: http://stackoverflow.com/q/27273064
tags question: http://stackoverflow.com/q/27308541
tags question: http://stackoverflow.com/q/27268840
tags question: http://stackoverflow.com/q/27166288
tags question: http://stackoverflow.com/q/27274908
tags question: http://stackoverflow.com/q/27181432
tags question: http://stackoverflow.com/q/27245305
tags question: http://stackoverflow.com/q/27305964
tags question: http://stackoverflow.com/q/27234851
tags question: http://stackoverflow.com/q/27231584
tags question: http://stackoverflow.com/q/27200649
tags question: http://stackoverflow.com/q/27157124
tags question: http://stackoverflow.com/q/27310097
tags question: http://stackoverflow.com/q/27258103
tags question: http://stackoverflow.com/q/27216096
tags question: http://stackoverflow.com/q/27274855
tags question: http://stackoverflow.com/q/27281151
tags question: http://stackoverflow.com/q/27273490
tags question: http://stackoverflow.com/q/27312604
tags question: http://stackoverflow.com/q/27217225
tags question: http://stackoverflow.com/q/27221779
tags question: http://stackoverflow.com/q/27201203
tags question: http://stackoverflow.com/q/27237257
tags question: http://stackoverflow.com/q/27242671
tags question: http://stackoverflow.com/q/27253885
tags question: http://stackoverflow.com/q/27155567
tags question: http://stackoverflow.com/q/27164379
tags question: http://stackoverflow.com/q/27155187
tags question: http://stackoverflow.com/q/27289245
tags question: http://stackoverflow.com/q/27281396
tags question: http://stackoverflow.com/q/27184247
tags question: http://stackoverflow.com/q/27249230
tags question: http://stackoverflow.com/q/27170428
tags question: http://stackoverflow.com/q/27185080
tags question: http://stackoverflow.com/q/27309095
tags question: http://stackoverflow.com/q/27257003
tags question: http://stackoverflow.com/q/27263603
tags question: http://stackoverflow.com/q/27192790
tags question: http://stackoverflow.com/q/27306968
tags question: http://stackoverflow.com/q/27199035
tags question: http://stackoverflow.com/q/27297511
tags question: http://stackoverflow.com/q/27243036
tags question: http://stackoverflow.com/q/27245601
tags question: http://stackoverflow.com/q/27228514
tags question: http://stackoverflow.com/q/27181008
tags question: http://stackoverflow.com/q/27230625
tags question: http://stackoverflow.com/q/27186698
tags question: http://stackoverflow.com/q/27298984
tags question: http://stackoverflow.com/q/27242049
tags question: http://stackoverflow.com/q/27178292
tags question: http://stackoverflow.com/q/27265522
tags question: http://stackoverflow.com/q/27283084
tags question: http://stackoverflow.com/q/27231624
tags question: http://stackoverflow.com/q/27216660
tags question: http://stackoverflow.com/q/27272404
tags question: http://stackoverflow.com/q/27167073
tags question: http://stackoverflow.com/q/27207558
tags question: http://stackoverflow.com/q/27199135
tags question: http://stackoverflow.com/q/27261370
tags question: http://stackoverflow.com/q/27296843
tags question: http://stackoverflow.com/q/27277092
tags question: http://stackoverflow.com/q/27287041
tags question: http://stackoverflow.com/q/27204250
tags question: http://stackoverflow.com/q/27163845
tags question: http://stackoverflow.com/q/27295291
tags question: http://stackoverflow.com/q/27171708
tags question: http://stackoverflow.com/q/27270993
tags question: http://stackoverflow.com/q/27215433
tags question: http://stackoverflow.com/q/27181119
tags question: http://stackoverflow.com/q/27178550

http://stackoverflow.com/q/27306142
has body: Im writing a program in java that is suppose to receive a phone number as a string, (ex. 1800helpmee) from the user and print out its corresponding numbers. 1800 435 7633 should be the answer. this is the code i have so far. I've loaded the number into the array. I am having an issue with the next part. my array is called inputNumber. I tried something like this but it doesn't seem to be working for (int j = 0; j&lt;9; j ++) { if ( inputNumber[j] =='A' || inputNumber[j] == 'B' || inputNumber[j] =='C'){ System.out.println("2"); } etc.
has comment: http://stackoverflow.com/comment/43075318
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43075059
has comment: http://stackoverflow.com/comment/43075019
has comment: http://stackoverflow.com/comment/43075336
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27306431
type: Question
has comment: http://stackoverflow.com/comment/43075165
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/43074963
downvote count: 1
has answer: http://stackoverflow.com/a/27306577
has title: change a phone number as a string into all numbers
has comment: http://stackoverflow.com/comment/43075027
has comment: http://stackoverflow.com/comment/43075281
favorite count: 0
has comment: http://stackoverflow.com/comment/43075144

http://stackoverflow.com/q/27302374
linked to: http://stackoverflow.com/q/7234795
tagged with: eclipse-luna
type: UnansweredQuestion
has body: So I've been using Eclipse on my mac for the past 4 months with no problems but suddenly things are acting up. Before, Eclipse would show me a red dot on the lefthand scroll bar when I was working on a class in a project. Now, for some reason, all it does is grey-out that line number but it does not show me that dot like it used to. I've tried restarting both Eclipse and my computer, I've tried working on different projects and classes, I've made sure a project builder is selected, and I've checked that the "show errors" options are all checked. I do not like having to have another window open to see exactly where all my errors are; I preferred just having the red section on my class screen. Any other suggestions? Thanks everyone!
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse Not Showing Errors on Lefthand Side
has comment: http://stackoverflow.com/comment/43068045
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27302440

http://stackoverflow.com/q/27233869
type: UnansweredQuestion
tagged with: sockets
tagged with: http
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27234498
has title: When I run the client first time it server shows the output... second time when I run client, server doesn't does not show output
score: 0
has body: Client side code is try { URL url=new URL("http://127.0.0.1:7655"); HttpURLConnection connection=(HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.connect(); PrintWriter writer = new PrintWriter(connection.getOutputStream()); writer.println("Hello"); writer.flush(); writer.close(); connection.getResponseCode(); connection.disconnect(); } catch (UnknownHostException e) { System.err.println("Don't know about host: hostname"); } catch (IOException e) { System.err.println("Couldn't get I/O for the connection to: hostname"); } Server Side code is public static void main(String args[]) throws IOException { ServerSocket echoServer = null; String line; DataInputStream is = null; Socket clientSocket = null; try { echoServer = new ServerSocket(7655); clientSocket = echoServer.accept(); while (true) { is = new DataInputStream(clientSocket.getInputStream()); System.out.println("inside"); line = is.readLine(); System.out.println(line); } }catch (IOException e) { System.out.println(e); }finally{ is.close(); clientSocket.close(); } } When I run the client first time it server shows the output... second time when I run client, server doesn't show output. Is there some mistake in the code? If I am not givng "Connection.getResponseCode" in the end server side receives null and shows null on console. Why is this necessary?
answer count: 1

http://stackoverflow.com/a/27185912
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27185807
downvote count: 0
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/42861640
has body: input type date means it will open numeric virtual keyboard on the screen when the user tap the textview. To parse it to your required format, you have to use JAVA date time class.
accepted answer of: http://stackoverflow.com/q/27185807

http://stackoverflow.com/comment/43072425
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27304050
has text: I actually asked the Heroku people (and they responded almost immediately, which I was surprised about) - turns out that it only works if you put the Java one *first*. -_- No idea why. This is a great idea though (and confirmed it works). Thanks!
score: 0

http://stackoverflow.com/q/27221882
has title: How to select an 'outer' HTML element with a certain tag within it in JSOUP?
score: 0
has answer: http://stackoverflow.com/a/27222599
answer count: 1
tagged with: jsoup
tagged with: css-selectors
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27222599
tagged with: parsing
type: Question
tagged with: http://stackoverflow.com/tag/html
has body: So, say I have this HTML block here: (this is Java JSOUP BTW) Creamy Broccoli Cheddar Soup Right now I have a list of elements (as Elements type) and I want to select the elements, but only ones that have an attribute as "Vegetarian" in the alt="" part of the img tag within it. Right now I can select based on if it's Vegetarian for example by doing meals.select("img[alt=vegetarian]") but this only returns the actual img tags as elements, thus losing the name of the object (which is Creamy Broccoli Cheddar Soup in the above example) How do I select the div part of the element but still make sure the img tag within has a certain attribute? Thanks
tagged with: java

http://stackoverflow.com/q/27286846
has comment: http://stackoverflow.com/comment/43040973
upvote count: 0
has title: Build as single jar with dependencies
answer count: 1
tagged with: executable-jar
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/43040890
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43079169
linked to: http://stackoverflow.com/q/4498047
has comment: http://stackoverflow.com/comment/43041395
has comment: http://stackoverflow.com/comment/43041285
tagged with: netbeans
tagged with: java
has body: I am using netbeans IDE 7.4. I want to make a jar file with all my dependencies and other image folders along with the jar. How to make a single workable jar file in netbeans or in command tool. Thanks
has comment: http://stackoverflow.com/comment/43075532
downvote count: 1
has comment: http://stackoverflow.com/comment/43041279
type: Question
has comment: http://stackoverflow.com/comment/43078666
has answer: http://stackoverflow.com/a/27287094
has comment: http://stackoverflow.com/comment/43040962
score: -1
has comment: http://stackoverflow.com/comment/43040859

http://stackoverflow.com/comment/42843374
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27174364
has text: Thanks greg! Where can I define an object at the application level considering that i'm using the e4 schema? LifeCycle would aim to that purpose?
type: AnswerComment

http://stackoverflow.com/a/27271096
has body: (?&lt;!\\s|^)pet Try this.See demo.Replace by empty string. http://regex101.com/r/gJ4uX1/1
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27271065

http://stackoverflow.com/comment/43002369
has text: Can you post logic of calling writeResult() method. Probably you are doing mistake during the method call (writeResult()).
comment on: http://stackoverflow.com/q/27265351
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43077783
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27306007
type: Comment
has text: I have answered a similar question before, which only use stack. Dunno if it helps: http://stackoverflow.com/a/22187419/395202

http://stackoverflow.com/q/27243043
score: 0
tagged with: java
tagged with: keylistener
has title: KeyEvent working with Java 1.7 but not with 1.6
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42962345
has comment: http://stackoverflow.com/comment/42962001
has comment: http://stackoverflow.com/comment/42962420
has comment: http://stackoverflow.com/comment/42962287
has comment: http://stackoverflow.com/comment/42962304
has comment: http://stackoverflow.com/comment/42962161
type: Question
tagged with: swing
has body: We have developed a plugin project which is developed on Java 1.7(in eclipse) and build on java 1.6(build tool is on Java 1.6, it will we upgraded to Java 1.7 soon). We are using key listener in our code which is running fine when core application is running on Java 1.7 but not when core application is running on Java 1.6(Current production environment is running on Java 1.6 which will further migrated to java 1.7). Any idea, what we can do for this issue? txtInput.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { setAdjusting(cbInput, true); keyEvent = false; if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN ) { selectionAllowed = true; e.setSource(cbInput); cbInput.dispatchEvent(e); keyEvent = true; if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP ) { if(cbInput.getSelectedItem() != null ) { txtInput.setText(cbInput.getSelectedItem().toString()); } } if (e.getKeyCode() == KeyEvent.VK_ENTER) { cbInput.setPopupVisible(false); if(txtInput.getText() != null ) { try { BFMDateTime end_date; BRMap map = new BRMap(); map.putElem("content", txtInput.getText().trim()); map.putElem("action", "ButtonClicked"); map.putElem("start_date", timeZone.bfmDateToSearchFormat(new BFMDateTime(uiObj.fromDate.getText().toString()))); end_date = new BFMDateTime(uiObj.toDate.getText().toString()); end_date.addHours(23); end_date.addMinutes(59); end_date.addSeconds(59); map.putElem("end_date", timeZone.bfmDateToSearchFormat(end_date)); CommandMsg commandMsg = new CommandMsg(AppConstants.DEALER_SEARCH_COMMAND, map); RequestHandler requestHandler = new RequestHandler(); requestHandler.handleRequest(commandMsg,AppConstants.RESPONSE_SOURCE,uiObj); } catch (NumberFormatException e1) { e1.printStackTrace(); } catch (BFMTimeException e1) { e1.printStackTrace(); } } } } if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { cbInput.setPopupVisible(false); } setAdjusting(cbInput, false); } })…
has comment: http://stackoverflow.com/comment/42964391

http://stackoverflow.com/a/27308906
answers question: http://stackoverflow.com/q/27308891
score: 0
type: Answer
has body: The Integer class has an intValue() method on it. Check the javadocs - they are your friend: http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#intValue%28%29

http://stackoverflow.com/a/27217247
has body: use variables for paint distance between lines and only one for import javax.swing.JPanel; public class MainClass extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); //variable of the begin of point int pointIni=0; //variable for the distance between lines int distance=20; //variable for the space between lines int cntLines=20; for (int i = 0; i &lt; cntLines; i++) { g.drawLine(0, 0, pointIni, getHeight()-pointIni); pointIni=pointIni+distance; } } public static void main(String[] args) { JFrame myFrame = new JFrame(); MainClass panel = new MainClass(); myFrame.add(panel); myFrame.setSize(400, 400); myFrame.setLocation(100, 100); myFrame.setVisible(true); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/27217003
has comment: http://stackoverflow.com/comment/42914553
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27217003

gwt
tags question: http://stackoverflow.com/q/27250980
tags question: http://stackoverflow.com/q/27180309
tags question: http://stackoverflow.com/q/27289398
tag name: gwt
tags question: http://stackoverflow.com/q/27269249
tags question: http://stackoverflow.com/q/27226583
tags question: http://stackoverflow.com/q/27277085
tags question: http://stackoverflow.com/q/27199288
type: Tag
tags question: http://stackoverflow.com/q/27253314
tags question: http://stackoverflow.com/q/27226082
tags question: http://stackoverflow.com/q/27153642
tags question: http://stackoverflow.com/q/27286492
tags question: http://stackoverflow.com/q/27249260
tags question: http://stackoverflow.com/q/27197196
tags question: http://stackoverflow.com/q/27188516
tags question: http://stackoverflow.com/q/27153109
tags question: http://stackoverflow.com/q/27211191
tags question: http://stackoverflow.com/q/27275468
tags question: http://stackoverflow.com/q/27286527
tags question: http://stackoverflow.com/q/27161106
tags question: http://stackoverflow.com/q/27195749
tags question: http://stackoverflow.com/q/27182816
tags question: http://stackoverflow.com/q/27241328
tags question: http://stackoverflow.com/q/27215999
tags question: http://stackoverflow.com/q/27287348
tags question: http://stackoverflow.com/q/27224052
tags question: http://stackoverflow.com/q/27267224
tags question: http://stackoverflow.com/q/27307655
tags question: http://stackoverflow.com/q/27244119
tags question: http://stackoverflow.com/q/27273173
tags question: http://stackoverflow.com/q/27289242
tags question: http://stackoverflow.com/q/27175022
tags question: http://stackoverflow.com/q/27157852
tags question: http://stackoverflow.com/q/27255746
tags question: http://stackoverflow.com/q/27286420

http://stackoverflow.com/comment/42968248
comment on: http://stackoverflow.com/a/27246185
type: Comment
has text: I don't agree with you. I want to understand the code of others - and that also includes understanding their private methods. Adding a `main()`-method seems to be the easiest way. If I want to understand a brake, I also want to look at the brakeshoe and not only test if the car stops,...
score: 0
type: AnswerComment

recursion
type: Tag
tags question: http://stackoverflow.com/q/27218229
tags question: http://stackoverflow.com/q/27256770
tags question: http://stackoverflow.com/q/27243102
tag name: recursion
tags question: http://stackoverflow.com/q/27256845
tags question: http://stackoverflow.com/q/27216743
tags question: http://stackoverflow.com/q/27307875
tags question: http://stackoverflow.com/q/27302277
tags question: http://stackoverflow.com/q/27266631
tags question: http://stackoverflow.com/q/27229579
tags question: http://stackoverflow.com/q/27155180
tags question: http://stackoverflow.com/q/27256118
tags question: http://stackoverflow.com/q/27159938
tags question: http://stackoverflow.com/q/27284475
tags question: http://stackoverflow.com/q/27263627
tags question: http://stackoverflow.com/q/27309750
tags question: http://stackoverflow.com/q/27232457
tags question: http://stackoverflow.com/q/27195883
tags question: http://stackoverflow.com/q/27165564
tags question: http://stackoverflow.com/q/27188506
tags question: http://stackoverflow.com/q/27187849
tags question: http://stackoverflow.com/q/27280482

http://stackoverflow.com/comment/43072235
comment on: http://stackoverflow.com/q/27304471
type: Comment
type: QuestionComment
score: 0
has text: I think we need more context here. Provide more context, more code to replicate your problem and we will help you on how to solve it

http://stackoverflow.com/a/27211815
accepted answer of: http://stackoverflow.com/q/27211465
type: Answer
has comment: http://stackoverflow.com/comment/42905686
has comment: http://stackoverflow.com/comment/42905472
answers question: http://stackoverflow.com/q/27211465
score: 2
has comment: http://stackoverflow.com/comment/42905587
has comment: http://stackoverflow.com/comment/42905358
upvote count: 2
has comment: http://stackoverflow.com/comment/42904901
has comment: http://stackoverflow.com/comment/42905353
has comment: http://stackoverflow.com/comment/42905192
has comment: http://stackoverflow.com/comment/42905600
has body: Don't do table = new JTable(data, headers); in your constructor. You are derefrencing the initial table you drag and dropped. Sure jScrollPane2.setViewportView(table); might have fixed it (by set the viewport to the new table) but this is unnecessary, and smells of future problems if you don't understand what's going on. Instead work with the table's model to update. So instead of the table = new JTable, do DefaultTableModel model = new DefaultTableModel(data, headers); table.setModel(model); That's it. To update the table, just update the model, upon successful update in the database. if (successfulInsert) { DefaultTableModel model = (DefaultTableModel)table.getModel(); Object[] row = .... // get the data for the row model.addRow(row); } See more at How to Use Tables and Creating a TableModel and DefaultTableModel API
has comment: http://stackoverflow.com/comment/42905137
has comment: http://stackoverflow.com/comment/42904950
has comment: http://stackoverflow.com/comment/42904878
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42905054
has comment: http://stackoverflow.com/comment/42905111

http://stackoverflow.com/a/27294470
answers question: http://stackoverflow.com/q/27294392
has comment: http://stackoverflow.com/comment/43515682
downvote count: 0
has comment: http://stackoverflow.com/comment/43559250
has body: Normally, you need to add the alternate description like this: logoImage.setAccessibleAttribute(PdfName.ALT, new PdfString("Logo")); This works for PDF/A2-A and PDF/A3-A, but not for PDF/A1-A. I have tested this and I see that you have discovered a bug. This bug has now been fixed. The fix will be in the next release.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43061925
accepted answer of: http://stackoverflow.com/q/27294392
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43083166
has comment: http://stackoverflow.com/comment/43055553
score: 1
has comment: http://stackoverflow.com/comment/43056952

http://stackoverflow.com/comment/42989823
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27257927
has text: @brso05 And perform lot's of `SELECT 1` statements to your database every X seconds like a heartbeat? That's not a good idea. I would prefer to use a database connection pool that can truly reuse the same physical connection rather than doing manually.

http://stackoverflow.com/comment/42939290
score: 0
comment on: http://stackoverflow.com/q/27231193
type: Comment
type: QuestionComment
has text: Thanks for the answer. So would you say using try-with-resources is the wrong approach here? Can you recommend a more elegant version?

http://stackoverflow.com/q/27230710
tagged with: arrays
has comment: http://stackoverflow.com/comment/42938250
has body: I am looking for a dynamic programming solution of getting all permutations of k length from a set of n unique strings. Example: array = {"A","B","C","D","E","F","G"}; // n = 7 example permutations = {ABC}, {ABD}, {ABE} etc // k = 3 I have an approach to solve this, as first to generate combinations, then generate all possible permutations of that combination. Combinations can be generated using dynamic programming like solving Binomial Coefficient problem using DP. Thoughts?
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/35323412
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/35323412
has title: All possible permutations of length k (k legth string ) from a set (array of chars) length n dynamic programming solution
tagged with: dynamic
tagged with: java
has answer: http://stackoverflow.com/a/27231275
type: Question
has comment: http://stackoverflow.com/comment/43012489
tagged with: algorithm

http://stackoverflow.com/q/27260526
has answer: http://stackoverflow.com/a/27265396
type: UnansweredQuestion
tagged with: hibernate-mapping
has title: how to uniquely identify an hibernate sql query
score: 1
tagged with: orm
upvote count: 1
type: Question
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: jpa
downvote count: 0
has body: What's the easiest way to uniquely identify an Hibernate SQLQuery (https://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/SQLQuery.html) once it has been created and all it's parameters bound? I've found this to generate a query key: http://docs.jboss.org/hibernate/orm/4.2/javadocs/org/hibernate/cache/spi/QueryKey.html. But, that does not appear to be usable outside of hibernate internals.
favorite count: 0

http://stackoverflow.com/a/27199140
downvote count: 0
has body: the camel-jdbc component expects SQL text, so the body should contain an insert statement... so, you need to parse the results from your select stmt which returns ArrayList&lt;HashMap&lt;String, Object&gt;&gt;...the split() gets you to HashMap&lt;String, Object&gt;, so you can extract those map values using camel-simple... something like this... .setBody(simple("insert into employee values('${body[id]','${body[name]}')"))
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27195750
answers question: http://stackoverflow.com/q/27195750
has comment: http://stackoverflow.com/comment/42891808
type: AcceptedAnswer

http://stackoverflow.com/q/27234808
has comment: http://stackoverflow.com/comment/42946277
tagged with: java
has body: I am trying to refresh the data from a JTable. This method select the data from database: public Object[][] getData() { Object[][] data = new Object[15][10]; try { String query = "SELECT * from emailApp"; rs = st.executeQuery(query); int i = 0; while (rs.next()) { int id = rs.getInt("id"); int priority = rs.getInt("priority"); String sender = rs.getString("sender"); String recipient = rs.getString("recipient"); String labelDb = rs.getString("label"); String subject = rs.getString("subject"); String message = rs.getString("message"); data[i][0] = id; data[i][1] = sender; data[i][2] = priority; data[i][3] = recipient; data[i][4] = labelDb; data[i][5] = subject; data[i][6] = message; i++; if(i&gt;15) break; } } catch(Exception ex) { System.out.println(ex); } return data; } Then I am using this method to refresh the data from the JTable: public void setUpTableData() { DefaultTableModel model = (DefaultTableModel) table.getModel(); DBConnect connect = new DBConnect(); Object[][] data = connect.getData(); Object[] modelData = new Object[15]; model.setRowCount(0); for(int i = 0; i&lt;15; i++) { if(data[i][0] == null) break; modelData[0] = data[i][0]; modelData[1] = data[i][1]; modelData[2] = data[i][2]; modelData[3] = data[i][3]; modelData[4] = data[i][4]; modelData[5] = data[i][5]; modelData[6] = data[i][6]; model.addRow(data); } model.fireTableDataChanged(); table.setModel(model); } Error: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JTable$1 cannot be cast to javax.swing.table.DefaultTableModel and then I am calling this method by pressing a button. Can someone tell me what I am doing wrong. Thank you!
type: Question
has answer: http://stackoverflow.com/a/27408564
has title: error while refreshing the data in JTable using TableModel
has comment: http://stackoverflow.com/comment/42948577
score: 0
has comment: http://stackoverflow.com/comment/42947056
has comment: http://stackoverflow.com/comment/42946733
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/27408564
has comment: http://stackoverflow.com/comment/42946401
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/43084075
type: Comment
has text: private static String get(JSONObject jsonObj,String str){ JSONObject localJson=jsonObj; try{ return localJson.get(str).toString(); }catch(Exception je){ je.printStackTrace(); }return localJson.toString(); }public static void main(String[] args) throws Exception{ String xml1= " " + " ADER " + " ABC123 " + " FIN " + " 1.1 " + " " + " 2012 " + " 6 " + " 21 " + " 11 "+ " 18 "+ " 29 "+ " "+ " ";
comment on: http://stackoverflow.com/a/27286617
score: 0
type: AnswerComment

http://stackoverflow.com/q/27177849
has comment: http://stackoverflow.com/comment/42844613
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27178561
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/42844687
tagged with: java
has title: Game enemy computer AI logic
accepted answer: http://stackoverflow.com/a/27178561
has body: I am creating a battleships game. It is complete except for the enemy AI. At present, when the enemy hits a ship, it hits in another random place. Obviously this is not good so I have written a method to try and deal with this. At present, it goes into a never ending loop if it misses the ship, after hitting it initially. public void compAI() { // Randomly goes up, down, left, or right from the previous spot to attempt to sink ship // BEWARE, ARRAYLISTOUTOFBOUNDsEXCEPTION WAITING TO HAPPEN! // CURRENTLY CREATES NEVER ENDING LOOP IF IT MISSES............ boolean compAllowed = false; int forwards = 0, up = 0; while (!compAllowed) { int direction = (int) Math.random() * 4; if (direction == 0) forwards = 1; if (direction == 1) forwards = -1; if (direction == 2) up = 1; if (direction == 3) up = -1; if (playerBoard[savedCompRow + up][savedCompCol + forwards] == '~') { playerBoard[savedCompRow + up][savedCompCol + forwards] = 'ø'; //lastMove = "miss"; compAllowed = true; } else if (playerBoard[savedCompRow + up][savedCompCol + forwards] == 'ø') compAllowed = false; else if (playerBoard[savedCompRow + up][savedCompCol + forwards] == 'X') compAllowed = false; else { playerBoard[savedCompRow + up][savedCompCol + forwards] = 'X'; lastMove = "hit"; compAllowed = true; } } } Code for computer taking shot public void compMove() { // Randomly choose locations boolean compAllowed = false; //if (lastMove.equals("hit")) compAI(); // Calls the compAI method to provide a smart strategy for the computer while (!compAllowed) { int row = (int) (Math.random() * boardSize); int col = (int) (Math.random() * boardSize); if (playerBoard[row][col] == '~'){ playerBoard[row][col] = 'ø'; compAllowed = true; } else if (playerBoard[row][col] == 'ø') compAllowed = false; // Already made this move else if (playerBoard[row][col] == 'X') compAllowed = false; // Already made this move else { // Must be a hit playerBoard[row][col] = 'X'; /* lastMove = "hit"; savedCompRow = row; savedCompCol = col; */ comp…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42844642
has comment: http://stackoverflow.com/comment/42844665
has comment: http://stackoverflow.com/comment/42844537

http://stackoverflow.com/comment/42846805
comment on: http://stackoverflow.com/a/27177625
type: AnswerComment
score: 0
type: Comment
has text: I think that was a @Where limitation only. I think [it should work for ManyToOne](http://stackoverflow.com/questions/10691527/using-filter-with-manytoone-relation).

http://stackoverflow.com/a/34961544
has body: good to know that your issue is resolved on making capability.setCapability("nativeEvents", false); but it may create problem when you try to perform native events. so if you not tried, please try performing click before sendkeys. it helps me some times and also providing Thread.sleep(3000) in java also helps me in some situations. please try these if not. Thank You, Murali
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27251010

http://stackoverflow.com/q/27309182
downvote count: 0
has body: I get this exception sometimes only,like once in 100 calls. I looked for solutions but could not figure out. Stored procedure takes one input. The driver i use is sqljdbc4 version 4.0 CREATE PROCEDURE [dbo].[PROC_CATEGORY_LIST] @USERID INT and i have set the parameter as follows "EXEC PROC_CATEGORY_LIST ?" callableStatement.setInt(1, userId); resultSet = callableStatement.executeQuery(); I get the following exception The value is not set for the parameter number 2. com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 2. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildParamTypeDefinitions(SQLServerPreparedStatement.java:260) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildPreparedStrings(SQLServerPreparedStatement.java:219) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:612) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:400) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$Stat…
tagged with: sql-server
has comment: http://stackoverflow.com/comment/43080280
tagged with: jdbc
favorite count: 0
has comment: http://stackoverflow.com/comment/43080202
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: stored-procedures
answer count: 0
has comment: http://stackoverflow.com/comment/91236621
has comment: http://stackoverflow.com/comment/43079991
tagged with: java
has comment: http://stackoverflow.com/comment/43079995
has comment: http://stackoverflow.com/comment/43080158
type: Question
tagged with: mssql-jdbc
has title: com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter

http://stackoverflow.com/comment/43161624
comment on: http://stackoverflow.com/q/27273121
score: 0
type: Comment
type: QuestionComment
has text: @cherouvim Via IDE , file is not getting locked , but i made it as a web service , so when the web service call is done then the file is getting locked for some time

http://stackoverflow.com/a/27234954
answers question: http://stackoverflow.com/q/27234588
has body: The below code snippet can be helpful to meet your requirements public static String extractMovieName(String movieNameString){ Pattern pattern = Pattern.compile("([\\w' ]+)([\\[]|[\\(]|[\\d]{4})"); Matcher matcher = pattern.matcher(movieNameString); String extractedName = ""; if(matcher.find()){ extractedName = matcher.group(1); } return extractedName; }
type: Answer
score: 2
upvote count: 2
downvote count: 0

odata
tag name: odata
type: Tag
tags question: http://stackoverflow.com/q/27294637
tags question: http://stackoverflow.com/q/27260910

http://stackoverflow.com/comment/42900803
score: 0
type: Comment
has text: http://www.json.org/javadoc/org/json/JSONArray.html
type: QuestionComment
comment on: http://stackoverflow.com/q/27209488

http://stackoverflow.com/comment/42873220
type: AnswerComment
has text: I've updated the question to explain the problem a little more clearly.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27178049

http://stackoverflow.com/q/27183847
accepted answer: http://stackoverflow.com/a/27184198
tagged with: http-redirect
has body: I am using the PayPal Sandbox in my Struts 2 web project. I have a payment-method.jsp that contains the PayPal form: I have specified the return value as payment. I have defined the action in my struts.xml: /transaction-result.jsp But it's returning to the PayPal Sandbox homepage. How do I redirect to an action (instead of an actual page) after the user completes their transaction in PayPal? (The cancel_return works by the way.)
tagged with: paypal
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42855263
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42855228
has comment: http://stackoverflow.com/comment/42855667
possible better answer: http://stackoverflow.com/a/27184281
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27184281
tagged with: struts2
upvote count: 1
has title: Redirect to Struts 2 action class after user completes PayPal purchase
favorite count: 0
has answer: http://stackoverflow.com/a/27184198

configuration-files
type: Tag
tags question: http://stackoverflow.com/q/27305092
tags question: http://stackoverflow.com/q/27191145
tag name: configuration-files

http://stackoverflow.com/comment/42954959
comment on: http://stackoverflow.com/q/27238713
type: Comment
has text: You could use tail to get the end of the file, and then transfer that however, but I think cron and rsync are your friends. And rsync can be made to operate over ssh.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27301055
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/43065815
type: AnsweredQuestion
has body: I am using a JPanel with Graphics to make a game. I have implemented a KeyListener and I have added it to my JPanel. I cannot get it to read the keycodes, however. I added a print statement that I assumed would print anytime a key was pushed, but none of the keys I press are returning codes. Here is my JPanel constructor: public Game() { super(); JPanel mazepanel = new JPanel(); this.add(mazepanel); this.setVisible(true); this.addMouseListener(this); this.addKeyListener(this); } And here is my KeyListener. public void keyTyped(KeyEvent kb) { System.out.println("Key pressed: " + kb.getKeyCode()); if (kb.getKeyCode() == KeyEvent.VK_UP) { forward = true; } else if (kb.getKeyCode() == KeyEvent.VK_LEFT) { left = true; } else if (kb.getKeyCode() == KeyEvent.VK_RIGHT) { right = true; } else if (kb.getKeyCode() == KeyEvent.VK_DOWN) { back = true; } else { } this.repaint(); }
tagged with: java
has comment: http://stackoverflow.com/comment/43065916
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27301107
tagged with: user-interface
tagged with: keyboard
has title: Why is my KeyListener not reading keys?
has comment: http://stackoverflow.com/comment/43065835
possible better answer: http://stackoverflow.com/a/27301129
has comment: http://stackoverflow.com/comment/43065823
has answer: http://stackoverflow.com/a/27301129
accepted answer: http://stackoverflow.com/a/27301107

http://stackoverflow.com/q/27214995
upvote count: 0
has body: Hi I am hoping for a little direction/help on the following task I am struggling with.. Provide two classes which implement the ConsolePrint interface. • One is called SimplePrint and it will just print the supplied argument directly to the console. e.g. simplePrintObject.printInfo(“Heading this is not fancy”); would output: Heading this is not fancy • One is called FancyPrint. It should use StringTokenizer or String.split() to break up the string. The first part of the string should be treated as a header and the other parts should be separated by tabs in the output. e.g. fancyPrintObject.printInfo(“Heading this is quite fancy”); would output: *********** Heading ********** this is quite fancy ****************************** Note: You should aim to have both “starred” rows take up the same width, regardless of the size of the header (for example, you can assume that the maximum length of the header string is 20 and that the first and last rows will output 30 characters – which will be 30 * in the case of the last row.) Provide a basic class called ConsolePrintTest which will test each of the two classes. Make sure that your classes can handle empty strings and null strings. So far I have written my interface as directed: public interface ConsolePrint { void printInfo(String infoToPrint); } And a small program using the Split.split method.. public class PrintTester { public static void main(String args[]) { String str = new String("\n\n**************Heading************** \n\n\t" + "This Is Quite Fancy\n" + "\n***********************************"); for (String retval: str.split(" ", 1)) { System.out.println(retval); } } } But trying to implement the ConsolePrint interface as directed in two classes has me stumped after days of reading and searching!
answer count: 1
tagged with: string
score: -6
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42910278
has title: String split, Java
has comment: http://stackoverflow.com/comment/42910054
downvote count: 6
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27215028

http://stackoverflow.com/q/27216012
has title: how to solve IllegalStateException
answer count: 2
upvote count: 0
has body: I am developping an app and i wanna display a google map v2 on activity but it doesn't show this is a snippet form logcat 11-30 19:14:56.681: E/AndroidRuntime(6062): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cultural/com.example.cultural.MainActivity}: android.view.InflateException: Binary XML file line #20: Error inflating class fragment 11-30 19:14:56.681: E/AndroidRuntime(6062): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 6171000 but found 0. You must have the following declaration within the element:
favorite count: 0
has answer: http://stackoverflow.com/a/27216071
tagged with: android
linked to: http://stackoverflow.com/q/21039508
possible better answer: http://stackoverflow.com/a/27216045
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27216045
tagged with: java
accepted answer: http://stackoverflow.com/a/27216071
downvote count: 1
type: Question
score: -1

http://stackoverflow.com/comment/42877477
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27194947
type: QuestionComment
has text: So what is the answer to the title question?

http://stackoverflow.com/comment/42991799
comment on: http://stackoverflow.com/q/27258772
score: 0
has text: @RealSkeptic `NullPointException` isn't important for me, correctly working more important than exception
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42852697
has text: @Nitin yes I will, If you could share your updated code. Have you declared any attribute named `cid` in servlet, if not then remove `request.getAttribute("cid")` part and it should become. `String locations ="["+lats+","+lon+"]"`. I have updated my code with `String lon= lonMap.get("lons"+i);`
type: AnswerComment
comment on: http://stackoverflow.com/a/27165812
score: 0
type: Comment

http://stackoverflow.com/comment/43196364
type: Comment
has text: JNDI is only an API. You seem to be talking about the RMI Registry.
score: 0
comment on: http://stackoverflow.com/a/27209711
type: AnswerComment

http://stackoverflow.com/comment/43084722
type: Comment
has text: String jsonString = arg0.get(i).get(0).getJSONArray("tripPoints").toString(); contains the JSON. What should I add before or after?
score: 0
comment on: http://stackoverflow.com/a/27311229
type: AnswerComment

http://stackoverflow.com/q/27206880
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42895969
has comment: http://stackoverflow.com/comment/42895841
has title: Java - listFiles() returns nullpointerexception
has comment: http://stackoverflow.com/comment/42895941
answer count: 0
has comment: http://stackoverflow.com/comment/42896010
tagged with: java
has body: Well I'm running a Runnable JAR File exported from eclipse and I'm getting a NullPointerException(on a Linux VPS). In my Windows PC, it works perfectly file. This is my code: public Main() throws Throwable { Policy.setPolicy(new PluginPolicy()); System.setSecurityManager(new SecurityManager()); File directory = new File("src/Plugins/Rogue/"); File[] fList = directory.listFiles(); if(fList.length &gt; 0) { for (File file : fList) { if (file.isFile()) { System.out.println(file.getName()); String path = file.getParent().substring(4).replace("\\", "."); String pluginName = file.getName().split("\\.")[0]; File unauthorizedJarFile = new File(pluginName + ".jar"); ClassLoader unauthorizedLoader = URLClassLoader.newInstance(new URL[] { unauthorizedJarFile.toURI().toURL() }); Plugin unauthorizedPlugin = (Plugin) unauthorizedLoader.loadClass(path + "." + pluginName).newInstance(); unauthorizedPlugin.run(); } } } } I get this in my Linux VPS: Exception in thread "main" java.lang.NullPointerException at Test.Main.&lt;init&gt;(Main.java:23) at Test.Main.main(Main.java:12) and on my Eclipse IDE on Windows: Rogue.java swaggy! Any help is appreciated! Thanks
has comment: http://stackoverflow.com/comment/42895911
type: Question
has comment: http://stackoverflow.com/comment/42896471
has comment: http://stackoverflow.com/comment/42896061
has comment: http://stackoverflow.com/comment/42895977
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/42895958
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42896158
has comment: http://stackoverflow.com/comment/42896129
has comment: http://stackoverflow.com/comment/42895863
has comment: http://stackoverflow.com/comment/42896013
has comment: http://stackoverflow.com/comment/42895906
has comment: http://stackoverflow.com/comment/42896362
has comment: http://stackoverflow.com/comment/42895896

http://stackoverflow.com/q/27215032
has comment: http://stackoverflow.com/comment/42910163
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/27215246
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27215240
type: Question
has answer: http://stackoverflow.com/a/27215240
accepted answer: http://stackoverflow.com/a/27215246
has title: Stop thread, not extending class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42910196
has body: I've been looking around some anwers given here but i don't get exactly the solution to my problem: I don't want to create a new class and extends runnable or thread. I have a service that when created must check every 10 secs some stuff and the calls needed can't be done from the main thread, so onStartCommand() method I do the following: mThread = new Thread() { public void run() { while(true) { // some code try { Thread.sleep(10000); } catch (Exception e){ StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); Log.i("Exception", errors.toString()); } } Now, when i call onStopService() i want to stop this thread. The method stop() is deprecated so I'm using interrupt(): @Override public void onDestroy(){ mDelete.interrupt(); mDownload.interrupt(); super.onDestroy(); } As I expected, it throws InterruptedException because the thread is sleeping when calling interrupt. Is there any way to stop the thread without creating a new class and extend from runnable or thread? Thanks in advance

http://stackoverflow.com/q/27229410
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/27229824
has comment: http://stackoverflow.com/comment/42942874
has comment: http://stackoverflow.com/comment/42936812
tagged with: class
has answer: http://stackoverflow.com/a/27229768
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27229824
has title: Is there a certain benefit in declaring an object using a class and assign it to another class?
type: Question
has answer: http://stackoverflow.com/a/27229588
has comment: http://stackoverflow.com/comment/42935745
tagged with: object
has body: During a Java course in my University we teach this example. While I certainly understand how this works, I fail to imagine a real life example where this practice might be useful. In my eyes it makes the code harder to understand. More specifically, is there a certain benefit in declaring an object using a class and assign it to another class (Small smallBig = new Big();) and can you give me a simple scenario where this practice might be useful? The code: public class Small { public int value; public Small() {value = 10;} public int getValue() {return value;} } public class Big extends Small { public int value; public Big() {value = 40;} public int getValue() {return value-10;} } public class Main { public static void main (String args[]) { Small small = new Small(); Small smallBig = new Big(); Big big = new Big(); System.out.println(small.getValue()); System.out.println(smallBig.getValue()); System.out.println(big.getValue()); System.out.println(small.value); System.out.println(smallBig.value); System.out.println(big.value); small = (Small) big; System.out.println(small.getValue()); System.out.println(small.value); big = (Big) small; System.out.println(big.getValue()); System.out.println(big.value); } } The output: 10 30 30 10 10 40 30 10 30 40
possible better answer: http://stackoverflow.com/a/27229588

http://stackoverflow.com/a/27225200
type: Answer
has comment: http://stackoverflow.com/comment/42984577
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27209971
has body: To fix your current problem, you should add &lt;constant name="struts.enable.SlashesInActionNames" value="true"/&gt; in struts.xml, that is false by default, and will take all the part before the last slash as namespace instead of action name. BTW this has side effects: Action Names With Slashes If your action names have slashes in them (for example, &lt;action name="admin/home" class="tutorial.Admin"/&gt;) you need to specifically allow slashes in your action names via a constant in the struts.xml file by specifying &lt;constant name="struts.enable.SlashesInActionNames" value="true"/&gt;. See JIRA Issue WW-1383 for discussion as there are side effects to setting this property to true. To fix the problem the right way, you need to make a correct usage of namespaces: Action @Namespace("/admin/product") public class YourAction extends ActionSupport @Action("insert") public String insert() throws Exception { /* .... */ } @Action("update") public String update() throws Exception { /* .... */ } @Action("delete") public String delete() throws Exception { /* .... */ } JSP &lt;s:submit value="Thêm mới" action="insert" cssClass="btn btn-default" /&gt; &lt;s:submit value="Cập nhật" action="update" cssClass="btn btn-default" /&gt; &lt;s:submit value="Xóa" action="delete" cssClass="btn btn-default" /&gt; You should also refactor the package structure for Actions and JSPs to follow the namespace structure. P.S: remember to set action prefix enabled as explained in this answer if you are using a Struts2 version higher than 2.3.15.2: &lt;constant name="struts.mapper.action.prefix.enabled" value="true"/&gt; EDIT If the namespace of the Action you are using to show your JSP is not the same of the actions called (in this case, /admin/product), you need to specify it in &lt;s:form&gt; tag: &lt;s:form namespace = "/admin/product" enctype = "multipart/form-data" theme = "simple" role = "form"&gt; And (if you are using a Struts2 version higher than 2.3.15.2), set the following property i…
has comment: http://stackoverflow.com/comment/42979639
answers question: http://stackoverflow.com/q/27209971
has comment: http://stackoverflow.com/comment/42985085
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42984852
has comment: http://stackoverflow.com/comment/42962374
has comment: http://stackoverflow.com/comment/42977956
has comment: http://stackoverflow.com/comment/42978948
has comment: http://stackoverflow.com/comment/42979323
has comment: http://stackoverflow.com/comment/42985675

http://stackoverflow.com/q/27176878
tagged with: java
type: Question
tagged with: processing
has comment: http://stackoverflow.com/comment/42848086
has answer: http://stackoverflow.com/a/27177473
score: 0
accepted answer: http://stackoverflow.com/a/27177473
answer count: 1
has title: How to capture overlay and webcam together in Processing?
has body: I've written a simple code to use the webcam feature with an overlay, but when i try to capture pictures it's the webcam picture only, is there anyway i can combine the overlay and webcame picture together when saving? import processing.video.*; int w = 1280; int h = 720; int i = 0; Capture camDevice; PImage overlay; void setup() { size(w, h); camDevice = new Capture(this, w, h); camDevice.start(); } void draw() { overlay = loadImage("overlay.png"); if (camDevice.available() == true) { camDevice.read(); } image(camDevice, 0, 0); image(overlay, 0, 0, width, height); } void keyPressed() { if ( key == 's' ) { if (i&lt;300){ i++; } else i = 1; //camDevice.save( "stillFrame"+i+".png" ); saveFrame("Frame-"+i+".png"); //Found this in the library that does exactly what i wanted } }
type: AnsweredQuestion

format
tags question: http://stackoverflow.com/q/27220693
tags question: http://stackoverflow.com/q/27225236
tag name: format
type: Tag
tags question: http://stackoverflow.com/q/27206306

http://stackoverflow.com/q/27212698
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27213373
tagged with: java
type: Question
has title: Java - the function in case of an exit from the program
has comment: http://stackoverflow.com/comment/42937845
accepted answer: http://stackoverflow.com/a/27213373
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42906077
has body: I have the main program which transfers files for the composer of diagrams, and opens it. If I close the composer of diagrams and I open composer of diagrams with new files from the main program, there can be errors because in case of the first exit from the graphic composer some important variables aren't nullified. How can I fix it?
has comment: http://stackoverflow.com/comment/42906058

http://stackoverflow.com/q/27293431
score: 1
has answer: http://stackoverflow.com/a/27293475
upvote count: 1
accepted answer: http://stackoverflow.com/a/27293467
type: AnsweredQuestion
has body: I am doing a small program that holds shelves in a library list. If the number of shelf was already entered before, you can't enter it again. However, it's not working. Here is my code in the main class: Shelf s = new Shelf(1); Shelf s2 = new Shelf(1); Library l = new Library(); l.Addshelf(s); l.Addshelf(s2); As you can see I entered 1 in both objects as the shelf number so this code below should then run from the library class public void Addshelf(Shelf s) { List li = new ArrayList(); if(li.contains(s)) { System.out.println("already exists"); } else { li.add(s); } } The problem must be in the above method. I want to know how I check if that shelf number already exists in the list, in which case it should prompt me with the above statement - "already exists.
possible better answer: http://stackoverflow.com/a/27293475
tagged with: java
has comment: http://stackoverflow.com/comment/43052133
type: Question
has title: Checking if a value is already in a List won't work
downvote count: 0
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/27293483
answer count: 4
has answer: http://stackoverflow.com/a/27293467
has comment: http://stackoverflow.com/comment/43052660
has answer: http://stackoverflow.com/a/27293480

http://stackoverflow.com/comment/42904012
comment on: http://stackoverflow.com/a/27204359
type: AnswerComment
has text: My `OneThread` class had another field `ArrayList<Cls2>` making `Cls2` also serializable solved it.
score: 10
type: Comment

http://stackoverflow.com/comment/43035955
has text: you're welcome, yes other answers came when I've been typing this answer and I didn't see them before posting this answer
comment on: http://stackoverflow.com/a/27283850
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27294722
score: 0
answers question: http://stackoverflow.com/q/27294667
type: Answer
has body: BigInteger does support methods like add/multiply etc. See this for details. BigInteger operand1 = new BigInteger("123454466666666666666665454545454454544598989899545455454222222222222222"); BigInteger operand2 = new BigInteger("123454466666666666666665454545454454544598989899545455454222222222222222"); System.out.println(operand1.add(operand2)); System.out.println(operand1.subtract(operand2)); System.out.println(operand1.multiply(operand2)); System.out.println(operand1.divide(operand2));

http://stackoverflow.com/comment/46539837
type: AnswerComment
type: Comment
has text: This answer is wrong. See [Morwenn's answer](http://stackoverflow.com/questions/27218894/how-to-find-if-two-numbers-are-consecutive-numbers-in-gray-code-sequence/27332721#27332721).
score: 4
comment on: http://stackoverflow.com/a/27219118

http://stackoverflow.com/comment/43075973
comment on: http://stackoverflow.com/q/27306256
score: 0
type: Comment
type: QuestionComment
has text: @EJK the device is actually the same OS version that one of the testing device I have, but not the same device. Will the emulator make the difference?

http://stackoverflow.com/q/27264255
tagged with: casting
has answer: http://stackoverflow.com/a/27264629
has comment: http://stackoverflow.com/comment/43000528
score: 0
tagged with: subclass
has answer: http://stackoverflow.com/a/27264353
has title: Why won't this cast?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27264357
has comment: http://stackoverflow.com/comment/43000481
type: Question
tagged with: tree
has body: So I have a class: public static class AVLTreeNode &lt;E extends Comparable&lt;E&gt;&gt; extends BST.TreeNode&lt;E&gt; { protected int height; public AVLTreeNode(E e) { super(e); } } That extends another class: public static class TreeNode&lt;E extends Comparable&lt;E&gt;&gt; { protected E element; protected TreeNode&lt;E&gt; left; protected TreeNode&lt;E&gt; right; public TreeNode(E e) { element = e; } } And I am creating an ArrayList of type TreeNode, and trying to cast it to AVLTreeNode: public void balancePath(E e) { ArrayList&lt;TreeNode&lt;E&gt;&gt; path = path(e); for (int i = path.size() - 1; i &gt;= 0; i--) { AVLTreeNode&lt;E&gt; a = (AVLTreeNode&lt;E&gt;)(path.get(i)); //continued code not important... Note that my path method returns an ArrayList of type TreeNode&lt;E&gt;. But when I try to cast the node that I get at position i in the list to AVLTreeNode&lt;E&gt; (a subtype of TreeNode) I get a ClassCastException. What is the problem here? Edit Here is the full stack trace Exception in thread "main" java.lang.ClassCastException: com.jeffsite.chapter27.BinarySearchTree$TreeNode cannot be cast to com.jeffsite.chapter29.AVLTree$AVLTreeNode at com.jeffsite.chapter29.AVLTree.balancePath(AVLTree.java:102) at com.jeffsite.chapter29.AVLTree.insert(AVLTree.java:19) at com.jeffsite.chapter29.TestAVLTree.main(TestAVLTree.java:10)
tagged with: oop
tagged with: java
answer count: 3

http://stackoverflow.com/comment/43012155
score: 1
comment on: http://stackoverflow.com/a/27269271
type: AnswerComment
has text: @SujeethDamodharan - You have to have an initial spring context in any case. Anyway, I edited my answer and added the right annotation to use when configuring with configuration class and not with XML. But still in a standalone app you need to programatically load the context somehow in order for the annotations to work.
type: Comment

http://stackoverflow.com/a/27154068
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27153758
has comment: http://stackoverflow.com/comment/42946702
type: Answer
has comment: http://stackoverflow.com/comment/42948837
score: 2
has comment: http://stackoverflow.com/comment/42949779
has comment: http://stackoverflow.com/comment/42803280
downvote count: 0
has comment: http://stackoverflow.com/comment/42949318
has comment: http://stackoverflow.com/comment/42948269
has body: You could use regex and matcher to find your key and value: public static void main(String[] args) throws IOException { String test = "[(xx)(KEYX)some text]"; Pattern pattern = Pattern.compile("\\(KEY.*\\)"); Matcher matcher = pattern.matcher(test); matcher.find(); String s = matcher.group(0); String s1 = test.substring(matcher.end(), test.length() - 1); System.out.println("" + s + " " + s1); } Output of this would be: (KEYX) some text If you change string to "[(xx)(KEYXYYYYYY)some text]" then it would be: (KEYXYYYYYY) some text If you don't want parenthesis around key: public static void main(String[] args) throws IOException { String test = "[(xx)(KEYXYYYYYY)some text]"; Pattern pattern = Pattern.compile("(?&lt;=\\()KEY.*(?=\\))"); Matcher matcher = pattern.matcher(test); matcher.find(); String s = matcher.group(0); String s1 = test.substring(matcher.end() + 1, test.length() - 1); System.out.println("" + s + " " + s1); } Output would be: KEYXYYYYYY some text **************************************************************UPDATE********************************************************** Match anything for key not just KEY: public static void main(String[] args) throws IOException { String test = "[(xx)(time.zone1)some text]"; Pattern pattern = Pattern.compile("(?&lt;=\\()[^xy].*(?=\\))"); Matcher matcher = pattern.matcher(test); matcher.find(); String s = matcher.group(0); String s1 = test.substring(matcher.end() + 1, test.length() - 1); System.out.println("" + s + " " + s1); } This will output: time.zone1 some text **********************************************************UPDATE********************************************** Multiple matches in same String: public static void main(String[] args) throws IOException { String test = "[(xx)(time1.zone1)some text1]blahblahblah[(xx)(time2.zone2)some text2]"; Pattern pattern = Pattern.compile("(?&lt;=\\()[^xy].*?]"); Matcher matcher = pattern.matcher(test); while(matcher.find()) { String s = matcher.group(0); String s1 = s.s…
upvote count: 2
answers question: http://stackoverflow.com/q/27153758
has comment: http://stackoverflow.com/comment/42948386
has comment: http://stackoverflow.com/comment/42806659

http://stackoverflow.com/comment/42890769
type: QuestionComment
has text: You should read on "variable scope"
comment on: http://stackoverflow.com/q/27204014
score: 0
type: Comment

http://stackoverflow.com/comment/43110684
comment on: http://stackoverflow.com/q/27274926
has text: Oh, I see you said "case-INsensitive". Then that's 39 characters, and you should be able to fold into the 94 ASCII characters and achieve about 25% compression.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27287100
score: 2
downvote count: 0
type: Answer
has body: In my opinion you should consider following things, For Load testing of any complex system(which includes multiple components), divide the load testing as per components (App1, Rabbit queue, producer, consumer). Reason behind this is in one test you cannot get the bottleneck in the system or it will lead to incorrect results. In my team we have had such assignment (publisher - consumer model) once. There is no rule which says for load testing you must use any load testing tool. A simple java code which can act as load generator (Publisher) and simple java code which consumes the load (Consumer) will be enough for load testing. JMeter is a good option (free, scalable, reliable, known in Industry) but you can check LoadRunner, Neoload etc. IMHO, You should seperate the components and test them individually which will help you to find answers like what is max consumer rate and what is max publisher rate. A simple java code can do that for you. You dont need JMeter requests for that. This way you can have more control on rate of production as well as rate of consumption. Yes your plan was correct, Find the max. rates possible rates at which publisher and consumer can give you max. system throughput. While doing this, have an eye on system utilization also. Finally when you get measurements of stable system, you can go for 2 options, 1. Stress test (when system breaks) 2. Tune the system to improve the performance and repeat the cycle for new measurements. I hope some confusion is clear now :)
answers question: http://stackoverflow.com/q/27284001
upvote count: 2

http://stackoverflow.com/a/27312259
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27311281
has body: ASN.1 (Abstract Syntax Notation One) is one quite ofter used abstract language. The wiki page contains links to different java and C generators for ASN.1 . There quite big list of similar interface description language listed in this page.
type: Answer
accepted answer of: http://stackoverflow.com/q/27311281

http://stackoverflow.com/q/27210143
score: -1
has comment: http://stackoverflow.com/comment/42901964
has comment: http://stackoverflow.com/comment/42901923
type: Question
has title: Calculating Grade Averages, program continually errors out
tagged with: arrays
has comment: http://stackoverflow.com/comment/42902010
has answer: http://stackoverflow.com/a/27210166
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42901929
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42901945
has body: My job for this code is to calculate the grades and final weighted average grade and the output them in a table. I'm having trouble doing this because I continually get an array out of bounds where it says: examAverage[index] = ...etc My MAX_STUDENTS is 200 because that is the highest amount of students that can have their grades stored in my program. Please help me figure out what variables I need to change to make this program work well. If there is anymore information I need to provide just let me know. Here is the rest of my code: if (choice == 2) { //Index counters for averages int examIndex = 0; int quizIndex = 0; int hwIndex = 0; int gradeAveragingIndex = 0; //loop finding the gradeAverage for(int index = 0; index&lt;=MAX_STUDENTS; index++){ examAverage[index] = (exams[examIndex] + exams[examIndex+1] + exams[examIndex+2]) / numExams; quizAverage[index] = (quizzes[quizIndex] + quizzes[quizIndex+1] + quizzes[quizIndex+2]) / numQuizzes; hwAverage[index] = (hw[hwIndex] + hw[hwIndex+1] + hw[hwIndex+2]) / numHW; gradeAverage[index] = ((examAverage[gradeAveragingIndex] * examWeight) + (quizAverage[gradeAveragingIndex] * quizWeight) + (hwAverage[gradeAveragingIndex] * hwWeight) / numExams); examIndex+=3; quizIndex+=3; hwIndex+=3; gradeAveragingIndex++; } System.out.println("Display student grades &amp; statistics"); //Formatting for the heading of my grade table System.out.printf("%-10s","Name"); System.out.printf("%-5s","Exam"); System.out.printf("%-5s","Exam"); System.out.printf("%-5s","Exam"); System.out.printf("%-5s","Quiz"); System.out.printf("%-5s","Quiz"); System.out.printf("%-5s","Quiz"); System.out.printf("%-7s","HWork"); System.out.printf("%-7s","HWork"); System.out.printf("%-7s","HWork"); System.out.printf("%-5s","Grade\n"); //declaring index counters int studentNameIndex = 0; int examGradeIndex = 0; int quizGradeIndex = 0; int homeworkGradeIndex = 0; int gradeAverageIndex = 0; //for loop for the output of exams, quizzes, homework, and grade average for(in…
tagged with: java

http://stackoverflow.com/comment/42999603
type: AnswerComment
has text: If system has not enough memory to extend heap size (any part of heap), it will cause JVM termination in case HotSpot JVM.
type: Comment
comment on: http://stackoverflow.com/a/27251109
score: 0

http://stackoverflow.com/q/27239051
has comment: http://stackoverflow.com/comment/42954684
type: Question
tagged with: java
upvote count: 6
tagged with: start-stop-daemon
has comment: http://stackoverflow.com/comment/42955288
has title: Debian start-stop-daemon. Java start jar File
answer count: 1
tagged with: jar
has body: I have this command in a shellscript in /etc/init.d/ start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid --background --exec /usr/bin/java -jar /home/username/myjar.jar If i execute this i get this error start-stop-daemon: unable to stat /usr/bin/java -jar /home/username/myjar.jar (No such file or directory) If i execute /usr/bin/java -jar /home/username/myjar.jar in the commandline everything is fine .. i don't get my mistake :(
has comment: http://stackoverflow.com/comment/42954706
favorite count: 0
tagged with: debian
has comment: http://stackoverflow.com/comment/42955196
tagged with: service
has answer: http://stackoverflow.com/a/27239133
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27239133
has comment: http://stackoverflow.com/comment/42955544
has comment: http://stackoverflow.com/comment/42955170
downvote count: 0
score: 6

http://stackoverflow.com/comment/42962547
comment on: http://stackoverflow.com/a/27231946
has text: That's the problem I guess. It doesn't. In the single model version it does, in the tri-module one it doesn't. I just can't figure out why. The code is the same and the modules are build succesfully, the dependency between them seems to be also good, judging by the maven tree..
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43057648
comment on: http://stackoverflow.com/q/27278816
score: 0
type: Comment
type: QuestionComment
has text: Okay - adding it as an actual answer.

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/27178062
tags question: http://stackoverflow.com/q/27219898
tags question: http://stackoverflow.com/q/27220992
tags question: http://stackoverflow.com/q/27153037
tags question: http://stackoverflow.com/q/27246060
tags question: http://stackoverflow.com/q/27219336
tags question: http://stackoverflow.com/q/27189824
tags question: http://stackoverflow.com/q/27239791
tags question: http://stackoverflow.com/q/27186492
tags question: http://stackoverflow.com/q/27311256
tags question: http://stackoverflow.com/q/27300899
tags question: http://stackoverflow.com/q/27195679
tags question: http://stackoverflow.com/q/27263290
tags question: http://stackoverflow.com/q/27244369
tags question: http://stackoverflow.com/q/27223838
tags question: http://stackoverflow.com/q/27287802
tags question: http://stackoverflow.com/q/27273105
tags question: http://stackoverflow.com/q/27217657
type: Tag
tags question: http://stackoverflow.com/q/27264068
tags question: http://stackoverflow.com/q/27184083
tags question: http://stackoverflow.com/q/27178658
tags question: http://stackoverflow.com/q/27228411
tags question: http://stackoverflow.com/q/27157909
tags question: http://stackoverflow.com/q/27209019
tags question: http://stackoverflow.com/q/27278915
tags question: http://stackoverflow.com/q/27248639
tags question: http://stackoverflow.com/q/27173606
tags question: http://stackoverflow.com/q/27252596
tags question: http://stackoverflow.com/q/27271099
tags question: http://stackoverflow.com/q/27212145
tags question: http://stackoverflow.com/q/27279542
tags question: http://stackoverflow.com/q/27170972
tags question: http://stackoverflow.com/q/27205073
tags question: http://stackoverflow.com/q/27221675
tags question: http://stackoverflow.com/q/27252591
tags question: http://stackoverflow.com/q/27216680
tags question: http://stackoverflow.com/q/27203309
tags question: http://stackoverflow.com/q/27226219
tags question: http://stackoverflow.com/q/27245669
tags question: http://stackoverflow.com/q/27192139
tags question: http://stackoverflow.com/q/27217370
tags question: http://stackoverflow.com/q/27228607
tags question: http://stackoverflow.com/q/27172991
tag name: html
tags question: http://stackoverflow.com/q/27172775
tags question: http://stackoverflow.com/q/27266439
tags question: http://stackoverflow.com/q/27154604
tags question: http://stackoverflow.com/q/27264473
tags question: http://stackoverflow.com/q/27297165
tags question: http://stackoverflow.com/q/27312151
tags question: http://stackoverflow.com/q/27269359
tags question: http://stackoverflow.com/q/27221882

http://stackoverflow.com/q/27261759
upvote count: 0
tagged with: java
tagged with: swing
type: Question
tagged with: jtextarea
has body: Hello guys i am writing a simple gui editor in java swing using JTextArea. but now i want to be able to right click and have the options to cut, copy, paste and select all and possibly change fonts. I need help in implementing the option of cutting, copying or pasting in the JTextArea. Help will be appreciated. Below is a snippet of my code: public class Example extends JPanel { private JTextArea area; private JScrollPane scpane; public Example() { super("My Text Editor"); setUp(); } private void setUp() { area = new JTextArea(); scpane= new JScrollPane(area); area.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { if(e.getButton()==MouseEvent.BUTTON3) { //having difficulty how to set up the copy, cut or paste option //with the mouse in JTextArea. } } }); } } }
score: -1
tagged with: mouseevent
has answer: http://stackoverflow.com/a/27261833
linked to: http://stackoverflow.com/q/10075147
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42996374
has title: Need help implementing mouselistener in JTextArea
favorite count: 0
type: UnansweredQuestion

ant
tags question: http://stackoverflow.com/q/27178255
tags question: http://stackoverflow.com/q/27305079
tags question: http://stackoverflow.com/q/27232662
tags question: http://stackoverflow.com/q/27178462
tags question: http://stackoverflow.com/q/27205942
tags question: http://stackoverflow.com/q/27288726
tags question: http://stackoverflow.com/q/27287541
type: Tag
tags question: http://stackoverflow.com/q/27257179
tags question: http://stackoverflow.com/q/27178870
tags question: http://stackoverflow.com/q/27286618
tags question: http://stackoverflow.com/q/27297511
tags question: http://stackoverflow.com/q/27159246
tags question: http://stackoverflow.com/q/27171708
tags question: http://stackoverflow.com/q/27290444
tag name: ant
tags question: http://stackoverflow.com/q/27206929
tags question: http://stackoverflow.com/q/27280653
tags question: http://stackoverflow.com/q/27233394
tags question: http://stackoverflow.com/q/27234250
tags question: http://stackoverflow.com/q/27259512
tags question: http://stackoverflow.com/q/27246575
tags question: http://stackoverflow.com/q/27252076
tags question: http://stackoverflow.com/q/27197005
tags question: http://stackoverflow.com/q/27157146
tags question: http://stackoverflow.com/q/27233828

http://stackoverflow.com/a/27204607
has comment: http://stackoverflow.com/comment/42892217
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42892000
has body: There are multiple ways to do this. I'll share one: String input = "HTML[0].BODY[0]/UL[1]/LI[10]/A[1]"; Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher(input); StringBuffer sb = new StringBuffer(); while (m.find()) { m.appendReplacement(sb, String.valueOf(Integer.parseInt(m.group()) + 1)); } m.appendTail(sb); String output = sb.toString(); System.out.println(output);
type: Answer
has comment: http://stackoverflow.com/comment/42892334
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27204532
has comment: http://stackoverflow.com/comment/42892109
answers question: http://stackoverflow.com/q/27204532

http://stackoverflow.com/a/27214897
has comment: http://stackoverflow.com/comment/42909819
type: Answer
has body: The problem is here: for (int index = 0; index &lt; waste.size(); index++){ wasteRecord = waste.get(index); wasteRecord.calcGrossWasteEmission(); wasteRecord.calcWasteReduction(); wasteRecord.calcNetWasteReduction(); // &lt;== netWasteReduction = grossWasteEmission = wasteReduction; }
answers question: http://stackoverflow.com/q/27214836
score: 0

http://stackoverflow.com/comment/42956324
comment on: http://stackoverflow.com/q/27231276
score: 0
type: QuestionComment
type: Comment
has text: There are system properties to set debug trace on the access controller (forget what they are off hand). Setting global state within a shared VM is a bad idea (obviously). Some instances are forbidden unless the process is unshared. (Oh, and signed doesn't necessarily mean fully trusted.)

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/27284475
tags question: http://stackoverflow.com/q/27211517
tags question: http://stackoverflow.com/q/27242725
tags question: http://stackoverflow.com/q/27236457
tags question: http://stackoverflow.com/q/27266324
tags question: http://stackoverflow.com/q/27238923
tags question: http://stackoverflow.com/q/27256293
tags question: http://stackoverflow.com/q/27258591
type: Tag
tags question: http://stackoverflow.com/q/27181442
tags question: http://stackoverflow.com/q/27224441
tags question: http://stackoverflow.com/q/27160943
tags question: http://stackoverflow.com/q/27197334
tags question: http://stackoverflow.com/q/27245900
tags question: http://stackoverflow.com/q/27159840
tags question: http://stackoverflow.com/q/27198225
tags question: http://stackoverflow.com/q/27300075
tags question: http://stackoverflow.com/q/27217106
tags question: http://stackoverflow.com/q/27228183
tags question: http://stackoverflow.com/q/27301699
tags question: http://stackoverflow.com/q/27217621
tags question: http://stackoverflow.com/q/27285564

http://stackoverflow.com/comment/43086828
has text: that seems to be a good solution(+1) (but it will require some major changes on my project). I need to deliver a working version of the project very soon so i will stick to what i already done and try to use the enums asap. will let you know. thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/27302625
type: Comment
score: 0

cucumber-jvm
tag name: cucumber-jvm
type: Tag
tags question: http://stackoverflow.com/q/27301047

http://stackoverflow.com/a/27162831
score: 0
answers question: http://stackoverflow.com/q/27162496
has body: yes I'm done ! just post here for if other people look at I was add a web.xml file like that http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> MainFilter MainFilter sleep-time-in-seconds 10 MainFilter /* welcome.html And export my web to war file in webapps folder and change to ROOT.war notice : my MainFilter in default package
type: Answer

unit-testing
tags question: http://stackoverflow.com/q/27268502
tags question: http://stackoverflow.com/q/27233070
tags question: http://stackoverflow.com/q/27289046
tags question: http://stackoverflow.com/q/27303562
tags question: http://stackoverflow.com/q/27218176
tags question: http://stackoverflow.com/q/27313635
tags question: http://stackoverflow.com/q/27153642
tags question: http://stackoverflow.com/q/27275611
tags question: http://stackoverflow.com/q/27241736
tags question: http://stackoverflow.com/q/27251102
tags question: http://stackoverflow.com/q/27266757
tags question: http://stackoverflow.com/q/27245914
tags question: http://stackoverflow.com/q/27247265
tags question: http://stackoverflow.com/q/27290213
tags question: http://stackoverflow.com/q/27210814
tags question: http://stackoverflow.com/q/27289274
tags question: http://stackoverflow.com/q/27222339
type: Tag
tags question: http://stackoverflow.com/q/27236801
tag name: unit-testing
tags question: http://stackoverflow.com/q/27279370
tags question: http://stackoverflow.com/q/27191151
tags question: http://stackoverflow.com/q/27188520
tags question: http://stackoverflow.com/q/27205678

http://stackoverflow.com/comment/94145537
score: 0
type: AnswerComment
has text: This is a pat answer and does not answer the question asked and it should never have been upvoted.
comment on: http://stackoverflow.com/a/27189307
type: Comment

http://stackoverflow.com/comment/42892503
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27204883
has text: Homework or real work or whatever, it makes no difference. You just did it for him :) An answer is deleted for a reason: I misunderstood the question at first, I thought he only needed the keys.

http://stackoverflow.com/q/27234754
score: 0
has comment: http://stackoverflow.com/comment/42946331
has comment: http://stackoverflow.com/comment/42959648
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27266230
type: Question
has comment: http://stackoverflow.com/comment/42947213
has comment: http://stackoverflow.com/comment/42946087
tagged with: windows-8
tagged with: java
has comment: http://stackoverflow.com/comment/42948221
has body: How to create a Windows 8 desktop application using JAVA as a source language ? Please tell me what tools I can use for the same ? I have done a lot of research but I cannot find a way to get out of the problem. Please help me out. Thanks in advance. And please instead of down vote this, please try to help me if you can. Take care!
answer count: 1
has title: Windows 8 Metro UI App using JAVA
favorite count: 0
has comment: http://stackoverflow.com/comment/42959634

http://stackoverflow.com/a/42935344
score: 0
type: Answer
has body: You called getChildren().remove() method directly will cause the gridpane to go out of sync with the constraints. When you add, it also setup the constraint for the node. Add clearConstraints() method.
answers question: http://stackoverflow.com/q/27154996

arrays
tags question: http://stackoverflow.com/q/27263576
tags question: http://stackoverflow.com/q/27302416
tags question: http://stackoverflow.com/q/27297186
tags question: http://stackoverflow.com/q/27285292
tags question: http://stackoverflow.com/q/27236217
tags question: http://stackoverflow.com/q/27261807
tags question: http://stackoverflow.com/q/27272945
tags question: http://stackoverflow.com/q/27209656
tags question: http://stackoverflow.com/q/27237317
tags question: http://stackoverflow.com/q/27220401
tags question: http://stackoverflow.com/q/27194486
tags question: http://stackoverflow.com/q/27208159
tags question: http://stackoverflow.com/q/27281306
tags question: http://stackoverflow.com/q/27212421
type: Tag
tags question: http://stackoverflow.com/q/27247976
tags question: http://stackoverflow.com/q/27257301
tags question: http://stackoverflow.com/q/27283458
tags question: http://stackoverflow.com/q/27239018
tags question: http://stackoverflow.com/q/27306045
tags question: http://stackoverflow.com/q/27157685
tags question: http://stackoverflow.com/q/27157585
tags question: http://stackoverflow.com/q/27265454
tags question: http://stackoverflow.com/q/27260268
tags question: http://stackoverflow.com/q/27204476
tags question: http://stackoverflow.com/q/27294761
tags question: http://stackoverflow.com/q/27180473
tags question: http://stackoverflow.com/q/27177893
tags question: http://stackoverflow.com/q/27252683
tags question: http://stackoverflow.com/q/27238168
tags question: http://stackoverflow.com/q/27209271
tags question: http://stackoverflow.com/q/27234887
tags question: http://stackoverflow.com/q/27224600
tags question: http://stackoverflow.com/q/27304471
tags question: http://stackoverflow.com/q/27166425
tags question: http://stackoverflow.com/q/27310130
tags question: http://stackoverflow.com/q/27164933
tags question: http://stackoverflow.com/q/27307716
tags question: http://stackoverflow.com/q/27259284
tags question: http://stackoverflow.com/q/27286953
tags question: http://stackoverflow.com/q/27304033
tags question: http://stackoverflow.com/q/27310547
tags question: http://stackoverflow.com/q/27283455
tags question: http://stackoverflow.com/q/27198562
tags question: http://stackoverflow.com/q/27258780
tags question: http://stackoverflow.com/q/27232630
tags question: http://stackoverflow.com/q/27219060
tags question: http://stackoverflow.com/q/27294637
tags question: http://stackoverflow.com/q/27196376
tags question: http://stackoverflow.com/q/27204308
tags question: http://stackoverflow.com/q/27263215
tags question: http://stackoverflow.com/q/27274456
tags question: http://stackoverflow.com/q/27181941
tags question: http://stackoverflow.com/q/27311979
tags question: http://stackoverflow.com/q/27169392
tags question: http://stackoverflow.com/q/27219015
tags question: http://stackoverflow.com/q/27241097
tags question: http://stackoverflow.com/q/27237945
tags question: http://stackoverflow.com/q/27238689
tags question: http://stackoverflow.com/q/27307505
tags question: http://stackoverflow.com/q/27255807
tags question: http://stackoverflow.com/q/27261929
tags question: http://stackoverflow.com/q/27157742
tags question: http://stackoverflow.com/q/27258772
tags question: http://stackoverflow.com/q/27230878
tags question: http://stackoverflow.com/q/27239990
tags question: http://stackoverflow.com/q/27234223
tags question: http://stackoverflow.com/q/27219536
tags question: http://stackoverflow.com/q/27159348
tags question: http://stackoverflow.com/q/27217989
tags question: http://stackoverflow.com/q/27218929
tags question: http://stackoverflow.com/q/27156980
tags question: http://stackoverflow.com/q/27256845
tags question: http://stackoverflow.com/q/27194633
tags question: http://stackoverflow.com/q/27240786
tags question: http://stackoverflow.com/q/27160247
tags question: http://stackoverflow.com/q/27279189
tags question: http://stackoverflow.com/q/27159485
tags question: http://stackoverflow.com/q/27205482
tags question: http://stackoverflow.com/q/27299226

android-studio
tags question: http://stackoverflow.com/q/27209221
tags question: http://stackoverflow.com/q/27219599
tags question: http://stackoverflow.com/q/27164019
tags question: http://stackoverflow.com/q/27287077
tags question: http://stackoverflow.com/q/27193761
tags question: http://stackoverflow.com/q/27215771
tags question: http://stackoverflow.com/q/27270713
tags question: http://stackoverflow.com/q/27269552
tags question: http://stackoverflow.com/q/27193596
type: Tag
tags question: http://stackoverflow.com/q/27307341
tags question: http://stackoverflow.com/q/27251365
tags question: http://stackoverflow.com/q/27246491
tags question: http://stackoverflow.com/q/27254583
tags question: http://stackoverflow.com/q/27300328
tag name: android-studio

http://stackoverflow.com/comment/64919486
has text: Yes your .iss file shouldn't be empty. When you use javapackager it will create a default .iss for you and in the output it will tell you where this .iss file is saved. Go to that folder and copy the .iss somewhere else. Then add the above line for signing exe to the beginning of the .iss file.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/36182266

http://stackoverflow.com/a/27263849
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: You want to use a Map object instead. I'm a little rusty at java, but you can define a map of beds like this: HashMap&lt;Integer,Boolean&gt; occupiedBeds; and then you can check if an entry is true to see if a bed is occupied, and then set it to false when you discharge a patient. You can initialize the occupiedBeds to a range of false values, or you can just assume an "unset" state means that nobody is in the bed.
answers question: http://stackoverflow.com/q/27263790

http://stackoverflow.com/a/27184281
has body: if you want to redirect to action then you change this /transaction-result.jsp /index.jsp to /transaction-result.jsp ActionToberedireected Give action instead of index.jsp to which you want to redirect ..
type: Answer
answers question: http://stackoverflow.com/q/27183847
score: 0

http://stackoverflow.com/comment/42870137
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27191980
has text: If you want to see selections changing in a view you will have to use `ISelectionService.addSelectionListener`. To see view parts opening and closing use `IWorkbenchPage.addPartListener`.

http://stackoverflow.com/comment/43072812
type: Comment
has text: Then i don't think its an issue from passing a string... Its probably related to your sql query
comment on: http://stackoverflow.com/a/27243686
type: AnswerComment
score: 0

http://stackoverflow.com/a/27220567
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42920781
has comment: http://stackoverflow.com/comment/43020497
type: Answer
has comment: http://stackoverflow.com/comment/42920225
accepted answer of: http://stackoverflow.com/q/27208615
answers question: http://stackoverflow.com/q/27208615
has comment: http://stackoverflow.com/comment/42921783
upvote count: 5
has body: The Parser classes have been added only after version 2.5.0, but you're declaring dependency on protobuf v2.4.1. You're probably compiling your .proto files with a later version of the compiler than what are the runtime classes you're adding to your POM file. Update your dependency / downgrade your protoc compiler and everything will work just fine.
score: 5

http://stackoverflow.com/comment/42977175
comment on: http://stackoverflow.com/q/27251392
has text: The best approach is to bite the bullet and convert this to idiomatic Java code. Make a class with instance variables `a`, `b`, and `c`, and have `makeStep()` operate on its member values. Relying on "crutch solutions", such as passing single-element arrays, may be OK for short, one-time hacks, but its an awful approach in the long run.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47445419
type: AnswerComment
has text: Thanks a lot. This can be very userful
type: Comment
comment on: http://stackoverflow.com/a/29383896
score: 0

http://stackoverflow.com/q/27283474
tagged with: transfer
type: UnansweredQuestion
tagged with: file
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43035415
has body: I'm trying to execute the below code to transfer a file from android emulator to pc. The application force closes and i see the following error message in logcat: 12-03 16:56:33.503: D/AndroidRuntime(1145): Shutting down VM 12-03 16:56:33.503: D/AndroidRuntime(1145): --------- beginning of crash 12-03 16:56:33.517: E/AndroidRuntime(1145): FATAL EXCEPTION: main 12-03 16:56:33.517: E/AndroidRuntime(1145): Process: com.example.androidfiletransfer, PID: 1145 12-03 16:56:33.517: E/AndroidRuntime(1145): java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.OutputStream java.net.Socket.getOutputStream()' on a null object reference 12-03 16:56:33.517: E/AndroidRuntime(1145): at com.example.androidfiletransfer.MainActivity$1.onClick(MainActivity.java:77) 12-03 16:56:33.517: E/AndroidRuntime(1145): at android.view.View.performClick(View.java:4756) 12-03 16:56:33.517: E/AndroidRuntime(1145): at android.view.View$PerformClick.run(View.java:19749) 12-03 16:56:33.517: E/AndroidRuntime(1145): at android.os.Handler.handleCallback(Handler.java:739) And the following message in the console: Server started. Listening to the port 4444 Receiving... mybytearray: 100000000 current: -1 bytes read: -1 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at java.io.BufferedOutputStream.write(Unknown Source) at Javafilereceive.main(Javafilereceive.java:53) I tried researching on this error but im unable to resolve it. Since im new to android, it would be of great help if someone could help me out with this. Client side code: package com.example.androidfiletransfer; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.os.StrictMode; im…
answer count: 1
favorite count: 0
has title: Transfer file from android to pc using socket programming
score: 0
has answer: http://stackoverflow.com/a/27283587
tagged with: sockets
tagged with: android

http://stackoverflow.com/q/27162374
type: Question
accepted answer: http://stackoverflow.com/a/27163223
score: 8
tagged with: java
tagged with: idle-processing
has comment: http://stackoverflow.com/comment/42818181
answer count: 1
downvote count: 0
favorite count: 0
has title: JavaFX 2 User Idle Detection
upvote count: 8
has answer: http://stackoverflow.com/a/27163223
has body: I'm trying to make a simple Java transaction app with JavaFX as UI. What I want to do now is to detect user idle state from my application which has 1 primary stage and many scenes. Example : if user idle for 3 minutes then go back to main menu. I already try some examples on the web about how to detect JavaFX idle state, but what I found is always -one function idle state detection which is occuring all scenes- method which is (I think) dangerous for transaction app (ex : apps detect idle state in the middle of transaction process). It's possible to detect user idle state on every single scene? how? Thanks. EDIT : Examples that I already try : http://tomasmikula.github.io/blog/2014/06/04/timers-in-javafx-and-reactfx.html and http://ochafik.com/blog/?p=98
tagged with: javafx-2
type: AnsweredQuestion
tagged with: javafx

http://stackoverflow.com/comment/42904498
score: 0
has text: I second @a_horse_with_no_name's comment. With the [jOOQ](http://www.jooq.org) integration tests, we didn't run into any issues when using `\n` as a line separator in 17 popular RDBMS...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27211762

http://stackoverflow.com/q/27258772
has body: I have array File[] polFiles. Some files can be deleted by another function and I write function to clean remote files from an array. For example, if there was P0, P1, P2, P3, P4 in File [] polFiles, and were deleted by P1 and P2, now polFiles shall consist of P0, P2 and P4. How to make it? I wrote simple code but it throws any way exceptions and errors. int delcount = 0; for (File file : files) { if (!file.exists()) { delcount++; } } File[] newfiles = new File[files.length-delcount]; int fcount = 0; for (int i = 0; i &lt; newfiles.length; i++) { if (!files[i].exists()) { fcount++; for (int j = i; j &lt; files.length-fcount-1; j++) { newfiles[j] = files[j+fcount]; } } else { newfiles[i] = files[i+fcount]; } } System.arraycopy(newfiles, 0, files, 0, newfiles.length); for (int i = newfiles.length; i &lt; files.length; i++) { files[i] = null; } Where is a mistake? This code throws Null exception and don't correctly work. It deletes only first file from array
has comment: http://stackoverflow.com/comment/42991246
type: AnsweredQuestion
tagged with: java
has title: Java - delete some files from File[] array
has comment: http://stackoverflow.com/comment/42991799
has answer: http://stackoverflow.com/a/27259778
type: Question
answer count: 2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/27258965
has comment: http://stackoverflow.com/comment/42991371
has comment: http://stackoverflow.com/comment/42991929
has answer: http://stackoverflow.com/a/27258965
score: 0
accepted answer: http://stackoverflow.com/a/27259778
has comment: http://stackoverflow.com/comment/42991112
has comment: http://stackoverflow.com/comment/42991682

http://stackoverflow.com/a/27187348
upvote count: 2
score: 2
downvote count: 0
has body: StringBuilder.equals() actually exists, but it does not compare the Strings. From a Java perspective, this is the correct approach. StringBuilders mutate, that's their purpose, which makes two different StringBuilder objects un-equal by definition. Most newer Java APIs follow the approach that equal() is implemented for immutable or final classes, although there are exceptions. Mutable classes, on the other hand, usually simply inherit Object.equals() which relies on object-identity. There are at least two reasons behind this. One is the ability to properly use objects in hash-based data structures, i.e. as value in a HashSet or a key in a HashMap. Although this depends on Object.hashCode(), it affects Object.equals() because the hashCode should be stable over an object's life time if it is to be used as an entry in a hash-based datastructure, and equals() is defined to be consistent with hashCode(). The other is that Object.equals() is defined to be symmetrical, and carelessly overriding Object.equals() can break that symmetry. All in all, in Java, Object.equals() shouldn't be understood as value-equality but as equality according to the nature of the instances.
type: Answer
answers question: http://stackoverflow.com/q/27186075

http://stackoverflow.com/q/27165585
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42823538
tagged with: web-services
has title: JAXB element possibly altering encoding of string
type: Question
has body: I've created a web service and generated java files using the CXF wsdl2java tool. Now the parameters passed are stored as JAXBElements. When I send the values (in arabic) to my web service class they show as question marks. However when I print the value of the JAXBElement before it reaches my web service it's correct. Is the encoding changing between my test client and the web service? and if so how can I preserve the arabic characters?
linked to: http://stackoverflow.com/q/21018152
has comment: http://stackoverflow.com/comment/42833671
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/42830738
score: 0
has comment: http://stackoverflow.com/comment/42833843
has comment: http://stackoverflow.com/comment/42823679
has comment: http://stackoverflow.com/comment/42823687
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: cxf

http://stackoverflow.com/comment/42982808
score: 0
type: AnswerComment
type: Comment
has text: I did, and I have no problem connecting to the DB with the user specified in the config file.
comment on: http://stackoverflow.com/a/27245926

http://stackoverflow.com/comment/42871465
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27192931
has text: The database doesn't know what "\n" is. But it does know what CHAR(13) is.

http://stackoverflow.com/a/27263936
type: Answer
accepted answer of: http://stackoverflow.com/q/27198370
answers question: http://stackoverflow.com/q/27198370
score: 0
has body: Here is the implementation I came up with for this code: try (ByteArrayOutputStream plainTextStream = new ByteArrayOutputStream()) { // -- c# like CryptoStream try (CipherOutputStream decrypterStream = new CipherOutputStream(plainTextStream, cipher)) { // -- binaryWriter like c# try (DataOutputStream binaryWriter = new DataOutputStream(decrypterStream)) { // -- Encrypt Data //Decrypt Cipher Text from Message binaryWriter.write(encryptedMessage, nonSecretPayloadLength + iv.length, encryptedMessage.length - nonSecretPayloadLength - iv.length - sentTag.length); } //Return Plain Text //decrypterStream.flush(); } finally { return plainTextStream.toByteArray(); } } catch (IOException e) { e.printStackTrace(); }
type: AcceptedAnswer

http://stackoverflow.com/q/27200649
tagged with: java
has body: This is the code: public class MainActivity extends Activity { private TextView textView2; private Button button2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView2=(TextView)findViewById(R.id.textView1); button2=(Button)findViewById(R.id.button1); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url="http://stackoverflow.com/"; try{ Document doc=Jsoup.connect(url).get(); Elements elem=doc.select("meta[name=twitter:domain]"); String title1=elem.attr("content"); textView2.setText(title1); } catch(Exception e){ } } }); }} This is the xml code: &lt;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.example.jsouptest.MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="111dp" android:text="TextView" android:textSize="100dp" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignParentTop="true" android:layout_marginLeft="22dp" android:layout_marginTop="34dp" android:text="Display" /&gt; It isn't displaying the content in the textview on clicking the button. I have added permission for internet in the manifest file.
type: Question
tagged with: jsoup
answer count: 1
has comment: http://stackoverflow.com/comment/42884986
score: 0
has title: What is wrong in this jsoup code? (Android)
tagged with: android
has comment: http://stackoverflow.com/comment/42885018
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27200927
has comment: http://stackoverflow.com/comment/42885067
has comment: http://stackoverflow.com/comment/42885089

http://stackoverflow.com/a/27246597
has comment: http://stackoverflow.com/comment/42969130
answers question: http://stackoverflow.com/q/27246277
has comment: http://stackoverflow.com/comment/42968422
has comment: http://stackoverflow.com/comment/42968797
type: Answer
has comment: http://stackoverflow.com/comment/42968203
has comment: http://stackoverflow.com/comment/42969054
has comment: http://stackoverflow.com/comment/42969309
upvote count: 1
has comment: http://stackoverflow.com/comment/42968313
has comment: http://stackoverflow.com/comment/42968603
has comment: http://stackoverflow.com/comment/42969372
has comment: http://stackoverflow.com/comment/42968358
score: 1
has comment: http://stackoverflow.com/comment/42968189
downvote count: 0
has body: You could get an arbitrary amount of Teachers, and then check if the amount of Teachers is at least 1: private Set&lt;Teacher&gt; teachers; public DespachoImpl(String nombre, Integer planta, Integer aforo, Teacher... teachers) { super(TipoLugar.OTRO, nombre, planta, aforo); if (teachers.length == 0) { throw new IllegalArgumentException("No teachers given"); } this.teachers = new HashSet&lt;Teacher&gt;(); this.teachers.addAll(Arrays.asList(teachers)); } If two constructors are a requirement, then this is a way of doing it: private Set&lt;Teacher&gt; teachers; public DespachoImpl(String nombre, Integer planta, Integer aforo, Teacher teacher) { this(nombre, planta, aforo, new Teacher[] { teacher }); } public DespachoImpl(String nombre, Integer planta, Integer aforo, Teacher[] teachers) { super(TipoLugar.OTRO, nombre, planta, aforo); if (teachers.length == 0) { throw new IllegalArgumentException("No teachers given"); } this.teachers = new HashSet&lt;Teacher&gt;(); this.teachers.addAll(Arrays.asList(teachers)); } This seems very stupid to me, but it's necessary for the first constructor to be able to call the second one. Other than that, It's an equally solid solution as the first one.

http://stackoverflow.com/a/27286617
has comment: http://stackoverflow.com/comment/54024247
has comment: http://stackoverflow.com/comment/43042916
has comment: http://stackoverflow.com/comment/43050048
has comment: http://stackoverflow.com/comment/43043314
has comment: http://stackoverflow.com/comment/43080918
has comment: http://stackoverflow.com/comment/43042871
has comment: http://stackoverflow.com/comment/43047718
has comment: http://stackoverflow.com/comment/43084075
has comment: http://stackoverflow.com/comment/43044971
answers question: http://stackoverflow.com/q/27286434
has comment: http://stackoverflow.com/comment/43047569
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43049976
has comment: http://stackoverflow.com/comment/43054139
has comment: http://stackoverflow.com/comment/43047867
has body: The simplest way I could suggest is to override/modify .get() method of "tosPrint". You must handle exception in this method it self. If you like this approach please show more code behind and after of what you shared above. See below code sample for help: Create a class variable tosPrint. Create a private get method in your class. You must tryout in this way as code given below. I don't have a JVM installed on my machine right now. Please cooperate with compilation errors. public class PrintingMsgs{ private TosPrint tosPrint; /*Here you wrap the get() method of third party jar */ private String get(String str){ try{ return tosPrint.get(str).toString(); } catch (JSONException e) { e.printStackTrace(); LogWriter.LogErrorMessage(e); } return null; } mainMethod(){ tosPrint = new TosPrint(); Printmsg printmsg= new Printmsg(); printmsg.setGatepass(get("gatepass")); printmsg.setTransactionType(get("transactionType")); printmsg.setContainer(get("container")); printmsg.setSsco(get("ssco")); printmsg.setWgt(get("wgt")); printmsg.setTruckingcmpny(get("truckingCompany")); printmsg.setIssuetime(get("issueTime")); printmsg.setLicense(get("driverLicense")); printmsg.setChasis(get("chasis")); try{ descNodes = tosPrint.getJSONObject("description"); linelist = descNodes.getJSONArray("eachLine"); printmsg.setDescription_lines(new String[linelist.length()]); for (int i=0;i&lt;linelist.length(); i++) { printmsg.getDescription_lines()[i]= linelist.getString(i); } } catch (JSONException e) { e.printStackTrace(); LogWriter.LogErrorMessage(e); } } }
has comment: http://stackoverflow.com/comment/43050019

http://stackoverflow.com/q/27263563
accepted answer: http://stackoverflow.com/a/27263631
has title: JTextField won't disappear completely
has answer: http://stackoverflow.com/a/27263780
type: AnsweredQuestion
tagged with: dialog
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27263780
tagged with: jtextfield
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27263631
has comment: http://stackoverflow.com/comment/42999420
has body: I created a dialog box and have the user enter 5 colors in it from memory. That all completely works, there's just a slight aesthetic problem. Upon entering all 5 colors correctly, or getting one incorrect, it's suppose to wipe the contents within the dialog box and print a message "Sorry! Incorrect color" or "Congratulations". It prints the message, but the JTextField can still be seen somewhat behind the message (A left over portion/clipping). I've tried using the hide() and remove() methods but they didn't seem to work (Or I'm using them incorrectly), I tried re-making a dialog box upon either but I couldn't seem to solve the issue still. What am I doing wrong/how can I make the JTextField disappear upon completion? Thank you in advance for any help! Here's the portion where if the user enters a color incorrectly or gets them all correct (txtName is the JTextField): if(count == 6)//User either finished or entered a color incorrectly { //Entered color incorrectly if(incorrect == true) { txtName.setEnabled(false); //Doesn't work homeScreen.remove(txtName); //Doesn't work labelName.setText("Incorrect! Sorry - Wrong color."); //txtName.removeActionListener(new MyButtonListener()); } else//Correctly finished the game. { labelName.setText("Congratulations - your memory skills are perfect!"); //txtName.removeActionListener(new MyButtonListener()); homeScreen.remove(txtName);//Doesn't work } } Here's my entire program (I can't get it format properly in the post): package memorygame; import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.FlowLayout; public class MemoryGame { private JFrame homeScreen; private JLabel labelName; private JTextField txtName; private JLabel correct; Vector&lt;String&gt; name = new Vector(); private int count = 1; private MyButtonListener listen1 = new MyButtonListener(); //Constructor - Method to be called when MemoryGame object called public void MemoryGame () { homeScreen = new JFrame(); homeScr…

http://stackoverflow.com/comment/43066152
comment on: http://stackoverflow.com/q/27301110
type: Comment
type: QuestionComment
has text: setContentView(R.layout.activity_main); doesn't have the ID of pager. setContentView(R.layout.round_activity_main); does have it. Thanks for catching my stupid errors!
score: 0

http://stackoverflow.com/q/27278449
tagged with: abstract-class
has body: I'm currently trying to get the hang of inheritance and implementation but I can't get my head around why I need to implement interfaces, and why they aren't just normal methods. Here is the code I'm currently writing that brought me to these questions, I'm trying to extend the ArrayList class so that elements are automatically sorted when entered. import java.util.ArrayList; import java.util.*; import java.util.Comparator; /** * extending to ArrayList */ public abstract class SortedArrayList&lt;E&gt; extends ArrayList&lt;E&gt; implements Comparator&lt;E&gt; { /** * Constructing the super */ public SortedArrayList() { super(); } public void insertAndSort (E element){ if (isEmpty()){ add(element); } for ( int i = 0; i &lt; size(); i++){ E otherElement = get(i); if(compare(element, otherElement) &gt; 0){ add(i+1, element); } if(compare(element, otherElement) &lt; 0) { add(i-1, element); } } } } note: I'm aware it's bad practice to extend an arrayList, it's just something I have to do. Also I'm not allowed to use sort(). I want to use the comparator to sort the ArrayList so I needed to implement it. However it wouldn't let me implement it without making the class abstract. I did so and although it meant I no longer get compiler errors I don't fully understand what it means to make an abstract class and what repercussions it will have. Am I doing the right thing? Thanks.
has comment: http://stackoverflow.com/comment/43026259
linked to: http://stackoverflow.com/q/19758055
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43025816
has title: Why can't I use the compare() method without making my class abstract?
has comment: http://stackoverflow.com/comment/43025888
has answer: http://stackoverflow.com/a/27278579
tagged with: java
has answer: http://stackoverflow.com/a/27279197
type: Question
has comment: http://stackoverflow.com/comment/43026090
tagged with: comparator
answer count: 2
tagged with: inheritance
has comment: http://stackoverflow.com/comment/43025887
score: 0

http://stackoverflow.com/q/27183641
has answer: http://stackoverflow.com/a/27189708
upvote count: 2
has comment: http://stackoverflow.com/comment/42884726
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42872272
has comment: http://stackoverflow.com/comment/42857263
tagged with: apache-spark-mllib
has body: I have source that uses Apache Spark. The source is written in Scala and I want to convert it to Java. Is it possible to convert to Java from all Scala source?
has comment: http://stackoverflow.com/comment/42890289
type: Question
has comment: http://stackoverflow.com/comment/42885747
has comment: http://stackoverflow.com/comment/42855722
has answer: http://stackoverflow.com/a/27185982
has comment: http://stackoverflow.com/comment/42871274
has comment: http://stackoverflow.com/comment/42889501
has answer: http://stackoverflow.com/a/27206042
score: 0
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/42872405
favorite count: 0
has answer: http://stackoverflow.com/a/27185590
type: UnansweredQuestion
tagged with: scala
has title: Can Spark code in Scala be converted to Java?
answer count: 4
has comment: http://stackoverflow.com/comment/42858858

http://stackoverflow.com/comment/42896940
score: 0
has text: You have a collection of collections and want to convert it to a collection? That's called "flattening". Where does `Arrays.asList` come into it? You don't have an array...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27207523

integer
tags question: http://stackoverflow.com/q/27209852
tags question: http://stackoverflow.com/q/27240357
tags question: http://stackoverflow.com/q/27207523
tags question: http://stackoverflow.com/q/27263070
tags question: http://stackoverflow.com/q/27256423
tags question: http://stackoverflow.com/q/27171901
tags question: http://stackoverflow.com/q/27199128
tags question: http://stackoverflow.com/q/27205268
tags question: http://stackoverflow.com/q/27238230
tags question: http://stackoverflow.com/q/27308891
tags question: http://stackoverflow.com/q/27211076
tag name: integer
tags question: http://stackoverflow.com/q/27217321
type: Tag

http://stackoverflow.com/a/27272594
has comment: http://stackoverflow.com/comment/43016465
type: Answer
has comment: http://stackoverflow.com/comment/43018204
has comment: http://stackoverflow.com/comment/43015765
score: 1
has comment: http://stackoverflow.com/comment/43016379
upvote count: 1
has body: Start back at the basics. The only two reasons for ClassNotFoundException are that the class does not exist, or the configuration of the runtime does not include the correct pointer to where the class exists. Figure out where your development system expects class files to be for your project. Someone well-versed in eclipse could tell you exactly where this is configured, or the various places where it can be configured, I can't off the top of my head. Depending on how you're running Tomcat, it might not be an eclipse thing; running Tomcat as a separate program would decouple it from eclipse config, for instance. Another possible way to do this is, when it is working, search the entire disk for the .class file for the class that shows up missing (or one of them, you aren't clear about whether it is always the same file). There may be multiple copies of it, note them all. The next time it isn't working, do the same search. I am assuming you do not package the class files into jars in the development environment. If that's so, then the two searches should tell you where the class file is supposed to be but is not. Perhaps you can work backwards from there to figure out why it seems random, which process is supposed to put it there but does not. I don't think it is actually random, and I don't think it's eclipse. I think out of the 10-20 times you clean and restart something different is going on. I hope you have verified, too, that you are not running out of disk space or ignoring logs that would indicate compilation problems.
has comment: http://stackoverflow.com/comment/43017694
has comment: http://stackoverflow.com/comment/43015333
answers question: http://stackoverflow.com/q/27271625
downvote count: 0

http://stackoverflow.com/a/27303510
has body: Your current approach isn't working because you're checking to see if the two BitSets that represent your input strings are equal, which they won't be unless the two strings have exactly the same letters. I don't think sorting the letters in the strings will work either. You won't find the sequence "abc" in the sequence "aabbcc" even though both strings are sorted. A better approach might be to create a HashMap from each string with each letter as the key and the number of times it occurs as the value. Then check the 1st word to make sure it has enough occurences of each letter to hide the 2nd word.
score: 0
answers question: http://stackoverflow.com/q/27303252
type: Answer

http://stackoverflow.com/q/27174178
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27174280
tagged with: jdbc
favorite count: 0
has title: Java JDBC: how to get int size of table, by exectuning SQL query
type: UnansweredQuestion
has body: Part of my code looks like this: int size = 0; try { String query = "SELECT count(*) FROM users"; statement = connection.prepareStatement(query); statement.execute(query); I don't know what to do to set size of table to my int size.
has answer: http://stackoverflow.com/a/27174319
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/42985118
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27255598
score: 1
has text: The constructor for DefaultTableModel that accepts 2 vectors is expecting the second vector to contain Strings. You are not putting Strings into the dat vector.

http://stackoverflow.com/comment/43007445
type: Comment
has text: So as I said: If it is result of an API call (here intent.getStringArrayExtra()) you have to be sure it is not NULL or add a check condition. Who fills this Intent?
comment on: http://stackoverflow.com/q/27267725
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42984280
score: 0
type: Comment
type: QuestionComment
has text: If the perfect solution existed, don't you think it would already be built into Selenium?
comment on: http://stackoverflow.com/q/27254416

http://stackoverflow.com/comment/42877544
comment on: http://stackoverflow.com/a/27196162
type: Comment
score: 1
type: AnswerComment
has text: Thank you, could you explain why though count would be equal to 0? I was using count to determine how many words only differed by one letter, so if `count==0`, and you print that you found first difference, that doesn't really make sense to me.

audio
tags question: http://stackoverflow.com/q/27230694
tags question: http://stackoverflow.com/q/27167055
tags question: http://stackoverflow.com/q/27219857
tags question: http://stackoverflow.com/q/27290074
tags question: http://stackoverflow.com/q/27208568
tags question: http://stackoverflow.com/q/27296929
tags question: http://stackoverflow.com/q/27181991
tags question: http://stackoverflow.com/q/27233623
tags question: http://stackoverflow.com/q/27300162
type: Tag
tag name: audio
tags question: http://stackoverflow.com/q/27305657
tags question: http://stackoverflow.com/q/27208201
tags question: http://stackoverflow.com/q/27283729
tags question: http://stackoverflow.com/q/27298705
tags question: http://stackoverflow.com/q/27289622
tags question: http://stackoverflow.com/q/27164379
tags question: http://stackoverflow.com/q/27205306
tags question: http://stackoverflow.com/q/27284688

http://stackoverflow.com/a/27161503
has comment: http://stackoverflow.com/comment/42847748
upvote count: 5
has body: You'll be throwing away the instances, but sure list.stream().filter(c2 -&gt; "value".equals(new C1(c2).getProperty())).collect(toList()); This does seem kind of backwards. Perhaps the logic for this property should go in the C2 class or some utility class (static method) or instance that provides the property for a given C2 instance.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42853727
type: Answer
accepted answer of: http://stackoverflow.com/q/27161463
answers question: http://stackoverflow.com/q/27161463
score: 5

http://stackoverflow.com/q/27231518
upvote count: 1
has body: I have many hashmaps which have been serialized and dumped to a text file using python. I am trying to use gson to deserialize this data into objects. The serialization works fine for small-sized files(~MBs) but gives error for files of giga-bytes size. The error is: Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 1230 path $. at com.google.gson.Gson.fromJson(Gson.java:825) at ReadFromJson.main(ReadFromJson.java:47) Caused by: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 1230 path $. at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1573) at com.google.gson.stream.JsonReader.nextQuotedValue(JsonReader.java:1031) at com.google.gson.stream.JsonReader.nextString(JsonReader.java:827) at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:358) at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:346) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) at com.google.gson.Gson.fromJson(Gson.java:810)
has answer: http://stackoverflow.com/a/27232440
accepted answer: http://stackoverflow.com/a/27232440
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42941455
favorite count: 0
tagged with: serialization
type: Question
has title: Serializing gigabytes of python object in Java using gson
tagged with: bigdata
tagged with: python
answer count: 1
tagged with: java
tagged with: gson

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

http://stackoverflow.com/comment/43047914
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27283022
has text: Which version of OrientDB do you have?

http://stackoverflow.com/q/27256845
has answer: http://stackoverflow.com/a/27256953
downvote count: 2
tagged with: recursion
score: -2
tagged with: java
has body: I have finished the first part of a homework assignment and I'm starting to get stuck (partially confused on the instructions. I currently have some completed code: import java.util.*; import java.util.ArrayList; public class ListMethods { public static ArrayList&lt;Integer&gt; makeList(int n) { ArrayList&lt;Integer&gt; tempList = new ArrayList&lt;Integer&gt;(); if (n &lt;= 0) // The smallest list we can make { return tempList; } else // All other size lists are created here { } return tempList; } } public class ListMethodRunner { public static void main(String[] args) { ArrayList&lt;Integer&gt; tempList = ListMethods.makeList(0); if(tempList.size() == 0) { System.out.println("The list is empty."); } else { for(Integer i: tempList) { System.out.println(i); } } } } The goal right now is to use these instructions: Whenever a method calls itself, the method is recursive. By calling the same method again, each instance of a problem is solved using the solution to a smaller instance. Logically, this process has to stop somewhere. In the case of our ArrayList problem, it stops when we call makeList(0). This is the problem we solved by hand in Lab 1.1. Whenever we call makeList(n - 1) we receive an ArrayList with 1, 2, 3, …, n - 1. How can we use that to produce an ArrayList with 1, 2, 3, …, n? Add that code to the else block and complete the makeList method. Test your code with the test harness by changing the argument that is passed to makeList. Can you make a list with 100 items? I need to make a list with 100 items but I don't understand how to do this with 100 items using the (n-1). If I understand this correctly, seeing as how we can't use while loops, I would use something like (int i = 0, i&lt;100, i++) right?
has answer: http://stackoverflow.com/a/27257381
type: Question
answer count: 2
upvote count: 0
tagged with: arrays
favorite count: 0
has title: Recursion - making array list with 100 integers
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42987394
type: UnansweredQuestion

http://stackoverflow.com/comment/43006087
comment on: http://stackoverflow.com/q/27267544
score: 0
type: Comment
has text: i have checked it in windows 8 for example,and it works.But it doesn't work in XP.
type: QuestionComment

textview
tags question: http://stackoverflow.com/q/27181447
tags question: http://stackoverflow.com/q/27226351
tag name: textview
type: Tag
tags question: http://stackoverflow.com/q/27241651
tags question: http://stackoverflow.com/q/27264047
tags question: http://stackoverflow.com/q/27247871
tags question: http://stackoverflow.com/q/27304344
tags question: http://stackoverflow.com/q/27254267

http://stackoverflow.com/comment/42889302
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27203236
type: Comment
has text: @fge No, you didn't understand me. Look, I mean, maybe in Java 5 there was another construct to define annotations.

http://stackoverflow.com/comment/95547761
type: Comment
has text: I think this is a separate question... https://stackoverflow.com/questions/54365079/printing-backtraces-when-debugging-java
type: AnswerComment
comment on: http://stackoverflow.com/a/27242060
score: 0

http://stackoverflow.com/comment/43036764
comment on: http://stackoverflow.com/a/27266545
type: Comment
has text: @oneofakind Did you see my comment to your other question [here](http://stackoverflow.com/questions/27261866/jdbc-postgresql-unable-to-retrieve-records#comment43010458_27261866)? Yes, there may well be something about your particular Java/JDBC configuration that is causing problems. We just need more help from you to determine what that might be.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27244965
has answer: http://stackoverflow.com/a/27249575
accepted answer: http://stackoverflow.com/a/27249575
answer count: 1
tagged with: opengl-es
favorite count: 0
type: AnsweredQuestion
tagged with: memory-management
downvote count: 0
tagged with: java
has title: Why can we directly allocate bytes in ByteBuffer but not floating Point in FloatBuffer
type: Question
score: 3
tagged with: floatbuffer
tagged with: bytebuffer
has body: In java using openGL (ES) we can directly allocate ByteBuffer like ByteBuffer bf ; bf.allocateDirect(); But we can not do that in case of FloatBuffer it is not aviliable , why is that ? I was wondering if it is because of : Byte is accessible in hardware level (as OpenGL works just above hardware unlike delvik ) and registers in hardware (hardware of GPU ) are in bytes , even floating points numbers should be stored in 4 byte register which may not be available so we cannot allocate directly , rather we should tell the buffer to allocate the memory for a block of given size and after that put the data in those blocks and treat it again as FloatBuffer.
upvote count: 3

http://stackoverflow.com/comment/55440905
type: Comment
has text: and how can you get a returning value of a method without printing out what is inside of a method? Because I am trying to return an object value in my method, but when I assign method to a variable, like `Object x = call_method();` what happens is the whole method is called again. Is there any way to avoid this?
comment on: http://stackoverflow.com/a/27162468
type: AnswerComment
score: 0

http://stackoverflow.com/a/27288083
score: 2
has body: That's something you have to implement yourself. The shuffle is probably a series of random swaps (e.g. swap 1 -> 4, swap 3 -> 2). Keep track of each element's new position (e.g. 4 3 2 1 5 for a list with 5 elements and the above shuffle operations). If any element is still at it's old place (5 in that example), keep on shuffling. Sounds like fun.
downvote count: 0
answers question: http://stackoverflow.com/q/27287935
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43051666
score: 0
type: Comment
has text: There is a ; after else if. Delete it.
type: QuestionComment
comment on: http://stackoverflow.com/q/27288946

http://stackoverflow.com/a/27310810
has body: I believe you can do this with hadoop streaming. As per tom white, author of hadoop definitive guide, 3rd edition. Page # 622, Appendix C. He used hadoop to execute a bash shell script as a mapper. In your case you need to use perl script instead of that bash shell script. Use Case: He has a lot of small files(one big tar file input), his shell script converts them into few big files(one big tar file output). He used hadoop to process them in parallel by giving bash shell script as mapper. Therefore this mapper works with input files parallely and produce results. example hadoop command:(copy pasted) hadoop jar $HADOOP_INSTALL/contrib/streaming/hadoop-*-streaming.jar \ -D mapred.reduce.tasks=0 \ -D mapred.map.tasks.speculative.execution=false \ -D mapred.task.timeout=12000000 \ -input ncdc_files.txt \ -inputformat org.apache.hadoop.mapred.lib.NLineInputFormat \ -output output \ -mapper load_ncdc_map.sh \ -file load_ncdc_map.sh Replace load_ncdc_map.sh with your xyz.perl in both places(last 2 lines in command). Replace ncdc_files.txt with another text file which contains the list of your input files to be processed.(5th line from bottom) Assumptions Taken: You have a fully functional hadoop cluster running and your perl script is error free. Please try and let me know.
upvote count: 6
has comment: http://stackoverflow.com/comment/43115613
has comment: http://stackoverflow.com/comment/43090847
has comment: http://stackoverflow.com/comment/43122370
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/43115817
answers question: http://stackoverflow.com/q/27309200
has comment: http://stackoverflow.com/comment/43091195
downvote count: 0
has comment: http://stackoverflow.com/comment/43096550

http://stackoverflow.com/comment/42945383
has text: A project for my school. I have a java file that looks at source codes of websites and looks for a keyword and displays the links that relate to those keywords. it works perfectly but i want to know how I can allow a user to go to my appspot page, type a keyword and let the java file run. grab the java results and post them to the page.
type: Comment
comment on: http://stackoverflow.com/q/27233314
score: 0
type: QuestionComment

http://stackoverflow.com/q/27268979
accepted answer: http://stackoverflow.com/a/27269413
type: AnsweredQuestion
tagged with: java
upvote count: 10
has body: I am getting an Android error, even though the error message is quite obvious, i can't figure out how to make it work properly. The error message is: java.lang.IllegalStateException: Must be called from main thread at android.app.Activity.recreate(Activity.java:4193) In my app, a notification is sent to log out a user (when his token expires). On older Android versions i am having no problems to do so, however from SDK 11 and up, i have to use the recreate() method. I get the error that it has to be called from the Main thread. I moved the recreate() statement to the MainActivity class, this doesn't work when i call the method from the IntentService. I still get the same error. The messaging part is working just fine, just the handling of the logout message is resulting in this error. Here are some snippets: inside GcmIntentService.java if (logout!=null) { VarControl.ma.logout(); } inside MainActivity.java public void logout() { deleteToken(); closeWebView(); restartApp(); } public void restartApp() { if (Build.VERSION.SDK_INT &gt;= 11) { this.recreate(); // THE ERROR OCCURS HERE } else{ //left out this part because its not relevant } } How can i call recreate from the Main thread (but the code has to be handled on receiving the intent) ??
type: Question
score: 10
answer count: 2
has answer: http://stackoverflow.com/a/27269413
downvote count: 0
possible better answer: http://stackoverflow.com/a/27269060
favorite count: 0
has answer: http://stackoverflow.com/a/27269060
has title: Android error: recreate() must be called from main thread
tagged with: android

http://stackoverflow.com/comment/43051238
score: 0
type: Comment
has text: YOU ARE THE MAN DUDE! IT WORKED. I WOULD KNOW YOU IN REAL LIFE, I WOULD BUY You a turkish kebab!!!
comment on: http://stackoverflow.com/a/27292991
type: AnswerComment

http://stackoverflow.com/comment/42833419
type: AnswerComment
type: Comment
has text: @EJP: No he doesn't, check closely.
comment on: http://stackoverflow.com/a/27160503
score: 0

http://stackoverflow.com/q/27269666
favorite count: 0
has comment: http://stackoverflow.com/comment/43009816
has comment: http://stackoverflow.com/comment/43009935
accepted answer: http://stackoverflow.com/a/27269928
upvote count: 1
has comment: http://stackoverflow.com/comment/43010026
has comment: http://stackoverflow.com/comment/43009685
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27269725
tagged with: java
has answer: http://stackoverflow.com/a/27269928
has comment: http://stackoverflow.com/comment/43009842
has comment: http://stackoverflow.com/comment/43010355
downvote count: 1
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/43009963
has answer: http://stackoverflow.com/a/27269735
has answer: http://stackoverflow.com/a/27269725
score: 0
answer count: 3
has body: i don't know what's wrong. the array should be in Number or int. here's my code: Number[] freq; int place = 0; BufferedReader br = new BufferedReader(new FileReader(new File("this.txt"))); String read; String[] temp; int num; while((read = br.readLine())!=null) { temp = read.split(","); for(int i = 0; i&lt;=temp.length; i++) { String t = temp[i]; num = Integer.parseInt(t); freq[place] = num; place++; } } System.out.println("done"); it shouldn't output some heavy result but i need it working. i always get the error variable freq might not have been initialized. freq[place] = num;
has title: adding values on array java

http://stackoverflow.com/a/27174433
score: 0
has body: It looks like you are new to languages and compilers. If you want to build a Rock Solid expression evaluator please search for "recursive descent parser" implementation in Java. Even better: build a table driven parser (eg based on JavaCC) but the learning curvevis steeper.
answers question: http://stackoverflow.com/q/27174074
type: Answer

http://stackoverflow.com/comment/43407325
type: QuestionComment
comment on: http://stackoverflow.com/q/27202184
type: Comment
has text: @fge orcale doc here https://docs.oracle.com/javase/tutorial/essential/io/path.html#relative states that a absolute path always contains the root element. So at least there they mention it
score: 5

http://stackoverflow.com/comment/42867243
type: Comment
comment on: http://stackoverflow.com/a/27190098
score: 1
type: AnswerComment
has text: Nice solution with no `StackOverFlow` Exception

http://stackoverflow.com/a/27180539
has comment: http://stackoverflow.com/comment/42849575
answers question: http://stackoverflow.com/q/27180473
has body: This private LendingItem[] signedOutItems; is equivalent to private LendingItem[] signedOutItems = null; so when you do, public LendingItem[] getSignedOutItems() { return signedOutItems; } It returns null. Initialize and add elements to your array. Something like, private LendingItem[] signedOutItems = new LendingItem[10]; creates an array with space for 10 LendingItem(s). Note that each of those 10 slots is initialized to null.
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42849564
type: Answer
score: 2

http://stackoverflow.com/comment/42856548
comment on: http://stackoverflow.com/a/27184556
has text: Your manifest is within your apk, which is signed, so changing it dynamically would invalidate the whole package. My guess is dynamically changing the manifest is not possible.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27156980
tagged with: java
has comment: http://stackoverflow.com/comment/42808170
has answer: http://stackoverflow.com/a/27157161
answer count: 2
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42808206
possible better answer: http://stackoverflow.com/a/27157269
accepted answer: http://stackoverflow.com/a/27157161
has comment: http://stackoverflow.com/comment/42808135
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27157269
tagged with: dynamic
upvote count: 2
has title: split and sort array into multiple arrays
type: Question
has body: I have a 2d array of double values and I want to split it into a bunch of arrays based on a value in the array For instance, if I had: {2, 0.0}, {3, 0.0}, {1, 0.0}, {2, 1.0}, {5, 0.0}, {7, 1.0}, {6, 2.0} I want to split this into arrays like this {0.0, 2, 3, 1, 5} {1.0, 2, 7} {2.0, 6} The arrays I am dealing with may contain several hundred lines, so it would be faster to iterate through each of these lists than checking the full array, and if the second column is the same doing something for example, iterating through the first list takes 7*6/2 = 21 comparisons iterating through the second lists takes 7 to split it up, and 7 comparisons of everything inside the lists ie. {2/3, 2/1, 2/5. 3/1, 3/5, 1/5}, {2,7}, {} How would I go about doing something like this, or is there a better way of comparing them?

http://stackoverflow.com/q/27196955
possible better answer: http://stackoverflow.com/a/27196983
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27196983
tagged with: loops
downvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27196971
tagged with: prompt
tagged with: arrays
has title: Java Program Loop won't Execute and Prompt User?
has body: Okay so I am only part of the way through my array inventory program, but my while loop that is supposed to prompt a user to re-enter a number when they have entered an invalid one will not execute. When an invalid number is entered the program just ends...I have tried a couple methods and neither are working. this is where i am at now, any ideas?? thanks much! public class InventorySystem { public static void main(String[] args) { String[] newItemInfo = new String[1000]; String[] itemDescription = new String[1000]; int[] itemPrice = new int[1000]; int choice; boolean isValid; int itemChoice; Scanner inputDevice = new Scanner(System.in); System.out.println("*****Raider Inventory System*****"); System.out.println("1. Enter a new item"); System.out.println("2. View Item Information"); System.out.println("3. View a list of all items"); System.out.println("9. End Program\n"); System.out.println("Please enter your selection: "); choice = inputDevice.nextInt(); if (choice == 1 || choice == 2 || choice == 3 || choice == 9) { isValid = true; } else { isValid = false; } ** while (isValid = false) { System.out.println("Invalid entry, please enter either 1, 2, 3, or 9 for menu options."); ** } for (int x = 0; x &lt; 1000; ++x) { if (choice == 1) { System.out.println("Please enter the name if the item: "); newItemInfo[x] = inputDevice.nextLine(); System.out.println("Please enter the item description: "); itemDescription[x] = inputDevice.nextLine(); System.out.println("Please enter item price: "); itemPrice[x] = inputDevice.nextInt(); } } if (choice == 2) { System.out.println("***Show item Description***"); System.out.println("0. "); System.out.println("please enter the item number ot view details: "); itemChoice = inputDevice.nextInt(); } if (choice == 3) { System.out.println("****Item List Report****"); } if (choice == 9) { System.exit(0); } } }
tagged with: while-loop
has answer: http://stackoverflow.com/a/27196971

http://stackoverflow.com/comment/42871378
type: QuestionComment
comment on: http://stackoverflow.com/q/27192854
score: 1
has text: @DaoWen there are still bugs / new features / changes in functionality that need to be addressed. That would make it off topic on codereview and on topic here.
type: Comment

http://stackoverflow.com/q/27182319
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42853607
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/42854825
accepted answer: http://stackoverflow.com/a/27186792
has comment: http://stackoverflow.com/comment/42855021
answer count: 1
downvote count: 0
has body: I want only images at their respective positions as in the pdf with its exact layout but I don't want text to render in it Is there any way to do it currently I am working in this way but text also coming in this way so is there any way to meet that requirement File sourceFile=new File(pdfFile); String fileName = sourceFile.getName().replace(".pdf", ""); int pageNumber = 1; for (PDPage page : li) { BufferedImage image = page.convertToImage(); File outputfile = new File(imgDes + fileName +"_"+ pageNumber +".png"); System.out.println("Image Created -&gt; "+ outputfile.getName()); ImageIO.write(image, "png", outputfile); pageNumber++; }
favorite count: 0
has title: Extract Images from PDF using pdfbox library java
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42853882
upvote count: 2
has answer: http://stackoverflow.com/a/27186792

http://stackoverflow.com/q/27211037
possible better answer: http://stackoverflow.com/a/27211121
tagged with: wear-os
type: Question
accepted answer: http://stackoverflow.com/a/27219742
has answer: http://stackoverflow.com/a/27211121
tagged with: android-fragments
has title: How to create a full screen Android Wear app without cards
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27219742
tagged with: android
type: AnsweredQuestion
has body: I'm brand new to Android programming and I'm trying to create a full screen Android Wear interface with custom layouts and no cards. I'm trying to go off the sample but I can't figure out how to get around using CardFragments. My MainActivity code is essentially identical to the example, with a few names changed. Here is the code for my GridViewPagerAdaper: public class MyGridViewPagerAdapter extends FragmentGridPagerAdapter { private final Context mContext; public MyGridViewPagerAdapter(Context ctx, FragmentManager fm) { super(fm); mContext = ctx; } static final int[] BG_IMAGES = new int[]{ R.drawable.bg, }; /** * A simple container for static data in each page */ private static class Page { int titleRes; int textRes; int iconRes; int cardGravity = Gravity.BOTTOM; boolean expansionEnabled = true; float expansionFactor = 1.0f; int expansionDirection = CardFragment.EXPAND_DOWN; public Page(int titleRes) { this.titleRes = titleRes; this.textRes = textRes; this.iconRes = iconRes; } public Page(int titleRes, int textRes, int iconRes, int gravity) { this.titleRes = titleRes; this.textRes = textRes; this.iconRes = iconRes; this.cardGravity = gravity; } } private final Page[][] PAGES = { { new Page(R.drawable.tuner), }, { new Page(R.drawable.metronome), new Page(R.drawable.metroplain) }, }; @Override public Fragment getFragment(int row, int col) { Page page = PAGES[row][col]; // String title = page.titleRes != 0 ? mContext.getString(page.titleRes) : null; // String text = page.textRes != 0 ? mContext.getString(page.textRes) : null; CardFragment fragment = CardFragment.create("", "", page.iconRes); // Advanced settings fragment.setCardGravity(page.cardGravity); fragment.setExpansionEnabled(page.expansionEnabled); fragment.setExpansionDirection(page.expansionDirection); fragment.setExpansionFactor(page.expansionFactor); return fragment; } @Override public ImageReference getBackground(int row, int column) { return ImageReference.forDrawable(BG_IMAGES[row % BG_IMAGES.length]);…
tagged with: java
linked to: http://stackoverflow.com/q/22525582

http://stackoverflow.com/q/27169192
has title: Large int on checkedId setoncheckedchangeListener
answer count: 1
has comment: http://stackoverflow.com/comment/42829895
accepted answer: http://stackoverflow.com/a/27169495
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/42830066
has body: Whenever I receive the id from the checkedId, it's a really long int for example (2131034187) even if I have declared an id for every radiobutton in the xml file. I have no idea what causes this or how to fix it. Here's my code. XML layout &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:layout_gravity="right" /&gt; &lt;RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="" /&gt; &lt;RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;RadioButton android:id="@+id/radio3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;RadioButton android:id="@+id/radio4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;RadioButton android:id="@+id/radio5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="" /&gt; &lt;/RadioGroup&gt; Java class holder.rbg = (RadioGroup)convertView.findViewById(R.id.radioGroup1); convertView.setTag(holder); holder.rbg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { Log.d("id", checkedId+""); selections[position] = checkedId; } }); Erro…
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42829834
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27169495
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/42844353
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27177777
has text: Can you share the source of your statement ?

http://stackoverflow.com/q/27195204
has answer: http://stackoverflow.com/a/27197501
has title: Scrolling down a JPanel
has comment: http://stackoverflow.com/comment/42875644
linked to: http://stackoverflow.com/q/14011492
tagged with: list
tagged with: java
accepted answer: http://stackoverflow.com/a/27197501
has comment: http://stackoverflow.com/comment/42875683
tagged with: swing
type: Question
has body: Im trying to make a dynamic list of entries for a budget program. Initially there is supposed to be 10 items in this list and i want to give the user the option to add more items and have the panel scrollable. Every item is a panel that contains 1 label and 1 textbox. My problem is i have the main panel's layout set to grid, and i have set the number of colums to 2 and the number of rows to 0, when adding an 11th item to this panel it creates a new row which is fine, except the panel's "view" widens when adding things to this panel. I'd like to have the panel's "view" to stay the same size and be able to scroll down to see its other contents. Heres my code: private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: javax.swing.JPanel newCategoryPanel = new javax.swing.JPanel(); javax.swing.JLabel newLabel = new javax.swing.JLabel(); javax.swing.JTextField newTextField = new javax.swing.JTextField(); newCategoryPanel.setLayout(new java.awt.GridLayout(1, 2)); newLabel.setText("Poop :)"); //for testing newCategoryPanel.add(newLabel); newTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { } }); newCategoryPanel.add(newTextField); panel1.add(newCategoryPanel); panel1.revalidate(); }
type: AnsweredQuestion
tagged with: jpanel
score: 0
linked to: http://stackoverflow.com/q/7229226
answer count: 1
tagged with: user-interface

http://stackoverflow.com/a/27260037
type: Answer
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/105748483
answers question: http://stackoverflow.com/q/27246610
has body: The group id should be unique across multiple domains. For example, when you do the GET request to retrieve a group, you only need to supply a group id: GET https://www.googleapis.com/admin/directory/v1/groups/YOUR_GROUP_ID No domain name is required to retrieve a group (Same for UPDATE or DELTE a group). Also be aware not to use email address of a group as a unique ID since email address can be subject to change. You can visit this section in Directory API for more information about the group.

indexof
tags question: http://stackoverflow.com/q/27201395
type: Tag
tags question: http://stackoverflow.com/q/27219917
tag name: indexof
tags question: http://stackoverflow.com/q/27178582

http://stackoverflow.com/comment/43007281
comment on: http://stackoverflow.com/a/27266666
score: 0
type: AnswerComment
type: Comment
has text: Bruce. Thanks this works great to start activity, but got another problem if you can guide me. When my app start it take sme on the first option activity automatically rather than wait for an item to be selected by me. If I press back button of mobile then it takes me to the main activity where I specified the spinner. so I dont know if it is spinner problem or it is the problem in selection item code.

http://stackoverflow.com/comment/42897060
score: 0
has text: I just posted. Please take a look. Thanks.
comment on: http://stackoverflow.com/q/27207558
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42848009
type: Comment
type: QuestionComment
score: 1
has text: part-r-000000 contains your output
comment on: http://stackoverflow.com/q/27177157

http://stackoverflow.com/comment/42918828
comment on: http://stackoverflow.com/a/27217076
has text: Yup , there are flush() and close() in my code. How can I do that?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27261950
favorite count: 0
accepted answer: http://stackoverflow.com/a/27261974
upvote count: 1
type: AnsweredQuestion
has body: I have the following Duple class, and I'm trying to write methods to perform math over both of its "cells" ((new Duple(1,2)).plus(new Duple(2,6) == new Duple(3,8)): final class Duple&lt;T,U&gt; { final T a; final U b; public Duple(T a, U b) { this.a = a; this.b = b; } public String toString() { return "(" + a + ", " + b + ")"; } /*public Duple&lt;T,U&gt; plus(Duple &lt;T,U&gt; otherDuple) { return Duple(a + otherDuple.a, b + otherDuple.b); }*/ The commented-out code gives an error because it can't guarantee that T or U will support +. Is there a way to have it do a compile time check on the parameters? I tried: public Duple&lt;T,U&gt; plus(Duple &lt;T extends Number,U extends Number&gt; otherDuple) { ... } But the compiler complains for me to delete extends. I saw an example using a user defined interfaces, but for what I need it for, that seems extreme. Basically I'm trying to emulate: plus :: (Num t, Num u) =&gt; Duple t u -&gt; Duple t u -&gt; Duple t u (x1,y1) `plus` (x2,y2) = (x1 + x2,y1 + y2) If it were written in Haskell
possible better answer: http://stackoverflow.com/a/27262429
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27262429
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27261974
downvote count: 0
has title: How can I limit a method to only accept parameters with certain restrictions?
tagged with: generics

http://stackoverflow.com/comment/43740509
type: AnswerComment
has text: That does it. I can capture the screen as a bitmap now, although having the CPU iterate through every pixel is killing my framerate. I may work on parallelizing this code to utilize all the cores of the Nexus 6.
comment on: http://stackoverflow.com/a/27638215
type: Comment
score: 0

http://stackoverflow.com/q/27216968
has answer: http://stackoverflow.com/a/27223533
has title: Headless Exception in wildfly
tagged with: wildfly-8
has body: I'm trying to develop an application which involve me show my log to my supervisor, on deployment on wildfly app server i'm getting Headless Exception. 9:26:45,480 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./RealStreamer: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./RealStreamer: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25] Caused by: java.lang.RuntimeException: java.awt.HeadlessException at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:219) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] ... 3 more Caused by: java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207) [rt.jar:1.8.0_25] at java.awt.Window.&lt;init&gt;(Window.java:536) [rt.jar:1.8.0_25] at java.awt.Frame.&lt;init&gt;(Frame.java:420) [rt.jar:1.8.0_25] at java.awt.Frame.&lt;init&gt;(Frame.java:385) [rt.jar:1.8.0_25] at javax.swing.JFrame.&lt;init&gt;(JFrame.java:181) [rt.jar:1.8.0_25] at com.prodigy4440.sever.ServerJFrame.&lt;init&gt;(ServerJFrame…
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: netbeans
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/27353928
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/27308966
has answer: http://stackoverflow.com/a/27310116
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/2811001
has comment: http://stackoverflow.com/comment/43080191
type: Question
has body: I have below xml layout from which I am suppose to extract all the "userid" value which is inside and load them to HashSet in Java <?xml version="1.0" encoding="UTF-8"?> consumerid last_set 934463448 1417753752 <key_data> userid 934463448 </key_data> 1228059948 1417753799 <key_data> userid 1228059948 </key_data> I will be getting above xml data from a url and it is possible that I can get big XML file. What is the best way to parse the above XML and extract all the "userid" and load it in the HashSet in Java? This is what I have started - public static Set<String> getUserList(String host, String count) { Set<String> usrlist = new HashSet<String>(); String url = "urlA"; // this url will return me above XML data InputStream is = new URL(url).openStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); // not sure what I should do here which can // parse my above xml and extract all the // userid and load it into usrlist hash set return usrlist; } UPDATE:- This is what I have tried - public static Set<String> getUserList() { Set<String> usrlist = new HashSet<String>(); String url = "urlA"; // this url will return me above XML data InputStream is = new URL(url).openStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new URL(url).openStream()); XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); XPathExpression expr = xpath.compile("//record/key_data/key[name='userid']/value"); NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); for (int i = 0; i < nodes.getLength(); i++) { usrlist.add(nodes.item(i).getNodeValue()); } return usrlist; } But I am not getting any user id in the usrlist object? Anything wrong I am doing here?
downvote count: 0
has comment: http://stackoverflow.com/comment/43203554
answer count: 3
has answer: http://stackoverflow.com/a/27311709
has answer: http://stackoverflow.com/a/27309028
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has title: How to parse nested XML data and extract only the userid from it?
upvote count: 3
tagged with: sax
has comment: http://stackoverflow.com/comment/43080195
has comment: http://stackoverflow.com/comment/43080214
has comment: http://stackoverflow.com/comment/43085741

http://stackoverflow.com/q/27202855
has answer: http://stackoverflow.com/a/27202878
answer count: 4
type: AnsweredQuestion
has title: How to get class'es method without importing class
has body: There is a situation: package pak1 contains some class package pak1; public class A { public void g() {} } and another package pak2 package pak2; public class B { public void f() { // here I want to call method g() from class A } } Is there any way to call class's A method g() without importing class A (and then new A().g())? If the method g() was static, I could write public void f() { pak1.A.g(); }
upvote count: 3
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27202874
tagged with: java
has answer: http://stackoverflow.com/a/69591589
score: 2
has answer: http://stackoverflow.com/a/27202876
has comment: http://stackoverflow.com/comment/42888571
favorite count: 0
tagged with: visibility
tagged with: package
accepted answer: http://stackoverflow.com/a/27202876
possible better answer: http://stackoverflow.com/a/27202878

http://stackoverflow.com/q/27163585
has title: Storing Images in java project dynamically
tagged with: java
has comment: http://stackoverflow.com/comment/42866179
type: Question
has comment: http://stackoverflow.com/comment/43086317
has answer: http://stackoverflow.com/a/27163658
tagged with: image
tagged with: struts2
has body: I am working on a website in java. When I login to that website I have use_case to fetch images from other websites and show them in my website. But the problem is that I don't want to show images by just storing URL, because the URL may change and in that case images won't be displayed. So, I want to store or write the URL as an image in a location. This way, the next time when I login my website, I wll just fetch my image from that location. So, my question is where to store these images. If I store images in Tomcat webapps folder then next time when I build my project that folder will be deleted.
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/27183917
has comment: http://stackoverflow.com/comment/42855121
has body: Is there an annotation or another method to turn the non-exhaustive switch statement warning into an error? I want a certain method or class to produce an error if not all values have been handled in the switch properly. Example: public enum E { A, B } and somewhere else in the code there is a switch on that enum like so switch (enumValue) { case A: /* do something */ break; } Java will give you a warning that this switch does not handle all the enum values. I want to turn this warning into an error (permanently, regardless of individual IDE settings). Please keep in mind that I cannot change the original enum in this case, so I want the compiler to enforce it.
downvote count: 0
accepted answer: http://stackoverflow.com/a/60761288
possible better answer: http://stackoverflow.com/a/27184080
favorite count: 0
linked to: http://stackoverflow.com/q/16797529
has answer: http://stackoverflow.com/a/27184080
has title: Force exhaustive switch
has comment: http://stackoverflow.com/comment/85014829
answer count: 4
has comment: http://stackoverflow.com/comment/42855109
has comment: http://stackoverflow.com/comment/42855084
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48916819
has comment: http://stackoverflow.com/comment/42855487
has comment: http://stackoverflow.com/comment/42855404
has comment: http://stackoverflow.com/comment/70690032
tagged with: java
has answer: http://stackoverflow.com/a/60761288
has comment: http://stackoverflow.com/comment/42855096
type: Question
tagged with: enums
upvote count: 20
has comment: http://stackoverflow.com/comment/42855486
has comment: http://stackoverflow.com/comment/42855535
has answer: http://stackoverflow.com/a/27183993
score: 20

http://stackoverflow.com/q/27179739
tagged with: swing
type: Question
tagged with: jpanel
score: 0
has body: Hi I have following classes, I want display content (paintComponentor that panel with this rectangle from paint class) inside my JFrame. I try already find out how to achieve this by looking at different examples posted on this forum however this doesn't help me I need simple example like panel inside frame with paint component or something similar to understand how should work! ps. don't hang me on tree because I am newbie jut ask question!!! [I want something like this][1] package scp; import java.awt.*; import javax.swing.*; public class Panel extends JPanel { public Panel() { //this.setPreferredSize(new Dimension(200,200)); //panel = new Panel(); setVisible(true); setLayout(new FlowLayout()); setSize(200, 300); getRootPane(); } @Override public void paintComponent(Graphics g){ g.drawString("HEY",20,20); g.drawRect(200, 200, 200, 200); } } and package scp; import javax.swing.JFrame; import javax.swing.JButton; import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.beans.EventHandler; public class Frame extends JFrame { JButton redButton; JButton blueButton; public Frame() { super("EventHandling"); setLayout(new FlowLayout()); redButton = new JButton("Red"); add(redButton); blueButton = new JButton("Blue"); add(blueButton); EventHandler h = new EventHandler(); redButton.addActionListener(h); blueButton.addActionListener(h); } private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { if (e.getSource()==redButton) getContentPane().setBackground(Color.RED); else if(e.getSource()==blueButton) getContentPane().setBackground(Color.BLUE); } } } and package scp; import javax.swing.JFrame; public class EventHandling { public static void main(String[] args) { Frame f = new Frame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800,600); f.setVisible(true); f.getContentPane().add(new Panel()); } } [1]: https://i.sstatic.net/OJTrq.png
answer count: 1
tagged with: paintcomponent
has title: JFrame, JPanel, paintComponent how to
has answer: http://stackoverflow.com/a/27179775
accepted answer: http://stackoverflow.com/a/27179775
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27173357
tagged with: guice-3
score: 0
answer count: 1
has body: I have been using Roboguice for a while but as I see the source code in github, it has a lot of unnecessary stuff that I am not typically use it or need it, so I decided to start working only with Guice. The only drawback with this is that I need to inject the Android Context and configure by myself, so I end up doing this: public class AndroidDemoApplication extends Application { private static AndroidDemoApplication instance; private static final Injector INJECTOR = Guice.createInjector(new AndroidDemoModule()); @Override public void onCreate() { super.onCreate(); instance = this; } public static Context getAppContext() { return instance; } public static void injectMembers(final Object object) { INJECTOR.injectMembers(object); } } And then in my class that extends AbstractModule: public class AndroidDemoModule extends AbstractModule { @Override protected void configure() { bind(Context.class).toProvider(new Provider&lt;Context&gt;() { @Override public Context get() { return AndroidDemoApplication.getAppContext(); } }); // .in(Singleton.class); } } Is it a good approach? For now I just only need the Context to use in let say a Session manager which needs the context to create a sharedPreference instance and play with it. Finally: is it a good approach to replace Roboguice with Guice when I only want to inject My Objects and not anything related to Android, only the Context? And use something more lightweight and less dependent than Roboguice. After all Dagger does something similar, right?
tagged with: java
tagged with: roboguice
has answer: http://stackoverflow.com/a/27179484
tagged with: guice
type: UnansweredQuestion
has title: Guice in Android without Use Roboguice, good choice?
type: Question
tagged with: android

http://stackoverflow.com/comment/43061614
comment on: http://stackoverflow.com/a/27298715
type: AnswerComment
has text: @DariuszMydlarz There's no standard way to do it. It depends on your Servlet container.
score: 0
type: Comment

http://stackoverflow.com/a/46394516
type: Answer
has body: This works for me: .and().csrf().disable(); another solution (but every form) &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt;
score: 0
answers question: http://stackoverflow.com/q/27269383

http://stackoverflow.com/comment/43159246
type: Comment
comment on: http://stackoverflow.com/a/27270025
score: 0
type: AnswerComment
has text: Thanks John for your valuable comment, may be i was missing one thing and that was injecting the class, but weld documentation says it injects into servlet by enabling a listener in to context.By the way WEB-INF listing is to long, not able to paste it here ! And how can i inject Servlet (DefaultAppController) ?

http://stackoverflow.com/a/27155379
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27155195
type: Answer
has body: For example, you can make a "resources" source folder, put files in it, then use Thread.currentThread().getContextClassLoader().getResourceAsStream("abc.txt"); I always use this method.
score: 2

http://stackoverflow.com/a/27249832
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: This worked for me! &lt;form:select path="category.categoryID" &gt; &lt;form:options items="${categoryList}" itemValue="categoryID" /&gt; &lt;/form:select&gt;
answers question: http://stackoverflow.com/q/27247955

http://stackoverflow.com/comment/61454676
type: Comment
has text: That's not accurate - you can use the interface to execute a mapped statement with a result handler without using the session.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27249714

http://stackoverflow.com/q/27157685
tagged with: java
has answer: http://stackoverflow.com/a/27157870
accepted answer: http://stackoverflow.com/a/27157870
type: Question
tagged with: arrays
score: 4
has title: Android: better way to get an integer from a spinner
answer count: 1
tagged with: spinner
favorite count: 0
tagged with: android
upvote count: 4
has body: I have a spinner filled with integer values, and I'm trying to extract the selected value. I managed to do with the following line of code: Integer.decode(spinner.getSelectedItem().toString()) but this seems like a lot of calls for what should be a simple operation. I'm creating the spinner using a string-array defined as follows: In the strings.xml 1 2 3 4 In the activity onCreate function: Spinner spinner = (Spinner) findViewById(R.id.num_cells_spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.settings_cells_array, R.layout.my_layout); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(R.layout.my_layout); // Apply the adapter to the spinner spinner.setAdapter(adapter); In my mind, since the spinner is created with a string-array, the .toString() call seems excessive, but I imagine that's leaving room for flexibility with adapters and spinners built out of custom objects or something fancy like that. Anyway, my question is this: is there a better way to extract an integer from a spinner defined this way, or alternatively, is there a better way to set up my spinner such that it plays more nicely with ints?
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/43046547
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27289864
type: Comment
has text: @Ashfaq okay.Accept the answer.It will help to someone to see your question.easy to find which answer is correct.

http://stackoverflow.com/q/27270382
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/63367650
has comment: http://stackoverflow.com/comment/63331596
has body: I am trying to copy file through FTPClient and testing in my local system My code is like this with my IPv4 address as input for host import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPReply; public class FTPUploader { FTPClient ftp = null; public FTPUploader(String host, String user, String pwd) throws Exception{ ftp = new FTPClient(); ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); int reply; ftp.connect(host); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); throw new Exception("Exception in connecting to FTP Server"); } ftp.login(user, pwd); ftp.setFileType(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); } public void uploadFile(String localFileFullName, String fileName, String hostDir) throws Exception { try(InputStream input = new FileInputStream(new File(localFileFullName))){ this.ftp.storeFile(hostDir + fileName, input); } } public void disconnect(){ if (this.ftp.isConnected()) { try { this.ftp.logout(); this.ftp.disconnect(); } catch (IOException f) { // DO NOTHING } } } public static void main(String[] args) { try{ System.out.println("Start"); FTPUploader ftpUploader = new FTPUploader("10.66.***.***", "username", "password"); ftpUploader.uploadFile("D:/Venkatesh.pptx", "65.pptx", "C:/Users/VENKATESH/Desktop"); ftpUploader.disconnect(); System.out.println("Done"); }catch(Exception exception){ exception.printStackTrace(); } } } Now by this, Iam getting the following Exception Start java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source…
type: AnsweredQuestion
has title: FTPClient Connection refused
tagged with: java
tagged with: ftp-client
has comment: http://stackoverflow.com/comment/63418159
type: Question
tagged with: apache-commons-net
has answer: http://stackoverflow.com/a/27457739
accepted answer: http://stackoverflow.com/a/27457739

http://stackoverflow.com/comment/42816346
type: QuestionComment
has text: 1- Don't directly reference the `src` directory in your code, it won't exist once the program is build. 2- Use `JButton#setIcon` to change the positions of the images as per your requirements...
score: 1
comment on: http://stackoverflow.com/q/27161375
type: Comment

http://stackoverflow.com/comment/42992341
score: 2
comment on: http://stackoverflow.com/q/27259411
has text: I think it's because the `onClick` method being called from outside of your class and then it must be public.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27224358
answers question: http://stackoverflow.com/q/27224316
has comment: http://stackoverflow.com/comment/42927003
upvote count: 1
has comment: http://stackoverflow.com/comment/42926955
has body: You can do two things: Make inputList more strongly typed. Use ArrayList&lt;String&gt; inputList in the function parameter list. Use a cast at the point of use: String URLline = (String)inputList.get(i); Be aware that (1) will cause compile time failures whereas (2) will cause runtime failures if inputList contains objects that are not String types. So (1) will give you more program stability but (2) will be easier to fit into your codebase, especially if you use your function getURLsContainingTarget in many places.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/27191204
has comment: http://stackoverflow.com/comment/42868802
has title: Is Jasypt's StrongPasswordEncryptor fundamentally flawed by it's choice of algorithm?
has comment: http://stackoverflow.com/comment/42869585
has comment: http://stackoverflow.com/comment/42868616
upvote count: 2
tagged with: security
has body: Good rule of thumb: If you need encryption, don't do it yourself. You'll get it wrong! So far so good. I was looking at Jasypt for that reason. it claims to do all the complicated stuff for you, without you needing to understand it. It offers you a class with the trustworthy name StrongPasswordEncryptor: Utility class for easily performing high-strength password digesting and checking. Still I wanted to know more about what it does, before I trust my users passwords to it. As it claims in the API: This class internally holds a StandardStringDigester configured this way: Algorithm: SHA-256. Salt size: 16 bytes. Iterations: 100000. And that's were my basic knowledge on that topic tells me: That's not how you should do it! In fact it looks to me like a naive approach. Take SHA, because MD5 is not secure any more, but better take one with a bigger number, because bigger is better there. But multiple bytes of salt in there and then run it lots of times to be harder to crack. Why do I think that is bad? SHA is basically designed to be an elaborated kind of check digit. It is meant to be fast. That is the opposite of what you want of a password hashing algorithm. You want those to be cost expansive even on hardware designed to be fast on them. In fact there is a lot of discourse on the web who good bcrypt and PBKDF2 lack some important requirements and if scrpyt should be used instead. Look at these stackexchange questions to get an idea: https://security.stackexchange.com/questions/4781/do-any-security-experts-recommend-bcrypt-for-password-storage, SHA512 vs. Blowfish and Bcrypt To give a quote from http://www.jasypt.org/howtoencryptuserpasswords.html In most cases, both MD5 or SHA-1 will be adequate choices for password digesting, although applying these algorithms will not be enough, as we will see later on. I'm passionally disagreeing in that point, because of the reasons above. Am I missing something here, or is Jasypt really selling me a fundamentally flawed algorith…
tagged with: password-encryption
downvote count: 0
tagged with: jasypt
favorite count: 0
has comment: http://stackoverflow.com/comment/42868723
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1561174
score: 2
has comment: http://stackoverflow.com/comment/42868725
answer count: 0
has comment: http://stackoverflow.com/comment/42868504
tagged with: java
type: Question

http://stackoverflow.com/q/27246796
favorite count: 0
has body: I have an object like public class Foo{ private List<List<AnotherFoo>> anotherFooList; } and I have a DTO object like public class FooDTO{ private List<List<AnotherFooDTO>> anotherFooList; } On regular dozer converter I have an exception, because this is a dozer issue like is said here: Map list of lists with Dozer So I try made a custom converter for this field threw a bean like this <constructor-arg value="[L[Lcom.bla.AnotherFoo;;" /> <constructor-arg value="[L[Lcom.bla.AnotherFooDTO;;" /> com.bla.Foo com.bla.FooDTO anotherFooListanotherFooList and my class: public class CustomConverterBean extends DozerConverter<List<List<AnotherFoo>>, List<List<AnotherFooDTO>>> { public CustomConverterBean(Class<List<List<AnotherFoo>>> prototypeA, Class<List<List<AnotherFooDTO>>> prototypeB) { super(prototypeA, prototypeB); } @Override public List<List<TrSectionDTO>> convertTo(List<List<AnotherFoo>> source, List<List<AnotherFooDTO>> destination) { if(source==null){ return null; } return null; } @Override public List<List<AnotherFoo>> convertFrom(List<List<AnotherFooDTO>> source, List<List<AnotherFoo>> destination) { return null; } } But when Trying to convert I have an exception: org.dozer.MappingException: Destination Type (java.util.List) is not accepted by this Custom Converter (com.bla.CustomConverterBean)! at org.dozer.DozerConverter.convert(DozerConverter.java:64) ... Anyone have a clue of how to solve this?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19537549
tagged with: dozer
score: 2
answer count: 0
upvote count: 2
tagged with: mappingexception
type: Question
tagged with: java
has title: Custom Converter Dozer - Exception List of List
downvote count: 0

http://stackoverflow.com/a/27398933
accepted answer of: http://stackoverflow.com/q/27180234
has body: Since I didnt find a way to tell gmail to stop blocking my own login request (It keeps blocking even after I said it was me...), I switched to yahoo smtp, and it works perfect! Here is my configuration: true true true
type: Answer
upvote count: 0
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/27180234
type: AcceptedAnswer

http://stackoverflow.com/a/27201855
has comment: http://stackoverflow.com/comment/42913160
has comment: http://stackoverflow.com/comment/42904698
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: What you could do is use the source of ConcurrentSkipListSet in OpenJDK 7, which, if you don't have or are too lazy to download, is available on GrepCode or DocJar.
has comment: http://stackoverflow.com/comment/42904488
answers question: http://stackoverflow.com/q/27198336

http://stackoverflow.com/q/27174157
has comment: http://stackoverflow.com/comment/42838222
has comment: http://stackoverflow.com/comment/42838479
has comment: http://stackoverflow.com/comment/42838320
accepted answer: http://stackoverflow.com/a/27175005
answer count: 1
tagged with: spring-form
has comment: http://stackoverflow.com/comment/42838145
tagged with: jsp
tagged with: spring-security
has body: I'm currently working on a simple SpringMVC application. I've recently started to use Spring-security. The users and their respective roles are kept in the database. My current task is to implement a "register user" form. I'm using a simple .jsp and spring forms. The users can have 2 roles : ROLE_USER and ROLE_ADMIN, and ROLE_USER is checked by default. Here are my AppUser and AppUserRoles models. AppUser.java : import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; @Entity @Table(name="appusers") public class AppUser { @Id @Column(name="USERNAME", unique = true, nullable = false, length = 45) @NotEmpty(message="Username field cannot be empty") private String username; @Column(name="PASSWORD", nullable = false, length = 60) @NotEmpty(message="Password field cannot be empty") @Size(min=6,max=10,message="Password must be between 6 and 10 letters") private String password; @NotEmpty(message="The user must have at least one defined role") @OneToMany(fetch = FetchType.LAZY, mappedBy = "appUser") private Set&lt;AppUserRole&gt; userRole = new HashSet&lt;AppUserRole&gt;(0); public AppUser() { super(); } public AppUser(String username, String password) { super(); this.username = username; this.password = password; } public AppUser(String username, String password, Set&lt;AppUserRole&gt; userRole) { super(); this.username = username; this.password = password; this.userRole = userRole; } 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; } public Set&lt;AppUserRole&gt; getUserRole() { return userRole; } public v…
score: 0
has answer: http://stackoverflow.com/a/27175005
has title: Add spring form checkbox selections to a collection and persist it
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42838413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42839399
tagged with: java
has comment: http://stackoverflow.com/comment/42839299

http://stackoverflow.com/comment/42912503
type: QuestionComment
has text: hahaha, then i think you got the point :)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27216265

http://stackoverflow.com/q/27262743
tagged with: jsp
favorite count: 0
tagged with: oracle-database
has title: Can I use the same ResultSet statement object in if-else ladder with different query?
has answer: http://stackoverflow.com/a/27263144
score: -2
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/42998039
has comment: http://stackoverflow.com/comment/42998152
accepted answer: http://stackoverflow.com/a/27263144
upvote count: 0
has body: &lt;% String s1=request.getParameter("cmpname"); String s2=request.getParameter("bname"); String s3=request.getParameter("oname"); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","manager"); Statement stmt=con.createStatement(); ResultSet rs=null; **if( !( s1.equals("") &amp;&amp; s2.equals("") &amp;&amp; s3.equals("") ))**//only this is executing { rs=stmt.executeQuery("select * from comp where operating='"+s3+"' and name='"+s1+"' and prolong='"+s2+"'"); } *else if( (s1.equals("") &amp;&amp; s2.equals("")) || (s1.equals("") &amp;&amp; s3.equals("")) || (s2.equals("") &amp;&amp; s3.equals("")) )* { if( (s1.equals("") &amp;&amp; s2.equals("")) ) rs=stmt.executeQuery("select * from comp where operating='"+s3+"'"); else if( (s1.equals("") &amp;&amp; s3.equals("")) ) rs=stmt.executeQuery("select * from comp where prolong='"+s2+"'"); else if( (s2.equals("") &amp;&amp; s3.equals("")) ) rs=stmt.executeQuery("select * from comp where name='"+s1+"'"); } *else {* if( s1.equals("")) rs=stmt.executeQuery("select * from comp where operating='"+s3+"' and prolong='"+s2+"'"); else if( s2.equals("")) rs=stmt.executeQuery("select * from comp where operating='"+s3+"' and name='"+s1+"'"); else if( s3.equals("")) rs=stmt.executeQuery("select * from comp where name='"+s1+"' and prolong='"+s2+"'"); } while(rs.next()) { String componentName=rs.getString("name"); String author=rs.getString("author"); String domain=rs.getString("domain"); String programmingL=rs.getString("prolong"); String opersys=rs.getString("operating"); String fun=rs.getString("functionality"); test=false; } %&gt; Only the first result set statement is executing. I am getting blank page when the second and third condition becomes true. Please suggest me the correct code for correct execution. Thanks in advance.
answer count: 1

http://stackoverflow.com/comment/42952978
has text: You want to read it onStart()
comment on: http://stackoverflow.com/q/27238136
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27299195
tagged with: java
has title: Elements in JList does not show up
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43078159
has comment: http://stackoverflow.com/comment/43064185
favorite count: 0
has body: I have created a Netbeans GUI with a jLabel and a jList. I am trying to show the mail subjects from my Gmail into the jList, but nothing comes up. Here's the code that I have: public class FilterExistingUI extends javax.swing.JFrame { public FilterExistingUI() { initComponents(); } static FilterExistingUI gmail = new FilterExistingUI(); @SuppressWarnings("unchecked") //program-generated private void initComponents() code private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: gmail.read(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FilterExistingUI().setVisible(true); } }); gmail.read(); } public void read() { Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { //props.load(new FileInputStream(new File("C:\\smtp.properties"))); Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.gmail.com", "gmail_id@gmail.com","password"); Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_ONLY); int messageCount = inbox.getMessageCount(); System.out.println("Total Messages:- " + messageCount); jLabel4.setText(Integer.toString(messageCount)); Message[] messages = inbox.getMessages(); System.out.println("------------------------------"); DefaultListModel listmodel = (DefaultListModel)inboxList.getModel(); listmodel.clear(); for (int i = 0; i &lt; messageCount; i++) { System.out.println("Mail Subject:- " + messages[i].getSubject()); listmodel.addElement("Subject:- " + messages[i].getSubject()); } inboxList.setModel(listmodel); inbox.close(true); store.close(); } catch (Exception e) { e.printStackTrace(); } } The System.out.println prints out the list in the output window, but when I run the program, the mail subjects list doesn't show up in the inboxList (my jList), and the message count doesn't show up in jLabel4. I have also added i…
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43077635
type: Question
score: 1

http://stackoverflow.com/a/27266590
accepted answer of: http://stackoverflow.com/q/27266542
answers question: http://stackoverflow.com/q/27266542
score: 0
type: AcceptedAnswer
type: Answer
has body: G - the letter G [0-9] - a digit .* - any sequence of characters So the expression G[0-9].* will match a letter G followed by a digit followed by any sequence of characters.

http://stackoverflow.com/comment/43430724
comment on: http://stackoverflow.com/a/27475369
type: AnswerComment
score: 0
type: Comment
has text: Selenium IDE is written in JavaScript like all Firefox extensions. The [code can be found on the Google Code page of Selenium](https://code.google.com/p/selenium/source/browse/ide/main/src/content/locatorBuilders.js?r=967286a7dc4acae58e95d53435c272a69b115d87#255). The code is under the Apache License 2.0.

http://stackoverflow.com/q/27259957
has title: Can someone explain to me about the right steps to get this answer for this java code, BigO/running time?
tagged with: java
type: Question
has body: sum = 0; for(i=0;i&lt;sqrt(n)/2;i++) sum++; for(j=0;j&lt;sqrt(n)/4;j++) sum++; for(k=0; k&lt;8+j; k++) sum++; The question is asking if it takes 10ms to run program for n = 100, how large a problem can be solved in 40 ms. The answer is 1600. My question is how did they get to 1600, I tried to plug it in N but I keep getting 200 instead?. Do I plug for the first N loop or the second N loop?
has answer: http://stackoverflow.com/a/27260109
has answer: http://stackoverflow.com/a/27260064
score: 0
answer count: 3
tagged with: big-o
has answer: http://stackoverflow.com/a/27260067
type: UnansweredQuestion

http://stackoverflow.com/a/27313351
score: 1
type: Answer
answers question: http://stackoverflow.com/q/27312350
upvote count: 1
downvote count: 0
has body: I would solve the race on currentLine differently: for (int i = 1; i &lt;= logfile.getTotalLines(); i++) { t = new Thread(new ThreadFile(i), "logFile_Thread_" + i); t.start(); } Defining ThreadFile thus: static class ThreadFile implements Runnable { private int lineToProcess; public ThreadFile( int lineToProcess ) { super(); this.lineToProcess = lineToProcess; } public void run() { timer.schedule(new timedTask(), (long) logfile.getFileHash().get(lineToProcess).getTimeStampInMilli()); } } This way, when you create the runnable, it already knows which line to access, and there is no access to a common variable and no need for synchronization. There may still be some sort of a problem with logfile since it, too, is common and not synchronized, but if all we do is read from it and reading does not involve updating its state, it should be OK.

http://stackoverflow.com/comment/42896039
score: 0
has text: I'm confused as to what your `GraphicCard` method does?
type: Comment
comment on: http://stackoverflow.com/a/27205500
type: AnswerComment

http://stackoverflow.com/comment/43021410
score: 2
type: AnswerComment
has text: 1 reason is performance (if it matters); 2 - it may be more flexible (if needed); otherwise I would use replaceFirst because it's one line solution
type: Comment
comment on: http://stackoverflow.com/a/27275934

http://stackoverflow.com/a/27204688
type: Answer
accepted answer of: http://stackoverflow.com/q/27204645
answers question: http://stackoverflow.com/q/27204645
score: 0
has body: Let's say this was your connection part of your script. $con = mysqli_connect("localhost","database_user","my_password","animals"); Be sure to change the "localhost" to the correct IP/network address of computer A. You may need to port forward on computer A if both computers are not on the same network too... But if they aren't on the same network then why bother with all that? I'd recommend getting some real web hosting and it comes very cheap! Even free ones offer free MySQL databases just not with remote access.
type: AcceptedAnswer

http://stackoverflow.com/comment/43076108
type: QuestionComment
has text: Here's something else I've tried in my showWord method for (int i =0; i<word.length; i++) { if (word[i].equals(guess)) System.out.print (word[i]); else System.out.print ('_'); } System.out.println (" "); }
comment on: http://stackoverflow.com/q/27306734
score: 0
type: Comment

http://stackoverflow.com/q/27250786
type: Question
has answer: http://stackoverflow.com/a/27251111
has answer: http://stackoverflow.com/a/27250898
has comment: http://stackoverflow.com/comment/42976022
has comment: http://stackoverflow.com/comment/42976220
has title: Regex To Split String Into Sentences
answer count: 3
has comment: http://stackoverflow.com/comment/42975613
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/27251111
has comment: http://stackoverflow.com/comment/42975772
has body: I need to split a string containing sentences such as: "this is a sentence. this is another. Rawlings, G. stated foo and bar." into ["this is a sentence.", "this is another.", "Rawlings, G. stated foo and bar."] using regular expressions. The other solutions I found split the third sentence into "Rawlings, G." and "stated foo and bar." which is not what I want.
tagged with: regex
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/27250817
possible better answer: http://stackoverflow.com/a/27250898

http://stackoverflow.com/q/27173974
downvote count: 0
answer count: 1
score: 1
tagged with: oncreateoptionsmenu
favorite count: 0
tagged with: android
has body: When I create an Android application within Eclipse Juno with Target: Android-19 (4.4.2) , I only want the onCreate() method to be created within my Activity. However, at the minute I am getting the following when I create my Activity, Note that I do not want to use fragments or the action bar within my application. public class MainActivity extends Activity { @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); } } I know that I can just delete these methods but it would be more convenient not to do so. How can I ensure that the onCreateOptionsMenu() and onOptionsItemsSelect() methods are not created when I created an Android application?
has title: Android: How to prevent certain methods from being created when Application created?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27174068
type: Question
tagged with: oncreate
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/27228022
type: Answer
accepted answer of: http://stackoverflow.com/q/27227893
answers question: http://stackoverflow.com/q/27227893
has body: You need to pass File object or String with file name in coonstructor outputWriter = new BufferedWriter(new FileWriter("10.txt"));
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27205413
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27204100
type: Answer
accepted answer of: http://stackoverflow.com/q/27204100
has body: Analysator class expect the list as input, so provide a list to it: Analysator analysator1 = new Analysator(); analysator1.setListRoleGame(Arrays.asList(new RoleGame())); // Should work
upvote count: 1
score: 1

http://stackoverflow.com/q/27224146
tagged with: libreoffice
favorite count: 0
tagged with: uno
type: UnansweredQuestion
score: 2
has title: LibreOffice java uno 'How to get cursor position of text range or a paragraph'
answer count: 0
upvote count: 2
tagged with: java
type: Question
has body: I'm looking for a clever and accurate way to get the cursor position of a paragraph within a text. I will be using this point to place an image besides the text items or paragraphs. I am doing this on impress and thus using XShape and XText. The position I'm looking for would be similar to XTextViewCursor's getPosition method. Below best describes what I'm looking for. [position ?] This is paragraph one [position ?] this is paragraph tow this is paragraph two [position ? ] this is paragraph three this is paragraph three this is paragraph three
downvote count: 0

http://stackoverflow.com/comment/42831778
score: 1
has text: If the program has not exited yet, the only way is to check output.
comment on: http://stackoverflow.com/a/27170268
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27266058
tagged with: constructor
has answer: http://stackoverflow.com/a/27266164
type: Question
has answer: http://stackoverflow.com/a/27266181
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27266108
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27266170
downvote count: 0
has body: I have below classes in the same package: class Moo { Moo() { System.out.println("No-Arguments Base Constructor!"); } Moo(int a) { System.out.println("Parameterized Base Constructor!"); } public String coolMethod() { return "Wow!"; } } class Zoo extends Moo { Zoo() { super(10); System.out.println("SubClass Constructor!"); } public String coolMethod() { return "Zoo Wow!"; } public static void main(String[] args) { Zoo m = new Zoo(); System.out.println(m.coolMethod()); } } And the Output is like below: Parameterized Base Constructor! SubClass Constructor! Zoo Wow! What I know is, "whenever we run a program, the compiler will execute the base class default constructor before executing the child constructor". But in this case, the parameterized constructor is getting called first (instead of default constructor). So my question is, Does the compiler look for a super keyword in child class constructor before executing the base class constructor?
has title: Does the compiler look for a **super** keyword in child class constructor before calling the it's base class constructor?
favorite count: 0
has answer: http://stackoverflow.com/a/27266108
answer count: 5
has answer: http://stackoverflow.com/a/27266190
accepted answer: http://stackoverflow.com/a/27266190

http://stackoverflow.com/q/27299541
has answer: http://stackoverflow.com/a/27301048
tagged with: synchronized
favorite count: 0
has comment: http://stackoverflow.com/comment/43063282
has answer: http://stackoverflow.com/a/27299736
type: UnansweredQuestion
score: -4
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43063063
has comment: http://stackoverflow.com/comment/43062978
tagged with: java
has title: Can a Thread t1 call the function "x.funcA()" when Thread t2 is currently executing the same function? (Java)
has comment: http://stackoverflow.com/comment/43063082
has body: Good evening, I have two questions to the following code.. Can a Thread t1 call the function f.funcA() when Thread t2 is currently executing f.funcA()? Can a Thread t1 call the function f.funcB() when Thread t2 is currently executing f.funcA()? I'd be nice if someone could explanation why yes or why not. public class Foo() { ... synchronized void funcA() {....} synchronized void funcB() {....} ... } Foo f = new Foo(); Thanks in advance for your answers! And as some people think this is "homework".. it is not.
type: Question
downvote count: 4
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/42960087
comment on: http://stackoverflow.com/q/27241848
has text: your sql query is wrong. see the answer and try it. tell me if it works
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27196389
accepted answer: http://stackoverflow.com/a/27196933
tagged with: game-physics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27196933
tagged with: libgdx
tagged with: camera
tagged with: java
has title: Why does my player move off the screen when I set the libGDX camera's position to the players x and y?
has body: for the past few days i have been tinkering around with moving the player with just one camera and having the camera follow the player's x and y. When i searched this up all i found was to move the player and set the camera's x and y to that. But i am having a problem, my player does not stay in the middle of the screen and it is really anoying. If anyone could hep me that would be great. Here is the code. in the create; cam = new OrthographicCamera(); cam.setToOrtho(false, Main.WIDTH, Main.HEIGHT); batch = new SpriteBatch(); batch.setProjectionMatrix(cam.combined); in the update; cam.position.set(Player.getX() + Main.WIDTH / 2, Player.getY() + Main.HEIGHT / 2, 0); cam.update(); in the movement; if (Gdx.input.isKeyPressed(Keys.W) || Gdx.input.isKeyPressed(Keys.UP)) { Player.setVelY(Player.SPEED); } else if (Gdx.input.isKeyPressed(Keys.S) || Gdx.input.isKeyPressed(Keys.DOWN)) { Player.setVelY(-Player.SPEED); } else { Player.setVelY(0); } if (Gdx.input.isKeyPressed(Keys.A) || Gdx.input.isKeyPressed(Keys.LEFT)) { Player.setVelX(-Player.SPEED); Player.dir = Player.Direction.LEFT; } else if (Gdx.input.isKeyPressed(Keys.D) || Gdx.input.isKeyPressed(Keys.RIGHT)) { Player.setVelX(Player.SPEED); Player.dir = Player.Direction.RIGHT; } else { Player.setVelX(0); Player.dir = null; }
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/42968944
has text: Are you sure that is the correct IP address ?
comment on: http://stackoverflow.com/q/27247010
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27276219
tagged with: listview
has title: Android listview onclicklistener activity
answer count: 1
has comment: http://stackoverflow.com/comment/43021877
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/27278889
tagged with: android
type: AnsweredQuestion
tagged with: onclicklistener
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43023582
type: Question
has body: I want that if I click in the listview on 'Leerlingenraad' that he opens the class Leerlingenraad with leerlingenraad.xml and if I click on Contact that he opens the class Contact with contact.xml I have found a lot of topics of this but it won't work. Does anyone know what's wrong in my script? Please don't rate this down. Myclass.java: package com.example.myapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem.*; import android.view.MenuItem; import android.view.MenuInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.*; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import android.text.Editable; import android.widget.AdapterView.OnItemClickListener; import android.text.TextWatcher; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.view.ViewGroup; import android.widget.Toast; public class Myclass extends Activity { // List view private ListView lv; // Listview Adapter ArrayAdapter&lt;String&gt; adapter; // Search EditText EditText inputSearch; // ArrayList for Listview ArrayList&lt;HashMap&lt;String, String&gt;&gt; onderneming; /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myclass); String onderneming[] = {"Leerlingenraad", "Medezeggenschapsraad", "3", "4", "5", "6", "Contact"}; lv = (ListView) findViewById(R.id.list_view); inputSearch = (EditText) findViewById(R.id.inputSearch); // Adding items to listview adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.product_name, onderneming); lv.setAdapter(adapter); /** * Enabling Search Filter * */ inputSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1…
has comment: http://stackoverflow.com/comment/43022147
has comment: http://stackoverflow.com/comment/43023679
has answer: http://stackoverflow.com/a/27278889
linked to: http://stackoverflow.com/q/5265913
has comment: http://stackoverflow.com/comment/43021678

http://stackoverflow.com/comment/42815433
has text: P.S. An "even" number is one that is divisible by 2 (2, 4, 6, 8, ...) I don't think you meant to use that word in the title or your question--you probably meant "equal".
comment on: http://stackoverflow.com/q/27160754
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42966609
type: Comment
comment on: http://stackoverflow.com/a/27245719
score: 0
type: AnswerComment
has text: That is incorrect. http://stackoverflow.com/questions/383551/what-is-the-size-of-a-boolean-variable-in-java It should be noted that it can cary from JVM to JVM.

thread-safety
tags question: http://stackoverflow.com/q/27241655
tags question: http://stackoverflow.com/q/27188279
tags question: http://stackoverflow.com/q/27289638
tags question: http://stackoverflow.com/q/27233958
tag name: thread-safety
tags question: http://stackoverflow.com/q/27222646
tags question: http://stackoverflow.com/q/27278641
tags question: http://stackoverflow.com/q/27303275
type: Tag

http://stackoverflow.com/a/27188987
has comment: http://stackoverflow.com/comment/42868328
answers question: http://stackoverflow.com/q/27187725
downvote count: 1
has comment: http://stackoverflow.com/comment/42868941
upvote count: 12
has comment: http://stackoverflow.com/comment/42867646
type: Answer
score: 11
has body: Firebase will always retrieve the complete node(s) that you ask for. Since you're asking for all Chats or an entire Chat at once (it isn't clear which one you do from your code), that's what you get. If you want to get less data from Firebase, you'll have to be more specific in what you ask from it. For example if you want to display Chat1, then start by listening for the children of the Chat1 node. This snippet comes from the Firebase guide for Android: // Retrieve new posts as they are added to Firebase ref.addChildEventListener(new ChildEventListener() { // Retrieve new posts as they are added to Firebase @Override public void onChildAdded(DataSnapshot snapshot, String previousChildKey) { Map&lt;String, Object&gt; newPost = (Map&lt;String, Object&gt;) snapshot.getValue(); System.out.println("Author: " + newPost.get("author")); System.out.println("Title: " + newPost.get("title")); } //... ChildEventListener also defines onChildChanged, onChildRemoved, // onChildMoved and onCanceled, covered in later sections. }); This snippet accomplishes the same as your current example, but instead of your code looping over the data with a for, Firebase feeds you the data one message at a time. With that in place, you can filter the messages. This is a two-step process: first you order by a child node, then you limit which nodes are returned. Query query = ref.orderByChild("Author").equalTo("Author1", "Author"); query.addChildEventListener(new ChildEventListener() { // the rest of the code remains the same as above This last bit is best explained in the Firebase documentation on queries.

http://stackoverflow.com/comment/42877406
has text: do i declare it the same as i did with the simple array ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27196170

http://stackoverflow.com/q/27200042
favorite count: 0
type: Question
upvote count: 2
has title: Game Of Life - Out Of Bounds array index
has answer: http://stackoverflow.com/a/27200060
score: 0
tagged with: java
downvote count: 2
tagged with: indexoutofboundsexception
answer count: 1
tagged with: arrays
type: UnansweredQuestion
has body: I'm working on the standard Game Of Life program for my Intro to Java course, and so far I've been able to accomplish a lot of it on my own. However, I'm having some difficulty with counting the neighbors of a given cell, to determine whether it lives or dies. Here is my countNeighbors method: public static int countNeighbors(int [][] board, int A, int B) { int [][]a = board; int count = 0; if (a[A][B] == 0 || a[A][B] == 1) { try{ if (a[A-1][B-1] == 1) {count++;} if (a[A ][B-1] == 1) {count++;} if (a[A+1][B-1] == 1) {count++;} if (a[A-1][B ] == 1) {count++;} if (a[A+1][B ] == 1) {count++;} if (a[A-1][B+1] == 1) {count++;} if (a[A ][B+1] == 1) {count++;} if (a[A+1][B+1] == 1) {count++;} } catch (ArrayIndexOutOfBoundsException e) {} } return count; } When I run my program, this method does not count the neighbors correctly, thus initializing an incorrect new generation. How do I overcome the out of bounds indices of an array?

http://stackoverflow.com/q/27208062
tagged with: pointers
favorite count: 0
accepted answer: http://stackoverflow.com/a/27208223
has comment: http://stackoverflow.com/comment/42898179
has comment: http://stackoverflow.com/comment/42898262
has comment: http://stackoverflow.com/comment/42898218
has comment: http://stackoverflow.com/comment/42898105
has comment: http://stackoverflow.com/comment/42898112
has comment: http://stackoverflow.com/comment/42898505
has comment: http://stackoverflow.com/comment/42898502
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/27208372
tagged with: oop
has answer: http://stackoverflow.com/a/27208223
tagged with: java
has comment: http://stackoverflow.com/comment/42898504
has comment: http://stackoverflow.com/comment/42898066
has comment: http://stackoverflow.com/comment/42898602
score: 4
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/27208372
answer count: 2
has title: Is it possible to get the type of an uninstantiated variable in Java?
has body: Is it possible to get the type of a variable that is declared (but not instantiated) in Java? for example: public class Foo { FooTwo foo2; FooTwo foo3; FooThree foo4; public static void main(String[] args) { if (foo2.getClass() == foo3.getClass()) { System.out.println("foo2 is the same type as foo3"); } if (foo3.getClass() == foo4.getClass()) { System.out.println("foo3 is the same class as foo4"); } } } With output: foo2 is the same type as foo3 obviously the method getClass() does not work on an uninstantiated variable, so this code does not function. I am assuming that the information I am looking for is stored somewhere in the variable (pointer?) for type safety, and that it may be accessible. Is it possible to Achieve this comparison? the reason: I have a class with several declared variables. These variables are supposed to point to objects stored in an ArrayList in another class. I am trying to create a method that will take an initialized (but uninstantiated) variable as a parameter, scan the arraylist for an object matching the type of the initialized variable, and set the variable to the object (Make the variable point to the object). ALSO: The point of the system is to remove coupling in the constructor of the class. The objects cannot be instantiated immediately or in the constructor.
downvote count: 0

http://stackoverflow.com/q/27163316
answer count: 1
has body: package prgms; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; class new_experi { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new FileWriter("C://Users//Abhilasha U//Desktop//output.txt")); try { Process p=Runtime.getRuntime().exec("cmd /c dir"); p.waitFor(); BufferedReader reader=new BufferedReader( new InputStreamReader(p.getInputStream()) ); String line; while((line = reader.readLine()) != null) { System.out.println(line); } } catch(IOException e1) {} System.out.println("Done"); } }
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27163589
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: how to copy the console output of this program in java

http://stackoverflow.com/comment/42888252
has text: Oyur code already knows how to send a message to one device (see your `onsubmit="return sendPushNotification(...`). The code behind this sendPushNotification method has to be executed for every registration id. I recommend to not do it in the JavaSript. Move the send loop to the PHP code, and as Eran explained do not send more than 1000 messages in one request.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27202601

http://stackoverflow.com/q/27274663
has comment: http://stackoverflow.com/comment/43020110
downvote count: 0
has comment: http://stackoverflow.com/comment/43019260
favorite count: 0
possible better answer: http://stackoverflow.com/a/27274774
tagged with: subclass
has answer: http://stackoverflow.com/a/27274774
has comment: http://stackoverflow.com/comment/43019289
tagged with: superclass
type: AnsweredQuestion
has title: Superclass method obtain subclass variable
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43018662
upvote count: 1
has answer: http://stackoverflow.com/a/27274737
type: Question
has body: I have a superclass and a subclass. And in the superclass I try to get the variable from the subclass using a method. I have 2 subclasses and each subclasses have different values on this variable. How do I do this? This is how it looks like: public class SuperClass{ protected int health; public int getHealth() { return health; } And then I have my Subclasses: public class SubClass1 extends SuperClass{ private int health = 30; public SubClass1() { super(); } } public class SubClass2 extends SuperClass{ private int health = 50; public SubClass2() { super(); } } And then I try to test this using JTestUnit: public class SubClass1{ @Test public void testGetHealth() { SubClass1 unit = new SubClass1(); assertEquals(unit.getHealth(), 30); } But it doesn't work. How do I get the value depending if it's SubClass1 or SubClass2 object(instance?) that I am creating? Thanks in advance!
has comment: http://stackoverflow.com/comment/43019133
has comment: http://stackoverflow.com/comment/43019058
has answer: http://stackoverflow.com/a/27274828
has comment: http://stackoverflow.com/comment/43019975
answer count: 3
accepted answer: http://stackoverflow.com/a/27274737

http://stackoverflow.com/q/27238354
tagged with: spring-data-jpa
tagged with: sql
favorite count: 0
accepted answer: http://stackoverflow.com/a/27369964
has comment: http://stackoverflow.com/comment/42953480
tagged with: spring-data
score: 6
has body: My query looks like this: @Query("SELECT p FROM Pilot p LEFT JOIN FETCH p.playerShips WHERE p.nickname = (:nickname)") So far so good. I'm getting Pilot instance even when playerShips is empty. Now, I want to fetch only inactive ships so I modified my query to look like this: @Query("SELECT p FROM Pilot p LEFT JOIN FETCH p.playerShips s WHERE p.nickname = (:nickname) AND s.active = false") and I'm getting null as a pilot so it clearly doesn't work. I'd be glad if someone could explain me how to create a JOIN FETCH query with WHERE clause that applies to the child elements. Thanks in advance.
tagged with: spring
upvote count: 6
has comment: http://stackoverflow.com/comment/42953552
has comment: http://stackoverflow.com/comment/43207940
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27327002
has title: Spring Data 'Left Join Fetch' query returning null
has answer: http://stackoverflow.com/a/27327002
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27369964
downvote count: 0
has comment: http://stackoverflow.com/comment/43191814

http://stackoverflow.com/q/27213305
has comment: http://stackoverflow.com/comment/42907843
answer count: 0
tagged with: java
has title: Refilling A JPanel after removeAll()
type: Question
tagged with: jpanel
score: 0
linked to: http://stackoverflow.com/q/5665156
has comment: http://stackoverflow.com/comment/42969539
has comment: http://stackoverflow.com/comment/42969638
type: UnansweredQuestion
tagged with: swing
has body: I'm finding that when I use removeAll() in JPanel, then attempt to add new contents via add() (e.g. a simple text JLabel), the original contents get cleared okay, but the new contents don't appear. Yes, I'm remembering to order a repaint() opperation on the JPanel afterwards, and yes, I'm conducting these opperations in SwingUtilities.invokeLater(). But if I leave the frame untouched, the new contents of the JPanel doesn't appear. However, if I manually resize the frame, then the contents DOES appear. Can anyone give me any advice as to how to get the contents to display by itself? Thanks. Sample code: public class SimpleTester extends JFrame implements WindowListener { private static final long serialVersionUID = 6768852132139940161L; private JPanel panel; public SimpleTester() throws HeadlessException { super("SimpleTester"); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.add(Box.createRigidArea(new Dimension(60, 60))); this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); this.getContentPane().add(panel); this.addWindowListener(this); this.pack(); } public static void main(String[] args) { SimpleTester tester = new SimpleTester(); tester.setVisible(true); final String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int pos = 0; while(true) { SwingUtilities.invokeLater(new Replacer(tester.mainPanel(), new JLabel(alphabet.substring(pos, pos+1)))); pos++; if(pos&gt;=alphabet.length()) { pos = 0; } synchronized(tester) { try { tester.wait(3000L); } catch (InterruptedException e) { System.exit(0); } } } } @Override public void windowActivated(WindowEvent arg0) { // TODO Auto-generated method stub } @Override public void windowClosed(WindowEvent arg0) { // TODO Auto-generated method stub } @Override public void windowClosing(WindowEvent arg0) { System.exit(0); } @Override public void windowDeactivated(WindowEvent arg0) { // TODO Auto-generated…
has comment: http://stackoverflow.com/comment/42907033

http://stackoverflow.com/q/27291061
has comment: http://stackoverflow.com/comment/43048080
has answer: http://stackoverflow.com/a/27291705
answer count: 3
downvote count: 0
favorite count: 0
tagged with: logic
has comment: http://stackoverflow.com/comment/43051955
has answer: http://stackoverflow.com/a/27292156
has answer: http://stackoverflow.com/a/27292952
has comment: http://stackoverflow.com/comment/43048205
has title: Convert a ResultSet into List of HashMap in java
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43048348
upvote count: 1
has body: I have a resultset (returned by a stored procedure) like - I need a List of HashMap, and HashMap will be made of individual (distinct by combination of FirstName, LastName and Id) students records. Below image will describe the structure of HashMap. So, basically in this example, I need a list of 3 HashMap. Can you please suggest some efficient way to do that? Thanks! why do I need a list of hashmap for this? I need to create an XML file out of this ResultSet. List of HashMap is the best way I can think of for required XML structure. XML Structure : If my approach is not correct in terms of coding standard or efficiency, please suggest me different approach. What I am thinking: I've not tried yet. But can not think anything else other than iterating over the ResultSet and temporarily storing FirstName, LastName and Id to check if it is same as previous value or not. If same then add marks array to MarksList, else consider it as record of another student. I am hoping there might be a different way. [Update]: I think I should use list of Objects, not list of HashMap. But the question still is, how can I interpret the value from resultset and set values into the object.
type: Question
has comment: http://stackoverflow.com/comment/43054481
tagged with: hashmap
has comment: http://stackoverflow.com/comment/43048123
accepted answer: http://stackoverflow.com/a/27292952
has comment: http://stackoverflow.com/comment/43048134
possible better answer: http://stackoverflow.com/a/27291705
has comment: http://stackoverflow.com/comment/43051517

http://stackoverflow.com/comment/42822504
has text: LinkedList has to be coded manually is what OP wants---not the library class! So you receive -1 from me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27164908
type: Comment

http://stackoverflow.com/comment/43085658
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27311229
has text: @kittu88 Please comment on my original answer. You need to remove the `"` before `{` and after `}`. It will then say it's invalid due to the missing `"` after `__type`.
score: 0

http://stackoverflow.com/comment/43057879
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27294063
has text: @dic19 Ok sorry. Maybe I have to clarify what I mean with "resize": For example if we have 9 symbols and the box has space for 3 items horizontally, then it would layout as 111 \n 111 \n 111. But if we expand the size(resize) the box to have 4 item spaces: 1111 \n 1111 \ 1 should be the result. I am not 100% sure if GridLayout can dynamically adjust column/row amount.

http://stackoverflow.com/comment/42969505
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27247317
has text: If you have in mind the collection, that it is the simplest and most traightforward way to deal with it

http://stackoverflow.com/q/27228656
accepted answer: http://stackoverflow.com/a/27246822
favorite count: 0
has comment: http://stackoverflow.com/comment/42936868
has comment: http://stackoverflow.com/comment/42935944
type: Question
has comment: http://stackoverflow.com/comment/42936971
tagged with: spring
has title: How to use d3.js in JSP?
tagged with: d3.js
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27246822
has comment: http://stackoverflow.com/comment/42936267
tagged with: java
tagged with: javascript
has body: In a Spring web application I am trying to create a dummy JSP page to build on: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ page session="false"%> <spring:url value="/resources/scripts/d3.js" var="d3_url" /> A Pagey Page Hello world! What up? I loaded d3.js in the header of the page and there are no complaints about it, so I assume the resource was found. However when I come to use a D3 script in the body of the page I get "Uncaught ReferenceError: d3 is not defined". I am positive about the syntax of the call, because I've tested the same thing in a simple HTML page and it worked. So, either this is not the way to use D3 in a JSP page or somehow the resource isn't loaded after all. My resources folder is declared in the config file: <resources mapping="/resources/**" location="/resources/" /> and I triple-checked that d3.js is indeed in the /resources/scripts folder. What is the right way to use d3.js in JSP? UPDATE: In Google Chrome development tools console d3 is not recognized. This leads to conclusion that despite the lack of warnings about loading d3 in the header, it hasn't been properly loaded. But why? UPDATE 2: When I replace <spring:url value="/resources/scripts/d3.js" var="d3_url" /> with I get Failed to load resource: the server responded with a status of 404 (Not Found) in the Chrome console for that line. SOLVED: My bad. After removing the leading slash from the resource location, it worked! value="resources/scripts/d3.js". I still don't get why that would affect the outcome taking into account that the resources root was explicitly indicated.
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
score: 1

http://stackoverflow.com/comment/42919365
type: AnswerComment
comment on: http://stackoverflow.com/a/27220153
score: 0
type: Comment
has text: Considering the edit to your question, how would i go about "deleting" the old frame properly. Shouldn't just removing the reference "delete" it and make it eligible for `gc()`

http://stackoverflow.com/a/27289756
answers question: http://stackoverflow.com/q/27289187
type: Answer
downvote count: 0
has body: Spring probably honors the Accept header. Browsers usually send application/xml as an accepted format. REST clients usually include application/json. CURL does not send anything (unless you define it) and Spring probably prefers the JSON in such case. As for the format itself I have found this - https://datatracker.ietf.org/doc/html/draft-richer-oauth-xml-01#section-4.1 .
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27289187
upvote count: 1

http://stackoverflow.com/q/27294442
has title: Java: Creating Reference Type from Abstract class and interface
type: Question
accepted answer: http://stackoverflow.com/a/27294515
score: 3
tagged with: oop
has answer: http://stackoverflow.com/a/27294500
downvote count: 0
possible better answer: http://stackoverflow.com/a/27294486
favorite count: 0
linked to: http://stackoverflow.com/q/13670991
has answer: http://stackoverflow.com/a/27294486
tagged with: abstract-class
has answer: http://stackoverflow.com/a/27294515
answer count: 5
tagged with: interface
has body: I am new to Java and I have read threads (here) that it is not possible to instantiate an abstract class. So, I tested it out. The first test I did is shown below. And it seems like I can actually instantiate an abstract class and in fact, I actually have a new type which refers to the abstract class and the type is actually shared by all subclasses the extends it. This also means polymorhpism applies. import java.util.*; abstract class AbstractClass{ public abstract void printname(); } class Test1 extends AbstractClass{ private String name; public Test1(String name){ this.name = name; } public void printname(){ System.out.println("My name is " + name); } } class Test2 extends AbstractClass{ private String saysomething; public Test2(String saysomething){ this.saysomething = saysomething; } public void printname(){ System.out.println(saysomething); } } class TestingApp{ public static void main(String[] args){ AbstractClass[] abstractclass_list = {new Test1("JEFFFFFF") , new Test2("Hey , say something")}; for(AbstractClass item : abstractclass_list){ item.printname(); } } } Then I did another test but this time, instead of working on abstract class, I decided to create a type which refers to Interface. It seems like I can instantiate an interface as well. I can actually create a type that refers to the interface. This type is shared by all the classes that implements this interface. And polymorphism applies again. import java.util.*; interface AbstractInterface{ public void printname(); } class Test4 implements AbstractInterface{ private String name; public Test4(String name){ this.name = name; } public void printname(){ System.out.println("My name is " + name); } } class Test3 implements AbstractInterface{ private String saysomething; public Test3(String saysomething){ this.saysomething = saysomething; } public void printname(){ System.out.println(saysomething); } } class TestingAbstractInterfaceApp{ public static void main(String[] args){ AbstractInterface[] abstrac…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27294509
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27295368

http://stackoverflow.com/a/27215823
upvote count: 1
has comment: http://stackoverflow.com/comment/42912604
has body: Try running mvn package exec:java.
type: Answer
has comment: http://stackoverflow.com/comment/42916067
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42915601
has comment: http://stackoverflow.com/comment/42911820
has comment: http://stackoverflow.com/comment/42915068
answers question: http://stackoverflow.com/q/27215603

http://stackoverflow.com/comment/44896259
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27274527
has text: Yes, I can assemble stuff fine but I have a few flavours so I'm building assemble[Flavour]Debug rather than assembleDebug. Will a little fiddling I've come up with something that's working for me. Rather than matching a specific Flavour, I'm enabling the flag on all variants. See my answer. Now just to figure out how to get it to ignore the deprecation where I've @SuppressWarnings("deprecation").
type: AnswerComment

http://stackoverflow.com/a/27181847
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27179175
has body: Whether or not you want to be a Stream yourself, primarily depends on whether you're truly a Stream with the corresponding powers, i.e. support parallelization (not all Streams do, but it's one of the many benefits of Streams, and it's an important one). Normally I'd rather be a Collection and let myself be Streamed by the corresponding API calls. The getStuff() method, returning Stream&lt;String&gt; from myCollection.stream() looks right to me.

http://stackoverflow.com/comment/42990137
type: AnswerComment
has text: You don´t need StringUtils for that. Java´s String[] array = "a,b".split(","); is just as good for that. Nevertheless StringUtils works just as well.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27178303

http://stackoverflow.com/a/27245199
type: Answer
has comment: http://stackoverflow.com/comment/42966903
has body: This usually happens when sources are not compiled because of project misconfiguration. Try Project>Clean. Also try F3 which is shortcut for CTRL+click.
has comment: http://stackoverflow.com/comment/42968872
answers question: http://stackoverflow.com/q/27245003
has comment: http://stackoverflow.com/comment/42967039
score: 0
has comment: http://stackoverflow.com/comment/42968749

http://stackoverflow.com/a/27274736
has body: Mmmm... from what I've been taught (and also from what I've read), the definition of an Anonymous Array is: "Array without any name, it is an array just for create and use it". And since it does not have any name, you should not be able to reuse that array. The best references I had when I prepared for the OCJP was: anonymous int array : new int[] { 1, 2, 3, 4}; anonymous String array : new String[] {"one", "two", "three"}; anonymous char array : new char[] {'a', 'b', 'c'); You can notice that (and also you already know) these type of arrays have the creation and initialization at the same time (as you initialize them in the same line you create them using the new() keyword without assigning to any variable and you would not be able to reuse it later). So, from what you have mentioned, when you assign an array to a variable, even when you create it and initialize at the same line, it is being assigned to a variable so it is able to be reused later, it is not anonymous, it can be referenced, so I wonder why in the examples of "anonymous arrays" you see something like: int [] k= new int[2]{5,10}; Anonymous means "not known by name" which is not the case in the line you specified since the array is assigned to a variable called "k". However, this one shows the property of anonymous array-object creation which is pointed by a reference variable "k", so if we write just "new int[]{1,2,3};" then this is how anonymous array-object can be created... When I prepared for OCJP 7 I read many articles from this page, I would recommend it to you to go deeply in Java in the future :) Reference: http://javarevisited.blogspot.com/2012/01/anonymous-array-example-java-create.html You can find also good examples and articles there :)
score: 3
answers question: http://stackoverflow.com/q/27274356
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43021112

http://stackoverflow.com/q/27265547
type: Question
has title: How to find a set of any start location to between any last required location using lambdas
score: 0
linked to: http://stackoverflow.com/q/20746429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43003073
has body: how to find a set of any start location to between any last required location using lambdas I am not familiar of this new java feature of lambda, I have an arraylist in generic class Location and I want to get a set of objects from a starting location (Object.element) to a specific location void find(){ int Sindex; int Eindex; String stationName=(String) to.getSelectedItem();// combo box String stationNameEnd=(String) from.getSelectedItem();// get from combo box Controller manager=new Controller(); manager.station.stream().forEach((entrySet) -&gt; { if (entrySet.getStopName().equals(stationName)) { Sindex= manager.station.indexOf(entrySet); if(!entrySet.getStopName().equalsIgnoreCase(stationNameEnd)){ dist=dist + entrySet.getDistanceforlaststation(); TolalPrice=TolalPrice+ entrySet.getPrice(); Name=stationName; Name+=", "+ entrySet.getStopName(); time= time+entrySet.getTime(); point=point+entrySet.getPoints(); } } }); Problem: I am not familiar of this new java feature of lambda Case 1.1: I have an arraylist in generic class Location Case 1.2: and I want to get a set of object case 2: from find starting Object.element and case 2.1: also stop to at specific location What I have to do through lambda
tagged with: lambda
answer count: 0
has comment: http://stackoverflow.com/comment/43043499
tagged with: java
has comment: http://stackoverflow.com/comment/43003111

http://stackoverflow.com/comment/43005782
type: AnswerComment
comment on: http://stackoverflow.com/a/27252374
type: Comment
has text: But this is like running eclipse! Isn't it? At the end, I would like to put my plugin code in a jar file to be used by some other java applications which are supposed to be a standalone applications, and they are not supposed to have eclipse. Thanks a lot!
score: 0

http://stackoverflow.com/comment/43019726
has text: Well in java just check the documentation of JavaCV for similar function naming!
comment on: http://stackoverflow.com/a/27184792
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42816008
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27161190
has text: You need to clarify exactly what the expected input and output is. As stated, this question is unclear. Add a few examples demonstrating the constraints of the problem.

http://stackoverflow.com/q/27209863
has answer: http://stackoverflow.com/a/29244130
has answer: http://stackoverflow.com/a/41174170
answer count: 3
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
score: 6
tagged with: merge
tagged with: cells
has answer: http://stackoverflow.com/a/47094360
tagged with: java
has title: Apache POI merge cells from a table in a Word document
type: Question
has body: I need to have a table with the cells on the first and second row merged. Something like this: Image of table (I can't post pics) https://i.sstatic.net/dAO6j.png I have been reviewing all the questions related to this topic and I have found some answers for applying grid span to the cells, but I couldn't find a real solution. Here is the code I have from examples obtained from google and from this site: XWPFDocument document = new XWPFDocument(); XWPFTable table = document.createTable(7, 2); fillTable(table); XWPFTableCell cellRow1 = table.getRow(0).getCell(0); XWPFTableCell cellRow2 = table.getRow(1).getCell(0); cellRow1.getCTTc().addNewTcPr(); cellRow1.getCTTc().getTcPr().addNewGridSpan(); cellRow1.getCTTc().getTcPr().getGridSpan().setVal(BigInteger.valueOf(2L)); cellRow2.getCTTc().addNewTcPr(); cellRow2.getCTTc().getTcPr().addNewGridSpan(); cellRow2.getCTTc().getTcPr().getGridSpan().setVal(BigInteger.valueOf(2L)); FileOutputStream out = new FileOutputStream("Table.docx"); doc.write(out); out.close(); What I get from this code is the following: I tried to remove the "extra" cells with table.getRow(0).removeCell(1); but it didn't work, am I doing something wrong?
tagged with: apache
downvote count: 0
upvote count: 6

http://stackoverflow.com/comment/42973513
comment on: http://stackoverflow.com/a/27240582
has text: sorry what if I want to use some object instead of int or string etc. Looks like getJobDataMap can only use string/int.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43032298
type: QuestionComment
has text: yes. i checked all directories in the project. You can also download the project from the URL provided in the post.
score: 0
comment on: http://stackoverflow.com/q/27281760
type: Comment

http://stackoverflow.com/comment/43020002
has text: @membersound - You must build a dictionary - anything in the dictionary is translated, anything not is passed through untouched. Have a look at how [LZW](http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch) works.
type: AnswerComment
comment on: http://stackoverflow.com/a/27275246
score: 0
type: Comment

http://stackoverflow.com/q/27278316
has comment: http://stackoverflow.com/comment/43042353
has comment: http://stackoverflow.com/comment/43068395
has comment: http://stackoverflow.com/comment/43056331
tagged with: pdf.js
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43069795
has comment: http://stackoverflow.com/comment/43069849
has comment: http://stackoverflow.com/comment/43069567
has body: I'm displaying a pdf using pdf.js. I can then click to download the generated pdf (generated by pdfbox) or click to email it to a designated email address. On a computer, this works fine, the pdf has merged fields (filled in with pdfbox), I can email it and the file is fine, download it and it isn't corrupt. On an iPad, I can initiate the email, and the file comes over just fine (confirming that the generated PDF is perfectly fine.), but when I click to PRINT it, the PDF is rendered in CHROME and the merged fields are NOT there. If I click 'Open with..' and open it with a separate app like Adobe Reader, I am told that the file is invalid - only on the iPad using Chrome. I don't think this is a pdf.js problem. Is there any reason why downloading a pdf created by pdfbox in Chrome on an iPad would be corrupt/invalid? Functionally, everything should be exactly the same whether these things are being done on a desktop vs ipad.
answer count: 0
has comment: http://stackoverflow.com/comment/43068920
has comment: http://stackoverflow.com/comment/43068043
has comment: http://stackoverflow.com/comment/43064724
type: Question
has comment: http://stackoverflow.com/comment/43043598
has title: PDF download on iPad is invalid
has comment: http://stackoverflow.com/comment/43064856
tagged with: java
has comment: http://stackoverflow.com/comment/43056544
tagged with: jboss
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/43065249
score: 0
tagged with: ipad
has comment: http://stackoverflow.com/comment/43066941
has comment: http://stackoverflow.com/comment/43056154
has comment: http://stackoverflow.com/comment/43067300

http://stackoverflow.com/a/27304250
has body: Can I also use @AndroidFindBys({ @AndroidFindBy(id = "com.mycurrentpackage:id/startup_text1"), @AndroidFindBy(id = "com.futurepackage:id/startup_text1") }) @CacheLookup private MobileElement startup_text1 When I used this one it takes a long time to load the page. Do I need to list it as private List&lt;MobileElement&gt; startup_text1
score: 0
answers question: http://stackoverflow.com/q/27302104
type: Answer

http://stackoverflow.com/comment/42829722
type: Comment
comment on: http://stackoverflow.com/a/27168213
type: AnswerComment
has text: Try the solution described in this link (First Answer) http://stackoverflow.com/questions/4900157/saving-jsp-as-utf-8-in-netbeans
score: 0

http://stackoverflow.com/comment/43009741
type: Comment
type: QuestionComment
has text: public void save() { if (context != null) { MyBean mybean= new MyBean(); mybean.save(); } }
comment on: http://stackoverflow.com/q/27267103
score: 0

http://stackoverflow.com/comment/43112463
score: 0
comment on: http://stackoverflow.com/q/27306913
type: Comment
has text: Are you using Eclipse or Android Studio?
type: QuestionComment

http://stackoverflow.com/a/27200252
has comment: http://stackoverflow.com/comment/42884290
has comment: http://stackoverflow.com/comment/78686044
has comment: http://stackoverflow.com/comment/42920745
downvote count: 0
has comment: http://stackoverflow.com/comment/42884315
score: 3
answers question: http://stackoverflow.com/q/27200158
type: Answer
has body: This means that you have misconfigured your local resolver in some way. getLocalHost() is supposed to return the real local IP address, and getLoopbackAddress() returns the loopback address, usually 127.0.0.1 (you say you are getting 127.0.1.1; although that's not impossible, I still assume that's a typo?) There are several situations that you can identify in the Java code for getLocalHost() that will make it return the loopback address instead of the real address: The local hostname is set to localhost String local = impl.getLocalHostName(); // [...] if (local.equals("localhost")) { return impl.loopbackAddress(); } Your code doesn't have permissions to get the local host adddress (it may be an applet or a Java WebStart application without permissions) } catch (java.lang.SecurityException e) { return impl.loopbackAddress(); } In other situations, however, it should throw an UnknownHostException. If your problem is number 1, then you need to change the host name of your machine to something that resolved back to the IP number of your computer. If your problem is number 2, then you need to make sure that your code gets the appropriate permission, for example by signing the applet or webstart application.
upvote count: 3
has comment: http://stackoverflow.com/comment/42913930
has comment: http://stackoverflow.com/comment/102723903
has comment: http://stackoverflow.com/comment/42885502

http://stackoverflow.com/q/27254589
score: 1
tagged with: jaxb
upvote count: 1
has title: JAXB unmarshall element children as plain text
type: Question
tagged with: java
duplicate of: http://stackoverflow.com/q/12428727
tagged with: unmarshalling
downvote count: 0
favorite count: 0
tagged with: xjc
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12428727
tagged with: http://stackoverflow.com/tag/xml
has body: I would like to know if/how it is possible to unmarshall an xml document such that the contents of certain know elements will not be treated as xml but rather plain text. When the below example is run the output is MessageData [text= and this is just plain] but I would like it to contain MessageData [text= This is bold, this is italic and this is just plain] import java.io.StringReader; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlRootElement; public class JAXBTest { public static String xml = " This is bold, this is italic and this is just plain "; public static void main(String[] args) throws Exception { JAXBContext context = JAXBContext.newInstance(MessageData.class); Unmarshaller unmarshaller = context.createUnmarshaller(); System.out.println(unmarshaller.unmarshal(new StringReader(xml))); } @XmlRootElement static class MessageData { public String text; @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("MessageData [text="); builder.append(text); builder.append("]"); return builder.toString(); } } } Thanks in advance
answer count: 0

http://stackoverflow.com/comment/105916528
has text: How to mesure Spring Boot startup time of a unit test run from intellij ?
type: Comment
comment on: http://stackoverflow.com/a/49663075
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42914912
type: QuestionComment
comment on: http://stackoverflow.com/q/27217657
score: 4
has text: share that xml line where are you getting error?
type: Comment

http://stackoverflow.com/q/27279510
has body: I have searched on google for a solution for detect points from an image using the OpenCV library for android (Java). I only need detect some points of the same color. I tried using diverse codes those use HoughCircles method, but didn't work. If any can give me an idea i will thank you so much. Update: I'm using the method Imgproc.HoughCircles, how can i fix the parameters for detect points? I found this code and playing with the parameters Mat imgCirclesOut = sourceImage.clone(); Imgproc.cvtColor(sourceImage, sourceImage, Imgproc.COLOR_RGB2GRAY); Imgproc.GaussianBlur( sourceImage, sourceImage, new Size(9, 9), 2, 2 ); Imgproc.HoughCircles( sourceImage, imgCirclesOut, Imgproc.CV_HOUGH_GRADIENT, 1, 1, 1, 1, 1, 10000 ); float circle[] = new float[3]; Log.d ("InvisicodeAppDebug","imgCirclesOut.cols(): " + imgCirclesOut.cols()); for (int i = 0; i &lt; imgCirclesOut.cols(); i++) { imgCirclesOut.get(0, i, circle); org.opencv.core.Point center = new org.opencv.core.Point(); center.x = circle[0]; center.y = circle[1]; Core.circle(sourceImage, center, (int) circle[2], new Scalar(255,0,0,255), 4); } But it takes too long. Again any help is welcome, thank you for your attention.
answer count: 1
has comment: http://stackoverflow.com/comment/43028026
downvote count: 0
favorite count: 0
tagged with: android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29239583
accepted answer: http://stackoverflow.com/a/29239583
upvote count: 2
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/43028368
type: Question
tagged with: opencv
has comment: http://stackoverflow.com/comment/43028112
has title: Android OpenCV - Problems with detection of points using HoughCircles
has comment: http://stackoverflow.com/comment/43028516

http://stackoverflow.com/comment/42872926
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27193462
has text: I removed the line textField1.addActionListener(handler). Also, change TextfieldHangler, However, still when I put the input and press Enter, nothing happened.......

http://stackoverflow.com/q/27272031
has comment: http://stackoverflow.com/comment/43132950
accepted answer: http://stackoverflow.com/a/38786768
type: AnsweredQuestion
tagged with: openoffice.org
downvote count: 0
has answer: http://stackoverflow.com/a/38786768
score: 1
tagged with: java
has body: I'm using JODConverter to convert my office files into PDF, using this simple code: officeDocumentConverter.convert(origin, destination, destinationFormat); But the problem is that OpenOffice (or JODConverter, I don`t know) isn't respecting the page orientation of my documents. Every document stays in a portrait format. Even if the document pages are in landscape format. Is there any option to turn on that kind of detection or respect my page orientations?
type: Question
has title: JODConverter Page Orientation
tagged with: jodconverter
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/20188953

http://stackoverflow.com/comment/43099990
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27299261
has text: Thank you for reply. It's exactly what you said.
score: 0

http://stackoverflow.com/q/27187540
tagged with: java
has body: I want the Logcat to be logging to a file in my application. So I use this code to redirect the log buffer to file (and it works): String filePath = Environment.getExternalStorageDirectory() + "/logcat.txt"; try { // This line clears the previous logs Process process = new ProcessBuilder() .command("logcat", "-c") .redirectErrorStream(true).start(); //TODO execute this once / double check this is active //each time this line is ran it will send another dump to the log file, 1, 2, 3, 4, etc. Runtime.getRuntime().exec(new String[]{"logcat", "-f", filePath, "-v", "time", "ActivityManager:W", "InvApp:I", "*:S"}); } catch (IOException e) { e.printStackTrace(); } Log.w("InvApp", "This is a message!"); The problem is every time this line is ran (every time I start up the app) it's like it hooks up to the event so In my log file I end up with something like so: Fist run: [TIME] InvApp This is a message! Second run: [TIME] InvApp This is a message! [TIME] InvApp This is a message! Third run: [TIME] InvApp This is a message! [TIME] InvApp This is a message! [TIME] InvApp This is a message! ...and so on and so forth. How do I make sure this code is either only ever executed once, or unhook/clear the exec commands?
type: Question
tagged with: logcat
has title: Android Logcat buffer redirect is being duplicated
score: 0
has comment: http://stackoverflow.com/comment/42864055
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42863425
answer count: 0

http://stackoverflow.com/q/27262754
has comment: http://stackoverflow.com/comment/42998059
has body: I have an assignment where I have to read data from a text file and sum up the data in each line. Here is the txt file: Chen Ruolin 9.2 9.3 9 9.9 9.5 9.5 9.6 9.8 Emilie Heymans 9.2 9.2 9 9.9 9.5 9.5 9.7 9.6 Wang Xin 9.2 9.2 9.1 9.9 9.5 9.6 9.4 9.8 Paola Espinosa 9.2 9.3 9.2 9 9.5 9.3 9.6 9.8 Tatiana Ortiz 9.2 9.3 9 9.4 9.1 9.5 9.6 9.8 Melissa Wu 9.2 9.3 9.3 9.7 9.2 9.2 9.6 9.8 Marie-Eve Marleau 9.2 9.2 9.2 9.9 9.5 9.2 9.3 9.8 Tonia Couch 9.2 9 9.1 9.5 9.2 9.3 9.4 9.6 Laura Wilkinson 9.7 9.1 9.3 9.4 9.5 9.4 9.6 9.2 A list of names and diving scores. We're supposed to read the data from the file and put it into arrays (I'm guessing each line would be it's own array), drop the highest and lowest scores of each diver and sum up the remaining scores. So, the output for the first line would look something like this: Chen Roulin: 56.90 The thing I'm stuck on is how to take a line and create an array (a string array, in this case) where it would separate the words and numbers and put them each into an array index. To make it more clear, the array for the first line would be something like: String chenRoulin[] = {"Chen", "Roulin", "9.2", "9.3", "9", "9.9", "9.5", "9.5", "9.6", "9.8}; With this, I think I would be able to Double.parseDouble the numerical values in the array and sum them up as I explained earlier. I am aware of 2d arrays and have already tried that approach, but was stuck on the same problem, since all the examples I've found so far were creating int or double arrays. Basically, what would be the best/simplest way to make an array out of each line of the file? Thanks in advance for the help. Here's the code I have so far (it's not much): import java.util.Scanner; import java.io.*; public class DivingData{ public static void main(String[] args) throws IOException { File myFile = new File("diving_data.txt"); Scanner inputFile = new Scanner(myFile); String line = inputFile.nextLine(); String[] chenRoulin = new String[10]; } } Just to be clear, I'm only asking for…
has answer: http://stackoverflow.com/a/27262843
has title: Java how to read a txt file and make each line it's own string array
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42998079
tagged with: java
accepted answer: http://stackoverflow.com/a/27262949
type: Question
tagged with: file-read
has comment: http://stackoverflow.com/comment/42998042
has answer: http://stackoverflow.com/a/27262949
score: 0
possible better answer: http://stackoverflow.com/a/27262843
answer count: 3
has answer: http://stackoverflow.com/a/27263064
tagged with: arrays
has comment: http://stackoverflow.com/comment/42998034

http://stackoverflow.com/comment/43081214
type: Comment
has text: A few style notes: you shouldn't have a method and a variable with the same name (`count`). Variables should start with a lower case letter (`Text`). Also, all of this could be written with iterative (not recursive) code and it would be more efficient and more readable.
type: QuestionComment
comment on: http://stackoverflow.com/q/27309750
score: 0

http://stackoverflow.com/comment/44509625
type: AnswerComment
type: Comment
has text: Thanks almas shaikh for your suggestion i do as you say but i got new exception: Unknown Host ip6-192.168.1.12 where as my usr/hosts having configuration 192.168.1.12 localhost hbase 192.168.1.12 ngi-Satellite-Pro-B40-A # The following lines are desirable for IPv6 capable hosts ::1 ip6-192.168.1.12 ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters as 192.168.1.12 is the ip of where hbase is installed.
score: 0
comment on: http://stackoverflow.com/a/27247126

http://stackoverflow.com/q/27313387
has comment: http://stackoverflow.com/comment/43102670
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/78278385
has answer: http://stackoverflow.com/a/27317523
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/43100251
has comment: http://stackoverflow.com/comment/43098899
score: 0
tagged with: guice
answer count: 1
has title: Guice declarative vs method syntax
has body: I'm new to Guice and would like the know the meaning (or difference between the following): @SessionScoped public class Counter { int count = 0; Does it everyone who has a Counter as a member will have the same Counter singleton instance? what is the difference with this syntax? what is the meaning of this line if there is no to()? bind(MySingleton.class).in(Scopes.SINGLETON); also: Here is the code to init inhector: public class ClientApplication { public static void main(String[] args) { Injector injector = Guice.createInjector(new AppInjector()); MyApplication app = injector.getInstance(MyApplication.class); app.sendMessage("Hi Pankaj", "pankaj@abc.com"); } } How do I init the injector when I don't have my own main method? eg. running Cucamber or Junit?
accepted answer: http://stackoverflow.com/a/27317523

http://stackoverflow.com/a/27174585
answers question: http://stackoverflow.com/q/27174528
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/42859348
has body: soda variable is actually coke in the carbonated method, see this illustration: carbonated( soda, pop, pepsi) ↓ ↓ ↓ carbonated(String coke, String soda, String pop) The first parameter coke will be printed in the last of the sentence The second parameter soda will be printed in the first of the sentence The last parameter pop will be concatenated in the middle Remember, it's the order that's important, not the variables names.

http://stackoverflow.com/comment/42949747
type: Comment
type: QuestionComment
score: 0
has text: @HotLicks Most obvious is the `if-statement` ending with a semicolon instead of having a body.
comment on: http://stackoverflow.com/q/27236396

http://stackoverflow.com/q/27195962
has comment: http://stackoverflow.com/comment/42877420
answer count: 1
has body: I have problem with my code. I wrote program for count words in text, but I have small problem with patterns which must be search in text. Maybe somebody can help me. import java.util.*; class KomparatorLicz implements Comparator&lt;Word&gt; { @Override public int compare(Word arg0, Word arg1) { return arg1.amount - arg0.amount; } } class KomparatorString implements Comparator&lt;Word&gt; { @Override public int compare(Word obj1, Word obj2) { if (obj1.content == obj2.content) { return 0; } if (obj1.content == null) { return -1; } if (obj2.content == null) { return 1; } return obj1.content.compareTo(obj2.content); } } class Word { public String content; public int amount; public Word(String content, int amount) { this.content = content; this.amount = amount; } @Override public String toString() { return "Word [content=" + content + ", amount=" + amount + "]"; } } public class Source4 { public static float procent(int wordCount, int oneWord) { return (((float)oneWord*100)/(float)wordCount); } public static void main(String[] args) { String line, wordsLine[]; String klucze = null; int valTemp; int wordCount=0; int keyWords=0; HashMap&lt;String, Word&gt; slownik = new HashMap&lt;String, Word&gt;(); ArrayList&lt;Word&gt; lista= new ArrayList&lt;Word&gt;(); ArrayList&lt;Object&gt; keyWordsList = new ArrayList&lt;Object&gt;(); Scanner in = new Scanner(System.in); String alph = in.nextLine(); keyWords = in.nextInt(); for(int i=0; i&lt;keyWords; i++) { klucze = in.next(); keyWordsList.add(klucze); } while(in.hasNextLine()) { line = in.nextLine(); if(line.equals("koniec")) break; wordsLine = line.split("[^" + alph + "]"); for(String s : wordsLine) { if(s != null &amp;&amp; s.length() &gt; 0) { wordCount++; if(slownik.containsKey(s)) { valTemp = slownik.get(s).amount; slownik.remove(s); valTemp++; slownik.put(s, new Word(s,valTemp)); } else { slownik.put(s, new Word(s,1)); } } } } for (String key : slownik.keySet()) { lista.add(slownik.get(key)); } Collections.sort(lista, new …
has comment: http://stackoverflow.com/comment/42876918
has comment: http://stackoverflow.com/comment/42877295
has title: Comparing words
type: AnsweredQuestion
tagged with: compare
has comment: http://stackoverflow.com/comment/42877139
type: Question
has answer: http://stackoverflow.com/a/27196430
has comment: http://stackoverflow.com/comment/42877171
accepted answer: http://stackoverflow.com/a/27196430
linked to: http://stackoverflow.com/q/7378451
score: 0
tagged with: java

http://stackoverflow.com/comment/118088941
type: AnswerComment
comment on: http://stackoverflow.com/a/54050721
type: Comment
has text: Thanks a lot! It helped!!
score: 0

http://stackoverflow.com/q/27299126
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43062269
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27299186
accepted answer: http://stackoverflow.com/a/27299186
type: Question
has title: "Cannot find symbol variable" compilation error for inner class
has body: I'm a newcomer to Java and this is probably a basic question, but after looking at some references on inner classes I can't figure out why this android code produces a compilation error of "cannot find symbol variable ButtonListener" in the OnCreate method public class MainActivity extends Activity { private class ButtonListener extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("TAG", "test"); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButtonListener = new ButtonListener(); registerReceiver(ButtonListener, new IntentFilter("12345")); }
answer count: 1

http://stackoverflow.com/a/27179771
has comment: http://stackoverflow.com/comment/42848677
downvote count: 0
answers question: http://stackoverflow.com/q/27178461
type: Answer
score: 2
has body: You don't need any filters for it. No changes in Foo and Bar classes. New MixInFoo class: public class MixInFoo { @JsonProperty("mixinFooId") private Integer id; @JsonIgnore private String name; } I've changed 'id' property name just to illustrate that you can change response completely without modifying original Foo class. ObjectMapper objectMapper = new ObjectMapper(); objectMapper.getSerializationConfig().addMixInAnnotations(Foo.class, MixInFoo.class); objectMapper.getDeserializationConfig().addMixInAnnotations(Foo.class, MixInFoo.class); String result = objectMapper.writeValueAsString(json); You will need to register MixIn classes as shown. ******* Filter based implementation *********** Yes, you can use Filter to achieve the same result. You need to add @JsonFilter to the Foo class and name it like "FooFilter". Then you can add Filter that will apply only to the Foo class: @JsonFilter("FooFilter") public class Foo { private Integer id; private String name; } public class Bar { private Integer id; private String name; private Foo foo; } public static void main(String []args) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String []fooIgnore = {"name"}; SimpleBeanPropertyFilter propertyFilter = SimpleBeanPropertyFilter.serializeAllExcept(fooIgnore); FilterProvider filterProvider = new SimpleFilterProvider().addFilter("FooFilter", propertyFilter); ObjectWriter objectWriter = objectMapper.writer(filterProvider); String result = objectWriter.writeValueAsString(json); System.out.println(result); } In that implementation you don't need to extend and implement you custom SimpleBeanProvider to apply the filter only to the Foo class.
upvote count: 2
has comment: http://stackoverflow.com/comment/42854854

http://stackoverflow.com/q/27170469
score: 0
has comment: http://stackoverflow.com/comment/42836033
answer count: 1
has comment: http://stackoverflow.com/comment/42834131
has comment: http://stackoverflow.com/comment/42831762
has comment: http://stackoverflow.com/comment/42834894
has body: I am using Hibernate in my object and getting lazyinitializationexception even when session is not closed. Here is the relation of the objects in issue. There are 3 Objects: ObjectA ObjectB ObjectC ObjectA includes ObjectB as FetchType=EAGER ObjectB includes ObjectC as FetchType=LAZY We are fetching ObjectA. So, because of eager fetch type, it is automatically fetching ObjectB. But when I am trying to fetch ObjectC using ObjectB, it is giving this error. The code is too big and proprietary. So, can't share the code. Note: 1. All these operations are being done inside one transaction only. 2. I checked the logs and found out that session is not being closed. 3. I found similar link - LazyInitializationException in JPA and Hibernate I am using annotationDriven tag also in my code as suggested in this link. I am not getting if why is it happening.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27185501
tagged with: lazy-loading
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42998703
type: Question
tagged with: debugging
has title: lazyinitializationexception when session is not closed
linked to: http://stackoverflow.com/q/12428085
has comment: http://stackoverflow.com/comment/42832269
has comment: http://stackoverflow.com/comment/42834127

http://stackoverflow.com/q/27271933
tagged with: spring
has body: I am interested in injecting Actors to beans, while the actors will be created by spring. In addition, I am looking for ways to customize Akka configuration file path. My project uses Java 7 and spring 3.2.5, akka version is 2.3.7. I read some documents and guides that instruct to create a bean definition in my spring beans configuration file, as follows: &lt;bean id="system-actor" class="akka.actor.ActorSystem" factory-method="create" destroy-method="shutdown" scope="singleton"&gt; &lt;constructor-arg value="MyApp" /&gt; &lt;/bean&gt; The system actor created by spring successfully according to default configuration. Questions: I want to initialize the system actor according to /WEB-INF/application.conf file, I added the -Dconfig.trace=loads system property in order to debug configuration loading, this is the output: Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.conf exception loading application.conf: java.io.IOException: resource not found on classpath: application.conf Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.json exception loading application.json: java.io.IOException: resource not found on classpath: application.json Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.properties exception loading application.properties: java.io.IOException: resource not found on classpath: application.properties Did not find 'application' with any extension (.conf, .json, .propert…
tagged with: java
type: Question
has title: Integrate Akka with Spring in Java web application project under Tomcat7
tagged with: akka
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27273160
type: UnansweredQuestion

http://stackoverflow.com/comment/42815786
comment on: http://stackoverflow.com/q/27161074
type: QuestionComment
score: 0
has text: You have a switch on your command line or IDE that's set to Java version 1.6 or less. Multicatch requires 1.7 or greater.
type: Comment

http://stackoverflow.com/q/27266130
score: 0
has title: Appropriate replacement function for toString method
answer count: 1
has comment: http://stackoverflow.com/comment/43003630
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43003502
tagged with: java
has comment: http://stackoverflow.com/comment/43003728
type: Question
has body: I have below lines of code in my java source. I'm not supposed to use "toString" method. Can you pls suggest any appropriate method for it. public void logDebug(String eventType, String info) { String[] source = getSourceAndLineNumber(); StringBuffer log= new StringBuffer(eventType).append(":::").append(source[0]); log.append(":::").append(source[1]).append(":::\n").append(info).append("\n"); logInfo.log(Level.INFO, log.toString()); }
has answer: http://stackoverflow.com/a/27266153

http://stackoverflow.com/q/27205295
downvote count: 0
tagged with: android-loadermanager
has comment: http://stackoverflow.com/comment/42952844
favorite count: 0
linked to: http://stackoverflow.com/q/7273061
type: UnansweredQuestion
tagged with: android
has title: App works fine in Debug mode but crashes when running directly
tagged with: android-cursorloader
answer count: 0
upvote count: 3
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42954248
tagged with: android-arrayadapter
has body: I'm working on an Android app developing project, and I'm stuck with a strange situation which is seems to be caused by the constructor of CursorLoader. My app works fine in debug mode, but crashes when it runs without debugging. How can I fix this? Great thanks in advance Code: MainActivity.java package com.tee.quietime; import ...; //All imports needed public class MainActivity extends Activity implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; { public final static String EXTRA_MESSAGE = "com.tee.quietime.MESSAGE"; eventsListAdapter adapter; protected static GregorianCalendar selectedDate; protected static TextView selectedDateTxt; protected static TextView emptyText; protected static CalendarView mainCalendar; protected static ListView selectedDateEventsList; private static final TimeZone defaultTZ=TimeZone.getDefault(); private static final int INSTANCES_LOADER = 0; private static final String ID_COLNAME = CalendarContract.Instances._ID; private static final String BEGIN_COLNAME = CalendarContract.Instances.BEGIN; private static final String END_COLNAME = CalendarContract.Instances.END; private static final String END_DAY_COLNAME = CalendarContract.Instances.END_DAY; private static final String END_MINUTE_COLNAME = CalendarContract.Instances.END_MINUTE; private static final String EVENT_ID_COLNAME = CalendarContract.Instances.EVENT_ID; private static final String START_DAY_COLNAME = CalendarContract.Instances.START_DAY; private static final String START_MINUTE_COLNAME = CalendarContract.Instances.START_MINUTE; private static final String ALL_DAY_COLNAME = CalendarContract.Instances.ALL_DAY; private static final String DURATION_COLNAME = CalendarContract.Instances.DURATION; private static final String LOCATION_COLNAME = CalendarContract.Instances.EVENT_LOCATION; private static final String TITLE_COLNAME = CalendarContract.Instances.TITLE; private static final String TIMEZONE_COLNAME = CalendarContract.Instances.EVENT_TIMEZONE; private static final String END…

http://stackoverflow.com/comment/42801482
has text: Short answer no. Long answer yes, but you'll need to use native code. JNI or JNA.
comment on: http://stackoverflow.com/q/27153444
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/43002706
has text: `ListOfView.get(i).getText().toString()` But it won't work in `onCreateView`. Put In button click.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27265575

http://stackoverflow.com/comment/43045034
score: 0
type: Comment
has text: With HH you will get 01:18, not 13:58. It's not correct!
comment on: http://stackoverflow.com/a/27289270
type: AnswerComment

http://stackoverflow.com/comment/42838353
comment on: http://stackoverflow.com/a/27174336
has text: Race condition, never mind lol . The question is too trivial anyway :p
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27164311
tagged with: swing
has comment: http://stackoverflow.com/comment/42821375
answer count: 1
has comment: http://stackoverflow.com/comment/42821264
has body: I have lot of things implemented in ComponentAdapter of Java. Since it does loading data from database and displaying in JTable, I added it into another thread. I will show you one method which is being called by such ComponentAdapter private class DisplayInitialRevenue_Thread implements Runnable { @Override public void run() { displayInitialRevenue_Method(); } } private void displayInitialRevenue_Method() { //Get the dates from the combo String selectedCouple = revenueYearCombo.getSelectedItem().toString(); if(selectedCouple.equals("Select Year")) { return; } String[] split = selectedCouple.split("/"); //Related to DB double totalamountInvested; //Get data from the database dbConnector = new DBHandler(); dbConnector.makeConnection(); DefaultTableModel model = (DefaultTableModel) initialRevenueTable.getModel(); model.setRowCount(0); ResultSet selectAllDetails = dbConnector.selectAllDetails("SQL CODE HERE "); try { if(selectAllDetails.isBeforeFirst()==false) { JOptionPane.showMessageDialog(null,"This table is empty"); } else { while(selectAllDetails.next()) { String clientName = selectAllDetails.getString("Client Name"); String providerName = selectAllDetails.getString("Provider Name"); Double amountInvested = selectAllDetails.getDouble("Invest_Amount"); //Get Other Data //Update the table Object[]row = {dateS,clientName,providerName,amountInvested}; model.addRow(row); //Get the total amountInvested = amountInvested+amountInvested; } //Add the sum Object[]blankRow = {null,null,null,null}; model.addRow(blankRow); Object[]row = {dateS,clientName,providerName,amountInvested}; } } catch(SQLException sql) { JOptionPane.showMessageDialog(null,sql.getLocalizedMessage()); } } And, this above thread can be called in 3 ways. That is by ItemListener attached to a JComboBox, ActionListener attached to a JMenuand ComponentListener. ComponentListener private class DisplayInitialRevenue extends ComponentAdapter { public void componentShown(ComponentEvent e) { formMemorizer = FormMe…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27164344
type: Question
has title: Application is freezing when database is called
has comment: http://stackoverflow.com/comment/42821350
has comment: http://stackoverflow.com/comment/42821273
tagged with: freeze
has comment: http://stackoverflow.com/comment/42821307
tagged with: java
score: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/27164344
tagged with: mysql
linked to: http://stackoverflow.com/q/7053865

http://stackoverflow.com/q/27229091
tagged with: java
has answer: http://stackoverflow.com/a/27229250
type: Question
answer count: 2
score: 2
accepted answer: http://stackoverflow.com/a/27229250
downvote count: 0
has answer: http://stackoverflow.com/a/27229171
has comment: http://stackoverflow.com/comment/42935461
has title: Futuristic GUI in Java?
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/27229171
favorite count: 0
has body: First of all sorry for my english, it's not my mother tongue. I want to made a program in java, i was thinking that it will look great with a futuristic graphical user interface. When i say "futuristic", i mean something like this: I know it's the image of an Android application but i'd like to do something like this in a java program. Usually when i have to do GUIs in java i use Swing components, but now i need to personalize everything, and i'd also like that when i click "Send" for example the circle becomes bigger and other things appears inside it. So i need to have a complitely personalized and animated GUI. Which is the best way to do it? Swing, Awt, JavaFx or what else? Thank you in advance.
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/q/27236856
has comment: http://stackoverflow.com/comment/42950641
has answer: http://stackoverflow.com/a/27236982
downvote count: 0
has comment: http://stackoverflow.com/comment/42950303
tagged with: shuffle
accepted answer: http://stackoverflow.com/a/27236910
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42950283
has comment: http://stackoverflow.com/comment/42950879
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27236910
has comment: http://stackoverflow.com/comment/42950409
has comment: http://stackoverflow.com/comment/42950464
has comment: http://stackoverflow.com/comment/42950459
answer count: 2
has comment: http://stackoverflow.com/comment/42951456
has title: Error while shuffling an Array in Java
upvote count: 1
tagged with: swap
favorite count: 0
has comment: http://stackoverflow.com/comment/42950550
tagged with: xor
possible better answer: http://stackoverflow.com/a/27236982
has body: This is what I have so far int[] question = new int[25]; for (int i = 0; i &lt; question.length; i++){ question[i] = i+1; } Random rand = new Random(); int max = question.length-1, min = 1; for(int i = 0; i &lt; question.length; i++){ int idx = rand.nextInt((max - min) + 1) + min; randg[i] = idx; question[i] ^= question[idx]; question[idx] ^= question[i]; question[i] ^= question[idx]; if(question[i] == 0){ System.out.println("Something went wrong!" + i + " " + idx); } } So the problem seems to be when the rand value (idx) is equal to i, for the swap... it just replaces the value with 0. How do I fix that problem?
has comment: http://stackoverflow.com/comment/42950336
has comment: http://stackoverflow.com/comment/42950810
has comment: http://stackoverflow.com/comment/42950269
has comment: http://stackoverflow.com/comment/42950354

http://stackoverflow.com/q/27178255
favorite count: 0
has title: How to set JAVA HOME in Ant build.xml
tagged with: http://stackoverflow.com/tag/xml
score: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has body: I have the following build.xml file and i want to set JAVA HOME path but i don't know where to write and what to write. Does anyone wants to help me? <delete dir="build"/> <mkdir dir="build/classes"/> <javac srcdir="src" destdir="build/classes"/> <mkdir dir="build/jar"/> <attribute name="Main-Class" value="Master"/> <java jar="mapreduce.jar" fork="true"/>
has answer: http://stackoverflow.com/a/27178540
tagged with: ant
tagged with: java
answer count: 1

http://stackoverflow.com/comment/42924838
score: 0
comment on: http://stackoverflow.com/q/27223045
type: Comment
type: QuestionComment
has text: Well that's shown part of your code - although it suggests you're not closing your statement, which is worrying. You haven't given any of the rest of the information, however - and we don't know whether you have lots of rows to insert in one go, in which case batching might help, too.

http://stackoverflow.com/q/27205544
has answer: http://stackoverflow.com/a/27205627
score: 1
has comment: http://stackoverflow.com/comment/42893685
has title: contains() method not working as expected
tagged with: string
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/27205585
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/72749612
tagged with: contains
has answer: http://stackoverflow.com/a/27205585
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27205627
downvote count: 0
has body: I am building a voice assistant for android, here this method retrieves contact names one by one and compares it to to SpeechToText input. I am successfully getting the contact names, but when I am comparing it with my input text, nothing is happening. Here is the code private void callFromContact(String text_received, int index){ Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null); while (phones.moveToNext()) { String name=phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); if(text_received.toLowerCase().contains(name)){ String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); contactNames.add(name); contactNumbers.add(phoneNumber); } } Here for example I sending "call karan" as input, while debugging the name "Karan" comes up as the value of name variable, but when comparing it in if-statement, nothing happens, I mean the next statement is not executed, what might be the problem, help would be appreciated.

printf
tags question: http://stackoverflow.com/q/27209450
tag name: printf
tags question: http://stackoverflow.com/q/27210345
type: Tag

http://stackoverflow.com/a/27207992
type: Answer
has comment: http://stackoverflow.com/comment/42897950
answers question: http://stackoverflow.com/q/27207965
accepted answer of: http://stackoverflow.com/q/27207965
has comment: http://stackoverflow.com/comment/42898061
type: AcceptedAnswer
score: 0
has body: int[][] matrix = new int[sizeX][sizeY] for (int i = 0; i &lt; matrix.length; i++) { for (int j = 0; j &lt; matrix[i].length; j++) { //do matrix processing here with matrix[i][j] } }

http://stackoverflow.com/a/27702208
has body: Looks like you're using an old version of jcabi-w3c. Try the latest one (1.1). If you still have the same issue, submit a ticket here: https://github.com/jcabi/jcabi-w3c/issues We'll try to help
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/27232668
type: Answer
downvote count: 1

http://stackoverflow.com/a/27283555
answers question: http://stackoverflow.com/q/27282474
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27282474
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43036310
type: Answer
downvote count: 0
has body: Well the problem is that you need to retain your inheritance as generic type information. Basically you would have to do something like: class PlayerCharacter&lt;P extends PlayerCharacter&lt;P&gt;&gt; { List&lt;Trait&lt;? super P&gt;&gt; myTraits; } class VampirePlayer extends PlayerCharacter&lt;VampirePlayer&gt; {...} abstract class Trait&lt;P extends PlayerCharacter&lt;P&gt;&gt; { abstract void apply(P player); } class FangLengthTrait extends Trait&lt;VampirePlayer&gt; {...} It begins to get very clunky, though. You can somewhat improve the situation by approaching from composition: class Attributes {} class Base extends Attributes { int strength; } class Vampire extends Base { int fangLength; } class Player&lt;A extends Attributes&gt; { final A attributes; final List&lt;Trait&lt;? super A&gt;&gt; traits = new ArrayList&lt;&gt;(); Player(A attributes) { this.attributes = attributes; } void applyTraits() { for(Trait&lt;? super A&gt; t : traits) t.apply(this); } } interface Trait&lt;A extends Attributes&gt; { void apply(Player&lt;? extends A&gt; player); } class StrengthTrait implements Trait&lt;Base&gt; { @Override public void apply(Player&lt;? extends Base&gt; player) { player.attributes.strength = 1000; } } class FangLengthTrait implements Trait&lt;Vampire&gt; { @Override public void apply(Player&lt;? extends Vampire&gt; player) { player.attributes.fangLength = 100; } } final class Factory { private Factory() {} public static Player&lt;Base&gt; newPlayer() { return new Player&lt;Base&gt;(new Base()); } public static Player&lt;Vampire&gt; newVampire() { return new Player&lt;Vampire&gt;(new Vampire()); } } I still find it clunky, personally. If you are mainly just using these Traits to construct objects you might think about using a builder or factory so you don't need to use generics.
score: 3

http://stackoverflow.com/q/27187264
answer count: 2
has answer: http://stackoverflow.com/a/27187321
accepted answer: http://stackoverflow.com/a/27187321
possible better answer: http://stackoverflow.com/a/27187371
has title: Program to display character only displays '?' in java
has body: Wrote a program to display all that character. But the output only display the ? character. I am a total newbie, please help. public class charSheet { public static void main(String args[]){ char c; for(int i = 0; i &lt; 65536; i++){ c = (char) i; System.out.println(i + "---" + c); } } } Output(only a part): 57987---? 57988---? 57989---? 57990---? 57991---? 57992---?
tagged with: character
has answer: http://stackoverflow.com/a/27187371
has comment: http://stackoverflow.com/comment/42861127
has comment: http://stackoverflow.com/comment/42861143
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42861090
score: 0

http://stackoverflow.com/a/27211839
upvote count: 3
type: Answer
has body: You will not get a numeric sort for the first column simply because the data are String and not numeric, I would suggest you keep your data as Integer, Object[][] data = { {75500, "Don't Let Go", new Integer(179)}, {121343, "Photograph", new Integer(29)}, {32323, "Hash Pipe", new Integer(186)} }; Create and use a new cellRender with the format you want: table.setDefaultRenderer(Integer.class, new DefaultTableCellRenderer() { private NumberFormat numberFormat = new DecimalFormat("#,###,###"); @Override protected void setValue(Object aValue) { Integer value = (Integer) aValue; super.setValue(numberFormat.format(value)); } });
has comment: http://stackoverflow.com/comment/42914170
downvote count: 0
has comment: http://stackoverflow.com/comment/77582714
score: 3
answers question: http://stackoverflow.com/q/27211076

http://stackoverflow.com/q/27284131
answer count: 1
favorite count: 0
has body: I need to handle any given url that is passed to our library. So at first I did: URL url = new URL(filename); URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); url = new URL(uri.toASCIIString()); URLConnection conn = url.openConnection(); For the url http://www.stackoverflow.com?title=Člen8FO this gave me a url of http://www.stackoverflow.com?title=%C4%8Clen8FO And that returned a 403 when I made the request. So then I did: URL url = new URL(filename); URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), URLEncoder.encode(url.getQuery(), "UTF-8"), url.getRef()); url = new URL(uri.toASCIIString()); Which gives me a url of http://www.stackoverflow.com?title%3D%C4%8Clen8FO Why does it fail on an explicit =? I thought that was fully valid. Update: This is so weird. The below code failed before, now it succeeds. import java.io.InputStream; import java.net.*; public class UriIssue { public static void main(String[] args) { try { openUriWithEncode("http://www.google.com/?q=Člen8FO"); System.out.println("completed successfully"); } catch (Exception ex) { System.out.println("exception = " + ex); } try { openUriNoEncode("http://www.google.com/?q=Člen8FO"); System.out.println("completed successfully"); } catch (Exception ex) { System.out.println("exception = " + ex); } } public static void openUriWithEncode(String fullUrl) throws Exception { System.out.println("openUriWithEncode(" + fullUrl + ")"); URL url = new URL(fullUrl); String query = url.getQuery() != null ? URLEncoder.encode(url.getQuery(), "UTF-8") : null; URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), query, url.getRef()); System.out.println("uri = " + uri.toASCIIString()); url = new URL(uri.toASCIIString()); URLConnection conn = url.openConnection(); InputStream stream = conn.getInputStream(); stream.close(); } public static void openU…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43036662
has title: Why do I need to url encode =?
tagged with: urlencode
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27306415
tagged with: url-encoding
has comment: http://stackoverflow.com/comment/43037049
downvote count: 0

http://stackoverflow.com/a/27237027
has comment: http://stackoverflow.com/comment/42974642
type: Answer
has comment: http://stackoverflow.com/comment/42983178
score: 2
answers question: http://stackoverflow.com/q/27223562
downvote count: 0
upvote count: 2
has body: Probably the fastest way to convert a specific, say, int between big and little endian is Integer.reverseBytes.

http://stackoverflow.com/q/27243036
tagged with: php
has comment: http://stackoverflow.com/comment/42962477
has answer: http://stackoverflow.com/a/27243107
has comment: http://stackoverflow.com/comment/42962751
tagged with: java
tagged with: mysql
has body: I tried an internet tutorial about inserting the data into mysql from Android in the activity_main.xml, there are button to register new user. So i put all the information such as firstname, etc. When the user clicks the submit button, it should redirect back to activity_main.xml. But when I click submit, the app is forced to close, and the data is not inserted into mysql database. My question is, What exactly is wrong in the code ? Please give me advice. Everything in the code is the same what i had also used for my android application. Also I am providing log traces here. Any help is appreciated... regactivity.java package com.example.estate; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; public class RegActivity extends Activity { // Progress Dialog private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText fname; EditText lname; EditText username; EditText password; EditText location; EditText contact; Button btnreg; Button btncancel; // url to create new product private static String url_new_user = "http://192.168.43.236/Estate_Conny/new_user.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reg_activity); // Edit Text fname = (EditText) findViewById(R.id.fname); lname = (EditText) findViewById(R.id.lname); username = (EditText) findViewById(R.id.uname); password = (EditText) findViewById(R.id.pass); location = (EditText) findViewById(R.id.addr); contact = (EditText) findViewById(R.id.…
type: Question
has comment: http://stackoverflow.com/comment/42962099
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42961788
answer count: 1
favorite count: 0
has title: the app force close after submitting the data into mysql
type: UnansweredQuestion
tagged with: android
downvote count: 2

http://stackoverflow.com/comment/42971042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27248147
score: 0
has text: @hemanth, Connecting to MySQL using Oracle JDBC driver? huh?

http://stackoverflow.com/a/27268141
answers question: http://stackoverflow.com/q/27268027
type: Answer
has body: int size = cust.size(); cust.get(size - 1);
score: 0

http://stackoverflow.com/a/27276391
has comment: http://stackoverflow.com/comment/43052521
has comment: http://stackoverflow.com/comment/43027930
has comment: http://stackoverflow.com/comment/43022302
upvote count: 1
has body: What did you select as Packaging Format? If you select "All" it will generate a self-contained installer which has the JRE included.
has comment: http://stackoverflow.com/comment/43045102
type: Answer
has comment: http://stackoverflow.com/comment/43053373
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43041634
has comment: http://stackoverflow.com/comment/43032054
answers question: http://stackoverflow.com/q/27269864
has comment: http://stackoverflow.com/comment/43052709
has comment: http://stackoverflow.com/comment/43029648

http://stackoverflow.com/a/27252132
answers question: http://stackoverflow.com/q/27250415
type: Answer
accepted answer of: http://stackoverflow.com/q/27250415
has body: The question premise is false. The sources are being generated, but go under src/main/java/com/google/protobuf rather than src/main/java/google/protobuf as one might expect from the package name in descriptor.proto. Edit - the java package name is given in the proto file like so: package google.protobuf; option java_package = "com.google.protobuf";
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42997614

http://stackoverflow.com/comment/43072182
comment on: http://stackoverflow.com/q/27304594
score: 0
type: Comment
type: QuestionComment
has text: Change your constructor to take an int.

http://stackoverflow.com/a/27265248
answers question: http://stackoverflow.com/q/27265090
has body: Please check the below link from Android Developer site; http://developer.android.com/google/play-services/setup.html If it is from bitbucket, 1. Unzip your file 2. Import to tour workspace by Click File > Import, select Android > Existing Android Code into Workspace 3. Add Reference library to your project (http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject) 4. Add &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; this inside your application element of the Manifest file
type: Answer
score: 0

http://stackoverflow.com/a/27220115
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27216265
has body: Any hashing or checksumming algorithm will give you a stable result (always the same answer for the same content). The quality of the algorithm will determine how many conflicts you have (different content that returns the same result). You could use the standard Java CRC32 checksummer but it really wants bytes, not floats. I think your suggestion to use the Arrays.hashCode(float[]) will return exactly what you want (a relatively stable int deterministically computed from the content in the given array). Be aware that if you start caching vertex arrays, you will need to be extra careful if those arrays are mutated or changed in anyway. (The cached entry will need to be invalidated, and you might end up sharing mutations you didn't mean to share.)
answers question: http://stackoverflow.com/q/27216265
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27204662
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42892030
type: Answer
has comment: http://stackoverflow.com/comment/42891921
downvote count: 0
has comment: http://stackoverflow.com/comment/42898908
accepted answer of: http://stackoverflow.com/q/27204341
has body: The nested loops are not required, this can be done with one SQL statement that joins the table and sums the amounts. I obviously don't have all the column names at my disposal but you should be able to replace the names I've used with your own: SELECT company.name, SUM(bill.amount) - SUM(cheque.amount) AS amount FROM imone AS company INNER JOIN saskaitos AS bill ON company.id = bill.imone LEFT JOIN kvitai AS cheque ON bill.sask_nr = cheque.sask_nr GROUP BY company.name;
answers question: http://stackoverflow.com/q/27204341
score: 1
upvote count: 1

http://stackoverflow.com/a/27307137
has comment: http://stackoverflow.com/comment/43077231
upvote count: 1
has comment: http://stackoverflow.com/comment/43077573
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43076646
has body: This should work. I think you may have forgot to continue iterating through the list after you did the initial Junction currentJunction = junctionIterator.next();, so you never really moved through the list. Also, you may want to always check hasNext() before using next() in case there is an empty list. public int searchJunction(IRobot robot) { boolean foundJunction = false; Junction currentJunction = null; //Iterate through list until the end, or until correct junction is found. while (!foundJunction &amp;&amp; junctionIterator.hasNext()) { currentJunction = junctionIterator.next(); if ((((currentJunction.x)==(robot.getLocation().x))) &amp;&amp; ((currentJunction.y)==(robot.getLocation().y))) { foundJunction = true; } } return currentJunction; } Hope this clears things up.
has comment: http://stackoverflow.com/comment/43077359
accepted answer of: http://stackoverflow.com/q/27306892
has comment: http://stackoverflow.com/comment/43077748
type: Answer
answers question: http://stackoverflow.com/q/27306892
has comment: http://stackoverflow.com/comment/43077079
has comment: http://stackoverflow.com/comment/43077151
score: 1

http://stackoverflow.com/q/27313804
tagged with: jpa
answer count: 1
tagged with: jta
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27314211
tagged with: transactions
tagged with: java
tagged with: hibernate
has title: Hibernate Transaction Timeout - Exception Handling
type: Question
has body: I set transaction timeout to 10 second. The transaction gets timed out. Will it throw any exception ? (In hibernate) try { session.getTransaction.setTimeout(10); session.getTransaction().begin(); session.persists(something); session.getTransaction().commit(); } catch(Transaction - Time - out Exception) { if it times out I want to come here. }

http://stackoverflow.com/q/27214409
has body: Can any one please suggest me a idea for the achieving below pagination. 1 2 3 4 5 next&gt;&gt; suppose if you are clicking "next>>" it should show next set of pagination like below 6 7 8 9 10 next&gt;&gt; and control should be in 6th page scenario: 1 2 3 4 5 next&gt;&gt; if we are in any of the page and clicking next&gt;&gt; should go to 6th page i.e next set's 1st page ex: if we are in 2nd page and next&gt;&gt; should go to 6th page or 3rd page next&gt;&gt; go to 6th page?? Thanks in advance.
answer count: 1
type: UnansweredQuestion
tagged with: demandware
has answer: http://stackoverflow.com/a/31805388
tagged with: java
score: 0
type: Question
tagged with: javascript
has title: Pagination logic
has comment: http://stackoverflow.com/comment/42908940

http://stackoverflow.com/comment/43815230
has text: Hi, I am going thorugh the same problem. Can we have a proper solution ?
type: Comment
comment on: http://stackoverflow.com/a/27155906
score: 0
type: AnswerComment

http://stackoverflow.com/a/27219938
answers question: http://stackoverflow.com/q/27219854
has comment: http://stackoverflow.com/comment/42923626
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42919408
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42919318
score: 2
accepted answer of: http://stackoverflow.com/q/27219854
has body: Since 8 is a power of 2, you have a quick way to obtain the next number: int theSize = (orig + 7) &amp; ~7; As to reading into a byte array directly, you say you use nio; therefore allocate a ByteBuffer of the requested size and .read() into it from the channel associated with the file (use FileChannel.open()). Then get the underlying array using the .array() method of ByteBuffer. (note: DO NOT .allocateDirect()! Otherwise .array() won't work) It would have been ideal if you could FileChannel.map() to the wanted size, unfortunately mapping to a greater size modifies the underlying file, so no dice here... Sample code: final Path path = Paths.get("path/to/wanted/file"); try ( final FileChannel channel = FileChannel.open(path, StandardOpenOption.READ); ) { final int bufsize = ((int) channel.size() + 7) &amp; ~7; final ByteBuffer buf = ByteBuffer.allocate(bufsize); channel.read(buf); return buf.array(); }

http://stackoverflow.com/q/27261929
downvote count: 0
favorite count: 0
has title: Import .txt into Array, output W/ Dialog boxes
tagged with: joptionpane
has body: So I've been working on this code for awhile now and before adding the JOptionPane I tested it and there were 0 errors, then I added the JOptionPane and got between 27-38. So I clearly did something wrong in my JOptionPane but I'm not sure what, I only have experience using Scanner for the most part so any help would be appreciated. Thank you! import javax.swing.JOptionPane; import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class TestScores { public static void main(String args[]) throws IOException { String filename = ("scores.txt"); File file = new File(filename); Scanner inputFile = new Scanner(file); while (inputFile.hasNextInt()) { String line = inputFile.nextLine(); ArrayList&lt;Integer&gt; scores = new ArrayList&lt;Integer&gt;(); Scanner scanner = new Scanner(line); scanner.useDelimiter(","); while(scanner.hasNextInt()) { scores.add(scanner.nextInt()); } scanner.close(); } } public static int averageScore(int[] numbers) { int total = 0; for (int i : numbers) { total += i; } return total/(numbers.length); } public static int modeOfScores(int[] numbers) { int modeCount = 0; int mode = 0; int currCount = 0; int currElement; for (int candidateMode : numbers) { currCount = 0; for (int element : numbers) { if (candidateMode == element) { currCount++; } } if (currCount &gt; modeCount) { modeCount = currCount; mode = candidateMode; } } return mode; } public static int lowestScore(int[] numbers) { int lowest = numbers[0]; for(int i = 1; i &gt; numbers.length; i++) { if(numbers[i] &lt; lowest) { lowest = numbers[i]; } } return lowest; } public static int largestScore(int[] numbers) { int largest = numbers[0]; for(int i = 1; i &lt; numbers.length; i++) { if(numbers[i] &gt; largest) { largest = numbers[i]; } } return largest; } JOptionPane.showMessageDialog (null, "The Average number is: " + total); JOptionPane.showMessageDialog (null, "The Mode number is: " + mode); JOptionPane.showMessageDialog (null, "The Lowest number is: " + lowest); JOp…
has answer: http://stackoverflow.com/a/27262043
has comment: http://stackoverflow.com/comment/42996648
accepted answer: http://stackoverflow.com/a/27262043
tagged with: methods
tagged with: import
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
tagged with: arrays

http://stackoverflow.com/a/27173993
upvote count: 2
has body: cast[^\n]+\n[^\n]+\n[^\n]*datetime Try this.See demo. http://regex101.com/r/hQ9xT1/2 Edit: Use cast([^\n]+\n){0,2}[^\n]*datetime If you want to match 1 to 3 lines. http://regex101.com/r/hQ9xT1/4
answers question: http://stackoverflow.com/q/27173837
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/a/27295945
upvote count: 2
answers question: http://stackoverflow.com/q/27295827
has body: There probably are not; and even if they were it wouldn't have any use. The JIT will perform loop unrolling (at least, Oracle JVM's JIT does) when it estimates that it is beneficial. Among other optimizations. Write code that is obviously correct and let the JVM handle optimization. The JIT is smarter than you anyway. Repeat after me: the JIT is smarter than you ;)
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/27262629
tagged with: docker
accepted answer: http://stackoverflow.com/a/27300434
answer count: 3
downvote count: 0
tagged with: jvm
favorite count: 0
has body: I cant seem to run java at all in a Docker container on my server. Even when issuing java -version, I get the following error. root@86088d679103:/# java -version OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000035ce1000000, 2555904, 1) failed; error='Operation not permitted' (errno=1) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory. # An error report file with more information is saved as: # //hs_err_pid17.log According to this, java can't map 2.5Mb of space for reserved memory? This does not seem right... I have the full log included at the end, but for the sake of some extra information, my system is reporting the following: root@86088d679103:/# uname -m x86_64 root@86088d679103:/# free -mh total used free shared buffers cached Mem: 15G 9.7G 5.8G 912K 148M 8.9G -/+ buffers/cache: 639M 14G Swap: 15G 0B 15G Can anyone point me in the right direction? Full Log: https://gist.github.com/KayoticSully/e206c44681ce261674ba Update @Yobert nailed the problem and I highly suggest you read through the comments and chat log. Good info in there. For those who want the final command that made Java work: setfattr -n user.pax.flags -v "mr" /usr/bin/java If your distro does not have setfattr installed by default it should be included in the installable package attr through paceman, apt-get, etc.
upvote count: 11
type: AnsweredQuestion
tagged with: mmap
score: 11
type: Question
has title: JVM cant map reserved memory when running in Docker container
has answer: http://stackoverflow.com/a/36507784
has answer: http://stackoverflow.com/a/38642395
has answer: http://stackoverflow.com/a/27300434
tagged with: java
possible better answer: http://stackoverflow.com/a/36507784

http://stackoverflow.com/q/27251034
tagged with: java
has comment: http://stackoverflow.com/comment/42977633
has comment: http://stackoverflow.com/comment/42976665
tagged with: stringtokenizer
has comment: http://stackoverflow.com/comment/42977072
type: Question
has comment: http://stackoverflow.com/comment/42976248
has comment: http://stackoverflow.com/comment/42976430
has comment: http://stackoverflow.com/comment/42977452
has comment: http://stackoverflow.com/comment/42977485
answer count: 1
has comment: http://stackoverflow.com/comment/42976396
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/42977559
has comment: http://stackoverflow.com/comment/42976796
has comment: http://stackoverflow.com/comment/42976332
has comment: http://stackoverflow.com/comment/42976331
has comment: http://stackoverflow.com/comment/42977311
has answer: http://stackoverflow.com/a/27251206
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: I can't split string into token using StringTokenizer in java
has body: I am trying to split string into token using StringTokenizer. My code is : String original = "Short stories for kids are adventurous and interesting ways to teach your children about good morals and right conduct."; String delimiters = "+-*/(),.? "; StringTokenizer st = new StringTokenizer(original, delimiters); while (st.hasMoreTokens()) { String w = st.nextToken(); System.out.println("tokens are = = = "+w); } When i run this code output is : token are = = = Short token are = = = stories token are = = = for token are = = = kids are token are = = = adventurous token are = = = and token are = = = interesting token are = = = ways token are = = = to token are = = = teach token are = = = your token are = = = children token are = = = about token are = = = good token are = = = morals token are = = = and token are = = = right token are = = = conduct I am used space (+-*/(),.? ) as a delimiter. There is one word called kids are. Where i am getting confused output. But it is something socked output...!!! Actually i believe the output is both word as a separate out by space (delimiter). Why i am getting this type of output ?
has comment: http://stackoverflow.com/comment/42976554

http://stackoverflow.com/comment/43427239
type: AnswerComment
comment on: http://stackoverflow.com/a/27418802
score: 0
type: Comment
has text: Thanks for the update. This is not expected: I expect the header to do a lookup at every rollover, without this value being cached anywhere. Let's follow up in the Log4j2 Jira ticket https://issues.apache.org/jira/browse/LOG4J2-921

http://stackoverflow.com/comment/42930966
score: 0
type: Comment
has text: Two questions please: (1) could you post an example of your 'insert' code, in particular are you making sure that the java references point both ways (2) after your insert, did you try and peek in your database - could you tell what data you see there.
type: QuestionComment
comment on: http://stackoverflow.com/q/27225454

http://stackoverflow.com/q/27221634
score: 1
accepted answer: http://stackoverflow.com/a/27221658
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42922015
type: Question
has comment: http://stackoverflow.com/comment/42922161
linked to: http://stackoverflow.com/q/6729605
answer count: 2
has comment: http://stackoverflow.com/comment/42922016
has answer: http://stackoverflow.com/a/27221658
has comment: http://stackoverflow.com/comment/42922622
has comment: http://stackoverflow.com/comment/42922078
favorite count: 0
possible better answer: http://stackoverflow.com/a/27221762
upvote count: 2
has answer: http://stackoverflow.com/a/27221762
has body: class states{ List&lt;String&gt; cities = new ArrayList&lt;String&gt;(); public void add_city(String current_city){ this.cities.add(current_city); } } class add_values{ public static void main(String [] args){ System.out.println("Enter the state name : "); Scanner sc = new Scanner(System.in); String user_state = sc.nextLine(); // need to create an object with the name from a string value states user_state = new states(); .... .... } } Is there a way to create an object for a class with the name from a string. If, user enters the state name as "Michigan", an object is created with "Michigan" which is got from scanner. and cities can be added for the state Michigan.
has comment: http://stackoverflow.com/comment/42922372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42922046
has title: Is there a way to create an object with object name from the value of a string

http://stackoverflow.com/comment/42808714
type: AnswerComment
type: Comment
has text: Would a debug output guard me against it you think? As @Luiggi mentioned it can be a bit pain as a player to experience that kind of error.
comment on: http://stackoverflow.com/a/27157267
score: 0

http://stackoverflow.com/comment/42925611
score: 0
type: Comment
type: QuestionComment
has text: you can replace part of the string with an empty string result of which is equivalent to delete :)
comment on: http://stackoverflow.com/q/27223634

http://stackoverflow.com/a/27180404
type: Answer
score: 2
upvote count: 2
has body: I don't know if GWT has any special restrictions, but you could wait until they've all succeeded for example using a simple CountDownLatch final CountDownLatch latch = new CountDownLatch(shares.size()); for(final Share share : shares) { someInstance.check(new someCallback() { @Override public void onSuccess() { latch.countDown(); // do something } }); } latch.await(); boolean initalized = true; That would simply block execution until each callback has counted down once. Blocking is usually a bad idea though. So you might want to set initialized ansynchronously as well. and use some callback once it's true.
answers question: http://stackoverflow.com/q/27180309
downvote count: 0

http://stackoverflow.com/comment/43054886
comment on: http://stackoverflow.com/q/27294864
score: 0
has text: @AdrianNasui I find it perfectly comprehensible... In calls to `replaceAll` he specifies *what to replace*. He's looking for a way to specify *what to keep*. It's as simple as that.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42849944
comment on: http://stackoverflow.com/a/27180616
score: 0
type: Comment
has text: sorry, it's the `when` clause, try to check the update
type: AnswerComment

trace
tag name: trace
type: Tag
tags question: http://stackoverflow.com/q/27244807

http://stackoverflow.com/comment/42976248
comment on: http://stackoverflow.com/q/27251034
has text: It should works, are you sure that there is no other whitespace instead of space between `kids` and `are`?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27230101
score: 0
has answer: http://stackoverflow.com/a/27230264
upvote count: 1
has comment: http://stackoverflow.com/comment/42937343
favorite count: 0
has title: How to create as many objects as the user wants?
linked to: http://stackoverflow.com/q/6470651
has comment: http://stackoverflow.com/comment/42937250
has body: I have an assignment upcoming and I will quote the assignment(I am not asking you to do it for me, I just am confused at how to start) Your task is to write a (very simple:-) student record system. You should be able to store details about students - their name, subject and a student number; as well as the level they have most recently completed ranging from 0 (meaning they are still in the first year) through to 3 (meaning they have graduated). It should also store their result for each level they have completed as a number 0-100. Your program should allow the user to enter student data for as many students as they want. Would this be done via objects or not, as I am very confused on this part.. Any advice would be helpful, I can do everything bar this part.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27230608
accepted answer: http://stackoverflow.com/a/27230608
possible better answer: http://stackoverflow.com/a/27230264
tagged with: java
has comment: http://stackoverflow.com/comment/42937421
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42937757
has comment: http://stackoverflow.com/comment/42937358

android-volley
tags question: http://stackoverflow.com/q/27302247
type: Tag
tag name: android-volley
tags question: http://stackoverflow.com/q/27284195

http://stackoverflow.com/comment/42927549
type: AnswerComment
score: 0
type: Comment
has text: what I need in the servlet is to get table'data and then pass them into another java method to save them into mysql database
comment on: http://stackoverflow.com/a/27222312

http://stackoverflow.com/comment/42812100
score: 0
type: Comment
type: QuestionComment
has text: @MarounMaroun Since this is for a tic-tac-toe program, I don't think the output provided by `deepToString` will help.
comment on: http://stackoverflow.com/q/27159057

http://stackoverflow.com/a/27196170
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27196142
downvote count: 0
has body: You're shadowing the variable liste. Replace Personne[] liste = new Personne[t]; with liste = new Personne[t];
has comment: http://stackoverflow.com/comment/42877406
has comment: http://stackoverflow.com/comment/42877385
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42877343
answers question: http://stackoverflow.com/q/27196142
type: Answer

http://stackoverflow.com/a/27285327
has comment: http://stackoverflow.com/comment/43038850
has body: "Apparently it views the jsp as .java file.". No. It translates the JSP into Java and then compiles that. If your JSP contains errors, then it is quite likely that those errors will result in Java code that has compilation errors in it. What you need to do is to look at the generated source code for the JSP, and figure out what the Java compilation errors are saying. Then figure out the corresponding error in your JSP, and fix the problem there. In this case, it appears that your JSP is trying to call a non-existent method on the request object. The compiler is correct. There is no method called getDispatcherType() in the HttpServletRequest API, so your JSP code that is attempting to call it is incorrect.
has comment: http://stackoverflow.com/comment/43038462
has comment: http://stackoverflow.com/comment/43038409
has comment: http://stackoverflow.com/comment/43038778
has comment: http://stackoverflow.com/comment/43038796
has comment: http://stackoverflow.com/comment/43038485
score: 0
answers question: http://stackoverflow.com/q/27285115
has comment: http://stackoverflow.com/comment/43038531
type: Answer

http://stackoverflow.com/q/27283231
tagged with: scala
has comment: http://stackoverflow.com/comment/43038493
upvote count: 1
has comment: http://stackoverflow.com/comment/43053656
possible better answer: http://stackoverflow.com/a/27297759
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27297759
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27284643
type: Question
has title: Apache Spark: issue with Scala example
tagged with: ubuntu
answer count: 2
tagged with: apache-spark
downvote count: 0
has answer: http://stackoverflow.com/a/27284643
has body: I'm trying to learn to use Apache Spark and I have a problem with a simple example but I can not find a solution. I'm working on Ubuntu 13.04 with Java-7-Oracle and scala 2.9.3. When I try to run SparkPi examples I get this output: filippo@filippo-HP-Pavilion-dv6-Notebook-PC:/usr/local/spark$ ./bin/run-example SparkPi 10 java.lang.ClassNotFoundException: org.apache.spark.examples.SparkPi 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.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:337) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties This is the example show in Spark documentation but I don't understand what is the problem :(
favorite count: 0

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

http://stackoverflow.com/q/27312077
has body: I have this code : List&lt;Banner&gt; bannerLists = ...; // Get the list for (Banner bannerList : bannerLists) { bannerList.getLocation().setLocationName("1 - " + bannerList.getLocation().getLocationName()); log.info("LOCATION " + bannerList.getId() + " : " + bannerList.getLocation().getLocationName()); } Supposed that every locationName have the same value : LOCATIONA, but the id is different each other. The log resulted in something like : LOCATION IDA : 1 - LOCATIONA LOCATION IDB : 1 - 1 - LOCATIONA LOCATION IDC : 1 - 1 - 1 - LOCATIONA It's like the modified field still called on the next repetition. This is the structure (I omit unnecessary detail) : Banner.java ... private Location location; ... Location.java ... private String locationName; ... What's wrong? I tried using for(int i = 0; i ... but same. EDIT for (Banner bannerList : bannerLists) { Location location = banner.getLocation(); location.setLocationName("1 - " + location.getPageName()); bannerList.setLocation(location); log.info("LOCATION " + bannerList.getId() + " : " + bannerList.getLocation().getLocationName()); }
has answer: http://stackoverflow.com/a/27312394
has answer: http://stackoverflow.com/a/27312198
downvote count: 0
has comment: http://stackoverflow.com/comment/43085231
favorite count: 0
possible better answer: http://stackoverflow.com/a/27312198
answer count: 5
has answer: http://stackoverflow.com/a/27312316
has comment: http://stackoverflow.com/comment/43085165
has comment: http://stackoverflow.com/comment/43085270
accepted answer: http://stackoverflow.com/a/27312394
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27312203
upvote count: 1
has answer: http://stackoverflow.com/a/27312528
type: Question
has title: Modify value in ArrayList
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43084851
has comment: http://stackoverflow.com/comment/43084820

http://stackoverflow.com/comment/42887323
comment on: http://stackoverflow.com/q/27201967
type: QuestionComment
has text: You could split the string a collection of words. Would be easier to handle.
score: 0
type: Comment

http://stackoverflow.com/comment/42979042
has text: Agreed. Think about how the ClassLoader works. It has to be able to find all of the packages and classes without loading the .class file and examining it to find the class name.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27252504

http://stackoverflow.com/comment/42868617
type: Comment
comment on: http://stackoverflow.com/a/27180157
score: 0
has text: Thanks for your answer. When I sudo lsof -i :8080, it shows that TCP *:http-alt (LISTEN) is listening. I stopped the Pivotal tc Server. Once I run the src in one of the project, the Pivotal tc Server starts again. If I select src and click run again, the Port 8080 error appears, so I see no output of running the Java codes. I'm a complete Java newbie, is there something else you would recommend?
type: AnswerComment

http://stackoverflow.com/q/27188472
tagged with: android
has comment: http://stackoverflow.com/comment/42864732
has title: how to have 3 different row designs in the same ListView?
has body: I have custom ListView that contains 60 items, and I have a 3 differnet row design and the 3 rows contains the same textView but with different background here is the xmle code to understand it better: &lt;TextView android:id="@+id/abilityBlue" android:layout_width="150dp" android:layout_height="25dp" android:layout_gravity="center" android:gravity="left|center_vertical" android:paddingLeft="23dp" android:paddingRight="1dp" android:textSize="12sp" android:textStyle="bold" android:textColor="@android:color/white" android:background="@drawable/ability_blue_btn"/&gt; &lt;TextView android:id="@+id/abilityGreen" android:layout_width="150dp" android:layout_height="25dp" android:layout_gravity="center" android:gravity="left|center_vertical" android:paddingLeft="23dp" android:paddingRight="1dp" android:textSize="12sp" android:textStyle="bold" android:textColor="@android:color/white" android:background="@drawable/ability_green_btn"/&gt; &lt;TextView android:id="@+id/abilityYellow" android:layout_width="150dp" android:layout_height="25dp" android:layout_gravity="center" android:gravity="left|center_vertical" android:paddingLeft="23dp" android:paddingRight="1dp" android:textSize="12sp" android:textStyle="bold" android:textColor="@android:color/white" android:background="@drawable/ability_yellow_btn"/&gt; so I wanted to know how could I make for an example each 20 items with the different textview. Thanks MY adapter: class Ability extends ArrayAdapter&lt;String&gt; { Context context; String[] titleArray; Ability(Context c,String[] Names) { super(c,R.layout.ability_btn,R.id.abilityBlue,Names); this.context=c; this.titleArray=Names; } class MyViewHolder { TextView myText; MyViewHolder(View v) { myText = (TextView) v.findViewById(R.id.abilityBlue); } } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View row = convertView; MyViewHolder holder = null; if(row==null) { LayoutInflater inflater = (LayoutInflater) cont…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42863312
possible better answer: http://stackoverflow.com/a/27188871
tagged with: eclipse
type: Question
answer count: 2
tagged with: listview
has answer: http://stackoverflow.com/a/27188988
accepted answer: http://stackoverflow.com/a/27188988
score: 0
has answer: http://stackoverflow.com/a/27188871
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42864010
has comment: http://stackoverflow.com/comment/42863441

http://stackoverflow.com/comment/42925292
type: AnswerComment
comment on: http://stackoverflow.com/a/27223221
has text: @Mailkov The codes were modified from your original post, only to reverse the looping order as the OP asked me what does "looping backwards" mean and I cannot put all these in the comment.
type: Comment
score: 0

http://stackoverflow.com/a/27300170
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Add an abstract method to PluginManager to make a class loader, and call it as needed. Subclasses should override that method, returning the appropriate subclass: public abstract class PluginManager { public PluginManager() { pluginLoader = MakeClassLoader(); } ... protected abstract PluginClassLoader MakeClassLoader(); } public class ServiceManager extends PluginManager { ... protected abstract PluginClassLoader MakeClassLoader() { return new ServiceClassLoader(); } } public class ChannelManager extends PluginManager { ... protected abstract PluginClassLoader MakeClassLoader() { return new ChannelClassLoader(); } } This implements the Factory Method design pattern.
accepted answer of: http://stackoverflow.com/q/27299901
answers question: http://stackoverflow.com/q/27299901
upvote count: 1

http://stackoverflow.com/comment/42911486
type: Comment
type: QuestionComment
has text: possible duplicate of [Read request attribute in a Jersey ContainerRequestFilter](http://stackoverflow.com/questions/19691753/read-request-attribute-in-a-jersey-containerrequestfilter)
comment on: http://stackoverflow.com/q/27197587
score: 0

http://stackoverflow.com/comment/43087939
type: Comment
comment on: http://stackoverflow.com/q/27313076
score: 0
has text: @user902383 Oh I see, that was just a question cuz I wasn't sure if we're supposed to use printf or just print since only few languages use printf and I can't provide my actual program code since I'm worried it might get tagged for plagiarism later.. lol but thanks will try my best
type: QuestionComment

http://stackoverflow.com/comment/42876140
type: Comment
has text: I did think about that when I was writing this, and I knew that something needed to be changed to facilitate that need. I am trying now to write a second while loop underneath the first one, which I cut down to only calculate the final mean. I tested to make sure that it worked by calculating the final mean on a graphing calculator.
comment on: http://stackoverflow.com/a/27194163
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42890847
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27204034
type: Comment
has text: @ZouZou my locale is Poland

http://stackoverflow.com/comment/43030744
comment on: http://stackoverflow.com/q/27280988
score: 0
type: Comment
has text: That may not be the best answer. Googling for "c# equivalent of java wildcard" turns up a few more possibilities.
type: QuestionComment

http://stackoverflow.com/a/44744557
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27313352
has body: There are two common solutions: 1. Creating a new password on the server and inform user from it. 2. Sending a unique URL to reset password. The first solution has a lot of problems and is not appropriate to use. These are some reasons: 1. The new password which is created by server should be sent through an insecure channel (such as email, sms, ...) and resides in your inbox. 2. If somebody know the email address or phone number of a user who has an account at a website then then it is possible to reset user password. So, second solution is better to use. However, you should consider following issues: - The reset url should be random, not something guessable and unique to this specific instance of the reset process. - It should not consist of any external information to the user For example, a reset URL should not simply be a path such as “.../?username=Michael”. - We need to ensure that the URL is loaded over HTTPS. No, posting to HTTPS is not enough, that URL with the token must implement transport layer security so that the new password form cannot be MITM’d and the password the user creates is sent back over a secure connection. - The other thing we want to do with a reset URL is setting token's expiration time so that the reset process must be completed within a certain duration. - The reset process must run once completely. So, Reset URL can not be appilicable if the reset process is done completely once. The common solution can be generating a URL to create a unique token which can be sent as URL parameter, it contains a URL such as “Reset/?id=2ae755640s15cd3si8c8i6s2cib9e14a1ae552b”.
downvote count: 0

http://stackoverflow.com/comment/43041208
score: 1
type: AnswerComment
type: Comment
has text: @SVMRAJESH - How is this not an answer to the question?
comment on: http://stackoverflow.com/a/27286665

http://stackoverflow.com/a/27189937
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27189545
has body: You can extract this code to a method: public static void main(String[] args) { Scanner input = new Scanner(System.in); String userName = readFieldAndVerify(input, "Enter your name: "); String userAddress = readFieldAndVerify(input, "Enter your address: "); String userPhoneNumber = readFieldAndVerify(input, "Enter your phone number: "); } private static String readFieldAndVerify(Scanner input, String prompt) { while (true) { System.out.print(prompt); String field = input.next(); System.out.println("Are you sure (yes / no)?"); String verify = input.next(); if (verify.equalsIgnoreCase("yes")) { System.out.println("Verified!"); return field; } else { System.out.println("Canceled"); } } }
has comment: http://stackoverflow.com/comment/42866795
accepted answer of: http://stackoverflow.com/q/27189545
upvote count: 1
has comment: http://stackoverflow.com/comment/42866389
score: 1

http://stackoverflow.com/a/27268010
upvote count: 22
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43007324
score: 22
accepted answer of: http://stackoverflow.com/q/27267391
has body: You can use like this also: String command = "python /c start python path\to\script\script.py"; Process p = Runtime.getRuntime().exec(command + param ); or String prg = "import sys"; BufferedWriter out = new BufferedWriter(new FileWriter("path/a.py")); out.write(prg); out.close(); Process p = Runtime.getRuntime().exec("python path/a.py"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String ret = in.readLine(); System.out.println("value is : "+ret); Run Python script from Java
type: Answer
has comment: http://stackoverflow.com/comment/43007728
has comment: http://stackoverflow.com/comment/43007214
answers question: http://stackoverflow.com/q/27267391
has comment: http://stackoverflow.com/comment/43007403

http://stackoverflow.com/q/27275169
has comment: http://stackoverflow.com/comment/43036546
has comment: http://stackoverflow.com/comment/43041888
tagged with: batch-file
has comment: http://stackoverflow.com/comment/43041126
tagged with: windows
accepted answer: http://stackoverflow.com/a/27309932
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: registry
has answer: http://stackoverflow.com/a/27309932
has comment: http://stackoverflow.com/comment/43042074
linked to: http://stackoverflow.com/q/27287873
type: Question
has body: I am trying to iterate all the registry key in order to find (contains) and delete jre1.5.0_14 values. Is there a way to do it? The code below just finds jre1.5.0_14 under a specific key! I do want to iterate all of the keys. By the way if clause gets if it is equal to jre1.5.0_14, but it should be if it contains jre1.5.0_14. Thanks in advance. Best Regards. @echo off setlocal set KEY_NAME="HKEY_CURRENT_USER\Software\Microsoft\Notepad" set VALUE_NAME=jre1.5.0_14 FOR /F "skip=2 tokens=3" %%A IN ('REG QUERY %KEY_NAME%') DO if "%%A"=="%VALUE_NAME%" ( @echo %%A )
has title: How to iterate all of the registry keys?
tagged with: java
has comment: http://stackoverflow.com/comment/43031395
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/43033163
favorite count: 0

http://stackoverflow.com/q/27212145
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42905369
has body: I don't have a physical page with a link, but rather an application that is firing the link from the backend using java.net.URL. I'm wondering how I can append target=_top to the URL? I feel like I've tried everything but have failed. Could some one please help me. Perhaps there's away to set it in java.net.URL too. https://graph.facebook.com/oauth/authorize?client_id=111111111&amp;redirect_uri=https://local.example.com:8443/test/facebook/oauth/blank/https:$002f$002flocal.example.com:8443$002ftest$002fsignin/target=_top is one of the cases I've tried without success. I've tried all the following as well. :target=_top /target=_top &amp;target=_top :target="_top" /target="_top" &amp;target="_top" the issue I'm facing Simple FB inquiry: FB login screen in a canvas app? Some code Attempt 1 StringBuilder sb = new StringBuilder(); sb.append("https://graph.facebook.com/oauth/authorize?client_id="); sb.append(getOauthClientId()); sb.append("&amp;target=_top"); sb.append("&amp;redirect_uri="); sb.append(getOauthRedirectLink()); sb.append("&amp;scope="); sb.append(facebookPermissions); System.out.println(sb.toString()); return new URL(sb.toString()); Attempt 2 StringBuilder sb = new StringBuilder(); sb.append("https://graph.facebook.com/oauth/authorize?client_id="); sb.append(getOauthClientId()); sb.append("&amp;redirect_uri="); sb.append(getOauthRedirectLink()); sb.append("&amp;scope="); sb.append(facebookPermissions); sb.append("&amp;target=_top"); System.out.println(sb.toString()); return new URL(sb.toString()); My goal is to fire this link off from the backend rather than using javascript to trigger the link.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42905317
has answer: http://stackoverflow.com/a/27212444
has answer: http://stackoverflow.com/a/27212364
linked to: http://stackoverflow.com/q/10628467
score: 0
answer count: 2
has title: append target to url

http://stackoverflow.com/a/27302703
type: AcceptedAnswer
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43068672
downvote count: 0
has comment: http://stackoverflow.com/comment/43068646
has comment: http://stackoverflow.com/comment/43068577
answers question: http://stackoverflow.com/q/27302614
score: 4
accepted answer of: http://stackoverflow.com/q/27302614
has body: You can do it by passing Class&lt;T&gt;, like this: public &lt;T extends GeometryObject&gt; List&lt;T&gt; getList(Class&lt;T&gt; itemClass) throws Exception { List&lt;T&gt; res = new ArrayList&lt;T&gt;(); for (int i = 0 ; i != 10 ; i++) { res.add(itemClass.newInstance()); } return res; } Demo. Note: the above call to newInstance assumes that the class has a parameterless constructor.

http://stackoverflow.com/comment/42912164
type: Comment
type: QuestionComment
has text: @talex Haha magic okay :P From now on i will finish my questions in one setting
comment on: http://stackoverflow.com/q/27192184
score: 0

http://stackoverflow.com/comment/42881987
comment on: http://stackoverflow.com/q/27175945
score: 0
has text: @Desorder : Can you please elaborate on publish-subscribe method
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43221773
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27312022
has text: @WillTice How did you enable proguard in the first place?

http://stackoverflow.com/comment/42992515
comment on: http://stackoverflow.com/a/27236939
has text: Yes that's literally all the sorting user class has in it, well that and a few getters and the constructor haha. But dw @RealSkeptic fixed my issue :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27274240
answer count: 1
downvote count: 0
has body: I've been messing around with this problem for quite some time now and can't get round to fixing this. Take the following case: I have 2 employees in my company which have their own blog page: POST blog/page/1 { "author": "Byron", "author-title": "Junior Software Developer", "content" : "My amazing bio" } and POST blog/page/2 { "author": "Jason", "author-title": "Senior Software Developer", "content" : "My amazing bio is better" } After they created their blog posts, we would like to keep track of the 'views' of their blogs and boost search results based on their 'views'. This can be done by using the function score query: GET blog/_search { "query": { "function_score": { "query": { "match": { "author-title": "developer" } }, "functions": [ { "filter": { "range": { "views": { "from": 1 } } }, "field_value_factor": { "field": "views" } } ] } } } I use the range filter to make sure the field_value_factor doesn't affect the score when the amount of views is 0 (score would be also 0). Now when I try to run this query, I will get the following exception: nested: ElasticsearchException[Unable to find a field mapper for field [views]]; }] Which makes sense, because the field doesn't exist anywhere in the index. If I were to add views = 0 on index-time, I wouldn't have the above issue as the field is known within the index. But in my use-case I'm unable to add this either on index-time or to a mapping. Based on the ability to use a range filter within the function score query, I thought I would be able to use a exists filter to make sure that the field_value_factor part would only be executed when the field is actually present in the index, but no such luck: GET blog/_search { "query": { "function_score": { "query": { "match": { "author-title": "developer" } }, "functions": [ { "filter": { "bool": { "must": [ { "exists": { "field": "views" } }, { "range": { "views": { "from": 1 } } } ] } }, "field_value_factor": { "field": "views" } } ] } } } Still gives: nested: Elasticsea…
favorite count: 0
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/47715764
tagged with: elasticsearch
upvote count: 6
has title: Function score query with field_value_factor on not (yet) existing field
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/53574796
has answer: http://stackoverflow.com/a/32322804
tagged with: scoring

http://stackoverflow.com/q/27170188
has comment: http://stackoverflow.com/comment/42831525
accepted answer: http://stackoverflow.com/a/27170379
downvote count: 1
type: Question
has body: I have a List of Map.Entry, in roder to have a list of pairs. In my List, I will be inserting pairs where the key is a Long value representing a UNIX epoch, and the value is a String with some text: ArrayList&lt;Map.Entry&lt;Long, String&gt;&gt; events = new ArrayList&lt;Map.Entry&lt;Long, String&gt;&gt;(); events.add(new Map.Entry&lt;Long, String&gt;(140000000, "Test event")); I want to remove Map.Entry with duplicated key, so each UNIX epoch have only an associated String. Any fancy way of doing this without iterating the whole list manually? Bonus if the String value is a concat of all the String values from the same key.
tagged with: arraylist
has title: Remove duplicated key Map.Entry from a List
has comment: http://stackoverflow.com/comment/42831245
answer count: 1
has answer: http://stackoverflow.com/a/27170379
favorite count: 0
tagged with: dictionary
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java

http://stackoverflow.com/q/27309645
score: 2
downvote count: 0
tagged with: deserialization
favorite count: 0
type: Question
tagged with: json-deserialization
has body: I am running an google places api the response i received is in json format i have also checked it in json viewer, { "html_attributions" : [], "next_page_token" : "CvQB7AAAAKcVCYUk92u8YbCxucwIYZZoVsNOAX1utAinxpRnjirhCWRGYI1ozjaw-9JauOVcr8iOqsvGVR3n183oJ-saMliylmFcPdJ8HwhIpxwWr8EsXDuTk4SCIYfSfcpSflBaWMqorPnNHAVMz9HS3r4q8Hq-UUobHHfD8HZ4auX9eOzVHETQezM0eT8164h1qsRChdvzEQdsxu1nze6c3GI6xO_PByuSeI8tksFlrPm2P45cZda-_qpQlmn_ksZiCzTRnpPGYG0U7AgtpoiUK85WTAX5CkH7jFpjYFap6LSSv33ujQtFFk52CECLu_iudN78IhIQri7z9TjtM4StCVCRS0Do6RoUrMm6kpd4rUbKD7LkTqbq3o7DOZU", "results" : [ { "geometry" : { "location" : { "lat" : -33.8599827, "lng" : 151.2021282 }, "viewport" : { "northeast" : { "lat" : -33.8552624, "lng" : 151.2031401 }, "southwest" : { "lat" : -33.8657895, "lng" : 151.2000123 } } }, "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png", "id" : "92f1bbd4ecab8e9add032bccee40a57a8dfd42b4", "name" : "Barangaroo", "place_id" : "ChIJ1ZL9NkGuEmsRUEkzFmh9AQU", "reference" : "CpQBhQAAAE4kOaitGfNEGHyhPnHMiP5NVmC9UsUYoYyOtBcO7zKBMNHR07V90Ohq6AV8qEWIAy0xpMvzlEimcdzW0KwdtCbUpWYKXFhby57oPCCUbMiIy_9yxPhtmnzcWFOMZqWWUnVxpYOW6hHR_JbLUbFRPZCSYqMJ9VL6xpxAbjulKVJFmJP4enq7MyeMe8rO0lJRCRIQelNwAky9wPZz9iyjcT7-UhoUGMbpbFWZZeZDjpOxJyipeWTTRxk", "scope" : "GOOGLE", "types" : [ "locality", "political" ], "vicinity" : "Barangaroo" }] } I have used in this way the models 1.GooglePlacesModel is main model which contains List results; and 2.PlacesMainModel contains List geometry; again submodels i used as per need Now i m able to receive string fields in results array like name,icon but m failing to receice the geometry fields like location I came across the following stack trace GooglePlacesModel plcModel = gson.fromJson(resultedPLaces, GooglePlacesModel.class); where resultedPLaces is the json string as it is above, googleapis.com:443][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20] com.google.gson.JsonParseException: The JsonDeserializer com.google.gson.DefaultTyp…
has title: JsonParseException: The JsonDeserializer com.google.gson.DefaultTypeAdapters while running google places api
tagged with: parameterized-types
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/27310607
answer count: 1
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27310607
type: AnsweredQuestion

http://stackoverflow.com/q/27164216
tagged with: servlets
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27164468
tagged with: javascript
has comment: http://stackoverflow.com/comment/42824170
score: 0
has body: Hi I am getting the access_token value dynamically from server for servlet request it is below: now i want to retrive the access_taken value in to my servlet program. { "access_token":"AQWP_EVkqdc7E0wD09J6msmjnUlvilhP304gUIDzl6KKgNxwnHyz_W9nOxS0IroDJwEfVr3n3O-IC9YKc3bjyuwYRm6qbKRiP3A2AzuDjo8ohZERZFRCMyfjjqqDjNJ5J5ReCQDhkFJam51eiqsOeXDg4U_c9XJzc1dUx7Qxck0p9RNE0", "expires_in": 5183999 } my code is below: public class Demo extends HttpServlet { private static final long serialVersionUID = 1L; private static final String PROTECTED_RESOURCE_URL = "http://api.linkedin.com/v1/people/~:(first-name,last-name,email-address)"; /** * @see HttpServlet#HttpServlet() */ public Demo() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); String authCode = request.getParameter("code"); request.setAttribute("authCode",authCode); out.println(authCode); doPost(request,response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); Object url=request.getAttribute("authCode"); response.sendRedirect("https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&amp;code="+url+"&amp;redirect_uri=http://localhost:8080/LinkedinMails/dem&amp;client_id=xxxxxxxxxxxxx&amp;client_secret=xxxxxxxxxxxxxxx"); } } Thank You.
has answer: http://stackoverflow.com/a/27164488
accepted answer: http://stackoverflow.com/a/27164468
has title: Retrieving dynamic JSONObject value from server response in servlets
possible better answer: http://stackoverflow.com/a/27164488
has comment: http://stackoverflow.com/comment/42821538
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42825094
tagged with: java
tagged with: http://stackoverflow.com/tag/json

error-handling
tags question: http://stackoverflow.com/q/27277851
tags question: http://stackoverflow.com/q/27176272
tags question: http://stackoverflow.com/q/27220089
tags question: http://stackoverflow.com/q/27196488
tag name: error-handling
tags question: http://stackoverflow.com/q/27177395
tags question: http://stackoverflow.com/q/27157596
tags question: http://stackoverflow.com/q/27198856
tags question: http://stackoverflow.com/q/27307165
tags question: http://stackoverflow.com/q/27237317
type: Tag

http://stackoverflow.com/a/27196331
has comment: http://stackoverflow.com/comment/42878221
downvote count: 0
has comment: http://stackoverflow.com/comment/42878339
has comment: http://stackoverflow.com/comment/42878061
type: Answer
has comment: http://stackoverflow.com/comment/42878093
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27196252
has body: The reason your less wanted day is always printing 0 is because that's most likely lower than the input being entered in. An alternative would be to set the lessWantedDay value to INTEGER.MAX_VALUE, or just the max ticket value, or another arbitrary random large number, like 9001, 100000, something like that. An alternative alternative (in case you can't use a basic thing mentioned above) is that you can set the LessWantedDay and mostWantedDay to be the first element of the array after you get the input from the user. int mostWantedDay; int LessWantedDay; &lt;snipped out input logic/&gt; mostWantedDay = dayOfTicket[0]; LessWantedDay = dayOfTicket[0]; Whenever you find a most and least day, you need to update the values of mostWantedDay and LessWantedDay with the values you found so your if statements would look like this: if(dayOfTicket[f]&gt;mostWantedDay){ indexOfWantedDay=f+1; mostWantedDay = dayOfTicket[f]; } if(dayOfTicket[f]&lt;LessWantedDay){ indexOfLessWantedDay=f+1; LessWantedDay = dayOfTicket[f]; }
has comment: http://stackoverflow.com/comment/42878195
has comment: http://stackoverflow.com/comment/42878358
has comment: http://stackoverflow.com/comment/42878117

http://stackoverflow.com/q/27197699
has body: I would like to store my RSA private key, which app uses to sign its data before sending to the server, somewhere safely, so that it would be much harder to steal the key than just copy it from app folder. I know that Java KeyStore could be used to store keys and load them by runtime, but how can I load the key from KeyStore without a password for a signed jar? For example, I've loaded a key "mykey" into KeyStore, and I signed App.jar. I want to load the key in runtime from KeyStore automaticly, without specifying a password to KeyStore, if the app which requested it is signed. Perhaps, I don't understand the principles of the KeyStore correctly. But the task is to sign data which is sent to server and store the key safely. (The app is a POS application, so it should be loaded automaticly, without any password given by startup).
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42886691
tagged with: java
tagged with: rsa
has comment: http://stackoverflow.com/comment/42880329
has comment: http://stackoverflow.com/comment/42880237
has title: How to safely store RSA private key to use it in java app?
answer count: 1
tagged with: key
has comment: http://stackoverflow.com/comment/42886791
has comment: http://stackoverflow.com/comment/42880338
tagged with: security
has comment: http://stackoverflow.com/comment/42880446
score: 0
has answer: http://stackoverflow.com/a/27198648
linked to: http://stackoverflow.com/q/8357868
tagged with: keystore
has comment: http://stackoverflow.com/comment/42880432
duplicate of: http://stackoverflow.com/q/8357868
has comment: http://stackoverflow.com/comment/42880194

http://stackoverflow.com/comment/42946334
comment on: http://stackoverflow.com/q/27234887
score: 0
has text: what exactly do you want?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27282065
answer count: 2
has title: LinkedList NullPointerException (Need help implementing a LinkedList)
has body: I am needing to implement a LinkedList and so far I have written my method to insert values in order in my list. I have my Node, front, as my instance datum for my class and when creating my first value and attempting to set the value of front's next to point at my new node I get a nullpointerexception. public class Class1 { private Node front = null;//Linked List pointer private int comparisons = 0; //# of comparisons in Lists //private LinkedList&lt;Node&gt; orderLink = new LinkedList&lt;Node&gt;(); public Class1() { } /*public Class1(int x){ }*/ public void insert (int num){ Node current = null; Node previous = null; boolean placed = false; if (front == null){ //generate first node of list Node first = new Node(num, null); front.setNext(first); placed = true; } previous = front; current = front.getNext(); Node step = new Node(num, null); if (placed == false){ do{ if (step.getData() &lt; current.getData() &amp;&amp; step.getData() &gt; previous.getData() || step.getData() == current.getData() || step.getData() == previous.getData()){ //if the new data is between previous and current, place. If equals current, place. //Insert into List step.setNext(current); previous.setNext(step); placed = true; } if (previous == front &amp;&amp; step.getData() &lt; current.getData()){ //separate case for first node step.setNext(current); previous.setNext(step); placed = true; } if (current.getNext() == null &amp;&amp; step.getData() &gt; current.getData()){ //case for last node current.setNext(step); placed = true; } //move a space up the list previous = current; current = current.getNext(); }while(previous.getNext() != null || placed == false); } } public int search(int num){ int nodeIndex = 0; return 1; //Return index of num } public void delete (int num){ //delete num from the list } public void traverse(){ System.out.println(front.getNext()); System.out.println(front.getNext().getNext()); System.out.println(front.getNext().getNext().getNext()); System.out.println(front.getNex…
score: 0
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/41928009
has answer: http://stackoverflow.com/a/41928009
has answer: http://stackoverflow.com/a/27282119
accepted answer: http://stackoverflow.com/a/27282119
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/60520789
type: QuestionComment
comment on: http://stackoverflow.com/q/27188536
has text: @Droidekas, thanks for you comment! The performance problem was identified in version 21 lib, but even at 23 the problem still exists.
score: 0
type: Comment

http://stackoverflow.com/q/27168575
tagged with: android
has comment: http://stackoverflow.com/comment/42830193
has comment: http://stackoverflow.com/comment/42829414
accepted answer: http://stackoverflow.com/a/27174400
type: AnsweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/42830282
tagged with: java
has title: Reloading android view in a fragment
tagged with: eclipse
type: Question
has body: I'm using Android Eclipse while working on a project where the user can save and upload notes with images. I have a fragment which holds a textview and some thumbnail images. The user can add additional images by using the camera and they can remove images by viewing(clicking) an image (in a separate activity) and deleting it. My problem is with refreshing the layout of the fragment to reflect a deleted image. Currently the following function is being called to deal with this: public ViewGroup removeNoteImageFromView(String location) { List&lt;String&gt; imageLinks = new ArrayList&lt;String&gt;(); for (String string : imageLocations) { if (string.equalsIgnoreCase(location)) { break; } imageLinks.add(string); } //REMOVE ALL THE IMAGEVIEWS from the Linear Layout LinearLayout linear = (LinearLayout) rootView.findViewById(R.id.imageContainer); if (linear.getChildCount() != 0) { linear.removeAllViewsInLayout(); linear.refreshDrawableState(); linear.postInvalidate(); } imageLocations.addAll(imageLinks); //Add them all back from the new array String root = Environment.getExternalStorageDirectory().toString(); for (String string : imageLinks) { Bitmap myBitmap = BitmapFactory.decodeFile((new File(root +"/saved_images/"+string)).getAbsolutePath()); addImage(myBitmap); } return linear; } All this code does is hide all thumbnails which is called by linear.removeAllViewsInLayout(). However the following two line are what I thought would reload the layout on screen but they appear to have no effect whatsoever. Please note I have tried linear.invalidate() as well as postInvalidate and still get nothing. The correct image is deleted from the device as this is dealt with elsewhere so when I go back to this fragment by reselecting it in the menu everything is displayed correctly.
has comment: http://stackoverflow.com/comment/42829970
has answer: http://stackoverflow.com/a/27168714
has comment: http://stackoverflow.com/comment/42829281
score: 0
has answer: http://stackoverflow.com/a/27174400
has answer: http://stackoverflow.com/a/27171056
answer count: 3
possible better answer: http://stackoverflow.com/a/27168714
has comment: http://stackoverflow.com/comment/42829696
has comment: http://stackoverflow.com/comment/42829540
tagged with: view

http://stackoverflow.com/a/27218069
type: Answer
has comment: http://stackoverflow.com/comment/42916231
has comment: http://stackoverflow.com/comment/42915858
has comment: http://stackoverflow.com/comment/42915677
has comment: http://stackoverflow.com/comment/42916145
has body: For sure you have issue here: int numExams = 0; int numQuizzes = 0; int numHW = 0; // declare Double[] exams using length numExams double[] exams = new double[numExams]; // declare Double[] quizzes using length numQuizzes double[] quizzes = new double[numQuizzes]; // declare Double[] HW using length numHW double[] hw = new double[numHW]; Your are declaring here arrays with size 0. If you have more issues - I was not checking.
score: 0
has comment: http://stackoverflow.com/comment/42915602
answers question: http://stackoverflow.com/q/27217989

http://stackoverflow.com/q/27285178
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/29383896
tagged with: java
has body: I am trying to use spark mllib.jar in web project. I downloaded spark-1.1.0-bin-hadoop2.4 and unzipped. There are some jar found as follows: datanucleus-api-jdi-3.2.1.jar datanucleus-core-3.2.2.jar datanucleus-rdbms-3.2.1.jar spark-assembly-1.1.0-hadoop2.4.0.jar spark-examples-1.1.0-hadoop2.4.0.jar Then I use spark-assembly-1.1.0-hadoop2.4.0.jar to import classification methods. It can be run successfully in java project. However when I add the jar to SomeWebProject/web-inf/lib, it turns out error messages: validateJarFile ...\web-inf\lib\spark-assembly-1.1.0-hadoop2.4.0.jar jar not loaded. offending class:javax/servlet/servlet.class I know it because my web project javax.servlet class is duplicated with spark jar. I try to delete spark's javax.servlet. It still not working. Could you please tell me how to figure it out and Can I use other spark jar to run mllib in local mode. This jar is too large and it is about 132 mb and I think some of them are useless. But I cannot find any other available jars. Is this jar the only way to import spark-mllib.jar? p.s. For some reasons I can not deploy spark in my servers. So I could not use hadoop environments Thanks very much!!!
tagged with: apache-spark-mllib
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/29383896
upvote count: 2
has title: How to use spark mllib in web project
tagged with: apache-spark
answer count: 1
downvote count: 0
favorite count: 0

elasticsearch-java-api
tag name: elasticsearch-java-api
type: Tag
tags question: http://stackoverflow.com/q/27235197
tags question: http://stackoverflow.com/q/27226782

http://stackoverflow.com/a/27208596
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27208105
has body: Here is what you want: import java.io.*; import java.util.*; public class UniqueName { public static void main(String args[]) throws IOException{ Scanner input = new Scanner(new FileReader("Names.txt")); Set&lt;String&gt; uniqueNames = new HashSet&lt;String&gt;(); while (input.hasNextLine()) { String line = input.nextLine(); String str [] = line.split((" ")); for ( int i = 0; i &lt;str.length ; i ++) { if (str [i].length() &gt; 0) { wordcount ++; } uniqueNames.add(str[i]); } } System.out.println(wordcount); System.out.println(uniqueNames); } } Using a set, it only adds the value you pass if it doesn't already exist in it. Then you can print it out with println(uniqueNames); which will print out each element like so: "[name1, name2, name3, ..., nameN]" To get rid of the brackets and commas, you can use this: String str = uniqueNames.toString(); str = str.replace('[', ''); str = str.replace(']', ''); str = str.replace(',', ''); If you want to get each one on a new line, you can change replace(',', '') to: replace(',', '\n');
type: Answer
answers question: http://stackoverflow.com/q/27208105
has comment: http://stackoverflow.com/comment/42899548
score: 0

http://stackoverflow.com/comment/43083005
comment on: http://stackoverflow.com/q/27311083
has text: What does the log Log.e("Json String", jsonString); say in the logcat? What exception is throwed in de logcat?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27299186
has body: You forgot to give your variable a name! Try ButtonListener listener = new ButtonListener(); registerReceiver(listener, new IntentFilter("12345")); Both lines had an error. The first line specified the class of the variable, but not its name (and that's what the compiler burped about). The second line needed you to pass a variable for the first argument, and you specified the name of the class instead of the name of the variable (an understandable mistake, since it didn't have a name!).
has comment: http://stackoverflow.com/comment/43062451
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27299126
answers question: http://stackoverflow.com/q/27299126
has comment: http://stackoverflow.com/comment/43062371
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43062419

http://stackoverflow.com/comment/43033440
type: QuestionComment
has text: 1M is tiny - you sure it should not be 1024M?
comment on: http://stackoverflow.com/q/27269913
score: 0
type: Comment

http://stackoverflow.com/comment/42939848
comment on: http://stackoverflow.com/q/27231467
has text: Can you elaborate on `runs`? Do you mean if the same number appears consecutive times, or if you have a sequence of, say, 7-8-9?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43255023
type: QuestionComment
comment on: http://stackoverflow.com/q/27180878
has text: HTTP_STATUS 500 means its a server side issue. Try accessing the URL over a browser or use `wget`(linux/cygwin) to see if it works. I dont think there is anything wrong with your code. Except the probability of certificate issue as mentioned by Scott Dudley.
score: 0
type: Comment

http://stackoverflow.com/q/27230151
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42937290
score: -1
has body: I am trying to create a program that outputs a number of balloons and color of balloons entered by the user. The current problem i'm having trouble with is, I am trying to turn a string into an int so I can easily output the number of balloons. I tested the program with what seemed to work well but the output to the console was 0 no matter what I entered. what am I doing wrong ? package assignment_5_1; import java.util.Scanner; public class Assignment_5_1 { public static int colorToNumber; @SuppressWarnings("empty-statement") public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter The Number of Balloons You Want to See:"); int nob= input.nextInt(); String cob; System.out.print("Enter the Color You Want The Balloons to Be:"); cob = input.next(); String rr= "red"; String oo = "orange"; String yy = "yellow"; String gg = "green"; String bb = "blue"; int result = colorToNumber; System.out.println(result); } public static int colorToNumber(int ret, int cob, String rr, String oo, String yy, String gg, String bb) { if(rr.equals(cob)){ret = 1;} if(oo.equals(cob)){ret = 2;} if(yy.equals(cob)){ret = 3;} if(gg.equals(cob)){ret = 4;} if(bb.equals(cob)){ret = 5;} return ret; } }
tagged with: int
answer count: 2
has answer: http://stackoverflow.com/a/27230189
has answer: http://stackoverflow.com/a/27230357
has title: Turning a String into an Int java method
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/27230357
accepted answer: http://stackoverflow.com/a/27230189
type: AnsweredQuestion

http://stackoverflow.com/a/27198886
type: Answer
answers question: http://stackoverflow.com/q/27198826
score: 3
accepted answer of: http://stackoverflow.com/q/27198826
upvote count: 3
type: AcceptedAnswer
has body: The problem was that I had to specify the are_we_done variable in the thread class as volatile.
downvote count: 0

http://stackoverflow.com/q/27281371
has comment: http://stackoverflow.com/comment/43031459
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43031441
has body: I need a way to center a custom 3D polygon around it's position (the centroid). I made a method for getting the centroid, but I need a method to move the polygon to the specified centroid. I want to do this so the PerspectiveProjection class only has to project 1 Vector3 (the position) instead of all the polygon's knots. Polygon3D class: public class Polygon3D extends Colored implements Shape { private List&lt;Vector3&gt; knots; // Position = center of polygon. private Vector3 position; private Polygon poly; public Polygon3D() { this(new ArrayList&lt;Vector3&gt;()); } public Polygon3D(List&lt;Vector3&gt; knots) { this(knots, new Vector3()); } public Polygon3D(List&lt;Vector3&gt; knots, Vector3 position) { this(knots, position, Color.GRAY); } public Polygon3D(List&lt;Vector3&gt; knots, Vector3 position, Color color) { this.knots = knots; setColor(color); this.position = position; ShapeManager.registerShape(this); this.poly = toPolygon(); } public List&lt;Vector3&gt; getKnots() { return this.knots; } public void setKnots(List&lt;Vector3&gt; knots) { this.knots = knots; this.poly = toPolygon(); } public void addKnot(Vector3 knot) { if (this.knots.contains(knot)) return; this.knots.add(knot); this.poly = toPolygon(); } public void removeKnot(Vector3 knot) { this.knots.remove(knot); this.poly = toPolygon(); } public Vector3 getPosition() { return this.position; } public void setPosition(Vector3 position) { this.position = position; } public Vector3 getCentroid() { double centroidX = 0, centroidY = 0, centroidZ = 0; for (Vector3 knot : this.knots) { centroidX += knot.getX(); centroidY += knot.getY(); centroidZ += knot.getZ(); } return new Vector3(centroidX / this.knots.size(), centroidY / this.knots.size(), centroidZ / this.knots.size()); } public List&lt;Vector2&gt; get2DKnots() { List&lt;Vector2&gt; knots = new ArrayList&lt;&gt;(); Camera camera = PaintPanel.mainCamera; Projection3D project = camera.getProjection(); OrthographicProjection op = null; PerspectiveProjectio…
tagged with: centroid
answer count: 0
tagged with: java
type: Question
tagged with: polygon
tagged with: 3d
has title: (Java) Center 3D Polygon around position

http://stackoverflow.com/comment/42834311
score: 0
type: Comment
type: QuestionComment
has text: do you have a `main` method in your Main Window class?
comment on: http://stackoverflow.com/q/27171802

for-loop
tags question: http://stackoverflow.com/q/27176642
tags question: http://stackoverflow.com/q/27297518
tags question: http://stackoverflow.com/q/27156885
tags question: http://stackoverflow.com/q/27194445
tags question: http://stackoverflow.com/q/27154874
tags question: http://stackoverflow.com/q/27210345
tags question: http://stackoverflow.com/q/27202325
tags question: http://stackoverflow.com/q/27215611
tags question: http://stackoverflow.com/q/27200680
tags question: http://stackoverflow.com/q/27292459
tags question: http://stackoverflow.com/q/27250046
tag name: for-loop
tags question: http://stackoverflow.com/q/27160038
tags question: http://stackoverflow.com/q/27154121
tags question: http://stackoverflow.com/q/27284369
tags question: http://stackoverflow.com/q/27254515
tags question: http://stackoverflow.com/q/27211549
tags question: http://stackoverflow.com/q/27263576
tags question: http://stackoverflow.com/q/27289671
type: Tag
tags question: http://stackoverflow.com/q/27303279
tags question: http://stackoverflow.com/q/27215523
tags question: http://stackoverflow.com/q/27195039
tags question: http://stackoverflow.com/q/27195890
tags question: http://stackoverflow.com/q/27223859
tags question: http://stackoverflow.com/q/27198403
tags question: http://stackoverflow.com/q/27239265
tags question: http://stackoverflow.com/q/27241384
tags question: http://stackoverflow.com/q/27223494
tags question: http://stackoverflow.com/q/27157742
tags question: http://stackoverflow.com/q/27204880

http://stackoverflow.com/a/27309985
has body: Check out the join() method on the Thread class - http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html#join%28%29 Something like this: public Thread calculation1(){ Thread thread = new Thread(){ public void run(){ /* do calculation */ } }; thread.start(); return thread; } public Thread calculation2(){ Thread thread = new Thread(){ public void run(){ /* do some other calculation */ }; }; thread.start(); return thread; } And then use isAlive() and join() to wait for execution to finish List&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;(); threads.add(calculation1()); threads.add(calculation2()); for(Thread t : threads){ if(t.isAlive()){ t.join(); } }
score: 3
answers question: http://stackoverflow.com/q/27309876
accepted answer of: http://stackoverflow.com/q/27309876
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42817110
type: Comment
type: QuestionComment
has text: That fixed it for me, post that as an answer and I'll check it off.
score: 0
comment on: http://stackoverflow.com/q/27161731

http://stackoverflow.com/q/27193150
has comment: http://stackoverflow.com/comment/42878539
tagged with: opengl
tagged with: java
type: Question
has body: My task is to create an OpenGL Java program which will load a dataset, and then display an orthogonal slice of said data on the X, Y and Z axis. I'm new to OpenGL and I've been having trouble with plotting the data. The class to load the dataset has been provided for me: public class VolumetricDataSet { private final int[] dimensions; private int maxValue; private int minValue; private final int[][][] volumeData; /** * Construct a new dataset from a File. * * @param in * the file to read the data from. * @param xSize * the maximal x dimension to use. * @param ySize * the maximal y dimension to use. * @param zSize * the maximal z dimension to use. * @throws IOException * if the underlying reader encounters an error. * @throws FileNotFoundException * if the file cannot be found. */ public VolumetricDataSet(final File in, final int xSize, final int ySize, final int zSize) throws IOException, FileNotFoundException { this(new FileInputStream(in), xSize, ySize, zSize); } /** * Construct a new dataset. * * @param in * the stream to read the data from. * @param xSize * the maximal x dimension to use. * @param ySize * the maximal y dimension to use. * @param zSize * the maximal z dimension to use. * @throws IOException * if the underlying reader encounters an error. */ public VolumetricDataSet(final InputStream in, final int xSize, final int ySize, final int zSize) throws IOException { int value = 0, xCur = 0, yCur = 0, zCur = 0; volumeData = new int[xSize][ySize][zSize]; while ((value = in.read()) != -1) { volumeData[xCur][yCur][zCur] = value; if (value &gt; maxValue) maxValue = value; if (value &lt; minValue) minValue = value; if (++xCur == xSize) { xCur = 0; if (++yCur == ySize) { yCur = 0; zCur++; } } } dimensions = new int[] { xSize, ySize, zSize }; } /** * Retrieve the length of the x y z dimensions of the data set. 3 element array * * @return the dimensions. */ public int[] getDimensions() { return dimensions; } /** * @return the maximal value */ public int getMaxValu…
score: 0
has title: OpenGL/Java slicing dataset and plotting it
has comment: http://stackoverflow.com/comment/42879674
favorite count: 0
answer count: 0
tagged with: jogl
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42878246

http://stackoverflow.com/comment/42950616
type: Comment
type: QuestionComment
has text: Share what you have tried so far.
comment on: http://stackoverflow.com/q/27236990
score: 0

http://stackoverflow.com/comment/42837901
type: AnswerComment
has text: Thanks for your response! Your description is correct, do you know any fancy tricks to remove the operators? All i can think of is .replace("/,*,-,+","") < not sure if this works.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27173769

http://stackoverflow.com/q/27311138
tagged with: http://stackoverflow.com/tag/json
has body: @Override protected JSONObject doInBackground(String... params) { String path = null; String response = null; HashMap&lt;String, String&gt; request = null; JSONObject requestJson = null; DefaultHttpClient httpClient = null; HttpPost httpPost = null; StringEntity requestString = null; ResponseHandler&lt;String&gt; responseHandler = null; // get the username and password Log.i("Email", params[0]); Log.i("Password", params[1]); try { path = "http://192.xxx.x.xxx/xxxxService/UsersService.svc/UserAuthentication"; new URL(path); } catch (MalformedURLException e) { e.printStackTrace(); } try { // set the API request request = new HashMap&lt;String, String&gt;(); request.put(new String("Email"), params[0]); request.put(new String("Password"), params[1]); request.entrySet().iterator(); // Store locations in JSON requestJson = new JSONObject(request); httpClient = new DefaultHttpClient(); httpPost = new HttpPost(path); requestString = new StringEntity(requestJson.toString()); // sets the post request as the resulting string httpPost.setEntity(requestString); httpPost.setHeader("Content-type", "application/json"); // Handles the response responseHandler = new BasicResponseHandler(); response = httpClient.execute(httpPost, responseHandler); responseJson = new JSONObject(response); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } try { responseJson = new JSONObject(response); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } return responseJson; } I'm using this code to login to my app. responseJson = new JSONObject(response); I'm getting "success" for the response, but responseJson value is "null" This is what I got: Error converting result org.json.JSONException: Value Fail of type java.lang.String cannot be converted to JSONObject I t will be good if i can get a salution Thanks in advance.
has comment: http://stackoverflow.com/comment/43083448
upvote count: 0
answer count: 1
has title: java.lang.String cannot be converted to JSONObject
favorite count: 0
has comment: http://stackoverflow.com/comment/43083056
tagged with: android-json
has comment: http://stackoverflow.com/comment/43082996
has comment: http://stackoverflow.com/comment/43089480
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/27311453
type: UnansweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/43086624
has comment: http://stackoverflow.com/comment/43082966
type: Question

http://stackoverflow.com/q/27241575
tagged with: jogl
tagged with: opengl
tagged with: java
possible better answer: http://stackoverflow.com/a/62674465
type: Question
score: 21
linked to: http://stackoverflow.com/q/426230
linked to: http://stackoverflow.com/q/8924216
answer count: 2
tagged with: gdb
upvote count: 21
downvote count: 0
tagged with: segmentation-fault
has answer: http://stackoverflow.com/a/62674465
favorite count: 0
linked to: http://stackoverflow.com/q/54365079
has body: Attempting to run java app from gdb results in segfault, yet running app alone does not. This app is a .JAR which uses JOGL and a bit of memory-mapping to talk to the GPU. Stacktrace below hints at some sort of memory access problem but I don't understand why it manifests in GDB but not in real life. Could there be some environment factor gdb needs to know to allow proper execution? This issue persists between JVMs OpenJDK 6 and 7, as well as Oracle JRE 7. The oracle JRE runs a little farther into startup before segfault. All segfaults are otherwise consistent in occurrence and location between trials. Segfault persists between GPUs and drivers(!!): nvidia, radeon, fglrx current and fglrx beta (14.xx). GDB will successfully attach to an already-running instance of my program, however it doesn't seem possible for gDEBugger to do this, which is ultimately what needs to work. There is no intent to actually debug with gdb. Rather I am trying to use gDEBugger to perform OpenGL debugging. gDEBugger apparently relies on GDB as part of its backend, so if GDB fails, so does gDEBugger. This resulted in attempts to run gdb alone to isolate the issue. gDEBugger output: GDB String: [Thread debugging using libthread_db enabled] GDB String: Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1 . Thread Created: 140737353893632 (LWP: 3265) Thread Created: 140737294624512 (LWP: 3266) Thread Created: 140737293571840 (LWP: 3267) Thread Created: 140737292519168 (LWP: 3268) Thread Created: 140737155180288 (LWP: 3269) Thread Created: 140737154127616 (LWP: 3270) Thread Created: 140736913602304 (LWP: 3271) Thread Created: 140736909629184 (LWP: 3272) Thread Created: 140736908576512 (LWP: 3273) Thread Created: 140736907523840 (LWP: 3274) Thread Created: 140736906471168 (LWP: 3275) Thread Created: 140736905418496 (LWP: 3276) Thread Created: 140736278275840 (LWP: 3277) Thread Created: 140736272963328 (LWP: 3278) Thread Created: 140736271910656 (LWP: 3279) Thread Created: 1407…
has title: Why does java app crash in gdb but runs normally in real life?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27242060
accepted answer: http://stackoverflow.com/a/27242060

http://stackoverflow.com/q/27310579
upvote count: 6
has answer: http://stackoverflow.com/a/27310663
linked to: http://stackoverflow.com/q/26921281
has answer: http://stackoverflow.com/a/27310676
accepted answer: http://stackoverflow.com/a/27310676
has answer: http://stackoverflow.com/a/27311048
has answer: http://stackoverflow.com/a/27310687
favorite count: 0
has body: In a standard J2EE web application , assuming that class load times during app startup is not an issue, which would be a better approach in terms of maintainance, performace and usability ? The first approach involves creating different exception classes, each to denote a particular error that occurs in the application. The class names are self explanatory, and that'll be used to provide error messages. (UPDATE : The number of classes is about 30 as of now, and it'll continue to increase in the near future, probably upto 70 or 80 atmost) The secodn approach involves creating one exception class, and a bunch of exception codes where each code represent a particular error in the app. The error codes are obtained from the exception, and is used to provide error messages.
tagged with: exception
has comment: http://stackoverflow.com/comment/43082180
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 6
possible better answer: http://stackoverflow.com/a/27310687
has title: Which is better ? Many custom exception classes, or one exception class with many custom exception codes?
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/27742405
has body: You are missing the attrs values. these should already be present in the library project. try re-importing the library from the scratch. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="RoundedImageView"&gt; &lt;attr name="corner_radius" format="dimension" /&gt; &lt;attr name="border_width" format="dimension" /&gt; &lt;attr name="border_color" format="color" /&gt; &lt;attr name="mutate_background" format="boolean" /&gt; &lt;attr name="oval" format="boolean" /&gt; &lt;attr name="android:scaleType" /&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; just in case
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27263015

http://stackoverflow.com/q/27303300
type: Question
has answer: http://stackoverflow.com/a/27304433
has title: Can this SQLITE db.insert be combined or improved?
has comment: http://stackoverflow.com/comment/43071539
tagged with: listview
score: 0
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/27304433
has comment: http://stackoverflow.com/comment/43070160
has comment: http://stackoverflow.com/comment/43069689
tagged with: android
has comment: http://stackoverflow.com/comment/43070444
has body: i have 2460 rows to insert in my sqlite DB by a click, my question : there's any way to improve this code to be more efficient and get better performance ? is keeping DBHelper is good in this situation, having that i need to show my data in a Listview with a lot of queries ? what do you think ? Thank you, and sorry for my english My class: public class MainActivity &lt;ButtonListener&gt; extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnSimple = (Button) findViewById(R.id.buttonviewrec1); btnSimple.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent (v.getContext(),ViewTeam.class); startActivityForResult(intent, 0); } }); Button btnasearch = (Button) findViewById(R.id.searchbtn1); btnasearch.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String tmname1= "spurs"; String tmopponent1= "lal"; String tmdate1= "26/12/2014 12:00"; String tmname2= "Maavs"; String tmopponent2= "Raps"; String tmdate2= "22/12/2014 03:30"; String tmname3= "Clips"; String tmopponent3= "Bulls"; String tmdate3= "19/12/2014 01:30"; TeamModel pm; DBHelper db; db = new DBHelper(getApplicationContext()); db.getWritableDatabase(); pm = new TeamModel(); pm.teamname=tmname1; pm.teamopponent=tmopponent1; pm.teamdate=tmdate1; Log.i("teamname,teamopponent,teamdate", "" + pm.teamname + "" + pm.teamopponent + "" + pm.teamdate); db.addTeam(pm); pm.teamname=tmname2; pm.teamopponent=tmopponent2; pm.teamdate=tmdate2; Log.i("teamname,teamopponent,teamdate", "" + pm.teamname + "" + pm.teamopponent + "" + pm.teamdate); db.addTeam(pm); pm.teamname=tmname3; pm.teamopponent=tmopponent3; pm.teamdate=tmdate3; Log.i("teamname,teamopponent,teamdate", "" + pm.teamname + "" + pm.teamopponent + "" + pm.teamdate); db.addTeam(pm); } }); } My DBHelper public class DBHelper extends SQLiteOpenHelper{ public DBHelper(Contex…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43070455
linked to: http://stackoverflow.com/q/1711631

http://stackoverflow.com/comment/43021678
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27276219
has text: It sounds like you need to use Activities. Create a new activity for `Leerlingenraad` and `Contact` and use `Intent`s and `startActivity()` to change to these activities.
score: 1

http://stackoverflow.com/comment/42970876
has text: Thanks a lot, That was really informative. I accepted your answer.
comment on: http://stackoverflow.com/q/27246662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43005442
comment on: http://stackoverflow.com/a/27267162
has text: I tried this, but `cxt.getBean("myDynamicPortName")` does not find the bean, so probably it's not working this way.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27242007
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
tagged with: intellij-idea
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43076364
has title: Intellij perforce plugin issue - com/intellij/openapi/vcs/FileRenameProvider [Plugin: Perforce]
type: UnansweredQuestion
tagged with: perforce
has body: I tried using Perforce plugin in intellij. After i restarted the intellij, it doesn't open and throws the below exception Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: com/intellij/openapi/vcs/FileRenameProvider [Plugin: Perforce] could some one help in fixing this. Thanks in advance.
has answer: http://stackoverflow.com/a/42568889

http://stackoverflow.com/comment/43016802
comment on: http://stackoverflow.com/q/27273402
type: Comment
has text: note as aside usage of scaledInstance is pretty asynchronous,
score: 0
type: QuestionComment

http://stackoverflow.com/a/27216045
answers question: http://stackoverflow.com/q/27216012
has body: Make sure you have the following inside the &lt;application&gt; element in your AndroidManifest.xml. &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/&gt;
has comment: http://stackoverflow.com/comment/42933477
score: 0
type: Answer

http://stackoverflow.com/q/27164498
favorite count: 0
tagged with: rest
has body: I have a problem in a big application with rich context, and I spent time to understand why it isn't mapped. So I tried to create simple project and face the same issue :( pom.xml 4.0.0 com.springapp testMvc war 1.0-SNAPSHOT testMvc <spring.version>4.1.1.RELEASE</spring.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} javax.servlet servlet-api 2.5 javax.servlet.jsp jsp-api 2.1 provided org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} test junit junit 4.11 test com.fasterxml.jackson.core jackson-core 2.4.3 com.fasterxml.jackson.core jackson-databind 2.4.3 testMvc maven-compiler-plugin 1.7 1.7 maven-surefire-plugin **/*Tests.java org.mortbay.jetty maven-jetty-plugin 6.1.10 10 8080 60000 web.xml Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / context: <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:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <mvc:annotation-driven> <mvc:message-converters> </mvc:message-converters> </mvc:annotation-driven> <context:component-scan base-package="com.springapp.mvc"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> </beans> controller: package com.springapp.mvc; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Hash…
type: AnsweredQuestion
has title: Spring MVC mapping with path variable
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27165516
accepted answer: http://stackoverflow.com/a/27165516
has comment: http://stackoverflow.com/comment/42821616
score: 1
tagged with: java
upvote count: 1
downvote count: 0
answer count: 1
tagged with: path-variables

http://stackoverflow.com/comment/42898006
has text: Can you add `-Djavax.net.debug=ssl,handshake,failure` to your jvm and restart hudson/jenkins? Then post the output or logs
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27206599

http://stackoverflow.com/comment/43005294
comment on: http://stackoverflow.com/a/27266578
score: 0
type: AnswerComment
type: Comment
has text: I'm using Eclipse Compiler V20140604-1726, same errors as before. I really appreciate it. I'll figure it out.

http://stackoverflow.com/q/27192867
answer count: 1
has body: I have tried right clicking on res and adding new folders and fils with -v11 at the end of the name but I don't see the folder in the res directory when I do this? I have restared android studio and still don't see them? Or sometimes is says thats an invalid character? I right click on res and this is what I see then I click new directory. Thanks for the help in advance!!
has title: Cant add version Qualifier Folder into res/menu in Android Studio
favorite count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27193115
upvote count: 1
tagged with: version

http://stackoverflow.com/comment/42834894
type: Comment
type: QuestionComment
has text: "getting lazyinitializationexception even when session is not closed" - so how do you prove that? Because at the moment I can only assume that the session that the entity was loaded in IS closed, and you just don't understand why. I will of course fully believe you when you say that "a" session is open - but I don't believe you that it is the session in which the entity was loaded. Problems can already occur when you have a nested transaction situation for example.
score: 2
comment on: http://stackoverflow.com/q/27170469

http://stackoverflow.com/comment/100426904
score: 0
type: Comment
has text: How would one package a paa as a zip but end up with a .paa file?
type: AnswerComment
comment on: http://stackoverflow.com/a/27595352

http://stackoverflow.com/comment/43072025
type: QuestionComment
comment on: http://stackoverflow.com/q/27304407
has text: ...sorry for the confusion, the pattern I am seeking is commented at the top.
score: 0
type: Comment

http://stackoverflow.com/comment/42997614
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27252132
has text: Correct. Java code is expected to be organized by Java package name. In contrast, C++ generated code will be organized according to the directory structure of the input `.proto` files.
type: AnswerComment

http://stackoverflow.com/comment/42914969
has text: You're right, but this feels wrong to me. Default methods were really intended to support functional interfaces, since you can only have one method that didn't have an implementation in a functional interface. My gut feeling is to go with an abstract class, since it conveys intent clearer (and if that's the only method you have in your interface, there's not much gain to having it be an interface).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27210951

http://stackoverflow.com/comment/42946225
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27234588
has text: @anubhava: it's not a problem if the year of the movie is present later in the string.
score: 0

http://stackoverflow.com/comment/43172121
comment on: http://stackoverflow.com/q/27276939
score: 0
type: Comment
type: QuestionComment
has text: I found the solution. The problem is that the two jar files were NOT in the same location. One was located in my bin directory and another was in another completely different location (directory structure). After the two jar files were in the same directory the main error went away...

http://stackoverflow.com/comment/42959562
type: QuestionComment
comment on: http://stackoverflow.com/q/27241207
has text: It's still impossible to say without the logcat output of the crash. What you have posted *seems* fine
score: 0
type: Comment

http://stackoverflow.com/comment/42959338
type: Comment
type: QuestionComment
has text: I was using the Git bash. I didn't realize the Windows command line would have been different from it.
score: 0
comment on: http://stackoverflow.com/q/27240231

http://stackoverflow.com/comment/42998217
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27262602
has text: There you have it (in the exception stack trace) -- you (somewhere) modified the list that your `cornerVectors` sublist was taken from.
score: 0

http://stackoverflow.com/a/27182168
downvote count: 0
has body: I won't give you the answer, but hopefully this gives you some hints. A recursive method is something that solves a problem by calling itself to solve a smaller version of the same problem. In your case, the problem is to print this (I've put b where blanks belong): OOOOO bOOO bbO You're printing the first line, then solving a smaller version of the same problem, which is to print a smaller triangle: bOOO bbO The problem is that this smaller version isn't quite the same; it has to have extra spaces before each line. How much extra space? Well, that's why the instructor said "use k to your advantage". How could you call the method recursively, and use k to tell it to display extra spaces?
score: 1
answers question: http://stackoverflow.com/q/27182070
upvote count: 1
type: Answer

http://stackoverflow.com/q/27205256
has comment: http://stackoverflow.com/comment/42893029
answer count: 3
has answer: http://stackoverflow.com/a/39198223
has answer: http://stackoverflow.com/a/27227149
has title: Week representation in Java 8 Time API
score: 8
linked to: http://stackoverflow.com/q/38922754
possible better answer: http://stackoverflow.com/a/27227149
downvote count: 0
has comment: http://stackoverflow.com/comment/42893050
has answer: http://stackoverflow.com/a/27210618
tagged with: java-8
accepted answer: http://stackoverflow.com/a/27210618
type: AnsweredQuestion
tagged with: java
tagged with: java-time
has comment: http://stackoverflow.com/comment/42902396
upvote count: 8
type: Question
tagged with: jodatime
has body: I would like to have a class to represent a particular week of year - for example today it's 29 November, which is exactly week number 48 of year 2014. So, one example implementation would be: import java.time.Year; public class WorkingWeek { private int weekNumber; private Year year; } Another conception is to have just a week's Monday date in a WorkingWeek class, but I feel it's less intuitive and I will frequently use week-in-year number. Is there a class in Java 8 Time API that would fit best my requirements? Or if not, what would be recommended approach?
favorite count: 0

http://stackoverflow.com/comment/42876855
score: 0
has text: Please post your code as Answer and then select it as correct answer. It will help others in future
comment on: http://stackoverflow.com/q/27195794
type: Comment
type: QuestionComment

spring
tags question: http://stackoverflow.com/q/27191213
tags question: http://stackoverflow.com/q/27242839
tags question: http://stackoverflow.com/q/27309477
tags question: http://stackoverflow.com/q/27202812
tags question: http://stackoverflow.com/q/27172867
tags question: http://stackoverflow.com/q/27184164
tags question: http://stackoverflow.com/q/27258555
tags question: http://stackoverflow.com/q/27250108
tags question: http://stackoverflow.com/q/27210380
tags question: http://stackoverflow.com/q/27283421
tags question: http://stackoverflow.com/q/27219959
tags question: http://stackoverflow.com/q/27156925
tags question: http://stackoverflow.com/q/27285847
tags question: http://stackoverflow.com/q/27238354
tags question: http://stackoverflow.com/q/27171223
tags question: http://stackoverflow.com/q/27171629
tags question: http://stackoverflow.com/q/27274299
tags question: http://stackoverflow.com/q/27212600
tags question: http://stackoverflow.com/q/27252974
tags question: http://stackoverflow.com/q/27175665
tags question: http://stackoverflow.com/q/27312693
tags question: http://stackoverflow.com/q/27303123
tags question: http://stackoverflow.com/q/27267103
tags question: http://stackoverflow.com/q/27224936
tags question: http://stackoverflow.com/q/27202350
tags question: http://stackoverflow.com/q/27247365
tags question: http://stackoverflow.com/q/27205678
tags question: http://stackoverflow.com/q/27228656
tags question: http://stackoverflow.com/q/27162987
tags question: http://stackoverflow.com/q/27190291
tags question: http://stackoverflow.com/q/27285202
tags question: http://stackoverflow.com/q/27229121
tags question: http://stackoverflow.com/q/27201791
tags question: http://stackoverflow.com/q/27247955
tags question: http://stackoverflow.com/q/27234293
tags question: http://stackoverflow.com/q/27178381
tags question: http://stackoverflow.com/q/27218448
tags question: http://stackoverflow.com/q/27168412
tags question: http://stackoverflow.com/q/27173667
tags question: http://stackoverflow.com/q/27240803
tags question: http://stackoverflow.com/q/27313758
tags question: http://stackoverflow.com/q/27234210
tags question: http://stackoverflow.com/q/27223917
tags question: http://stackoverflow.com/q/27166721
tags question: http://stackoverflow.com/q/27200500
tags question: http://stackoverflow.com/q/27281172
tags question: http://stackoverflow.com/q/27154189
tags question: http://stackoverflow.com/q/27190641
tags question: http://stackoverflow.com/q/27269439
tags question: http://stackoverflow.com/q/27164802
tags question: http://stackoverflow.com/q/27213290
tags question: http://stackoverflow.com/q/27165764
tags question: http://stackoverflow.com/q/27199105
tags question: http://stackoverflow.com/q/27294878
tags question: http://stackoverflow.com/q/27241441
tags question: http://stackoverflow.com/q/27265526
type: Tag
tags question: http://stackoverflow.com/q/27301213
tags question: http://stackoverflow.com/q/27162634
tags question: http://stackoverflow.com/q/27187472
tags question: http://stackoverflow.com/q/27258899
tags question: http://stackoverflow.com/q/27273754
tags question: http://stackoverflow.com/q/27273777
tags question: http://stackoverflow.com/q/27253757
tags question: http://stackoverflow.com/q/27270578
tags question: http://stackoverflow.com/q/27295038
tags question: http://stackoverflow.com/q/27248509
tags question: http://stackoverflow.com/q/27178761
tags question: http://stackoverflow.com/q/27270781
tags question: http://stackoverflow.com/q/27204239
tags question: http://stackoverflow.com/q/27185862
tags question: http://stackoverflow.com/q/27307973
tags question: http://stackoverflow.com/q/27269383
tags question: http://stackoverflow.com/q/27296276
tags question: http://stackoverflow.com/q/27187819
tags question: http://stackoverflow.com/q/27300874
tags question: http://stackoverflow.com/q/27188787
tags question: http://stackoverflow.com/q/27281820
tags question: http://stackoverflow.com/q/27242076
tags question: http://stackoverflow.com/q/27204818

http://stackoverflow.com/q/27200158
has comment: http://stackoverflow.com/comment/42884334
has comment: http://stackoverflow.com/comment/42884171
answer count: 2
has title: InetAddress.getLocalHost().getHostAddress() returning unwanted address Java
downvote count: 0
has answer: http://stackoverflow.com/a/43283106
favorite count: 0
has answer: http://stackoverflow.com/a/27200252
has comment: http://stackoverflow.com/comment/42884101
score: 2
upvote count: 2
has body: I tried InetAddress.getLocalHost().getHostAddress() to get the users internet address. It's giving me 127.0.1.1 but i'm looking for something more like 192.168.1.75. Any idea how to get the address i'm looking for? Thanks - Tyler EDIT: I have ubuntu. Remember that. I exported my program to a jar and ran it on my moms Windows laptop. It game me the correct address. That is 192.168.1.64. Still not the correct one on mine.
has comment: http://stackoverflow.com/comment/42884208
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2939218
type: Question
linked to: http://stackoverflow.com/q/9481865
tagged with: network-programming

http://stackoverflow.com/comment/42977160
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27250880
has text: Remember that the people helping you here are doing so in their spare time, for fun. Why make it difficult for us? Show us you've taken some effort yourself - for instance, you've completely ignored part of my question which was "*Try testing your key storage and retrieval separately - does this return the same data?*".

http://stackoverflow.com/q/27278638
tagged with: daemon
type: UnansweredQuestion
tagged with: multithreading
has body: Timer timer = new Timer(); // scheduling the task at interval timer.schedule(tasknew,100, 100); If this is added as part of a web-application at the startup, how is the task getting kicked off at the scheduled time? Is a new daemon thread process being created, solely for triggering this task? I just want to understand if we are creating any additional thread that is responsible for this task threads?
tagged with: java
has answer: http://stackoverflow.com/a/27278692
type: Question
has title: Java util Timer - Thread addition
has comment: http://stackoverflow.com/comment/43026272
tagged with: threadpool
has comment: http://stackoverflow.com/comment/43026205
score: 0
answer count: 1

http://stackoverflow.com/a/27301750
answers question: http://stackoverflow.com/q/27300427
upvote count: 1
downvote count: 1
score: 0
has body: Suppose you are going to play N games (in sequence) and at each step you record whether player A wins or player B wins. You generate a sequence that looks like AABABBAABA, etc. You want to count the number of such sequences where there are M times as many A's as B's (I assume you mean at least M times as many). Since N is fixed, you have an upper bound on the number of B's. I.e. #B's + #A's = N and #A's >= M*#B's, so (M+1)*#B's &lt;= N and so #B's &lt;= N/(M+1). Let us say, that you can have at most K B's in the string (and there are N characters total). For each 1 &lt;= k &lt;= K there are N choose k ways to place the B's (assuming you have k of them) and the rest are A's. In total, then, there are SUM(k=0..K) (N choose k) such possibilities. So instead of using the code to generate all these, just have your code compute the (N choose k) values and sum them up.
type: Answer

applet
tags question: http://stackoverflow.com/q/27313171
tags question: http://stackoverflow.com/q/27220468
tags question: http://stackoverflow.com/q/27310053
tags question: http://stackoverflow.com/q/27198085
tags question: http://stackoverflow.com/q/27304570
tags question: http://stackoverflow.com/q/27241517
tags question: http://stackoverflow.com/q/27231780
tags question: http://stackoverflow.com/q/27249605
tags question: http://stackoverflow.com/q/27196382
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/27181442
tags question: http://stackoverflow.com/q/27153321
tags question: http://stackoverflow.com/q/27156798
tags question: http://stackoverflow.com/q/27294023
tags question: http://stackoverflow.com/q/27225185
tags question: http://stackoverflow.com/q/27293706
tags question: http://stackoverflow.com/q/27256707
tags question: http://stackoverflow.com/q/27226448
tags question: http://stackoverflow.com/q/27160887
tags question: http://stackoverflow.com/q/27300075
tags question: http://stackoverflow.com/q/27225237
tags question: http://stackoverflow.com/q/27183616
tags question: http://stackoverflow.com/q/27271567
tags question: http://stackoverflow.com/q/27253314
tags question: http://stackoverflow.com/q/27275808
tags question: http://stackoverflow.com/q/27301569
tags question: http://stackoverflow.com/q/27283534
tags question: http://stackoverflow.com/q/27217575
tags question: http://stackoverflow.com/q/27205294
tags question: http://stackoverflow.com/q/27296494
tags question: http://stackoverflow.com/q/27272725
tags question: http://stackoverflow.com/q/27247346

http://stackoverflow.com/a/27200516
has comment: http://stackoverflow.com/comment/42884950
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42888411
downvote count: 0
answers question: http://stackoverflow.com/q/27200494
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27200494
upvote count: 1
has body: Try case..when..then like below: SELECT CASE WHEN Date1 &gt;= Date2 AND Date1 &gt;= Date3 THEN Date1 WHEN Date2 &gt;= Date1 AND Date2 &gt;= Date3 THEN Date2 WHEN Date3 &gt;= Date1 AND Date3 &gt;= Date2 THEN Date3 ELSE Date1 END AS RecentDate FROM mytable

http://stackoverflow.com/a/27241382
answers question: http://stackoverflow.com/q/27238432
score: 1
upvote count: 1
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27238432
type: Answer
has body: Answering my own question in case this helps someone in the future... Looks to be a proxy issue as I got off our work network onto a private one and things worked/downloaded. Interesting thing though is that the "oss.sonatype.org/content/repositories/comgoogleappengine-1004/" still doesn't seem to be there. So I would think that the pom.xml file should be changed none-the-less.

http://stackoverflow.com/a/27273380
type: Answer
accepted answer of: http://stackoverflow.com/q/27273220
answers question: http://stackoverflow.com/q/27273220
score: 4
upvote count: 4
has body: With JSPs the right way to do it is using JSTL tags. Google for 'jstl tutorial' and read up what is offered.Your example uses scriptlets instead. Though that would get it done too but is not the right way to do it. One example is shown below: <c:choose> <c:when test= "${request.getSession().getAttribute("userName").equals("Guest")}"> Welcome Guest </c:when> <c:otherwise> Welcome Real User </c:otherwise> </c:choose>
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42872084
score: 0
comment on: http://stackoverflow.com/a/27193292
has text: Well, let me rewrite the answer, I didn't express myself well.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27204626
type: Question
type: AnsweredQuestion
favorite count: 0
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27205323
tagged with: java
tagged with: hibernate
has body: Tags contains tag with field name with value "#tylkoclara". In first case results has size 1 which is expected result SessionFactory sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); List&lt;Tag&gt; results = new ArrayList&lt;Tag&gt;(); Criteria criteria = session.createCriteria(Tag.class); criteria.add(Restrictions.eq("name", "#tylkoclara")); results = criteria.list();I But if I try to use whole collection as criteria, result's size is 0 public static List&lt;Tag&gt; filterTags(List&lt;Tag&gt; tags) { SessionFactory sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); Criteria criteria = session.createCriteria(Tag.class); List&lt;Tag&gt; results = new ArrayList&lt;Tag&gt;(); for(Tag tag : tags) { criteria.add(Restrictions.eq("name", tag.getName())); } results = criteria.list(); I have no ideas why is that happening
accepted answer: http://stackoverflow.com/a/27205323
has title: Hibernate criteria with collections
downvote count: 0
score: 1

http://stackoverflow.com/comment/42887489
score: 0
type: Comment
has text: @codeav3 if you're going to reference these variables from multiple methods, you should declare them as [member variables](https://docs.oracle.com/javase/tutorial/java/javaOO/variables.html).
comment on: http://stackoverflow.com/a/27201563
type: AnswerComment

apache-poi
tags question: http://stackoverflow.com/q/27308718
tags question: http://stackoverflow.com/q/27266131
tags question: http://stackoverflow.com/q/27289443
tags question: http://stackoverflow.com/q/27225499
tags question: http://stackoverflow.com/q/27172136
tags question: http://stackoverflow.com/q/27169948
tags question: http://stackoverflow.com/q/27204492
type: Tag
tags question: http://stackoverflow.com/q/27204455
tags question: http://stackoverflow.com/q/27248248
tags question: http://stackoverflow.com/q/27271123
tags question: http://stackoverflow.com/q/27183699
tags question: http://stackoverflow.com/q/27226413
tags question: http://stackoverflow.com/q/27312886
tags question: http://stackoverflow.com/q/27220313
tags question: http://stackoverflow.com/q/27233622
tag name: apache-poi
tags question: http://stackoverflow.com/q/27227828
tags question: http://stackoverflow.com/q/27203801
tags question: http://stackoverflow.com/q/27290204
tags question: http://stackoverflow.com/q/27265049
tags question: http://stackoverflow.com/q/27209863
tags question: http://stackoverflow.com/q/27298135

http://stackoverflow.com/comment/42905369
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27212145
has text: @ursa I added a lot more detail.

http://stackoverflow.com/a/27173075
answers question: http://stackoverflow.com/q/27172823
has comment: http://stackoverflow.com/comment/42836470
has body: You can use this Java regex code to put hyphens at right place in UUID string: String s = "005056963AB75FD48BDC59C100314C40"; s = s.replaceAll( "(?i)([a-f0-9]{8})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{12})", "$1-$2-$3-$4-$5"); System.out.printf("UUID: [%s]%n", s); //=&gt; 00505696-3AB7-5FD4-8BDC-59C100314C40 Update: Non regex solution (thnks to @atamanroman) StringBuilder sbr = new StringBuilder(s); for(int i=8, j=0; i&lt;=20; i+=4, j++) sbr.insert(i+j, '-'); UUID uuid = UUID.fromString( sbr.toString() );
score: 0
type: Answer

http://stackoverflow.com/q/27158769
tagged with: jdbc
has body: I'm having difficulties in Java with an SQLITE database provided in a separate JAR file. Surprisingly, the sqlite database seems to be accessed even after removing the JAR file, exiting and restarting the program and even after rebooting the machine. I'm using the Xerial driver sqlite-jdbc-3.7.2.jar (for org.sqlite.JDBC). EDIT: very same issue with sqlite-jdbc-3.8.6.jar. Xerial JDBC driver is published here: https://bitbucket.org/xerial/sqlite-jdbc I'm really puzzled. Is there some kind of persistent cache for this particular JDBC driver? or is it something I missed regarding JDBC in general? CODE SAMPLE: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class SqliteJDBCTest { public static void main(String[] args) { Connection connection = null; Statement statement = null; ResultSet rs = null; try { Class.forName("org.sqlite.JDBC"); connection = DriverManager.getConnection("jdbc:sqlite::resource:jar:file:doesntexistJAR.jar!/doesntexistDB.sqlite"); System.out.println("connection = " + connection); statement = connection.createStatement(); System.out.println("statement = " + statement); rs = statement.executeQuery(" SELECT * FROM nonexistentTable WHERE key = 'nonexistentKey'"); } catch (Exception e) { e.printStackTrace(); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } } } The above code sample shows the first step of the problem: on the first run, DriverManager.getConnection(..) throwed an exception as expected: $ java -jar sqliteJDBCTest.jar java.sql.SQLException: failed to load jar:file:doesntexistJAR.jar!/doesntexistDB.sqlite: java.io.FileNotFoundException: doesntexistJAR.jar (Aucun fichier ou dossier de ce type) at org.sqlite.Conn.open(Conn.java:92) at org.sqlite.Conn.&lt;init&gt;(Conn.java:57) at org.sqlite.JDBC.createConnection(JDBC.java:77) at org.sqlite.JDBC.connect(JDBC.java:64) at java.sql…
has comment: http://stackoverflow.com/comment/42843925
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27230373
has comment: http://stackoverflow.com/comment/42823142
has comment: http://stackoverflow.com/comment/42878085
tagged with: java
has comment: http://stackoverflow.com/comment/42812848
type: Question
has title: Why is java.sql.DriverManager.getConnection() still working after removing the SQLite database JAR?
has comment: http://stackoverflow.com/comment/42813964
score: 0
has answer: http://stackoverflow.com/a/27230373
tagged with: sqlite
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/42878046
has comment: http://stackoverflow.com/comment/42814694
has comment: http://stackoverflow.com/comment/42938024

http://stackoverflow.com/comment/42981207
score: 0
type: AnswerComment
has text: @mish it's administration problem, i think. Not programmatic.
type: Comment
comment on: http://stackoverflow.com/a/27248603

http://stackoverflow.com/comment/43061459
score: 0
comment on: http://stackoverflow.com/q/27298487
type: QuestionComment
has text: you are right but unfortunately i have to do it hard way
type: Comment

http://stackoverflow.com/a/27252090
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42978645
type: Answer
has comment: http://stackoverflow.com/comment/42978701
score: 2
downvote count: 0
has body: As the example stands right now, the user still needs to enter the power consumption. Keeping with your current design, add an array of your power consumption values: private String[] appStrings={" ","Refrigirator","Electric Iron","Fan","Television","Washing Machine"}; private double[] appPower={0.0, 200.0, 50.0, 20.0, 150.0, 250.0}; // New Add an ActionChangeListener to your combobox: appCB.addActionListener(new ApplianceChangeListener()); Since you have a lookup table, you may not want users to edit the power consumption. If this is the case, you may wish to set the field as not editable: powTF.setEditable(false); In order to keep the Calculate button working and add functionality, I recommend moving all of the code from the CalculateButtonHandler into a new method called calculate and just have the button handler call calculate. public class CalculateButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent e){ calculate(); } } private void calculate() { double a,b,c,d,f,g,h; try { a=Double.parseDouble(powTF.getText()); b=Double.parseDouble(hoursTF.getText()); } catch (NumberFormatException nfe) { return; } c=(a*b)/1000; d=c*30; f=d*12; dayTF.setText(""+c); monthTF.setText(""+d); yearTF.setText(""+f); } Note that there is a try/catch wrapper around the calls to parseDouble. This will just return from the method (without error) if the user has not entered hours OR if they have selected no appliance. And finally, the ApplianceChangeListener: public class ApplianceChangeListener implements ActionListener { @Override public void actionPerformed(ActionEvent ae) { int item = appCB.getSelectedIndex(); if (item == 0) powTF.setText(""); else powTF.setText("" + appPower[item]); calculate(); } }
accepted answer of: http://stackoverflow.com/q/27250662
answers question: http://stackoverflow.com/q/27250662
has comment: http://stackoverflow.com/comment/42979119
upvote count: 2

http://stackoverflow.com/comment/43017643
has text: I tried with resizing the image by converting it to BufferImage. I passed the new width as `4*72=288` and height as `6*72=432` (as everything is 72dpi in java). But the image gets distorted. Its prints a image of 3.7 x 4 and uses a printable area of 4 x 5.2. The print quality was also decreased drastically. [The link to the edited code](http://pastie.org/9758244). I am not sure, if I am using the correct process to convert from and back to BufferedImage to Image.
comment on: http://stackoverflow.com/q/27273402
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27294315
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27294756
has title: Click on jsp tree element
score: 0
has answer: http://stackoverflow.com/a/27294432
possible better answer: http://stackoverflow.com/a/27294756
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: selenium
type: Question
accepted answer: http://stackoverflow.com/a/27294432
has body: I am having a tree element from a jsp page. When clicking this span tag then I get more of the tree. Categories Any recommendations how to click with selenium on this span element to expand it more? I appreciate your answer! UPDATE All these tree elements look the same. The only difference is their tag text.

http://stackoverflow.com/comment/42971632
score: 0
has text: Yes FFMpeg written in C/C++. You can also look at http://developer.android.com/guide/topics/media/exoplayer.html
type: Comment
comment on: http://stackoverflow.com/a/27245498
type: AnswerComment

http://stackoverflow.com/q/27241517
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42997415
has title: How to "disable a method" in java and make it active in an actionPerformed method if that makes any sense
has comment: http://stackoverflow.com/comment/42987193
tagged with: awt
score: 0
has comment: http://stackoverflow.com/comment/42994531
answer count: 1
tagged with: applet
has answer: http://stackoverflow.com/a/27241554
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42974663
has comment: http://stackoverflow.com/comment/42960003
linked to: http://stackoverflow.com/q/6255106
tagged with: paint
has body: Situation: So I am calling the method draw from my paint method. However, I only want it to draw if the convert button is clicked. How do I tell java to not draw3Drectangle unless (ae.getSource==convert)?? I am new to GUI as you can probably tell, so simple answers please. Appreciate any help. CODE: public class simpgui extends Applet implements ActionListener { Button convert; Label celsius; Label farenheit; TextField cels; TextField fare; String message = ""; public void init() { convert = new Button("Convert"); celsius = new Label("Celsius"); farenheit = new Label("Farenheit"); cels = new TextField(15); fare = new TextField(15); add(convert); add(celsius); add(cels); add(farenheit); add(fare); convert.addActionListener(this); } public void paint(Graphics g) { fare.setLocation(160,50); farenheit.setLocation(90,50); convert.setLocation(310,5); draw(g); } public void actionPerformed (ActionEvent ae) { if(ae.getSource() == convert) { int farenheit = (int) ((Double.parseDouble(cels.getText())) * (1.8)) + 32; fare.setText(farenheit+""); } } public static void draw(Graphics g) { g.setColor(Color.BLUE); g.fill3DRect(0,0,400,100,true); } }

http://stackoverflow.com/a/27285286
has body: View your data structure on how you would view your real life calendar. E.g. one person could have one calendar - the calendar is made up of days, multiple events can occur on any given day. Events can occur repeatedly, and span given days.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27285237

http://stackoverflow.com/q/27290920
favorite count: 0
has comment: http://stackoverflow.com/comment/43047761
has answer: http://stackoverflow.com/a/27294113
accepted answer: http://stackoverflow.com/a/27294113
type: AnsweredQuestion
type: Question
has body: I am new to Apache Camel and using Java DSL. I want to send a image file to different end points by splitting it using image processing tool. What are all the components do I need to use to achieve that and also I need to send the split images to one more end point.
tagged with: java
tagged with: apache-camel
has title: Apache camel : how to split the file and send to multiple end points
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43048321

http://stackoverflow.com/q/27227964
type: Question
tagged with: jpa
downvote count: 0
has title: JPA with ORACLE insert null error
linked to: http://stackoverflow.com/q/24693015
tagged with: oracle-database
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42933956
tagged with: exception
type: UnansweredQuestion
upvote count: 1
has body: I have a JPA entity named "Service" having ID as primary key @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(name = "NAME") private String name; When I am trying to persist this data through JPA persistence API Service service = new Service("abcservice"); entityManager.persist(service); I am getting error cannot insert NULL into ("TESTUSER992"."SERVICE"."ID") org.hibernate.exception.ConstraintViolationException: could not insert: [com.dto.Service] I am using Oracle thin, sid:xe
tagged with: constraints
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27229226

http://stackoverflow.com/q/27270777
has comment: http://stackoverflow.com/comment/43011822
has comment: http://stackoverflow.com/comment/43012033
has title: Why Netbeans warns me of finalize?
type: AnsweredQuestion
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/26642153
has body: I implemented a class in Java7. It does not inherit/implements anything. It uses Tess4J so I thought it would be nice to free the resources in the end. So I overrode the finalize() method like this: @Override protected void finalize() throws Throwable { try { TessAPI1.TessBaseAPIDelete(handle); } catch(Throwable t) { throw t; } finally { super.finalize(); } } Netbeans 8.0.2 gives me warning for this method: finalize declared() The description on Netbeans website is not more useful to me: warns about implementation of Object.finalize() I didn't overrode any other method like equals or anything (maybe I should?). Can you tell me why I get this warning?
accepted answer: http://stackoverflow.com/a/27271133
possible better answer: http://stackoverflow.com/a/27271066
tagged with: finalize
type: Question
has comment: http://stackoverflow.com/comment/43012465
tagged with: java-7
downvote count: 0
has answer: http://stackoverflow.com/a/27271133
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/27270885
has comment: http://stackoverflow.com/comment/43011637
has answer: http://stackoverflow.com/a/27271066
tagged with: netbeans
upvote count: 3

http://stackoverflow.com/comment/43053162
has text: it's fixed now, all i had to do is move the list outside the method and it worked thanks a lot for your help.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27293467

http://stackoverflow.com/q/27246277
has comment: http://stackoverflow.com/comment/42967876
has answer: http://stackoverflow.com/a/27246745
accepted answer: http://stackoverflow.com/a/27246745
answer count: 5
has comment: http://stackoverflow.com/comment/42967877
has answer: http://stackoverflow.com/a/27246410
has comment: http://stackoverflow.com/comment/42967573
has answer: http://stackoverflow.com/a/27246738
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42967538
tagged with: java
has body: Sorry if I'm a bit vague, but between not being my native language and that I am a beginner, I'm trying my best to put the question clear. I am stuck in a part of an exercise that I can't find any solutions to, even after searching in Google. At least not something that I understand. I have to create two constructors, one of them, apart from the variables, receives a group of teachers, and the other one receives only one teacher. private Set&lt;Teacher&gt; teacher; public DespachoImpl(String nombre, Integer planta, Integer aforo, Teacher teacher) { super(TipoLugar.OTRO, nombre, planta, aforo); this.teacher = new HashSet&lt;Teacher&gt;(); } I can't find anything about how to make them different, so that one constructor only adds 1 teacher, and the other one adds a few teachers. Thanks for the help, would be lovely if you linked some resources too.
has answer: http://stackoverflow.com/a/27246597
possible better answer: http://stackoverflow.com/a/27246410
has comment: http://stackoverflow.com/comment/42967626
type: Question
has comment: http://stackoverflow.com/comment/42967955
has title: Adding a group in a constructor instead of only one
has comment: http://stackoverflow.com/comment/42968412
score: 0
has answer: http://stackoverflow.com/a/27246505
has comment: http://stackoverflow.com/comment/42967689

http://stackoverflow.com/q/27207512
has body: I've been following this page http://devmag.org.za/2009/04/25/perlin-noise/ as a guide to create my own perlin noise - it's been pointed out in the comments section that this is FBM noise, but that's irrelevant. This is working very nicely so far, these are the results, after some 'cleaning' to remove as many artifacts as I can. http://puu.sh/dayg9/2943aca5ce.png Now that I've created my noise, I'm going to use it as an infinite map for a platform game. However, as you can see, there are some holes in my noise. -Please note- this noise is meant for a 2D game! My question is - how can I either fill in these holes, or stop the player from spawning inside them? Can't find an answer despite a lot of googling and thinking EXTRA hard. Thanks for your time:)
has title: Eliminating (or detecting) holes in procedural noise for game development
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27368623
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27368623
tagged with: procedural-generation
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27207620
possible better answer: http://stackoverflow.com/a/27207620

http://stackoverflow.com/q/27175147
tagged with: java
possible better answer: http://stackoverflow.com/a/27175882
type: Question
tagged with: algorithm
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27175846
has body: i'm trying to write a blackJack game using Java and i'm facing this algorithm issue, the Hand class will choose randomly 3 card from Card class if the ACE card appears in the hand it will takes a value of 1 or 11, this is the wished result : Welcome to the BlackJack table. Let's play ! Your hand is currently : [A, 8, A] : [10, 20, 20, 30] The best score is: 20 Welcome to the BlackJack table. Let's play ! Your hand is currently : [K, J, 4] : [24] this is the method i writhe to do this : public List&lt;Integer&gt; count() { LinkedList&lt;Integer&gt; List = new LinkedList&lt;Integer&gt;(); LinkedList&lt;Integer&gt; List2 = new LinkedList&lt;Integer&gt;(); List.add(0); if(this.cardList.size()&gt;0) { for (Card c : cardList) { for (int i = 0; i &lt; List.size(); i++) { int val = List.get(i); List2.add(List.set(i, c.getPoints() + val )); if(c.getPoints() == 1) { List2.add(List.getFirst() + (val + 11)); } } } } return List2; } and this is what i get : Welcome to the BlackJack table. Let's play ! Your Hand is currently : [5(♥), 8(♦), 8(♥)] [0, 5, 13]
has answer: http://stackoverflow.com/a/27175846
has answer: http://stackoverflow.com/a/27175882
type: AnsweredQuestion
tagged with: oop
has title: issue in my algorithm when the 'ACE' card appears in the hand of my blackjack game

http://stackoverflow.com/a/27208399
accepted answer of: http://stackoverflow.com/q/27158723
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
has body: I resolved using a custom XMLStreamWriter that replace the &lt;tag-name&gt;&lt;/tag-name&gt; with &lt;tag-name/&gt; if tag-name has no content at all. The idea behind is to defer write events between startElement-endElement. When an endElement is found if the aren't content events between boundaries replace startElement with a emptyElement and suppress endElement at all. Sorry for poor comments, I'll came back later to make it more understandable. public class EmptyTagXMLStreamWriter extends StreamWriterDelegate { class Event { Method m; Object[] args; } enum EventEnum { writeStartElement, writeAttribute, writeNamespace, writeEndElement, setPrefix, setDefaultNamespace, } private List&lt;Event&gt; queue = new ArrayList&lt;Event&gt;(); protected EmptyTagXMLStreamWriter(XMLStreamWriter out) { super(out); } @Override public void writeStartElement(String localName) throws XMLStreamException { d(e(m("writeStartElement",String.class)), localName); } @Override public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { d(e(m("writeStartElement",String.class,String.class)), namespaceURI, localName); } @Override public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { d(e(m("writeStartElement",String.class,String.class,String.class)), prefix, localName, namespaceURI); } @Override public void writeAttribute(String localName, String value) throws XMLStreamException { d(e(m("writeAttribute",String.class, String.class)), localName, value); } @Override public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { d(e(m("writeAttribute",String.class, String.class, String.class)), namespaceURI, localName, value); } @Override public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException { d(e(m("writeAttribute",String.class, String.class, String.class, String.class)), prefix, namespaceURI, …
answers question: http://stackoverflow.com/q/27158723
type: Answer

http://stackoverflow.com/a/27273494
has comment: http://stackoverflow.com/comment/43016765
has comment: http://stackoverflow.com/comment/43016907
score: 19
has comment: http://stackoverflow.com/comment/61980153
has comment: http://stackoverflow.com/comment/43019180
has comment: http://stackoverflow.com/comment/135069162
has comment: http://stackoverflow.com/comment/43018997
has comment: http://stackoverflow.com/comment/61969168
has body: In C#, we don't have anonymous types like Java per se. You can create an anonymous type which contains fields like so: var myObject = new { Foo = "foo", Bar = 1, Quz = 4.2f } However these cannot have methods placed in them and are only passable into methods by use of object or dynamic (as they have no type at compile-time, they are generated by the compiler AFAIK) Instead in C# we use, as you said, delegates or lambdas. If I understand your pickle correctly, you could implement a nested private class like so: interface IMyInterface { void Foo(); } class MyClass { public void Bar() { var obj = new MyInterface(); obj.Foo(); } private class MyInterface : IMyInterface { public void Foo() { // stuff } } } Now MyClass can create an instance of MyInterface which implements IMyInterface. As commentors have mentioned, MyInterface can access members of MyClass (although you most certainly want to try and stick to using publicly accessible members of both types). This encapsulates the "anonymous" class (using Java terms here to make it simpler) and also means that you could potentially return MyInterface as an IMyInterface and the rest of the software would be none the wiser. This is actually how some abstract factory patterns work. Basically, I need to run different code from the calling class depending on what happens in the SomethingModel class methods. This smells of heavy coupling. Oh dear! It sounds to me like your particular problem could use refactoring. In C# you can use Events to solve this (note: Can, not should). Just have an Event for each "branch" point of your method. However I must say that this does make your solution harder to envisage and maintain. However I suggest you architect your solution in a way such that you don't need such heavy coupling like that. You could also try using a Pipeline model but I'm not sure how to implement that myself. I know that jetty (or is it Netty? the NIO for Java by JBOSS) certainly used a similar model. You may find that th…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27273328
downvote count: 0
answers question: http://stackoverflow.com/q/27273328
has comment: http://stackoverflow.com/comment/61969359
type: Answer
has comment: http://stackoverflow.com/comment/61899867
upvote count: 19

optimization
tags question: http://stackoverflow.com/q/27262453
tags question: http://stackoverflow.com/q/27247530
tags question: http://stackoverflow.com/q/27305587
tags question: http://stackoverflow.com/q/27289245
tags question: http://stackoverflow.com/q/27313159
tags question: http://stackoverflow.com/q/27178559
tag name: optimization
tags question: http://stackoverflow.com/q/27236587
tags question: http://stackoverflow.com/q/27288928
tags question: http://stackoverflow.com/q/27307490
type: Tag

http://stackoverflow.com/comment/42891926
has text: Post your AsyncTask plz.
score: 0
comment on: http://stackoverflow.com/q/27204694
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27278667
downvote count: 0
linked to: http://stackoverflow.com/q/4644451
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27280268
type: AnsweredQuestion
has title: Hebrew/Jewish Calendar in Android
upvote count: 2
tagged with: calendar
type: Question
accepted answer: http://stackoverflow.com/a/27280268
tagged with: java
has comment: http://stackoverflow.com/comment/81980290
score: 2
answer count: 1
has body: I need to display a Jewish calendar in my app, there is only a Gregorian calendar view on the API. In each box of the calendar (each day) I need to display the appropriate date in Hebrew letters. Maybe I should create a Gregorian calendar view, and convert it to a Jewish calendar, something like this: Gregorian to Hebrew

http://stackoverflow.com/a/27271102
type: AcceptedAnswer
has body: Use a positive lookbehind for this. String input = "I'am peter and i'm apetering or fadapetering"; System.out.println( input .replaceAll("(?&lt;=\\w)pet", "") ); Output I'am peter and i'm aering or fadaering Note See API on Special constructs (named-capturing and non-capturing).
accepted answer of: http://stackoverflow.com/q/27271065
answers question: http://stackoverflow.com/q/27271065
type: Answer
score: 0

http://stackoverflow.com/comment/43033717
has text: actually just found this problem wrong import
comment on: http://stackoverflow.com/q/27281957
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42909955
type: Comment
comment on: http://stackoverflow.com/a/27213169
score: 0
type: AnswerComment
has text: @cardboard12I don't understand the question. Are you asking how you would call the constructor? `List<String> list = new ArrayList<String>(); list.add("something"); Shopping shopping = new Shopping(2.3,list);`

http://stackoverflow.com/comment/43067631
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27301810
type: Comment
has text: `trim().isEmpty()` sounds like a reasonable option to me - have you tried it and run into a problem? Showing us code and the part that you have a real problem with will be more useful than having us try to answer a hypothetical problem.

http://stackoverflow.com/comment/42961369
type: Comment
type: QuestionComment
has text: whats is the problem you are facing?
score: 0
comment on: http://stackoverflow.com/q/27242671

javacard
tag name: javacard
type: Tag
tags question: http://stackoverflow.com/q/27187461

http://stackoverflow.com/q/27260972
has comment: http://stackoverflow.com/comment/42995219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42995049
has comment: http://stackoverflow.com/comment/42995155
tagged with: copyonwritearraylist
favorite count: 0
type: Question
has body: I have this code: int rnd1=Rnd.get(players.size()); int rnd2=Rnd.get(players.size()); while(rnd2==rnd1) rnd2=Rnd.get(players.size()); for(L2PcInstance player : players) { if(player != players.get(rnd1) &amp;&amp; player != players.get(rnd2)) players.remove(player); } And I have this error: Exception in thread "GeneralSTPool-8" java.lang.ArrayIndexOutOfBoundsException: 2 at java.util.concurrent.CopyOnWriteArrayList.get(Unknown Source) at java.util.concurrent.CopyOnWriteArrayList.get(Unknown Source) at net.sf.l2j.gameserver.model.RandomFight.pickPlayers(RandomFight.java:89) at net.sf.l2j.gameserver.model.RandomFight$pickPlayers.run(RandomFight.java:270) at net.sf.l2j.gameserver.ThreadPoolManager$RunnableWrapper.run(ThreadPoolManager.java:85) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) What is going on here? Line 89 is this : for(L2PcInstance player : players). This shouldn't appeared since rnd.get() is from 0 to players.size() - 1.
has comment: http://stackoverflow.com/comment/42995129
score: -2
tagged with: list
tagged with: java
downvote count: 3
upvote count: 1
answer count: 1
has title: copyonwritearraylist strange error
has comment: http://stackoverflow.com/comment/42995146
has comment: http://stackoverflow.com/comment/42995223
has answer: http://stackoverflow.com/a/27261136

http://stackoverflow.com/q/27180856
tagged with: java
has title: Byte -> Primitive inconsistency, attempting to create a buffer
score: 0
has body: I'm attempting to make a customized buffer that's going to be using a List&lt;Byte&gt; and currently I've only gotten as far as a single method before it completely broke down on me, and I'm not sure exactly why. I've been referencing the Source code of the DataOutputStream and DataInputStream classes to make sure that I'm reading/writing the data correctly. I must be doing something wrong. private List&lt;Byte&gt; buffer = new ArrayList&lt;&gt;(); public void writeInt(int value) { buffer.add((byte)((value &gt;&gt;&gt; 24) &amp; 0xFF)); buffer.add((byte)((value &gt;&gt;&gt; 16) &amp; 0xFF)); buffer.add((byte)((value &gt;&gt;&gt; 8) &amp; 0xFF)); buffer.add((byte)((value &gt;&gt;&gt; 0) &amp; 0xFF)); } public void readInt() { int ch1 = buffer.get(0); int ch2 = buffer.get(1); int ch3 = buffer.get(2); int ch4 = buffer.get(3); System.out.println("CH1: " + ch1); System.out.println("CH2: " + ch2); System.out.println("CH3: " + ch3); System.out.println("CH4: " + ch4); System.out.println("==============="); int value = ((ch1 &lt;&lt; 24) + (ch2 &lt;&lt; 16) + (ch3 &lt;&lt; 8) + (ch4 &lt;&lt; 0)); System.out.println("Value: " + value); } If I write a small value(Anything from 0->127), it's perfectly fine, however the moment I get to 128, all hell breaks lose, here's the output of 127vs128 #writeInt(127) CH1: 0 CH2: 0 CH3: 0 CH4: 127 =============== Value: 127 #writeInt(128) CH1: 0 CH2: 0 CH3: 0 CH4: -128 =============== Value: 128 And just for some more (I don't understand it) examples, here's a large number. #writeInt(999999999) CH1: 59 CH2: -102 CH3: -55 CH4: -1 =============== Value: 983156991 I'm honestly not sure where I'm going wrong, hopefully someone can tell me. EDIT: I also thought it could be because I'm getting the byte as an int, and then trying to do the math, so I changed it up, but it didn't change the result at all. Modification example: public void readInt() { int ch1 = buffer.get(0) &lt;&lt; 24; int ch2 = buffer.get(1) &lt;&lt; 16; int ch3 = buffer.get(2) &…
has answer: http://stackoverflow.com/a/27181740
answer count: 1
accepted answer: http://stackoverflow.com/a/27181740
tagged with: io
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/42885969
type: QuestionComment
comment on: http://stackoverflow.com/q/27201203
score: 0
has text: I think you must remove addFlags from your code
type: Comment

http://stackoverflow.com/comment/42846682
comment on: http://stackoverflow.com/q/27178895
score: 0
type: Comment
type: QuestionComment
has text: Are you compiling against the jdk or the jre? make sure its the jdk.

http://stackoverflow.com/q/27163066
has comment: http://stackoverflow.com/comment/42819143
has body: I'm in the design phase of a program that will have 10-30 threads, where each thread will process many small blocks of information. I have the option of each block sleeping for 5 ms or not sleeping at all. I should choose whichever reduces load on the CPU. Normally I would sleep to reduce CPU utilization, but I am concerned that many 5 ms sleeps may, because of context switching, cause CPU utilization to increase rather than decrease. Are there any studies already done on the trade off between short sleeps and context switching on CPU utilization?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42822210
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27175696
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/27175781
has answer: http://stackoverflow.com/a/27175696
has comment: http://stackoverflow.com/comment/69275428
score: 0
has title: At what point do short sleeps increase CPU util rather than reduce it
linked to: http://stackoverflow.com/q/2313062
has comment: http://stackoverflow.com/comment/42840781
has comment: http://stackoverflow.com/comment/42819427
tagged with: cpu-usage
tagged with: multithreading
tagged with: architecture
accepted answer: http://stackoverflow.com/a/27175781

http://stackoverflow.com/a/27216754
answers question: http://stackoverflow.com/q/27216192
upvote count: 1
type: Answer
has body: I struggle with regular expressions: private static final List LONDON_CODES = Arrays.asList("WC","EC","BR","CR","DA","EN","HA","IG","KT","RM","SM","TW","UB","WD"); public static void main(String ... a) { if(LONDON_CODES.contains("WD")) { System.out.println("This is London!"); } else { System.out.println("This is country!"); } }
downvote count: 0
score: 1

onfocus
tag name: onfocus
tags question: http://stackoverflow.com/q/27268840
type: Tag

http://stackoverflow.com/a/27192250
has comment: http://stackoverflow.com/comment/43254605
has comment: http://stackoverflow.com/comment/43427758
score: 1
upvote count: 1
has body: UIAutomator runs inside the shell as a process, so we would not be able to access excel file which runs in PC How ever, there are two ways you can automate it: 1.Write a Script to parse excel sheet and set them as dummy system properties, use UIAutomator to read the same //set android dummy property using script adb shell setprop dummy value //Read Value of property in UIAutomator getProperty("dummy"); //Subroutine for Reading Property from Android public String getProperty(String propName) { String propValue = null; try { propValue = (String) Class.forName("android.os.SystemProperties").getMethod("get", new Class[] { String.class }).invoke(null, propName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return propValue; } 2.Write values to a text file and parse it in Java in UIAutomator class
answers question: http://stackoverflow.com/q/27182337
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43432077
has comment: http://stackoverflow.com/comment/43247810

http://stackoverflow.com/q/27266597
has body: How to get all bindings declared in a WSDL using JAX-WS (Metro implementation) API? Use case : I am going to enable the users of my application to dynamically invoke a web service. For that I am discovering the bindings first, then ports associated with the binding etc. at runtime. I was going through the Metro documentation and found WSDLport class might useful to get port information and then binding information. But any idea how to get the reference of this class in the first place?
score: 0
has answer: http://stackoverflow.com/a/27525852
answer count: 1
type: UnansweredQuestion
has title: How to get all binding information from WSDL using JAX-WS API
tagged with: soap-client
tagged with: java
tagged with: jax-ws
tagged with: web-services
type: Question
tagged with: java-metro-framework

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

http://stackoverflow.com/comment/43017415
type: QuestionComment
comment on: http://stackoverflow.com/q/27273865
type: Comment
score: 1
has text: There are multiple articles in google about this for example http://howtodoinjava.com/2013/07/22/how-to-generate-secure-password-hash-md5-sha-pbkdf2-bcrypt-examples/.

http://stackoverflow.com/comment/42852171
comment on: http://stackoverflow.com/q/27181941
has text: Why is name swapping not taking place? name[loc] is loosing it's value every time it's assigned name[pass].
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42988275
type: Comment
comment on: http://stackoverflow.com/q/27256751
has text: As described by the JavaDocs, you pass it reference of a Component which acts as the parent for the dialog
score: 0
type: QuestionComment

http://stackoverflow.com/q/27287351
type: Question
score: 0
has body: So here's how my client looks like: Socket socket = new Socket("localhost", 1234); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); while (true) { String userInput = stdIn.readLine(); if (userInput != null) { String message = username + ":" + userInput + "\n"; out.println(message); out.flush(); } String serverMessage = in.readLine(); if (serverMessage != null){ System.out.println(serverMessage); } } Client has to listen for user input to transmit it to other clients and has to listen for other clients messages. This code does exactly that but gets stuck on the first line listening for user input. Is there any workaround ?
answer count: 1
has comment: http://stackoverflow.com/comment/43042872
has answer: http://stackoverflow.com/a/27287763
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43041898
has title: Socket client stuck on user input
has comment: http://stackoverflow.com/comment/43041762
tagged with: java

http://stackoverflow.com/comment/42983464
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27254053
has text: @paulc01 also can you mark this as correct if this is what helped you? Thanks!

jsp
tags question: http://stackoverflow.com/q/27157733
tags question: http://stackoverflow.com/q/27231852
tags question: http://stackoverflow.com/q/27226285
tags question: http://stackoverflow.com/q/27156313
tags question: http://stackoverflow.com/q/27263290
tags question: http://stackoverflow.com/q/27226713
tags question: http://stackoverflow.com/q/27167099
tags question: http://stackoverflow.com/q/27243117
tags question: http://stackoverflow.com/q/27210577
tags question: http://stackoverflow.com/q/27293302
tags question: http://stackoverflow.com/q/27295431
tags question: http://stackoverflow.com/q/27221934
tags question: http://stackoverflow.com/q/27225059
tags question: http://stackoverflow.com/q/27304332
tags question: http://stackoverflow.com/q/27166399
tags question: http://stackoverflow.com/q/27273865
tags question: http://stackoverflow.com/q/27236495
tags question: http://stackoverflow.com/q/27164313
tags question: http://stackoverflow.com/q/27182993
tags question: http://stackoverflow.com/q/27186492
tags question: http://stackoverflow.com/q/27233116
tags question: http://stackoverflow.com/q/27166237
tags question: http://stackoverflow.com/q/27220192
tags question: http://stackoverflow.com/q/27166452
tags question: http://stackoverflow.com/q/27256848
tags question: http://stackoverflow.com/q/27287510
tags question: http://stackoverflow.com/q/27218154
tags question: http://stackoverflow.com/q/27166702
tags question: http://stackoverflow.com/q/27213172
tags question: http://stackoverflow.com/q/27248639
tags question: http://stackoverflow.com/q/27174889
tags question: http://stackoverflow.com/q/27262743
tags question: http://stackoverflow.com/q/27287070
tags question: http://stackoverflow.com/q/27261807
tags question: http://stackoverflow.com/q/27236173
tags question: http://stackoverflow.com/q/27287011
type: Tag
tags question: http://stackoverflow.com/q/27280013
tags question: http://stackoverflow.com/q/27271099
tags question: http://stackoverflow.com/q/27181731
tags question: http://stackoverflow.com/q/27285115
tags question: http://stackoverflow.com/q/27271446
tags question: http://stackoverflow.com/q/27234426
tags question: http://stackoverflow.com/q/27216680
tags question: http://stackoverflow.com/q/27258336
tags question: http://stackoverflow.com/q/27226219
tags question: http://stackoverflow.com/q/27189102
tags question: http://stackoverflow.com/q/27234976
tags question: http://stackoverflow.com/q/27291952
tags question: http://stackoverflow.com/q/27254424
tags question: http://stackoverflow.com/q/27183847
tags question: http://stackoverflow.com/q/27215450
tags question: http://stackoverflow.com/q/27288180
tag name: jsp
tags question: http://stackoverflow.com/q/27309506
tags question: http://stackoverflow.com/q/27172991
tags question: http://stackoverflow.com/q/27292442
tags question: http://stackoverflow.com/q/27201763
tags question: http://stackoverflow.com/q/27163692
tags question: http://stackoverflow.com/q/27249674
tags question: http://stackoverflow.com/q/27251039
tags question: http://stackoverflow.com/q/27281760
tags question: http://stackoverflow.com/q/27243355
tags question: http://stackoverflow.com/q/27174157
tags question: http://stackoverflow.com/q/27257190
tags question: http://stackoverflow.com/q/27264473
tags question: http://stackoverflow.com/q/27159398
tags question: http://stackoverflow.com/q/27211796
tags question: http://stackoverflow.com/q/27202350
tags question: http://stackoverflow.com/q/27271010
tags question: http://stackoverflow.com/q/27211376
tags question: http://stackoverflow.com/q/27242741
tags question: http://stackoverflow.com/q/27231579
tags question: http://stackoverflow.com/q/27228656
tags question: http://stackoverflow.com/q/27221675
tags question: http://stackoverflow.com/q/27309573
tags question: http://stackoverflow.com/q/27178381
tags question: http://stackoverflow.com/q/27283254
tags question: http://stackoverflow.com/q/27209971
tags question: http://stackoverflow.com/q/27185588

http://stackoverflow.com/comment/42861527
type: QuestionComment
has text: sry,i can't zip it my requirement should download one by one
comment on: http://stackoverflow.com/q/27187437
score: 0
type: Comment

http://stackoverflow.com/comment/42948879
type: QuestionComment
score: 0
has text: value can not be null so those null checks are useless. And learn about the [label element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
comment on: http://stackoverflow.com/q/27236173
type: Comment

http://stackoverflow.com/comment/42845120
type: Comment
comment on: http://stackoverflow.com/a/27178091
type: AnswerComment
score: 0
has text: Ok. I think I know what your problem might be. Can you show me the first couple of lines of your onCreate method in your second activity? Specifically the line where you set the layout

http://stackoverflow.com/q/27174273
tagged with: jodatime
answer count: 2
has comment: http://stackoverflow.com/comment/42838249
linked to: http://stackoverflow.com/q/27136877
linked to: http://stackoverflow.com/q/38922754
tagged with: date
score: 0
possible better answer: http://stackoverflow.com/a/68321635
has comment: http://stackoverflow.com/comment/42838377
has answer: http://stackoverflow.com/a/27174339
has answer: http://stackoverflow.com/a/68321635
tagged with: datetime
has body: I'm writing some code to store metadata from uploaded images in the database. One of those fields is the photo Capture Date. The API I'm using returns the Capture Date in the String format Sat Nov 01 20:08:07 UTC 2014 However, Joda Time throws an IllegalArgumentException when creating a DateTime or LocalDateTime. Conversely, java.util.Date accepts the string formatting and creates a Date object with no issue. One solution is to do Date tempDate = new Date("Sat Nov 01 20:08:07 UTC 2014"); DateTime captureDate = new DateTime(tempDate); but this requires creating two separate objects to persist one. Given the string format above, is it possible to convince JodaTime to create a DateTime object without an intermediary Date initialization?
type: AnsweredQuestion
has title: JodaTime throws IllegalArgumentException with Date string from EXIF metadata
tagged with: java
accepted answer: http://stackoverflow.com/a/27174339
has comment: http://stackoverflow.com/comment/42838294
type: Question

http://stackoverflow.com/q/27266216
favorite count: 0
has title: How to load multiple configuration file from classpath using @ImportResource annotation in Spring
has answer: http://stackoverflow.com/a/27266259
possible better answer: http://stackoverflow.com/a/27266255
upvote count: 2
has answer: http://stackoverflow.com/a/27266255
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/15004674
score: 2
type: AnsweredQuestion
tagged with: java
has body: I don't know,how to load multiple configuration files from classpath in spring using @ImportResource.I have already gone through the link Spring 3 @ImportResource with multiple files but no luck so far. My code is below. @Configuration @PropertySource("classpath:apis.application.properties") @ComponentScan(basePackages = {"org.surfnet.oaaas.resource", "org.surfnet.oaaas.service"}) @ImportResource({"classpath:spring-repositories.xml,classpath:commonApplicationContext.xml"}) @EnableTransactionManagement public class SpringConfiguration { } Exception i am facing is java.io.FileNotFoundException: class path resource [spring-repositories.xml,classpath:commonApplicationContext.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) How ever when i try to load a single file,like below.it works for both file.But i can not include two ImportResource annotation in a java class. @ImportResource("classpath:spring-repositories.xml"})
accepted answer: http://stackoverflow.com/a/27266259
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/27227647
has answer: http://stackoverflow.com/a/27354517
accepted answer: http://stackoverflow.com/a/27354517
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42941602
has body: Intention: Get BufferedImage from resource (be it in IDE or running JAR). Problem: Getting an Image always works, converting to BufferedImage requires knowledge of size, but size always returns -1, even after waiting with MediaTracker. In IDE, size after MediaTracker is proper, before it is -1. Waiting with while-loop until size >-1 seems to never end in running JAR. (Tried with code language level 6 and 8 using JDK/JRE 8.) Output of SSCCE in IDE: IMAGE: sun.awt.image.ToolkitImage@15975490 WIDTH: -1 DURATION: 38 ms WIDTH: 32 BUFFEREDIMAGE: BufferedImage@6adede5: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 32 height = 32 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0 EDIT: MediaTracker's "isErrorAny()" returns false. Output of SSCCE in running JAR: IMAGE: sun.awt.image.ToolkitImage@2a84aee7 WIDTH: -1 DURATION: 23 ms WIDTH: -1 Exception in thread "main" java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be &lt;= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) at java.awt.image.BufferedImage.(Unknown Source) at ImageSizeProblem.createBufferedImageFromImage(ImageSizeProblem.java:82) at ImageSizeProblem.main(ImageSizeProblem.java:26) EDIT: MediaTracker's "isErrorAny()" returns true. But I have no way of finding out what the error is - also, the image does load properly, since it can be successfully used in an JToolBar via making an ImageIcon from it. (I already tried abusing ImageIcon's getIconWidth() or getImage() methods - they bring no improvement at all.) SSCCE: import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.net.URL; public class ImageSizeProblem { public static void main(final String[] args) { final Image img = createImageFromResource("test.png"); System.out.println("IMAGE: " + img); System.out.println("WIDTH: " + img.getWidth(null)); final long startTime = System.currentTimeMillis(); waitForImage(img); final long …
tagged with: java
has comment: http://stackoverflow.com/comment/42971557
tagged with: bufferedimage
type: Question
tagged with: jar
has comment: http://stackoverflow.com/comment/42979540
tagged with: image
has comment: http://stackoverflow.com/comment/42981093
score: 0
linked to: http://stackoverflow.com/q/13605248
has comment: http://stackoverflow.com/comment/42979322
answer count: 1
has comment: http://stackoverflow.com/comment/42963041
tagged with: size
has title: Image size returns -1 in JAR but proper size in IDE. Image loaded via Toolkit....createImage(url)

http://stackoverflow.com/a/27285394
upvote count: 1
has body: As MadProgrammer pointed out (thank you!), the problem was caused by the position of the frame.setVisible(true). This needs to be the last thing called, or the frame's refresh mode may cause for unrendered components like happened in my case.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27285233
score: 1

http://stackoverflow.com/a/27168715
has comment: http://stackoverflow.com/comment/42829951
accepted answer of: http://stackoverflow.com/q/27168504
has comment: http://stackoverflow.com/comment/42828919
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: You cannot rename the package to enum, because it is a reserved keyword in Java. At the Oracle tutorial page "Naming a package" it says In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen or other special character, if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int".
answers question: http://stackoverflow.com/q/27168504
has comment: http://stackoverflow.com/comment/42829321
type: Answer

http://stackoverflow.com/a/27243095
type: Answer
has body: You can simply split the output string into multiple parts with the "+" operand like so You need to add more quotations before and after the +: " " + " " + " " you can do this for as long as you like, this is also how you easily put variables inside an output string System.out.println("Text Text Text Text Text Text Text Text Text Text Text Text" + "Text Text Text Text Text Text Text Text Text Text"); break; System.out.println("something " + variable1 + " something else " + variable2);
score: 0
answers question: http://stackoverflow.com/q/27242989

http://stackoverflow.com/a/27529853
type: Answer
upvote count: 4
downvote count: 0
has body: Actually, the @InitBinder was not read, that's why new collection limit was not set. I had to upgrade my springmvc-router version to 1.2.0 (which also forced me upgrade my spring version to 3.2). After those upgrades, with the same code, it works ;)
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27252974
answers question: http://stackoverflow.com/q/27252974

http://stackoverflow.com/comment/43044877
score: 1
type: QuestionComment
has text: @FaroukTouzi a switch isn't much more efficient than if-statements for 100 cases
comment on: http://stackoverflow.com/q/27289210
type: Comment

http://stackoverflow.com/comment/42816957
has text: No, I want to know what's the difference using the domain or enum for show and save into database.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27161541

http://stackoverflow.com/a/27305061
has comment: http://stackoverflow.com/comment/43100210
answers question: http://stackoverflow.com/q/27303748
has comment: http://stackoverflow.com/comment/43099728
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Painting in Swing is controlled by the RepaintManager which decides when things should get updated. The RepaintManager is optimised to reduce the number paint events it schedules in order to maintain performance. This means that when it receives a bunch of requests for repaints, it will consolidate them down into as few paint events as it can. This means that when you call setText from within a loop on a bunch of buttons, it's likely that the RepaintManager has reduced this down to as close to one as it can (depending on what you are updating there might be more, but will most likely be less than the number of iterations of the loop)... For example, it seems to work for me... import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestKeyboard { public static void main(String[] args) { new TestKeyboard(); } public TestKeyboard() { 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); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private List&lt;JButton&gt; buttons; public TestPane() { setFocusable(true); setLayout(new GridLayout(0, 4)); buttons = new ArrayList&lt;&gt;(26); for (int index = 0; index &lt; 26; index++) { JButton btn = createButton(index); buttons.add(btn); add(btn); } addKeyListener(new KeyAdapter() { @Override public …
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27303748
score: 3

http://stackoverflow.com/comment/42985657
score: 0
type: Comment
has text: As I said, the problem is somewhere else. I don't see a problem in the code that you provided.
type: QuestionComment
comment on: http://stackoverflow.com/q/27215999

http://stackoverflow.com/comment/43025382
has text: Yes, already wrote that, manifest file has internet permission and internet state permission.
comment on: http://stackoverflow.com/q/27278078
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27200761
type: Question
has comment: http://stackoverflow.com/comment/42895085
answer count: 2
has answer: http://stackoverflow.com/a/27201135
has comment: http://stackoverflow.com/comment/42885145
has body: I am really confused about how to save my ArrayList of custom objects into SharedPreference. I looked up a very popular thread but did not understand solution as certain variables were not given context. My arraylist has certain things like Strings, UUIDs, and Dates, and I do not mind going to API 11 to avoid using gson or json. If someone were to be so kind as to explain the solution in this or provide their own I would really appreciate. I am new to this, been doing for a couple of months and want to make sure I understand everything in depth but my english is not so well. Thank you in advance!
tagged with: arraylist
score: 0
tagged with: android
type: UnansweredQuestion
has title: Save Arraylist of custom objects SharedPreferences
has answer: http://stackoverflow.com/a/27200811
linked to: http://stackoverflow.com/q/7057845
tagged with: java
tagged with: set
tagged with: sharedpreferences

http://stackoverflow.com/comment/43065646
type: Comment
has text: If you already have the cert imported to the keystore, then you can skip down to the Edit Configuration section.
comment on: http://stackoverflow.com/a/27300881
type: AnswerComment
score: 0

http://stackoverflow.com/q/27213688
has comment: http://stackoverflow.com/comment/42910157
has body: It is a short time that I'm studying Spring,I'm a student I have problems with dependency injection. In this project I have this error code in the method acquista.Why? Acquista in english is translated in "buy".If my Carrello (cart) is composed by more than one Articolo(Article) , in ArticoliOrdine(ArticlesOrder) I have only the first of them.Why?How can I solve it? Error code: Grave: Servlet.service() for servlet [applicationContext] in context with path [/SpringStore] threw exception [Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: bean.Ordine] with root cause org.hibernate.PersistentObjectException: detached entity passed to persist: bean.Ordine at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:139) at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:75) at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:811) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:784) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:789) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1181) 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.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:289) at com.sun.proxy.$Proxy37.persist(Unknown Source) at daoJPA.CarrelloDAOImpl.acquista(CarrelloDAOImpl.java:130) CarrelloDAOImpl.java @Transactional public class CarrelloDAOImpl implements CarrelloDAO { @PersistenceContext private EntityManager em; @Autowired Carrello carrello; @Autowir…
upvote count: 1
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/42909050
favorite count: 0
linked to: http://stackoverflow.com/q/27081472
downvote count: 0
type: UnansweredQuestion
tagged with: orm
tagged with: spring
has answer: http://stackoverflow.com/a/27214550
type: Question
has title: Spring: detached entity passed to persist
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27241493
score: 0
answer count: 1
has body: I am working with Spring 3.1.0. I am trying to understand the way spring is reading its xml files. I am trying to understand how spring deals with ambiguous conditions in the bean definitions. For example I have Alarm.java package com.anshbansal.alarm2; public class Alarm { private String type; private int volume; private int hour; public Alarm() { } public Alarm(String type, int volume, int hour) { this.type = type; this.volume = volume; this.hour = hour; } public Alarm(String type, int volume) { this.type = type; this.volume = volume; } public Alarm(int volume, String type) { this.type = type; this.volume = volume; } public void setType(String type) { this.type = type; } public void setVolume(int volume) { this.volume = volume; } public void setHour(int hour) { this.hour = hour; } @Override public String toString() { return "Alarm{" + "type='" + type + '\'' + ", volume=" + volume + ", hour=" + hour + '}'; } } My spring xml file alarm2.xml is as follows. &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.xsd"&gt; &lt;bean id="propertyRandom" abstract="true"&gt; &lt;constructor-arg value="23" type="int"/&gt; &lt;/bean&gt; &lt;bean id="alarm1" class="com.anshbansal.alarm2.Alarm" parent="propertyRandom"&gt; &lt;constructor-arg value="10" type="int"/&gt; &lt;constructor-arg value="Ringing" /&gt; &lt;/bean&gt; &lt;/beans&gt; There is ambiguity as it is not instantly clear which int will go into volume and which will go into hour. If I print I get the following Alarm{type='Ringing', volume=23, hour=10} So how does spring read the xml file to resolve which constructor to call? Parent first, then bean? Is it documented somewhere? I know that there are ways like specifying index and name as attributes but I should also be aware about how to deal w…
has answer: http://stackoverflow.com/a/27241563
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: How is constructor chosen in spring for beans defined in xml with parent?
tagged with: spring-3
tagged with: java
linked to: http://stackoverflow.com/q/7327255
type: Question
accepted answer: http://stackoverflow.com/a/27241563

http://stackoverflow.com/q/27288762
tagged with: java
type: Question
answer count: 1
tagged with: android-youtube-api
score: 0
tagged with: android
has title: YouTube Player doesn't play when a device is rotated
has body: I'm using YouTube API in my Android application. Everything initializes pretty well and the video plays on clicked, but when I select to play video in fullscreen mode, it just forces the phone to rotate and plays video for 1s, then it stops. When I try to play the video once more, it repeats the same action: plays for 1sec and then stops. I would be grateful for any of your help fixing this bug. I have an idea, that it's something wrong with listeners, but I didn't come up with a solution. I'm posting the code below (mainly, the snippets, which are connected with the YouTube player...) If you need any details, you are welcome to ask... public class ItemScreen extends ActionBarActivity implements BaseSliderView.OnSliderClickListener, YouTubePlayer.OnInitializedListener { public String VIDEO_ID; private SliderLayout mDemoSlider; private ClickableItem ci; private RatingBar rb; private SharedPreferences sp; private String location; private int position; private TextView rating_text; private double votes, voters; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.item_screen); //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mDemoSlider = (SliderLayout) findViewById(R.id.slider); TextView work_hours = (TextView) findViewById(R.id.work_hours); TextView address = (TextView) findViewById(R.id.address); TextView description = (TextView) findViewById(R.id.description); rating_text = (TextView) findViewById(R.id.rating_text); ImageButton pin = (ImageButton) findViewById(R.id.pin); final ImageButton number = (ImageButton) findViewById(R.id.number); final ImageButton email = (ImageButton) findViewById(R.id.email); rb = (RatingBar) findViewById(R.id.ratingBar); View divider = (View) findViewById(R.id.divider4); View otherDivider = (View) findViewById(R.id.divider3); FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frame_layout); //YouTubePlayerSupportFragment youTubePlayerFragment…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27970197
tagged with: android-layout

http://stackoverflow.com/q/27303252
has answer: http://stackoverflow.com/a/27303510
has body: I am very new to Java and I am currently working on a "Hidden Word" program that is able to take input from the user, 2 Strings, and see if the 2nd String is contained within the 1st. The tricky part that I have been dealing with is that the word in the 1st String does not have to be in the same order as that of the 2nd String. For example, the word "tot" can be found in the word "tomato" even though it is not present in that exact order. I figured out that I could sort the characters of the String to test if they could match, but whenever I try using test data, It always prints that the word could not be found from the 1st String. If anyone could give me a hint as to what I'm missing I'd really appreciate it. I don't really get why it always prints out as no. And as another note, I read somewhere about the BitSet util being a better option than a character array if you want to use Strings that are different lengths, but I'm not sure if that's true or if it's even sorting the characters. public static void main(String[] args) { input = new Scanner(System.in); System.out.println("Please enter a word"); //prompts user for a word String word = input.next(); System.out.println("Please enter a word you would like to search"); //prompts user again to enter a word that they would like to search for within the first word String search = input.next(); if (usedChar(word).equals(usedChar(search))) //method call using the two input variables { //the if statement checks to see if the two Strings are equal System.out.print("The word " + search + " is found in the word " + word); } else { System.out.print("The word was not found in " + word); //returns second print statement if the Strings do not match } } public static BitSet usedChar(String s){//method to iterate through Strings BitSet bs = new BitSet(); for (int i = 0; i &lt; s.length(); i++) { bs.set(s.charAt(i)); } return bs; }
tagged with: character
score: 0
has title: How do I properly sort the characters of a String to compare to another String in Java?
tagged with: java
has answer: http://stackoverflow.com/a/27303998
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/27310090
tagged with: string
tagged with: sorting
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/27217753
has answer: http://stackoverflow.com/a/27217782
type: Question
possible better answer: http://stackoverflow.com/a/27217782
answer count: 3
accepted answer: http://stackoverflow.com/a/27217802
downvote count: 0
favorite count: 0
has body: I need help making a delimiter for multiple characters I need a String delimiter for these characters ( ) " ; : , ? ! . I've tried: private String delimiter = "()\":;,?!."; private String delimiter = "[()\":;,?!.]"; private String delimiter = "\\(\\)\"\\:\\;\\,\\?\\!\\."; Seems I can only make them work one at a time.. Any insight is greatly appreciated. If it matters this is how its going into array: foo = line.split(delim);
has answer: http://stackoverflow.com/a/27217824
type: AnsweredQuestion
score: 1
has title: cant make this delimiter work, java split
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27217802
has comment: http://stackoverflow.com/comment/42915243

http://stackoverflow.com/q/27292899
accepted answer: http://stackoverflow.com/a/27404725
tagged with: windows
answer count: 1
has title: JavaFX - Drawing component when the screen is turned off
favorite count: 0
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/43251544
has body: My application works on tablet (with Windows 7) which sometimes turns off its display in order to save battery. After touching the screen, it turns on again. Application should remain operational even after turning off the screen, what is, in general, accomplished (i.e. sounds are played). The only problem is the fact that when screen is turned off and application tries to add new component to the scene (technically - add children to the displayed GridPane), the newly added component is not visible when I touch the screen (and it turns on). It is just like there was a cache which stores and restores displayed content when screen is turning on/off. After turning screen on - when I click windows button (keyboard) or or change focus to another application - newly added component appears. I have tried setting -Dprism.dirtyopts=false but it did not change anything. My Java is 7u67. Is it known bug? Is there any programming workaround? I have tought about using WinAPI to force redraw/refresh of the application window but it seems too big for this case.
upvote count: 1
has answer: http://stackoverflow.com/a/27404725
type: AnsweredQuestion
score: 1
tagged with: winapi
tagged with: java
tagged with: javafx
type: Question
downvote count: 0

http://stackoverflow.com/q/27155241
has title: Divide a JPA entity into two?
upvote count: 1
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/42806018
has comment: http://stackoverflow.com/comment/42816103
tagged with: relationship
has comment: http://stackoverflow.com/comment/42805689
downvote count: 0
type: UnansweredQuestion
score: 1
has body: Assume I have the following entity: @Entity @Table (name = "customers) public class CustomerImpl implements Customer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", nullable = false, unique = true) private Long id; @Column(name = "name", nullable = false) private String name; @Column(name = "surname", nullable = false) private String surname; @Column(name = "country", nullable = false) private String country; @Column(name = "city", nullable = false) private String city; @Column(name = "street", nullable = false) private String street; @Column(name = "zipCode", nullable = false) private String zipCode; // constructor + getters } I want to create a new class called Address which will hold country, street, city and zip code variables. The outlined variables will be then replaced with Address object to make code more readable and cleaner. In my case, should the Address class be embedded or should I assign it as new entity and give @OneToOne relationship between Address and Customer? Thank you
type: Question
has comment: http://stackoverflow.com/comment/42805635
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42804883
tagged with: orm
favorite count: 0
has comment: http://stackoverflow.com/comment/42805944
has comment: http://stackoverflow.com/comment/42814921
has answer: http://stackoverflow.com/a/27155448
has comment: http://stackoverflow.com/comment/42814856
has comment: http://stackoverflow.com/comment/42808552
has comment: http://stackoverflow.com/comment/42806322

http://stackoverflow.com/a/27161043
downvote count: 0
has body: Convert your key to a char first by using Character.forDigit() public static boolean bs(int intkey,String N){ char key = Character.forDigit(intkey,10); int low=0,high=N.length()-1,mid; //... //the rest of your function should stay the same //... }
type: Answer
answers question: http://stackoverflow.com/q/27160856
upvote count: 2
score: 2

http://stackoverflow.com/q/27286030
answer count: 1
tagged with: string
favorite count: 0
tagged with: regex
has answer: http://stackoverflow.com/a/27286051
upvote count: 1
has body: I have input as below: Input: 6jVYY3Xnqt&lt;&gt;:"/\|?*GjznpnRQSb testInput = testInput.replaceAll("[&lt;&gt;:/\\\"|?*]", "-"); output: 6jVYY3Xnqt----\---GjznpnRQSb But if I do: testInput = testInput.replaceAll("[&lt;&gt;:/\"|?*]", "-"); testInput = testInput.replace("\\", "-"); output: 6jVYY3Xnqt--------GjznpnRQSb Is this a bug in java 7? Why is replaceAll not taking the \ character?
type: AnsweredQuestion
score: 1
tagged with: java
has title: Peculiar issue with replaceAll method in java
type: Question
accepted answer: http://stackoverflow.com/a/27286051
downvote count: 0

http://stackoverflow.com/q/27168535
upvote count: 1
has comment: http://stackoverflow.com/comment/42828929
has comment: http://stackoverflow.com/comment/42832317
has answer: http://stackoverflow.com/a/27169525
accepted answer: http://stackoverflow.com/a/27169525
favorite count: 0
tagged with: image-compression
tagged with: run-length-encoding
tagged with: javax.imageio
has title: Java Bitmap RLE8 format
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27169498
has body: Does Java ImageIO (or any other image handlers) support BI_RLE8 image format? The only thing I have managed to find is BMPImageWriteParam but I have no idea whatsoever how to use that. Any help would be wonderful.
tagged with: image
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27169498

http://stackoverflow.com/q/27277085
tagged with: css
has title: Is there an option of GWT CssResource source inheritance?
type: UnansweredQuestion
tagged with: gxt
upvote count: 1
type: Question
tagged with: gwt
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27279575
has body: Here is my question: for example I have 2 java-classes with appearances for diffrenet components. But they use same basic CSS-files for CssResource style interfaces. Here how this looks: public class FirstAppearance { public interface FirstResources extends ClientBundle { @Source({"Basic.css", "AnotherBasic.css", "First.css"}) FirstStyle style(); } public interface FirstStyle extends CssResource { ... } And then public class SecondAppearance { public interface SecondResources extends ClientBundle { @Source({"Basic.css", "AnotherBasic.css", "Second.css"}) SecondStyle style(); } public interface SecondStyle extends CssResource { ... } Is there any way to get rid of everytime-definition of "Basic.css", "AnotherBasic.css" in @Source ?
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27268852
downvote count: 0
answers question: http://stackoverflow.com/q/27247110
upvote count: 2
type: Answer
has body: Not the freshest answer ever, but I believe it still holds: Annotations on interface methods are not inherited when implementing said interface. Annotation is not inherited from interface method Why java classes do not inherit annotations from implemented interfaces?
score: 2

http://stackoverflow.com/comment/42885798
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27194429
has text: I've edited. Hope it would help.

http://stackoverflow.com/q/27269839
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43019265
tagged with: java
linked to: http://stackoverflow.com/q/1862283
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43011015
has answer: http://stackoverflow.com/a/27278554
has comment: http://stackoverflow.com/comment/43011493
downvote count: 0
answer count: 1
score: 1
has title: can't generate java from command line: org.jooq.exception.DetachedException: Cannot execute query. No Connection configured
favorite count: 0
accepted answer: http://stackoverflow.com/a/27278554
has body: I tried to generate JOOQ Java code from my database. When i execute java -cp "bla.xml;jooq-3.5.0.jar;jooq-meta-3.5.0.jar;jooq-codegen-3.5.0.jar;jtds.jar" org.jooq.util.GenerationTool bla.xml i get: org.jooq.exception.DetachedException: Cannot execute query. No Connection configured at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:303) I have no clue why it does not generate java code. The Startup says: Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: Initialising properties : bla.xml Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger warn Warnung: DEPRECATED : The configuration property /configuration/generator/database/dateAsTimestamp is deprecated as it is superseded by custom bindings and converters. It will thus be removed in the future. Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: License parameters Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: ---------------------------------------------------------- Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: Thank you for using jOOQ and jOOQ's code generator Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: Database parameters Dez 03, 2014 11:43:33 AM org.jooq.tools.JooqLogger info Information: ---------------------------------------------------------- Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: dialect : SQLSERVER Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: URL : Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: target dir : C:/Users/x/Downloads/jOOQ-3.5.0/jOOQ-lib/src Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: target package : de.xy.model.database Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: includes : [.*] Dez 03, 2014 11:43:34 AM org.jooq.tools.JooqLogger info Information: excludes : [] Dez 03, 2014 11:43:34 AM org.jo…
tagged with: jooq
tagged with: code-generation
has comment: http://stackoverflow.com/comment/43022143

http://stackoverflow.com/comment/43048854
type: Comment
type: QuestionComment
has text: @JaredRummler I have done it lot of times haha thank you
comment on: http://stackoverflow.com/q/27290991
score: 0

http://stackoverflow.com/q/27181174
has title: Generate multiple constructors from fields in Eclipse
has answer: http://stackoverflow.com/a/27181205
type: Question
has comment: http://stackoverflow.com/comment/42851119
tagged with: java
tagged with: eclipse
has body: I have a java class in Eclipse that looks like this: public class Assignment { public LeftSide leftSide; public ArithmeticExpression arithmeticExpression; public Location location; } I want eclipse to generate a separate constructor for each variable like this: public class Assignment { public LeftSide leftSide; public ArithmeticExpression arithmeticExpression; public Location location; public Assignment(LeftSide leftSide) { this.leftSide = leftSide; } public Assignment(ArithmeticExpression arithmeticExpression) { this.arithmeticExpression = arithmeticExpression; } public Assignment(Location location) { this.location = location; } } I know Eclipse has the wonderful feature "Generate constructor using fields" but like the name says, it only seems to be able to generate a single constructor, not all three at once. I know I'm very lazy and feature-greedy but is it possible to generate all three at once?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42851298
type: UnansweredQuestion

http://stackoverflow.com/a/27295838
type: Answer
has body: You are adding the playerContainer again and again. I think you should actually use the newly created JPanel. This one should be populated and added to the main container. Adding a single panel multiple times will not render properly as this screws up the layout. I think you need to keep a reference to the new JPanel and fill this one with your layout and the buttons. I am thinking something like this: public void playerFrame() { GridBagConstraints gbc = new GridBagConstraints(); JPanel newPanel = new JPanel(new GridBagLayout()); playerFrameArr.add(newPanel); gbc.gridx = 0; gbc.gridy = 0; newPanel.add(new JButton("LABEL"), gbc); gbc.gridx = 1; gbc.gridy = 0; newPanel.add(new JButton("BUTTON"), gbc); gbc.gridx = 0; gbc.gridy = frameCounter + 1; container.add(newPanel, gbc); System.out.println(frameCounter); frameCounter++; }
answers question: http://stackoverflow.com/q/27295333
has comment: http://stackoverflow.com/comment/43057131
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43057579
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27295333

network-programming
tags question: http://stackoverflow.com/q/27287074
tags question: http://stackoverflow.com/q/27200158
tags question: http://stackoverflow.com/q/27297808
tags question: http://stackoverflow.com/q/27276067
tags question: http://stackoverflow.com/q/27268929
tags question: http://stackoverflow.com/q/27273105
tags question: http://stackoverflow.com/q/27216181
type: Tag
tags question: http://stackoverflow.com/q/27254329
tag name: network-programming
tags question: http://stackoverflow.com/q/27302504
tags question: http://stackoverflow.com/q/27309950
tags question: http://stackoverflow.com/q/27294674
tags question: http://stackoverflow.com/q/27282997
tags question: http://stackoverflow.com/q/27162348
tags question: http://stackoverflow.com/q/27166016
tags question: http://stackoverflow.com/q/27196991

http://stackoverflow.com/comment/42909552
type: QuestionComment
comment on: http://stackoverflow.com/q/27204166
has text: Couldn't the containing class (I assume that this would be one that represents another XML element) take care of equals and hashCode simply by bypassing the JAXBElement? I do know that xjc doesn't include these methods, but a plugin could, and so could a hand-written class where an element needs the JAXBElement wrapper.
score: 0
type: Comment

http://stackoverflow.com/q/27243355
upvote count: 0
has comment: http://stackoverflow.com/comment/42962467
tagged with: string
linked to: http://stackoverflow.com/q/5902090
favorite count: 0
has comment: http://stackoverflow.com/comment/42962468
duplicate of: http://stackoverflow.com/q/5902090
score: -3
has title: extracting of string parameter value from java output
possible better answer: http://stackoverflow.com/a/27243448
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27243465
has answer: http://stackoverflow.com/a/27243448
tagged with: java
downvote count: 3
tagged with: http
type: Question
tagged with: jsp
accepted answer: http://stackoverflow.com/a/27243465
has body: Hi I am getting the following output from java code: access_token=[binary]&amp;expires=5181699 How do I retrieve only the value of access_token? my code is below: String line; StringBuffer buffer = new StringBuffer(); BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream())); while ((line = reader.readLine()) != null) { buffer.append(line); } reader.close(); conn.disconnect(); String response1= buffer.toString(); Thank YOu.
tagged with: servlets
answer count: 2

http://stackoverflow.com/comment/42926498
has text: Thank both for quick reply. I tried the command again and it still shows /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home. I need 1.7 jdk.
comment on: http://stackoverflow.com/q/27224003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42975008
type: Comment
has text: Then try and see if you drop Regex and iterate of the characters and check for things like `Character.isDigit(char ch)` Maybe there's a pure Regex solution but I don't know it and it starts to remind me of the epic "Parse HTML with Regex" Thread.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27249754

http://stackoverflow.com/comment/42836326
type: Comment
comment on: http://stackoverflow.com/a/27172902
has text: @kocko the fact that `Map` doesn't extend `Collection` interface doesn't mean it's not a Java Collection. See here: https://docs.oracle.com/javase/tutorial/collections/interfaces/index.html
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43084834
comment on: http://stackoverflow.com/q/27312132
score: 0
type: QuestionComment
has text: Which operating system? What permissions exactly are you referring to?
type: Comment

http://stackoverflow.com/q/27188834
type: AnsweredQuestion
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/27200916
type: Question
tagged with: spring-mvc
tagged with: java
linked to: http://stackoverflow.com/q/25109945
answer count: 2
upvote count: 1
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/27200916
favorite count: 0
tagged with: angularjs
has title: how to send empty value for MultipartFile
has body: I'm using angularJs and spring 4.0, My Controller code: @RequestMapping(value = "/endpoint/add", method = RequestMethod.POST) public @ResponseBody GenericFormResponse execute( WebRequest wreq, @RequestParam("epName") String epName, @RequestParam("ipAddr") String ipAddr, @RequestParam("useDefault") String useDefault, @RequestParam("certFile") MultipartFile certFile) throws Exception { ..................... } my js(angualrJs) code: var formData = new FormData(); formData.append("epName", $scope.epName); formData.append("ipAddr", $scope.ipAddr); formData.append("useDefault",$scope.defaultCert); if(!$scope.defaultCert){ formData.append("certFile", upFile); } $http({ method: "POST", url: "./service/endpoint/add", data: formData, transformRequest: angular.identity, headers: {'Content-Type': undefined } }).success(svcSuccessHandler) .error(svcErrorHandler); My problem is $scope.defaultCert=false the POST request is working fine, $scope.defaultCert = true i'm getting Bad request(400). i tried below thing also, if(!$scope.defaultCert){ formData.append("certFile", upFile); }else{ formData.append("certFile", null); } How do i sent empty MultipartFile. Thanks.
has answer: http://stackoverflow.com/a/27221898
accepted answer: http://stackoverflow.com/a/27221898

http://stackoverflow.com/q/27229104
has title: "Container" classes, good or bad practice, why?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27229188
downvote count: 0
has answer: http://stackoverflow.com/a/27229274
score: 1
has answer: http://stackoverflow.com/a/27229188
has answer: http://stackoverflow.com/a/27229550
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27229304
answer count: 6
has answer: http://stackoverflow.com/a/27229308
upvote count: 1
has body: I'm curious as to which is the better practice and the reasoning behind it, for this example I'm going to be using a social application which contains a 'friends' and a 'ignore' list with some custom logic based on them, (For sending messages directly, etc) Which would be the better practice, and why? Scenario 1: class user { List&lt;&gt; friends; List&lt;&gt; ignores; ... logical methods here } Scenario 2: class User { Social social; ... } class Social { List&lt;&gt; friends; List&lt;&gt; ignores; ... logical methods here } I've seen both scenarios used throughout numerous applications and I'm curious as to which is the "Correct" way to lay it out in java, these will have methods such as #addFriend(User user) check ignore check valid user check other info add to list end #getFriend(int id) find friend by id check online status return friend It seems like while have a 'Social' class may be a cleaner approach, does it really follow good practices? Seems like it'd use more memory/user just for cleaner code.
favorite count: 0
has answer: http://stackoverflow.com/a/27229663
accepted answer: http://stackoverflow.com/a/27229663

http://stackoverflow.com/a/27193369
has body: In general, super will invoke its parent constructor with matching arguments. In this case, because AbstractList has an implicit no-arg constructor, we use super() with no arguments to invoke the implicit no-arg constructor. As to why - there's really no reason to do it in this case, if there's no requirement to set fields in the parent class. This may have been a case of an older style of programming. It does no harm, and it's self-documenting; it's explicit in that it calls its parent's constructor. Although, I will note that the Javadoc for that constructor calls out its invocation usefulness: /** * Sole constructor. (For invocation by subclass constructors, typically * implicit.) */ You're more likely to see implicit invocations of that constructor than you are explicit.
type: Answer
answers question: http://stackoverflow.com/q/27193239
accepted answer of: http://stackoverflow.com/q/27193239
has comment: http://stackoverflow.com/comment/42872345
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42872303
score: 4

http://stackoverflow.com/comment/43064724
type: QuestionComment
has text: I just realized what this must be. I don't think the iPad can few these forms correctly becuase of the merged fields. Those fields are the only things missing from the pdf if viewed in a browser! So not a pdfjs or pdfbox problem!
comment on: http://stackoverflow.com/q/27278316
score: 0
type: Comment

swing
tags question: http://stackoverflow.com/q/27175275
tags question: http://stackoverflow.com/q/27176557
tags question: http://stackoverflow.com/q/27208702
tags question: http://stackoverflow.com/q/27209669
tags question: http://stackoverflow.com/q/27294063
tags question: http://stackoverflow.com/q/27193589
tags question: http://stackoverflow.com/q/27220422
tags question: http://stackoverflow.com/q/27169716
tags question: http://stackoverflow.com/q/27209814
tags question: http://stackoverflow.com/q/27158148
tags question: http://stackoverflow.com/q/27243279
tags question: http://stackoverflow.com/q/27156138
tags question: http://stackoverflow.com/q/27170797
tags question: http://stackoverflow.com/q/27265709
tags question: http://stackoverflow.com/q/27256400
tags question: http://stackoverflow.com/q/27169392
tags question: http://stackoverflow.com/q/27311995
tags question: http://stackoverflow.com/q/27211388
tags question: http://stackoverflow.com/q/27281957
tags question: http://stackoverflow.com/q/27188878
tags question: http://stackoverflow.com/q/27306328
tags question: http://stackoverflow.com/q/27307580
tags question: http://stackoverflow.com/q/27309502
tags question: http://stackoverflow.com/q/27287469
tags question: http://stackoverflow.com/q/27160943
tags question: http://stackoverflow.com/q/27249346
tags question: http://stackoverflow.com/q/27208267
tags question: http://stackoverflow.com/q/27293036
tags question: http://stackoverflow.com/q/27163399
tags question: http://stackoverflow.com/q/27219639
tags question: http://stackoverflow.com/q/27217697
tags question: http://stackoverflow.com/q/27281099
tags question: http://stackoverflow.com/q/27245900
tags question: http://stackoverflow.com/q/27220071
tags question: http://stackoverflow.com/q/27165245
tags question: http://stackoverflow.com/q/27219509
tags question: http://stackoverflow.com/q/27196356
tags question: http://stackoverflow.com/q/27209112
tags question: http://stackoverflow.com/q/27153470
tags question: http://stackoverflow.com/q/27239041
tags question: http://stackoverflow.com/q/27202768
tags question: http://stackoverflow.com/q/27275323
tags question: http://stackoverflow.com/q/27160887
tags question: http://stackoverflow.com/q/27168823
tags question: http://stackoverflow.com/q/27306795
tags question: http://stackoverflow.com/q/27215585
tags question: http://stackoverflow.com/q/27227653
tags question: http://stackoverflow.com/q/27170282
tags question: http://stackoverflow.com/q/27213331
tags question: http://stackoverflow.com/q/27241409
tags question: http://stackoverflow.com/q/27219674
tags question: http://stackoverflow.com/q/27269796
tags question: http://stackoverflow.com/q/27277800
tags question: http://stackoverflow.com/q/27283711
tags question: http://stackoverflow.com/q/27188925
tags question: http://stackoverflow.com/q/27283559
tags question: http://stackoverflow.com/q/27281119
tags question: http://stackoverflow.com/q/27240340
tags question: http://stackoverflow.com/q/27307596
tags question: http://stackoverflow.com/q/27165006
tags question: http://stackoverflow.com/q/27301001
tags question: http://stackoverflow.com/q/27274418
tags question: http://stackoverflow.com/q/27236204
tags question: http://stackoverflow.com/q/27237857
tags question: http://stackoverflow.com/q/27288097
tags question: http://stackoverflow.com/q/27268584
tags question: http://stackoverflow.com/q/27200373
tags question: http://stackoverflow.com/q/27268166
tags question: http://stackoverflow.com/q/27194858
tags question: http://stackoverflow.com/q/27255244
tags question: http://stackoverflow.com/q/27231303
tags question: http://stackoverflow.com/q/27213305
tags question: http://stackoverflow.com/q/27175921
tags question: http://stackoverflow.com/q/27154532
tags question: http://stackoverflow.com/q/27297752
tags question: http://stackoverflow.com/q/27162680
tags question: http://stackoverflow.com/q/27175687
tags question: http://stackoverflow.com/q/27164311
tags question: http://stackoverflow.com/q/27177190
tags question: http://stackoverflow.com/q/27245283

http://stackoverflow.com/comment/42919375
comment on: http://stackoverflow.com/q/27220128
score: 0
type: Comment
type: QuestionComment
has text: Should be double quotes around the column alias.

http://stackoverflow.com/comment/42938830
score: 1
has text: @LuiggiMendoza yes, I know that, the question is why Java thinks these methods have different erasures when neither uses the generic parameter, and why it's happy if I remove the `comps` arguments from both. Possibly something to do with [bridge methods](http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html), but I can't see it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27230928

http://stackoverflow.com/a/27257249
score: -1
has body: You are writing HTML code inside your scriptlets - you have to close the scriptlet after you finish writing Java code. This should do it - LoginSuccess.jsp: <% System.out.println("LoginSuccess.jsp: Entered LoginSuccess.jsp"); String username = request.getParameter("Username"); System.out.println("LoginSuccess.jsp: User Name from the request is: " + username); session.setAttribute("Username", username); String url2 = "acctinfo.jsp"; System.out.println("LoginSuccess.jsp: URL is: " + url); //session.setAttribute("CustomerName", customerName); %> Login successful. <a href=<%= url2 %>>Proceed to Account Information Page
answers question: http://stackoverflow.com/q/27256848
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/135969046
has text: Yes, in my case I have added a try-catch to make a fallback to `BigInteger`, thanks for the comment!
comment on: http://stackoverflow.com/a/27169507
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42884041
has text: @Gowtham A Map is not an array. So you'd use `yaml.dump(array)` which would give you an array. What are you asking exactly?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27199987
type: Comment

http://stackoverflow.com/comment/43081026
type: Comment
type: QuestionComment
has text: You can `split(" ")` your `Original string` on newline character and then make the program go through each of the individual words in the array as it does for a single word.
score: 0
comment on: http://stackoverflow.com/q/27309817

http://stackoverflow.com/q/27275611
has body: When writing debug statements out in unit tests, is it ok to give the test class a logger and use the same logging framework your production code uses, or should System.out.print be used?
type: Question
has comment: http://stackoverflow.com/comment/43020890
upvote count: 1
accepted answer: http://stackoverflow.com/a/27276184
answer count: 1
has comment: http://stackoverflow.com/comment/43032553
has answer: http://stackoverflow.com/a/27276184
has comment: http://stackoverflow.com/comment/43020567
favorite count: 0
downvote count: 0
has title: Logger or System.out.print for debug statements in tests
tagged with: logging
tagged with: unit-testing
type: AnsweredQuestion
score: 1
tagged with: java

android-service
tags question: http://stackoverflow.com/q/27251797
type: Tag
tag name: android-service

http://stackoverflow.com/q/27303759
has comment: http://stackoverflow.com/comment/43071896
favorite count: 0
has answer: http://stackoverflow.com/a/27304147
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/43070765
has title: How to store data obtained from JTextFields, JComboBox's & JSpinners?
upvote count: 0
has body: Background: I am creating a GUI for a Cruise company. I have developed a GUI where you may "add a cruise" to the system. I am currently struggling with how to obtain all the data entered and store the data. I have the following swing components: JTextField - To enter Cruise Name JcomboBox's (2) - To select start and end ports JSpinners (2) - To enter cruise start &amp; end date. The Problem: Upon clicking the button "Add Cruise", I ideally want the new Cruise information to be stored in the cruise ArrayList: public ArrayList &lt;Cruise&gt; cruises; However I am unsure of how to obtain the data from the swing components and adding them to the ArrayList when the user clicks "Add Cruise" as not all the swing components are String format. How do I go about this? How I Created the Components: JTextField Cruisename = new JTextField(); contentPane2.add(Cruisename); Frame2.add(contentPane2, BorderLayout.CENTER); Frame2.setVisible(true); JComboBox for Start Port (End Port JComboBox made similarly with same String values) startL = new JComboBox(); final JComboBox typeList2; final String[] typeStrings2 = { "", "Tobermory","Oban", "Isle of Mull", "Isle of Harris", "Lewis and Harris", "Stornoway", "Skye", "Portree"}; startL = new JComboBox(typeStrings2); JSpinners for Start &amp; End Date SpinnerModel model1 = new SpinnerDateModel(); JSpinner spinner1 = new JSpinner(model1);
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43070676
has answer: http://stackoverflow.com/a/27304512
score: -1
has comment: http://stackoverflow.com/comment/43070593
answer count: 2
tagged with: user-interface
downvote count: 1

http://stackoverflow.com/a/27312022
upvote count: 2
has comment: http://stackoverflow.com/comment/43222738
answers question: http://stackoverflow.com/q/27176437
has comment: http://stackoverflow.com/comment/43222447
score: 2
type: AcceptedAnswer
downvote count: 0
has body: I suggest you disable proguard unless you're doing a release build. When you disable/enable proguard you will need to Project &gt; Clean (and re-build if you don't have Project &gt; Build Automatically checked; Project -&gt; Build or CTRL-B).
type: Answer
has comment: http://stackoverflow.com/comment/43221773
has comment: http://stackoverflow.com/comment/43221723
accepted answer of: http://stackoverflow.com/q/27176437

http://stackoverflow.com/comment/42805091
has text: @TsvetanDimitrov Let me define recursion for you; if you understand recursion stop reading this comment, otherwise go back to the start.
score: 2
comment on: http://stackoverflow.com/a/27155321
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27299795
has body: A few things: For your String.format, try String.Format("${0}", balance); As mentioned, you need to just call your toString() method to have the "has a current balance.." part You have the code to deposit and withdraw, but you don't call it. So you need to call it, like micky.deposit(500);. Then you can repeat your toString() call to print it out. If your having a problem with the actual displaying, try Console.WriteLine() instead of System.out.println()
type: Answer
has comment: http://stackoverflow.com/comment/43063542
upvote count: 0
has comment: http://stackoverflow.com/comment/43063616
has comment: http://stackoverflow.com/comment/43063568
score: -2
downvote count: 2
answers question: http://stackoverflow.com/q/27299372

http://stackoverflow.com/q/27303931
has answer: http://stackoverflow.com/a/27304062
has title: Listview inside tabpager fragment not showing
tagged with: listview
type: Question
score: 0
answer count: 2
tagged with: layout
has body: Im trying to add a listview inside a fragment witch is also inside a tabhost. the app is not crashing or anything, but the list view is not showing anything. Here is my code: Class for the tabPager public class TabPagerAdapter extends FragmentPagerAdapter { public TabPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { switch (index) { case 0: return new FragmentHome(); case 1: return new FragmentBadges(); case 2: return new FragmentBenefits(); } return null; } Following is the fragment where I want the listview: public class FragmentBadges extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_badges_list, null); BadgesListAdapter adapter = new BadgesListAdapter(this.getActivity(), getCurrentBadges()); ListView badgeslist = (ListView) rootView.findViewById(R.id.badges_list); badgeslist.setAdapter(adapter); badgeslist.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { //TODO do some } }); return rootView; } And following is the adapter: public class BadgesListAdapter extends ArrayAdapter&lt;String&gt; { private final Activity context; private List&lt;Badge&gt; badges; public BadgesListAdapter(Activity context, List&lt;Badge&gt; badges) { super(context, R.layout.fragment_badges_listrow); this.context = context; this.badges = badges; } @Override public View getView(int position, View view, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View rowView= inflater.inflate(R.layout.fragment_badges_listrow, null, true); TextView txtTitle = (TextView) rowView.findViewById(R.id.text); ImageView imageView = (ImageView) rowView.findViewById(R.id.img); txtTitle.setText(badges.get(position).getName()); imageView.setImageResource(badges.get(position).getDrawableValue()); return rowV…
has answer: http://stackoverflow.com/a/27319929
accepted answer: http://stackoverflow.com/a/27319929
tagged with: android
possible better answer: http://stackoverflow.com/a/27304062
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java

http://stackoverflow.com/q/27265012
has body: While using the stringbuilder class i need to append the "\n" after every "{" or "}" or ";".And then need to write the same in file. Output of stringbuilder object i.e System.out.println(sb.toString()); is nav { ul { list-style: none; margin: 0; padding: 0; } li { display: inline-block; } a { display: block; padding: 6px 12px; text-decoration: none; } Please help. Thanks
has answer: http://stackoverflow.com/a/27265032
type: Question
upvote count: 4
has title: Add a new line character after a "{" or ";" or "}" in java while using string builder
score: 4
has answer: http://stackoverflow.com/a/27265145
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/27266073
favorite count: 0
has answer: http://stackoverflow.com/a/27265127
has answer: http://stackoverflow.com/a/27265035
answer count: 5
type: UnansweredQuestion
tagged with: regex
tagged with: stringbuilder
tagged with: java

http://stackoverflow.com/comment/42963101
has text: Dear Remove finish();
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27243107

http://stackoverflow.com/q/27195459
tagged with: maven
tagged with: dependency-management
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: gradle
type: Question
has title: How to transition to gradle/maven one project at a time by depending on projects that don't declare their dependencies
has body: My situation is this: I am sick of using ant in my workplace for obvious reasons (unmaintainable build scripts, annoying to introduce new dependencies) and want to use gradle (or maven). I have a couple projects that I manage, and I am free to do what I want with them. My projects depend on a small number of other company projects, and those project owners are not going to switch to gradle in the near future and this is not a negotiable point. I rarely need to change the versions of the projects that I depend on, so I figure that I can configure a company repository with Nexus or something similar and just upload those jars there. The problem that I am not sure how to solve though is this: these ant projects don't declare their dependencies, they just depend on things being in the "libs/" folder. So by sucking in just the final jar, I wouldn't have all the required dependencies. I could bundle all the dependencies into the jar, but then the dependency information is lost to gradle and I feel like this could lead to really hard to debug dependency resolution problems. One option that I see is to make a complete list of things that this project depends on, and stick all of those dependencies into my projects. The other option that I can see is to basically have some sort of fake gradle project that does absolutely nothing but claims that it depends on the jar from the other project and all of its dependencies, so by importing this fake project, I can "pretend" that this other project is gradle managed. Are either of these sane things to do? Do you have any other suggestions?
accepted answer: http://stackoverflow.com/a/27196306
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27196306

http://stackoverflow.com/q/27289046
has body: I'm busy writing MUnit test cases for a subflow. I've mocked out a component to prevent emails being sent, but mainly to confirm that my flow is passing the correct attributes to that SMTP component. I can use a verifier to confirm that whether the call matched an expected configuration. But if it doesn't match, how does one verify exactly which attribute was missing? Is it best practise to individually verify on each Attribute rather than all of them together? Or what is the process? If I do that I can get a line number of which verification failed. Is there no way to give a "message" to print when MUnit tests/verifications fail? JUnit does this and it's extremely helpful when viewing test results and debugging.
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has title: MUnit mocks: Which Attribute failed verification?
has answer: http://stackoverflow.com/a/27429095
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: mule
tagged with: unit-testing
type: Question

http://stackoverflow.com/comment/42831550
has text: maybe I am making confusion...what I need to check is that the command was successfully executed...I cannot check exit value after launching baseX server because I would get "java.lang.IllegalThreadStateException: process has not exited"...I want the server to be running as far as the main program is being used
type: AnswerComment
comment on: http://stackoverflow.com/a/27170268
score: 0
type: Comment

http://stackoverflow.com/comment/43142212
has text: Does the field/method have any additional annotations on them? Can you edit the question and provide a sample model class?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27282681
score: 0

http://stackoverflow.com/q/27303883
has comment: http://stackoverflow.com/comment/43070653
type: Question
score: 12
possible better answer: http://stackoverflow.com/a/27304065
answer count: 2
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/43070768
has body: public class MultiMap_Test { public static void main(String[] args) { Multimap&lt;String, String&gt; myMultimap = ArrayListMultimap.create(); myMultimap.put("classlabel", "tid"); myMultimap.put("Y", "1"); myMultimap.put("Y", "2"); myMultimap.put("N", "4"); // Iterating over entire MutliMap for(String value : myMultimap.values()) { System.out.print(value); } } } The above code prints 1 2 tid 4. I am not understanding why it is not printing tid 1 2 4.
has title: Why is insertion order not preserved in MultiMap?
has answer: http://stackoverflow.com/a/27303976
accepted answer: http://stackoverflow.com/a/27303976
favorite count: 0
tagged with: multimap
has comment: http://stackoverflow.com/comment/43070707
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27304065
tagged with: java

http://stackoverflow.com/q/27258485
downvote count: 0
answer count: 1
has body: I am working on a system where the administrators made life a little difficult. I have a parent script called client.sh. This script calls a Java class, and the Java class has a java.util.Scanner instance that waits for the user to enter a string. It then waits for the user to type in "exit" before exiting. I want to create a shortcut in my BASH profile to automate this, as I am entering the exact same string every single time into this Java class. So the shortcut would call the client.sh script, print a pre-determined string into the Java prompt, and finally print exit into the Java prompt. How could I do this?
favorite count: 0
tagged with: shortcut
type: AnsweredQuestion
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27258589
upvote count: 1
type: Question
score: 1
tagged with: java
has title: BASH Script Enter Value into Java Scanner
tagged with: bash
accepted answer: http://stackoverflow.com/a/27258589

http://stackoverflow.com/a/27257148
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27256894
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42989729
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27256894
has comment: http://stackoverflow.com/comment/42990159
has body: Your SubClass is subtype of SuperClass, but Map&lt;String, Class&lt;SubClass&gt;&gt; isn't subtype of Map&lt;String, Class&lt;SuperClass&gt;&gt;. For more information you can see Generics, Inheritance, and Subtypes For Java SE 7 you can use: return Collections.&lt;String, Class&lt;? extends SomeClass.SuperClass&gt;&gt;singletonMap("hello", SomeClass.SubClass.class);

http://stackoverflow.com/comment/42829639
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27166131
has text: Your problem is unclear as you can't give us an accurate input example. Once you said it's an array of digits and sign, newt it's separated by spaces, and now each part is on a differnt line, separated by `\n`char.

http://stackoverflow.com/q/27203646
has title: Java validation class and exception
answer count: 1
score: 0
tagged with: exception
has body: I have a form that send an email to a servlet that will test the validity. This servlet invoke a class called EmailValidator and can catch 2 type of errors: longest string, and invalid email path. When the former error will be catched, will throw the exception below: throw new IllegalArgumentException( "The email is too long.", new Exception("email-too-long") ); When the latter error occurs will be throw: throw new IllegalArgumentException( "The email is invalid because the \"@\"character is missing.", new Exception("invalid-email") ); Than the servlet catch the exception and and do the following: try{ new EmailValidator().validate( "test" ); }catch( IllegalArgumentException e ){ log.error( e ); Writer out = response.getWriter(); out.write( e.getCause().getMessage() ); // short message to the client. out.close(); } The question is that, is a good way to send the message "invalid-email" to the client and send more accurate details to logger, like done above? The client browser can handle only this type of string "invalid-email" or "email-too-long" to allert the client properly with a good messages not known by the server. Thanks in advance and if exists tell me a way more accurate and/or smart to done this.
has answer: http://stackoverflow.com/a/27203718
accepted answer: http://stackoverflow.com/a/27203718
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question

http://stackoverflow.com/q/27177461
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43587720
has comment: http://stackoverflow.com/comment/42859484
has comment: http://stackoverflow.com/comment/42876064
tagged with: selenium-chromedriver
tagged with: selenium
upvote count: 1
has title: phantomjs can't load page if there is a flash plugin
type: Question
tagged with: phantomjs
has answer: http://stackoverflow.com/a/28634831
tagged with: java
linked to: http://stackoverflow.com/q/21743350
has answer: http://stackoverflow.com/a/27188106
has body: I have a problem running selenium tests with phantomjs from Java. I am aware that phantomjs doesn't support flash. I am running dual tests with chromedriver without flash enabled and phantom. on a page that chromedriver displays no flash plugin enabled, it just loads the rest of the page and reads it correctly. The phantom tests throw an exception of timeout here: WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[contains(text(),'"+s +"')]"))); any ideas? Full stacktrace: org.openqa.selenium.TimeoutException: Timed out after 10 seconds waiting for visibility of element located by By.xpath: //span[contains(text(),'Swiss Super League')] Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39' System info: host: 'countZero', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-40-generic', java.version: '1.8.0_25' Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, handlesAlerts=false, databaseEnabled=false, version=1.9.0, platform=LINUX, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, acceptSslCerts=false, driverVersion=1.0.3, locationContextEnabled=false, webStorageEnabled=false, browserName=phantomjs, takesScreenshot=true, driverName=ghostdriver, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 9422d0d0-7731-11e4-9730-f784ef9dac1a at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:79) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228) at com.hawaii.gatherer.parsers.betfred.parse(betfred.java:88) at com.hawaii.gatherer.parsers.Parser.call(Parser.java:93) at com.hawaii.gatherer.parsers.Parser.call(Parser.java:27) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) a…
answer count: 2
downvote count: 0
score: 1

http://stackoverflow.com/comment/43400123
comment on: http://stackoverflow.com/q/27225027
type: QuestionComment
type: Comment
score: 0
has text: Unfortunately publishing the project at work is impossible (firewalls, proxy policies). I need to do the POC from scratch at home and publish it from there.

http://stackoverflow.com/comment/42957236
type: Comment
has text: I don't understand the question. If this Actions3d API is anything like libgdx's scene2d, then `Actions3d.sequence(...)` is creating a new object.
comment on: http://stackoverflow.com/q/27233685
score: 0
type: QuestionComment

continuous-testing
type: Tag
tags question: http://stackoverflow.com/q/27172745
tag name: continuous-testing

git
tags question: http://stackoverflow.com/q/27224283
tags question: http://stackoverflow.com/q/27289045
tags question: http://stackoverflow.com/q/27209692
tag name: git
type: Tag

http://stackoverflow.com/comment/43032763
comment on: http://stackoverflow.com/a/27281929
has text: 1. Why to use threads if there is much simpler way to do that? 2. The code in the second thread must not update Swing unless you make it invoke on EDT (another Runnable) so the example above is wrong unless you add that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42802268
type: Comment
type: QuestionComment
has text: `NoSuchElementException` is generally due to either the elements you are locating being inside of an `iframe`, or due to them loading slowly. In this case, I suspect your table is contained in an `iframe`. If you could post the HTML you are attempting to work with, that would be helpful.
comment on: http://stackoverflow.com/q/27153959
score: 0

http://stackoverflow.com/q/27160123
tagged with: java
tagged with: maven-failsafe-plugin
linked to: http://stackoverflow.com/q/10483180
has comment: http://stackoverflow.com/comment/42814662
has answer: http://stackoverflow.com/a/27176244
type: Question
has title: Maven failsafe not running tests
upvote count: 1
answer count: 1
favorite count: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/27176244
tagged with: testng
type: AnsweredQuestion
downvote count: 0
has body: I have a simple TestNG test in MyIT.java. When I run mvn integration-test, my test does not run. However when I run mvn failsafe:integration-test, my test does run. What could the problem be? This is my pom.xml: 4.0.0 com.mycompany.app my-app jar 1.0-SNAPSHOT my-app http://maven.apache.org org.testng testng 6.8.8 test org.apache.maven.plugins maven-failsafe-plugin 2.18 integration-test verify
score: 1

http://stackoverflow.com/comment/42872077
type: AnswerComment
type: Comment
has text: definitely an idea worth spending time on!
comment on: http://stackoverflow.com/a/27192413
score: 0

http://stackoverflow.com/comment/125818542
comment on: http://stackoverflow.com/a/27234970
type: AnswerComment
score: 0
type: Comment
has text: This answer is incorrect and doesn't answer OP's question for future readers

http://stackoverflow.com/comment/42997818
has text: @ScottMitchell - The pipeline for the client is using a standard implementation of `MessageToMessageEncoder` in combination with the `ByteToMessageDecoder` and the `ChannelHandler` is pretty much empty, albeit printing a stack-trace. What I mean by `I'm sending all data through the channel` is that I store the channel of a client when it connects (and authorizes it's connection via a user/pass) for future reference on the server. The server references this channel based on the account the data came from, by getting the channel relative to the `ChannelHandlerContext` passed through the deco...
score: 0
comment on: http://stackoverflow.com/q/27254329
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42849655
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27180553
has text: I think that comparator is doing the work you want it to do. The problem is in the order you input the parameters to the constructor of Student.
score: 1

http://stackoverflow.com/a/27280844
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27280548
has body: There's a few ways you could do this, but I would choose a little while-loop int lowerBound = input, upperBound = input; Now arrayOfNumbers should be an ArrayList, so it can use the contains method. You can use an array too, but then you'll have to iterate through yourself, and it just adds unnecessary hassle. while (!arrayOfNumbers.contains(lowerBound) &amp;&amp; !arrayOfNumbers.contains(upperBound) { lowerBound--; upperBound++; } // I'm using two 'if's, because there can be two closest // numbers, if the input is directly between two values. if (arrayOfNumbers.contains(lowerBound)) { System.out.println(lowerBound); } if (arrayOfNumbers.contains(upperBound)) { System.out.println(upperBound); } So essentially, it searches upward and downward to find the closest number. It's even easier if you don't use negatives, but I figured I'd be better safe than sorry. And if you're using decimals...well...that's a different story too.

http://stackoverflow.com/comment/43038121
has text: Is `x` a method or constructor?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27285162

http://stackoverflow.com/comment/43015685
type: Comment
has text: Yeah i know that, i mean without scanning!
type: AnswerComment
comment on: http://stackoverflow.com/a/27273069
score: 4

http://stackoverflow.com/q/27157243
has body: I am trying to build a Google Maps application in a JSwing application using JXBrowser. I am using a API key provided by Google. import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserFactory; import javax.swing.*; import java.awt.*; public class GAPIJXBrowser { public static void main(String[] args) { final Browser browser = BrowserFactory.create(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(browser.getView().getComponent(), BorderLayout.CENTER); frame.setSize(700, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.executeJavaScript(" \n" + " \n" + " \n" + " Simple Map \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " "); } } Page loads but getting the following error while executing: stating : google has disabled uso of the Maps api for this application. I even tried a new key. What wrong am I doing it over here?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-maps-api-3
has title: stating: google has disabled uso of the Maps api for this application
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/33259624

http://stackoverflow.com/a/27285573
score: 1
answers question: http://stackoverflow.com/q/27285486
upvote count: 1
downvote count: 0
type: Answer
has body: Android restarts the main activity when the orientation changes so you'll need to disable or handle that. You can find out more here: How do I disable orientation change on Android?

http://stackoverflow.com/q/27285233
has title: Why does a JButton not show unless text is set after JButton is added to JPanel?
has body: I have a problem with my JButton objects behaving in an odd way: JFrame frame = new JFrame(); frame.setSize(new Dimension(200, 200)); frame.setVisible(true); //Constraints GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; ... // JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); JButton button = new JButton("Categories:"); panel.add(button, constraints); frame.add(panel); This results in the following GUI: Where is the button? When I replace the last few lines with the following: JPanel panel = new JPanel(); JButton button = new JButton(); panel.add(button, constraints); button.setText("Categories:"); frame.add(panel); I get the following GUI: The button now shows up. Why is this? I thought giving a string in the constructor of the button would result in the same as explicitly calling the setter.
has comment: http://stackoverflow.com/comment/43038459
has answer: http://stackoverflow.com/a/27285394
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/43038202
tagged with: swing
has answer: http://stackoverflow.com/a/27285790
accepted answer: http://stackoverflow.com/a/27285790
tagged with: jbutton
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/27285394
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/comment/43063701
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27297884
has text: It looks fine, please try changing all the annotations to exactly like I have it and using this path `http://localhost:8080/admin-ws/services/users/12344`. Also you should clean and build your project. Look in the Wildfly `standalone/deployment` and delete the war and and unpackaged war, and deploy the newly clean and built war. I have no problems with the code I have posted
type: Comment

http://stackoverflow.com/q/27206994
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27218483
type: Question
linked to: http://stackoverflow.com/q/2921945
tagged with: mongodb
downvote count: 0
answer count: 1
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/42896027
has body: I have a question about closing resources (AutoCloseable or not) that are static members of a Java class. In my particular situation I have a class that manages connections to a MongoDB instance using a static MongoClient instance variable. How would I ensure that this client is closed as the documentation recommends when my application terminates? I am using this class as part of the back end to a Java webapp which is run in a container (Tomcat 7). I could not override the Object's finalize() method to close the client because that is called on an instance of the class and would have no effect on static members correct? Here is my example code: public class MyManager { //This needs to be closed when the application terminates private static MongoClient CLIENT; static { ... CLIENT = new MongoClient("localhost", 27017); ... } public static DB getSomeDB(String dbName) { return CLIENT.getDB(dbName); } //more factory methods ... //Would this work? @Override protected void finalize() throws Throwable { CLIENT.close(); } } Can someone tell me how to best handle this situation and in general with resources such as a database connection or JDBC driver? Thanks!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42991973
has title: Closeing a static resource in Java
score: 1

http://stackoverflow.com/comment/42824690
type: AnswerComment
comment on: http://stackoverflow.com/a/27166095
has text: What do you mean `block`? The stream returns `-1` to let you know that it has ended and so you can make the action you think are necessary. Usually just get input a long as the return value is not `-1`. The first example I stepped on using google: `http://www.tutorialspoint.com/java/io/inputstream_read.htm` should explain that
type: Comment
score: 0

http://stackoverflow.com/comment/43116336
type: Comment
comment on: http://stackoverflow.com/a/27312499
type: AnswerComment
score: 0
has text: Thanks, trustin, Frederic.

http://stackoverflow.com/q/27246978
score: 1
has body: When I use reflection to get method setHomeActionContentDescription like this: Method setHomeActionContentDescription = ActionBar.class.getDeclaredMethod( "setHomeActionContentDescription", Integer.TYPE); I get NoSuchMethodException: java.lang.NoSuchMethodException: setHomeActionContentDescription [int]
type: Question
type: AnsweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42968946
favorite count: 0
has answer: http://stackoverflow.com/a/27268745
upvote count: 1
tagged with: nosuchmethoderror
answer count: 1
has comment: http://stackoverflow.com/comment/42971118
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/42997458
has comment: http://stackoverflow.com/comment/42969989
accepted answer: http://stackoverflow.com/a/27268745
downvote count: 0
has title: java.lang.NoSuchMethodException: setHomeActionContentDescription [int]?

http://stackoverflow.com/a/27156515
has comment: http://stackoverflow.com/comment/42808079
has comment: http://stackoverflow.com/comment/42836790
score: 0
has body: Seem this requires the use of @XmlSeeAlso @XmlRootElement @XmlSeeAlso({Sheep.class, Goat.class}) public abstract class Animal { public Animal() {} } C:\&gt;curl -H "Accept:application/json" http://localhost:8080/api/animal/sheep {"type":"sheep","fur":"curly"}
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42808458
answers question: http://stackoverflow.com/q/27154884
has comment: http://stackoverflow.com/comment/42808129
type: Answer
accepted answer of: http://stackoverflow.com/q/27154884

http://stackoverflow.com/a/27211678
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42909204
score: 2
answers question: http://stackoverflow.com/q/27211549
has comment: http://stackoverflow.com/comment/42904705
has body: I think this has the potential to become a better question, if we had more info. You should specify what language you are referring to. If this is JavaScript or something else then you need to mention that. Secondly, consider revising your question. I suggest asking under which situations one is more appropriate than the other. Whatever the language, the difference between the two is a stark contrast. The first for-loop involves incrementing a variable until a maximum value is reached (metaphorically-speaking, kind of like a race to the top), while the second involves decrementing a variable until a certain minimum is reached (like a race to the bottom). Incidentally, in some languages, such as PHP performance is faster in a loop increment expression if you write the increment or decrement operators on the left instead of on the right.
has comment: http://stackoverflow.com/comment/42904565
downvote count: 0

http://stackoverflow.com/comment/42950409
type: QuestionComment
has text: Yes the most basic programming technic is to correctly swap two values. you need a help variable to store one of the values to swap
comment on: http://stackoverflow.com/q/27236856
score: 0
type: Comment

http://stackoverflow.com/comment/43025599
type: QuestionComment
score: 0
has text: @dheeraj92 You have not given enough information for anyone to make a clear answer.
comment on: http://stackoverflow.com/q/27277692
type: Comment

http://stackoverflow.com/a/27340839
answers question: http://stackoverflow.com/q/27250880
downvote count: 0
type: Answer
has body: For temporary solution, I think it is better for you to use the static key as suggested by the Duncan. Because even though the new key is generated every time, if you store the key in the plain JSON file for next usage, what would be so different than keep it in the code and reuse it over again? If anyone is trying to get the key and decrypt the video, he/she would have to either debug/de-assemble the code to find the static key or just look at the application directory for plain JSON key file, which both are not much difficult tasks. If you really care about the security(I guess that's the reason that you are trying to encrypt the video stream at the first place) I suggest you to look at the Android Keystore and try to encrypt and store your video encryption key with user's PIN or passphrase that can be provided from user-side.
score: 1
upvote count: 1

http://stackoverflow.com/q/27184960
score: 0
has answer: http://stackoverflow.com/a/27186260
possible better answer: http://stackoverflow.com/a/27186438
has title: PropertyAccessException: IllegalArgumentException occurred while calling setter
answer count: 2
has answer: http://stackoverflow.com/a/27186438
has body: I am using Spring 3 with JPA/Hibernate 4. I am getting an IllegalArgumentException when trying to persist a "Product" entity. I have a One to many relation between Product and Category, and there is a composite key ProductId class that has only the PKs of Product and Category. I used @IdClass annotation as both PKs are auto generated by the DB (MySql). My code below will explain it better. My SQL script: CREATE TABLE IF NOT EXISTS `orangeDB`.`Category` ( `catId` INT NOT NULL AUTO_INCREMENT, `category` VARCHAR(45) NOT NULL, `lft` INT NOT NULL, `rgt` INT NOT NULL, PRIMARY KEY (`catId`), UNIQUE INDEX `categoryId_UNIQUE` (`catId` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 1795327; CREATE TABLE IF NOT EXISTS `orangeDB`.`Product` ( `prodId` INT(9) NOT NULL AUTO_INCREMENT, `prefix` CHAR NOT NULL, `product` VARCHAR(45) NOT NULL, `quantity` INT(9) NOT NULL, `price` DOUBLE NOT NULL, `discount` INT(9) NOT NULL, `catId` INT NOT NULL, PRIMARY KEY (`prodId`, `catId`), INDEX `fk_Product_Category1_idx` (`catId` ASC), CONSTRAINT `fk_Product_Category1` FOREIGN KEY (`catId`) REFERENCES `orangeDB`.`Category` (`catId`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 1143713; My Model classes: Product, Category and ProductId composite key class. @SuppressWarnings("serial") @Entity @Table(name = "Category", catalog = "orangeDB") public class Category implements java.io.Serializable { private Integer catId; private String category; private int lft; private int rgt; private Set&lt;Product&gt; products = new HashSet&lt;Product&gt;(0); public Category() { } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "catId", unique = true, nullable = false) public Integer getCatId() { return this.catId; } public void setCatId(Integer catId) { this.catId = catId; } @Column(name = "category", nullable = false, length = 45) public String getCategory() { return this.category; } public void setCategory(String category) { this.category = category; } @OneToMany(fetch = FetchType.LAZY, …
tagged with: jpa
accepted answer: http://stackoverflow.com/a/27186260
has comment: http://stackoverflow.com/comment/42857040
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/212350
type: Question
tagged with: hibernate

http://stackoverflow.com/comment/42914607
has text: Thanks, after implementing this, I tried running a timer and releasing the screen lock and it worked! But what steps do I take to wake up the screen? (I turn off the screen right before the timer fires)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27214507
type: Comment

http://stackoverflow.com/q/27249209
type: Question
has answer: http://stackoverflow.com/a/27249735
has comment: http://stackoverflow.com/comment/42972681
has comment: http://stackoverflow.com/comment/42972813
has title: Using a splitter on an Iterated LinkedList?
favorite count: 0
answer count: 3
downvote count: 1
upvote count: 0
has answer: http://stackoverflow.com/a/27249323
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42972794
has body: Just wondering if you can use a splitter class to split up details moved from a LinkedList to and iterated one? This is the code of the initial split I used before I iterated the LinkedList: Scanner input = new Scanner(new File("today.txt")); while (input.hasNextLine()) { names = input.nextLine(); if(names.contains(":")) { splitter2 = names.split(":"); name = splitter2[0]; times = splitter2[1]; System.out.printf("%s\t\t %s \n",name, times); } q1.add(names); } Q1 being the LinkedList that i have created. Is there anyway to split the iterated list so that i can only search for name when calling back the new Iterated List?
tagged with: java
has answer: http://stackoverflow.com/a/27249328
score: -1

websphere
tags question: http://stackoverflow.com/q/27260984
tags question: http://stackoverflow.com/q/27214517
tags question: http://stackoverflow.com/q/27272877
tags question: http://stackoverflow.com/q/27253341
tags question: http://stackoverflow.com/q/27306986
tags question: http://stackoverflow.com/q/27236792
tags question: http://stackoverflow.com/q/27164282
tag name: websphere
type: Tag
tags question: http://stackoverflow.com/q/27247467

http://stackoverflow.com/comment/42824976
comment on: http://stackoverflow.com/q/27166425
score: 0
type: QuestionComment
type: Comment
has text: public static void main(String args[]){ Object[] objects = new Object[5]; int x = 0; do { objects[x] = new Object[] {1, 1, 3}; x++; } while (x < 5);

http://stackoverflow.com/comment/93782199
has text: *That said, to paraphrase Animal House, some collections are more deterministic than others* George Orwell wrote [Animal Farm](https://en.wikipedia.org/wiki/Animal_Farm) (where some animals are more equal than others). [Animal House](https://en.wikipedia.org/wiki/Animal_House) is a film from National Lampoon. [Food fight!](https://youtu.be/hLdO2V1CTF0)
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27210685

http://stackoverflow.com/a/27275934
answers question: http://stackoverflow.com/q/27275460
has body: You can do it this way StringBuffer sb = new StringBuffer(); Matcher m = Pattern.compile("\\d+").matcher(str); int n = 0; while(m.find()) { if (++n == 1) { m.appendReplacement(sb, "first"); } else { m.appendReplacement(sb, "second"); } } m.appendTail(sb); s = sb.toString();
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43021091
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27275460
has comment: http://stackoverflow.com/comment/43021410

http://stackoverflow.com/a/27300662
answers question: http://stackoverflow.com/q/27300502
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43065997
has body: Your immediate issue is that findViewById looks in the layout you've inflated with setContentView() and since the Views you are trying to inflate aren't in that layout, they return null. So this line returns null LinearLayout layout = (LinearLayout) findViewById(R.id.entryLayout); which causes a NPE at this line as you've noticed TextView text = (TextView) layout.getChildAt(0); because layout is null. The bigger issue is the way you are going about using your ListView. Since you want to use a custom layout for the rows, you should be using a custom Adapter and inflate the appropriate layout there . You can then utilize Adapter's getView() method to set the data in each row as needed. This tutorial can help you get started on that. You also may want to watch Google I/O World of ListView ListView Docs
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27300502
type: Answer

http://stackoverflow.com/a/27185657
has comment: http://stackoverflow.com/comment/43054289
type: Answer
answers question: http://stackoverflow.com/q/27185063
has body: Your pass bundle does not contain an icon. Nov 28 17:34:28 pfr MobileSafari[2127] &lt;Warning&gt;: Invalid data error reading pass M5AULVCSR9.pass.egratify.gift/9128232779653468419. Pass does not contain icon.png/icon@2x.png/icon3x.png Nov 28 17:34:28 pfr MobileSafari[2127] &lt;Warning&gt;: PassBook Pass download failed: The pass cannot be read because it isn’t valid. You also should not be including your certificate in p12 or PEM format in the pass bundle. I would strongly recommend that you revoke this certificate an reissue another. Once you fix these, your pass will still fail to load because your pass.json has an authenticationToken key, but is missing a webServiceURL. You should either add a valid webServiceURL or remove the authenitcationToken key. Your final problem is the passTypeIdentifier key. This should match the name of the certificate used to sign your pass. In this case, pass.egiftfy.giftCupon. { "formatVersion": 1, "serialNumber": "9128232779653468419", "passTypeIdentifier": "M5AULVCSR9.pass.egratify.gift", "authenticationToken": "1234567890987653", "description": "Devesh kumar", "teamIdentifier": "M5AULVCSR9", "organizationName": "OrgName", "logoText": "Devesh kumar ka pass", "foregroundColor": "rgb(255,255,255)", "backgroundColor": "rgb(0,255,0)", "barcode": { "format": "PKBarcodeFormatQR", "message": "ABCDEFG", "messageEncoding": "UTF-8" }, "storeCard": { "primaryFields": [{ "key": "balance", "label": "balance", "value": "100", "currencyCode": "EUR" }] } } Update You pass is still failing because the passTypeIdentifier does not match the certificate you have used to sign the pass. Nov 28 19:14:33 pfr MobileSafari[2127] &lt;Warning&gt;: Invalid data error reading pass pass.egratify.gift/9128232779653468419. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified. Looking at your signature file in a hex editor, it looks like you are now signing with an App Developer cert…
score: 4
has comment: http://stackoverflow.com/comment/53244989
accepted answer of: http://stackoverflow.com/q/27185063
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/53358979
type: AcceptedAnswer

http://stackoverflow.com/q/27290079
duplicate of: http://stackoverflow.com/q/2670982
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43046421
has body: I am making a simple unit tester, where i iterate on pairs of (input, expected) values, and check if a calculated actual value equals the expected. This is perfectly doable in a simple HashMap&lt;INPUTTYPE, OUTPUTTYPE&gt;, but hash logic is pointless, since i'm going to iterate on all values, and never search in the map, while it would be nice to keep the order of the test cases (pairs of (input, expected)). A List&lt;Entry&lt;K,V&gt;&gt; seems to work well, but it seems not nice to use an inner component of a Map in a List. It also seems unnatural to create the Pair class to connect input and expected, since Entry is the same thing. Is there a way using existing java classes in the base libs that support this kind of data very well?
linked to: http://stackoverflow.com/q/2670982
tagged with: java
has answer: http://stackoverflow.com/a/27290223
has comment: http://stackoverflow.com/comment/43046592
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43046445
has title: List<Entry<K,V>> - anything more standard than that?
tagged with: data-structures
has answer: http://stackoverflow.com/a/27290166
score: 0
has comment: http://stackoverflow.com/comment/43046429

http://stackoverflow.com/a/63011381
answers question: http://stackoverflow.com/q/27229407
downvote count: 1
has body: The "Flush memcache" approach didn't work for me. I couldn't find where to shutdown a service either. Instead, I found a way to delete the instance being served then hit the application's url. App engine would automatically create a new instance, which essentially would be a restart. To delete an instance, do this: From App engine dashboard, click "Instances" on the side menu. On the Instances page—below the graph—you would see a list of active instances, delete them, then hit your app's url.
has comment: http://stackoverflow.com/comment/120310184
score: 7
upvote count: 8
type: Answer

http://stackoverflow.com/comment/42811434
type: QuestionComment
type: Comment
has text: I'd argue that the array is a reference to a collection of other references...not a pointer. Java doesn't expose pointers to the developer.
comment on: http://stackoverflow.com/q/27158259
score: 0

http://stackoverflow.com/a/27188505
score: 0
accepted answer of: http://stackoverflow.com/q/27174697
type: AcceptedAnswer
has body: Thanks to Peter Niederwiser answer and comments, this post in StackOverflow and some reading on Gradle documentation about Java plugin I was able to figure it out what was wrong and fix it. Detais below: Peter suggestions on updating the resourceDir for both main and test source sets were done (see Peter's answer and his comments) There was a Hibernate package missing for runtime environment; I updated the dependency block to add it: dependencies { ... compile 'org.hibernate:hibernate-entitymanager:4.3.6.Final' runtime 'org.hibernate:hibernate-entitymanager:4.3.6.Final' ... } Only this two steps combined fixed my problem. The META-INF folder was copied to the right place and the (now present) Hibernate package was there to handle persistence.xml in order to create the EntityManager instance my testing code needed.
answers question: http://stackoverflow.com/q/27174697
type: Answer

http://stackoverflow.com/comment/42930969
type: Comment
comment on: http://stackoverflow.com/a/27226621
type: AnswerComment
has text: I tied doing this too but on the java side I got errors because there were [] brackets in it!
score: 0

http://stackoverflow.com/q/27180473
has comment: http://stackoverflow.com/comment/42849535
has comment: http://stackoverflow.com/comment/42849442
score: 0
has comment: http://stackoverflow.com/comment/42849807
has title: Creating an Object array from another class
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42849439
has comment: http://stackoverflow.com/comment/42849489
tagged with: java
has comment: http://stackoverflow.com/comment/42849512
has comment: http://stackoverflow.com/comment/42849490
type: Question
has comment: http://stackoverflow.com/comment/42849434
answer count: 2
has answer: http://stackoverflow.com/a/27180658
has body: Okay this should be simple. But I have been at this for a good hour and cannot figure out why its a nullpointerexception. I need to create an array for "Sally" and then test its length, which should be 0. This is in the main method of the driver class. LendingItem[] sallysItemList = sally.getSignedOutItems(); if (sallysItemList.length == 0) and this is in the object class that created sally. that rotten B. private LendingItem[] signedOutItems; public LendingItem[] getSignedOutItems() { return signedOutItems; } I feel like I need to maybe declare the Lending item as private LendingItem[] signedOutItems = {}; but I still get errors with that also. EDIT: Im going to add more so that its more understandable what I need to make happen Provided code below. System.out.println("\n*** Test case #1: Create a CardHolder object &amp; test accessors"); CardHolder sally = new CardHolder("Sally Smith", 152, "454-1234"); System.out.println("Name: " + sally.getName() + "\nAppt #: " + sally.getAptNumber() + "\nPhone: " + sally.getPhoneNumber() + "\nMember #: " + sally.getMembershipNumber()); LendingItem[] sallysItemList = sally.getSignedOutItems(); if (sallysItemList.length == 0) System.out.println("Correct result: Sally has zero lending items."); else System.out.println("&gt;&gt; ERROR: Sally has more than zero lending items."); System.out.println("\n*** Test case #6: Sign out one LendingItem"); if(sally.signOut(testItemList[0])) { System.out.println("Correct result: Sally signed out an item successfully."); sallysItemList = sally.getSignedOutItems(); if (sallysItemList.length == 1) System.out.println("Correct result: Sally has one lending item."); else System.out.println("&gt;&gt; ERROR: Sally has other than one lending item."); } else System.out.println("&gt;&gt; ERROR: Sally was unable to sign out an item."); This is my code thus far. Just need to return the current signed out items. public LendingItem[] getSignedOutItems() { return signedOutItems; } This is how we are expected t…
tagged with: arrays
has answer: http://stackoverflow.com/a/27180539
has comment: http://stackoverflow.com/comment/42849471
has comment: http://stackoverflow.com/comment/42849542
accepted answer: http://stackoverflow.com/a/27180658
has comment: http://stackoverflow.com/comment/42849452
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42849558
possible better answer: http://stackoverflow.com/a/27180539
has comment: http://stackoverflow.com/comment/42849504

http://stackoverflow.com/comment/42922322
comment on: http://stackoverflow.com/a/27221584
has text: I'm going to edit the question now. Give me a second, and you will see what I was trying to do. I finished it while responding on here
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27289950
has comment: http://stackoverflow.com/comment/43046561
tagged with: alexa-internet
has answer: http://stackoverflow.com/a/27297649
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27294964
has answer: http://stackoverflow.com/a/27294964
has comment: http://stackoverflow.com/comment/43059414
tagged with: jdom
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/27297649
has answer: http://stackoverflow.com/a/27292353
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43046258
has title: XPath expressions for extracting information from AWIS (Alexa.com) XML data
tagged with: xpath
has body: I somehow can't manage to extract information from AWIS results (containing Alexa data). I've a bunch of XML files containing AWIS data from which I want to extract information bits such as Rank and PageViews for 3 month period. The two (colliding) namespaces are somehow confusing and my XPath expressions are not working as intended. (Even a simple //aws:Rank/text() is not working.) It would be great if somebody could assist me to get going. Currently, I am using jdom library, but wouldn't mind using something else. This is a tiny example that does not work as suspected: Document doc = new SAXBuilder().build(file); XPath xpath = XPath.newInstance("//aws:Rank"); xpath.addNamespace("aws", "http://awis.amazonaws.com/doc/2005-07-11/"); Element rank = (Element) xpath.selectSingleNode(doc); I'd prefer to use javax.xml though... Here's an example of the XML: &lt;?xml version="1.0"?&gt; &lt;aws:UrlInfoResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/"&gt; &lt;aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11"&gt; &lt;aws:OperationRequest&gt; &lt;aws:RequestId&gt;XXXX-XXXX-XXXX-XXXX-XXXX&lt;/aws:RequestId&gt; &lt;/aws:OperationRequest&gt; &lt;aws:UrlInfoResult&gt; &lt;aws:Alexa&gt; &lt;aws:ContactInfo&gt; &lt;aws:DataUrl type="canonical"&gt;ahparis.com&lt;/aws:DataUrl&gt; &lt;aws:PhoneNumbers&gt; &lt;aws:PhoneNumber&gt;+33 140289796&lt;/aws:PhoneNumber&gt; &lt;/aws:PhoneNumbers&gt; &lt;aws:OwnerName&gt;John Fay&lt;/aws:OwnerName&gt; &lt;aws:Email&gt;hostmaster@superbregistrar.net&lt;/aws:Email&gt; &lt;aws:PhysicalAddress&gt; &lt;aws:Streets&gt; &lt;aws:Street&gt;22 rue Saint Sauveur&lt;/aws:Street&gt; &lt;/aws:Streets&gt; &lt;aws:City&gt;Paris 75002,&lt;/aws:City&gt; &lt;aws:Country&gt;FRANCE&lt;/aws:Country&gt; &lt;/aws:PhysicalAddress&gt; &lt;aws:CompanyStockTicker/&gt; &lt;/aws:ContactInfo&gt; &lt;aws:ContentData&gt; &lt;aws:DataUrl type="canonical"&gt;ahparis.com&lt;/aws:DataUrl&gt; &lt;aws:SiteData&gt; &lt;aws:Title&gt;Ah Paris&lt;/aws:Title&…
type: Question
answer count: 3

http://stackoverflow.com/q/27202120
accepted answer: http://stackoverflow.com/a/27202192
tagged with: label
score: 0
has answer: http://stackoverflow.com/a/27202187
favorite count: 0
has comment: http://stackoverflow.com/comment/42887465
possible better answer: http://stackoverflow.com/a/27202187
has answer: http://stackoverflow.com/a/27202192
has comment: http://stackoverflow.com/comment/42887438
type: AnsweredQuestion
tagged with: java
has title: how to make a loop of a switch statement with a label in java
has body: it's quite simple but i don't seem to fegure it out here is my code System.out.println("1=&gt;do this \n2=&gt; do that \n3=&gt; blablabla \n4=&gt; EXIT"); choose:{ int choix = s.nextInt(); switch (choix) { case 1 : lper.addpersonne(); break choose; case 2 : lper.removepersonne(); break choose; case 3 : blalalalala when it comes to execution the "lper.addpersonne" works perfectly fine but after that i can't get the label where i can choose something else . it just stops
upvote count: 1
downvote count: 1
tagged with: switch-statement
type: Question
answer count: 2

http://stackoverflow.com/comment/42838452
type: Comment
has text: Thanks alot for the explanation! i just realised what my code was actually doing... >< I'm not known with enum's in java yet so im probably not using that for now, but thanks for the suggestion, I'll look into it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27173975

http://stackoverflow.com/comment/42836643
has text: Do `01:02:03` instead as your input. It should precisely follow your instructions. Also, parse out the `:` before attempting to convert a `String` to an `int`.
comment on: http://stackoverflow.com/q/27173195
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43091195
comment on: http://stackoverflow.com/a/27310810
type: Comment
score: 1
type: AnswerComment
has text: @learner , Yes - you dont need to write a new MR program. You can reuse the above hadoop query with your modifications. I suggest to write a new parent.perl program which contains nothing but your 4-5 child-sequential.perl programs. Therefore you can give the parent.perl program as a mapper to hadoop, hadoop will run that perl program on the given nodes as a standalone program on that system. Please try and let me know.

http://stackoverflow.com/q/27202481
tagged with: jar
tagged with: unix
favorite count: 0
tagged with: command-line
type: Question
has body: I ran a java executable file using the following command java -cp .;aa/bb/cc/dd/Main.jar aa.bb.cc.dd.Main where aa.bb.cc.dd is the package that has all the .java, .class, and Main.jar files and this package is inside the src folder from where I am running this command. I am getting an error cannot execute binary file: Exec format error Can anyone tell me where I am going wrong.
answer count: 1
upvote count: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42888117
type: UnansweredQuestion
tagged with: ubuntu
has title: cannot execute binary file: Exec format error
score: 2
has answer: http://stackoverflow.com/a/59926827

http://stackoverflow.com/comment/42938351
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27229628
score: 1
has text: [This question](https://www.eclipse.org/forums/index.php/t/801627/) is similar but doesn't have a complete resolution

http://stackoverflow.com/q/27276302
tagged with: java
upvote count: 1
type: Question
has title: What's the proper way of configuring a SoapActionSmartEndpointInterceptor along with AnnotationActionEndpointMapping
downvote count: 0
has answer: http://stackoverflow.com/a/27291014
accepted answer: http://stackoverflow.com/a/27291014
has comment: http://stackoverflow.com/comment/43023497
has body: AbstractAddressingEndpointMapping (an ancestor of AnnotationActionEndpointMapping) retrieves all SmartInterceptors from the BeanFactory and assigns them to an instance variable. Later the MessageDispatcher (SoapMessageDispatcher) calls getEndpoint() on the mapping (from within its own getEndpoint() method). AbstractAddressingEndpointMapping.getEndpoint() calls its own private getEndpointInvocationChain() method that creates a new instance of SoapEndpointInvocationChain with all the interceptors. It never calls shouldIntercept() on the interceptor to determine whether it should be added to the chain. Contract this to SoapActionAnnotationMethodEndpointMapping, which inherits from AbstractEndpointMapping which does the same thing in regards to retrieving the SmartInterceptors. However, it's getEndpoint() method actually calls shouldIntercept() on each interceptor and only adds ones that return true to its chain. AnnotationActionEndpointMapping and SoapActionAnnotationMethodEndpointMapping have different ancestors so their handling is obviously different. So the question is -- is there a proper way to configure SmartInterceptors for an AnnotationActionEndpointMapping?
answer count: 1
has comment: http://stackoverflow.com/comment/43023398
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43021930
tagged with: spring-ws
score: 1

http://stackoverflow.com/comment/42864432
type: Comment
comment on: http://stackoverflow.com/a/27189056
has text: @rchang actually [link](http://stackoverflow.com/questions/7199666/difference-between-and-in-java) made me think this
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42901465
comment on: http://stackoverflow.com/q/27209596
type: Comment
score: 0
type: QuestionComment
has text: Create a new `MediaSession`, then use [`MediaSession.getSessionToken`](https://developer.android.com/reference/android/media/session/MediaSession.html#getSessionToken%28%29)

http://stackoverflow.com/q/27152919
has comment: http://stackoverflow.com/comment/42801841
tagged with: postgresql
type: Question
has body: I'm looking for a way for the sql generated by hql to use upper or lower as comparisons on joins. For example if I have from EntityA a join fetch a.b Which generates ... join table b on a.fk = b.pk I would instead like ... join table b on upper(a.fk) = upper(b.pk); I tried making the postgres columns citext, which makes them case insensitive, but that was causing lazy fetching issues with hibernate that I cannot figure out. Thus I want to try altering hibernates behavior.
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42805331
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42812374
has title: Hibernate case insensitive joins for Postgres
has comment: http://stackoverflow.com/comment/42804741

http://stackoverflow.com/q/27206377
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/27206437
has answer: http://stackoverflow.com/a/27206440
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/27206440
has title: How can I create a search method to search for name which completely matches all the other entry names
has body: Don't know if the question I was asking made clear to you. So I am trying to make a method which lets me search name in my telephone directory class and finds all the entries with the same name. //this is my method in the telephone directory class public String searchEntry(Entry e) { if (entrylist.contains(e)) { return e.getSurname(); } return null; } however what this method dopes is lets search for an entry and find's its extension number. in my entry class I have got three parameters passing in the constructor public Entry(String surname, String initials, String extension) { this.setSurname(surname); this.setInitials(initials); this.setExtension(extension); } ListDirectory ls = new ListDirectory(); Entry e = new Entry("james", "K", "9023"); ls.addEntry(e); System.out.println(ls.searchEntry(e));; //this prints out james I am not sure how I could look up the names which are saved my in my telephone directory class.
tagged with: java
has answer: http://stackoverflow.com/a/27206437
score: 2

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/27249304
tags question: http://stackoverflow.com/q/27220369

http://stackoverflow.com/comment/42893002
comment on: http://stackoverflow.com/a/27205189
type: AnswerComment
has text: your odd rows are 1 star too long. The pattern in the question alternates between 4 and 5 stars
type: Comment
score: 0

loops
tags question: http://stackoverflow.com/q/27212389
tags question: http://stackoverflow.com/q/27222122
tags question: http://stackoverflow.com/q/27156180
tags question: http://stackoverflow.com/q/27152867
tags question: http://stackoverflow.com/q/27204341
tags question: http://stackoverflow.com/q/27282703
tags question: http://stackoverflow.com/q/27202719
tags question: http://stackoverflow.com/q/27292459
tags question: http://stackoverflow.com/q/27253864
tags question: http://stackoverflow.com/q/27218902
tags question: http://stackoverflow.com/q/27177849
type: Tag
tags question: http://stackoverflow.com/q/27195039
tags question: http://stackoverflow.com/q/27284395
tags question: http://stackoverflow.com/q/27161185
tags question: http://stackoverflow.com/q/27281057
tags question: http://stackoverflow.com/q/27276623
tags question: http://stackoverflow.com/q/27217003
tags question: http://stackoverflow.com/q/27197746
tags question: http://stackoverflow.com/q/27202171
tags question: http://stackoverflow.com/q/27208159
tags question: http://stackoverflow.com/q/27204880
tags question: http://stackoverflow.com/q/27272276
tags question: http://stackoverflow.com/q/27298551
tags question: http://stackoverflow.com/q/27279189
tags question: http://stackoverflow.com/q/27221897
tag name: loops
tags question: http://stackoverflow.com/q/27219354
tags question: http://stackoverflow.com/q/27198403
tags question: http://stackoverflow.com/q/27239611
tags question: http://stackoverflow.com/q/27189545
tags question: http://stackoverflow.com/q/27306377
tags question: http://stackoverflow.com/q/27239265
tags question: http://stackoverflow.com/q/27255843
tags question: http://stackoverflow.com/q/27260565
tags question: http://stackoverflow.com/q/27192112
tags question: http://stackoverflow.com/q/27215611
tags question: http://stackoverflow.com/q/27253100
tags question: http://stackoverflow.com/q/27196955
tags question: http://stackoverflow.com/q/27254435
tags question: http://stackoverflow.com/q/27307617
tags question: http://stackoverflow.com/q/27214988
tags question: http://stackoverflow.com/q/27262194
tags question: http://stackoverflow.com/q/27267664
tags question: http://stackoverflow.com/q/27217512

http://stackoverflow.com/a/27174820
type: Answer
answers question: http://stackoverflow.com/q/27174716
has body: This is how it should be with your code, and please dont forget, if answers.length() is just 2 also, it will return only first answer as you are already calling return. I would recommend saving this in list and returning list. public String toString() { return questionText + "\n"; char label = 'a'; for(int i= 0; i &lt; answers.length; i++){ label++; return "("+label+")"+" "+answers[i]+ "\n"; } With list : public String toString() { List&lt;String&gt; stringList = new ArrayList(); for(int i= 0; i &lt; answers.length; i++){ arrayList.add(answers); label++; } return arrayList; I cannot understand your data structure as its written very badly by you. So, I can only help this much.
score: 0

http://stackoverflow.com/q/27229579
upvote count: 3
has answer: http://stackoverflow.com/a/27230278
type: Question
tagged with: tree
tagged with: recursion
type: AnsweredQuestion
score: 3
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/27230278
tagged with: nodes
has comment: http://stackoverflow.com/comment/69098068
has comment: http://stackoverflow.com/comment/69098067
answer count: 1
downvote count: 0
has title: Building general trees in java (with recursion)
favorite count: 0
has body: I have been stuck on a problem for quite a few days. My end goal is to perform preorder, inorder, and postorder traversals on a general tree. The problem I am having is just populating the tree. I am only able to add nodes to the root and to the root's children. I am not able to move "down" past the roots children. I woke up one morning with the idea of building the tree recursively from a bottom-up approach. I have never used recursion so first of all, is this possible? I would basically build the tree by creating the nodes at the bottom of the tree and then work my way up? Here is my node class: //Represents node of the Tree&lt;T&gt; class public class Node&lt;T&gt; { public T data; public List&lt;Node&lt;T&gt;&gt; children; //Default constructor public Node() { super(); children = new ArrayList&lt;Node&lt;T&gt;&gt;(); } public Node(T data) { this(); setData(data); } //Return the children of Node&lt;T&gt; public List&lt;Node&lt;T&gt;&gt; getChildren() { if(this.children == null) { return new ArrayList&lt;Node&lt;T&gt;&gt;(); } return this.children; } //Sets the children of a Node&lt;T&gt; object public void setChildren(List&lt;Node&lt;T&gt;&gt; children) { this.children = children; } //Returns the number of immediate children of this Node&lt;T&gt; public int getNumberOfChildren() { if(children == null) { return 0; } return children.size(); } //Adds a child to the list of children for this Node&lt;T&gt; public void addChild(Node&lt;T&gt; child) { if(children == null) { children = new ArrayList&lt;Node&lt;T&gt;&gt;(); } children.add(child); } public void addChildAt(int index, Node&lt;T&gt; child) throws IndexOutOfBoundsException { if(index == getNumberOfChildren()) { addChild(child); return; } else { children.get(index); children.add(index, child); } } public boolean isLeaf() { if(getNumberOfChildren() == 0) return true; return false; } public T getData() { return this.data; } public void setData(T data) { this.data = data; } public String toString() { StringBuilder…

http://stackoverflow.com/a/27156056
downvote count: 0
has body: I would try recursion. Start in the upper left. If you find a even number, recusively call a method that keeps track of the count, can only look left in the row or in the next lower row. Recursive signature might be: int getMaxSameNeibors(int valueToMatch, int numberFoundSoFar, int[][] array, int currentIndex0, int currentIndex1){ } Challenge would be the following: 2 5 8 7 1 3 2 9 4 7 2 2 2 0 3 8 0 1 5 7 There are 5 neighboring "2"s, but don't double count the one at 2,3 because it is a neighbor of 2,2 and 3,1. To do this you might need to pass a list of found positions to the recursion. EDIT I realized this wouldn't work well for the below... 2 5 8 7 1 3 2 2 2 7 3 3 2 0 3 8 0 1 5 7 Because of this you will need to check same row right one, one row up one position right and one row down (left 1, directly under 2 and right 1). Because of this, I think you need to pass the list of found value indexes.
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27155840

http://stackoverflow.com/q/27222839
has answer: http://stackoverflow.com/a/27223306
score: 0
has title: Exposing Interfaces for Handling Active MQ Events
tagged with: api
answer count: 1
tagged with: event-handling
has body: I have an application written in Java, which functions by communicating over ActiveMQ. I have simple consumer and producer implemented in Java which are receiving and sending messages to a particular platform via Active MQ. I need to provide interfaces to a third party for each defined event, so that they can implement a particular interface to perform a particular task on a particular event. I am looking into different types of interfaces, i need to know that if Tag Interfaces can be some help in this case, if not then what technique should i use to implement this scenario?
type: UnansweredQuestion
tagged with: interface
tagged with: activemq-classic
tagged with: java
type: Question

http://stackoverflow.com/a/27176658
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: You have your output and input code mixed together. You're creating the output and input streams at the same time. When you call new FileOutputStream(file), it replaces the existing file, so when you try to read it, it's empty. Move your output and input code into two different methods.
answers question: http://stackoverflow.com/q/27176598

http://stackoverflow.com/q/27301798
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27301990
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27302129
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27301957
has comment: http://stackoverflow.com/comment/43067234
has title: Showing an image without specifying src in xml
has comment: http://stackoverflow.com/comment/43067196
downvote count: 0
has body: I want to show an image, depending on the value of the int imgch This is in my onCreate: ImageView image = (ImageView)findViewById(R.id.gimage); Resources res = getResources(); Drawable gameImage = res.getDrawable(images[imgch]); And this in my XML: &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/gimage" /&gt; How do I get it to show the correct image in the activity?
favorite count: 0
has answer: http://stackoverflow.com/a/27301957
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/27301921
accepted answer: http://stackoverflow.com/a/27301921

http://stackoverflow.com/q/27218448
tagged with: spring-mvc
tagged with: spring-test
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: junit
downvote count: 0
has body: I am studying for the Spring Core certification and I have the following problem with an exercise related to the use of JUnit test in Spring. So I have the following configuration class named TestInfrastructureConfig: @Configuration @Import({ TestInfrastructureDevConfig.class, TestInfrastructureProductionConfig.class, RewardsConfig.class }) public class TestInfrastructureConfig { public LoggingBeanPostProcessor loggingBean(){ return new LoggingBeanPostProcessor(); } } This class configure the test environment- Now in an exercise say that: In Spring when no configuration class or configurationXML file is specified, @ContextConfiguration will look for an inner class marked with @Configuration (If none is found it will also look for an XML file name of &lt;Classname&gt;-context.xml). Since the TestInfrastructureConfig class is so small anyway, copy the entire class definition, including annotations, to an inner class withing the test class. Then remove the configuration class reference from the @ContextConfiguration annotation (no property in the brackets). This is an example of convention over configuration. So I have totally commentd the code of the TestInfrastructureConfig class that become: //package rewards; // //import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Import; // //import config.RewardsConfig; // //@Configuration //@Import({ // TestInfrastructureDevConfig.class, // TestInfrastructureProductionConfig.class, // RewardsConfig.class }) //public class TestInfrastructureConfig { // // public LoggingBeanPostProcessor loggingBean(){ // return new LoggingBeanPostProcessor(); // } //} Then in the RewardNetworkTests I change: @ContextConfiguration(classes=TestInfrastructureConfig.class) into: @ContextConfiguration() and I add the code of the commented TestInfrastructureConfig into the RewardNetworkTests class as an inner class, something like this: @RunWith(SpringJUnit4ClassRunner.class) //@ContextConfigura…
has answer: http://stackoverflow.com/a/27219026
favorite count: 0
has answer: http://stackoverflow.com/a/27218677
tagged with: spring
has title: Why I obtain this error message when I try to move the configuration class as an inner class of the test class?
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/43029518
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27278742
has text: An internet search engine reveals that this has been extensively studied and some results are [here](http://johanjeuring.blogspot.fi/2007/08/finding-palindromes.html).

http://stackoverflow.com/q/27213687
score: 0
has body: I have been searching for hours on the internet and can't seem to find a step by step tutorial for what I want. I am writing a java desktop application that connects to an instance of a mysql database on amazon web services. This works fine. Now I want to change the connection so that it is SSL. According to the aws web site, each DB instance has a certificate installed on it. the public key is available at https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem . I know that I need to modify the connection url in my java program to include the properties useSSL and requireSSL and set them to true. I have downloaded the was public key and set the above two properties. What do I do next? Do I need a certificate signed by a trusted authority or is that the certificate which is already installed on the was DB instance? How do I use the downloaded public key in my program? What steps do I need to follow? I would appreciate step by step instructions.
answer count: 1
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/27214898
accepted answer: http://stackoverflow.com/a/27214898
tagged with: java
tagged with: mysql
type: Question
type: AnsweredQuestion
tagged with: ssl
has title: Connecting to an instance of mysql on was from java client application

http://stackoverflow.com/q/27244857
type: Question
tagged with: swt
tagged with: jface
has answer: http://stackoverflow.com/a/36301091
tagged with: java
tagged with: treeview
upvote count: 1
has comment: http://stackoverflow.com/comment/42965312
answer count: 1
has comment: http://stackoverflow.com/comment/42965188
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42965070
downvote count: 0
has body: I have designed a checkbox treeviewer using jface but when i run the program it doesnot display any thing on the UI.I am not able to find the where the issue is.Please help me whrer the problem is as I am new to jface. private void createTreeMenu(Composite parentComposite){ /*treeItem = new TreeItem(tree, SWT.MULTI | SWT.CHECK | SWT.VIRTUAL |SWT.BORDER ); treeItem.setText("(1)Test Session"); treeItem.setImage(new Image(null, TreeViewer.class.getClassLoader().getResourceAsStream("icons/Folder-Main.JPG")));*/ Composite treeMenu = new Composite(parentComposite, SWT.BORDER); treeMenu.setLayout(new GridLayout(1, false)); treeMenu.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); /*tree = new Tree (treeMenu, SWT.MULTI | SWT.CHECK |SWT.VIRTUAL ); GridData treeGD = new GridData(SWT.FILL, GridData.FILL, true, true); tree.setLayoutData(treeGD);*/ CheckboxTreeViewer treeViewer=new CheckboxTreeViewer(tree); treeViewer.setContentProvider(new FileTreeContentProvider()); treeViewer.setLabelProvider(new FileTreeLabelProvider1()); treeViewer.setInput(treeItem); parameters.add("root"); /*treeItem = new TreeItem(tree, SWT.MULTI | SWT.CHECK | SWT.VIRTUAL |SWT.BORDER ); treeItem.setText("(1)Test Session"); treeItem.setImage(new Image(null, TreeViewer.class.getClassLoader().getResourceAsStream("icons/Folder-Main.JPG")));*/ tree.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { if(e.item == null) { return; } treeSelection = tree.getSelection(); } }); treeMenu.addListener(SWT.MouseDown, new Listener() { @Override public void handleEvent(Event event) { tree.setSelection(new TreeItem[] {}); treeSelection = null; } }); final Menu menu = new Menu(tree); tree.setMenu(menu); loadMenuDetails(menu); } public TreeItem getInput() { treeItem = new TreeItem(tree, SWT.MULTI | SWT.CHECK | SWT.VIRTUAL |SWT.BORDER ); treeItem.setText("(1)Test Session"); treeItem.setImage(new Image(null, TreeViewer.class.getClassLoader().getResourceAsStream("icons/Folder-Ma…
has title: How to design a checkbox treeviewer using jface
score: 1
favorite count: 0

http://stackoverflow.com/q/27187332
accepted answer: http://stackoverflow.com/a/27187400
score: 0
has answer: http://stackoverflow.com/a/27187421
has answer: http://stackoverflow.com/a/27187452
has answer: http://stackoverflow.com/a/27187439
has answer: http://stackoverflow.com/a/27187400
has title: Java String to Integer No Working?
favorite count: 0
has body: I have the following class and when I run it I get an error which is: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "com.mysql.jdbc.JDBC4ResultSet@42147df5" The error occurs on this line: fono = Integer.valueOf(fonoS); This is the Code: public Counter(){ String query = "SELECT MAX(FONO) from forders"; try { connectOrders.pst = connectOrders.con.prepareStatement(query); connectOrders.rs = connectOrders.pst.executeQuery(query); if (connectOrders.rs.next()){ Object fonoO = connectOrders.rs; String fonoS= fonoO.toString(); fono = Integer.valueOf(fonoS); try { serialisationFoNo(fono); } catch (IOException ex) { Logger.getLogger(Counter.class.getName()).log(Level.SEVERE, null, ex); } } if (connectOrders.rs.wasNull()){ fono = 1; try { serialisationFoNo(fono); } catch (IOException ex) { Logger.getLogger(Counter.class.getName()).log(Level.SEVERE, null, ex); } } } catch (SQLException ex) { Logger.getLogger(Counter.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, ex); } } Why is it throwing this exception I have used the same syntax of code elsewhere in the application and it works. NOTE: I have also tried using Integer.parseInt(); but even that throws a similar exception.
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/27187448
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42861182
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/27187452
type: Question
has answer: http://stackoverflow.com/a/27187359
answer count: 6

http://stackoverflow.com/comment/42972045
type: Comment
has text: got tip, but still gives the same result
type: AnswerComment
comment on: http://stackoverflow.com/a/27248751
score: 0

http://stackoverflow.com/comment/43039087
has text: Your browser knows about network proxies
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27284261

http://stackoverflow.com/a/27237436
type: AcceptedAnswer
downvote count: 0
has body: click Advanced... button under Advanced Project Options section, and override the quiet period per job
type: Answer
answers question: http://stackoverflow.com/q/27234953
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27234953

http://stackoverflow.com/q/27191973
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/27192200
answer count: 1
downvote count: 1
tagged with: deserialization
has comment: http://stackoverflow.com/comment/42869855
favorite count: 0
linked to: http://stackoverflow.com/q/5635226
has title: Deserialize only some fields of JSON objects array (Java)
has body: Given this JSON response I get from an website : { "Items": [ { "Name":"Apple", "Price":12.3, "Quantity":30 }, { "Name":"Grape", "Price":3.21, "Quantity":60 } ], "Date":"21/11/2010" } How could i deserialize this JSON, splitting it in an array called Fruits, containing only name and quantity ? I don't care about date field or other fields like price. My class should look like: class Fruit{ String name; String quantity; } And this is the array: Fruit myfruits[] = new Fruit [this number depends on JSON response I get] How could I achive this ? I've tried to give my best explanation, if it is still not clear, feel free to ask. P.S: btw, the real JSON response has many more fields
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5455014
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
linked to: http://stackoverflow.com/q/4802887
has comment: http://stackoverflow.com/comment/43164027

http://stackoverflow.com/q/27211191
has answer: http://stackoverflow.com/a/27211331
tagged with: gwt
type: AnsweredQuestion
has title: How can I use the same Event Handlers Performing same functions on multiple Objects of the same Kind in GWT (or Java AWT Swing)
tagged with: java
type: Question
has body: I just started working on Gwt2.0. I have two textbox here. Both perform the same event operation. Using addFocusListener() What I have now is. areaBox.addFocusListener(new FocusListener(){ @Override @Deprecated public void onFocus(Widget arg0) { // TODO Auto-generated method stub areaBox.setTitle("Area"); } @Override public void onLostFocus(Widget arg0) { if(areaBox.getText().length() &gt;= 4 ) { areaBox.setStyleName("gwt-TextBox-Success"); } else { areaBox.setStyleName("gwt-TextBox-Error"); cityBox.setText("Enter Area Name "); areaBox.addFocusListener(new FocusListener(){ @Override @Deprecated public void onFocus(Widget arg0) { areaBox.setText(null); areaBox.setStyleName("gwt-TextBox-AE"); } @Override @Deprecated public void onLostFocus(Widget arg0) { } }); } } }); cityBox.addFocusListener(new FocusListener(){ @Override @Deprecated public void onFocus(Widget arg0) { cityBox.setTitle("City"); } @Override public void onLostFocus(Widget arg0) { if(cityBox.getText().length() &gt;= 4 ) { cityBox.setStyleName("gwt-TextBox-Success"); } else { cityBox.setStyleName("gwt-TextBox-Error"); cityBox.setText("Enter City Name "); cityBox.addFocusListener(new FocusListener(){ @Override @Deprecated public void onFocus(Widget arg0) { cityBox.setText(null); cityBox.setStyleName("gwt-TextBox-AE"); } @Override @Deprecated public void onLostFocus(Widget arg0) { // TODO Auto-generated method stub } }); } } }); What the code does is. When Focused on Area TextBox, a tooltip appears, showing what to enter. When Focus on it is lost or comes to next textbox i.e City TextBox, it checks whether the entered string is greater than 4 characters. if yes then SUCCESS css style is applied to the box, if not ERROR css style is applied. So, when clicked on it(AreaBox) again, The text is cleared and css style is reset. The above is a sample between 2 textbox. Please help me, I have nearly 10 such fields, I want to minimize the code. I am thinking of using collections or custom widgets. But don't know whe…
tagged with: javascript
score: 0
accepted answer: http://stackoverflow.com/a/27211331
answer count: 1
tagged with: events

http://stackoverflow.com/comment/43009465
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27269048
has text: @kocko -- but that makes your answer a non-answer: "you can do it like this" + "it is always wrong to do it like this" == "do not do this"

http://stackoverflow.com/comment/42865337
type: Comment
type: QuestionComment
has text: Do you have a connection to database?
comment on: http://stackoverflow.com/q/27189102
score: 0

http://stackoverflow.com/a/27243056
type: Answer
has comment: http://stackoverflow.com/comment/42962059
upvote count: 1
has comment: http://stackoverflow.com/comment/42963200
score: 1
answers question: http://stackoverflow.com/q/27242904
downvote count: 0
has body: There are too many unknowns about your data model and usage patterns to offer a specific solution, but I can offer a few tips. Updating a counter every time you create a new record will increase your writing costs by 2 write operations, which may or may not be significant. Using keys-only queries is very cheap and fast. It is the preferred method for counting something, so you should try to model your data in such a way that a keys-only query can give you an answer. For example, if a "trip" entity has a property for "id of a starting point", and this property is indexed, you can loop through your locations using a keys-only query to count the number of trips that started from each location. Assuming that you record a lot of trips, and that an admin page will be visited/refreshed not very frequently, the keys-only queries approach is the way to go. If the admin page is visited/refreshed many times per hour, you may be better off with the counters.

http://stackoverflow.com/comment/43098192
has text: @Haeri Well the actionPerformed method isn't going to be called automatically, you have to tell something to call it. That's done by adding an ActionListener to the list of listeners for each button. Any object can be an ActionListener if it's class implements ActionListener. So in this case, you probably want to do 'SymbolDialog extends JDialog implements ActionListener` and `button.addActionListener(this);`.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27294063

http://stackoverflow.com/q/27202925
linked to: http://stackoverflow.com/q/3271676
tagged with: tomcat8
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/27203890
has answer: http://stackoverflow.com/a/35461082
type: UnansweredQuestion
has title: How to access tomcat session context?
type: Question
linked to: http://stackoverflow.com/q/3092363
tagged with: java
score: 4
has body: I'm using tomcat8 and I like to look through the available sessions and invalidate/alter some sessions in my servlet Currently I keep every sessions in my own context(Vector) and I believe it's not a good idea. So how may I access tomcat session management/context to do so? Thanks
tagged with: servlets
upvote count: 4
answer count: 2
downvote count: 0

http://stackoverflow.com/q/27251797
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/27252698
type: AnsweredQuestion
tagged with: android-fragments
upvote count: 3
tagged with: java
type: Question
tagged with: android-service
score: 3
has title: Android service communicating with multiple fragments
has answer: http://stackoverflow.com/a/27252698
answer count: 3
has answer: http://stackoverflow.com/a/27251841
downvote count: 0
possible better answer: http://stackoverflow.com/a/27253901
favorite count: 0
has body: I have an application that has a single activity that hosts several fragments in a sort of custom navigation drawer design. Two of these fragments depend on a service to return them json information to display. I want to be able to start the service on my splash screen to load the data I need then asynchronously communicate the json to these fragments. I am new to android and programming in general so excuse me if my actions were ill informed but I first tried to register the fragments as receivers and then simply broadcast intents containing the json information in a bundle. This seemed to not work because sometimes the fragments would not be running when the service would broadcast the intent and miss the intent. Then I decided to go with sticky intents but this resulted in stale information not to mention the inherit security concern. What is the best way to have a service perform a background network request upon launching the app and then display the returned information later by any activity or fragment?
has comment: http://stackoverflow.com/comment/42981213
has answer: http://stackoverflow.com/a/27253901
tagged with: android

http://stackoverflow.com/a/27163081
has comment: http://stackoverflow.com/comment/42819158
type: Answer
has comment: http://stackoverflow.com/comment/42819270
downvote count: 0
has comment: http://stackoverflow.com/comment/42819160
has comment: http://stackoverflow.com/comment/42819210
score: 1
has comment: http://stackoverflow.com/comment/42819301
answers question: http://stackoverflow.com/q/27162996
has comment: http://stackoverflow.com/comment/42819349
has comment: http://stackoverflow.com/comment/42819117
has body: Just use a String with the full name, instead of Name when comparing or create a getName() method. Do this at least: public boolean equals(Name otherName) { String fullName = otherName.getFirst() + otherName.getMiddle() + otherName.getLast(); if (fullName.get.equalsIgnoreCase(this.Name)) { return true; } return false; }
upvote count: 1

http://stackoverflow.com/a/27175088
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/75911070
upvote count: 8
has body: Ok i found it... Should be: <reportElement key="image-1" style="PHLabel" x="0" y="0" width="160" height="33"/> $P{imagesDir}+"logo.bmp"
type: Answer
accepted answer of: http://stackoverflow.com/q/27174786
answers question: http://stackoverflow.com/q/27174786
type: AcceptedAnswer

http://stackoverflow.com/comment/135090095
comment on: http://stackoverflow.com/a/37351767
has text: The link is now updated. Regarding doing "anything", instead of extending an object and inheriting all Realm methods, you will now have to use RealmObject static methods, like `/* With the RealmModel interface */ RealmObject.isValid(p);` instead of `/* With the RealmObject base class */ p.isValid();`. Refer to the updated documentation for more information.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27274655
tagged with: struts-1
type: Question
accepted answer: http://stackoverflow.com/a/27279756
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27279756
type: AnsweredQuestion
has body: I was reading some blogs for struts 1.x, and found that there can be only one instance of action servlet per web application and once instance of request processor per web application module. Can someone explain me whats exactly mean by application module here? or how can we configure request processor for application module?
tagged with: java
has title: How many instances of request processor can exist in web application?

http://stackoverflow.com/a/27233388
answers question: http://stackoverflow.com/q/27232794
has comment: http://stackoverflow.com/comment/43159483
score: 3
upvote count: 3
has body: I looked for discussions on this pattern but none answered my question... which is how can I implement the Strategy pattern to let it be clean Your "strategy" isn't necessarily unclean, as you describe it and I think you may be getting bogged down with the idea of who the client is. Your client is providing the implementation to use but that may be a necessary implementation detail. For instance, the java RMI tutorial's ComputeEngine essentially uses just this pattern. The "compute" implementation is passed by the client - as only the client knows the computation to execute. However, more commonly, the strategy is used to provide a way for logic to be made configurable within some context or to allow a common context to be tailored to specific uses. It also has the benefits of hiding internal structures from clients as required. Often to do this, the strategy to use will be configured internally to the context. This may be provided by: An algorithm that determines the strategy based on the data to be processed An algorithm that determines the strategy based on system state or constraints A configuration file enabling the implementation to be loaded (Class.getResourceAsStream). This is an extension to your Context class's map (i.e. load the map from a well-known location). An example here is that you may provide a "strategy representing a default implementation to use but allow new implementations to be provided as an alternative strategy - e.g. a defaultXMLParser a controller for the data itself - e.g. An object type may stipulate that a certain strategy be used to calculate its value. For the first two points above, you could consider using a factory to derive the correct strategy. This would keep the implementation selection concern localised. Well... Am I totally wrong? Is there something I missed in the "canonical" strategy pattern. Is the "canonical" way the one and only way to implement the Strategy pattern? or Is there a better way to implement this pattern i…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27232794
type: Answer

http://stackoverflow.com/a/27158811
type: Answer
answers question: http://stackoverflow.com/q/27158755
score: 0
upvote count: 1
downvote count: 1
has body: Since you declare and initialize SIZE inside the constructor, that is the only place it is visible. You would need to declare it as a class variable instead. To access it in the way you show (Board.SIZE) you would need to make it a public variable. If you want it private like the others you would need to make a getter method like getSize() which would then return that private variable. Also, it looks like you are trying to get the variable directly from the class itself, not from an object of that class. In that case, you would also need the variable to be static. Public version public class Board { public static int SIZE = 9 public Board() { // remove "int SIZE = 9" from your constructor } } Private version public class Board { private static int SIZE = 9 public Board() { // remove "int SIZE = 9" from your constructor } public int getSize() { return SIZE; } } Side note: You have declared a variable at the class level here private char[][] board; and then inside your constructor you are doing it again here char[][] board = new char [3][3];. These are going to be 2 different variables which is almost certainly not what you want. In order to not create this confusion you only need to initialize board in the constructor, not re-declare it. In your constructor change char[][] board = new char [3][3]; to just board = new char [3][3];

opennlp
type: Tag
tags question: http://stackoverflow.com/q/27182040
tag name: opennlp

http://stackoverflow.com/q/27208153
type: Question
score: 5
downvote count: 0
has title: Jax-RS - Custom attribute to get header value
linked to: http://stackoverflow.com/q/26796363
favorite count: 0
answer count: 3
has body: EDIT: I just realized, is it even possible to perform a custom action with a custom attribute in Java? Or is it just informational? I want to include an authentication token in my Jax-RS service header, but I don't want to add a parameter to every request to get the header and check it like so: public Response getUser(@Context HttpHeaders headers) { if(authorize(headers.getRequestHeader("token").get(0)) { // Do something } } I would much rather add an attribute to each request (or even the class if that is possible: @Authorize public Response getUser() { // Do something } This way I can also add the attribute to only the requests I want to. And if the request isn't authorized, I can override it and return a 401. A custom attribute is easy to write, but how can I get the header information in the attribute without passing it in every time? NOTE: I would rather not use a web.xml. I don't have one right now and I don't like using them. I want to keep my code clean without xml and I think if I used a filter/web.xml it would apply to all calls. If that is the only way, I will, but I much prefer the approach with custom attributes.
tagged with: jax-rs
possible better answer: http://stackoverflow.com/a/27208616
has answer: http://stackoverflow.com/a/27218604
has answer: http://stackoverflow.com/a/27208640
has answer: http://stackoverflow.com/a/27208616
accepted answer: http://stackoverflow.com/a/27208640
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: authentication

http://stackoverflow.com/comment/43038142
comment on: http://stackoverflow.com/q/27284236
score: 0
type: Comment
type: QuestionComment
has text: Apply normal debugging techniques. In this case: print each step of the operation, follow along by hand, observe when it does something wrong, fix wrong thing.

http://stackoverflow.com/q/27165593
has title: Java to Wsdl Mapping in Windup Tools
score: 0
tagged with: java
answer count: 1
tagged with: weblogic
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32507304
tagged with: wsdl
tagged with: jboss7.x
tagged with: rhamt
type: Question
has body: I am trying to deploy a sample weblogic application in JBoss 7.1.1 final. To do this I needed to use Windup tools. In the windup tool it shows **Java to Wsdl Mapping ** for the following code. I really don't know what that is. I googled it, still no progress. Please help me out here. It is a very lengthy code, more than thousand lines. So I have given just a sample. &lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;j2ee:java-wsdl-mapping xmlns:j2ee='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'&gt; &lt;j2ee:package-mapping&gt; &lt;j2ee:package-type&gt;spclink&lt;/j2ee:package-type&gt; &lt;j2ee:namespaceURI&gt;a url here&lt;/j2ee:namespaceURI&gt; &lt;/j2ee:package-mapping&gt;

http://stackoverflow.com/q/27162250
type: Question
tagged with: javascript
score: 0
has body: I want to check the enum value set in the managed bean from a java script in JSF. How can I do this? My JSF has something like below. &lt;script language="javascript"&gt; function displayMsg() { setwindowOverlayPos('popup_window', - 100, - 150); } window.onload = function () { // this is the enum value I want to check. if the value is cust1 , I call the popup window. var cust1= '#{myBean.customerType.custType == "cust1"}'; if(cust1){ displayMsg(); } } &lt;/script&gt; I have enum for customer types public enum CustomerTypeEnum { CUST1("CUST1"), CUST2("CUST2"); private String custType; private CustomerTypeEnum(String s) { custType = s; } /** * @return customer type */ public String CustomerTypeEnum() { return custType; } } And my Managed bean having @ManagedBean(name = "home") @ViewScoped public class HomeBean extends BaseOrderStepBean { private CustomerTypeEnum customerType; public void method1(){ customerType = CustomerTypeEnum.CUST1; } }
answer count: 1
has comment: http://stackoverflow.com/comment/42825866
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27186096
has title: Use Enum value set in the bean from Java Script
tagged with: enums
tagged with: jsf
tagged with: java

http://stackoverflow.com/q/27299912
favorite count: 0
has answer: http://stackoverflow.com/a/27300116
tagged with: android
has comment: http://stackoverflow.com/comment/57431863
has answer: http://stackoverflow.com/a/27300145
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/27300116
upvote count: 2
has title: ADMOB-java.lang.IllegalStateException: isLoaded must be called on the main UI thread
linked to: http://stackoverflow.com/q/28501787
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/27300145
has body: I am newbie to android,its my AndroidLauncherjava file for intersial code @Override public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout layout = new RelativeLayout(this); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // Create the libgdx View View gameView = initializeForView(new MyGdxGame(this),config); AdView adView = new AdView(this); adView.setAdUnitId("ca-app-pub-6916351754834612/9855033027"); adView.setAdSize(AdSize.BANNER); adView.loadAd(new AdRequest.Builder() .build()); layout.addView(gameView); // Add the AdMob view RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); adParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); adView.setLayoutParams(adParams); adView.setBackgroundColor(Color.BLACK); layout.addView(adView, adParams); iAd = new InterstitialAd(this); iAd.setAdUnitId(AD_UNIT_ID); loadInterstitial(); iAd.setAdListener(new AdListener() { @Override public void onAdLoaded() { } @Override public void onAdFailedToLoad(int errorCode) { } }); setContentView(layout); } public void loadInterstitial() { /*AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("0FD328B10106BD9B2BE832163D43D085") .build();*/ AdRequest adRequest = new AdRequest.Builder().build(); iAd.loadAd(adRequest); //iAd.loadAd(adRequest); } public void showInterstitial() { if (iAd.isLoaded()) { iAd.show(); } else { //Log.d(TAG, "Interstitial ad is not loaded yet"); } } Its my code for interstitial ads;I getting java.lang.IllegalStateEx…
tagged with: admob
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/42878386
score: 0
has text: You could remove the existing elements from the new list using removeAll and passing it the existing list, now the new list only contains the new items, you can now call addAll on the existing list passing it the new list...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27196415

http://stackoverflow.com/comment/42894933
has text: in short - use shared data structures (e.g. collections, queues, fields). read [this tutorial](http://docs.oracle.com/javase/tutorial/essential/concurrency/) - it is the best guide for multi-threading. an hour of reading and testing, but much simpler to live further.
comment on: http://stackoverflow.com/a/27204773
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42854572
type: AnswerComment
type: Comment
has text: i am using datatable instead of simple table
score: 0
comment on: http://stackoverflow.com/a/27183227

http://stackoverflow.com/q/27292881
has title: Multithreaded test to test response time of sites/web services
tagged with: concurrency
tagged with: java.util.concurrent
has comment: http://stackoverflow.com/comment/43111697
type: Question
has comment: http://stackoverflow.com/comment/43257063
has comment: http://stackoverflow.com/comment/43245540
has comment: http://stackoverflow.com/comment/43139953
score: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/43102941
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has body: Below code tests the response time of reading www.google.com into a BufferedReader. I plan on using this code to test the response times of other sites and web services within intranet. Below tests runs for 20 seconds and opens 4 requests per second : import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; public class ResponseTimeTest { private static final int NUMBER_REQUESTS_PER_SECOND = 4; private static final int TEST_EXECUTION_TIME = 20000; private static final ConcurrentHashMap&lt;Long, Long&gt; timingMap = new ConcurrentHashMap&lt;Long, Long&gt;(); @Test public void testResponseTime() throws InterruptedException { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10); scheduler.scheduleAtFixedRate(new RequestThreadCreator(), 0, 1, TimeUnit.SECONDS); Thread.sleep(TEST_EXECUTION_TIME); System.out.println("Start Time, End Time, Total Time"); for (Entry&lt;Long, Long&gt; entry : timingMap.entrySet()) { System.out.println(entry.getKey() + "," + entry.getValue() +","+(entry.getValue() - entry.getKey())); } } private final class RequestThreadCreator implements Runnable { public void run() { ExecutorService es = Executors.newCachedThreadPool(); for (int i = 1; i &lt;= NUMBER_REQUESTS_PER_SECOND; i++) { es.execute(new RequestThread()); } es.shutdown(); } } private final class RequestThread implements Runnable { public void run() { long startTime = System.currentTimeMillis(); try { URL oracle = new URL("http://www.google.com/"); URLConnection yc = oracle.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); while ((in.readLine()) != null) { } in.close(); } catch (Exception…
has comment: http://stackoverflow.com/comment/43649430
has comment: http://stackoverflow.com/comment/43062947
tagged with: java
has comment: http://stackoverflow.com/comment/43256379

http://stackoverflow.com/comment/43140307
type: AnswerComment
type: Comment
has text: you probably have multiple jars containing the conflicted class in your classpath
comment on: http://stackoverflow.com/a/27224647
score: 0

http://stackoverflow.com/q/27239949
accepted answer: http://stackoverflow.com/a/27245648
tagged with: java
tagged with: eclipse
type: Question
has body: I've seen questions similar to this, but none that would match what I'm experiencing with my Libgdx project (desktop only). I've made a .tmx map using Tiled and copied it to the assets folder, which has two subpackages: gameScreens (with the maps) and tiles. If I open the .tmx map from Eclipse using Tiled it works just fine. Here's the .tmx: <?xml version="1.0" encoding="UTF-8"?> <image width="32" height="32" source="../tiles/rock.png"/> <image width="32" height="32" source="../tiles/tile_default_1.jpg"/> <image width="32" height="32" source="../tiles/tile_default_2.jpg"/> <image width="32" height="32" source="../tiles/wall.png"/> eJxjYWBgYCGAmXFgZHlGJHFGLPKU8okxH5f78GEAbrAA2Q== I created an abstract class GameState: package com.mygdx.cavedive.game.GameStates; //imports public abstract class GameState { private static TmxMapLoader mapLoader = new TmxMapLoader(); protected static OrthogonalTiledMapRenderer otmr; protected static OrthographicCamera cam; protected OrthogonalTiledMapRenderer getRenderer() { return otmr; } protected TmxMapLoader getMapLoader() { return mapLoader; } protected void disposeRenderer() { otmr.dispose(); } } and a class that extends it: package com.mygdx.cavedive.game.GameStates; //imports public class Level_1 extends GameState implements Screen { private TiledMap map; @Override public void render(float delta) { //Clear the screen Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); otmr.setView(cam); //Render the screen otmr.render(); } @Override public void resize(int width, int height) { cam.viewportWidth = width; cam.viewportHeight = height; cam.update(); } @Override public void show() { map = getMapLoader().load("gameScreens/level1.tmx"); otmr = new OrthogonalTiledMapRenderer(map, 1f / 32f); cam = new OrthographicCamera(); } @Override public void hide() { dispose(); } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { disposeRenderer(); map.dispose(); } } Now here's…
tagged with: libgdx
has comment: http://stackoverflow.com/comment/42957451
tagged with: tiled
score: 0
has answer: http://stackoverflow.com/a/27245648
answer count: 1
has title: NullPointerException Libgdx
type: AnsweredQuestion

http://stackoverflow.com/comment/42968678
comment on: http://stackoverflow.com/a/27246062
type: AnswerComment
has text: do you know how to unblock my take()? After adding a do while condition, my second thread is in the block process and doesnt recover. i think thats becuz it enter the do body before the condition is updated by the main thread
type: Comment
score: 0

http://stackoverflow.com/comment/43002691
has text: Good ideas. A custom trie may be a solution, too. The words cannot be joined into a string, because they come from a tokenization process, with separators that vary.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27263933
score: 0

http://stackoverflow.com/comment/43084951
type: AnswerComment
comment on: http://stackoverflow.com/a/27311953
type: Comment
score: 0
has text: Oh, I was absolutely sure it would not do that! Maybe it depends on the version or table engine? How about hacking the table-definitions directly. You do have a test-system, don't you?

storage
tag name: storage
tags question: http://stackoverflow.com/q/27205213
type: Tag

http://stackoverflow.com/comment/42921432
has text: http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_52/java/org/apache/catalina/core/ApplicationFilterChain.java?view=markup Line 237-238 versus Line 241. A method of Filter interface can be called. A method of specific class cannot.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27197157

http://stackoverflow.com/comment/43010543
comment on: http://stackoverflow.com/q/27269249
score: 0
type: Comment
type: QuestionComment
has text: @priya - You should go with - http://blazemeter.com/. It is really nice and efficient tool for load testing. It is also allow to run jmeter script using cloud.

gson
tags question: http://stackoverflow.com/q/27246024
tags question: http://stackoverflow.com/q/27188753
tags question: http://stackoverflow.com/q/27250880
tags question: http://stackoverflow.com/q/27191973
tags question: http://stackoverflow.com/q/27303275
tags question: http://stackoverflow.com/q/27212598
tags question: http://stackoverflow.com/q/27249894
tags question: http://stackoverflow.com/q/27176134
tag name: gson
tags question: http://stackoverflow.com/q/27309196
tags question: http://stackoverflow.com/q/27193633
tags question: http://stackoverflow.com/q/27206324
tags question: http://stackoverflow.com/q/27253555
tags question: http://stackoverflow.com/q/27238908
tags question: http://stackoverflow.com/q/27153463
type: Tag
tags question: http://stackoverflow.com/q/27231518

http://stackoverflow.com/comment/42993454
type: Comment
type: QuestionComment
score: 0
has text: I know that... I want to have a workaround so that my program is not delayed and that the program will return. There must be a way to accomplish this..
comment on: http://stackoverflow.com/q/27260116

http://stackoverflow.com/comment/42826530
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27167418
has text: because int is not an Object

http://stackoverflow.com/q/27272945
type: Question
has comment: http://stackoverflow.com/comment/43015833
has comment: http://stackoverflow.com/comment/43016796
tagged with: arrays
linked to: http://stackoverflow.com/q/3988788
favorite count: 0
has title: String index out of range (Repeating Sequence of digits)
has comment: http://stackoverflow.com/comment/43017110
answer count: 3
has answer: http://stackoverflow.com/a/27273609
has answer: http://stackoverflow.com/a/27273219
has comment: http://stackoverflow.com/comment/43015897
has answer: http://stackoverflow.com/a/27273168
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/43015585
has comment: http://stackoverflow.com/comment/43015745
upvote count: 1
has body: I seem to be having a problem with my code which is to look for the repeating sequence of digits. I have converted(?) double to string because I get the error unreachable statement. (which I guess helps to looking for the reason why I get the error I have now?). Whenever I run it, it goes fine until I finish entering N and D. It'll say "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 3" Here is my code below: import java.util.*; public class RepeatingSequence{ public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.print("Enter N,D: "); int numerator = in.nextInt(); int denominator = in.nextInt(); double quotient = numerator / denominator; String number = "" + quotient; char n = number.charAt(0); int j = 1; int z = 0; String output = ""; char[] index = number.toCharArray(); for ( int i = 2; number.charAt(j) != number.charAt(i); i++ ){ index[z] = number.charAt(z); index[j] = number.charAt(j); index[i] = number.charAt(i); output = output + index[i]; if ( index[i] != index[z] ){ System.out.print(index[z] + ".(" + index[j] + output + ")"); } } } }
has comment: http://stackoverflow.com/comment/43017927
tagged with: java
score: -1

label
tags question: http://stackoverflow.com/q/27216096
tags question: http://stackoverflow.com/q/27239018
tags question: http://stackoverflow.com/q/27202120
tags question: http://stackoverflow.com/q/27156138
tag name: label
type: Tag

http://stackoverflow.com/a/57453225
answers question: http://stackoverflow.com/q/27217401
score: 3
has comment: http://stackoverflow.com/comment/120456709
upvote count: 3
has comment: http://stackoverflow.com/comment/101381239
type: Answer
downvote count: 0
has body: One thing to notice is: in python 3: 6 // -132 = -1 in java: 6 / -132 = 0

http://stackoverflow.com/q/27159938
tagged with: recursion
has comment: http://stackoverflow.com/comment/42845668
tagged with: java
tagged with: timeout
has title: Java minimax with strict time limit
has body: I am implementing an alpha beta search with iterative deepening for a board game for a school project. The only problem I have is strict time limit - the solution is not valid if it does not finish exactly on time. I have found multiple solutions to this problem, but none of them seems to work for me. Right now what I have is this: public int act(int board[][], int[] moves, int timeLimit) { long startTime = System.currentTimeMillis(); ActThread actThread = new ActThread(board, moves); Thread worker = new Thread(actThread); worker.start(); try { Thread.sleep((long) (0.9 * timeLimit)); } catch (InterruptedException e) { System.err.println(e); } actThread.terminate(); return actThread.getBestMove(); } As you can see I count the result in different thread, where is it counted with the use of iterative deepening. This is my simplest solution, but I have tried using ExecutorService, specifically awaitTermination function and I have tried to schedule TimerTask which will terminate the ActThread.
score: 0
has comment: http://stackoverflow.com/comment/42820819
has comment: http://stackoverflow.com/comment/42848415
answer count: 0
tagged with: time
type: UnansweredQuestion
tagged with: limit
type: Question

http://stackoverflow.com/a/27178049
downvote count: 0
has comment: http://stackoverflow.com/comment/42868235
has comment: http://stackoverflow.com/comment/42873776
has comment: http://stackoverflow.com/comment/42873220
type: Answer
has body: If I'm understanding correctly, you want to normalize or massage the value on the incoming JsonReader from an int to something else, like a boolean. If so, you probably want to create an adapter class that extends TypeAdapter&lt;YourFieldNameType&gt; and overrides read(). You get the value from nextInt() and then return the appropriate boolean based on its value. You may have to check for null values, depending on the config of the parser. If you need to, you can override write() in the same adapter class, to coerce booleans in your client code into integers for the JsonWriter. [EDIT] For reference, here is an example of my TypeAdapter, which coerces a "Commands" enum class to/from an integer. package com.company.product.json; import static com.company.product.Commands.*; import java.io.IOException; import java.util.logging.Logger; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.company.product.Commands; import com.company.product.client.ClientSocket; /** * Adapter for Command handling. * * We write out the CommandName as an Integer, and read it in as a Commands constant. * * This satisfies the requirement that the CommandName by represented by JSON as an int, but allows * us to deserialize it to a Commands object on read. * * @author jdv * @see com.company.product.Command#commandName CommandName */ public class CommandsAdapter extends TypeAdapter&lt;Commands&gt; { private static final Logger logger = Logger.getLogger(ClientSocket.class.getPackage().getName()); /* * (non-Javadoc) Deserialize the JSON "CommandName" integer into the corresponding Commands * constant object. * * @see com.google.gson.TypeAdapter#read(com.google.gson.stream.JsonReader) */ @Override public Commands read(JsonReader in) throws IOException { final int command; try { command = in.nextInt(); } catch (IllegalStateException e) { logger.severe("Unable to read incoming JSON stream: " + e.getMessage()); throw new IOE…
answers question: http://stackoverflow.com/q/27176134
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42845571

http://stackoverflow.com/comment/43059723
has text: Do you get 2 different thread ids if you place a println of getId() right before the while loop?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27297306

http://stackoverflow.com/comment/43063801
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27296382
has text: I have copied ur code. When entering wrong/correct entries it says Contacting Servers, Logging in. This method looks much better than what I done bymyself(thanks for that), but it does not respong on my first click on login button. I think I know whats wrong hold on
type: AnswerComment

http://stackoverflow.com/comment/42894128
type: Comment
has text: [link](http://www.wavsource.com/sfx/sfx3.htm) I right clicked on one of the files to save it into my directory. Thanks for the help.
type: QuestionComment
comment on: http://stackoverflow.com/q/27205306
score: 0

gwtmockito
tags question: http://stackoverflow.com/q/27153642
tag name: gwtmockito
type: Tag

http://stackoverflow.com/q/27165644
tagged with: java
linked to: http://stackoverflow.com/q/6223765
has answer: http://stackoverflow.com/a/27180881
type: Question
possible better answer: http://stackoverflow.com/a/27165813
has body: I have scenario, where I need to kill a java process. Here is my scenario: I have web application in that web application I have implemented a Listener class like below public class MyListener extends ServletContextListener { java.lang.Process ps = null; public void contextInitialized(ServletContextEvent arg0) { // This will be excuted when my web application executed String command= "cmd.exe start maybatch";// This command is to execute a batch program that triggers java program ps = Runtime.getRunTime().exec(command); } public void contextDestroyed(ServletContextEvent arg0) { //This part will be executed when server shutdown happens. // Here I want to close the java process which was triggered when project deployed. if( ps !=null) ps.destroy(); } } } What my requirement is to close the Java process when my tomcat is shutting down and start the java program when my web application deployed. Everything is working fine till to start the java process when Project is deployed. But I dont know how to close the java process which was triggered when project is deployed Any help would be appreciated. Thanks in advance. Sorry to be not clear.. mybatch lanches a new java program.
downvote count: 0
has comment: http://stackoverflow.com/comment/42824778
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42823490
answer count: 3
has comment: http://stackoverflow.com/comment/42823433
has title: How to kill a java program with java program
accepted answer: http://stackoverflow.com/a/27180881
has answer: http://stackoverflow.com/a/27167322
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27165813
score: 1

http://stackoverflow.com/comment/43028424
type: AnswerComment
has text: Well, that's ok, you can still embed your ProcessBuilder thing with you the run() Method of Runnable(). Using the executor separates the problem of spawning multiple threads from actually executing a command line call.
type: Comment
comment on: http://stackoverflow.com/a/27279601
score: 0

http://stackoverflow.com/q/27261356
tagged with: package
tagged with: conventions
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42995815
tagged with: java
accepted answer: http://stackoverflow.com/a/27262784
has comment: http://stackoverflow.com/comment/42995997
has comment: http://stackoverflow.com/comment/42995926
type: Question
has comment: http://stackoverflow.com/comment/42995722
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/42995890
answer count: 1
has answer: http://stackoverflow.com/a/27262784
has title: Java classes with very limited use, but not limited to one class. External or inner?
has body: Say I have an abstract class AbstractBarrelComponent that extends the Component class. The class uses a class named Barrel for some imaginary purpose. Where should my Barrel class reside, if the only classes that would/can/should ever use it are the AbstractBarrelComponent and its subclasses? By "reside" I mean should the class be in its own file, Barrel.java, or should it be a package-protected class in AbstractBarrelComponent.java? Is there a common convention for this kind of situation?
tagged with: subclass

http://stackoverflow.com/comment/42945954
comment on: http://stackoverflow.com/q/27233828
score: 0
type: Comment
type: QuestionComment
has text: Any particular reason why you're using Eclipse instead of Android Studio?

http://stackoverflow.com/comment/43004321
has text: is a single quote a concern at all? When I also tried to use a view it comes out wrong.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27266545

http://stackoverflow.com/a/27240522
type: Answer
has body: " protected void updateProgress " location needs to be fixed since its functionality is changing with class. What you can do here is create a abstract super class and make the updateProgress abstract (this is template pattern) . Let the base class give independent functionality for it. this way you would be able to use it either way by sub-class/super-class variable. There is no law that you need to use composition every where , it depends .. in your case you should use template method pattern.
answers question: http://stackoverflow.com/q/27240406
score: 0

http://stackoverflow.com/q/27164230
tagged with: string
has comment: http://stackoverflow.com/comment/42822306
favorite count: 0
has comment: http://stackoverflow.com/comment/42821228
answer count: 5
has answer: http://stackoverflow.com/a/27164574
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/27164769
has answer: http://stackoverflow.com/a/27164626
has answer: http://stackoverflow.com/a/27164769
has title: How to break an Integer[] arr in more than one interger[] arrs in Java?
type: Question
has comment: http://stackoverflow.com/comment/42821446
has answer: http://stackoverflow.com/a/27164997
has answer: http://stackoverflow.com/a/27164292
tagged with: arrays
has comment: http://stackoverflow.com/comment/42821510
accepted answer: http://stackoverflow.com/a/27164626
has body: I have a comma separated string of IDs. I want to break this comma separated string in more than one strings if total no. of IDs are greater than 500. What I can do: I can convert this string in to integer array and then test it's size. Break than array in more than one arrays, and re-convert them in comma separated strings. My code so far: Integer[] empIdInt = null; String tokens[]=Application.splitstr(outerArray, ","); if(!ErmUtil.isNull(tokens) &amp;&amp; tokens.length&gt;0){ empIdInt=new Integer[tokens.length]; for(int i=0;i&lt;tokens.length;i++){ empIdInt[i]=Integer.valueOf(tokens[i]); } } Questions is it right approach to tackle this problem? if yes,how to break integer[] array in more than one arrays? if no, what should i do? Edit: input : "1,2,3,4,5,6,7,8,9,10,11" //list of ids; I want to break them more than one string if no. of ids is greater than let's say 3. As we it's 10 i.e total no. of ids. so output might be Output "1,2,3" //1st string "4,5,6" //2nd string "7,8,9" //3rd string "10" //4th string
downvote count: 0

http://stackoverflow.com/q/27228411
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27228800
has comment: http://stackoverflow.com/comment/42934199
has answer: http://stackoverflow.com/a/27228482
accepted answer: http://stackoverflow.com/a/27228482
has title: How to get time zone of the client
tagged with: java
upvote count: 2
answer count: 2
tagged with: javascript
tagged with: jquery
favorite count: 0
possible better answer: http://stackoverflow.com/a/27228800
has comment: http://stackoverflow.com/comment/42934029
tagged with: http://stackoverflow.com/tag/html
score: 2
has body: I want to access timezoneId of client. For this I had tried different approaches to get timezoneId information. Like: calculating timezone from offset &amp; daylight saving time, getting user location(i.e.longitude, latitude value) to know the timezoneId of that location I am getting the result but exact results (for all timezones) For example two countries having same offset value then I am unable to locate exact one based on their system timezone setting; like:for Arizona and Mountain Time(US &amp; Canada) both having offset value is UTC-7.00 Right now for both the value it is giving "MST" i.e. Mountain Standard Time as timezoneId. But I want what ever I will configure means if I will select Arizona then it will return Arizona and if I will select Mountain Time(US &amp; Canada) then it will give its corresponding timezoneId. Can you help me to get exact timezoneId ? Thanks,
downvote count: 0
type: Question

http://stackoverflow.com/a/27221358
has comment: http://stackoverflow.com/comment/42921770
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42925579
score: 3
answers question: http://stackoverflow.com/q/27221290
has comment: http://stackoverflow.com/comment/42921692
has comment: http://stackoverflow.com/comment/42921761
has body: This could only happen, when the port is not accessible because of a firewall in between. This firewall could be anywhere even on the client or the server machine. ping is to check if the host is accessible which it is but not on port 8001. From ping, it is confirmed that the host is accessible. Try running the server program on another generally open port such as 80, 443, 8080 etc. The network / firewall administrators generally allow these ports to be open and accessible. Note that for port 80, 443 (any port less than 1024) would require root access to bind to it (on the server that is).
accepted answer of: http://stackoverflow.com/q/27221290
has comment: http://stackoverflow.com/comment/42921716
has comment: http://stackoverflow.com/comment/42921629
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27169247
has answer: http://stackoverflow.com/a/27169342
accepted answer: http://stackoverflow.com/a/27169342
score: 0
answer count: 1
has title: JAX-WS wsdl in cluster environment
type: AnsweredQuestion
tagged with: java
tagged with: jax-ws
tagged with: web-services
has body: I'm encountering a bit of a problem when I deploy my web-services application on a cluster. The wsld is published and can be accessed using the [urlofcluster]/[webapp]/manageparticipantidentifier?wsdl url. But when I take a look inside i see this: &lt;s:import namespace="http://busdox.org/serviceMetadata/locator/1.0/" schemaLocation="http://[ipaddress]/[webapp]/manageparticipantidentifier?xsd=2"/&gt; Since this cluster is behind a firewall, the machine is not accessible trough the ip from the world-wide web... so the question is... How can i make Jax-ws replace the ip-address by the url of the cluster in the wsdl's ? For now this app needs to be deployed on weblogic, but other platforms need to be possible 2...
type: Question

http://stackoverflow.com/a/27164639
answers question: http://stackoverflow.com/q/27164531
accepted answer of: http://stackoverflow.com/q/27164531
score: 0
type: AcceptedAnswer
has body: Wrap the code in SwingUtilities.invokeLater() Process p = Runtime.getRuntime().exec("cmd /c mysqlbackup.bat", null, new File("C:\\MySQLBackups")); p.waitFor(); wait.dispose(); MessageService.showMessageDialog(MessageService.BACKUP_SUCCESSFUL, "Successful", "info"); But actually it's better to run succh ong tasks in a separate thread. Check SwingWorker examples.
type: Answer

http://stackoverflow.com/comment/42863033
score: 2
has text: I believe that using ThreadLocal is bad practice and looks like a hack.
comment on: http://stackoverflow.com/a/27188314
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42872483
comment on: http://stackoverflow.com/a/27191643
type: AnswerComment
score: 0
type: Comment
has text: Yes, take a look at this article for further information. http://www.intertech.com/Blog/understanding-spring-mvc-model-and-session-attributes/

http://stackoverflow.com/q/27172649
has body: What's the difference between replaceAll("\\s+") and replaceAll("\\\\s+")? Usually I use \\s+ but sometimes I see \\\\s+.
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27172702
accepted answer: http://stackoverflow.com/a/27172702
tagged with: replaceall
has comment: http://stackoverflow.com/comment/42835674
duplicate of: http://stackoverflow.com/q/4653831
upvote count: 7
type: AnsweredQuestion
has title: Java replaceAll("\\s+") vs replaceAll("\\\\s+")
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/4653831
has comment: http://stackoverflow.com/comment/42835679
type: Question

http://stackoverflow.com/comment/43078347
comment on: http://stackoverflow.com/q/27307716
score: 0
has text: adamdc78 you were correct, how do I accept your answer?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43037915
score: 0
type: QuestionComment
type: Comment
has text: @MadProgrammer i fixed the errors when u mentioned it did not compile. But it still overlaps the menu bar
comment on: http://stackoverflow.com/q/27284653

http://stackoverflow.com/q/27253100
upvote count: 1
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/42980432
tagged with: hashmap
tagged with: key
has body: i'm iterating over a hashmap, and comparing two keys. I remove the first key after saving it to a temp, so it never checks back through the keySet I want to remove both keys (or at least not iterate over that particular key again) if its found to pair with a previous key Iterator&lt;Entry&lt;Double, List&lt;Double&gt;&gt;&gt; i = map.entrySet().iterator(); while(i.hasNext()) { Map.Entry&lt;Double, List&lt;Double&gt;&gt; next = i.next(); i.remove(); for(Map.Entry&lt;Double, List&lt;Double&gt;&gt; e : map.entrySet()) { //if true they are a pair if((next.getKey() == Double.POSITIVE_INFINITY &amp;&amp; e.getKey() == 0) || (next.getKey() == 0 &amp;&amp; e.getKey() == Double.POSITIVE_INFINITY) || Math.abs(next.getKey() * e.getKey() + 1.0) &lt; 0.0000001) { List&lt;Double&gt; arrayX = next.getValue(); List&lt;Double&gt; arrayY = e.getValue(); for(int a = 0; a &lt; arrayX.size(); a++) { for(int b = 0; b &lt; arrayY.size(); b++) { if(Math.abs(arrayX.get(a) - arrayY.get(b)) &lt; 0.0000001) { squares++; } } } } } } random example for a visual demo: {1,2,3,1,2,4,5,6} 1 against {2,3,1,2,4,5,6} when it reaches 1 remove it and perform a function so the list left is {2,3,2,4,5,6} repeat until all the list has been traversed How can I achieve this?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to remove a key from hashmap while iterating
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/42877475
comment on: http://stackoverflow.com/a/27195566
score: 0
type: AnswerComment
type: Comment
has text: It's hard to say without a code sample, but it seems like you are trying to bind a UDP socket by giving it a IP address? You should setup the UDP socket on a port, and then when forming the UDPPacket, give it an IP Address, like you have done in your code above. Is this what you're doing?

http://stackoverflow.com/a/27245898
has comment: http://stackoverflow.com/comment/42967082
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42967328
has body: You can check the file for write access before opening it.This is done with the canWrite() method. Oracle Docs - File # canWrite Also check out this solved question. It deals with the synchronized attribute. Solved Question - Synchronized
type: Answer
accepted answer of: http://stackoverflow.com/q/27245799
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27245799

http://stackoverflow.com/a/27242060
answers question: http://stackoverflow.com/q/27241575
score: 49
has body: Why does java app crash in gdb but runs normally in real life? Because it doesn't actually crash. Java uses speculative loads. If a pointer points to addressable memory, the load succeeds. Rarely the pointer does not point to addressable memory, and the attempted load generates SIGSEGV ... which java runtime intercepts, makes the memory addressable again, and restarts the load instruction. When debugging java programs, one has to generally do this: (gdb) handle SIGSEGV nostop noprint pass Unfortunately, if there is some JNI code involved, and that code SIGSEGVs, GDB will happily ignore that signal as well, resulting in the death of inferior (being debugged) process. I have not found an acceptable solution for that latter problem.
has comment: http://stackoverflow.com/comment/95547617
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/110831578
type: Answer
has comment: http://stackoverflow.com/comment/95547761
accepted answer of: http://stackoverflow.com/q/27241575
upvote count: 49
has comment: http://stackoverflow.com/comment/118212397
has comment: http://stackoverflow.com/comment/42969586

http://stackoverflow.com/comment/43011130
score: 0
type: Comment
type: QuestionComment
has text: @jangroth Struts 1.x and Struts 2.x are 2 **completely** different frameworks, each with their own architecture. Struts 1 is MVC based while Struts 2 is component based (like JSF).
comment on: http://stackoverflow.com/q/27261630

http://stackoverflow.com/comment/42996032
has text: @Selena Underlying `Class` object never varies between generic types: actual `Class` for, say, `List<String>` is exactly the same as that of `List<Integer>` (feel free to test this to verify that actual `Class` object you get via `list.getClass()` is same). This also means that instantiation via reflection is exactly the same; much of generic types are handled by compiler inserting casts, and there is no real runtime difference. This means that you will not be able to construct different classes: they do not exist. You will rather need to use the existing type-erased `Class`.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27260476
score: 0

http://stackoverflow.com/q/27207373
has answer: http://stackoverflow.com/a/27207576
possible better answer: http://stackoverflow.com/a/27207472
upvote count: 1
has answer: http://stackoverflow.com/a/27207472
has answer: http://stackoverflow.com/a/27207833
accepted answer: http://stackoverflow.com/a/27207833
type: Question
has title: Java - know the obj which have my current object in attr
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm sure the answer is easier than I think, and I'm a little exhausted so sorry if you find my question .. dumb. Let us consider the two following classes : public class Objet1 { private Objet2 obj; //getter &amp; setter } public class Objet2 { public void myFunc(Objet1 objj) { // blabla } } in myFunc I need to have access to some methods of Object1, that's why I have Object1 in params. Is there any other solution to access it ? Cause i have to write something like Object1 ob = new Object1(); ob.getObject2().myFunc(ob); and I don't think/know if it is a good use of java.. I'm in the Object2 class' and I want to know if it is possible to have access to the Object1 which have my actual Object2 in attr without passing him throught another param Thanks in advance, and sorry if i didn't use the goods terms, it is certainly why i didn't find an answer
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43010485
comment on: http://stackoverflow.com/q/27269889
score: 0
has text: Added. Please check.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43080388
type: Comment
type: QuestionComment
has text: Did you try writing some code?
score: 0
comment on: http://stackoverflow.com/q/27309339

http://stackoverflow.com/q/27292471
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27292688
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/27292663
accepted answer: http://stackoverflow.com/a/27292663
linked to: http://stackoverflow.com/q/21973543
upvote count: 1
possible better answer: http://stackoverflow.com/a/27292849
has answer: http://stackoverflow.com/a/27292739
favorite count: 0
has title: doGet or doPost method invocation
has answer: http://stackoverflow.com/a/27292849
answer count: 4
type: AnsweredQuestion
has body: How does the servlet container know whether to call doGet or doPost method. When I make a get request doGet is called, When I make a post request doPost is called , but where is the logic to decide this .
downvote count: 0
tagged with: servlet-container
duplicate of: http://stackoverflow.com/q/21973543

http://stackoverflow.com/a/27172542
has comment: http://stackoverflow.com/comment/42835705
has comment: http://stackoverflow.com/comment/42837301
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/27172448
has comment: http://stackoverflow.com/comment/42835802
has comment: http://stackoverflow.com/comment/42837899
has comment: http://stackoverflow.com/comment/42845226
downvote count: 0
has body: Uncommented main method is a CheckStyle warning that the main() method is not commented-out. You are not supposed to have debug/test main() methods in your code. You can exclude your program entry point class using something like: &lt;module name="UncommentedMain"&gt; &lt;property name="excludedClasses" value="\.Main$"/&gt; &lt;/module&gt; See also http://checkstyle.sourceforge.net/config_misc.html#UncommentedMain
score: 8

http://stackoverflow.com/comment/42919915
type: AnswerComment
has text: To schematize a little bit : Guice was a first attempt at dependency injection. I am not too familiar with RoboGuice, but it looks pretty close to Guice with the addition of some Android helper methods, like view injection (the concept might look similar, but it is very different from DI). The limitation of Guice for Android is that it has been written for huge server farms and it does not scale well to Android. Specifically, Android is not very good with reflection and Guice uses it a lot.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27179484

http://stackoverflow.com/comment/43021439
has text: *"I'm using a book to learn java."* If that code above is a result, I don't think it is a very good book.. BTW - The `main(String[])` method usually creates an instance of the class it is in. This one I would have expected to be more like `Buttons gui = new Buttons(); gui.setVisible(true);`..
comment on: http://stackoverflow.com/q/27276084
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27234440
has body: The below is the OWASP regular expression which i'm using to validate the File paths. but it's not working as expected. please find the below details. Regular expression for file path = "^[a-zA-Z0-9:/\\\\!@#$%^&amp;{}\\[\\]()_+\\-=,.~'` ]{1,255}$"; Input1 = "E:\Hello\One\FilePath1\"; Input2 = "E:\Hello\One\1FilePath\"; The regular expression for file path works for Input1 and not for Input2. The reason is in Input2 after slash \ immediately if digit comes it's failing the validation. Can somebody please help on this pattern modification. Thank you :)
score: 0
has answer: http://stackoverflow.com/a/38874379
tagged with: validation
has comment: http://stackoverflow.com/comment/42982395
answer count: 1
has comment: http://stackoverflow.com/comment/43219281
has comment: http://stackoverflow.com/comment/42945964
type: UnansweredQuestion
tagged with: path
tagged with: owasp
tagged with: regex
tagged with: java
has comment: http://stackoverflow.com/comment/42971922
has comment: http://stackoverflow.com/comment/43204963
type: Question
has title: OWASP Regular expression for file path in java not working as expected

http://stackoverflow.com/comment/42820481
type: QuestionComment
comment on: http://stackoverflow.com/q/27163714
score: 0
has text: Please show your `.ini` file, as well as any possible commands you use when launching
type: Comment

http://stackoverflow.com/q/27227961
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/42935955
score: 9
answer count: 2
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
has title: An internal error occurred during: "Refreshing Process Information". java.lang.NullPointerException
tagged with: eclipse-luna
type: UnansweredQuestion
has body: Whenever I create a folder under WebContent in Eclipse Luna, this pops up even though the folder gets created. The message is: Problem Occured 'Refreshing Process Information' has encountered a problem. An internal error occurred during: "Refreshing Process Information". An internal error occurred during: "Refreshing Process Information". java.lang.NullPointerException Why the java.lang.NullPointerException? EDIT: Attached Error Log: These are the problems listed: (X) An internal error occurred during: "Refreshing Process Information". (!) Warning: The environment variable HOME is not set. The following directory will be used to store the Git (!) Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level (X) Could not bind a reference of component Active Customer. The reference is: Reference[name = AnalyzationAndRenderService, interface = j... (X) Could not bind a reference of component Active Customer. The reference is: Reference[name = AnalyzationAndRenderService, interface = j... (!) [SCR] ComponentReference.bind(): bind method 'setAnalyzationAndRenderService' not found or it is not accessible! (!) [SCR] Could not get the service object relevant to the reference. One possible reason is a circulation problem. Another possible reason is that Bu... (X) FrameworkEvent ERROR (X) Exception occurred while creating new instance of component Component[ (X) Exception occurred while creating new instance of component Component[
has answer: http://stackoverflow.com/a/35168947
has comment: http://stackoverflow.com/comment/42936085
has answer: http://stackoverflow.com/a/29770477
type: Question
has comment: http://stackoverflow.com/comment/42934791

http://stackoverflow.com/a/27176040
answers question: http://stackoverflow.com/q/27175687
has body: This is kind of the purpose of the constructor. Since you have created a new class, Main_Window, you should include the code you want to run during the creation of the main window there. While your current definition of the Main_Window class is not present, it would be something like this. public class Main_Window extends ?Frame implements ? { // members // constructor Main_Window(){ //do some stuff here } // methods }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42841580
type: Answer
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/27175687

http://stackoverflow.com/comment/42953000
type: Comment
has text: I have another reference, and I want to check if it's still in the list. Do you know what I mean?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27238166

hibernate
tags question: http://stackoverflow.com/q/27205811
tags question: http://stackoverflow.com/q/27274306
tags question: http://stackoverflow.com/q/27155241
tags question: http://stackoverflow.com/q/27288127
tags question: http://stackoverflow.com/q/27244120
tags question: http://stackoverflow.com/q/27198495
tags question: http://stackoverflow.com/q/27174697
tags question: http://stackoverflow.com/q/27220743
tags question: http://stackoverflow.com/q/27184424
tags question: http://stackoverflow.com/q/27276602
tags question: http://stackoverflow.com/q/27290978
tags question: http://stackoverflow.com/q/27252431
tags question: http://stackoverflow.com/q/27159875
tags question: http://stackoverflow.com/q/27204626
tags question: http://stackoverflow.com/q/27194661
tags question: http://stackoverflow.com/q/27178593
tags question: http://stackoverflow.com/q/27227983
tags question: http://stackoverflow.com/q/27217860
tags question: http://stackoverflow.com/q/27205652
tags question: http://stackoverflow.com/q/27286257
tags question: http://stackoverflow.com/q/27261812
tags question: http://stackoverflow.com/q/27272260
tags question: http://stackoverflow.com/q/27274302
tags question: http://stackoverflow.com/q/27298487
tags question: http://stackoverflow.com/q/27310243
tags question: http://stackoverflow.com/q/27310487
tags question: http://stackoverflow.com/q/27271175
tags question: http://stackoverflow.com/q/27264709
tags question: http://stackoverflow.com/q/27289959
tags question: http://stackoverflow.com/q/27277233
tags question: http://stackoverflow.com/q/27170469
tags question: http://stackoverflow.com/q/27243303
tags question: http://stackoverflow.com/q/27246406
tags question: http://stackoverflow.com/q/27248205
tags question: http://stackoverflow.com/q/27226056
tags question: http://stackoverflow.com/q/27254163
tags question: http://stackoverflow.com/q/27188426
tags question: http://stackoverflow.com/q/27264707
tags question: http://stackoverflow.com/q/27155084
tags question: http://stackoverflow.com/q/27196902
tags question: http://stackoverflow.com/q/27179144
tags question: http://stackoverflow.com/q/27285442
tags question: http://stackoverflow.com/q/27220363
tags question: http://stackoverflow.com/q/27269059
tags question: http://stackoverflow.com/q/27272264
tag name: hibernate
tags question: http://stackoverflow.com/q/27289768
tags question: http://stackoverflow.com/q/27154954
tags question: http://stackoverflow.com/q/27169120
tags question: http://stackoverflow.com/q/27202203
tags question: http://stackoverflow.com/q/27266175
tags question: http://stackoverflow.com/q/27189102
tags question: http://stackoverflow.com/q/27229817
tags question: http://stackoverflow.com/q/27271537
tags question: http://stackoverflow.com/q/27184960
tags question: http://stackoverflow.com/q/27293367
tags question: http://stackoverflow.com/q/27295842
tags question: http://stackoverflow.com/q/27204132
tags question: http://stackoverflow.com/q/27159829
tags question: http://stackoverflow.com/q/27152919
tags question: http://stackoverflow.com/q/27250720
tags question: http://stackoverflow.com/q/27230426
tags question: http://stackoverflow.com/q/27230398
tags question: http://stackoverflow.com/q/27258555
tags question: http://stackoverflow.com/q/27156114
tags question: http://stackoverflow.com/q/27163591
tags question: http://stackoverflow.com/q/27219959
tags question: http://stackoverflow.com/q/27175845
tags question: http://stackoverflow.com/q/27280383
tags question: http://stackoverflow.com/q/27212600
tags question: http://stackoverflow.com/q/27175665
tags question: http://stackoverflow.com/q/27304580
tags question: http://stackoverflow.com/q/27239857
tags question: http://stackoverflow.com/q/27286045
tags question: http://stackoverflow.com/q/27162987
tags question: http://stackoverflow.com/q/27257207
tags question: http://stackoverflow.com/q/27312821
tags question: http://stackoverflow.com/q/27272416
tags question: http://stackoverflow.com/q/27229121
tags question: http://stackoverflow.com/q/27201791

http://stackoverflow.com/a/27277597
type: AcceptedAnswer
has body: Found it finally. I needed to go into Preferences->EditBox then click on each color in the preview pane. Setting it anywhere else would not work. H
answers question: http://stackoverflow.com/q/27261724
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27261724

http://stackoverflow.com/comment/43027483
type: Comment
type: QuestionComment
has text: As an update, I'm still getting 9 as a generator for Z*11 in my example.
comment on: http://stackoverflow.com/q/27277357
score: 0

http://stackoverflow.com/q/27225789
tagged with: jpa
has answer: http://stackoverflow.com/a/27226421
has title: GAE and JPA - java.lang.NoSuchMethodError: org.datanucleus.store.ExecutionContext.findObject
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
downvote count: 0
score: 1
tagged with: java
has body: I'm using Google app engine and JPA for my application. I need to call REST API to insert and get records.Insertion of the records to the table works fine,but when I use select query it is giving tons of error. Error Trace is : java.lang.NoSuchMethodError: org.datanucleus.store.ExecutionContext.findObject(Ljava/lang/Object;Lorg/datanucleus/store/FieldValues;Ljava/lang/Class;Z)Ljava/lang/Object; at com.google.appengine.datanucleus.query.DatastoreQuery.entityToPojoPrimaryKey(DatastoreQuery.java:543) at com.google.appengine.datanucleus.query.DatastoreQuery.access$100(DatastoreQuery.java:115) at com.google.appengine.datanucleus.query.DatastoreQuery$1.apply(DatastoreQuery.java:221) at com.google.appengine.datanucleus.query.DatastoreQuery$1.apply(DatastoreQuery.java:219) at com.google.appengine.datanucleus.query.LazyResult.resolveNext(LazyResult.java:96) at com.google.appengine.datanucleus.query.LazyResult.resolveAll(LazyResult.java:121) at com.google.appengine.datanucleus.query.LazyResult.size(LazyResult.java:115) at com.google.appengine.datanucleus.query.StreamingQueryResult.size(StreamingQueryResult.java:151) at org.datanucleus.store.query.AbstractQueryResult.toArray(AbstractQueryResult.java:400) at java.util.ArrayList.addAll(Unknown Source) at org.datanucleus.query.evaluator.JavaQueryEvaluator.execute(JavaQueryEvaluator.java:160) at org.datanucleus.query.evaluator.JPQLEvaluator.execute(JPQLEvaluator.java:112) at com.google.appengine.datanucleus.query.JPQLQuery.performExecute(JPQLQuery.java:200) at org.datanucleus.store.query.Query.executeQuery(Query.java:1789) at org.datanucleus.store.query.Query.executeWithMap(Query.java:1693) at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:185) And for select query I use CriteriaAPI of JPA : CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<Technology> cq = cb.createQuery(Technology.class); Root<Technology> e = cq.from(entityManager.getMetamodel().entity(Technology.class)); cq.where(cb.equal(e.ge…
type: Question

http://stackoverflow.com/comment/43560205
score: 0
type: Comment
has text: Sad to hear you have to do a custom implementation now. If only Hibernate can do what you require at the moment maybe it would make sense to request this as a feature of an upcoming JPA release?
comment on: http://stackoverflow.com/a/27464206
type: AnswerComment

http://stackoverflow.com/q/27283022
has comment: http://stackoverflow.com/comment/43073863
has comment: http://stackoverflow.com/comment/43034413
tagged with: java
tagged with: graph-databases
has title: OrientDB Repeated Corruption
score: 0
has comment: http://stackoverflow.com/comment/43047914
has body: I'm trying to build a Java application using Wicket as a front end and OrientDB as the database. Three times today, my databases have been corrupted, once while trying to perform a backup. I am confident that I am doing something wrong. There appears to be a console command to repair the database but I cannot connect to the database to use it. My Java web app connects to my graph database using the Graph API. At first I was using plocal mode, but now I am using remote even though the DB is local to my box. I am also connecting to OrientDB via the provided console and the web interface. Here is the error message I am receiving: orientdb&gt; connect remote:localhost/grctestdb admin password Connecting to database [remote:localhost/grctestdb] with user 'admin'... Error: com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/opt/orientdb/databases/grctestdb' with mode=rw Error: com.orientechnologies.orient.core.exception.OSerializationException: Cannot load database's configuration. The database seems to be corrupted. Error: com.orientechnologies.common.io.OIOException: You cannot access outside the file size (0 bytes). You have requested portion 0-4 bytes. File: File: database.ocf os-size=1024, stored=0, filled=0, max=0 The only connection between the three corruption events is that I am always notified of the corruption via the Console first, then my application reports the same error in a stack trace the next time I fire it up. Any guidance would be greatly appreciated.
tagged with: nosql
answer count: 0
type: UnansweredQuestion
tagged with: orientdb
type: Question
has comment: http://stackoverflow.com/comment/43067758

http://stackoverflow.com/q/27261610
answer count: 2
has answer: http://stackoverflow.com/a/27266279
has body: I am programming a simple Top Down Shooter right now. The player is able to hold the down mouse to continously shoot. Since there is no native way to check if the mouse button is held down I implemented this solution: https://stackoverflow.com/a/6828990/3716866 This works perfectly fine. But the problem is that I put each bullet object and each GameObject (enemies, player, barrels, etc.) in a Linked List (two lists one for the objects, one for the bullets). When you shoot a bullet it get's added to the LinkedList. Each runthrough of the gameloop the whole List get's checked through for collision. After firing about 2 shots the game crashes with a Null Pointer Exception. I think the problem is, since I use a second thread to implement the mouse button hold down, that a bullet object is getting created while in the other thread it checks through the list. Since I am checking through the list, while the size is getting altered it is checking through the list, it crashes. But that is just my theory. Anybody got an idea on how to keep them at synch? If you need more code etc. just tell me and I will upload it. I just wasn't sure what I should post. So before I spam everything I wanted to wait for your feedback. The Exception: Exception in thread "Thread-2" java.lang.NullPointerException at shooter.main.Handler.checkForCollision(Handler.java:50) at shooter.main.Handler.tick(Handler.java:41) at shooter.main.Game.tick(Game.java:189) at shooter.main.Game.run(Game.java:290) at java.lang.Thread.run(Unknown Source) Handler Class that runs all the tick and update methods for every Object, including collision: http://pastebin.com/mb206jug My MouseListener Class where the other Thread is implemented: http://pastebin.com/LfGWa5se My Main Game class, although I don't think it will be very important for this problem: http://pastebin.com/kW3UmZuD My abstract GameObject Class: http://pastebin.com/HbsdCUch Example of a GameObject: http://pastebin.com/vXCWZwtf My abstract Ammo Class: htt…
has answer: http://stackoverflow.com/a/27263145
has comment: http://stackoverflow.com/comment/43003783
score: 0
has comment: http://stackoverflow.com/comment/43003114
tagged with: mouselistener
type: UnansweredQuestion
tagged with: multithreading
tagged with: mouse
has comment: http://stackoverflow.com/comment/43008112
tagged with: java
has title: Java - Two threads out of synch
has comment: http://stackoverflow.com/comment/42998791
type: Question
linked to: http://stackoverflow.com/q/6828684

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/27239534
type: Tag
tags question: http://stackoverflow.com/q/27193111
tags question: http://stackoverflow.com/q/27233610

http://stackoverflow.com/comment/48278079
has text: Yes, but you can also give the marker interface a name unique to your project and then the annotation can look like @ComponentScan(basePackageClasses = {TwitterClient.class, EvernoteClient.class})
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27267657
type: Comment

http://stackoverflow.com/comment/42824180
type: Comment
score: 0
type: AnswerComment
has text: I have provided another example in the answer, however this isn't what you were asking.
comment on: http://stackoverflow.com/a/27165954

http://stackoverflow.com/comment/43027509
score: 0
type: AnswerComment
type: Comment
has text: You're correct! My `Equivalence.doHash()` impl didn't satisfy the distributable property. I.e. `doHash(p1) != doHash(p2)` - incorrectly.
comment on: http://stackoverflow.com/a/27279298

http://stackoverflow.com/q/27295356
type: Question
has comment: http://stackoverflow.com/comment/43055737
has comment: http://stackoverflow.com/comment/43056503
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27297487
has comment: http://stackoverflow.com/comment/43056855
has comment: http://stackoverflow.com/comment/43059310
tagged with: http://stackoverflow.com/tag/csv
has body: i have a performance problem when trying to create a csv file starting from another csv file. this is how the original file looks: country,state,co,olt,olu,splitter,ont,cpe,cpe.latitude,cpe.longitude,cpe.customer_class,cpe.phone,cpe.ip,cpe.subscriber_id COUNTRY-0001,STATE-0001,CO-0001,OLT-0001,OLU0001,SPLITTER-0001,ONT-0001,CPE-0001,28.21487,77.451775,ALL,SIP:+674100002743@IMS.COMCAST.NET,SIP:E28EDADA06B2@IMS.COMCAST.NET,CPE_SUBSCRIBER_ID-QHLHW4 COUNTRY-0001,STATE-0002,CO-0002,OLT-0002,OLU0002,SPLITTER-0002,ONT-0002,CPE-0002,28.294018,77.068924,ALL,SIP:+796107443092@IMS.COMCAST.NET,SIP:58DD999D6466@IMS.COMCAST.NET,CPE_SUBSCRIBER_ID-AH8NJQ potentially it could be millions of lines like this, i have detected the problem with 1.280.000 lines. this is the algorithm: File csvInputFile = new File(csv_path); int blockSize = 409600; brCsvInputFile = new BufferedReader(frCsvInputFile, blockSize); String line = null; StringBuilder sbIntermediate = new StringBuilder(); skipFirstLine(brCsvInputFile); while ((line = brCsvInputFile.readLine()) != null) { createIntermediateStringBuffer(sbIntermediate, line.split(REGEX_COMMA)); } private static void skipFirstLine(BufferedReader br) throws IOException { String line = br.readLine(); String[] splitLine = line.split(REGEX_COMMA); LOGGER.debug("First line detected! "); createIndex(splitLine); createIntermediateIndex(splitLine); } private static void createIndex(String[] splitLine) { LOGGER.debug("START method createIndex."); for (int i = 0; i &lt; splitLine.length; i++) headerIndex.put(splitLine[i], i); printMap(headerIndex); LOGGER.debug("COMPLETED method createIndex."); } private static void createIntermediateIndex(String[] splitLine) { LOGGER.debug("START method createIntermediateIndex."); com.tekcomms.c2d.xml.model.v2.Metadata_element[] metadata_element = null; String[] servicePath = newTopology.getElement().getEntity().getService_path().getLevel(); if (newTopology.getElement().getMetadata() != null) metadata_element = newTopology.g…
has title: creating large csv files in Java getting really slow
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27295708
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/27297487
possible better answer: http://stackoverflow.com/a/27295708

jackson
tags question: http://stackoverflow.com/q/27246955
tags question: http://stackoverflow.com/q/27178761
tags question: http://stackoverflow.com/q/27238657
tags question: http://stackoverflow.com/q/27274855
tags question: http://stackoverflow.com/q/27271604
tags question: http://stackoverflow.com/q/27260007
tags question: http://stackoverflow.com/q/27275127
tags question: http://stackoverflow.com/q/27271179
tags question: http://stackoverflow.com/q/27178461
type: Tag
tags question: http://stackoverflow.com/q/27154631
tags question: http://stackoverflow.com/q/27277724
tags question: http://stackoverflow.com/q/27244431
tags question: http://stackoverflow.com/q/27230010
tags question: http://stackoverflow.com/q/27251891
tags question: http://stackoverflow.com/q/27222744
tags question: http://stackoverflow.com/q/27173780
tag name: jackson
tags question: http://stackoverflow.com/q/27272391
tags question: http://stackoverflow.com/q/27301869
tags question: http://stackoverflow.com/q/27288261
tags question: http://stackoverflow.com/q/27279322
tags question: http://stackoverflow.com/q/27282681
tags question: http://stackoverflow.com/q/27162669
tags question: http://stackoverflow.com/q/27283479
tags question: http://stackoverflow.com/q/27275280
tags question: http://stackoverflow.com/q/27167816
tags question: http://stackoverflow.com/q/27240803
tags question: http://stackoverflow.com/q/27247767

http://stackoverflow.com/q/27238918
has comment: http://stackoverflow.com/comment/42954630
answer count: 1
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27239086
has body: Is it possible to add column and value on select statement based on some condition. I am trying to add column called status to my result which will display either active or inactive based on the condition check. I have two columns start date and end date in table. I am sending a date to sql so my select statement should test if this date is between start and end date and set active/inactive text in new column. I am getting active record with following SQl statement now I want to have inactive status too. select last_name, first_name, 'ACTIVE' as status from vw_member where last_name like :lastname and first_name like :firstName and TO_DATE(:dateOfCall, 'MM/DD/YYYY') between start_date and end_date order by last_name, first_name;
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27239086
has title: Add column with result based on condition checking in SQL select statment
score: 0

http://stackoverflow.com/a/27157416
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27157333
answers question: http://stackoverflow.com/q/27157333
has body: That is because you keep adding columns to the model model.addColumn("id"); model.addColumn("miestas"); model.addColumn("adresas"); model.addColumn("pavadinimas"); model.addColumn("kaina"); model.addColumn("kiekis"); model.addColumn("data"); Repeats each time you call the method
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42809034
has comment: http://stackoverflow.com/comment/42809571

http://stackoverflow.com/comment/42980679
score: 0
has text: I guess i didn't explicit it in the top, i'll edit it, the problem is to convert timestamp in the MySQL.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27248133

http://stackoverflow.com/comment/42974796
has text: Thanks for the suggestion but in this case the year 999 will be match and it's not what I want. And my big problem is that, I have many different patterns attached to a different inputs. I'm looking for a generic solution if there is one.
comment on: http://stackoverflow.com/a/27249754
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27256429
has body: I'm new to JUnit and Hamcrest and would like best-practice advice so I can decided which documentation to study first. For starters, which of these assertThat methods is better? org.junit.Assert.assertThat (from junit-4.11.jar) org.hamcrest.MatcherAssert.assertThat (from hamcrest-core-1.3.jar) According to one person last year, "JUnit has the assertThat method, but hamcrest has its own assertThat method that does the same thing.". According to someone earlier this year, Hamcrest "could potentially give better error messages because the matcher is called to describe the mismatch". It's hard to tell which versions of Junit and Hamcrest were compared in those posts. So I'd like a recommendation based on the most current released versions.
accepted answer: http://stackoverflow.com/a/27256498
has title: Is org.junit.Assert.assertThat better than org.hamcrest.MatcherAssert.assertThat?
favorite count: 0
has answer: http://stackoverflow.com/a/40826531
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/40826531
tagged with: java
score: 23
type: Question
upvote count: 23
has answer: http://stackoverflow.com/a/27256498
answer count: 3
tagged with: hamcrest
has answer: http://stackoverflow.com/a/65255214
tagged with: junit
downvote count: 0

http://stackoverflow.com/q/27282474
has body: I have a PlayerCharacter class. PlayerCharacter can be extended (for example, VampirePlayerCharacter vs WerewolfPlayerCharacter) I have a Trait class. Trait can be extended (for example, Generation or Gnosis). PlayerCharacter has a method, #withTrait(Trait), which adds the Trait to a collection. PlayerCharacter has a method, #applyAllTraits() which loops through the collection and applies each of them to the character. A VampirePlayerCharacter should be able to be given any Trait that could apply to a PlayerCharacter, as well as any Trait that could only apply to a VampirePlayerCharacter. So I added a generic type, making Trait&lt;PC extends PlayerCharacter&gt; Thus, there can be BasicTrait&lt;PlayerCharacter&gt; and Generation&lt;VampirePlayerCharacter&gt; My conundrum: If PlayerCharacter's collection of traits is Collection&lt;Trait&lt;PlayerCharacter&gt;&gt;, then VampirePlayerCharacter can't add a Trait&lt;VampirePlayerCharacter&gt; to the collection. If PlayerCharacter's collection of traits is Collection&lt;Trait&lt;? extends PlayerCharacter&gt;&gt;, then VampirePlayerCharacter can add a Trait&lt;VampirePlayerCharacter&gt; to the collection. However, PlayerCharacter can no longer loop through the traits, because their type is indeterminate (it could be Trait&lt;PlayerCharacter&gt; or a Trait&lt;VampirePlayerCharacter&gt; or a Trait&lt;WerewolfPlayerCharacter&gt; or...) If PlayerCharacter's collection of traits is Collection&lt;Trait&lt;? super PlayerCharacter&gt;&gt;, then VampirePlayerCharacter can't add a Trait&lt;VampirePlayerCharacter&gt;, because VampirePlayerCharacter isn't a supertype of PlayerCharacter I'm about a hair's-breadth from saying that more specialized traits just have to use a cast in their apply method and if you set things up inappropriately, they'll explode- but I'm certain that this is not a novel problem, and I just can't wrap my head around the solution. class PlayerCharacter { private int str; List&lt;Trait&lt;?&gt;&gt; traits = new A…
score: 5
has comment: http://stackoverflow.com/comment/43034030
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43033552
type: AnsweredQuestion
upvote count: 5
has comment: http://stackoverflow.com/comment/43033509
has comment: http://stackoverflow.com/comment/43033430
has answer: http://stackoverflow.com/a/27283555
has comment: http://stackoverflow.com/comment/43033604
accepted answer: http://stackoverflow.com/a/27283555
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43033822
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/43033728
has title: Java generic fields
has comment: http://stackoverflow.com/comment/43033782
has comment: http://stackoverflow.com/comment/43033682

http://stackoverflow.com/a/27200712
upvote count: 4
has body: That's the problem: new REPEAT { i += 1; println(i) } UNTIL (i == 100) is equivalent to: new REPEAT() { i += 1; println(i) } UNTIL (i == 100) So you're actually creating new instance of REPEAT class with command = (), and i += 1; println(i) in constructor - so i++ repeated only once and () repeated infinitely. The right way to call it: new REPEAT({ i += 1; println(i) }) UNTIL (i == 100) The reason why is you don't have to specify single parameter with Unit type explicitly in scala: scala&gt; class Aaaa(a: Unit) defined class Aaaa scala&gt; new Aaaa //parenthesis is not required for 'new' res10: Aaaa = Aaaa@17de44d4 scala&gt; def aaaa(a: Unit) = 5 aaaa: (a: Unit)Int scala&gt; aaaa() res13: Int = 5
type: AcceptedAnswer
score: 4
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27200203
answers question: http://stackoverflow.com/q/27200203

jaxb
tags question: http://stackoverflow.com/q/27182975
tags question: http://stackoverflow.com/q/27278225
tags question: http://stackoverflow.com/q/27154736
tags question: http://stackoverflow.com/q/27295167
tags question: http://stackoverflow.com/q/27189830
tags question: http://stackoverflow.com/q/27246939
tags question: http://stackoverflow.com/q/27186620
tags question: http://stackoverflow.com/q/27213150
tags question: http://stackoverflow.com/q/27215058
tags question: http://stackoverflow.com/q/27257994
tags question: http://stackoverflow.com/q/27236222
tags question: http://stackoverflow.com/q/27158723
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/27282559
tags question: http://stackoverflow.com/q/27216542
tags question: http://stackoverflow.com/q/27241550
tags question: http://stackoverflow.com/q/27239406
tags question: http://stackoverflow.com/q/27165585
tags question: http://stackoverflow.com/q/27299623
tags question: http://stackoverflow.com/q/27204166
tags question: http://stackoverflow.com/q/27282681
tags question: http://stackoverflow.com/q/27254589

http://stackoverflow.com/q/27301611
has answer: http://stackoverflow.com/a/27302059
favorite count: 0
has answer: http://stackoverflow.com/a/27301665
type: AnsweredQuestion
has title: Not able to delete files in a given directory
score: 1
tagged with: java
upvote count: 1
has body: I am trying to write a program which will delete all duplicate files in a directory. It is currently able to detect duplicates, but my deleting code does not seem to be working (Files.delete() returns false). Can anybody tell me why this is? Current code: import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.SecurityManager; public class Duplicate { @SuppressWarnings("resource") public static boolean isDuplicate(File a, File b) throws IOException { FileInputStream as = new FileInputStream(a); FileInputStream bs = new FileInputStream(b); while(true) { int aBytes = as.read(); int bBytes = bs.read(); if(aBytes != bBytes) { return false; } else if(aBytes == -1) { System.out.println("Duplicate found: "+a.getName()+", "+b.getName()); return true; } } } public static void main(String[] args) throws IOException { File dir = new File(System.getProperty("user.dir")); File[] files = dir.listFiles(); for(int i = 0; i &lt; files.length; i++) { for(int j = i+1; j &lt; files.length; j++) { if(isDuplicate(files[i], files[j])) { String filePath = System.getProperty("user.dir").replace("\\", "/")+"/"+files[i].getName(); System.out.println("Deleting "+filePath); File f = new File(filePath); if(f.delete()) System.out.println(filePath+" deleted successfully"); else System.out.println("Could not delete "+filePath); } } } } }
accepted answer: http://stackoverflow.com/a/27301665
type: Question
answer count: 2
downvote count: 0
tagged with: duplicates
has comment: http://stackoverflow.com/comment/43066822
has comment: http://stackoverflow.com/comment/43066851
possible better answer: http://stackoverflow.com/a/27302059
tagged with: file-io

http://stackoverflow.com/a/27238197
downvote count: 0
answers question: http://stackoverflow.com/q/27238093
has body: In your situation, the only way to tell if a particular instance of an object is contained in the HashSet, is to iterate the contents of the HashSet, and compare the object identities ( using the == operator instead of the equals() method). Something like: boolean isObjectInSet(Object object, Set&lt;? extends Object&gt; set) { boolean result = false; for(Object o : set) { if(o == object) { result = true; break; } } return result; }
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27238093
score: 2

http://stackoverflow.com/a/27168830
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42829423
has comment: http://stackoverflow.com/comment/42829318
answers question: http://stackoverflow.com/q/27168421
has body: What about this: boolean flag = true; int firstExecution = 0; while(flag){ try{ firstExecution++; if(firstExecution==1){ //........ statement 1 // ....... statement 2 might throw an Exception } // ....... statement 3 - A compulsory statement needs to be executed even if exception is thrown. flag=false; } catch {} } And if you want to try to execute statement 2 again and again then you can shift the bracket below statement 2 to above it.

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/27282537
tags question: http://stackoverflow.com/q/27277210
tags question: http://stackoverflow.com/q/27278316
tags question: http://stackoverflow.com/q/27182319
type: Tag
tags question: http://stackoverflow.com/q/27268879

http://stackoverflow.com/comment/43048555
has text: Oh! Interesting. We're getting closer. Check the Cassandra logs. Is anything in there? Does it start at all, does it die immediatelly? If the log is not there at all, focus on the `startCassandra` command - what does it call?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27290679

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/27254442

http://stackoverflow.com/q/27264484
tagged with: web-services
tagged with: spring
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27264711
has answer: http://stackoverflow.com/a/51969239
score: 0
answer count: 3
type: UnansweredQuestion
has title: Spring read multipart attachment as input stream
has body: I'm developing a spring web service.Is there a way to read Multipart attachments in a soap message as a input stream with spring?
has answer: http://stackoverflow.com/a/27264576

http://stackoverflow.com/comment/42849728
has text: Use a `Set` to avoid duplicates
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27180553
type: Comment

http://stackoverflow.com/comment/42831211
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27166721
type: QuestionComment
has text: I'm talking about the EntityManager, not the Connection. The log tells you where the EM is closed.

http://stackoverflow.com/q/27186799
downvote count: 0
possible better answer: http://stackoverflow.com/a/44994576
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/44994576
type: Question
has answer: http://stackoverflow.com/a/27186861
upvote count: 51
has comment: http://stackoverflow.com/comment/42860362
has title: What are GC roots for classes?
has body: In Java, there are special objects called Garbage Collection Roots (GC roots). They serve as a root objects for Garbage Collection marking mechanism (see picture). This article describes four types of GC roots: local variables active threads static variables JNI references It is also mentioned, that: Classes themselves can be garbage-collected. GC roots aren't collected thus classes themselves are not GC roots. So what are GC roots for the classes?
answer count: 2
tagged with: garbage-collection
accepted answer: http://stackoverflow.com/a/27186861
score: 51
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/comment/42926420
has text: Well there are spurious "-" signs in the XML you've provided, and if it's really nothing to do with the tokenization, that suggests it's an issue in how you're using the XML APIs... so you should be able to reproduce that in a simple program which *isn't* doing any tokenization. Currently with the tokenization mixed in with the XML output, it's a lot hard to diagnose the issue. (You might want to consider tokenizing to some class structure first, to separate the two steps entirely.) Also, I would *strongly* urge you to avoid using raw types such as `ArrayList` - always use the generic form.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27223002

http://stackoverflow.com/comment/43019212
comment on: http://stackoverflow.com/a/27257548
type: AnswerComment
score: 0
type: Comment
has text: Maybe I'm being a bit dense, but I'm still unsure how to apply this to my particular situation. It seems that the [SortTest](https://github.com/hibernate/hibernate-search/blob/b8c78df7403f42ab3f8f73603b01a944cab0a47d/orm/src/test/java/org/hibernate/search/test/query/SortTest.java) you referenced operates on properties of the `NumberHolder` class, where I'd be using a date range that the date on the `Hit` class would need to appear within. Also, how would `Hit`s that didn't fall within the range be excluded? (These would have a 0 count). Or would this need to happen outside of the sort?

http://stackoverflow.com/q/27290679
tagged with: cassandra
has title: Cassandra won't start on OSX "Reason: Connection refused."
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43048777
score: 1
has comment: http://stackoverflow.com/comment/43048555
tagged with: java
upvote count: 1
has body: I'm working on a java project in which cassandra is included in the repository itself. I'm having trouble getting it to run however, receiving the following error: /Users/xxx/dev/xxxx/build/cassandra/bin/cassandra-cli -h localhost -p 9052 -f /Users/xxx/dev/xxxx/schema.txt return code: 0 stderr: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused at org.apache.thrift.transport.TSocket.open(TSocket.java:183) at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81) at org.apache.cassandra.cli.CliMain.connect(CliMain.java:73) at org.apache.cassandra.cli.CliMain.main(CliMain.java:249) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.thrift.transport.TSocket.open(TSocket.java:178) ... 3 more Exception connecting to localhost/9052. Reason: Connection refused. stdout: Not connected to a cassandra instance. Not connected to a cassandra instance. I've tried altering the port and the localhost hostname to 127.0.0.1 and 0.0.0.0 but this makes no difference really. I'm using java version "1.7.0_71" Any ideas would be appreciated, thanks
type: Question
has answer: http://stackoverflow.com/a/27355093
has comment: http://stackoverflow.com/comment/43047971
has comment: http://stackoverflow.com/comment/43048367
accepted answer: http://stackoverflow.com/a/27355093
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/42932196
score: 0
comment on: http://stackoverflow.com/q/27226232
has text: @mKorbel. I've updated my question slightly. By factory I meant 'instance factory', which I use as a general Java pattern term, not specific to Swing. I was hoping to find an object factory for TableCellRenderers somewhere in Swing, but there isn't one.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27247467
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: websphere
has comment: http://stackoverflow.com/comment/42969859
has comment: http://stackoverflow.com/comment/42969750
downvote count: 0
has body: When I go to my webApplication I get the following exception: Error 500: javax.servlet.ServletException: Filter [Encoding]: Could not find required filter class - my.packagename.filter.EncodingFilter.class In the console I get: com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[action]: java.lang.ClassNotFoundException: class java.lang.ClassNotFoundException: my.packagename.filter.EncodingFilter In my web.xml I have the following configuration: Encoding my.packagename.filter.EncodingFilter encoding UTF-8 I verified that this class exists in my project (projectName\src\my\packagename\filter\EncodingFilter.java) and that it implements the Filter interface. What could be wrong? How can I solve this?
tagged with: websphere-7
has title: Why do I get ServletException - ClassNotFoundException?

http://stackoverflow.com/comment/43054726
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27238037
has text: I appreciate that. I want to give OSGi a try, but I am thinking to play in the SPI sandbox a little bit first because I think that it has a quicker learning curve, some of the conversations are similar, and that there is a degree of transferable knowledge. I marked this post as "the answer" because it is the correct answer to the question as I phrased it, but I wonder if SPI isn't the right choice for me right now.

http://stackoverflow.com/a/27241562
has body: Use Jstl rather than scriptlets for further Explanation use EL - Expression Language (${variable}) to get the Value eg. ${welcome} &lt;c:out value="${some varibale that holds the data from database}"/&gt;
type: Answer
answers question: http://stackoverflow.com/q/27231579
score: 0

http://stackoverflow.com/q/27279371
has comment: http://stackoverflow.com/comment/43030707
tagged with: processbuilder
type: UnansweredQuestion
tagged with: multithreading
has title: Java Multithreading: How can i start external Java Programs, which are executing threads?
has comment: http://stackoverflow.com/comment/43046025
has body: currently, i'm trying to write a programm, which should execute a seperate Java-program multiple times, but with different parameters. This executed Java-program calls a Thread-Class. Within this class, a connection to a (Game)Server is established. Once connected, the Threads sends a command to turn the connected player around every 10 milliseconds. I have 2 "solutions" for this: The easy (working) one: public class GeneralAgentTest { public static void main(String [] args){ Thread thread = new Thread(new HexagonRunner("127.0.0.1",6000,"UnitedTestors",-30,-15)); thread.start(); } } This is working correctly, but not actually my goal. I need to start several of this Threads (new Thread(new HexagonRunner("127.0.0.1",6000,"UnitedTestors",-30,-15)); ) and each of this threads must be handled by a seperate process. To do this, i wrote some code with an ProcessBuilder. This is within one class. Second not correctly working one: public void execute(Class class1, int a, String str, String team, String x, String y) { ProcessBuilder builder; String javaHome = System.getProperty("java.home"); String javaBin = javaHome + File.separator + "bin" + File.separator + "java"; String classpath = System.getProperty("java.class.path"); String className = class1.getCanonicalName(); builder = new ProcessBuilder(javaBin, "-cp", classpath, className, ip, port, team, str, x, y); try { process[a] = builder.start(); } catch (Exception e) { e.printStackTrace(); System.out.println("failed"); } public void loadPlayers() { process = new Process[4]; for (int i = 0; i &lt; 4; i++) { try { execute(processes.StartProcesses.class, i, playerCombo[i].getSelectedItem().toString(), playerTeam[i].getText(), playerStartX[i].getText(), playerStartY[i].getText()); } catch (Exception e) { System.out.println("Failed to create processes for players"); e.printStackTrace(); } } } These are the functions i wrote, to execute the class(es) who is/are starting the thread(s). Following class is executed: public class S…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27279601
has comment: http://stackoverflow.com/comment/43031387
score: 0
has comment: http://stackoverflow.com/comment/43046655
answer count: 1

http://stackoverflow.com/a/27189320
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27182287
answers question: http://stackoverflow.com/q/27182287
has comment: http://stackoverflow.com/comment/42962189
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42919237
score: 2
has comment: http://stackoverflow.com/comment/43035950
has body: EDIT Split the line via separator I'm assuming your input file contains each entry on one line. In that case, replace onUploadFile with this code. It uses Scanner to read the inputstream line by line. Do what you want with each line. public void onUploadFile(ActionEvent actionEvent) { if (file != null &amp;&amp; inputstream != null) { fileName = file.getFilename(); System.out.println("Notepad Name: " + fileName); final Scanner scanner = new Scanner(inputstream); while (scanner.hasNextLine()) { String line = scanner.nextLine(); //do somthing with the current line, like store each one in a list System.out.println(line); String[] lineElements=line.split(" "); //16/05/2014 17:19:00 6685 00:00:31 //in your case lineElements[0] should be a date //lineElements[1] is a timestamp linked to the before date //lineElements[2] is a number (int) //lineElements[3] is a timestamp //build string from elements [0] and [1] then transform it to a date //add logic for adding to database... } } if (inputFile != null) { inputFile.resetValue(); inputFile.setValid(true); } }
has comment: http://stackoverflow.com/comment/42962139

http://stackoverflow.com/comment/42976780
type: QuestionComment
has text: What is `tempMatrix`'s type? You haven't shown us how you create that.
score: 1
comment on: http://stackoverflow.com/q/27251310
type: Comment

http://stackoverflow.com/q/27226663
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42932131
type: Question
has comment: http://stackoverflow.com/comment/42931240
answer count: 1
tagged with: struts2
score: 0
has title: Database values not displaying in the webpage?
has comment: http://stackoverflow.com/comment/42931508
type: UnansweredQuestion
tagged with: spring
has body: I am using Struts 2 + Hibernate in my project. I am relatively new to this field though. I am able to get the required values in Java code, but not able to get them in the JSP page. This is my struts.xml: listTweet /showTweet.jsp This is my JSP page: Home Page. <%@taglib uri="/struts-tags" prefix="s"%> Welcome <% String username = request.getParameter("username"); out.println(username); %> Tweet: <s:form action="message"> <s:textarea name="message" /> <s:submit /> </s:form> Show Tweets: <s:form action="listTweet" > <s:submit /> </s:form> From JSP, on clicking show tweet button, it should map to the listTweet in struts.xml and should go to list() method of TweetAction.java class. TweetAction.java: package com.vaannila.web; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.vaannila.dao.TweetDAO; import com.vaannila.dao.TweetDAOImpl; import com.vaannila.dao.UserDAO; import com.vaannila.dao.UserDAOImpl; import com.vaannila.domain.Tweet; import com.vaannila.domain.User; public class TweetAction extends ActionSupport implements ModelDriven<Tweet>,SessionAware{ private User user = new User(); private List<User> userList = new ArrayList<User>(); private UserDAO userDAO = new UserDAOImpl(); //UserDAO interface, UserDAOImpl implements it. private boolean isAuthentic = false; private Tweet tweet = new Tweet(); private List<Tweet> tweetList = new ArrayList<Tweet>(); //TweetDAO interface, TweetDAOImpl implements it. private TweetDAO tweetDAO = new TweetDAOImpl(); public Tweet getModel() { // TODO Auto-generated method stub return tweet; } public String list() { System.out.println("inside list method"); tweetList = tweetDAO.listTweet(); System.out.println("exiting list method"); return SUCCESS; } public String add() { System.out.println("inside put message"); tweet.setUser_id(user.getUser_id()); System.out.…
has answer: http://stackoverflow.com/a/27248546

http://stackoverflow.com/q/27243073
has answer: http://stackoverflow.com/a/27243132
duplicate of: http://stackoverflow.com/q/8696506
tagged with: http://stackoverflow.com/tag/xml
has title: displaying a Prepopulated database as a listview
linked to: http://stackoverflow.com/q/8696506
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42961900
tagged with: java
has body: I am trying to display multiple columns of a database inside a listview. i am using sqliteasset helper and a row.xml and main.xml. my mainactivity extends a listactivity. The error i'm getting is that the findviewbyid can't find a linear layout with "R.id.list" but my activity_main.xml has it. this is my main class that displays the database info on the list. public class MainActivity extends ListActivity { private Cursor schedule; private MyDatabase db; ListView listView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new MyDatabase(this); schedule = db.getSchedule(); ListView listView = (ListView) findViewById(android.R.id.list); listView.setAdapter(new SimpleCursorAdapter( this, // The context R.layout.row, // The layout of the row to show db.getSchedule(), // Here the cursor where the data is // but it can be anything new String[] {"fName", "fType" }, // here the tables to show new int[] { android.R.id.text1, android.R.id.text2 }, // here where to show? the IDs // of the layout elements where put data. 0)); } @Override protected void onDestroy() { super.onDestroy(); schedule.close(); db.close(); } } Row: &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="10dp" android:text="TextView" android:textColor="#0000FF" android:textSize="25dp" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="10dp" android:text="TextView" android:textColor="#0000FF" android:textSize="25dp" /&gt; &lt;/LinearLayout&gt; Activity_Main: (you can see the id.list) &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" andr…
possible better answer: http://stackoverflow.com/a/27243132
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27243084
accepted answer: http://stackoverflow.com/a/27243084
tagged with: listview
score: 0
tagged with: android

http://stackoverflow.com/comment/42836506
comment on: http://stackoverflow.com/a/27172833
score: 0
type: Comment
has text: Hi, I get and "unexpected return value" when I add return "orderComplete.xhtml"
type: AnswerComment

inner-classes
tags question: http://stackoverflow.com/q/27224233
type: Tag
tags question: http://stackoverflow.com/q/27284667
tags question: http://stackoverflow.com/q/27181290
tags question: http://stackoverflow.com/q/27216232
tags question: http://stackoverflow.com/q/27165006
tags question: http://stackoverflow.com/q/27180729
tag name: inner-classes

http://stackoverflow.com/a/27263041
has comment: http://stackoverflow.com/comment/42998563
has comment: http://stackoverflow.com/comment/42998509
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27262905
has comment: http://stackoverflow.com/comment/42998540
has body: You can pass a Parameter by : Input Accept here System.out.println("Input here: " ); String input = scan.next(); // This how you gonna pass the parameter inputedByScanner(input); Your Method Accept it and print the inputed value. public void print inputedByScanner(String input){ System.out.println(input); }

http://stackoverflow.com/comment/43024091
score: 0
type: QuestionComment
type: Comment
has text: You are not ordering the table, nor selecting the row with `Book_ID` `1`, so it is quite possible you have a different row as a result.
comment on: http://stackoverflow.com/q/27277515

http://stackoverflow.com/comment/43016068
type: QuestionComment
comment on: http://stackoverflow.com/q/27263688
score: 0
type: Comment
has text: I have the 2d array declared for the txt file that contains the list of words and their conversion output. the issue is when i try to run, it gets stuck. and if the value exists... it will need to print out the corresponding value. thanks for the help thus far

sprite
tags question: http://stackoverflow.com/q/27236897
type: Tag
tag name: sprite

http://stackoverflow.com/q/27262231
has answer: http://stackoverflow.com/a/27262906
type: UnansweredQuestion
has body: I am having some problem when trying to refresh the rating bar after user submitted their rating. So basically I am passing the existing rating amount when certain button on my other Activity was triggered: viewDtlEventBtn.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Object[] obj = new Object[2]; obj[0] = String.valueOf(eventIDTV.getText()); obj[1] = eventReviewModel; new GetEventDetailAsyncTask(new GetEventDetailAsyncTask.OnRoutineFinished() { public void onFinish() { // Passing whole object with value into another activity Intent eventDtlIntent = new Intent(context, EventDetailMain.class); // Pass in a list of rating star together with amount eventDtlIntent.putExtra("eventPopulateStarObj", populateRatingStar); context.startActivity(eventDtlIntent); } }).execute(obj); } }); And I am populating the rating bar when onCreate(): ratingStarList = (ArrayList&lt;EventReview&gt;) i .getSerializableExtra("eventPopulateStarObj"); public void populateRatingProgressBar() { int totalStar = 0; // Get the total amount of rate records for (int j = 0; j &lt; ratingStarList.size(); j++) { if (ratingStarList.get(j).getStarAmt() != null) { totalStar += Integer.parseInt(ratingStarList.get(j) .getStarAmt()); } } txtTotalRate.setText(totalStar + " Ratings for this event"); // Set progress bar based on the each rates for (int i = 0; i &lt; ratingStarList.size(); i++) { if (ratingStarList.get(i).getStarAmt() != null) { if (ratingStarList.get(i).getEventReviewRate().equals("5")) { pb5Star.setProgress(Integer.parseInt(ratingStarList.get(i) .getStarAmt())); } else if (ratingStarList.get(i).getEventReviewRate() .equals("4")) { pb4Star.setProgress(Integer.parseInt(ratingStarList.get(i) .getStarAmt())); } else if (ratingStarList.get(i).getEventReviewRate() .equals("3")) { pb3Star.setProgress(Integer.parseInt(ratingStarList.get(i) .getStarAmt())); } else if (ratingStarList.get(i).getEventReviewRate() .equals("2")) { pb2Star.setProgress(Integer.parseInt(ratingStarList.get…
has title: Android refresh rating bar upon triggeration
tagged with: ratingbar
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43005024
answer count: 1
score: 0
tagged with: android
tagged with: android-asynctask

http://stackoverflow.com/a/35410102
accepted answer of: http://stackoverflow.com/q/27279322
upvote count: 1
score: 1
has body: Customized JSON Object using Serialization: An example: Loan Application (POJO Class) import java.io.Serializable; import org.webservice.business.serializer.LoanApplicationSerializer; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize(using=LoanApplicationSerializer.class) public class LoanApplication implements Serializable { private static final long serialVersionUID = 1L; private double amount; private String businessType; } package org.ovamba.business.serializer; import java.io.IOException; import org.webservice.business.dto.LoanApplication; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; public class LoanApplicationSerializer extends JsonSerializer<LoanApplication> { @Override public void serialize(LoanApplication prm_objObjectToSerialize, JsonGenerator prm_objJsonGenerator, SerializerProvider prm_objSerializerProvider) throws IOException, JsonProcessingException { if (null == prm_objObjectToSerialize) { } else { try { prm_objJsonGenerator.writeStartObject(); prm_objJsonGenerator.writeNumberField("amount", prm_objObjectToSerialize.getAmount()); prm_objJsonGenerator.writeStringField("businesstype", prm_objObjectToSerialize.getBusinessType()); } catch (Exception v_exException) { //ExceptionController.getInstance().error("Error while Serializing the Loan Application Object", v_exException); } finally { prm_objJsonGenerator.writeEndObject(); } } } }
answers question: http://stackoverflow.com/q/27279322
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27280050
type: Answer
answers question: http://stackoverflow.com/q/27279863
accepted answer of: http://stackoverflow.com/q/27279863
score: 0
type: AcceptedAnswer
has body: You can specify in the eclipse.ini file which JVM you want to use. The JVM does not even need to be installed, it is enough to unzip it to some folder. Simply create an entry like this: -vm C:\Java\JDK\1.6\bin\javaw.exe See also: https://wiki.eclipse.org/Eclipse.ini In Eclipse you can add the JVMs without having them installed as well: Windows / Preferences / Java > Installed JREs

http://stackoverflow.com/q/27168901
has answer: http://stackoverflow.com/a/32542121
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27168979
has comment: http://stackoverflow.com/comment/42832420
tagged with: return-value
has comment: http://stackoverflow.com/comment/42829131
score: 1
has answer: http://stackoverflow.com/a/27168960
tagged with: java
has body: I have my array class as shown below, when I run the program, it gives me this error message: Error: Main method not found in class SArray, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application I have no idea how I should modify my codes to solve this problem, cause it seems that there is no need for me to have a main method. public class SArray { public void setS(double[] S) {} public SArray(double[] S) { super(); } public double[][] getS(){ double[ ][ ] S = {{ x,x,x}, { x,x,x},{ x,x,x}}； for(int x = 0; x&lt;S.length; x++){ for(int y = 0; y&lt;S[x].length; y++){ System.out.println(S[x][y]); } } return S; } }
downvote count: 1
type: Question
tagged with: arrays
answer count: 6
has comment: http://stackoverflow.com/comment/42829164
has answer: http://stackoverflow.com/a/27168946
has comment: http://stackoverflow.com/comment/42829242
has comment: http://stackoverflow.com/comment/42829129
has title: How to return the value of a 2D array in java
has answer: http://stackoverflow.com/a/27168956
favorite count: 0
has answer: http://stackoverflow.com/a/27168994

http://stackoverflow.com/comment/42801563
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27153584
has text: Could you post the complete stack trace? Furthermore a bit more text besides the header would be nice!

http://stackoverflow.com/comment/42972782
score: 0
type: AnswerComment
type: Comment
has text: updated my question, getting null pointer at line `System.out.println(loadedeUser.getProteinData().getGoal());` in my Program.java on following your instruction.
comment on: http://stackoverflow.com/a/27248066

http://stackoverflow.com/a/27291766
has comment: http://stackoverflow.com/comment/44320260
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43060701
has body: You should add the xlsx as an EmbeddedPackagePart The main document part will need to point to it, using XML similar to: &lt;w:p&gt; &lt;w:r&gt; &lt;w:object w:dxaOrig="23793" w:dyaOrig="13287"&gt; &lt;v:shapetype stroked="f" filled="f" o:spt="75.0" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" coordsize="21600,21600" id="_x0000_t75"&gt; &lt;v:stroke joinstyle="miter"/&gt; &lt;v:formulas&gt; &lt;v:f eqn="if lineDrawn pixelLineWidth 0"/&gt; &lt;v:f eqn="sum @0 1 0"/&gt; &lt;v:f eqn="sum 0 0 @1"/&gt; &lt;v:f eqn="prod @2 1 2"/&gt; &lt;v:f eqn="prod @3 21600 pixelWidth"/&gt; &lt;v:f eqn="prod @3 21600 pixelHeight"/&gt; &lt;v:f eqn="sum @0 0 1"/&gt; &lt;v:f eqn="prod @6 1 2"/&gt; &lt;v:f eqn="prod @7 21600 pixelWidth"/&gt; &lt;v:f eqn="sum @8 21600 0"/&gt; &lt;v:f eqn="prod @7 21600 pixelHeight"/&gt; &lt;v:f eqn="sum @10 21600 0"/&gt; &lt;/v:formulas&gt; &lt;v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f"/&gt; &lt;o:lock aspectratio="t" v:ext="edit"/&gt; &lt;/v:shapetype&gt; &lt;v:shape type="#_x0000_t75" style="width:1189.5pt;height:664.5pt" id="_x0000_i1025" o:ole=""&gt; &lt;v:imagedata o:title="" r:id="rId5"/&gt; &lt;/v:shape&gt; &lt;o:OLEObject Type="Embed" ProgID="Excel.Sheet.12" ShapeID="_x0000_i1025" DrawAspect="Content" ObjectID="_1479233503" r:id="rId6"/&gt; &lt;/w:object&gt; &lt;/w:r&gt; &lt;/w:p&gt; Note the 2 rel ids; in this example rId6 points to the Emmbedded part, and rId5 points to the image to appear on the document surface (you need to create that yourself). You can write code to generate the above yourself. Alternatively, the commercial docx Enterprise edition would do it for you.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27290932
has comment: http://stackoverflow.com/comment/43051304

http://stackoverflow.com/comment/42949140
has text: @Wes It's a short message, but yes if the key is longer then the message that's possible. It's the key and the algorithm that determines the encryption type (**not** the message).
type: AnswerComment
comment on: http://stackoverflow.com/a/27236186
score: 0
type: Comment

http://stackoverflow.com/q/27201201
has title: how to manipulate HTTP json response data in Java
has answer: http://stackoverflow.com/a/27201317
answer count: 3
tagged with: httpresponse
favorite count: 0
has answer: http://stackoverflow.com/a/46353264
accepted answer: http://stackoverflow.com/a/27201317
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/27201222
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27201222
tagged with: http
type: Question
has body: HttpGet getRequest=new HttpGet("/rest/auth/1/session/"); getRequest.setHeaders(headers); httpResponse = httpclient.execute(target,getRequest); entity = httpResponse.getEntity(); System.out.println(EntityUtils.toString(entity)); Output as follows in json format ---------------------------------------- {"session":{"name":"JSESSIONID","value":"5F736EF0A08ACFD7020E482B89910589"},"loginInfo":{"loginCount":50,"previousLoginTime":"2014-11-29T14:54:10.424+0530"}} ---------------------------------------- What I want to know is how to you can manipulate this data using Java without writing it to a file? I want to print name, value in my code Jackson library is preferred but any would do. thanks in advance
has comment: http://stackoverflow.com/comment/42885845
downvote count: 0

http://stackoverflow.com/q/27156414
type: Question
has answer: http://stackoverflow.com/a/69229068
has answer: http://stackoverflow.com/a/27172174
accepted answer: http://stackoverflow.com/a/27172174
has comment: http://stackoverflow.com/comment/42827131
upvote count: 2
has comment: http://stackoverflow.com/comment/42827204
answer count: 2
favorite count: 0
has body: I am try to set up EventFiringWebDriver in my poject, I am stuck up at some point where EventFiringWebDriver object is working fine in the same class &amp; not working in the child class. Parent class: package utility; import java.util.List; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.events.EventFiringWebDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import eventListeners.WebDriverEventHandler; public class common { public static WebDriver driver = null; protected static EventFiringWebDriver eDriver; WebDriverEventHandler handler; protected NavigatetoOverviews nav; @BeforeClass public void beforeClass() throws InterruptedException { handler = new WebDriverEventHandler(); System.setProperty("webdriver.firefox.profile", "default"); driver = new FirefoxDriver(); eDriver = new EventFiringWebDriver(driver); eDriver.register(handler); nav = new NavigatetoOverviews(); eDriver.get("http://google.com"); } } My child class: package eventListeners; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.testng.annotations.Test; import bsh.commands.dir; import utility.common; public class TestExtendsCommon extends common{ @Test public void sample() { eDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); eDriver.findElement(By.id("gbqfq")).sendKeys("Selenium"); eDriver.findElement(By.id("gbqfba")).click(); } } My Test Results: [TestNG] Running: C:\Users\Hema\AppData\Local\Temp\testng-eclipse--492139263\testng-customsuite.xml Just before beforeNavigateTo http://google.com Inside the afterNavigateTo to http://google.com FAILED: sample java.lang.NullPointerException at eventListeners.WebDriverEventHandler.beforeFindBy(WebDriverEventHandler.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.refl…
has title: Not able to use EventFiringWebDriver object in child class
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/69229068
downvote count: 0
has comment: http://stackoverflow.com/comment/42823648
tagged with: java

http://stackoverflow.com/q/27165134
tagged with: call
has comment: http://stackoverflow.com/comment/42853110
tagged with: java
has title: My ajax call to spring rest services is pending forever
accepted answer: http://stackoverflow.com/a/27193920
type: Question
has comment: http://stackoverflow.com/comment/42843327
has comment: http://stackoverflow.com/comment/42822551
tagged with: ajax
score: 0
tagged with: rest
answer count: 1
has answer: http://stackoverflow.com/a/27193920
has body: My ajax call to spring rest services is pending state in my chrome browser and getting "provisional headers are shown not processing" in headers. Once if i restart my tomcat server then the request is processing successfully. The problem raising randomly... please let me know the problem is from spring rest services side or ajax side?? appreciate your help. Please find the screen shot from chrome browser..... Once the request is in pending state...all the subsequent requests are also pending state... Once the server has been started...then all the requests completes successfully...Please guide us how to solve this problem??? Please click below 1 to see the error pic.. !the request is in pending state....]1
type: AnsweredQuestion

http://stackoverflow.com/comment/43017638
score: 1
has text: Also, you shouldn't have to set the socket properties.
type: AnswerComment
comment on: http://stackoverflow.com/a/27274121
type: Comment

http://stackoverflow.com/q/27178550
score: -1
has body: i nearly finished an android game that i started to develop a little time ago. Actually, it worked fine on my test device (as i am an independant game developper, i use my personnal phone to test) which is a galaxy S2. I tried to optimize it correctly by following google's best practice and, obviously, stackoverflow. At the moment, i get an average 60~70fps on my galaxy s2. When I decided to test it on tablet (a manta 1008MID pro, not very famous), i noticed some lag, and i get only ~24 FPS. I don't understand, because sims to have a better hardware that my old phone. The current method used for drawing is Android Canvas and bitmap. I followed KiloBolt tutorials : http://www.kilobolt.com/unit-4-android-game-development.html The method user sims to be to scale the main Bitmap to screen size. Help me please, I don't understand why the fps are so low on my tablet ! (sorry for bad english, I'm french)
tagged with: bitmap
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27178595
tagged with: java
type: Question
upvote count: 0
answer count: 1
tagged with: android-canvas
has title: Android Game Development, Low FPS on tablet/high FPS on phones
tagged with: android
has answer: http://stackoverflow.com/a/27178595
favorite count: 0

http://stackoverflow.com/comment/43037516
comment on: http://stackoverflow.com/a/27284744
type: AnswerComment
has text: oops I had my coefficients off. I think these are correct.
type: Comment
score: 1

http://stackoverflow.com/comment/43167301
score: 0
comment on: http://stackoverflow.com/a/27272763
type: AnswerComment
type: Comment
has text: Just got rid of [RuntimeException](http://javadocs.com/docs/oracle/j2sdk/1.4.0_04/java/lang/RuntimeException.java) dave. TNX

http://stackoverflow.com/q/27281367
tagged with: maven
has comment: http://stackoverflow.com/comment/43042372
type: Question
accepted answer: http://stackoverflow.com/a/27300471
tagged with: java
tagged with: eclipse
answer count: 2
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27300471
has comment: http://stackoverflow.com/comment/43033823
possible better answer: http://stackoverflow.com/a/27300020
type: AnsweredQuestion
has body: Is there a reason maven-war-plugin behaves differently than the standard maven dependency resolving mechanism? I have a war maven project which has a dependency: GroupA DependencyA GroupB DependencyB The above dependency is correctly excluded and I can verify on the dependency hierarchy view. When I build the war with maven it includes the DependencyB in WEB-INF/lib directory, so I have to explicitly define to exclude it using the maven-war-plugin as so: maven-war-plugin src/main/webapp WEB-INF/lib/dependencyB.jar, I have to do the above cause conflicts between versions arise on my project. Why is this happening? Is there another way to achieve this? UPDATE So I created a test case just to showcase you what I mean, if I was not clear enough before. And the corresponding pom's are as below: ArtifactA: <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/maven-v4_0_0.xsd"> 4.0.0 GroupA ArtifactA war 0.0.1-SNAPSHOT ArtifactA Maven Webapp http://maven.apache.org junit junit 3.8.1 test GroupB ArtifactB war 0.0.1-SNAPSHOT GroupC ArtifactC ArtifactA ArtifactB <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/maven-v4_0_0.xsd"> 4.0.0 GroupB ArtifactB war 0.0.1-SNAPSHOT ArtifactB Maven Webapp http://maven.apache.org junit junit 3.8.1 test GroupC ArtifactC 0.0.1-SNAPSHOT ArtifactB ArtifactC <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 GroupC ArtifactC 0.0.1-SNAPSHOT jar ArtifatcC http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 3.8.1 test In the dependency Hierarchy in Eclipse, I do not see the depende…
has answer: http://stackoverflow.com/a/27300020
upvote count: 2
has title: Why maven-war-plugin behaves differently than the standard maven dependency resolving mechanism

http://stackoverflow.com/comment/43002406
comment on: http://stackoverflow.com/q/27265049
score: 0
type: Comment
type: QuestionComment
has text: Can you try like : FileInputStream input=new FileInputStream(new File("TestCase.xls")); In your code? I think it should work.

http://stackoverflow.com/comment/42844708
score: 0
comment on: http://stackoverflow.com/q/27177961
type: Comment
type: QuestionComment
has text: java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

http://stackoverflow.com/a/27308380
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27304059
type: Answer
has body: The code: Connection con = DriverManager.getConnection(Url, "username", "password"); This is a Factory Pattern. The manager creates the proper concrete Connection class based on the URL passed in. Connection itself is an interface (javadoc) that all of the concrete connection classes implement. MySQL, Postgres, Oracle, whatever... they are all Connection classes. The DriverManager selects the right one of those and creates it. How does the DriverManager know? The Driver classes register themselves with the Driver when they are loaded by the class loader. When the driver goes through asking "who responds to this URL" it invokes the acceptsURL method in each driver and the one that responds gives it a connection back when called with connect. Once you have a Connection object from the Driver (that knows how to talk to the database the driver works with) it is then able to create a statement or execute a query against that database that returns back a result set. The specifics of these are up to the driver to implement. You've just got interfaces to these way that it works. All of the ResultSets and Statements and Connections (and Drivers) work the same way from your point of view, though how they connect to the cursor and database behind the scenes may be different. But that doesn't matter. You've got an interface and they all work the same way. These are all instances of Factory Patterns. Factory, Abstract Factory and Factory Method may be a useful read on the matter. Other Patterns are described Examples of GoF Design Patterns in Java&#39;s core libraries. You may also find This lecture on Factory Pattern to be useful (its got the classic 'pizza' example). As these are Patterns (and I intentionally write that with a capital 'P'), you will find these solutions used again and again in similar ways throughout programs. Once you recognize that you are dealing with a Factory, you will likely be able to work with it more efficiently.

http://stackoverflow.com/comment/43006996
type: Comment
comment on: http://stackoverflow.com/a/27265273
has text: Thank for your answer. Since the default Hibernate version is 4, I have to config to make it to version 3. Then,one more clarification please. Do you think that all features of Hibernate 3 are supported ? (Including Hibernate XML configurations.not annotations?)
type: AnswerComment
score: 0

http://stackoverflow.com/a/27291120
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27290945
downvote count: 1
score: -1
has body: MaWhen starting a new activity you should use Intent myIntent = new Intent(MainTwoActivity.this ,NiatActivity.class); View getContext() doesnt carry the full context of your app. Read up here

http://stackoverflow.com/a/27299644
downvote count: 1
score: -1
has body: In your method that handles user input you would do either an INSERT or UPDATE query. Here's a modified example from the docs: Statement st = conn.createStatement(); String query_st = "INSERT INTO user_info_table VALUES ('"+user_id+"', '"+age+"', "+height+");"; ResultSet rs = st.executeQuery(query_st); while (rs.next()) { System.out.print("Column 1 returned "); System.out.println(rs.getString(1)); } rs.close(); st.close(); This assumes you have a table 'user_into_table' that has three columns.
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43066317
accepted answer of: http://stackoverflow.com/q/27299315
has comment: http://stackoverflow.com/comment/78926285
answers question: http://stackoverflow.com/q/27299315
type: Answer

http://stackoverflow.com/q/27236356
tagged with: java
has body: Hi I'm trying to send an ArrayList as a parameter for a POST request from my Android app to a server. So far I have this code: HttpResponse response; List&lt;NameValuePair&gt; postParams = new ArrayList&lt;NameValuePair&gt;(2); postParams.add(new BasicNameValuePair("post[text]", text)); postParams.add(new BasicNameValuePair("post[common_comments]", String.valueOf(commonComments)); postParams.add(new BasicNameValuePair("post[wall_ids]", wallIds); UrlEncodedFormEntity encodedParams; try { encodedParams = new UrlEncodedFormEntity(postParams); post.setEntity(encodedParams); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } but BasicNameValuePair only receives String as value. Is there any way I can send an ArrayList as a value for post[wall_ids]? Thanks in advance.
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42949602
downvote count: 0
has title: How to send ArrayList<Integer> as UrlEncodedFormEntity in HTTPPOST request?
tagged with: arraylist
tagged with: http-post
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/28341915
has comment: http://stackoverflow.com/comment/42949631
type: UnansweredQuestion
tagged with: post-parameter
score: 1

http://stackoverflow.com/q/27198370
downvote count: 0
has title: Need help converting c# encryption to java (android) encryption for cross compatibility
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27263936
favorite count: 0
has comment: http://stackoverflow.com/comment/42881695
upvote count: 2
tagged with: encryption
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27263936
tagged with: java
tagged with: cross-platform
has body: I've been attempting to convert this class (been using it in my c# app for a couple years now) to java for use in an android application: https://gist.github.com/jbtule/4336842#file-aesthenhmac-cs Some areas where I am having trouble is things like MemoryStream, CryptoStream, and more specifically: //C# CODE //Grab IV from message var iv = new byte[ivLength]; Array.Copy(encryptedMessage, nonSecretPayloadLength, iv, 0, iv.Length); using (var decrypter = aes.CreateDecryptor(cryptKey, iv)) using (var plainTextStream = new MemoryStream()) { using (var decrypterStream = new CryptoStream(plainTextStream, decrypter, CryptoStreamMode.Write)) using (var binaryWriter = new BinaryWriter(decrypterStream)) { //Decrypt Cipher Text from Message binaryWriter.Write( encryptedMessage, nonSecretPayloadLength + iv.Length, encryptedMessage.Length - nonSecretPayloadLength - iv.Length - sentTag.Length ); } //Return Plain Text return plainTextStream.ToArray(); } I am not quite sure what the java equivalent to CryptoStream or MemoryStream. What I've got so far (pertaining to this code example, not the whole class) //Grab IV from message byte[] iv = new byte[ivLength]; System.arraycopy(encryptedMessage, nonSecretPayloadLength, iv, 0, iv.length); Cipher aes = Cipher.getInstance("AES/CBC/PKCS7Padding"); // MISSING: create IvParameterSpec IvParameterSpec ivSpec = new IvParameterSpec(iv); iv = ivSpec.getIV(); aes.init(Cipher.DECRYPT_MODE, secretKeySpecy, ivSpec); //byte[] decoded = aes.doFinal(Base64.decodeBase64(encryptedMessage)); ByteArrayOutputStream decrypterStream = new ByteArrayOutputStream(); DataOutputStream binaryWriter = new DataOutputStream(decrypterStream); binaryWriter.write( encryptedMessage, nonSecretPayloadLength + iv.length, encryptedMessage.length - nonSecretPayloadLength - iv.length - sentTag.length ); If anyone could give me some pointers/help id be most grateful.
type: Question
tagged with: c#

http://stackoverflow.com/a/27265734
type: Answer
has comment: http://stackoverflow.com/comment/43038783
has comment: http://stackoverflow.com/comment/43038349
has body: The easiest way to access session is through HttpSession handler method argument. Set it once @RequestMapping(value = "/some-url/{someArg}", method = RequestMethod.POST) public void someMethod(@PathVariable String someArg, HttpSession session) { List&lt;String&gt; employeeName = getEmployees(); session.setAttribute("employees", employeeName); } And then you can use it in other methods: @RequestMapping(value = "/some-other-url/{someArg}", method = RequestMethod.GET) public String someOtherMethod(@PathVariable String someArg, HttpSession session) { List&lt;String&gt; employeeName = (List&lt;String&gt;)session.getAttribute("employees"); } Note: there is significant downsides in the design decision to store employees identifiers in session: Creation/deletion of employee by one user is not reflected for other users automatically as session is stored per application user. Creation/deletion of employee requires modification of stored list in session. Each application user has own session and hence own list of employees stored in session and if the number employees and users is large application would require more memory.
accepted answer of: http://stackoverflow.com/q/27265084
answers question: http://stackoverflow.com/q/27265084
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43038335
score: 0

http://stackoverflow.com/a/62966067
has body: If anyone didn't know what type of exception was thrown in the method e.g a method with a lot of possibilities like this one : public void onError(Throwable e) { } You can get the exception class by Log.e("Class Name", e.getClass().getSimpleName()); In my case it was UnknownHostException then use instanseof as mentioned in the previous answers to take some actions public void onError(Throwable e) { Log.e("Class Name", e.getClass().getSimpleName()); if (e instanceof UnknownHostException) Toast.makeText(context , "Couldn't reach the server", Toast.LENGTH_LONG).show(); else // do another thing }
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/27280928
downvote count: 0
type: Answer

http://stackoverflow.com/q/27244677
has answer: http://stackoverflow.com/a/32549913
upvote count: 17
has answer: http://stackoverflow.com/a/32116255
possible better answer: http://stackoverflow.com/a/27244788
favorite count: 0
has answer: http://stackoverflow.com/a/27244788
has title: What is the difference between Thread.join and Synchronized?
has answer: http://stackoverflow.com/a/34450284
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: thread-synchronization
has answer: http://stackoverflow.com/a/27244729
accepted answer: http://stackoverflow.com/a/27244729
score: 17
type: Question
answer count: 6
has body: I am confused when to use Thread.join() and when to use synchronization in multi threading application. According to me, both of them block or wait for the execution to be done by some other thread. This example has to output 10 A's , 10 B's &amp; 10 C's in sequential pattern one after other like : 1 : A 2 : A 3 : A 4 : A 5 : A 6 : A 7 : A 8 : A 9 : A 10 : A 1 : B 2 : B 3 : B 4 : B 5 : B 6 : B 7 : B 8 : B 9 : B 10 : B 1 : C 2 : C 3 : C 4 : C 5 : C 6 : C 7 : C 8 : C 9 : C 10 : C ----ProGraM ENDS---- Example starts here class SyncTest extends Thread { StringBuffer sb; public SyncTest(StringBuffer sb) { this.sb = sb; } public void run() { synchronized(sb) { for(int i=1;i&lt;=10;i++){ System.out.println(i+" : "+sb.charAt(0)); } sb.setCharAt(0, (char) (sb.charAt(0)+1)); } } public static void main(String [] args) throws InterruptedException { StringBuffer sb = new StringBuffer("A"); Thread t1=new SyncTest(sb); Thread t2=new SyncTest(sb); Thread t3=new SyncTest(sb); t1.start(); t2.start(); t3.start(); Thread.sleep(1000); System.out.println("----ProGraM ENDS----"); } } Here, output turns out to be 10 A's followed by 10 B's followed by 10 C's in a sequential order. But I can also use Thread.join instead of synchronized block to get the same output like this: public void run() { //removed synchronized statement... for(int i=1;i&lt;=10;i++){ System.out.println(i+" : "+sb.charAt(0)); } sb.setCharAt(0, (char) (sb.charAt(0)+1)); } public static void main(String [] args) throws InterruptedException { StringBuffer sb = new StringBuffer("A"); Thread t1=new SyncTest(sb); Thread t2=new SyncTest(sb); Thread t3=new SyncTest(sb); t1.start(); t1.join(); t2.start(); // wait for t1 to complete t2.join(); t3.start(); // wait for t2 to complete t3.join(); // wait for t3 to complete System.out.println("----ProGraM ENDS----"); } Can anyone clear my confusion on usage of these 2 techniques i.e. when to use Thread.join and when to use synchronization in Multi-threading on Java.
has answer: http://stackoverflow.com/a/27244720
has comment: http://stackoverflow.com/comment/42978257

http://stackoverflow.com/comment/127954764
has text: Still, we need to find an efficient solution for large PDF's.
type: Comment
comment on: http://stackoverflow.com/a/27288199
type: AnswerComment
score: 0

http://stackoverflow.com/q/27231467
answer count: 6
has answer: http://stackoverflow.com/a/27231658
has answer: http://stackoverflow.com/a/27231651
has answer: http://stackoverflow.com/a/27231562
tagged with: arrays
has comment: http://stackoverflow.com/comment/42939961
has title: Counting the number of an element in an array?
favorite count: 0
has body: So for an assignment in my class, we have a lab where we have to write code that will do three things: generate an array of 50 random numbers from 0-9. Return how many 8's appear in the array. Return the number of runs in the array. We were given a .java file to start out with that is this: package ArrayOfInts; public class ArrayOfInts { private int [] intArray; private int eights; private int runs; //Sets intArray to the parameter and initializes all other variables public ArrayOfInts(int [] x){ } //Returns how many 8's are in the array. public int findTheEights(){ return eights; } //Returns the number of runs in the array. public int countTheRuns(){ return runs; } } The code I've written so far is this: package ArrayOfInts; public class ArrayOfIntsTester { public static void main(String [] args){ int [] testArray = new int [50]; for(int i = 0; i &lt; testArray.length; i++){ int x = (int)(Math.random()*9); testArray[i]= x; System.out.print(x + ", "); } System.out.println(); ArrayOfInts test = new ArrayOfInts(testArray); System.out.println(test.findTheEights()); System.out.println(test.countTheRuns()); } } I honestly have no idea where to start with this. Help?? The code I've written generates the correct type of array, but I don't know how to count what I need to count for it.
has comment: http://stackoverflow.com/comment/42939848
has answer: http://stackoverflow.com/a/27231649
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42939855
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27231547
type: Question
has comment: http://stackoverflow.com/comment/42939782
has answer: http://stackoverflow.com/a/27232312
tagged with: java
has comment: http://stackoverflow.com/comment/42939998
score: -1

http://stackoverflow.com/comment/42904262
type: Comment
comment on: http://stackoverflow.com/a/27211498
type: AnswerComment
score: 0
has text: thanks for ur response. But I dont think error is with the url-pattern. Because use of '/' means, it handles all kind of url pattern not only particular .htm or .jsp. And regarding the debug logs, my controller itself is not called, then how can I get any logs for the particular funtion.

http://stackoverflow.com/q/27233685
tagged with: object
has comment: http://stackoverflow.com/comment/42945220
has comment: http://stackoverflow.com/comment/42979875
tagged with: libgdx
tagged with: java
type: Question
has title: Java Pool actions3d (remake libGDX actions) how to make a copy of action3d
tagged with: copy
score: 0
has comment: http://stackoverflow.com/comment/42957236
has comment: http://stackoverflow.com/comment/42944698
has comment: http://stackoverflow.com/comment/43036884
has body: I have problem with making a NEW of object. Example classes that I'm using: public class Actions3d{ /** Returns a new or pooled action of the specified type. */ static public &lt;T extends Action3d&gt; T action3d(Class&lt;T&gt; type) { Pool&lt;T&gt; pool = Pools.get(type); T action = pool.obtain(); action.setPool(pool); return action; } static public AddAction addAction(Action3d action) { AddAction addAction = action3d(AddAction.class); addAction.setAction(action); return addAction; } static public RemoveAction removeAction(Action3d action) { RemoveAction removeAction = action3d(RemoveAction.class); removeAction.setAction(action); return removeAction; } ... } Here is example of one specific Action3d abstract public class Action3d implements Poolable { /** The actor this action is attached to, or null if it is not attached. */ protected Actor3d actor3d; private Pool&lt;Action3d&gt; pool; /** * Updates the action based on time. Typically this is called each frame by * {@link Actor#act(float)}. * * @param delta * Time in seconds since the last frame. * @return true if the action is done. This method may continue to be called * after the action is done. */ abstract public boolean act(float delta); /** Sets the state of the action so it can be run again. */ public void restart() { } /** @return null if the action is not attached to an actor. */ public Actor3d getActor3d() { return actor3d; } /** * Sets the actor this action will be used for. This is called automatically * when an action is added to an actor. This is also called with null when * an action is removed from an actor. When set to null, if the action has a * {@link #setPool(Pool) pool} then the action is {@link Pool#free(Object) * returned} to the pool (which calls {@link #reset()}) and the pool is set * to null. If the action does not have a pool, {@link #reset()} is not * called. * &lt;p&gt; * This method is not typically a good place for a subclass to query the * actor's state because the action may not be …
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42871583
type: Comment
has text: I don't think this is really an answer to the question. It's about the effect when you DON'T use synchronization concepts yourself.
comment on: http://stackoverflow.com/a/27193016
type: AnswerComment
score: 0

http://stackoverflow.com/q/27205213
tagged with: java
answer count: 2
has body: I have succeeded in writing and reading a string to a file on my android app's internal storage, but I want to write an object and it's not working. I've read Oracle's documentation on the matter, which says for object fields to be transmitted over the stream the object needs to implement serializable, or something. I added imports serializable and implements serializable to the cat class but it threw an error. Without it "oos.writeObject(myCat);" causes an error too. I'm very confused. The below code exists in a java activity class tied to a layout.xml. The user presses a button and the object is saved or loaded. As stated writing and reading a string seems to work fine, but objects less so. private void writeFile() { try { String myFile = "myFile"; cat myCat = new cat("Harry", "blue", 11); FileOutputStream fos = openFileOutput(myFile,MODE_WORLD_READABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(myCat); oos.close(); fos.close(); Toast.makeText(getBaseContext(),"object saved",Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } } And private void readFile() { try { String myFile = "myFile"; FileInputStream fis = openFileInput(myFile); ObjectInputStream ois = new ObjectInputStream(fis); cat yourCat = (cat) ois.readObject(); ois.close(); fis.close(); String output = yourCat.name + " the " + yourCat.colour + " cat"; Toast.makeText(getBaseContext(),output,Toast.LENGTH_SHORT).show(); } catch (Exception e) { } } The cat object public class cat { public String name = ""; public String colour = "black"; public int age = 0; public cat(String pName, String pColour, int pAge) { name = pName; colour = pColour; age = pAge; } }
has answer: http://stackoverflow.com/a/27205968
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42894243
has title: writing object to internal storage
tagged with: storage
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27205326
has comment: http://stackoverflow.com/comment/42893497
type: Question
tagged with: object
tagged with: internal

http://stackoverflow.com/comment/42931242
comment on: http://stackoverflow.com/a/27226690
type: AnswerComment
has text: I think so yes, and that's also good news. This is what I originally thought when designing the system but had some doubt, as it was never intended that the interfaces would be given to a third party (and so this was not much of a consideration during my planning).
score: 0
type: Comment

http://stackoverflow.com/q/27312646
tagged with: java
has title: Dropwizard way of handling both GET and POST by single method
type: Question
has body: How to annotate a method in dropwizard so that a single method can handle my both post and GET eg: Like @POST @GET public void login() throws Exception{ // do something }
has comment: http://stackoverflow.com/comment/73970692
has comment: http://stackoverflow.com/comment/43333603
score: 0
tagged with: dropwizard
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43088535
linked to: http://stackoverflow.com/q/13408049
answer count: 0

http://stackoverflow.com/q/27167796
tagged with: spring
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27168177
type: Question
has body: I would like to use 'someotherproperty' value inside SomeIfaceDaoImpl But when I debug, it's always null, inside my bean definition and inside my bean constructor as well. I also tried to use @Value annotation inside my class but this does not work either. However, all database values works fine and available inside jdbcTemplate bean. My properties file contains database.url=jdbc:mysql://localhost:3306/databasename database.username=root database.password=password someotherproperty=HelloWorld My configuration class: @Configuration @Profile("production") @ComponentScan(basePackages = { "com.packagename" }) @PropertySource({"classpath:packagename.properties"}) public class ContextConfig { @Value("${database.url}") private String url; @Value("${database.username}") private String username; @Value("${database.password}") private String password; @Value("${someotherproperty}") private String someotherproperty; @Bean(name = "jdbcTemplate") public JdbcTemplate jdbcTemplate() { JdbcTemplate jdbcTemplate = new JdbcTemplate(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setUrl(StringUtil.appendObjects(url, "?", "useServerPrepStmts=false&amp;rewriteBatchedStatements=true")); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUsername(username); dataSource.setPassword(password); jdbcTemplate.setDataSource(dataSource); return jdbcTemplate; } @Bean public ISomeIfaceDao iSomeIfaceDao() { return new ISomeIfaceDaoImpl(); //&lt;---- I would like to have someotherproperty value here or inside the constructor } } Thank you.
has answer: http://stackoverflow.com/a/27168177
score: 0
answer count: 1
has title: How to work with annotation based properties in Spring
tagged with: annotations

http://stackoverflow.com/a/27309137
answers question: http://stackoverflow.com/q/27309099
score: 0
type: Answer
has body: If you are changing the link that you will want to traverse before you traverse it, then you need to store off in a different variable the result of the traversal before you change the link. Then after the change, you can traverse using your temporary copy.

http://stackoverflow.com/q/27203737
tagged with: java
has title: Compare 2 objects
score: 0
has answer: http://stackoverflow.com/a/27203764
has comment: http://stackoverflow.com/comment/42890192
favorite count: 0
has comment: http://stackoverflow.com/comment/42890195
has answer: http://stackoverflow.com/a/27203807
linked to: http://stackoverflow.com/q/513832
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42890246
has body: In java.. If when we have to compare an object with another object. We compare each field in that object. Student1 object has marks1, marks2, marks3, name, age as fields. Student2 object has marks1, marks2, marks3, name, age as fields. So to check if 2 students are equal or not... we compare each field. if(Student1.marks1 == Student2.marks1 &amp;&amp; Student1.marks2 == Student2.marks2 &amp;&amp; Student1.marks3 == Student2.marks3 &amp;&amp; Student1.name == Student2.name &amp;&amp; Student1.age == Student2.age) { // we say that Students are same } But what if the Student object has many fields.. Student1 object has marks1, marks2, marks3, name, age, address, color, class, country, section, x, y, z like this 100 such fields Student2 object has marks1, marks2, marks3, name, age, address, color, class, country, section, x, y, z like this 100 such fields So how should we now check whether 2 objects are equal or not..? going with the above approach.. of checking each individual field does not make sense since they are 100 such fields. Someone was telling this could be done by serialization in java. Can any one please tell how we can go about it or any other way?
has comment: http://stackoverflow.com/comment/42890174
answer count: 4
has comment: http://stackoverflow.com/comment/42890376
upvote count: 1
has comment: http://stackoverflow.com/comment/42890125
has comment: http://stackoverflow.com/comment/42890287
has answer: http://stackoverflow.com/a/27203789
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27203755

http://stackoverflow.com/q/27204880
score: -3
has comment: http://stackoverflow.com/comment/42892498
tagged with: for-loop
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42892261
possible better answer: http://stackoverflow.com/a/27205023
has comment: http://stackoverflow.com/comment/42892260
favorite count: 0
has comment: http://stackoverflow.com/comment/42892294
type: Question
has answer: http://stackoverflow.com/a/27205189
has comment: http://stackoverflow.com/comment/42892452
has answer: http://stackoverflow.com/a/27204901
has answer: http://stackoverflow.com/a/27205020
has answer: http://stackoverflow.com/a/27205027
has answer: http://stackoverflow.com/a/32799197
linked to: http://stackoverflow.com/q/27195039
has comment: http://stackoverflow.com/comment/42892257
tagged with: java
downvote count: 3
has title: How do I create a loop to print the following pattern?
tagged with: loops
has comment: http://stackoverflow.com/comment/42892839
answer count: 7
has body: I have to create the following pattern by using loop. * * * * * * * * * * * * * * * * * * Now I can only do that by simply system.out.print statement. I don't know how to construct that with a for loop. My code: package pattern; public class Pattern { public static void main(String[] args) { System.out.println("* * * * *"); System.out.println(" * * * *"); System.out.println("* * * * *"); System.out.println(" * * * *"); } }
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/27205020
has answer: http://stackoverflow.com/a/27204947
has answer: http://stackoverflow.com/a/27205023

http://stackoverflow.com/comment/115129585
type: AnswerComment
comment on: http://stackoverflow.com/a/65119701
type: Comment
has text: Hi! Please take the [tour](https://stackoverflow.com/tour). Thanks for contributing to Stack Overflow but can you also add an explanation on how your code solves the problem? Check the [help center](https://stackoverflow.com/editing-help) for help on code formatting.
score: 0

http://stackoverflow.com/a/27196675
type: Answer
accepted answer of: http://stackoverflow.com/q/27196530
has comment: http://stackoverflow.com/comment/42895411
answers question: http://stackoverflow.com/q/27196530
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/42879860
has comment: http://stackoverflow.com/comment/42880435
type: AcceptedAnswer
downvote count: 0
has body: masterPanel.add(display, BorderLayout.SOUTH); You are adding your Display panel to the SOUTH of a BorderLayout. The SOUTH constraint will respsect the preferred height of the component. Your component has a height of 0, to there is nothing to display. Whenever you do custom painting you also need to override the getPreferredSize() method of the component to provide the appropriate size of the component so the layout managers can do there job.

http://stackoverflow.com/a/27245117
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/42965448
type: Answer
has comment: http://stackoverflow.com/comment/42965852
has comment: http://stackoverflow.com/comment/42965934
accepted answer of: http://stackoverflow.com/q/27244947
downvote count: 0
answers question: http://stackoverflow.com/q/27244947
score: 16
has comment: http://stackoverflow.com/comment/42965364
has comment: http://stackoverflow.com/comment/42966006
has body: From a JSP In a jsp file you can print out the version like this: Tomcat Version : &lt;%= application.getServerInfo() %&gt; Output: Tomcat Version : Apache Tomcat/8.0.14 Outside of JSP (Any Java Code) If you want it outside of a JSP (e.g. in a Servlet or listener or w/e) take a look at the org.apache.catalina.util.ServerInfo class, it has some nice static methods: System.out.println(ServerInfo.getServerBuilt()); System.out.println(ServerInfo.getServerInfo()); System.out.println(ServerInfo.getServerNumber()); Output: Sep 24 2014 09:01:51 Apache Tomcat/8.0.14 8.0.14.0 So what you really want is ServerInfo.getServerNumber(). Note: The ServerInfo class also has a main() method so it can be run as a standalone application too: java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo Example output: Server version: Apache Tomcat/8.0.14 Server built: Sep 24 2014 09:01:51 Server number: 8.0.14.0 OS Name: Windows 7 OS Version: 6.1 Architecture: x86 JVM Version: 1.7.0_55-b13 JVM Vendor: Oracle Corporation

http://stackoverflow.com/q/27177961
has comment: http://stackoverflow.com/comment/42844991
has comment: http://stackoverflow.com/comment/42845315
has comment: http://stackoverflow.com/comment/42844867
has comment: http://stackoverflow.com/comment/42845013
has comment: http://stackoverflow.com/comment/42844910
has answer: http://stackoverflow.com/a/27178293
has title: Error when building Java project in Maven
has comment: http://stackoverflow.com/comment/42844884
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42844708
tagged with: java
tagged with: maven
type: Question
has comment: http://stackoverflow.com/comment/42844690
has comment: http://stackoverflow.com/comment/42844792
has comment: http://stackoverflow.com/comment/42844881
has comment: http://stackoverflow.com/comment/42844927
has comment: http://stackoverflow.com/comment/42845100
score: 0
has body: I downloaded a Java project from GitHub and trying to use Maven to build it. I use the command mvn clean package on Windows 7. I get the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2. 3.2:compile (default-compile) on project force-wsc: Compilation failure [ERROR] Unable to locate the Javac Compiler in: [ERROR] C:\jdk1_8_25\..\lib\tools.jar [ERROR] Please ensure you are using JDK 1.4 or above and [ERROR] not a JRE (the com.sun.tools.javac.Main class is required). [ERROR] In most cases you can change the location of your Java [ERROR] installation by setting the JAVA_HOME environment variable. As you can see in the error message, I AM pointing to a JDK. My JAVA_HOME is set to C:\jdk1_8_25 When I run java -version, I get: java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) There are my posts about this error but they all were pointing to a JRE and not a JKD. Mine is already pointing to a JDK so I'm not sure what is wrong here.
has comment: http://stackoverflow.com/comment/42844904
answer count: 1
has comment: http://stackoverflow.com/comment/42845160
has comment: http://stackoverflow.com/comment/42844805
has comment: http://stackoverflow.com/comment/42845037

http://stackoverflow.com/comment/42854491
type: QuestionComment
has text: What happened when you tried it?
score: 0
comment on: http://stackoverflow.com/q/27183439
type: Comment

http://stackoverflow.com/q/27206902
downvote count: 0
has comment: http://stackoverflow.com/comment/42896444
linked to: http://stackoverflow.com/q/10354997
has title: JDBC4 and Class.forName
tagged with: postgresql
has comment: http://stackoverflow.com/comment/42899241
favorite count: 0
score: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27215296
has comment: http://stackoverflow.com/comment/42896008
linked to: http://stackoverflow.com/q/6981564
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/42896006
type: Question
upvote count: 4
has body: I wrote some code that connects to a PostgreSQL 9.4 DB via its latest JDBC4 driver. My understanding is that JDBC4 no longer needs the boilerplate "Class.forName("org.postgresql.Driver") driver registration line. Thus, I left it out. It worked fine. I then put the same exact code in a servlet, added the postgreSQL JDBC jar to WebContent/WEB-INF/lib and it failed saying: java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/ When I add the Class.forName line, it then works fine. Does anyone know why this JDBC4 driver needs Class.forName when put within a doGet() servlet method, but in a basic Java class it doesn't? Thanks, TR edit: Forgot to mention, I'm using Java 7. Some updates: It does appear that this is a fairly common issue in Tomcat. I've moved the JAR out of WEB-INF/lib per the suggestions from this, and other posts. Even with it in TOMCAT_HOME/lib I need to use Class.forName(). Sort of odd, I suppose it has something to do with the way Tomcat registers classes. Found this post which is the exact issue with the mySQL JDBC driver rather than postgreSQL: When is Class.forName needed when connecting to a database via JDBC in a web app?
has comment: http://stackoverflow.com/comment/42896037
linked to: http://stackoverflow.com/q/8072832
has comment: http://stackoverflow.com/comment/42896296
answer count: 1

http://stackoverflow.com/comment/42966373
comment on: http://stackoverflow.com/a/27245393
has text: Both cases, i cannot give something to client that takes time to create something.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43077807
type: Comment
has text: I edited my code above. Can you please take a look and tell me exactly how you would arrange everything? Sorry again. I'll keep trying to fix it myself though. Thanks :) And does my activity need to implement a gestureListener?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27307513

http://stackoverflow.com/comment/59076653
comment on: http://stackoverflow.com/a/27206173
has text: After struggling for couple of hours this was the onlu solution that works. Just a note: the name of the certificate in my case was "ESETSSLFilterCA.crt" - extension crt and not cer
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42884028
type: Comment
has text: @Wilson Yes, because that's my answer as a method but you forgot `Arrays.toString()` so you get the default toString from Object. `System.out.println(Arrays.toString(sumDigits()));`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27200068

http://stackoverflow.com/comment/127787774
type: Comment
comment on: http://stackoverflow.com/a/72312649
score: 0
has text: I know as I got the answer from here last year, but sent link to friend and he didn't get it so i tried to facilitate it and right the answer directly in the simplest way , Thanks.
type: AnswerComment

http://stackoverflow.com/comment/42899378
has text: @Anton see above comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27208676
score: 0
type: Comment

http://stackoverflow.com/comment/42854526
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27165812
has text: i have updated the code below plz look into it ty :)

http://stackoverflow.com/q/27153564
tagged with: java
has answer: http://stackoverflow.com/a/27154004
type: Question
has title: Annotation to add the latest field value into HashMap
score: 0
has comment: http://stackoverflow.com/comment/42801878
has comment: http://stackoverflow.com/comment/42801525
answer count: 1
has body: I would like to write Annotation in Java, to keep the value of given field in HashMap. For example, using @Keepdata (Keepdata is an annotation) on specified field will store the latest value of the field value in the HashMap. @Keepdata double myDouble; double mySecondDouble; Creating instance of Keepdata and using method, for example bind(); should add the value of myDouble, but not mySecondDouble to the hashmap in the Keepdata annotation. Keepdata kd = new Keepdata(...) kd.bind(); // adding the actual values of fields to hashmap How to store this informations in the Keepdata instance of annotation? Could you suggest me the proper way of solving this problem?
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/q/27178088
has comment: http://stackoverflow.com/comment/42844981
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42845023
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/27178152
has title: Getting around the 4GB JAR limit
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/42845131
upvote count: 7
answer count: 1
has comment: http://stackoverflow.com/comment/42845075
has body: I'm making a offline database program that happens to include a lot of images - enough to make the jar file over 4GB, which, as Netbeans tells me, is not permitted. I would like to know what the best way of getting my files under this limit might be, and how to program in methods to access the images with Java. The image folder is currently 4.63GB by itself and will get larger (by maybe a few MBs) in future updates. What do you suggest, Stackoverflow?
favorite count: 0
tagged with: offline
has comment: http://stackoverflow.com/comment/42844934
has comment: http://stackoverflow.com/comment/42845111
accepted answer: http://stackoverflow.com/a/27178152
has comment: http://stackoverflow.com/comment/42845180

http://stackoverflow.com/q/27198530
has answer: http://stackoverflow.com/a/27199095
has comment: http://stackoverflow.com/comment/42881846
has comment: http://stackoverflow.com/comment/42881909
has comment: http://stackoverflow.com/comment/42882034
has comment: http://stackoverflow.com/comment/49731242
type: Question
has comment: http://stackoverflow.com/comment/42882084
has comment: http://stackoverflow.com/comment/42881852
tagged with: null
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/55192474
answer count: 1
has body: For an app I'm working on, I'm using Parse (www.parse.com) and I have two different pointer arrays in the _User class. That class contains two columns that I'm trying to include in my query: "following" and "friends". My problem is that the result is always either null or empty pointers, depending on how I query it. Parse mentions: In some situations, you want to return multiple types of related objects in one query. You can do this with the include method. However, using this include method causes the results to be null. This is my code: ParseQuery&lt;AAUser&gt; query = ParseQuery.getQuery(AAUser.class); query.include("following"); query.include("friends"); query.getInBackground(ParseUser.getCurrentUser().getObjectId, new GetCallback&lt;AAUser&gt;() { @Override public void done(AAUser user, ParseException e) { if(e != null) return; Log.d(TAG, String.valueOf(user.getFollowing())); } }); user.getFollowing() alwas returns [null] whenever I include that field. However, if I don't include it, it returns an empty pointer as it should. [AALocation{id='iLUigvrvrc'}] As you can see, I queried my subclassed AAUser class. I still get the same results by querying the ParseUser class so I don't see how subclassing made a difference. How can I solve this issue? Is this a bug with the Parse SDK? I'm using version 1.7.1 of the Parse Android SDK. . I'm basically trying to refresh the current user data with these fields included but I see it's not working as it should... And yes, I tried fetchInBackground() but it doesn't give me any ways to include those fields. My current workaround is to use the empty pointers and query all of them one by one but I find this to be an awful workaround... please halp.
has comment: http://stackoverflow.com/comment/42881885
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has title: ParseQuery include returning null
has comment: http://stackoverflow.com/comment/42882025

http://stackoverflow.com/a/27356208
answers question: http://stackoverflow.com/q/27313234
type: AcceptedAnswer
type: Answer
has body: I found it... The problem was inside "Assets file", I didn't change [new Texture("background.png")] for [loadTexture("background.png")] sorry and thanks
score: 0
accepted answer of: http://stackoverflow.com/q/27313234

http://stackoverflow.com/q/27254556
has body: Spring's @ComponentScan offers a type-safe basePackageClasses attribute - seems a good thing to use especially as it isn't uncommon for packages to be renamed on the project I'm working on. The documentation says: Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute. ... but offers no further guidance on the name of such a class. Am wondering if there are any conventions around this. package-info.java already exists in all packages (as enforced by Checkstyle) - would have preferred to reuse this but sadly Java doesn't allow a class of this name. (If no such standards exist am thinking perhaps PackageInfo, BasePackage, PackageMarker or similar but would prefer to follow convention if there is one.)
has title: Is there a naming convention for @ComponentScan basePackageClasses?
tagged with: convention
tagged with: spring
has comment: http://stackoverflow.com/comment/42982990
has comment: http://stackoverflow.com/comment/42983046
type: AnsweredQuestion
tagged with: java
tagged with: component-scan
accepted answer: http://stackoverflow.com/a/27267657
score: 15
type: Question
upvote count: 15
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/43009640
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43005977
favorite count: 0
has comment: http://stackoverflow.com/comment/42983257
has comment: http://stackoverflow.com/comment/42983198
has answer: http://stackoverflow.com/a/27267657

http://stackoverflow.com/comment/43056142
comment on: http://stackoverflow.com/q/27278816
type: Comment
type: QuestionComment
has text: First of all thanks for the answer! :) Already feared that might be the problem, but I had tested it by creating a new thread with a sleep in it and it didn't work. I will try using the Swing timer. :)
score: 1

jdbc
tags question: http://stackoverflow.com/q/27187124
tags question: http://stackoverflow.com/q/27297387
tags question: http://stackoverflow.com/q/27186765
tags question: http://stackoverflow.com/q/27297808
tags question: http://stackoverflow.com/q/27263971
tags question: http://stackoverflow.com/q/27248147
tags question: http://stackoverflow.com/q/27208369
tags question: http://stackoverflow.com/q/27284154
tags question: http://stackoverflow.com/q/27231416
tags question: http://stackoverflow.com/q/27178404
tags question: http://stackoverflow.com/q/27231281
tags question: http://stackoverflow.com/q/27191495
tags question: http://stackoverflow.com/q/27287074
tags question: http://stackoverflow.com/q/27309182
tags question: http://stackoverflow.com/q/27255690
tags question: http://stackoverflow.com/q/27210964
tags question: http://stackoverflow.com/q/27227983
tags question: http://stackoverflow.com/q/27244233
tags question: http://stackoverflow.com/q/27175886
tags question: http://stackoverflow.com/q/27270172
tags question: http://stackoverflow.com/q/27265097
type: Tag
tags question: http://stackoverflow.com/q/27303516
tags question: http://stackoverflow.com/q/27271446
tags question: http://stackoverflow.com/q/27293833
tags question: http://stackoverflow.com/q/27277515
tags question: http://stackoverflow.com/q/27218985
tags question: http://stackoverflow.com/q/27180211
tags question: http://stackoverflow.com/q/27266469
tags question: http://stackoverflow.com/q/27167072
tags question: http://stackoverflow.com/q/27221373
tags question: http://stackoverflow.com/q/27288724
tags question: http://stackoverflow.com/q/27193250
tags question: http://stackoverflow.com/q/27178518
tags question: http://stackoverflow.com/q/27202591
tags question: http://stackoverflow.com/q/27175792
tags question: http://stackoverflow.com/q/27161886
tags question: http://stackoverflow.com/q/27201807
tags question: http://stackoverflow.com/q/27289959
tags question: http://stackoverflow.com/q/27298796
tags question: http://stackoverflow.com/q/27299315
tags question: http://stackoverflow.com/q/27213331
tags question: http://stackoverflow.com/q/27299891
tags question: http://stackoverflow.com/q/27174178
tags question: http://stackoverflow.com/q/27267988
tags question: http://stackoverflow.com/q/27182300
tags question: http://stackoverflow.com/q/27278007
tags question: http://stackoverflow.com/q/27241927
tags question: http://stackoverflow.com/q/27249211
tags question: http://stackoverflow.com/q/27225187
tags question: http://stackoverflow.com/q/27211762
tags question: http://stackoverflow.com/q/27242013
tags question: http://stackoverflow.com/q/27197161
tags question: http://stackoverflow.com/q/27169361
tags question: http://stackoverflow.com/q/27238637
tags question: http://stackoverflow.com/q/27250450
tags question: http://stackoverflow.com/q/27154579
tags question: http://stackoverflow.com/q/27309506
tags question: http://stackoverflow.com/q/27252852
tags question: http://stackoverflow.com/q/27296680
tags question: http://stackoverflow.com/q/27269446
tags question: http://stackoverflow.com/q/27279899
tags question: http://stackoverflow.com/q/27304059
tags question: http://stackoverflow.com/q/27160906
tag name: jdbc
tags question: http://stackoverflow.com/q/27158769
tags question: http://stackoverflow.com/q/27168401
tags question: http://stackoverflow.com/q/27257927
tags question: http://stackoverflow.com/q/27227849
tags question: http://stackoverflow.com/q/27280536

http://stackoverflow.com/comment/42928475
has text: thank you for ur fast reply, i tried using quotes also and it is still not working...any other ideas?
comment on: http://stackoverflow.com/a/27224941
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42871709
has text: ahh...I think I am starting to understand you now..You see a list of Actors, and when you click 'add' button, the Actor gets added in 'Movie' List..Correct?
type: AnswerComment
comment on: http://stackoverflow.com/a/27192989
score: 0
type: Comment

http://stackoverflow.com/a/29560463
answers question: http://stackoverflow.com/q/27312491
upvote count: 9
downvote count: 0
has body: I recently bumped into this problem. It was caused by a library providing an old implementation of javax.ws.rs.core. I fixed it as follows: org.apache.axis2 axis2-jaxws 1.6.2 runtime javax.ws.rs jsr311-api
type: Answer
has comment: http://stackoverflow.com/comment/90226540
has comment: http://stackoverflow.com/comment/84249160
score: 9

http://stackoverflow.com/comment/42814344
score: 3
comment on: http://stackoverflow.com/q/27160248
has text: Note: If you make your `Point` class immutable, there would be no need to deep copy...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43007964
score: 0
type: AnswerComment
has text: Your web.xml shows you're using servlet spec 3.0, so you need the jstl definition of /jsp/jstl/core, and you should have jstl library version 1.2.1 available to your web app. See this: http://stackoverflow.com/tags/jstl/info
type: Comment
comment on: http://stackoverflow.com/a/27261148

http://stackoverflow.com/comment/42921863
has text: So when the font metrics, DPI or other rendering pipeline changes occur your "pretty pixel perfect" layout blows up in your face? 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
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27221500
score: 2

http://stackoverflow.com/comment/43002414
comment on: http://stackoverflow.com/a/27265026
has text: Thank you very much. I thought I have tried it. It worked. Sorry for the stupid question.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42859168
comment on: http://stackoverflow.com/a/27186128
type: AnswerComment
score: 0
type: Comment
has text: Well, i know equals() is the right way to compare, however when the below is evaluating to true why isn't the above? String s1 = "abc"; String s2="abc"; s1==s2 - evaluates to true

http://stackoverflow.com/comment/42962672
type: AnswerComment
score: 0
type: Comment
has text: What I have read is erasure refers to replacing Object with generic Type so both of them are subclasses of Object
comment on: http://stackoverflow.com/a/27243522

http://stackoverflow.com/q/27301810
tagged with: calculator
tagged with: dependencies
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43067163
tagged with: java
type: Question
score: 0
has body: I am fairly new to java (and stack overflow) so please bear with me. I am trying to create a physics projectile motion calculator which also outputs a graph of the motion. I want to have JTextfields in which the user can enter some or all of the following conditions: initial angle, initial speed, mass, range, maximum height. If the user does not enter all of the values, I want the program to fill in the remaining fields. So for example, if the user enters initial angle, initial speed and mass then I want it to calculate the range and max height. I know how to do everything described except one thing: I don't know how to have the program confirm which fields are filled and then, based on that, run the necessary calculation/method to find the missing values. I know how to use .trim().isEmpty() and I thought maybe I could use that along with some kind of boolean array or something? I searched around and couldn't find any answers. Anybody have any ideas? Any help appreciated! Let me know if I need to provide a SSCCE (I didn't think it would be especially helpful for this question) Edit: It seems my wording was unclear, I apologize for that. I know how to determine if a field is empty, what I need to know is how to have the program decide what calculation method to run depending on the combination of filled/unfilled fields. This is because the equations are such that I need at least 3 out of the 5 variables to calculate the others. So for example, if the user enters the mass, angle and range then I need to call a specific method to calculate the height and initial speed. However if the user enters mass, angle and speed then I need to call a different method to calculate the height and range. Note that although height is missing in both of the above cases, I need to call different methods in each case because the combination of filled/unfilled fields is different. JTextfield inputMass, inputAngle, inputSpeed, inputRange, inputHeight: JButton goButton; public void init(){ …
answer count: 1
has answer: http://stackoverflow.com/a/27303298
has comment: http://stackoverflow.com/comment/43067631
has title: How to have the java applet run a different calculation depending on which JTextfields are filled?

http://stackoverflow.com/q/27274840
has answer: http://stackoverflow.com/a/27276089
accepted answer: http://stackoverflow.com/a/27276089
tagged with: security-constraint
tagged with: authentication
type: Question
has body: I'm trying to write a Web-based Setup for my Webapplication (Mainly setting up the database). But because i am using DIGEST authentication for all Servlets i'm having a problem there. I want to be able to ask the user to enter his mysql password, but he can't because he can't login. Since the users are Saved in the Database, that doesnt exist at that point, there is no way to log in. <web-resource-collection> Wildcard means whole app requires authentication /* GET POST </web-resource-collection> crm_user NONE DIGEST tomcat_realm Can I override the login config for a single Servlet, so the user doesn't have to enter a password?
linked to: http://stackoverflow.com/q/20360377
tagged with: java
has title: Override Tomcat basic authentication
tagged with: servlets
score: 0
answer count: 1
tagged with: tomcat
type: AnsweredQuestion

http://stackoverflow.com/comment/42958858
comment on: http://stackoverflow.com/q/27241207
score: 0
type: Comment
has text: Post the logcat from the crash
type: QuestionComment

http://stackoverflow.com/q/27222294
has comment: http://stackoverflow.com/comment/42923291
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/42923226
has comment: http://stackoverflow.com/comment/42923267
has answer: http://stackoverflow.com/a/27222377
has answer: http://stackoverflow.com/a/27222401
score: 0
has answer: http://stackoverflow.com/a/27222395
has answer: http://stackoverflow.com/a/27222422
has body: I tried using this code to connect, but it doesn't work: Class.forName("com.mysql.jdbc.Driver").newInstance(); //line 4 Connection con = DriverManager.getConnection("jdbc:mysql://example.com:3306/db", "user", "pass"); Statement st = con.createStatement(); String sql = ("SELECT * FROM users;"); ResultSet rs = st.executeQuery(sql); if(rs.next()) { int id = rs.getInt("id"); String str1 = rs.getString("imei"); System.out.print(id+"+++"+str1); I receive this error: java.sql.SQLException: Access denied for user 'user'@'ip' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919) This user has all privileges to the database. How do I fix this?
type: UnansweredQuestion
has title: Connect to MySQL database remotely in Java
answer count: 4

http://stackoverflow.com/a/27225335
type: Answer
has comment: http://stackoverflow.com/comment/42929880
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42928988
has comment: http://stackoverflow.com/comment/42930006
has body: layoutParams is never initalized so it will always be null. So when you're trying to execute this line layoutParams.leftMargin = (int)event.getX(); you will get a NPE because layoutParams is null. If you want to use the layout paramters of the view try using: layoutParams = v.getLayoutParams(); before you try changing it's values.
accepted answer of: http://stackoverflow.com/q/27224290
answers question: http://stackoverflow.com/q/27224290
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42929027

http://stackoverflow.com/comment/42855375
type: Comment
has text: @LisaAnne than is `datandtime` null?!
type: AnswerComment
comment on: http://stackoverflow.com/a/27183958
score: 0

http://stackoverflow.com/a/27218255
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/27182395
has body: In one banking application (I developed) endorsement works since 2005 with Java 1.4. System property 'java.endorsed.dirs' was introduced in Java 1.4, so you can use it with Java 5 - it is guarantied to work. For example see this docs or this one. Edit And yes, JAX-WS 2.2.5 is compatible with JDK/JRE 1.5, see Required Software section in official release notes. Actually this was the last version of JAX-WS compatible with Java 5.
has comment: http://stackoverflow.com/comment/43125638
upvote count: 4

http://stackoverflow.com/comment/74515099
has text: @peterh sorry about that :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27301091
type: Comment

http://stackoverflow.com/a/27189070
downvote count: 0
answers question: http://stackoverflow.com/q/27188919
type: Answer
has body: The class String is an immutable or value object. It doesn't give you direct access to the characters which make up the string, mainly for performance reasons but also since it helps to avoid a whole class of bugs. That's why you can't use the array access via []. You could call A.getChars() but that would create a copy of the underlying character array. char is the code for a character. 'A' == 65, for example. See this table. If A.charAt(1) returns 'F' (or 70), then 'F' - 'A' gives you 5. +1 gives 6. So the code above turns letters into a number. A pattern which you'll see pretty often is charAt(i) - '0' to turn a string into a number. But the code above is odd in this respect since count *= num produces a pretty random result for the input. To turn the letters into numbers, base 26, it should read count = count * 26 + num.
upvote count: 1
score: 1

http://stackoverflow.com/q/27305979
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/27306443
has answer: http://stackoverflow.com/a/27306160
type: UnansweredQuestion
has title: How to load an AnchorPane in a SplitPane that existed in another SplitPane in javafx
has body: I created a horizontal split pane then I created a vertical one. How to load an anchorPane in the second split pane?
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/comment/43336980
type: Comment
has text: I wouldn’t expect that `modifier` field to do more than reporting these bits to applications using Reflection; the JVM surely maintains the original modifier bits at a different place so the verifier will still reject code trying to write to that field directly (without Reflection). And right, you don’t need to modify these bits; once you did `setAccessible(true)` you can modify `final` instance fields (not `final static` fields). That feature exists to support customized Deserialization.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27308389

http://stackoverflow.com/comment/43018312
comment on: http://stackoverflow.com/q/27253972
has text: Another update. This issue does indeed seem to be resolved by the most recent firmware for the X8-H which is available from Minix. I found it in the forums under the post http://www.minixforum.com/threads/official-002-firmware.2413/
score: 0
type: Comment
type: QuestionComment

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/27208702
tags question: http://stackoverflow.com/q/27222839
type: Tag
tags question: http://stackoverflow.com/q/27226810
tags question: http://stackoverflow.com/q/27268840

http://stackoverflow.com/q/27312134
linked to: http://stackoverflow.com/q/4851359
linked to: http://stackoverflow.com/q/2062020
tagged with: environment-variables
tagged with: intellij-idea
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43084911
favorite count: 0
has comment: http://stackoverflow.com/comment/43084810
has body: I am running on a 64 bit installation of Windows 7 and am calling System.getenv("programfiles") which is returning C:\Program Files (x86) instead of C:\Program Files. I have also noticed that when I run the same code using run in IntelliJ it returns C:\Program Files like it should. I assume this is because it is inheriting environment variables from IntelliJ but I would like to be able to get both the 32 and 64 bit versions from a standalone application. What is causing this and what can I do to fix it?
has answer: http://stackoverflow.com/a/27312213
has comment: http://stackoverflow.com/comment/43085531
score: 2
has comment: http://stackoverflow.com/comment/43086044
linked to: http://stackoverflow.com/q/8511063
upvote count: 2
type: UnansweredQuestion
type: Question
has title: System.getenv("ProgramFiles") returns C:\Program Files (x86)
tagged with: java

http://stackoverflow.com/comment/89806261
has text: My apologies, I was a bit unclear. Checking out the project with a clean working directory and simply performing `./gradlew clean shadowJar` as in the Readme results in the following error: `> The value of a manifest attribute must not be null (Key=Start-Class).`. I have made no local changes.
comment on: http://stackoverflow.com/a/49663075
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42932531
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27225856
type: Comment
has text: Seems like you forgot to create new `Vector` for each row and add that `Vector` the Vector<Vector>. You may be trying to add a String to `Vector<Vector>`

http://stackoverflow.com/comment/42868576
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27191231
has text: You want to add something to the "marmot" string? Like "marmot is great"?
type: AnswerComment

http://stackoverflow.com/q/27186097
has answer: http://stackoverflow.com/a/27186128
has comment: http://stackoverflow.com/comment/42862975
type: Question
tagged with: object
has title: object1.toString() == object2.toString()
tagged with: assignment-operator
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 1
duplicate of: http://stackoverflow.com/q/513832
linked to: http://stackoverflow.com/q/16729045
has comment: http://stackoverflow.com/comment/42859024
type: UnansweredQuestion
has body: The below is my main method in which am comparing two object references. Having overridden the toString() method in Car class, my question is why are the below "if" conditions evaluating to false when they should evaluate to true. Could somebody explain? Thanks. public static void main(String[] args){ Car c1 = new Car(2829,"white"); Car c2 = new Car(2829,"white"); if(c1 == c2) System.out.println(true); else System.out.println(false); String sc1 = c1.toString(); String sc2 = c2.toString(); if(sc1 == sc2) System.out.println("it's equal"); else System.out.println("it's not!"); } public class Car { private int regNo; private String color; protected void start(){ System.out.println("Car Started!"); } public Car(int regNo, String color){ this.regNo = regNo; this.color = color; } @Override public String toString() { return "Car-"+regNo; } } Say, i have two strings s1="abc" and s2 = "abc". Now, s1 == s2 evaluating to true then why is that in the above code c1.toString() == c2.toString() evaluating to false is my question?
tagged with: reference
tagged with: tostring
tagged with: java

http://stackoverflow.com/comment/42974882
has text: Thanks for answer, but what i'm trying is to change the default server instance of ebean by other server instance (`test` in this case) in runtime, definitely my `ChangeConfig` method don't solve the problem. Sorry if my question wasn't clear. Please check edit. Thanks
comment on: http://stackoverflow.com/a/27247137
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/43113687
upvote count: 1
score: 1
has body: A java-8 implementation of the problem: IntStream.range(0, MAX) .forEach(i -&gt; IntStream.rangeClosed(1, MAX) .mapToObj(j -&gt; j == MAX ? String.format("%3d", i * MAX + j) + "\n" : String.format("%3d", i * MAX + j) + " ") .forEach(System.out::print) ); The value for MAX in this case will be 3. Output for MAX = 5 - 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
downvote count: 0
answers question: http://stackoverflow.com/q/27197311
type: Answer

http://stackoverflow.com/q/27215714
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/42911544
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/42918851
has answer: http://stackoverflow.com/a/27217076
has title: SQLiteException: no such table: login
type: UnansweredQuestion
has body: Im trying to make a login using Sqlite Database Browser which is basically in the asset folder. Whenever I sign in, the app is always closing, getting an error about no such table as login. In my database broswer there's such a table but in ddms, only the android_metadata is shown and no such table as login is existed. Please help me. Here is my DatabaseHelper public class DatabaseHelper extends SQLiteOpenHelper { private static String DB_NAME = "cafs"; private static int DB_Version = 2; private SQLiteDatabase db; private final Context context; private String DB_PATH = "/data/data/com.example.trialngiba/databases/"; public DatabaseHelper(Context context) { super(context, DB_NAME, null, DB_Version); this.context = context; } public void createDataBase() throws IOException { boolean dbExist = checkDataBase(); if (dbExist) { try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } else { SQLiteDatabase db = this.getWritableDatabase(); if (db.isOpen()){ db.close(); try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } else { try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } } } private boolean checkDataBase() { File dbFile = new File(DB_PATH + DB_NAME); return dbFile.exists(); } private void copyDataBase() throws IOException { InputStream myInput = context.getAssets().open(DB_NAME); String outFileName = DB_PATH + DB_NAME; OutputStream myOutput = new FileOutputStream(outFileName); byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) &gt; 0) { myOutput.write(buffer, 0, length); } // Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } public DatabaseHelper open() throws SQLException { db = this.getWritableDatabase(); return this; } public void close() { db.close(); } public SQLiteDatabase getDatabaseInstance() { return db; } public void insertEntry(String userName,String password) { ContentValues newV…
tagged with: java
tagged with: authentication
tagged with: eclipse

http://stackoverflow.com/a/76835816
type: Answer
has body: Stack overflow error can also be caused by never ending function call loop. A simple example in TypeScript: function foo(a: number): number { const localFooValue = 12; return bar(localFooValue + a); } function bar(b: number): number { const localBarValue = 4; return foo(localBarValue * b); } The preceding code snippet creates stack overflow error, With each foo function calling bar function and vice-versa this causes infinite function call loop.
answers question: http://stackoverflow.com/q/27218736
score: 0
has comment: http://stackoverflow.com/comment/135465732

http://stackoverflow.com/comment/43067413
has text: What happens if you remove the image from the label?
comment on: http://stackoverflow.com/a/27301927
type: Comment
score: 0
type: AnswerComment

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/27248749
type: Tag

http://stackoverflow.com/comment/43028381
comment on: http://stackoverflow.com/q/27279080
type: Comment
type: QuestionComment
score: 0
has text: @Frakcool I Update the question to hopefully follow the MCVE rules.Feel free to mention if I used it incorrectly

http://stackoverflow.com/comment/42835020
comment on: http://stackoverflow.com/q/27172090
type: Comment
has text: Assuming the issue is with the GUI, try to call `revalidate()` before any `repaint()`
score: 0
type: QuestionComment

http://stackoverflow.com/q/27171980
has comment: http://stackoverflow.com/comment/42835048
has body: I've been searching web for a week now but none of the posts like How do I get FutureTask to return after TimeoutException? seems to answer my question. I've extracted a code sample from my code: Future&lt;Object&gt; result = executorService.submit(new Callable&lt;Object&gt;() { @Override public Object call() throws Exception { ........... } }); try { return result.get(timeout.getValue(), timeout.getUnit().getTimeUnit()); } catch (TimeoutException e) { result.cancel(true); throw new TTimeoutException(e); } If I run this, sometimes(1 out of 1000) I'm getting java.lang.InterruptedException at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:400) at java.util.concurrent.FutureTask.get(FutureTask.java:199) at com.abc.callers.A.call(A.java:83) and line no:83 is result.get() of future task shown in above code sample. Now my question is, can calling result.cancel(true) in future cause InterruptedException in result.get? If not, who can change the interrupt status of my current thread? AFAIK result.get() isn't the same thread as the one running my submitted task which I'm cancelling..
tagged with: future
tagged with: executorservice
has comment: http://stackoverflow.com/comment/42835428
linked to: http://stackoverflow.com/q/1281237
has comment: http://stackoverflow.com/comment/42835774
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42836054
upvote count: 1
has title: awaitDone in FutureTask throwing InterruptedException
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42837553
has answer: http://stackoverflow.com/a/27243104
score: 1
has comment: http://stackoverflow.com/comment/42834788
tagged with: java
has comment: http://stackoverflow.com/comment/42937543
type: Question
has comment: http://stackoverflow.com/comment/42834768
answer count: 2
possible better answer: http://stackoverflow.com/a/27172076
has answer: http://stackoverflow.com/a/27172076
downvote count: 0
favorite count: 0
tagged with: interrupt
has comment: http://stackoverflow.com/comment/42834740
accepted answer: http://stackoverflow.com/a/27243104

http://stackoverflow.com/comment/42929704
type: Comment
comment on: http://stackoverflow.com/a/27225957
has text: @Ibalazscs true, but the implementations of it within user's classes usually have to do the deep copying themselves. That's why they usually need to override it and don't just keep it as is.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42835490
comment on: http://stackoverflow.com/q/27171809
score: 0
type: Comment
type: QuestionComment
has text: yep. seems your client does not accept certificate from proxy, so I propose you to dig in this side.

http://stackoverflow.com/q/27289768
has comment: http://stackoverflow.com/comment/43045986
score: 0
has comment: http://stackoverflow.com/comment/43046118
has comment: http://stackoverflow.com/comment/43047742
tagged with: sql
has comment: http://stackoverflow.com/comment/43047634
answer count: 1
has comment: http://stackoverflow.com/comment/43047605
has answer: http://stackoverflow.com/a/27293761
has title: Program does not display all records, only the last record entered
type: UnansweredQuestion
has body: I am currently working on this Java web app with Hibernate framework wherein it will display all records from the database. However, the program only lists the last record entered in all rows. (Meaning, if I have 5 different existing data, the program displays 5 rows with data of the last record entered. So it is just repeating what the values of the last row are.) I couldn't figure out what is wrong with the code: Configuration cfg = new Configuration(); cfg.configure(); SessionFactory factory = cfg.buildSessionFactory(); Session session = factory.openSession(); Query query = session.createQuery("from mytable"); for (Iterator iterator = query.iterate(); iterator.hasNext();) { MyTable record = (MyTable) iterator.next(); System.out.println("id: " + record.getId()); System.out.println("firstName: " + record.getFirstName()); System.out.println("lastName: " + record.getLastName()); System.out.println("due: " + record.getDue()); System.out.println("email: " + record.getEmail()); System.out.println("website: " + record.getWebsite()); }
has comment: http://stackoverflow.com/comment/43047095
tagged with: list
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43047372
type: Question
has comment: http://stackoverflow.com/comment/43046897
tagged with: iterator

memoization
type: Tag
tags question: http://stackoverflow.com/q/27240082
tag name: memoization

http://stackoverflow.com/a/27302514
upvote count: 3
has comment: http://stackoverflow.com/comment/57031626
has body: Try doRpcCallSide instead of doRpcCall in TelegramApi object. It helped me.
downvote count: 0
answers question: http://stackoverflow.com/q/27243005
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/45993428

http://stackoverflow.com/a/27195429
has body: Check if u've got the JAVA_HOME environment variable. Check if the bin folder of your java installation is in the path and even if it is already there, move it to be the first one of the line. It should work.
score: 0
has comment: http://stackoverflow.com/comment/42880790
answers question: http://stackoverflow.com/q/27194853
type: Answer
has comment: http://stackoverflow.com/comment/42893070
has comment: http://stackoverflow.com/comment/42898521
has comment: http://stackoverflow.com/comment/42880803
has comment: http://stackoverflow.com/comment/42893260
has comment: http://stackoverflow.com/comment/42898542
has comment: http://stackoverflow.com/comment/42877320
has comment: http://stackoverflow.com/comment/42898012
has comment: http://stackoverflow.com/comment/42898688

http://stackoverflow.com/comment/42887816
comment on: http://stackoverflow.com/q/27200962
score: 0
type: Comment
type: QuestionComment
has text: @chrylis Thanx dear. Can you suggest something to optimize my query?

http://stackoverflow.com/comment/42926273
type: QuestionComment
type: Comment
has text: I tried to run a simple program :PowerMockito.mockStatic(StaticMockingExampleClass.class); Mockito.when(StaticMockingExampleClass.printString(anyString())).thenReturn(mockedResult); Mockito.when(StaticMockingExampleClass.printString(eq(inputString))).thenReturn(mockedResult); StaticMockingExampleClass.printString("Adf"); StaticMockingExampleClass.printString(inputString); StaticMockingExampleClass staticMockingExampleClass = Mockito.mock(StaticMockingExampleClass.class); But still its not working in IntelliJ with grails 2.2 and powermock 1.5
comment on: http://stackoverflow.com/q/27182976
score: 0

http://stackoverflow.com/q/27186755
has comment: http://stackoverflow.com/comment/42865574
has comment: http://stackoverflow.com/comment/42862114
score: -1
has comment: http://stackoverflow.com/comment/42864736
tagged with: javafx-8
has answer: http://stackoverflow.com/a/27192826
answer count: 1
has title: How to handle correlated FX properties?
has comment: http://stackoverflow.com/comment/42862484
favorite count: 0
accepted answer: http://stackoverflow.com/a/27192826
downvote count: 2
tagged with: properties
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has body: Properties - ol' style bean properties just the same as blinky fx properties - work best if they are orthogonal to each other. They pose problems - again, both types - if they are somehow correlated. Which might happen in nasty Real World more often than we like. As an example take the twosome selectedIndex/selectedItem: the index points to the position of the item in a list if it is contained, or is negative if not. Updating one requires to update the other as well. For java beans, the solution is straightforward because the bean itself has full control about when to fire the changes. And for fx beans? A base pattern used in SelectionModel Property&lt;T&gt; theRealItemProperty = new SimpleObjectProperty&lt;&gt;(); ReadOnlyProperty&lt;T&gt; readOnlyItemProperty = new ReadOnlyObjectProperty(theRealItemProperty); /** * Public access is read-only */ public final ReadOnlyProperty&lt;T&gt; itemProperty() { return readOnlyItemProperty; } /** * Setting allowed for subclasses only (and mis-behaving package neighbors ;-) */ protected final void setItem(T item) { theRealItemProperty.set(item); } /** * Special setting api for general public */ public void select(T item) { setIndex(indexOf(item)); setItem(item); } The properties fire at the time of calling their setters, the bean has no control. As internal state is unstable between those calls, listeners to the first must not access the second on receiving the notification .. as they can’t know which is the first to fire, they cannot rely on the bean being stable, ever. What to do now, either on owning bean or client side? Somehow defer the fire? The ol' trick Platform.runLater() scattered all over application code? Stumped ..

http://stackoverflow.com/q/27273547
tagged with: persistence
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/27273694
has title: Why in all tutorials write named query in the entity class. It's the logic part
has comment: http://stackoverflow.com/comment/43016506
has answer: http://stackoverflow.com/a/27273694
upvote count: 1
downvote count: 1
has body: it is good practice don't have any logic in POJO classes, but NamedQuery contains some logic
type: AnsweredQuestion
tagged with: named-query
tagged with: java
has comment: http://stackoverflow.com/comment/43016531
type: Question
answer count: 1

http://stackoverflow.com/comment/42998355
type: AnswerComment
has text: Each platform uses a different strategy, but I've had no issues on Mac OS X 6/9, Ubuntu 12/14 or Windows XP/7. See also [*Encrypted Preferences in Java*](http://www.drdobbs.com/security/encrypted-preferences-in-java/184416587).
comment on: http://stackoverflow.com/a/27214106
type: Comment
score: 0

http://stackoverflow.com/a/32259911
has body: It looks like the Java spark API has issues with certain JOIN operations.It worked when I tried the same with scala
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27268965
type: Answer
answers question: http://stackoverflow.com/q/27268965

http://stackoverflow.com/a/27178904
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42849660
score: 2
answers question: http://stackoverflow.com/q/27178870
has body: Your Main class is inside com.company package. you should give it's full name to the command prompt: java com.company.Main besides, you should add the .class file to the classpath: java -cp Main.class com.company.Main
downvote count: 0

http://stackoverflow.com/comment/42843574
score: 0
type: Comment
type: QuestionComment
has text: There is a difference between the class of a *reference* and the class of the *object* that the reference addresses. Casting can change the class of the *reference* but will never change the class of the *object*. (Note that reference casting is entirely different from scalar casting.) The compiler only knows what the class of the *reference* is.
comment on: http://stackoverflow.com/q/27177171

http://stackoverflow.com/q/27205293
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43248784
has answer: http://stackoverflow.com/a/27207608
tagged with: mongodb
has answer: http://stackoverflow.com/a/29898338
has title: Storing a LatLon class as GeoJSON using MongoDB / Morphia (Scala or Java)
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/27385475
downvote count: 0
tagged with: morphia
score: 1
favorite count: 0
has body: I'm writing an application that needs to make use of geo-referenced data, and I'd like to use MongoDB + Morphia. The application is in Scala, but if a portion needs to be Java, that's ok (yay compatibility!) I have a class to represent the Latitude and Longitude of events: class LatLon { @BeanProperty var latDegrees : Double @BeanProperty var lonDegrees : Double } It's not a very exciting class, but it is useful in this context. Now, I have an event that I record at a location: class ObservedEvent { @BeanProperty var observation : String = _ @Beanproperty var location : LatLon = _ } Now, I have a ton of observed events and I want to store them in MongoDB with Morphia. The 'location' should be stored as a GeoJson Point so I can index the collection, etc. I have tried making SimpleValueConverter's, adapters, and a few other hacks, but I haven't been able to figure out how to make this work. It seems like such a common use-case that it would be built in. Hopefully the answer here is "It's built in! Look [here]". If it is, I haven't found it :( Thanks!
has answer: http://stackoverflow.com/a/28322944
type: Question
tagged with: scala
tagged with: geospatial
has comment: http://stackoverflow.com/comment/43246682

http://stackoverflow.com/comment/43063325
has text: Yes. Since these operations are free, it's a great tool.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27298697
type: AnswerComment

http://stackoverflow.com/q/27306795
has body: I have a swing jFrame set up with a control group which contains 3 radio buttons. when one is clicked it sends its label to a jtextfield in a different class i have code parsing text by a term Scanner s = null; try { s = new Scanner(new BufferedReader(new FileReader("/Stage_One.txt"))); s.useDelimiter("\\*"); String total = (s.next()); Pattern p = Pattern.compile("\\n[\\n]+"); String[] parts = p.split(total); boolean searchArrayResult = false; java.io.File targetFile = new java.io.File("/Stage_Two.txt"); java.io.FileWriter filew = new java.io.FileWriter(targetFile); java.io.PrintWriter print = new java.io.PrintWriter(filew, true); for (String str : parts) { searchArrayResult = str.contains("THIS IS WHERE I WANT THE RESULT OF THE RADIO BUTTON GROUP"); if (searchArrayResult) { print.println(str + "\n"); //System.out.println(str + "\n"); } } while (s.hasNext()) { } } catch (Exception ex) { } } } I just need to know how to access the jframe variables (textfields, panels and such) so i can use their inputs in code to filter a text file. i know i have to link the 2 together but i am unsure of how to do it, and most searches are for jFrame to jFrame. Thanks in advance.
has comment: http://stackoverflow.com/comment/43076075
has title: java pass jTextfield text on jframe to seperate class
score: 0
has comment: http://stackoverflow.com/comment/43076101
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43075980
answer count: 0
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/comment/42971394
comment on: http://stackoverflow.com/a/27247752
score: 0
type: AnswerComment
has text: @Shubh:It is throwing this error------unknown error: Element is not clickable at point (627, 423). Other element would receive the click: ...
type: Comment

http://stackoverflow.com/q/27303349
has title: CDI with Jersey and Tomcat7 - Interceptors are never invoked
tagged with: java
type: Question
score: 0
tagged with: jersey
has body: I'm trying to work CDI interceptors with Jersy abd Tomcat 7. But it never worked. Can some one please help me. I'm kind of trying the example provided by Jersey with some minor modifications. Here is my code. Interestingly I can see the message "Injected....." in the output, means @PostConstruct annotation is working. Pom.xml javax.ws.rs javax.ws.rs-api 2.0 javax.annotation javax.annotation-api 1.2 javax.enterprise cdi-api 1.2 org.glassfish.jersey.containers jersey-container-servlet-core 2.13 org.glassfish.jersey.containers.glassfish jersey-gf-cdi 2.13 beans.xml in WEB-INF <beans> org.glassfish.jersey.examples.cdi.resources.LoggedInterceptor <beans/> Logged.java import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; @InterceptorBinding @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Logged { } LoggedInterceptor.java import java.io.Serializable; import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; @Interceptor @Logged public class LoggedInterceptor implements Serializable { public LoggedInterceptor() { System.out.println("Invoked...."); } @AroundInvoke public Object logMethodEntry(InvocationContext invocationContext) throws Exception { System.out.println("Entering method: " + invocationContext.getMethod().getName() + " in class " + invocationContext.getMethod().getDeclaringClass().getName()); return invocationContext.proceed(); } } LoggedInterceptorTest.java public class LoggedInterceptorTest { @Logged public void testLoggedInterceptor() { System.out.println("Called..."); } public static void main(String[] args) { LoggedInterceptorTest l = new LoggedInterceptorTest(); l.testLoggedInterceptor(); } } Service EchoParamFieldResource.java import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.…
has comment: http://stackoverflow.com/comment/43087913
answer count: 1
has comment: http://stackoverflow.com/comment/43087965
linked to: http://stackoverflow.com/q/27269482
tagged with: cdi
has answer: http://stackoverflow.com/a/27311506
type: UnansweredQuestion
tagged with: tomcat7

http://stackoverflow.com/q/27209669
has answer: http://stackoverflow.com/a/27210137
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27210137
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/27209684
type: Question
tagged with: jpanel
has title: Getting paintComponent elements of a JPanel to work with another JPanel inside of it
answer count: 2
has body: I have a JPanel with a simple animated snow particle effect inside of a JFrame, and it works from on its own. But when I try and add another panel to it, it makes the effect of the snow stop. Can anyone help me with this? Is it a problem with layering, or something? Or is it an issue with my Layout Managers? My Code: package christmasfinal; import java.awt.*; import javax.swing.*; public class ChristmasFinal extends JApplet { public static void main(String[] args) { JFrame frame = new JFrame(); TreePanel treePanel = new TreePanel(); frame.setSize(550, 420); SnowBackgroundPanel snowPanel = new SnowBackgroundPanel(frame.getWidth(), frame.getHeight()); treePanel.setSize(200, 320); snowPanel.setSize(frame.getWidth(), frame.getHeight()); snowPanel.setLayout(new BorderLayout()); frame.setLayout(new BorderLayout()); frame.add(snowPanel, BorderLayout.CENTER); snowPanel.add(treePanel, BorderLayout.CENTER); System.out.println(treePanel.getWidth() + " " + treePanel.getHeight()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setTitle("Christmas Final"); } } package christmasfinal; import javax.swing.*; import java.awt.*; public class TreePanel extends JPanel{ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int[] treeX = {getWidth()/2, getWidth()/2-20, getWidth()/2-60, getWidth()/2-20, getWidth()/2-40, getWidth()/2-80, getWidth()/2-20, getWidth()/2-60, getWidth()/2-100, getWidth()/2+100,getWidth()/2+60, getWidth()/2+20, getWidth()/2+80, getWidth()/2+40, getWidth()/2+20, getWidth()/2+60, getWidth()/2+20, getWidth()/2}; int[] treeY = {getHeight()/2-120, getHeight()/2-80, getHeight()/2-40, getHeight()/2-40, getHeight()/2-20, getHeight()/2, getHeight()/2, getHeight()/2+40, getHeight()/2+60, getHeight()/2+60, getHeight()/2+40, getHeight()/2, getHeight()/2, getHeight()/2-20, getHeight()/2-40, getHeight()/2-40, getHeight()/2-80, getHeight()/2-120}; g.setColor(Color.GREEN); g.fillPolygon(treeX, treeY, treeX.length); g.…
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27209684
tagged with: jframe

http://stackoverflow.com/a/27208327
answers question: http://stackoverflow.com/q/27208123
has body: You could check what kind of symbols are here $ nm -D libgetmacip.so will produce list of symbols If you have to demangle C++ names, use c++filt $ nm -D libgetmacip.so | c++filt check "man nm" for info how symbols are marked/used
upvote count: 1
has comment: http://stackoverflow.com/comment/42898618
score: 1
downvote count: 0
type: Answer

google-api
tags question: http://stackoverflow.com/q/27269848
tags question: http://stackoverflow.com/q/27194988
tags question: http://stackoverflow.com/q/27189224
tags question: http://stackoverflow.com/q/27228669
tag name: google-api
tags question: http://stackoverflow.com/q/27286978
type: Tag

http://stackoverflow.com/q/27242539
tagged with: exception
has answer: http://stackoverflow.com/a/27252597
tagged with: data-access
tagged with: java
type: Question
type: AnsweredQuestion
has body: I am using IBM DB2 and Hibernate in my java application. Whwnever I end up with a DataAccessException in my application I am getting a stacktrace like follows DataAccessException: {}com.ibm.websphere.ce.cm.DuplicateKeyException: [jcc][50053][12311][3.65.102] T2zOS exception: [jcc][T2zos]T2zosPreparedStatement.readExecuteInternal:nativeExecute:9943: DB2 engine SQL error, SQLCODE = -803, SQLSTATE = 23505, error tokens = IX6040UC;000001136E ERRORCODE=-803, SQLSTATE=23505 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57) at java.lang.reflect.Constructor.newInstance(Constructor.java:540) I am able to make sense out of almost all the items in stacktrace but this 000001136E in error tokens.What does it signify?
tagged with: hibernate
tagged with: db2
has title: need elaborate info on IBM DB2 error tokens while getting DataAccessException via hibernate
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27252597

http://stackoverflow.com/comment/43061668
has text: I checked very carefully, and the extension was .png instead of .jpg. Thanks!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27216208

http://stackoverflow.com/comment/42819439
type: QuestionComment
comment on: http://stackoverflow.com/q/27158610
score: 0
type: Comment
has text: @fge standard RLE doesn't need a dictionary upfront, image RLE does but that's only to say whether it is using 4 bits or 8 bit to represent the runLength. RLE just checks whether a value is recurring, if it is it adds the amount the value recurrs in a row in front of said value. then removes the recurring ones. So String AAAABB when RLE compressed becomes 4A2B so going from 6 bits to 4 bits (if each Char was 1 bit). Huffman however does need a dictionary as in the above example AAAA could become just A and BB could become B. but if we had AAAABBAAA then AAA would need to be C or A2 or somethin

http://stackoverflow.com/q/27166610
tagged with: syntax
tagged with: java
has answer: http://stackoverflow.com/a/27166672
type: Question
has comment: http://stackoverflow.com/comment/42825203
accepted answer: http://stackoverflow.com/a/27166672
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/27166931
favorite count: 0
has title: What does the dot operator `.` (before the generic parameter) mean?
has answer: http://stackoverflow.com/a/68647527
upvote count: 25
possible better answer: http://stackoverflow.com/a/27166862
has body: I saw this code today: ImmutableMap&lt;Class&lt;? extends ClientCommand&gt;, CommandProcessorInterface&gt; immutableMap = ImmutableMap.&lt;Class&lt;? extends ClientCommand&gt;, CommandProcessorInterface&gt;of(... What does this syntax mean? ImmutableMap.&lt;Class .. I knew generics was right after the class name. No? What is the difference between: ImmutableMap&lt;Class.. and ImmutableMap.&lt;Class..
has answer: http://stackoverflow.com/a/27166862
answer count: 4
score: 25
type: AnsweredQuestion
tagged with: guava

http://stackoverflow.com/comment/42919237
has text: Hi your code is working fine. But i just wondering how you going to differential the data type? For example the data i read from notepad consist of date,string and number. How can i differential it and store in table?
type: Comment
comment on: http://stackoverflow.com/a/27189320
score: 0
type: AnswerComment

http://stackoverflow.com/a/34017291
score: 0
answers question: http://stackoverflow.com/q/27285945
type: Answer
has body: Manually finding the solution is a lot of work. Regular Expression could be a sweet solution to your problem. Have a look at the link below: How to calculate syllables in text with regex and Java Also be reminded that the above reference doesnot consider Y as a syllable, you will have to tweak the regular expression a bit to get the desired output. Plus the vowel "e" needs some checking to be done to get the exact results.

http://stackoverflow.com/a/27219720
score: 3
upvote count: 3
has body: You need to create a custom renderer for that column of the table. Read the section from the Swing tutorial on Using Custom Renderers for more information. The example in the tutorial shows how to format a date, so you would modify the code to format your string.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27219674

http://stackoverflow.com/comment/42830997
type: AnswerComment
has text: sry that is my mistake....edited
type: Comment
comment on: http://stackoverflow.com/a/27169945
score: 0

http://stackoverflow.com/q/27182184
tagged with: java
upvote count: 1
type: Question
has title: How do I use ServiceLoader in a Netbeans Platform project to add SPIs
has comment: http://stackoverflow.com/comment/43077613
tagged with: wrapper
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans-8
tagged with: netbeans-platform
type: UnansweredQuestion
has body: I'm trying to add MP3 capabilities to my Netbeans Platform project in Netbeans 8.0. I understand that this can be easily added to the javax.sound.sampled libraries using ServiceLoader and an SPI for the MP3 codecs. So I downloaded MP3 SPI and unzipped it, then in Netbeans I created a Jar wrapper module with the three jars that were in the zip file (one jar was in the root of the zip and two were under lib/). Then I made the modules that need the MP3 functionality depend on this wrapper module. But when I call AudioSystem.getAudioFileTypes() in those modules, "MP3" is not one of the types (only "WAVE", "AU" and "AIFF") What am I missing? I checked that the correct files are listed under META-INF/services in the main jar. do I need to recreate the lib/ structure in my wrapper module? Does it make a difference what code-base I use for the wrapper module? Do I need to alert the ServiceLoader somehow in my code? Here is the project metadata for the wrapper module: <?xml version="1.0" encoding="UTF-8"?> org.netbeans.modules.apisupport.project org.sil.wrapper.mp3spi <suite-component/> <module-dependencies/> javazoom.jl.converter javazoom.jl.decoder javazoom.jl.player javazoom.jl.player.advanced javazoom.spi javazoom.spi.mpeg.sampled.convert javazoom.spi.mpeg.sampled.file javazoom.spi.mpeg.sampled.file.tag org.tritonus.share org.tritonus.share.midi org.tritonus.share.sampled org.tritonus.share.sampled.convert org.tritonus.share.sampled.file org.tritonus.share.sampled.mixer ext/mp3spi1.9.5.jar release/modules/ext/mp3spi1.9.5.jar ext/tritonus_share.jar release/modules/ext/tritonus_share.jar ext/jl1.0.1.jar release/modules/ext/jl1.0.1.jar
tagged with: netbeans
score: 1
has answer: http://stackoverflow.com/a/27342031

http://stackoverflow.com/q/27171922
has comment: http://stackoverflow.com/comment/42837107
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42835426
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am getting a string like String s = "abc:xyz". Is there any direct method to convert it into JsonObject having abc as key and xyz as value. I know there a way by converting string into String s = "{\"abc\":\"xyz\"}" and then I can use JSONObject j =(JSONObject) new JSONParser().parse(s); But I have too large list of string to convert into json object. So i don't want to preprocess to convert into quoted string. And one more way to split string on : . But i want to know any parser method which convert directly into object. So that i does not have to split. It is also a kind of preprocessing. If there is any way to convert by passing string to method. please suggest.
has title: converting string into json object
score: -1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27171977
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27171984
has comment: http://stackoverflow.com/comment/42835495

http://stackoverflow.com/q/27212424
has comment: http://stackoverflow.com/comment/42905723
has comment: http://stackoverflow.com/comment/42905760
type: Question
has comment: http://stackoverflow.com/comment/42905676
answer count: 1
has body: import java.util.LinkedList; import java.util.Queue; class Node { public int iData; // data item (key) public double dData; // data item public Node leftChild; // this node's left child public Node rightChild; // this node's right child public int level; public boolean flag; public void displayNode() // display ourself { System.out.print('{'); System.out.print(level); System.out.print(", "); System.out.print(iData); System.out.print(", "); System.out.print(dData); System.out.print("} "); System.out.println(" "); } } // end class Node // ////////////////////////////////////////////////////////////// class Tree { private Node root; // first node of tree // ------------------------------------------------------------- public Tree() // constructor { root = null; } // no nodes in tree yet // ------------------------------------------------------------- public void insert(int id, double dd) { Node newNode = new Node(); // make new node newNode.iData = id; // insert data newNode.dData = dd; if (root == null) // no node in root root = newNode; else // root occupied { Node current = root; // start at root Node parent; while (true) // (exits internally) { parent = current; if (id &lt; current.iData) // go left? { current = current.leftChild; if (current == null) // if end of the line, { // insert on left parent.leftChild = newNode; return; } } // end if go left else // or go right? { current = current.rightChild; if (current == null) // if end of the line { // insert on right parent.rightChild = newNode; return; } } // end else go right } // end while } // end else not root } // end insert() // ------------------------------------------------------------- public void breadthFirstDisplay() { Queue newQueue = new LinkedList(); int level = 0; newQueue.add(root); int temp = root.iData; while (!newQueue.isEmpty()) { Node theNode = (Node) newQueue.remove(); if (temp &gt; theNode.iData) level++; theNode.level = level; theNode.displayNode(); temp = theNode.iData; if (theNode.leftChil…
score: 0
has title: how to print a tree in order by using stack and depth first search?
has answer: http://stackoverflow.com/a/27212662
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42905811
tagged with: depth-first-search
tagged with: java

http://stackoverflow.com/a/27306662
type: Answer
score: 29
has comment: http://stackoverflow.com/comment/43132631
upvote count: 29
has comment: http://stackoverflow.com/comment/76601664
has comment: http://stackoverflow.com/comment/43092879
has comment: http://stackoverflow.com/comment/43093477
has body: The Java Persistence wikibook has a section called Primary Keys through OneToOne and ManyToOne Relationships which seems to indicate that what you want is possible. If I'm reading it right, for your case, it would look something like: class Vehicle { @Id @Column(name = "EXTRAS_ID") private long extrasId; @OneToOne(mappedBy="vehicle", cascade=CascadeType.ALL) private TravelExtra extras; } class TravelExtras { @Id @Column(name = "VEHICLE_ID") private long vehicleId; @OneToOne @PrimaryKeyJoinColumn(name="VEHICLE_ID", referencedColumnName="EXTRAS_ID") private Vehicle vehicle; public TravelExtras(Vehicle vehicle) { this.vehicleId = vehicle.getId(); this.vehicle = vehicle; } } Note that one of your entities will need to make sure it has the same id as the other, which is accomplished in the example by the TravelExtras constructor requiring the Vehicle it is bound to.
answers question: http://stackoverflow.com/q/27305950
downvote count: 0
has comment: http://stackoverflow.com/comment/84059165
has comment: http://stackoverflow.com/comment/84080596
has comment: http://stackoverflow.com/comment/93426243

http://stackoverflow.com/a/27294486
has body: You are not instantiating your abstract class or your interface. You are instantiating concrete classes that extend your abstract class (Test1 and Test2) or implement your interface (Test3 and Test4). It's allowed to assign an instance of a concrete class to a variable whose type is an interface or an abstract class. In fact, it's even encouraged.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27294442
score: 1

http://stackoverflow.com/a/27222377
score: 0
answers question: http://stackoverflow.com/q/27222294
type: Answer
has body: Write following command into remote machine Mysql Server. mysql&gt; GRANT ALL ON *.* to root@'localhost' IDENTIFIED BY 'your-root-password'; mysql&gt; FLUSH PRIVILEGES; This command helps you to connect remote machine to your machine

http://stackoverflow.com/a/27236639
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/27232739
score: 8
has comment: http://stackoverflow.com/comment/74401993
answers question: http://stackoverflow.com/q/27232739
has body: I was able to delete the directory recursively. Thanks @Rob here is the code that will help if anybody looking for it out there. public static void deleteDirectory(ChannelSftp sftp, String oldestBackup) throws SftpException { if (isDir(sftp, oldestBackup)) { sftp.cd(oldestBackup); Vector &lt; LsEntry &gt; entries = sftp.ls("."); for (LsEntry entry: entries) { deleteDirectory(sftp, entry.getFilename()); } sftp.cd(".."); sftp.rmdir(oldestBackup); } else { sftp.rm(oldestBackup); } } private static boolean isDir(ChannelSftp sftp, String entry) throws SftpException { return sftp.stat(entry).isDir(); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27178059
upvote count: 1
has comment: http://stackoverflow.com/comment/42845373
type: Answer
has body: You need to keep in mind that compilation and execution are two different processes that happen at different times and have different kinds of information available to them. The compiler has to predict the future -- it has to decide whether it can guarantee that your code will make sense in the future, at runtime. It does this by analyzing the types of the objects in your code. The runtime, on the other hand, just has to inspect the current state of things. When you read the line A a = new B(), you are inferring more information about the a local variable than the compiler is. The compiler basically just sees this as A a = &lt;some expression&gt;. It does not take note of the contents of the expression that's used to produce the value for a. The fact that you've said A a = ... is you telling the compiler: "hey, this a thing I'm going to deal with in the rest of my program, it's just an A, don't assume anything more about it." If you had instead said B a = ..., then you're telling the compiler that it's a B (and the compiler also sees B extends A elsewhere in your code, so it knows it's also an A). The subsequent expressions a instanceof A, a instanceof B, a.getClass(), and a.toString() are legal, from the compiler's point of view, regardless of the type of a: the instanceof operator and the getClass() and toString() methods are defined for all Objects. (The compiler does not need to predict what value those expressions will produce at runtime, just that they will produce either true or false, some Class&lt;?&gt;, and some String, respectively.) But then when you come to a.valA and a.valB, the compiler actually has to do some real work. It needs to prove or guarantee that the a object will have a valA and a valB field at runtime. But since you've explicitly told it earlier to just assume that a is an A, it can not prove that it will have a valB field at runtime. Now, later on, at execution time, the JVM has more information. When it evaluates a.getClass(), it actuall…
downvote count: 0
answers question: http://stackoverflow.com/q/27177171
score: 1

http://stackoverflow.com/comment/42909632
type: Comment
comment on: http://stackoverflow.com/a/27214743
has text: It is still printing out as 0. I wonder if there is an issue with the method?
score: 0
type: AnswerComment

http://stackoverflow.com/q/27210163
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/27210188
has body: I am writing a java project, but am having trouble with it. I am passing new value (0, 0) and (6, 0) in my Horizontal class (subclass), but when I run the program my output is (0, 0) and (4, 4) which are the values passed in in my super class! I do not know how to fix the issue! I would appreciate it if you give me an idea of where I am doing wrong. I need to follow the instructions! public class Segment implements SegmentInterface { // two Points that hold endpoints of the segment private Point p1; private Point p2; // Default constructor that will set the endpoints to new // Points with values (0,0) and (4,4) public Segment() { //this(0, 0, 4, 4); this.p1 = new Point(0, 0); this.p2 = new Point(4, 4); } // Parameterized constructor that accepts (int x1, int y1, int x2, int y2) // and creates and sets the endpoints public Segment(int x1, int y1, int x2, int y2) { //this.p1 = new Point(x1, y1); //this.p2 = new Point(x2, y2); if(x1 == x2 &amp;&amp; y1 == y2){ throw new IllegalArgumentException("Points can't have a lenght of 0!"); } else{ this.p1 = new Point(x1, y1); this.p2 = new Point(x2, y2); } } //A parameterized constructor that accepts (Point p1, Point p2) and sets both //the endpoints to a deep copy of the Points that are passed in. //Make sure to check to see if both Points are equal. This would be a //theoretical "Segment" of length 0 which is not allowed, so throw a new //IllegalArgumentException. public Segment(Point p1, Point p2) { this.p1 = new Point(p1.getX(), p1.getY()); this.p2 = new Point(p2.getX(), p2.getY()); if(p1.equals(p2)){ throw new IllegalArgumentException("Points cannot have same values!"); } } // Copy constructor that accepts a Segment and initializes the data (of the // new Segment being created) to be the same as the Segment that was // received. public Segment(Segment other) { this(other.p1, other.p2); //if(other.p1 == other.p2){ //throw new IllegalArgumentException("Undefine!"); //} and here is my subclass: //HorizontalSegment.java public…
has comment: http://stackoverflow.com/comment/42902066
favorite count: 0
has title: My Subclass is passing values from its super class
upvote count: 1
tagged with: superclass
tagged with: parameters
has answer: http://stackoverflow.com/a/27210188

http://stackoverflow.com/comment/42973655
type: Comment
has text: Sorry bro !! It was the speech to text api itself which I used
comment on: http://stackoverflow.com/a/27248286
score: 0
type: AnswerComment

http://stackoverflow.com/a/27179485
type: Answer
has comment: http://stackoverflow.com/comment/42847742
upvote count: 2
has comment: http://stackoverflow.com/comment/42848013
answers question: http://stackoverflow.com/q/27179372
score: 2
downvote count: 0
has body: Objects are not volatile. Variables are volatile. It is safe to play with the variable worksWaiting. It is not safe to play with the object it refers to unless it is documented as thread-safe or you synchronize all access to it correctly.

http://stackoverflow.com/a/27201145
has comment: http://stackoverflow.com/comment/42893271
accepted answer of: http://stackoverflow.com/q/27199252
answers question: http://stackoverflow.com/q/27199252
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class Main { public static void main(String[] args) throws Exception { String html = "&lt;div&gt;"+ "&lt;img class=\"absmiddle-blah foo-bar\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"absmiddle-blah2 foo-bar2\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"ablehe-bla2h foo-bar3\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"absmiddle-bl2ah foo-bar4\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"blah-bl2ah foo-bar4\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"absmiddle-bl2ah foo-bar4\" src=\"google.com/image.png\" \\&gt;"+ "&lt;img class=\"sdfdle-bl2ah foo-bar4\" src=\"google.com/image.png\" \\&gt;"+ "&lt;/div&gt;"; Document doc = Jsoup.parse(html); Elements els = doc.select("img[class*=absmiddle]"); System.out.println(els); } } You can check here for more examples of Jsoup's capabilities
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42893327
has comment: http://stackoverflow.com/comment/42893433

http://stackoverflow.com/q/27229383
type: Question
answer count: 2
has body: I'm using MyBatis in a project that fetches many rows (more than 2M rows). I have a simple question about how MyBatis works. Everytime I need an action from the mapper, does MyBatis read the XML file and extract the query? Or are the mappers put into memory and MyBatis access them directly? This is important, because access and read a XML file can have impact on the performance values we are expecting. Thanks in advance. Regards
possible better answer: http://stackoverflow.com/a/43987098
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/43987098
tagged with: mybatis
has answer: http://stackoverflow.com/a/27244265
type: AnsweredQuestion
score: 3
has title: MyBatis performance - access mappers
downvote count: 0
accepted answer: http://stackoverflow.com/a/27244265
favorite count: 0

http://stackoverflow.com/comment/43082046
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27310383
score: 0
has text: Actually i want to create tables without writing sql. just like django.

http://stackoverflow.com/comment/42983077
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27236179
has text: Upgrade to the latest driver and see what happens.
type: Comment

http://stackoverflow.com/q/27208402
has answer: http://stackoverflow.com/a/27208426
answer count: 1
has comment: http://stackoverflow.com/comment/42898853
has body: I wrote this code which is supposed to search for prime numbers and put them into an array. Here it is: int[] prime_array = new int[(int)s.upper_bound]; int index_in_array = 0; boolean are_we_done = false; int index = 1; boolean is_prime = true; while (!are_we_done) { try { for (int i = 1; i &lt; index; i++) { if ((index%i)==0) { is_prime = false; } } if (is_prime) { prime_array[index_in_array] = index; index_in_array++; } index++; is_prime = true; } catch (IndexOutOfBoundsException e) { are_we_done = true; break; } } Unfortunately, the only prime it catches is 1. Any idea why it doesn't work?
has comment: http://stackoverflow.com/comment/42898838
tagged with: primes
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27208426
linked to: http://stackoverflow.com/q/729379
has comment: http://stackoverflow.com/comment/42898831
type: Question
has title: Java - Prime Number Algorithm Implementation doesn't work
tagged with: java
has comment: http://stackoverflow.com/comment/42898796
has comment: http://stackoverflow.com/comment/42898950
has comment: http://stackoverflow.com/comment/42898787
score: 0
has comment: http://stackoverflow.com/comment/42898722

http://stackoverflow.com/q/27196194
has comment: http://stackoverflow.com/comment/42926793
has body: I am setting up GATE to run on a text document, I want to use DefaultTokenizer and POSTagger, but I am getting error while initializing ANNIE controller. Exception in thread "main" gate.creole.ResourceInstantiationException: No URL provided for the rules! at gate.creole.tokeniser.SimpleTokeniser.init(SimpleTokeniser.java:131) at gate.Factory.createResource(Factory.java:302) at gate.Factory.createResource(Factory.java:117) at gate.creole.tokeniser.DefaultTokeniser.init(DefaultTokeniser.java:55) at gate.Factory.createResource(Factory.java:302) at gate.Factory.createResource(Factory.java:97) Can you please help?
has answer: http://stackoverflow.com/a/27206353
has title: No list of internal splits provided! No Rules URL Provided?
type: Question
has answer: http://stackoverflow.com/a/30763182
tagged with: nlp
score: 0
tagged with: java
answer count: 3
tagged with: gate
accepted answer: http://stackoverflow.com/a/30763182
has answer: http://stackoverflow.com/a/29275776
possible better answer: http://stackoverflow.com/a/27206353
type: AnsweredQuestion

http://stackoverflow.com/q/27255843
has title: How to maintain an infinite loop with multiple buttons?
has answer: http://stackoverflow.com/a/27255988
tagged with: switch-statement
downvote count: 0
score: 1
has body: Alright so basically what I am trying to do is load my GUI with three buttons, "Clear", "Calculate", and "Quit". Through an infinite for loop, when I press Calculate I want it to break the loop. I have the code for the button functionality but when I press Quit before I press Calculate I get a NullPointerException (The button still closes the GUI but I get an error). What do I have to do in order to get rid of this error? Here's my code: form = new BasicForm("Clear", "Calculate", "Quit"); buildForm(); for ( ; ; ) { button = form.accept(); switch(button) { case 0: form.clearAll(); break; case 1: // calculate code goes here break; case 2: form.close(); break; } }
accepted answer: http://stackoverflow.com/a/27255932
type: Question
has comment: http://stackoverflow.com/comment/42985574
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42985831
has comment: http://stackoverflow.com/comment/42985483
favorite count: 0
tagged with: infinite
answer count: 2
upvote count: 1
tagged with: loops
has answer: http://stackoverflow.com/a/27255932
tagged with: java
has comment: http://stackoverflow.com/comment/42985714
possible better answer: http://stackoverflow.com/a/27255988

http://stackoverflow.com/comment/43555559
type: Comment
has text: ok, thanks for the offer, but how often will we get into such issues for the many potential matrix operations? Is this really feasible? Can this handle a matrix which consumes almost the entire RAM? Converting (and maybe persisting before) the MLlib matrix and loading it to a matrix library more usable from Java like commons-math or parallel colt will be the way to go while using Java on MLlib?
comment on: http://stackoverflow.com/a/27257514
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43035155
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27283305
has text: @KevH yes this answer is correct but my program is not returning it
score: 0

http://stackoverflow.com/a/27310721
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27300155
has body: There are many correct ways to implement such a class diagram. But in order to choose the correct implementation you should first make sure you understand the concepts of Association, Aggregation and Composition as they are defined in UML. I've written an article about that on my website: UML Composition vs Aggregation vs Association In short, the Composition is a type of Association with real constraints and impact on development, whereas the Aggregation is purely a functional indication of the nature of the Association with no technical impact.

http://stackoverflow.com/a/27177536
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27176552
has comment: http://stackoverflow.com/comment/42844429
upvote count: 5
has body: Yes, this is what System.inheritedChannel() is for. On the systemd side, you should be able to make your service file pass the socket as fd 0 (which is what Java expects) by setting StandardInput=socket.

http://stackoverflow.com/q/27229725
has comment: http://stackoverflow.com/comment/42936519
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42936471
has title: JUnitTest failing when creating subclass object
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/27229962
has comment: http://stackoverflow.com/comment/42936531
has comment: http://stackoverflow.com/comment/42936797
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42936709
has comment: http://stackoverflow.com/comment/42936547
upvote count: 0
has body: I got this superclass where I have some methods, one method is: abstract public void setHP(int health); In my subclass I have this method public void setHP(int health){ super.health = health } I then wrote a JUnitTest: @Test public void testEliteHetestUalth() { Subclass unit = new Subclass(); ... } And here it just fails, it's like I cant create an object of the subclass. Is there anything special about creating objects for subclasses? I hope I gave enough information.
tagged with: junit
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42936599
tagged with: abstract-class
has answer: http://stackoverflow.com/a/27229962
has comment: http://stackoverflow.com/comment/42936417
has comment: http://stackoverflow.com/comment/42936793

http://stackoverflow.com/q/27266177
type: UnansweredQuestion
downvote count: 0
score: 1
has body: My web applications runs at home and shall be accessed through NAT. Of course my DSL provider assigns varying IP-addresses to my home, so I get into the following situation: The setup: The web application is implemented on Jetty. A certificate was created with Java keytool and installed in Jetty. I have my private way to "guess" the IP address at home (not a dyndns provider). I can successfully access the web application from anywhere. So everything is fine, except: Whenever the DSL provider has changed my IP-address, I need to go through the three steps of telling firefox that the certificate is ok, which tends get annoying. I exported the certificate with keytool -exportcert -keystore WEB-INF/conf/hk_ssl_keystore -storepass XXXX -alias Einkaufsliste -file Einkaufsliste.cert and tried to import it into Firefox under Edit->Preferences->Advanced->View Certificates->Authorities but this results in This is not a certificate authority certificate, so it can't be imported into the certificate authority list. Now I wonder if I can tell firefox (and likely other browsers) that I am its master and I tell it by decree that this very certificate is trusted by me so there is no need to worry again?
tagged with: java
tagged with: ssl
favorite count: 0
type: Question
tagged with: firefox
tagged with: keytool
tagged with: ssl-certificate
upvote count: 1
answer count: 1
has title: java keytool self signed certificate use in firefox to trust changing DSL home IP-addresses
has answer: http://stackoverflow.com/a/27266332

http://stackoverflow.com/q/27292868
tagged with: structure
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27293563
answer count: 1
has title: Passing structure as parameter in RestApi using JAVA
accepted answer: http://stackoverflow.com/a/27293563
has body: I am basically trying to pass structures (complex objects) as arguments to a rest based service. Uptill now I know pass primitive types in URIs as varname=value&amp;varname2=value. My Question is how to pass structures containing multiple fields to the web service? For example i have a Rest based web service that maintains employee records. Now if a particular record has 15 fields, then when using POST method how will a client be able to send those 15 values apart from send it in URL. So a simple object Employee having name, employee id, date of joining, etc. I am using Eclipse for developing a java client. My webservice is wrttien in C using gSoap having httpget and httppost plugins. Requirement is to send complex structures as parameters to the service which can do processing on it and can return desired values.
has comment: http://stackoverflow.com/comment/43204896

http://stackoverflow.com/comment/43094604
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27309245
has text: Cannot resolve to a type error is very common. It means that it cannot find that class that it is looking for. The above code should work. If it is part of the old showcaseview. Why isn't it part of the new one?
type: AnswerComment

http://stackoverflow.com/q/27271123
accepted answer: http://stackoverflow.com/a/27433950
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43019439
has body: I obtained an excel (.xls) file that I cannot seem to load properly using POI libraries (versions tested 3.9, 3.10.1). The content of the file after loading goes along the lines of: , DIM_1, DIM_2, DIM_3, DIM_4,... ACTUAL, 0.0014, 16.0329, 240.4296,... DIM_22MAX, DIM_22MIN, , ,... whereas the real content is: Critical Parameters &amp; Quality Data Manufacturing Supplier: Manufacturer Supplier name: ??? Manufacturer Supplier code: Sampling Sample Size: 1 ... EDIT I have been updated that the file was generated using VBA. The java code used: Workbook workbook; workbook = WorkbookFactory.create(fileInputStream); workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK); Sheet sheet = workbook.getSheetAt(0); FormulaEvaluator evaluator = workbook.getCreationHelper() .createFormulaEvaluator(); inputMatrix = new ArrayList&lt;&gt;(); for (int j = 0; j &lt;= sheet.getLastRowNum(); j++) { ArrayList&lt;Object&gt; tRow = new ArrayList&lt;&gt;(); Row row = sheet.getRow(j); if (row != null) { for (int i = 0; i &lt; row.getLastCellNum(); i++) { Cell cell = row.getCell(i); if (cell == null) tRow.add(""); else try { switch (evaluator.evaluateInCell(cell) .getCellType()) { case Cell.CELL_TYPE_STRING: String strVal = /*cell.getStringCellValue();*/ cell.getRichStringCellValue().toString(); tRow.add(strVal); break; case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { tRow.add(cell.getDateCellValue()); } else { tRow.add(cell.getNumericCellValue()); } break; case Cell.CELL_TYPE_BOOLEAN: tRow.add(cell.getBooleanCellValue()); break; case Cell.CELL_TYPE_FORMULA: tRow.add(cell.getCellFormula()); break; default: tRow.add(""); } } catch (Exception e) { tRow.add("ERR"); logger.error("error evaluating excel file, assigning ERR value to the cell.", e); } } } inputMatrix.add(tRow); } Any thoughts...?
tagged with: apache-poi
has answer: http://stackoverflow.com/a/27433950
tagged with: excel
has title: Strange content of excel file loaded with POI
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/42855873
type: Comment
comment on: http://stackoverflow.com/q/27183759
has text: Well this sounds like it's about SQL rather than anything else then - and you haven't told us anything about the database or what's stored in it...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43052432
has text: I still can not solve this problem, if you have any evolution please post also
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27228426

http://stackoverflow.com/comment/43087071
type: Comment
type: QuestionComment
has text: Well, provided you use Jackson, you can use [one of my projects](https://github.com/fge/json-patch) (Spring uses it for instance) which supports both JSON Patch and JSON Merge Patch. If you are interested in JSON Merge Patch, you can [read the RFC](https://tools.ietf.org/html/rfc7386), it is a pretty easy read
comment on: http://stackoverflow.com/q/27312869
score: 0

http://stackoverflow.com/a/27269871
answers question: http://stackoverflow.com/q/27269637
type: Answer
upvote count: 3
downvote count: 0
has body: Variable names cannot start with a digit. The name 4dir is not a valid name for a variable. Reference: Java Language Specification paragraph 3.8: An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.
score: 3

http://stackoverflow.com/q/27300245
answer count: 3
has comment: http://stackoverflow.com/comment/43064576
has comment: http://stackoverflow.com/comment/43065090
has answer: http://stackoverflow.com/a/27320668
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43065236
upvote count: 1
has answer: http://stackoverflow.com/a/27308792
tagged with: java-8
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43064992
type: Question
has comment: http://stackoverflow.com/comment/43064756
has body: For instance i have some entity - Product public class Product { ... private String name; private int count; private Product associatedProduct; ... // GETTERS &amp; SETTERS } And also i have product finder which allows to find the product by filters: public interface Finder&lt;T&gt; { Set&lt;T&gt; find(Filter... filters); } And now i can execute the following code: Finder&lt;Product&gt; finder = ...; // find all products with name 'cucumber' Set&lt;Product&gt; finder.find(Filter.equals("name", "cucumber")); We don't like this code because i should have the 'soft' link to field name "name" and i can't have compile time exception in case misprint or any other mistake. For this reason i have created the code generator which generate static links to properties. The generated class looks like: public final class $Product { private final String context; // some factory is used to instance creation $PostEntity() {this.context = "";} $PostEntity(String context) {this.context = context;} public String name() { return context + "name";} public String count() { return context + "count";} public String associatedProduct() { return context + "associatedProduct";} public $Product associatedProductDot() { return new $Product( this.context + "associatedProduct.");} } For now i can make the following: Set&lt;Product&gt; finder.find(Filter.equals(Links.PRODUCT.name() , "cucumber")); //or Set&lt;Product&gt; finder.find(Filter.equals(Links.PRODUCT.associatedProductDot().name() , "cucumber")); It works like a charm and i happy. I know alternative approach with using proxy objects, but it imposes additional overhead in runtime and adds some magical moment in code, so this variant does not suit me. And finally my question: There is a more elegant approach to implement this functionality with using java 8?
has title: Hard link to field name in Java 8
has answer: http://stackoverflow.com/a/27300831
score: 0

http://stackoverflow.com/comment/42890318
has text: @haywire: I think it is perfectly fine to discuss it, as long as a civil tone is maintained.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27203807
type: AnswerComment

http://stackoverflow.com/q/27287872
linked to: http://stackoverflow.com/q/24395105
has comment: http://stackoverflow.com/comment/43042710
tagged with: ios
has comment: http://stackoverflow.com/comment/43042709
score: 0
has comment: http://stackoverflow.com/comment/43042466
type: UnansweredQuestion
tagged with: swift
has comment: http://stackoverflow.com/comment/43042517
answer count: 0
tagged with: java
has title: Equivalent of int[] a = new int[500]; in Java in Swift?
duplicate of: http://stackoverflow.com/q/24395105
has body: In Java, I can do this: int[] a = new int[500];. However in Swift, there seemed like there's no way I can create such a fixed size array without initializing all the variables in the array(which is quite impossible for an array of 500 elements). My goal here is to create a array of 160 SKSpriteNode.
type: Question

http://stackoverflow.com/q/27212598
upvote count: 20
has answer: http://stackoverflow.com/a/48927349
answer count: 5
has body: I'm using Retrofit (in combination with OkHttp and GSON) to communicate with an online webservice. The webservice has a default wrapper around all it's responses, similar to: { "resultCode":"OK", "resultObj":"Can be a string or JSON object / array", "error":"", "message":"" } In this example resultCode will either be OK or NO. Furthermore error and message only have any contents when an error has occured while processing the request. And last, but not least, resultObj will contain the actual result from the call (which is a string in the example, but some calls return a JSON array or a JSON object). To process this meta data, I created a generic class, like this one: public class ApiResult&lt;T&gt; { private String error; private String message; private String resultCode; private T resultObj; // + some getters, setters etcetera } I've also created classes that represent the responses sometimes given in resultObj and I've defined an interface for use with Retrofit, that looks a bit like this: public interface SomeWebService { @GET("/method/string") ApiResult&lt;String&gt; someCallThatReturnsAString(); @GET("/method/pojo") ApiResult&lt;SomeMappedResult&gt; someCallThatReturnsAnObject(); } As long as the request is valid this all works fine. But when an error occurs on the server side, it will still return a resultObj with a String-type. This causes someCallThatReturnsAnObject to crash inside the Retrofit RestAdapter / GSON library, with a message like this: retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 110 path $.resultObj Now, finally, my questions are: Is there an (easy) way to tell GSON that it should just ignore (aka "nullify") a property if it does not match the expected type? Can I tell GSON to treat empty strings as null?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
possible better answer: http://stackoverflow.com/a/34178227
has answer: http://stackoverflow.com/a/47280021
type: Question
score: 20
has answer: http://stackoverflow.com/a/27212876
has answer: http://stackoverflow.com/a/31604097
has title: GSON ignore elements with wrong type
accepted answer: http://stackoverflow.com/a/31604097
tagged with: retrofit
linked to: http://stackoverflow.com/q/33765241
tagged with: android
has answer: http://stackoverflow.com/a/34178227
favorite count: 0

http://stackoverflow.com/a/27241023
upvote count: 1
answers question: http://stackoverflow.com/q/27240957
downvote count: 0
type: Answer
has body: You are passing a Type Penny to the remove method. You should be passing an object. As for the get method you should probably read this: Why doesn&#39;t java.util.HashSet have a get(Object o) method? Furthermore, a typical issue that can cause problems looking up an object in a Hashset is if Penny doesn't have a proper hashCode() method. Removing an arbitrary Penny like this might not be exactly what you were trying to do in the first place. If, you want to remove the last one added (called popping from the stack) you may want to look into using a different collection
score: 1

http://stackoverflow.com/comment/43117546
has text: OK I'm not entirely sure from which context you are executing your code, but if you have a look at the code of org.jbpm.process.instance.command.ResumeProcessInstanceCommand in the jbpm-flow project you may get a better idea of what needs to be done
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27328658

http://stackoverflow.com/comment/43080509
type: Comment
comment on: http://stackoverflow.com/a/27309449
has text: I made a java class called constants and then in my main activity tried to set one, and got `cannot find symbol`
type: AnswerComment
score: 0

http://stackoverflow.com/q/27238616
has title: The executable generated by install4j doesnt start
type: Question
tagged with: windows
upvote count: 6
accepted answer: http://stackoverflow.com/a/27244617
answer count: 1
tagged with: java
tagged with: install4j
has body: I'm evaluating install4j since I want to generate an executable for our Windows-users. Normally we run our app directly in Eclipse, or using bash scripts. We have one big jar with the whole framework as well as our applications, and some dependency jars. On deployment we set the class path with one shellscript and start the individual applications using other shellscripts. This procedure work on both Linux, Mac and Windows. Now I tried installing the demo version of install4j, and have been struggling to create an installer. The result right now is that I build an installer that runs, and installs a generated EXE and all our other files in a directory structure under it. However starting the generated executable doesnt work very well. The demo dialog is shown, and then after a while the application exits without any error messages. My guess is of course that it crashes, probably because the classpath is incorrect or something similar. The problem is, I have been playing around with the options in install4j for a couple of hours without any change in behaviour, and I'm in the dark right now. Adding the whole LIB directory, "Scan directory", adding jars individually etc etc. Is there any way I can get some debugging information out frm the generated executable? Or any info at all abut what is going wrong?
tagged with: eclipse
score: 6
tagged with: classpath
has answer: http://stackoverflow.com/a/27244617
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/27208218
tagged with: java
has comment: http://stackoverflow.com/comment/42901228
has body: I'm working out of the "Android Game Programming For Dummies" book and I'm getting the exception IllegalArgumentException: UnknownBitmapConfiguration. I've been looking everywhere for what could be causing this but no luck. I'm pretty new to programming so any help would be appreciated. Here's my WhackAMoleView.java public WhackAMoleView(Context context, AttributeSet attrs){ super(context,attrs); SurfaceHolder holder = getHolder(); holder.addCallback(this); thread = new WhackAMoleThread(holder,context, new Handler(){ @Override public void handleMessage(Message m){ } }); setFocusable(true); } public WhackAMoleThread getThread(){ return thread; } class WhackAMoleThread extends Thread{ public WhackAMoleThread(SurfaceHolder surfaceHolder, Context context, Handler handler){ mySurfaceHolder = surfaceHolder; myContext = context; backgroundImg = BitmapFactory.decodeResource (context.getResources(), R.drawable.title); } @Override public void run(){ while (running){ Canvas c = null; try { c = mySurfaceHolder.lockCanvas(null); synchronized (mySurfaceHolder){ draw(c); } }finally{ if(c != null){ mySurfaceHolder.unlockCanvasAndPost(c); } } } } private void draw (Canvas canvas){ try{ canvas.drawBitmap(backgroundImg,0,0,null); if (!onTitle){ canvas.drawBitmap(mole, mole1x, mole1y,null); canvas.drawBitmap(mole, mole2x, mole2y, null); canvas.drawBitmap(mole, mole3x, mole3y, null); canvas.drawBitmap(mole, mole4x, mole4y, null); canvas.drawBitmap(mole, mole5x, mole5y, null); canvas.drawBitmap(mole, mole6x, mole6y, null); canvas.drawBitmap(mole, mole7x, mole7y, null); canvas.drawBitmap(mask, (int) 50* drawScaleW, (int) 450* drawScaleH, null); canvas.drawBitmap(mask, (int) 150* drawScaleW, (int) 400* drawScaleH,null); canvas.drawBitmap(mask, (int) 250* drawScaleW, (int) 450* drawScaleH,null); canvas.drawBitmap(mask, (int) 350* drawScaleW, (int) 400* drawScaleH, null); canvas.drawBitmap(mask, (int) 450* drawScaleW, (int) 450* drawScaleH, null); canvas.drawBitmap(mask, (int) 550* drawScale…
has title: IllegalArgumentException: UnknownBitmapConfiguration what is causing my game to crash?
has comment: http://stackoverflow.com/comment/42899020
accepted answer: http://stackoverflow.com/a/27210055
type: Question
tagged with: exception
type: AnsweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42901203
answer count: 1
has answer: http://stackoverflow.com/a/27210055
score: 0

http://stackoverflow.com/q/27284247
has comment: http://stackoverflow.com/comment/43068138
type: Question
has title: SpringFramework can't find a class / What does this Spring xml mean?
tagged with: intellij-idea
has body: I'm trying to run unit tests in IntelliJ IDE, and one of them fails with this error: Caused by: java.lang.ClassNotFoundException: #[cache.provider:com.foo.bar.caching.service.BasicMemcache] So I search for that string and I find it in my services.xml file here: &lt;bean id="catalogCacheProvider" class="#[cache.provider:com.foo.bar.caching.service.BasicMemcache]"&gt; &lt;property name="servers" value="${memcached.catalog.servers}"/&gt; &lt;/bean&gt; I didn't set this up, but I'm required to maintain it. I can't find any explanation for that spring syntax #[foo.bar:bazClass] so I don't know what that means. Also, I know that the class it references certainly exists. Any information you can share might help me figure this out.
upvote count: 1
has comment: http://stackoverflow.com/comment/43067420
has comment: http://stackoverflow.com/comment/43037162
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43037437
tagged with: spring
answer count: 0
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/42914568
has text: That option is checked. Should it be checked off?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27216429
score: 0

http://stackoverflow.com/comment/50201262
score: 0
type: Comment
has text: Hi and thanks for caring! My point was that I'm fairly certain that Java will optimize this away completely. Modern compilers are amazing. That said, I'll remove my downvote and leave you with figuring it out for now :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/27233377

http://stackoverflow.com/q/27254515
has title: PrintPowersof2 in java
has body: Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10); These calls should produce the following output: 1 2 4 8 1 2 4 8 16 32 64 128 256 512 1024 yes, this is a homework problem and I am sorry. I am not asking for code or anything just a little guidance would be helpful and I want to know what I am doing is wrong. Thank You. import java.lang.Math; public class Power { public void printPowersOf2(double thisX){ double k = 1.0; for(double i = k; i &lt;= Math.pow(2,thisX); i++){ double square = k; System.out.print(square+" "); k = 2.0 * k; } } } Second Class: import java.util.*; public class PowerMain{ public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Please, enter a number you want to square: "); double exponents = input.nextDouble(); Power numberOfPower = new Power(); numberOfPower.printPowersOf2(exponents); } } My output = 1.0 2.0 4.0 8.0 16.0 32.0 64.0 128.0 > when i enter 3
accepted answer: http://stackoverflow.com/a/27254813
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27254732
type: Question
has answer: http://stackoverflow.com/a/27254732
tagged with: java
has answer: http://stackoverflow.com/a/27254813
tagged with: exponent
score: 0
answer count: 2
tagged with: for-loop

http://stackoverflow.com/comment/42817558
comment on: http://stackoverflow.com/q/27161896
score: 0
type: Comment
type: QuestionComment
has text: exactly, considering that my project is fairly big. What would be the best way to archive this? By having a new database design(this will imply having a big refactoring as all the existing queries will be broken) Or have a duplicate table "pending_place, pending_tag and pending_place_tag) ?

http://stackoverflow.com/a/74662726
answers question: http://stackoverflow.com/q/27282537
score: 0
type: Answer
has body: For those trying to use this same method nowadays. public static void listFields(PDDocument doc) throws Exception { PDDocumentCatalog catalog = doc.getDocumentCatalog(); PDAcroForm form = catalog.getAcroForm(); List&lt;PDField&gt; fields = form.getFields(); for(PDField field: fields) { Object value = field.getValueAsString(); String name = field.getFullyQualifiedName(); System.out.print(name); System.out.print(&quot; = &quot;); System.out.print(value); System.out.println(); } }
has comment: http://stackoverflow.com/comment/131843164

http://stackoverflow.com/a/27160011
has body: stop() in java.lang.Thread was deprecated for good reasons: it didn't always work and could interfere with the workings of the JVM. Your best bet is to run the programs in separate JVMs. You can then kill the processes if you need to.
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/27159956
answers question: http://stackoverflow.com/q/27159956
score: 6
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27215773
has comment: http://stackoverflow.com/comment/42911753
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42911650
tagged with: list
has body: As I can do to get to see the result of two or more identical numbers contained in a list. Everything has to be based on lists, the code itself is simple but I have no idea how to achieve the same values print screen. All this is done under 5 numbers entered in a list. example: Introduce 1 - 2 - 3 - 3 - 4 And the output would be the number 3 is repeated. This is my code: package generarlista; import java.util.*; public class GenerarLista { /** * @param args the command line arguments */ public static void main(String[] args) { int num; Scanner read = new Scanner (System.in); List&lt;Integer&gt; lista = new ArrayList&lt;&gt;(); System.out.println("A list of 5 integers is generated and printed equal values\n"); for (int i=1; i&lt;6; i++){ System.out.println("Enter the value "+ i +" element to populate the list"); num = read.nextInt(); lista.add(num); } System.out.println("Data were loaded \n"); System.out.println("Values in the list are: "); Iterator&lt;Integer&gt; nameIterator = lista.iterator(); while(nameIterator.hasNext()){ int item = nameIterator.next(); System.out.print(item+" / "); } System.out.println("\n"); System.out.println("Equals are: "); } } thank you very much!
type: Question
upvote count: 5
tagged with: java
score: 5
has title: Equal values in a list java
downvote count: 0
answer count: 1
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42911527
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42911491
has answer: http://stackoverflow.com/a/27215977
accepted answer: http://stackoverflow.com/a/27215977

http://stackoverflow.com/q/27217150
has body: I am new to Java and programming and am following Derek Banas' tutorials on YouTube. This is my code thus far and I am getting an error saying "the import java.util.scanner cannot be resolved." I have compiler compliance level 1.7 and JRE 1.8.0_25. import java.util.scanner; public class Javalesson2 { }
has comment: http://stackoverflow.com/comment/42914005
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27217200
tagged with: java
has answer: http://stackoverflow.com/a/27217166
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/27217200
answer count: 2
downvote count: 4
favorite count: 0
has title: the import java.util.scanner cannot be resolved
accepted answer: http://stackoverflow.com/a/27217166
score: -3
upvote count: 1

http://stackoverflow.com/a/27300067
has body: Take a look at this library. It belongs to the standard java mail api. https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/package-summary.html
answers question: http://stackoverflow.com/q/27299980
score: 0
type: Answer

http://stackoverflow.com/q/27216609
type: UnansweredQuestion
tagged with: android
tagged with: opengl-es
has body: My game has two screens. Each screen is rendered with a class named SpriteBatcher. The first screen renders fine. The second fails and throws me the above error. 11-30 13:10:46.530: E/AndroidRuntime(1621): java.lang.IllegalArgumentException: Bad position (limit 0): 2 11-30 13:10:46.530: E/AndroidRuntime(1621): at java.nio.Buffer.positionImpl(Buffer.java:357) 11-30 13:10:46.530: E/AndroidRuntime(1621): at java.nio.Buffer.position(Buffer.java:351) 11-30 13:10:46.530: E/AndroidRuntime(1621): atcom.rim.framework.gl.Vertices.bind(Vertices.java:66) So i am trying to access buffer's position 2 while the buffer is 0 sized. In my code though i dont see any bug. this.vertexSize = (2 + (hasColor?4:0) + (hasTexCoords?2:0)) * 4; ByteBuffer buffer = ByteBuffer.allocateDirect(maxVertices * vertexSize); ///8 bit = 1 byte, 4 byte = 32bit float buffer.order(ByteOrder.nativeOrder()); vertices = buffer.asFloatBuffer(); The problem as the error states is in my bind() method: public void bind() { GL10 gl = glGraphics.getGL(); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); vertices.position(0); gl.glVertexPointer(2, GL10.GL_FLOAT, vertexSize, vertices); if(hasColor) { gl.glEnableClientState(GL10.GL_COLOR_ARRAY); vertices.position(2); gl.glColorPointer(4, GL10.GL_FLOAT, vertexSize, vertices); } if(hasTexCoords) { gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); vertices.position(hasColor?6:2); gl.glTexCoordPointer(2, GL10.GL_FLOAT, vertexSize, vertices); } } The bug was caused by the spritebatcher.bind method. I was passing zero sprites so i ended up rendering nulls...
type: Question
has comment: http://stackoverflow.com/comment/42913400
has comment: http://stackoverflow.com/comment/42913510
tagged with: java
tagged with: nio
score: 0
has title: opengles java nio buffers
answer count: 1
has answer: http://stackoverflow.com/a/27217071

http://stackoverflow.com/a/27164870
has body: PSTFile closes the filehandle in its finalize method, so the file is closed when your PSTFile is garbage collected. I don't think this is good style to clean up resources this way because finalize may be called much later or even never.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42822202
answers question: http://stackoverflow.com/q/27164693
has comment: http://stackoverflow.com/comment/42822113
upvote count: 1

http://stackoverflow.com/comment/42836893
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27173074
type: AnswerComment
has text: As you said String implements Comparable. From the TreeSet javadoc. Constructs a new, empty tree set, sorted according to the natural ordering of its elements. Or did I understand wrong?

http://stackoverflow.com/comment/42903871
type: AnswerComment
has text: thank you, I think I might go with the @SuppressWarnings thing
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27210892

http://stackoverflow.com/q/27272050
tagged with: android
has comment: http://stackoverflow.com/comment/43014162
has comment: http://stackoverflow.com/comment/43014458
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43013939
tagged with: google-analytics
has answer: http://stackoverflow.com/a/27297677
tagged with: java
type: Question
tagged with: casting
has title: Google Anaytlics v4 Android casting error
has comment: http://stackoverflow.com/comment/43014127
has body: I Cannot for some reason get the Anaytics simple screen view tracking to work, I have followed all the documentation, however am getting a casting issue: This is how I am trying to call the code within my onCreate(): Tracker t = ((Analytics) getApplication()).getTracker(Analytics.TrackerName.APP_TRACKER); t.setScreenName("Home"); t.send(new HitBuilders.AppViewBuilder().build()); However whenever I try to run it I get a casting error, please see below for my Log error message: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.test/com.test.test.Menu}: java.lang.ClassCastException: android.app.Application cannot be cast to com.test.test.Analytics Edit - Another attempt: <?xml version="1.0" encoding="utf-8"?> 300 true Analytics Menu UA-XXXXXXX-1 // Then I use this within my Menu.onCreate() ((Analytics) getApplication()).getTracker(Analytics.TrackerName.APP_TRACKER); However I am still getting the same casting error stated above
score: 0

http://stackoverflow.com/q/27227281
has body: I am trying to connect to the SharePoint from my java code. However there seems to be something is missing and I am not able to connect to the sharepoint. I am using the below code, NtlmAuthenticator credentials = new NtlmAuthenticator("domain", "uname", "Password"); // Initialize proxy settings //HttpProxy httpProxy = new HttpProxy("my_system_proxy", 80); // Connect to Sharepoint SPSite instance = new SPSite(new URL("https://my_url/cplc/projects/Knowledge%20Share/Forms/PracticeWise.aspx"), credentials, null, true, SPVersion.SP2013); // Get root web instance SPWeb rootWeb = instance.getRootWeb(); // Get list of all lists and document libraries from root web SPListCollection lists = rootWeb.getLists(); I don't know what value I should set for proxy field there. If I don't set the proxy and send null to it, it says "401: UnAuthorised" HTTP transport error: java.net.UnknownHostException: proxy.msa" Update: I am referring this, https://code.google.com/p/java-sharepoint-library/ Can anybody please help me to proceed further?
type: UnansweredQuestion
tagged with: http
has comment: http://stackoverflow.com/comment/42933457
tagged with: sharepoint-2013
tagged with: java
has answer: http://stackoverflow.com/a/62860250
has title: Connecting SharePoint in Java
tagged with: sharepoint
type: Question
has comment: http://stackoverflow.com/comment/42933185
score: 0
has comment: http://stackoverflow.com/comment/42933781
answer count: 1
has comment: http://stackoverflow.com/comment/42970157
has comment: http://stackoverflow.com/comment/42960066

http://stackoverflow.com/a/27180063
has comment: http://stackoverflow.com/comment/42879752
answers question: http://stackoverflow.com/q/27180005
has comment: http://stackoverflow.com/comment/42879615
has comment: http://stackoverflow.com/comment/42848826
accepted answer of: http://stackoverflow.com/q/27180005
upvote count: 2
type: AcceptedAnswer
has body: You don't have to explicitly iterate (unless you really want to) to get the value by key: just use get() method: System.out.println("quattro" + ": " + queque.get("quattro")); If you want to print all the values up to the certain one, you can do the following: Iterator i = queque.entrySet().iterator(); while(i.hasNext()) { Map.Entry&lt;String, String&gt; me = i.next(); if (me.getKey() == "quattro") break; System.out.println(me.getKey() + ": " + me.getValue()); } Or, a little more elegant: for (Map.Entry&lt;String, String&gt; me : queque.entrySet()) { if (me.getKey() == "quattro") break; System.out.println(me.getKey() + ": " + me.getValue()); } Couple more points: If you do not need to store the elements in the order they were added, use HashMap rather than LinkedHashMap, since former is faster. If you want store elements sorted, use TreeMap(but beware it is slower than the other types of Map). When you create instance of container in Java, you are better off using interface (like Map, List or Set) in the left part of assignment and implementation (like HashMap, ArrayList etc.) in the right part since it gives you much more flexibility: in case you later on decide to change the implementation of the same interface (e.g. use HashMap instead of LinkedHashMap as I suggested above), you only need to change one line of your code where you create this container, rather than change all places where this container is used.
has comment: http://stackoverflow.com/comment/42849436
type: Answer
has comment: http://stackoverflow.com/comment/42848985
has comment: http://stackoverflow.com/comment/42879784
score: 2
has comment: http://stackoverflow.com/comment/42848728
downvote count: 0

http://stackoverflow.com/comment/42999758
type: QuestionComment
comment on: http://stackoverflow.com/q/27229692
score: 0
has text: jimfromsa is right. Just using /folder1/folder2/error.gsp So, in your case, folder1 is the same path of login.html
type: Comment

http://stackoverflow.com/q/27296133
has comment: http://stackoverflow.com/comment/43080192
answer count: 0
has comment: http://stackoverflow.com/comment/43058047
type: UnansweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/43090342
type: Question
has body: Am new to JPA, Please some one help on the below My Entity UserTransaction is below @Entity @Table(name = "user_transaction") public class UserTransaction{ @Basic @Column(name = "current_balance") private BigDecimal currentBalance; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) @JoinColumn(name = "user_id", columnDefinition = "BIGINT UNSIGNED") private User user; @Version private Integer version; @Column(nullable = false, columnDefinition = "BOOLEAN default '1'") protected Boolean active = true; } Here am inserting new record with active=1 while user balance getting updated and will change the existing record to active=0. If i want to update my balance i will take active=1 record of my user and calculate my current balance, then update that record active=0 and create new one with active=1. In this case when multiple threads are trying to change the balance, results creating multiple active=1 records. I was searching solution for this. I got suggestion to add @Version column in my entity. I have added it. @Version column value increased if i update the existing column, but getting error while inserting another column with version for another user. Is it possible to increase version column count based on user? Else give me suggestion to handle my user balance during concurrency.
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43057797
has title: JPA increase @version column count based on another column

http://stackoverflow.com/comment/43037686
has text: @MadProgrammer The java guy displayed the menu bar ok. But i when added JTextArea it was overlapping the menuBar. Basically writing over the menubar and hiding the menu items
type: Comment
comment on: http://stackoverflow.com/q/27284653
score: 0
type: QuestionComment

http://stackoverflow.com/q/27153987
has comment: http://stackoverflow.com/comment/42806397
has title: Struts2 pass parameters to action in different webapp
has answer: http://stackoverflow.com/a/27157331
tagged with: struts2
has comment: http://stackoverflow.com/comment/42803832
has comment: http://stackoverflow.com/comment/42802700
has comment: http://stackoverflow.com/comment/42803812
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42802996
favorite count: 0
has comment: http://stackoverflow.com/comment/42806916
has comment: http://stackoverflow.com/comment/42803634
has comment: http://stackoverflow.com/comment/42802862
has comment: http://stackoverflow.com/comment/42803859
has comment: http://stackoverflow.com/comment/42804015
has comment: http://stackoverflow.com/comment/42803670
accepted answer: http://stackoverflow.com/a/27157331
linked to: http://stackoverflow.com/q/11006341
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42804721
upvote count: 3
has body: I use Struts 2.3.16.3. I want an action from webapp 1 to pass parameters to an action in webapp 2. In the struts.xml of webapp 1 I define the following result: http://localhost:8080/Webapp2/index.action testValue I expect my browser to redirect me to this webpage (a page in webapp2) when the result equals 'success': http://localhost:8080/Webapp2/index.action?testParam=testValue However, my browser takes me to: http://localhost:8080/Webapp2/index.action completely ignoring the parameter. If I change my result to have everything inside the location param then it works, but you can see this gets very clunky with multiple params: http://localhost:8080/Webapp2/index.action?testParam=${testValue} This correctly redirects my browser to the url: http://localhost:8080/Webapp2/index.action?testParam=testValue Why does the first method not work?
tagged with: java
has comment: http://stackoverflow.com/comment/42802550
type: Question
tagged with: param

http://stackoverflow.com/comment/43016796
comment on: http://stackoverflow.com/q/27272945
score: 0
type: Comment
has text: @RodGalangco I posted an answer if you want to check it out. I changed your code a little I'm not sure if it's exactly what you want. Let me know if it is what you want or if you have different requirements...
type: QuestionComment

http://stackoverflow.com/comment/42996613
comment on: http://stackoverflow.com/q/27261906
has text: I found this http://stackoverflow.com/questions/19802104/how-would-i-make-my-custom-generic-type-linked-list-in-java-sorted Though it solves some how but in case sorting does not uses generics.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42908144
type: QuestionComment
score: 2
has text: Have you tried to write `a = b` and see what happened before asking this question?
comment on: http://stackoverflow.com/q/27213958
type: Comment

http://stackoverflow.com/a/27157645
score: 1
answers question: http://stackoverflow.com/q/27157596
has body: If this should not happen as per the invariants and preconditions of the method, there is no real need to handle the exception. If you want to check to be make sure no bugs crop up during development, typically you would use assert for something like this: public Attribute getAttribute (int index) { assert(index &gt;= 0 &amp;&amp; index &lt; attributes.size()); return attributes.get(index); } Use assert to make sure that preconditions and invariants are not violated. assert shouldn't be used for checking of "normal" error conditions, but it is appropriate for debug / development sanity checks. It self-documents your assumptions. Also, it will allow a bug to be caught here, rather than at some vague higher level where an exception is eventually caught. This can help you pinpoint problems quicker. For more information, some explanation and examples, check out programming with assertions. There is also a related question at Avoiding != null statements - related in that the answer discusses overly aggressive checking of assumptions, and how to deal with them effectively; a good read. However: It's important to note that your method is public. The implication here is that anybody can call this. Perhaps you will even use this code in another program in the future. You will want to consider that when deciding whether or not you want to throw the AIOOB. If you do, I would just throw it out of the method, and document the method as throwing it if index is out of range. It depends on your situation, really. Also as Christian Hujer mentions in the comments below, a good set of test suites will help make sure your code never surprises you with any bugs here in the first place.
has comment: http://stackoverflow.com/comment/42809453
type: Answer
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27157596
type: AcceptedAnswer

http://stackoverflow.com/comment/43087119
comment on: http://stackoverflow.com/a/27305634
score: 0
type: AnswerComment
type: Comment
has text: I already did. It's difficult to find something but that didn't means there is nothing. I think I have my answer. Thank you.

http://stackoverflow.com/comment/43552624
has text: Here I got link for TSC TDP 274 PRINTER Specification ,how can I run this ?http://www.tscprinters.com/cms/upload/download_en/TSPL_TSPL2_Programming.pdf
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27562191
type: Comment

http://stackoverflow.com/q/27170428
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/27170599
accepted answer: http://stackoverflow.com/a/27170440
has answer: http://stackoverflow.com/a/27170599
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42831764
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/218384
has body: I am creating an Android app and I am trying to use a SettingsManager class to read and write preferences. To use this, I have to pass context to this SettingsManager in order to use the SharedPreferences API. However, my code keeps giving me a NullPointerException. Can anyone tell me why? Main.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_status); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); setButton(); } ... public void setButton(){ Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SettingsManager settings = SettingsManager.getInstance(getBaseContext()); settings.getUserName(); } }); } SettingsManager.java static Context context; private SettingsManager(){ sharedpreferences = context.getSharedPreferences(settingsfile, Context.MODE_PRIVATE); } public static SettingsManager getInstance(Context cntxt){ if(instance == null){ instance = new SettingsManager(); } context = cntxt; return instance; } The NPE happens on this line: sharedpreferences = context.getSharedPreferences(settingsfile, Context.MODE_PRIVATE);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42831678
has comment: http://stackoverflow.com/comment/42831747
favorite count: 0
has title: Android: Passing context to helper class results in NPE
tagged with: android-context
has answer: http://stackoverflow.com/a/27170440
tagged with: nullpointerexception

http://stackoverflow.com/a/27172354
answers question: http://stackoverflow.com/q/27172322
has body: Use a HashSet instead of an ArrayList inside the HasMap. HashMap&lt;String, HashSet&lt;String&gt;&gt; map1 = new HashMap&lt;&gt;(); HashSet&lt;String&gt; al = new HashSet&lt;&gt;(); al.add("A"); al.add("B"); al.add("C"); map1.put("1", al); Remove by: map1.get("1").remove("B")
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42835344
has comment: http://stackoverflow.com/comment/42835528
has comment: http://stackoverflow.com/comment/42835439
downvote count: 0
has comment: http://stackoverflow.com/comment/42838151

http://stackoverflow.com/a/27297884
has comment: http://stackoverflow.com/comment/69834122
has comment: http://stackoverflow.com/comment/43094017
has comment: http://stackoverflow.com/comment/43063939
has comment: http://stackoverflow.com/comment/43063765
has comment: http://stackoverflow.com/comment/43127217
has comment: http://stackoverflow.com/comment/43063701
has comment: http://stackoverflow.com/comment/43063770
has comment: http://stackoverflow.com/comment/43084369
has comment: http://stackoverflow.com/comment/43063210
score: 15
has body: Base: (1) http://localhost:8080/admin-ws (I assume `admin-ws` is the app name) @ApplicationPath("/services") == append /services to Base (2) http://localhost:8080/admin-ws/services @Path("/user") == append /user to previous (3) http://localhost:8080/admin-ws/services/user @Path("/services/user/getUser") == append /services/user/getUser to previous (4) http://localhost:8080/admin-ws/services/user/services/user/getUser //This is the winner with your current set up What you are using: http://localhost:8080/admin-ws/services/user/getUser What's different? How it Should Look : to follow good REST (naming included) practices @ApplicationPath("/services") public class WebConfig extends Application { } @Path("/users") public class UserResource implements Serializable { @Inject private UserService userService; @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public UserWsPojo getUser(@PathParam("id") String id) { UserWsPojo uwp = userService.getUserById(id); return uwp; } } Access: http://localhost:8080/admin-ws/services/users/12344 // some user id
has comment: http://stackoverflow.com/comment/43064002
upvote count: 15
has comment: http://stackoverflow.com/comment/43127390
has comment: http://stackoverflow.com/comment/43062805
answers question: http://stackoverflow.com/q/27295720
has comment: http://stackoverflow.com/comment/43063049
downvote count: 0
has comment: http://stackoverflow.com/comment/43063488
has comment: http://stackoverflow.com/comment/43127278
has comment: http://stackoverflow.com/comment/43063303
type: Answer
has comment: http://stackoverflow.com/comment/43063372

http://stackoverflow.com/a/27274774
has comment: http://stackoverflow.com/comment/43019303
downvote count: 0
has comment: http://stackoverflow.com/comment/43018860
has comment: http://stackoverflow.com/comment/43019085
has comment: http://stackoverflow.com/comment/43018845
type: Answer
score: 1
upvote count: 1
has body: You have to override method getHealth() for each sub class, i.e. public class SuperClass{ protected int health; public int getHealth() { return health; } } public class SubClass{ private int health; public int getHealth() { return health; } } public class SubClass{ public int getHealth() { return super.getHealth() * 2; } } Please pay attention that I renamed your classes that should start with capital letter by convention. Implementation of getHealth in first case uses its own variable while in second case calls getHealth() of super class and multiplies it by 2. This is just an usage example. EDIT Obviously this design is good for non-trivial implementations of methods, i.e. when method implement some logic. In your case you can just pass health through constructor: public class SuperClass{ protected int health; public SuperClass(int health) { this.health = health; } public int getHealth() { return health; } } public class SubClass1{ public SuperClass1(int health) { super(health); } } public class SubClass2{ public SuperClass2(int health) { super(health); } } But as far as the case is really simple, so there is not need to create sub classes at all, so you can just create your super class and create instances that hold different values of health: SuperClass c1 = new SuperClass(1); SuperClass c2 = new SuperClass(2);
answers question: http://stackoverflow.com/q/27274663

http://stackoverflow.com/q/27177908
tagged with: file
accepted answer: http://stackoverflow.com/a/27178844
type: Question
has title: How can I make the scanner search for a token, then return the one after it?
tagged with: search
score: 0
answer count: 1
has body: I want the strings inning, battingTeam, outs, balls, and strikes in an ArrayList&lt;String&gt;. In other words, I need the string that immediately follows the tag @attribute. @relation and @data and anything that follows on that line should not wind up in this ArrayList. @relation stats @attribute inning real @attribute battingTeam {0,1} @attribute outs {0,1,2} @attribute balls {0,1,2,3} @attribute strikes {0,1,2} @data 1,0,0,0,1,"CX",0,0,"crisc001","R","crisc001","R","wilsc004","L","wilsc004","L","","","","T","F",8,1,no This is my main method: public static void main(String[] args) throws IOException { File file = new File("2013ALL.csv"); Scanner scanFile = new Scanner(file); Scanner option = new Scanner(System.in); ArrayList&lt;String&gt; headers = new ArrayList&lt;String&gt;(); String line = ""; while (!line.startsWith("@attribute")); { line = scanFile.nextLine(); } do { line = scanFile.nextLine(); String[] splitLine = line.split(" "); headers.add(splitLine[1]); } while (line.startsWith("@attribute")); System.out.println(headers); }
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27178844
tagged with: input
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27280691
type: UnansweredQuestion
has title: Add an xml file to classpath via bootclasspath
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43030518
score: 0
has comment: http://stackoverflow.com/comment/43030056
answer count: 1
tagged with: jar
tagged with: bootclasspath
has body: The following scenario: I'm extending an admin tool for a system of small services compiled as runnable jars. These services use xml configurations in their classpath for a multitude of tasks. I now want to extract configuration files like db configuration from the compiled jar files and add them dynamically to the classpath. Up until now you needed to recompile the whole suite if you wanted to change the settings for the database, which is all kinds of bad imho. What I have tried: java -Xbootclasspath/p:/path/db.xml java -jar Foo.jar - this results in a java vm error java -Xbootclasspath/p:/path/db.jar java -jar Foo.jar - this doesn't seem to do anything, I've tried to find the xml file via the script below in the classpath, but I haven't been able to. The xml lies directly inside the jar (created with jar cvMf db.jar db.xml) The script I used: ZipFile zf; ZipFile zf; try{ zf = new ZipFile("Foo.jar"); } catch(final ZipException e){ throw new Error(e); } catch(final IOException e){ throw new Error(e); } final Enumeration e = zf.entries(); while(e.hasMoreElements()){ final ZipEntry ze = (ZipEntry) e.nextElement(); final String fileName = ze.getName(); final boolean accept = Pattern.compile(".*(xml)").matcher(fileName).matches(); if(accept){ log.debug(fileName); } } I hope someone can help with this problem, I'm pretty clueless on what else I could try.
has answer: http://stackoverflow.com/a/27281044
linked to: http://stackoverflow.com/q/3294196

http://stackoverflow.com/q/27154604
has title: Create a webpage to show the entries send by a form
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/27154667
answer count: 3
possible better answer: http://stackoverflow.com/a/27154667
tagged with: http://stackoverflow.com/tag/html
tagged with: php
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27154750
accepted answer: http://stackoverflow.com/a/27154750
has body: Please tell me the codding to create a webpage which can show the information send by another webpage for eg if a i have created a following webpage &lt;form action="demo.php" method="get"&gt; First name: &lt;input type="text" name="fname"&gt;&lt;br&gt; Last name: &lt;input type="text" name="lname"&gt;&lt;br&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; Then I want to know the codding of demo.php so that it can show me my full name which is sent by above codding Hope you understand what I want to ask......
has answer: http://stackoverflow.com/a/27154732
type: Question

http://stackoverflow.com/q/27306177
downvote count: 1
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27306398
has title: ERROR when appending ArrayList.remove and ArrayList.set
tagged with: binary-search
tagged with: dynamic-programming
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: ArrayList&lt;Integer&gt; M = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; V = new ArrayList&lt;Integer&gt;(); System.out.println("How many values? "); Scanner in = new Scanner(System.in); int noVal; noVal= in.nextInt(); for(int cn = 0; cn &lt; noVal; cn++){ int intrare; System.out.print("Introdu elem " + (cn) +" "); intrare = in.nextInt(); V.add(intrare); } in.close(); for(int cn = 0; cn &lt; noVal; cn++){ if(cn==0){ M.add(0); continue; } if(V.get(cn)&gt;= V.get(M.get(M.size()-1)) ) M.add(cn); else{ M.remove(binarySearch(V.get(cn), M.size(), M)); //here is the problem M.set(binarySearch(V.get(cn), M.size(), M), V.get(cn)); } } It returns error when tring to remove and set. This is a piece from an algorithm for computing in nlogn the longest ascendind substring from V. Everytime it goes to "else", that's the error: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.remove(Unknown Source) at SirMaximCrescator.main(SirMaximCrescator.java:37) The binarySearch function is: public static int binarySearch(int key, int size, ArrayList&lt;Integer&gt; data) { int low = 0; int high = size - 1; while(high &gt;= low) { int middle = (low + high) / 2; if(data.get(middle).equals(key)) { return 0; } if(data.get(middle) &lt; key) { low = middle + 1; } if(data.get(middle) &gt; key) { high = middle - 1; } } return low; }
score: 1
tagged with: java

http://stackoverflow.com/comment/42821529
comment on: http://stackoverflow.com/a/27163658
has text: thanks but can u suugest me a method to store image in database.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/35170329
has body: Yes, you can do it through ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS ); context.setContextPath( "/" ); context.addEventListener( new EnvironmentLoaderListener() ); // Add root ShiroFilter, all remaining filters and filter chains are defined in shiro.ini's [urls] section. FilterHolder filterHolder = new FilterHolder( new ShiroFilter() ); ServletHolder servletHolder = new ServletHolder( new MockServlet() ); EnumSet&lt;DispatcherType&gt; types = EnumSet.allOf( DispatcherType.class ); context.addFilter( filterHolder, "/*", types ); context.addFilter( new FilterHolder( new TestFilter() ), "/*", types ); context.addServlet( servletHolder, "/*" ); And for shiro.ini file refer this doc:
score: 0
answers question: http://stackoverflow.com/q/27244378
type: Answer

http://stackoverflow.com/comment/43009836
comment on: http://stackoverflow.com/a/27269735
type: AnswerComment
type: Comment
has text: There is no `Int` available in Java. You meant `int[size]`?
score: 1

http://stackoverflow.com/q/27218413
tagged with: arraylist
upvote count: 2
has title: Applying class methods to a whole ArrayList
has answer: http://stackoverflow.com/a/27218580
favorite count: 0
has comment: http://stackoverflow.com/comment/42916536
type: UnansweredQuestion
has body: I am wondering if there is a bit of code or that can apply a method from a class to all of the objects in the ArrayList? I'm making a basic space invaders program and I am trying to implement a move method that will apply to all of enemies, so that they move in a group rather than individually. I've created the items in the array list here: for (int i = 0; i &lt; 6; i++) { venWidth = venWidth - 139; enemyList.add(new Venusian("/venusian.jpg", venWidth, height)); } for (int i = 6; i &lt; 12; i++) { merWidth = merWidth - 145; enemyList.add(new Mercurian("/mercurian.jpg", merWidth, merHeight)); } for (int i = 12; i &lt; 18; i++) { marWidth = marWidth - 125; enemyList.add(new Martian("/martian.jpg", marWidth, marHeight)); } Here is where I call the move method: for (int i = 0; i &lt; enemyList.size(); i++) { Invader Invaders = (Invader) enemyList.get(i); Invaders.draw(g); Invaders.Move(1024); This makes them move independently and overlap, at the moment I am just moving them right and left using the boundaries of my created window. So is there any way of moving them together at the same time? I have searched for a way to apply a class method to all of the lists items but I haven't found anything after a couple of hours. Any material, sources or advice relating to this would be greatly appreciated.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42916502
tagged with: java
has answer: http://stackoverflow.com/a/27218523
type: Question
has comment: http://stackoverflow.com/comment/42916201
answer count: 2
has comment: http://stackoverflow.com/comment/42916824

http://stackoverflow.com/comment/70738856
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/35832997
has text: While you're at it, you should add IntelliJ's project files to your project's .gitignore. See https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore

http://stackoverflow.com/a/27240724
answers question: http://stackoverflow.com/q/27165919
type: Answer
has body: You can try to build a file with the list of commands and source it. Something like... cmdsToExecute.add("echo \"\" &gt; tmpcmd.txt"); cmdsToExecute.add("echo \"set bps [bps::connect ... ]\" &gt;&gt; tmpcmd.txt"); cmdsToExecute.add("echo \"set sf [$bps createSuperflow ... ]\" &gt;&gt; tmpcmd.txt"); cmdsToExecute.add("bpsh"); cmdsToExecute.add("source tmpcmd.txt");
score: 0

http://stackoverflow.com/q/27172668
has comment: http://stackoverflow.com/comment/42835907
score: 0
has answer: http://stackoverflow.com/a/27172824
has body: I am creating Chess game , for this i am creating 64 JPanels using Loop. and changing background color, here is the example code that i am using to create panel and changing its background color. for(int i=0;i&lt;8;i++) { for( int j=0;j&lt;8;j++) { jp[i][j]=new JPanel(); p.add(jp[i][j]); this.allSquares.add(jp[i][j]); // adding panel in arraylist of type Jpanel if(j%2==0&amp;&amp;i%2==0)// code to change background color of panels for chess board { jp[i][j].setBackground(Color.DARK_GRAY); } if(j%2!=0&amp;&amp;i%2!=0) { jp[i][j].setBackground(Color.DARK_GRAY); } } } i need code to get name of the JPanel when user click on it in chess board
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
has title: How To Create JPanels at runtime and show its name when user click on it
accepted answer: http://stackoverflow.com/a/27172824
answer count: 1

http://stackoverflow.com/a/27161180
downvote count: 0
answers question: http://stackoverflow.com/q/27161074
has body: Multi-catches like catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) are only supported from Java 7 and onwards. I believe your JDK/Java compliter is earlier than JDK1.7. http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html Please check that. If possible, upgrade to JDK 1.7. Else use the catch block as following... try { // Do something } catch (ClassNotFoundException ex) { // Do something } catch(InstantiationException ex) { // Do something } catch(IllegalAccessException ex) { // Do something } catch(UnsupportedLookAndFeelException ex) { // Do something } Cheers!
score: 1
has comment: http://stackoverflow.com/comment/42816078
upvote count: 1
type: Answer

http://stackoverflow.com/q/27209431
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27209460
tagged with: java
has answer: http://stackoverflow.com/a/27209583
possible better answer: http://stackoverflow.com/a/27209460
type: Question
has title: I am having Problems with Arrays
has answer: http://stackoverflow.com/a/27209588
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42900743
answer count: 3
has body: I am having issues with this array code. It needs to have a number count that displays the numbers that are entered by the user. So for instance, if the user enters three four's it will say "4 3." I already have the majority of the code done, but it is just returning the first number that's entered. import java.util.Scanner; public class NumberCounts { public static void main(String args[]) { int[] answer = new int [100]; inputArray(answer); } public static void inputArray(int[] Numbercounts) { System.out.println("This Program is written by Benjamin Barcomb\n"); Scanner kb = new Scanner(System.in); System.out.print("How many numbers will you enter? : "); kb.nextInt(); //int[] answer = new int[100]; int arryNum[] = new int[] {}; System.out.println("\nEnter numbers in [0, 100] range separated by a space:"); int input = kb.nextInt(); System.out.println("Number Count"); int[] counter = new int[] {input}; for (int i = 0; i &lt; arryNum.length; i++) { System.out.println(" " + (i + 1) + " " + counter[i]); } for (int i = 0; i &lt; counter.length; i++) { System.out.println(" " + (i + 1) + " " + counter[i]); } } }
favorite count: 0
linked to: http://stackoverflow.com/q/21871053
accepted answer: http://stackoverflow.com/a/27209588

http://stackoverflow.com/comment/42913927
type: QuestionComment
comment on: http://stackoverflow.com/q/27217106
score: 0
has text: OK, you've given us broad requirements and some unexplained code (does it work? not work? how?), but you need to also ask a specific and answerable question. A little effort will go a long way towards getting good answers. Best I can do at present is give you this link for the Swing tutorials and other Swing resources: [Swing Info](http://stackoverflow.com/questions/tagged/swing). If you give us more, then we can do likewise.
type: Comment

http://stackoverflow.com/q/27313447
has comment: http://stackoverflow.com/comment/43089021
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43087400
score: 1
tagged with: java
has body: I've already read this question, but still no luck. I want to embed HTML pages with CSS files. In my project I have res folder, in .classpath I have &lt;classpathentry kind="src" path="res"/&gt; so that my files are embedded. |-- src | `-- com | `-- pkg | `-- blahblahblah | `-- CTLiner.java `-- res `-- html |-- index.html `-- style.css CTLiner.java is main class file. URL u = CTLiner.class.getResource("/html/index.html"); System.out.println(u.toURI().toString()); webView.showPage(u); I use this code to load index.html. If I run this from Eclipse I get the following output file:/home/user/workspace/CTLiner/bin/html/index.html And &lt;link href="style.css" rel="stylesheet" type="text/css" /&gt; Works great. And when I export project as Runnable JAR, code outputs: rsrc:html/index.html And CSS file isn't found. I believe that if I move index.html and style.css files up-tree (can I say so?) everything will work, but is there any other soltion?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43088375
type: Question
accepted answer: http://stackoverflow.com/a/27314773
linked to: http://stackoverflow.com/q/18443315
downvote count: 0
has title: Embed HTML in JAR with Eclipse
has comment: http://stackoverflow.com/comment/43088227
has answer: http://stackoverflow.com/a/27314773
answer count: 1
has comment: http://stackoverflow.com/comment/43087624
has comment: http://stackoverflow.com/comment/43088913
favorite count: 0
tagged with: embedded-resource
upvote count: 1
has comment: http://stackoverflow.com/comment/43087713

http://stackoverflow.com/q/27232332
has title: Can you set the RSA public exponent to a value of your choice?
tagged with: encryption
tagged with: cryptography
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/27234001
upvote count: 3
tagged with: java
tagged with: rsa
type: Question
has body: This website describes a way to implement RSA in java using a library. Is it possible to have control over the value of the public exponent e? Java sets it to 65537. I know that it is an appropriate value but can I change it while still using the library? This is how they implement it: KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(2048); KeyPair kp = kpg.genKeyPair(); Key publicKey = kp.getPublic(); Key privateKey = kp.getPrivate(); KeyFactory fact = KeyFactory.getInstance("RSA"); RSAPublicKeySpec pub = fact.getKeySpec(kp.getPublic(), RSAPublicKeySpec.class); RSAPrivateKeySpec priv = fact.getKeySpec(kp.getPrivate(), RSAPrivateKeySpec.class); saveToFile("public.key", pub.getModulus(), pub.getPublicExponent()); saveToFile("private.key", priv.getModulus(), priv.getPrivateExponent());
tagged with: public-key-encryption
has answer: http://stackoverflow.com/a/27234001
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43085093
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27312251
has text: This cannot be a valid Java String constant, for starters
type: QuestionComment

http://stackoverflow.com/comment/43093143
has text: Very unlikely. Do a search on this error and see what you come up with. Did you restart? That's first. Also, look at task manager and see if something's running that could be tying up file. Get Unlocker utility and see what it says is locked.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27309932

http://stackoverflow.com/q/27290213
has title: Stub dynamic finder using spock
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/27291713
upvote count: 4
answer count: 1
downvote count: 0
score: 4
tagged with: grails
has body: I need help with a Spock test. I am trying to stub a Domain Object's dynamic finder (findById). I can't use code like: ObjectDomain.metaClass.static.findById = { -&gt; new ObjectDomain()} because I use the findsById method in other part of the test and if I use that I get false positives. anybody knows the best way to stub dynamic finders using Spock? Thanks in advance.
tagged with: groovy
accepted answer: http://stackoverflow.com/a/27291713
has comment: http://stackoverflow.com/comment/43048507
favorite count: 0
has comment: http://stackoverflow.com/comment/43047929
type: AnsweredQuestion
tagged with: spock
tagged with: java
has comment: http://stackoverflow.com/comment/43048269

http://stackoverflow.com/comment/43074407
type: AnswerComment
comment on: http://stackoverflow.com/a/27305836
type: Comment
score: 0
has text: Paul, are you saying if I throw the exception in Card(), it doesn't go to the memory and I have to throw/catch it again in the following Class?

http://stackoverflow.com/comment/43051528
type: AnswerComment
comment on: http://stackoverflow.com/a/27238037
score: 0
type: Comment
has text: OSGi services are much more flexible and modular than SPI. Also, SPI does not work in OSGi. You will have issues with the classLoaders and you will not have the chance to configure the provided service dynamically.

http://stackoverflow.com/a/27313728
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27313159
type: Answer
accepted answer of: http://stackoverflow.com/q/27313159
upvote count: 3
score: 3
has body: Why not try it out? In java 1.7, the main method of the following class: public class Concat1 { private static final String constant2 = "c2"; private static final String constant3 = "c3"; public void main(String[] args) { StringBuilder sb = new StringBuilder(); sb.append(args[0]); sb.append("?"); sb.append(constant2); sb.append("="); sb.append(constant3); System.out.println(sb.toString()); } } (I changed the number of constant for clarity) yields the following byte code: public class Concat1 { public Concat1(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."":()V 4: return public void main(java.lang.String[]); Code: 0: new #2 // class java/lang/StringBuilder 3: dup 4: invokespecial #3 // Method java/lang/StringBuilder."":()V 7: astore_2 8: aload_2 9: aload_1 10: iconst_0 11: aaload 12: invokevirtual #4 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 15: pop 16: aload_2 17: ldc #5 // String ? 19: invokevirtual #4 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 22: pop 23: aload_2 24: ldc #6 // String c2 26: invokevirtual #4 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 29: pop 30: aload_2 31: ldc #7 // String = 33: invokevirtual #4 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 36: pop 37: aload_2 38: ldc #8 // String c3 40: invokevirtual #4 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 43: pop 44: getstatic #9 // Field java/lang/System.out:Ljava/io/PrintStream; 47: aload_2 48: invokevirtual #10 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; 51: invokevirtual #11 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 54: return } while the following class: public class Concat2 { private static final String constant2 = "c2"; private static final String constant3 = "c3"; public void main(String[] args) { StringBuilder sb = new String…

http://stackoverflow.com/comment/42818323
comment on: http://stackoverflow.com/q/27161773
has text: Yes. I will either disable the transformation, or apply the transformation recursively on the inner HTML (which would make it programmatic rather than purely declarative).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28037652
answers question: http://stackoverflow.com/q/27309506
score: 0
type: Answer
has body: Remove "testDemoExample.add" from catalog path if you are using free tables and if you are using database table, change \\ to // in catalog path.

http://stackoverflow.com/comment/42910931
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27215235
has text: when i make a resource folder in eclipse, it doesnt put the resource folder in the bin folder.
type: Comment

http://stackoverflow.com/comment/42917301
type: Comment
type: QuestionComment
has text: Why do you use `j` as index in `arr[j] = S.nextInt();` inside loop based on `i1`? Since `j` doesn't change you are writing results of `nextInt()` into same location in array.
comment on: http://stackoverflow.com/q/27219015
score: 1

cellrenderer
tags question: http://stackoverflow.com/q/27202185
type: Tag
tag name: cellrenderer

http://stackoverflow.com/q/27237339
type: Question
has answer: http://stackoverflow.com/a/27237541
tagged with: class
has comment: http://stackoverflow.com/comment/42951462
has comment: http://stackoverflow.com/comment/42951582
score: 0
answer count: 1
has title: JFrame Wont Open when Combined with Other Classes in Main
tagged with: jframe
type: UnansweredQuestion
has body: When I instantiate the class that is supposed to open JFrame in the main method that contains another instantiated class, JFrame does not open, and I am not sure what I am doing wrong since there are no syntax erorrs. Thanks for the help. Tega Get Data Class: import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import javax.swing.JOptionPane; import java.text.DecimalFormat; /** * This class get the data from the user in a .csv format and split it into data and variable. * The class also turn the level data into returns */ /** * @author */ public class GetData { private ArrayList&lt;String&gt; originalDataString = new ArrayList&lt;String&gt;(); //This would be used to get the data from file private String dateTitle; //For date title private String variableTitle; //For the title of the variable from your file. private ArrayList&lt;String&gt; date = new ArrayList&lt;String&gt;(); //To store the date private ArrayList&lt;Double&gt; variableLevel = new ArrayList&lt;Double&gt;(); //To store the content of the Level data private ArrayList&lt;Double&gt; variableReturn = new ArrayList&lt;Double&gt;(); //To store the content of the Return data /** * The constructor opens a file to read the data * @param filename The file to open * @throws IOException */ public void getDataMethod() throws IOException { String filename = JOptionPane.showInputDialog("What is the name of the file you for the data?" + "\nThe file must be saved as .csv(comma delimited)"); File file = new File(filename); //Making sure that the file entered exist if (!file.exists()) { System.out.println("The file " + filename + " is not found"); System.exit(0); } //Getting the data from the file Scanner inputFile = new Scanner(file); String line; //To read the lines from the data while (inputFile.hasNext()) { line = inputFile.nextLine(); //Add each line to the ArrayList originalDataString.add(line); } //This part split the date and the variable and put them into one a…
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/42807461
type: QuestionComment
comment on: http://stackoverflow.com/q/27156311
has text: Can you set Secure Processing Feature to false?
score: 0
type: Comment

http://stackoverflow.com/comment/43027719
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27276943
has text: What should happen when two users save different values for the same thing?
type: Comment

http://stackoverflow.com/comment/42811272
comment on: http://stackoverflow.com/a/27155037
score: 0
type: Comment
has text: Then put an addendum on your question, or add a comment to the question or to one of the answers. Don't post your followup or extension question as an answer.
type: AnswerComment

http://stackoverflow.com/comment/43092502
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27248966
has text: For future reference, I've checked the above in detail and this is the full story. There are 3 compile/runtime deps: `jmh-core`, `jopt-simple`, and `commons-math3`; and an additional compile-time dep (compile-time annotation processor): `jmh-generator-annprocess`. Still a quite simple setup, easily replicated in gradle, ant, or a plain shell script. It works out-of-the box in Eclipse with basic Maven support (Maven dependencies container), using the standard Eclipse compiler and Run function.

http://stackoverflow.com/comment/42942043
type: QuestionComment
has text: Re "Both is called DIIOP", no it's only called DIIOP when you are using NCSO.jar. Dave is right. When you are using Notes.jar, you are using NRPC connecting to the regular Domino server task on port 1352. When you use NCSO.jar, it is connecting to the Domino IIOP task on the IIOP port (usually 60148 or 63148).
comment on: http://stackoverflow.com/q/27214544
score: 0
type: Comment

http://stackoverflow.com/q/27230878
has answer: http://stackoverflow.com/a/27230948
score: 0
tagged with: string
has body: Hello I have a string containing an array! I want to be able to construct this into an array but I cannot find any methods for doing so! Can someone help me, this is what my string looks like [111111,111111,111111,111111,111111,111111,111111]
accepted answer: http://stackoverflow.com/a/27230948
has title: Convert string containing an array to array object
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42938587
type: Question
tagged with: arrays
answer count: 1

http://stackoverflow.com/comment/43395501
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27475369
has text: thanks for the answer. Can you tell me what is the difference between Xpath generated by Firebug and the Xpath generated by selenium and which one should be preferred.
type: AnswerComment

http://stackoverflow.com/q/27211444
has body: I've written an application in JAVA and I've installed it to run via launchctl (basically cron). The problem I'm having is every time the job fires, I briefly see "Java" in the Menu Bar and keyboard control is taken away from me (again briefly but enough to annoy). How can I stop the application from doing this? Is there anything in launchctl that I can do? I know there are other applications launchctl is firing off that don't exhibit this behavior.
answer count: 1
has comment: http://stackoverflow.com/comment/42910572
tagged with: macos
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42910735
score: 1
tagged with: java
upvote count: 1
has title: How to start Java application with console suppressed on Mac
type: Question
has answer: http://stackoverflow.com/a/27591893
downvote count: 0
tagged with: console

http://stackoverflow.com/comment/42810849
comment on: http://stackoverflow.com/a/27158306
type: AnswerComment
has text: Still it wont delete the second name which is "White". And the size remains the same :(
score: 0
type: Comment

http://stackoverflow.com/a/27215604
has comment: http://stackoverflow.com/comment/42915361
has comment: http://stackoverflow.com/comment/42913005
has comment: http://stackoverflow.com/comment/42913810
type: AcceptedAnswer
has body: Although, strictly speaking, the question could be considered as being "Off topic" (since you're mainly looking for debugging help), this is one of your first questions, so some general hints: When you post a question here, consider that people here a volunteers. Make it easy for them to answer the question. In this particular case: You should create a MCVE, so that people can quickly copy &amp; paste your code (preferably, in a single code block) and run the program without any effort. For example, you should include a test class, inculding a main method, like this one: public class FFTest { /** * B---D * / \ / \ * A . F * \ / \ / * C---E */ public static void main(String[] args) throws Exception { FF ff = new FF(); Vertex vA = new Vertex("A"); Vertex vB = new Vertex("B"); Vertex vC = new Vertex("C"); Vertex vD = new Vertex("D"); Vertex vE = new Vertex("E"); Vertex vF = new Vertex("F"); ff.insertNode(vA); ff.insertNode(vB); ff.insertNode(vC); ff.insertNode(vD); ff.insertNode(vE); ff.insertNode(vF); ff.insertEdge(vA, vB, 3.0f); ff.insertEdge(vA, vC, 2.0f); ff.insertEdge(vB, vD, 1.0f); ff.insertEdge(vB, vE, 4.0f); ff.insertEdge(vC, vD, 2.0f); ff.insertEdge(vC, vE, 1.0f); ff.insertEdge(vD, vF, 2.0f); ff.insertEdge(vE, vF, 1.0f); float result = ff.fordFulkerson(vA, vF); System.out.println(result); } } (You should already have created such a test class when you write the question, anyhow!) You should make clear that you are NOT using StackOverflow as a "magic problem solving machine". In this case: I already mentioned that you should include debug outputs. If you had extended your FF class with methods like these.... private static void printPath(List&lt;Edge&gt; path) { System.out.println("Path: "); for (int i=0; i&lt;path.size(); i++) { Edge e = path.get(i); System.out.println( "Edge "+e+ " flow "+e.getFlow()+ " cap "+e.getCapacity()); } } which can be called in the main loop like this: while(bfs(source, destination, path)) { ... System.out.println("Before updating wi…
has comment: http://stackoverflow.com/comment/42944553
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42913844
accepted answer of: http://stackoverflow.com/q/27212679
answers question: http://stackoverflow.com/q/27212679

http://stackoverflow.com/a/27212480
accepted answer of: http://stackoverflow.com/q/27212460
answers question: http://stackoverflow.com/q/27212460
downvote count: 0
score: 7
type: AcceptedAnswer
has body: Both ways are acceptable (and neither way is "dirty" in my opinion). The first is less verbose and the one I would prefer in a trivial case like this. If you're extending Thread, so you can also skip Thread.currentThread(): new Thread() { public void run() { System.out.println("Thread: " + getName()); System.out.println("hello"); } }.start(); In any non-trivial case however (i.e. if the thread does more than just a couple of prints) the usual rule of "favor composition over inheritance" applies which advocates the second approach. If you're using Java 8, you can even take advantage of the fact that Runnable is a functional interface: new Thread(() -&gt; { System.out.println("Thread: " + Thread.currentThread().getName()); System.out.println("hello"); }).start() A final note: I rarely use threads these days. Whenever I do, I tend to end up rewriting it using ExecutorServices.
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/42905789
has comment: http://stackoverflow.com/comment/42906787
has comment: http://stackoverflow.com/comment/42905807

http://stackoverflow.com/comment/42893141
type: QuestionComment
has text: Please describe the Problem in more Detail. Are there some Exceptions?
score: 0
comment on: http://stackoverflow.com/q/27205267
type: Comment

http://stackoverflow.com/comment/42911753
type: QuestionComment
has text: iterate through List and enter each element in a Any collection like another list or set and before inserting check .conatins(element) on that collection and wherever it returns true that means this element is already present.
comment on: http://stackoverflow.com/q/27215773
score: 0
type: Comment

http://stackoverflow.com/comment/42940886
comment on: http://stackoverflow.com/a/27231735
has text: Add them to the orm.xml. Just write it once and it will be ok.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/27251639
score: 0
answer count: 1
has title: Xml components are not loaded into activity
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42977842
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-asynctask
has body: Edit: I just found out that comment the lines that cause the error, he gets the screen all black ... that is, does not load the layout. I'm trying to get a ProgressBar and a TextView to be able to make changes according to AsyncTask. It is noteworthy that at the time the project was created, the main activity is not this, this (with name SplashScreen) was created later (I'm saying this because I am beginner and I am not aware if something can affect if I left something behind ). protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splash_screen); /* New Handler to start the Menu-Activity * and close this Splash-Screen after some seconds.*/ mProgressBar = (ProgressBar) this.findViewById(R.id.progressBar); mProgressText = (TextView) this.findViewById(R.id.progressBarTextView); try { new WSCatalogo91(this).execute(); } catch (SQLException e) { e.printStackTrace(); } } to return rows where do findViewById is always null. <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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".SplashScreen"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/logoSplashScreen" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <TextView android:text="@string/progressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:id="@+id/progressBarTextView" android:maxWidth="400dp" android:maxHeight="400dp"/> <ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="wrap_content" andr…
has answer: http://stackoverflow.com/a/27251863
type: Question
has comment: http://stackoverflow.com/comment/42979498
tagged with: java

http://stackoverflow.com/q/27309495
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27309533
has answer: http://stackoverflow.com/a/27309533
has title: java printWrite writes nothing to file, but file is created
accepted answer: http://stackoverflow.com/a/27309538
type: AnsweredQuestion
tagged with: java
tagged with: file
type: Question
has body: i use this to write string to file. I see this file has been created by this code but no content inside. PrintWriter out = new PrintWriter("/home/paul/Documents/linuxwork/core_java/Welcome/src/output.txt"); out.println("helloworld"); Did I miss anything? THanks
has answer: http://stackoverflow.com/a/27309538

binary-search-tree
tags question: http://stackoverflow.com/q/27219895
tags question: http://stackoverflow.com/q/27243102
tags question: http://stackoverflow.com/q/27302826
tags question: http://stackoverflow.com/q/27275587
tags question: http://stackoverflow.com/q/27286813
type: Tag
tags question: http://stackoverflow.com/q/27285428
tags question: http://stackoverflow.com/q/27218942
tag name: binary-search-tree

http://stackoverflow.com/q/27163160
has title: create android project and android-support-v7-appcompat is not included in lib(eclipse)
has comment: http://stackoverflow.com/comment/42819299
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27164474
score: 0
answer count: 1
has body: I fixed the problem. I used the workspace which was given by a python professor. I guess some sets do not match. After changing workspace, it works. Thank all you guys answer. When i create a new android project, i ask eclipse create the activity for me. the code need to be imported v7, but there is not v7 in the lib. The error message shows up and stop the creating process. Anyone know how to fix it?（And i want to fix it in one time. i dont want it show up every time i create new project）(also if i cant fix it, eclipse cannot finish creating process,it means there are some unknown file have not be created before the error.this is the biggest problem) [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. [2014-11-26 23:39:54 - s] [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. [2014-11-26 23:39:54 - s] [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. [2014-11-26 23:39:54 - s] [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. [2014-11-26 23:39:54 - s] [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. [2014-11-26 23:39:54 - s] [2014-11-26 23:39:54 - s] C:\EclipseWorkspaces\personal\s\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBa…
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42819332
linked to: http://stackoverflow.com/q/17870881
has answer: http://stackoverflow.com/a/27164474
tagged with: java
type: Question

http://stackoverflow.com/comment/73031103
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27181414
has text: @Md.Kamruzzaman Yes thanks for giving attention to my question i just found a solution i set date 01 Feb 2017 (instead of 07 Feb 2017) and 02 Mar 2017 and got my expected solution as 2 months.

http://stackoverflow.com/comment/42966544
type: Comment
has text: I'd say it depends. In some cases you want to test if it is separated from a value. Then using the `!=` operator is the right way.
type: AnswerComment
comment on: http://stackoverflow.com/a/27245598
score: 0

http://stackoverflow.com/comment/42898393
type: QuestionComment
has text: If the app is crashing then post the logcat output and tell us which line is causing the crash (which you can find in the logcat output).
score: 0
comment on: http://stackoverflow.com/q/27208222
type: Comment

http://stackoverflow.com/comment/43061860
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27298835
type: Comment
has text: For some reason i was looking in the myList class I created and not the KVP class.

android-inapp-purchase
tags question: http://stackoverflow.com/q/27242746
tag name: android-inapp-purchase
type: Tag

http://stackoverflow.com/q/27285945
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27286198
answer count: 2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43039324
has body: I am trying to work on a syllable counter that counts the syllables in the string I enter. Here are the instructions. - Syllables are really useful for a lot of things. They are defined according to the following rules involving consonants (non-vowels) and vowels (a, e, i, o, u, y): Starting y omitted: (a) when words begin with y, we don’t count the starting y as a vowel. (we are assuming there are no words that start with y followed immediately by a consonant) Silent e omitted: (a) when e is the last letter of a word, we’ll assume it is silent, unless the word is café or entrée (words borrowed from French). (* we’ll ignore all other words to simplify) For simplification, it may be best to create a new String without this silent e, before checking for more syllables. With the silent-e omitted, one-syllable units: (a) have a single vowel. (b) have two vowels that are the same letter in succession. (c) have two vowels in immediate succession that are ei, ie, ea, ou, ey, ay, oy, uy, ai. (d) have three vowels in immediate succession that are eau, iou (* yes, there are exceptions to this that we are ignoring here). With the silent-e omitted, two-syllable units: (a) two vowels in immediate succession where the vowels are different letters not following the rule above. For instance, oe, io, oi. (b) three vowels in immediate succession not following the rule above where the last vowel is not a silent e. For instance (“eye”) as in “meyer.” Generate a program called SyllableCounter that counts syllables in a word or sentence (maximum one line). Assume the user will not use any punctuation. Pseudocode and a testing plan are required. Do not print in main(). Sample output: Please enter your word or sentence, followed by a carriage return. Sally where are you going Your entry has 7 syllables. Here is my current code (It compiles, but has a StringIndexOutOfBoundsException - /* * SyllableCounter.java * Prints the number of syllables based on an inputed string * * Testing - What sh…
linked to: http://stackoverflow.com/q/33425070
upvote count: 2
has title: SyllableCounter counts the Syllables in a word
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/34017291

http://stackoverflow.com/comment/83766707
score: 0
type: Comment
has text: BTW xpath are slower and much slower in IE
type: AnswerComment
comment on: http://stackoverflow.com/a/27246729

http://stackoverflow.com/comment/43009633
type: AnswerComment
type: Comment
has text: Format is the problem??
comment on: http://stackoverflow.com/a/27269648
score: 0

http://stackoverflow.com/comment/73505261
has text: or just ` ` which avoids such problems and always gets you the latest version
comment on: http://stackoverflow.com/a/27246822
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43036872
has text: Editing your existing question bumps it, so there's no need to create a new one. In both cases, we can't help you if you don't show us your `sequence` method.
score: 0
comment on: http://stackoverflow.com/q/27283805
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42925572
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27222958
type: AnswerComment
has text: Are you getting camera stopping event for all time?

http://stackoverflow.com/comment/42990451
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27247034
has text: Wow, that's a lot of code. Note that PBKDF2 (Rfc2898DeriveBytes) functionality should already been present in Java (although it is only compatible for ASCII characters). If you have already verified that the keys are correct, then it seems you are using a **block** size of 256 bits in Java vs 128 bit (i.e. AES) in the C# code of jbtule.
score: 0

http://stackoverflow.com/comment/43087361
comment on: http://stackoverflow.com/a/27313148
score: 0
type: AnswerComment
type: Comment
has text: @RealSkeptic - I just meant that incrementing **during** the call to the only methods that are using it (the get() method) you can ensure that it will be correct at the time of the call as long as it's only being altered during get() calls. It's a silly hack, I probably shouldn't have mentioned it.

http://stackoverflow.com/a/27320265
has body: I have a client working with Spring 3.2.8 and Hessian 3.2. Hope this helps.
answers question: http://stackoverflow.com/q/27309477
type: Answer
accepted answer of: http://stackoverflow.com/q/27309477
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27241185
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/42958809
favorite count: 0
has body: for(int j = 1;j&lt;fileArray.size();j++) { if(str.contains(fileArray.get(end+j))) { } } (assume end is some number such as 30). The goal of this part is when having a window length of 30 and a fileArray size > 30, check if theres anything after index 30 that matches whatever is inside the window. ex: "i like to eat piesss aaaabbbbpiesssbbbb" starting from the beginning of the string add the first 17 characters to a arraylist called window. then i check the rest of the string starting from right after window to see if there's anything that matches. space doesnt match so you add it to the output. keep checking then you see "piesss" matches. Then i replace the second "piesss" with wherever the first "piesss" occurs. So right now im using fileArray.get(end+j) to check if there's anything that matches within my string(str) except this doesn't really work. Is there a way I could fix this code segment?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42959087
has answer: http://stackoverflow.com/a/27241511
has comment: http://stackoverflow.com/comment/42958898
downvote count: 2
has comment: http://stackoverflow.com/comment/42959096
type: Question
has title: How would I check if a part of a string equals another string of unknown length?
has comment: http://stackoverflow.com/comment/42958962
has comment: http://stackoverflow.com/comment/42958936
score: -2
has comment: http://stackoverflow.com/comment/42958937
tagged with: java
has comment: http://stackoverflow.com/comment/42958783
upvote count: 0

http://stackoverflow.com/comment/42952391
type: Comment
has text: Yep, I guess I shouldn't be surprised but that actually works in grails without any further work necessary. Thanks!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27237677

http://stackoverflow.com/q/27204522
type: Question
accepted answer: http://stackoverflow.com/a/27204835
score: 0
answer count: 2
tagged with: grid-layout
has body: I want to display a lot of component in a grid view, like the normal explorer in windows or other operating systems. Is it possible to obtain this with a default or 3rd Party layout manager? I tried Gridlayout and Springlayout (according to this article). Both resize the components relative to the parent dimension but I want fixed cell size and relative row and column numbers.
possible better answer: http://stackoverflow.com/a/27204618
tagged with: layout-manager
has answer: http://stackoverflow.com/a/27204618
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27204835
tagged with: java
has title: Components in Grid with fixed size

http://stackoverflow.com/comment/42848135
type: Comment
has text: @user2950872 Glad that works. If you like the answer, please consider marking it as accepted. Thanks!
comment on: http://stackoverflow.com/a/27179479
type: AnswerComment
score: 0

http://stackoverflow.com/q/27270089
score: 1
upvote count: 3
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/15977637
has answer: http://stackoverflow.com/a/27270864
type: Question
has title: Parse an ISO-8601 duration in Java / JavaScript
has comment: http://stackoverflow.com/comment/43011003
tagged with: javascript
has comment: http://stackoverflow.com/comment/43013527
has comment: http://stackoverflow.com/comment/43011601
has comment: http://stackoverflow.com/comment/43011181
has comment: http://stackoverflow.com/comment/43013524
has comment: http://stackoverflow.com/comment/43010370
answer count: 1
has comment: http://stackoverflow.com/comment/43011980
accepted answer: http://stackoverflow.com/a/27270864
has comment: http://stackoverflow.com/comment/43011605
favorite count: 0
linked to: http://stackoverflow.com/q/14934089
has comment: http://stackoverflow.com/comment/43013222
has comment: http://stackoverflow.com/comment/43013182
has comment: http://stackoverflow.com/comment/43010690
has comment: http://stackoverflow.com/comment/43013678
has comment: http://stackoverflow.com/comment/43011791
has comment: http://stackoverflow.com/comment/43011427
has body: I need to convert an ISO-8601 duration into a date using JavaScript or Java. For example ISO-8601 like P0000-00-60T00:00:00 and current date like 2014-11-30 means, i want to get output like 2015-01-29
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2201925

http://stackoverflow.com/q/27229450
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42935973
tagged with: frameworks
linked to: http://stackoverflow.com/q/3573480
accepted answer: http://stackoverflow.com/a/27229624
type: AnsweredQuestion
favorite count: 0
type: Question
tagged with: diff
has title: Diff files and mark as yellow in Java
has answer: http://stackoverflow.com/a/27229624
has body: Does anyone could recommend a framework or a java api that could help me compare two files? I would to compare both and mark one as yellow where we have the differences, like Tortoise do as example.
score: 0

composite
tags question: http://stackoverflow.com/q/27203124
type: Tag
tag name: composite
tags question: http://stackoverflow.com/q/27206238

http://stackoverflow.com/q/27174917
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27175004
has body: I writing a program that takes a string inputted by user. (example: 175-24-56-5) The program takes that string and puts it in an ArrayList. The problem I'm having is that when I try to print the ArrayList, the last number (that should be in the ArrayList) isn't printed. Here's my code for that method: public void dc(String txt) { ArrayList&lt;String&gt; unkey = new ArrayList&lt;String&gt;(); int l = txt.length(); int x = 0; String xx = ""; String k = ""; for (int j = l; j &gt; 0; j--) { xx = Character.toString(txt.charAt(x)); System.out.println(xx); if (xx.equals("-")) { unkey.add(k); k = ""; } else { k += xx; } x++; } System.out.println(l); System.out.println(unkey); System.out.println(x); } It should have printed {175, 24, 56, 5} But it only prints {175, 24, 56} I'm relatively new to this. Any help? Thanks in advance..
type: Question
has answer: http://stackoverflow.com/a/27174951
has comment: http://stackoverflow.com/comment/42839794
has answer: http://stackoverflow.com/a/27174970
answer count: 6
accepted answer: http://stackoverflow.com/a/27174970
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27174963
has answer: http://stackoverflow.com/a/27174963
has answer: http://stackoverflow.com/a/27174949
has answer: http://stackoverflow.com/a/27175026
has title: ArrayList not printing all elements
tagged with: arraylist

http://stackoverflow.com/a/27235895
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27235157
upvote count: 1
has body: The purpose of Jasypt is to encapsulate security best practices of using encryption technology so that people not familiar with encryption can be reasonably safe in deploying such technology. It makes choices about CBC vs ECB and 68bit vs 128bit vs 256 bit and other lower level details for you. Sometimes incorrect choices of these low level details can affect the security your application (read someone can crack it). Jaspyt helps to minimize such possibilities by giving you the best options for security. So in a way it's less risky than using JCE or Bouncy Castle directly. In their FAQ they address your question directly: http://www.jasypt.org/faq.html#does-jasypt-implement-algorithms
type: Answer

http://stackoverflow.com/a/27228111
upvote count: 2
type: Answer
score: 2
has body: Its seems you have not parsed properly Change your try block with the following code try{ JSONObject myJson = new JSONObject(str); JSONObject entityObject = myJson.getJSONObject("entity"); // Parsing title JSONOBject titleObject = entityObject.getJSONObject("title"); String grande = titleObject.getString("$t"); // Do the same for Description as well (Like above two line) Toast.makeText(getActivity(), ""+grande, Toast.LENGTH_SHORT).show(); } catch ( JSONException e) { e.printStackTrace(); }
answers question: http://stackoverflow.com/q/27227838
accepted answer of: http://stackoverflow.com/q/27227838
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43093852
type: AnswerComment
comment on: http://stackoverflow.com/a/27269773
has text: 10.9.5, and there was one log file per launch. The unpack log file didn't look remarkable, but when we tried it on a new mac, which started as 10.9.5 and was upgraded to 10.10.1, it had the following nice behavior: it ran and failed as described, but then ran the second time, displaying the window correctly. I'll accept this answer, and ask another question with the two launch issue... Thanks!
type: Comment
score: 0

http://stackoverflow.com/q/27202720
tagged with: android-intent
type: AnsweredQuestion
tagged with: android-fragments
has answer: http://stackoverflow.com/a/27203561
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27202783
accepted answer: http://stackoverflow.com/a/27202783
answer count: 2
has comment: http://stackoverflow.com/comment/42888339
possible better answer: http://stackoverflow.com/a/27203561
downvote count: 0
has title: Change to Activity from Fragment
tagged with: android-activity
favorite count: 0
has body: I'm new to Android programming. I have the question, that how i can intent from fragment to an activity. I was trying to code it, but i failed :( ('l_places' is the layout of Fragment Places, and 'p_tr_fr' is a clickable TableRow) Here's my code of the Fragment: package com.fragment.toactivity; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Places extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.l_places, container, false);//l_places is the layout return rootView; } public void goToAttract(View v) { if (v.getId()== R.id.p_tr_fr) { Intent intent = new Intent(getActivity(), Listact.class); startActivity(intent); } } public View onCreateView(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }; } and here is my XML: <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="60dp" android:layout_height="60dp" android:id="@+id/imageView2" android:src="@drawable/m_pf" android:scaleType="fitCenter" android:layout_marginLeft="6dp" android:layout_marginTop="6dp" android:layout_marginBottom="6dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/s_shop" android:id="@+id/textView3" android:layout_column="1" android:layout_gravity="center_vertical" android:textStyle="bold" android:textSize="18dp" android:textColor="#ff000000" android:layout_marginLeft="6dp" /> When I click on the TableRow, the app stops. Please help! (sorry for my english)
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/74326265
type: Comment
has text: I am using Keycloak and have the same issue. It seems to be that the application, including webfilters, jax-rs filters etc never get into play in this scenario.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27203830

http://stackoverflow.com/q/27193250
has body: I'm executing a very simple SQL, that when I run in SQL Server Management Studio it's take a few seconds. But when I run in java using JDBC it freezes. The memory usage goes from 34MB to 280MB. public int size() { int lines = 0; string StringSize = "SELECT COUNT(BO_Numseq) FROM dbo.BOLETO"; try { Statement statementL = connection.createStatement(); ResultSet rsLocal = statementL.executeQuery(StringSize); rsLocal.next(); int size = rsLocal.getInt(1); resetConnexion(); return size; } catch (SQLException ex) { Logger.getLogger(ModelTratamentoBoleto.class.getName()).log(Level.SEVERE, null, ex); } return lines; public void resetConnexion() { try { connection = MSFConstants.controleur.getConnectionAutomat().getCnx(); statement = connection.createStatement(); rs = statement.executeQuery(stringCommand); } catch (SQLException ex) { Logger.getLogger(ModelTratamentoBoleto.class.getName()).log(Level.SEVERE, null, ex); } } public class ConnectionAutomat { private Connection cnx; private String stringConnection; public ConnectionAutomat() { // System.out.println("start ConnectionAutomat"); MSFConstants.versionBdD = "NV02.06c"; String sysUserName = System.getProperty("user.name"); String activeBase="Automat"; if(MSFConstants.SWtestSandBox){ activeBase="AutomatSandbox"; } stringConnection = "jdbc:sqlserver://localhost;" + "databaseName="+activeBase+";user=" + MSFConstants.user.getLogonAutomat() + ";password=" + MSFConstants.user.getPassAutomat(); } // System.out.println("ConnectionAutomat stringConnection " + stringConnection); try { cnx = DriverManager.getConnection(stringConnection); // System.out.println("ConnectionAutomat connection"); } catch (SQLException ex) { // System.out.println("ConnectionAutomat erreur"); javax.swing.JOptionPane.showMessageDialog(null, "Error "); // Logger.getLogger(ConnectionAutomat.class.getName()).log(Level.SEVERE, null, ex); MSFConstants.controleur.fermetureApplication(); } } public Connection getCnx() { return cnx; } It hangs in the line "ResultSet…
has comment: http://stackoverflow.com/comment/42872152
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42872156
has comment: http://stackoverflow.com/comment/42872686
has comment: http://stackoverflow.com/comment/42872814
has comment: http://stackoverflow.com/comment/42872754
tagged with: java
has title: Java Executequery Hangs
has comment: http://stackoverflow.com/comment/42872110
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42872620
score: 0
has answer: http://stackoverflow.com/a/27193647
has comment: http://stackoverflow.com/comment/42872597
has comment: http://stackoverflow.com/comment/42872018
has comment: http://stackoverflow.com/comment/42872665
tagged with: jdbc

http://stackoverflow.com/comment/42948869
score: 0
comment on: http://stackoverflow.com/q/27235880
type: Comment
type: QuestionComment
has text: What is `SortingUser`?

http://stackoverflow.com/q/27276623
score: 1
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/27276711
tagged with: iterator
accepted answer: http://stackoverflow.com/a/27276711
has answer: http://stackoverflow.com/a/27276875
has answer: http://stackoverflow.com/a/27276827
has answer: http://stackoverflow.com/a/27277235
has answer: http://stackoverflow.com/a/27276775
possible better answer: http://stackoverflow.com/a/27276808
has answer: http://stackoverflow.com/a/27276808
upvote count: 1
answer count: 7
has comment: http://stackoverflow.com/comment/43022357
has title: Iterator not looping
favorite count: 0
tagged with: android
has body: In my project, the user inputs random letters. Then I iterate through my_list to see if any of those random letters appear in my_list. If so, I remove them from my_list. Example: List&lt;String&gt; my_list contains: [a, b, c, d] List&lt;String&gt; rand contains: [r, a] Goal: The a will be removed from my_list Problem: The Iterator loops through my_list searching for the letter r. The letter r is not in my_list. But instead of continuing to the next letter a, the iterator exits the loop and the a still remains in my_list Can someone please tell me why my loop keeps breaking after the first letter? Here's my code: public void removeLetters( List&lt;String&gt; my_list, List&lt;String&gt; rand ) { Iterator&lt;String&gt; i = my_list.iterator(); for( String s : rand ) { while( i.hasNext() ) { Object o = i.next(); if( o.toString().equals( s ) ) { i.remove(); i = my_list.iterator(); break; } } } } I hope I explained my problem good enough. Please let me know if I need to explain more in detail. Thanks
has answer: http://stackoverflow.com/a/27276743
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/27297386
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/66986889
upvote count: 2
has body: The solution is to remove the eclipse/tomcat scratch dir completely. Searching for .class files takes very long and doesn't give any result. The scratch dir can be found in /.metadata/.plugins/org.eclipse.wst.server.core there you can find a folder called tmp0. Removing this folder resolved my problem.
answers question: http://stackoverflow.com/q/27271625
downvote count: 0

http://stackoverflow.com/a/27258182
answers question: http://stackoverflow.com/q/27257683
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: Yeah... it has to crap. You create a byte array with 'SIZE' length and access it's position with point var which increments with 'SIZE' vallue. For example: int SIZE = 10; int point = 0; while( point &lt; channel.size() - SIZE ){ buffer1.get(bytes1, point, SIZE); // Your logic here point += SIZE; } When you do the above, SIZE vallue increments enourmously and you try to access the byte array with point position which will have a higher vallue than it's size. So, your logic to access the array position is wrong. As the error line says, you're accessing and index out of bounds( higher than the limit ). I hope I could help you.

http://stackoverflow.com/comment/42986948
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27256473
has text: http://stackoverflow.com/questions/22960057/shortest-path-between-two-nodes-in-an-infinite-complete-binary-tree and http://www.geeksforgeeks.org/find-distance-two-given-nodes/ might be helpful.

http://stackoverflow.com/q/27242989
linked to: http://stackoverflow.com/q/24053499
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27243067
has title: Java code indentation
has comment: http://stackoverflow.com/comment/42961813
has answer: http://stackoverflow.com/a/27243067
score: -1
tagged with: indentation
downvote count: 1
has answer: http://stackoverflow.com/a/27243095
has answer: http://stackoverflow.com/a/27243081
accepted answer: http://stackoverflow.com/a/27243081
favorite count: 0
tagged with: tabs
upvote count: 0
has answer: http://stackoverflow.com/a/27243075
has body: For 'case 1' below, the console prints the text as intended. case 1: System.out.println ("Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "); break; However, I want to format the code so that, when reading the code, the second line of text is aligned with the first: so that the S in 'System' is aligned with the T of the 'Text' that is at the start of the second line of text. If I use the tab to indent the second line, the tab appears in the text that is printed to the console. Is there a way around this?
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/27224852
has answer: http://stackoverflow.com/a/29554315
has body: I create a program as below to execute a linux (raspbian) command: "omxplayer". But I don't know why I cannot get output from omxplayer as the time I type it into command line and hit Enter.But the output only show at the end of the video. So I want to get the output immediately after I type "omxplayer [video_name]" and hit "Enter" in my program. Just like the command line (terminal) work when I type directly into it in linux. This is my code: public class testprog { public static void main(String args[]) throws IOException { String in = ""; while(in!="exit") { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); in = reader.readLine(); runCommand(in); } } public static void runCommand(String command) { String s; Process p; try { System.out.println("run command " + command); p = Runtime.getRuntime().exec(new String[]{"bash", "-c",command}); MyInputStreamReader reader1 = new MyInputStreamReader(p.getInputStream()); reader1.setTag("in"); reader1.start(); MyInputStreamReader reader2 = new MyInputStreamReader(p.getErrorStream()); reader2.setTag("in"); reader2.start(); p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch (Exception e) {} } } class MyInputStreamReader extends Thread{ boolean isStop = false; ReadEventHandler handler; String tag; InputStream in; public MyInputStreamReader(InputStream in) { this.in = in; } public void setHandler(ReadEventHandler handler) { this.handler = handler; } public void setTag(String tag) { this.tag = tag; } public void run() { byte[] buff = new byte[8192]; while (true) { //String line; try { int len = in.read(buff); if (len == -1) { return; } String line = new String(buff, 0, len); if (handler!=null) handler.onReceived(line); System.out.println(tag +" " + line); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void dispose() { this.isStop = true; } public interface ReadEventHandler { void onReceived(String line); } } Any response is hig…
answer count: 1
downvote count: 0
tagged with: xbmc
favorite count: 0
tagged with: terminal
tagged with: linux
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has title: Java run linux(raspbian) command(omxplayer) and get output
type: Question
tagged with: raspberry-pi

http://stackoverflow.com/comment/42855722
comment on: http://stackoverflow.com/q/27183641
has text: I'm pretty sure the answer here is going to be: Technically yes, but not with a result that you'll like.
type: Comment
type: QuestionComment
score: 8

http://stackoverflow.com/q/27209541
possible better answer: http://stackoverflow.com/a/27210622
has answer: http://stackoverflow.com/a/27210622
accepted answer: http://stackoverflow.com/a/27209585
has title: Switch statement is not accepting String variable
has comment: http://stackoverflow.com/comment/42900943
answer count: 2
downvote count: 1
linked to: http://stackoverflow.com/q/21006136
has comment: http://stackoverflow.com/comment/75493153
tagged with: java
tagged with: switch-statement
has body: Can someone please tell me why the switch statement is not recognizing the gat String variable. The IDE tells me that a primitive is required (int, char, short ....), but it found a string. String gat = temp[i]; switch (gat) { case "a": output[i] = 12 * k; break; case "b": output[i] = 23 * k; break; case "c": output[i] = 34 * k; break; }
upvote count: 4
has comment: http://stackoverflow.com/comment/42900896
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27209585
tagged with: string
favorite count: 0
type: Question
score: 3

http://stackoverflow.com/comment/42923267
type: QuestionComment
type: Comment
has text: How can I access mysql command line in cpanel? to do them?
score: 0
comment on: http://stackoverflow.com/q/27222294

javafx
tags question: http://stackoverflow.com/q/27179376
tags question: http://stackoverflow.com/q/27209124
tags question: http://stackoverflow.com/q/27206221
tags question: http://stackoverflow.com/q/27255278
tags question: http://stackoverflow.com/q/27206953
type: Tag
tags question: http://stackoverflow.com/q/27202341
tags question: http://stackoverflow.com/q/27210819
tags question: http://stackoverflow.com/q/27192327
tags question: http://stackoverflow.com/q/27299261
tags question: http://stackoverflow.com/q/27299033
tags question: http://stackoverflow.com/q/27180988
tags question: http://stackoverflow.com/q/27301453
tags question: http://stackoverflow.com/q/27197472
tags question: http://stackoverflow.com/q/27308826
tags question: http://stackoverflow.com/q/27302342
tags question: http://stackoverflow.com/q/27210462
tags question: http://stackoverflow.com/q/27279125
tags question: http://stackoverflow.com/q/27170120
tags question: http://stackoverflow.com/q/27178895
tags question: http://stackoverflow.com/q/27285507
tags question: http://stackoverflow.com/q/27292899
tags question: http://stackoverflow.com/q/27235284
tags question: http://stackoverflow.com/q/27194981
tags question: http://stackoverflow.com/q/27307658
tags question: http://stackoverflow.com/q/27280465
tags question: http://stackoverflow.com/q/27287634
tag name: javafx
tags question: http://stackoverflow.com/q/27203694
tags question: http://stackoverflow.com/q/27223924
tags question: http://stackoverflow.com/q/27214558
tags question: http://stackoverflow.com/q/27293744
tags question: http://stackoverflow.com/q/27208201
tags question: http://stackoverflow.com/q/27206706
tags question: http://stackoverflow.com/q/27205858
tags question: http://stackoverflow.com/q/27309594
tags question: http://stackoverflow.com/q/27234809
tags question: http://stackoverflow.com/q/27211899
tags question: http://stackoverflow.com/q/27189661
tags question: http://stackoverflow.com/q/27256588
tags question: http://stackoverflow.com/q/27154996
tags question: http://stackoverflow.com/q/27208476
tags question: http://stackoverflow.com/q/27305979
tags question: http://stackoverflow.com/q/27282133
tags question: http://stackoverflow.com/q/27290158
tags question: http://stackoverflow.com/q/27286618
tags question: http://stackoverflow.com/q/27230651
tags question: http://stackoverflow.com/q/27231834
tags question: http://stackoverflow.com/q/27290941
tags question: http://stackoverflow.com/q/27272545
tags question: http://stackoverflow.com/q/27269864
tags question: http://stackoverflow.com/q/27210522
tags question: http://stackoverflow.com/q/27295505
tags question: http://stackoverflow.com/q/27202129
tags question: http://stackoverflow.com/q/27190774
tags question: http://stackoverflow.com/q/27166838
tags question: http://stackoverflow.com/q/27211517
tags question: http://stackoverflow.com/q/27162374
tags question: http://stackoverflow.com/q/27183526
tags question: http://stackoverflow.com/q/27233078
tags question: http://stackoverflow.com/q/27182323

http://stackoverflow.com/comment/42840540
has text: What do you actually want to do? What do you mean by "feedback messages"? Why do you think this particular class is the way to do it?
comment on: http://stackoverflow.com/q/27174548
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27247955
downvote count: 0
has answer: http://stackoverflow.com/a/27248416
favorite count: 0
has answer: http://stackoverflow.com/a/27249832
has title: Spring form binding drop down object
has answer: http://stackoverflow.com/a/34914546
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: spring
type: Question
tagged with: spring-mvc
has body: Facing issue in spring form binding.Say i have two models Category and Product. @Entity @Table(name="PRODUCT") public class Product { @Id @GeneratedValue private long productID; @ManyToOne @JoinColumn(name="categoryID") private Category category; //Getters and setters } @Entity @Table(name = "CATEGORY") public class Category { @Id @GeneratedValue private long categoryID; private String categoryName; } In controller to render add product page @RequestMapping(value = "/productpage", method=RequestMethod.GET) private ModelAndView getAddProductPage(){ ModelAndView modelAndView = new ModelAndView("add-product","product",new Product()); Map&lt;Category,String&gt; categoriesMap = new HashMap&lt;Category, String&gt;(); List&lt;Category&gt; categories = categoryService.getAllCategories(); if(categories != null &amp;&amp; !categories.isEmpty()) { for(Category category : categories) { categoriesMap.put(category, category.getCategoryName()); } } modelAndView.addObject("categoryList",categories); return modelAndView; } I am able to populate the drop down values of categories in JSP page using below code : &lt;form:select path="category" &gt; &lt;form:options items="${categoryList}"/&gt; &lt;/form:select&gt; While submitting the form i'm facing error 400 The request sent by the client was syntactically incorrect.Failed to convert property value of type 'java.lang.String' to required type 'com.example.model.Category' for property 'category'. If i view page source for each option category is assigned correctly. But not understanding why spring throwing that err.. Need help. Thanks in advance!
tagged with: java
answer count: 3

http://stackoverflow.com/a/27238836
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27238673
type: Answer
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/27238673
has body: I believe this will do the trick for a Stack: Stack&lt;Card&gt; deck = new Stack&lt;&gt;(); // add Card types to deck... Collections.shuffle(deck);
type: AcceptedAnswer

http://stackoverflow.com/q/27264707
type: Question
accepted answer: http://stackoverflow.com/a/27265273
answer count: 1
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: jboss
tagged with: jakarta-ee
has title: Does JBoss7 allow Hibernate 3 xml configuration?
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27265273
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: First I excuse if this is a stupid question. I am trying to deploy my spring application into JBoss 7. Hibernate entities are configured with xml. That means PojoClass.hbm.xml and not annotated. What I want know simply is, do JBoss 7 or 8 version support only Hibernate (version 3) mapping Annotations (POJO class mappings to database tables)? and no xml configurations ? If it is possible, would you let me have any guidance resource URL please ?

http://stackoverflow.com/q/27269249
has comment: http://stackoverflow.com/comment/43011225
has body: I am looking for open source automated testing tool for load testing of GWT application. Till now , I tried using jmeter for load testing but its plugin dependent and i havent got the plugin. There I am encountering some error.Another one i tried was Neoload it was asking for rpc files whuich i don't know how to find.Finally I just want some easy user friendly automated tool for load testing of gwt web application and gwt-rpc.
favorite count: 0
has comment: http://stackoverflow.com/comment/43010543
has comment: http://stackoverflow.com/comment/43011135
tagged with: load-testing
has comment: http://stackoverflow.com/comment/43009913
has comment: http://stackoverflow.com/comment/43010166
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43010986
tagged with: jmeter-plugins
tagged with: gwt
has title: Load Testing for gwt web application, gwt-rpc
score: 1
has comment: http://stackoverflow.com/comment/43010645
tagged with: java
type: Question
upvote count: 1

http://stackoverflow.com/comment/42913560
comment on: http://stackoverflow.com/q/27216813
has text: it doesnt work ! i dont have any println !
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27307405
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Use ActionBarActivity class and getSupportActionBar method of this class from android support library v7. See how to add it here support v7.
answers question: http://stackoverflow.com/q/27307341
accepted answer of: http://stackoverflow.com/q/27307341

http://stackoverflow.com/comment/43121085
has text: Now it is working.I used a galleryview in a layout.I want to use the images from the assets folder as the images of the gallery . Can you help me?
comment on: http://stackoverflow.com/a/27236150
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27284001
type: Question
has comment: http://stackoverflow.com/comment/43036222
tagged with: load-testing
score: -1
tagged with: jmeter
answer count: 1
tagged with: rabbitmq
downvote count: 1
has body: I've been given the task of load testing the software my team designs and builds. It is a Java web app that acts as an API to all the other applications my company makes. This is a rough outline of the system: 1) Application 1 needs information from the database. 2) App 1 produces a request to a rabbit exchange (routing key for the queue that is consumed by the tool I'm testing). 3) My tool consumes the RabbitMQ queue that App1 pushed to 4) My tool executes the request sent from App1 via the Rabbit queue 5) My tool then sends the response back to App 1 via a Rabbit Exchange/Reply Queue. 6) App 1 then consumes from the reply queue and handles the response This is a very low level view as there are a lot of instances of each app that is publishing to and consuming the queue. I've never load tested anything before so I'm new to the concepts and tools available. Right now I'm using jMeter to initiate the calls and consume the replies (and I have it operating just like App 1 in the examples, it calls via rabbit and consumes the replies). Here are my questions: 1) Is this a viable way to load test? Should I be testing the capacity of the server directly or should I continue going through rabbit since it's a closer to production use case? 2) What is the best way to adjust my rate of production? I've tried doing some throttling via jMeter but when I look at the rabbit graphs the publish rate seems to fluctuate wildly. Example: I tell jMeter to publish at 1000 messages/sec and the graph on the rabbit dashboard goes from 500/sec to 3000/sec. I don't feel like I can accurately get an idea of what we can handle if I can reliably adjust the rate. My plan was: 1) Find the rate at which my application can't pick things off the queue fast enough. (where the rate of publishing to the queue becomes faster than my application can consume them). 2) Once I know the fastest I can send stuff to the queue I can check the responses for error rate and processing time. I was thinking that by …
tagged with: performance
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27287100
has title: Looking for help in designing load tests
upvote count: 0
favorite count: 0

http://stackoverflow.com/a/27192886
has comment: http://stackoverflow.com/comment/42871761
has comment: http://stackoverflow.com/comment/42883056
has comment: http://stackoverflow.com/comment/42879115
score: 17
has comment: http://stackoverflow.com/comment/42872135
accepted answer of: http://stackoverflow.com/q/27192739
has comment: http://stackoverflow.com/comment/42872021
upvote count: 17
has comment: http://stackoverflow.com/comment/42872091
has body: The precise term is a data race, which is a specialization of the general concept of a race condition. The term data race is an official, precisely specified concept, which means that it arises from a formal analysis of the code. The only way to get the real picture is to go and study the Memory Model chapter of the Java Language Specification, but this is a simplified view: whenever you have a data race, there is almost no guarantee as to the outcome and a reading thread may see any value which has ever been written to the variable. Therein also lies the only guarantee: the thread will not observe an "out-of-thin-air" value, such which was never written. Well, unless you're dealing with longs or doubles, then you may see torn writes.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42871595
has comment: http://stackoverflow.com/comment/42885481
has comment: http://stackoverflow.com/comment/42871968
has comment: http://stackoverflow.com/comment/42883589
has comment: http://stackoverflow.com/comment/42871483
type: Answer
has comment: http://stackoverflow.com/comment/42935921
answers question: http://stackoverflow.com/q/27192739

http://stackoverflow.com/comment/52493308
comment on: http://stackoverflow.com/a/27236076
type: AnswerComment
has text: Did not mark this answer as correct since strictly speaking it is not, but it provides the most helpful information about the problem. It is caused by an older unsafe version of plexus, but surefire is not the only plugin that may contain this. in our case it was surefire, and a few other plugins (some of them were home grown mojo's). once we completely removed all the dependencies on the old plexus, that fixed the issue.
score: 0
type: Comment

http://stackoverflow.com/comment/42996860
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27261958
type: Comment
has text: Mayme using 3 chained Maps and then sending them to a JSON library such as GSON or Jackson cloud do the trick.

http://stackoverflow.com/comment/43081495
comment on: http://stackoverflow.com/a/27309976
has text: @JuliusLeo Edited. Have you tried looking at it with a debugger?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27173619
has comment: http://stackoverflow.com/comment/42837370
has answer: http://stackoverflow.com/a/27173762
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27173824
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42837369
type: Question
has answer: http://stackoverflow.com/a/27173742
linked to: http://stackoverflow.com/q/4644415
has comment: http://stackoverflow.com/comment/42845533
has comment: http://stackoverflow.com/comment/42837303
has title: Inputting and validating the email address in JAVA
score: -2
has comment: http://stackoverflow.com/comment/42837278
has comment: http://stackoverflow.com/comment/42837327
possible better answer: http://stackoverflow.com/a/27173742
accepted answer: http://stackoverflow.com/a/27173824
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42837229
favorite count: 0
has body: I have written the below code but i am unable to make it loop if the input entered is false.Kindly help me. System.out.println("Please enter your email address ex:xyz@gmail.com"); String emailaddress=name.nextLine(); String email_regex = "[A-Z]+[a-zA-Z_]+@\b([a-zA-Z]+.){2}\b?.[a-zA-Z]+"; String testString = emailaddress; Boolean b = testString.matches(email_regex); System.out.println("String: " + testString + " :Valid = " + b); System.out.println("Email address is " +emailaddress);

http://stackoverflow.com/q/27230419
has answer: http://stackoverflow.com/a/27230474
has comment: http://stackoverflow.com/comment/42938348
has comment: http://stackoverflow.com/comment/42938389
has comment: http://stackoverflow.com/comment/42937980
has comment: http://stackoverflow.com/comment/42938731
answer count: 4
has comment: http://stackoverflow.com/comment/42938014
upvote count: 0
has comment: http://stackoverflow.com/comment/42937806
has answer: http://stackoverflow.com/a/27230493
accepted answer: http://stackoverflow.com/a/27230493
has comment: http://stackoverflow.com/comment/42937936
has comment: http://stackoverflow.com/comment/42937848
type: Question
has comment: http://stackoverflow.com/comment/42938003
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42938183
has answer: http://stackoverflow.com/a/27230484
tagged with: java
has comment: http://stackoverflow.com/comment/42938637
score: -1
has comment: http://stackoverflow.com/comment/42938099
has comment: http://stackoverflow.com/comment/42937882
has title: Can an interface be a superclass?
linked to: http://stackoverflow.com/q/4423968
linked to: http://stackoverflow.com/q/212614
has body: In the Java documentaion it states: @Override annotation informs the compiler that the element is meant to override an element declared in a superclass. I have a class that implements an interface and the implemented method statements have the @Override annotation. Does this mean (according to the docs) that the interface is a superclass of my class? But how can it be, considering that interfaces only contain 'empty' methods, not methods that actually do stuff? My code is LibGDX-related: public class MouseAndKeyboard implements ApplicationListener { private Texture plane1; private Sprite mainPlane; private SpriteBatch mainSpritePacket; @Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); ...
downvote count: 1
duplicate of: http://stackoverflow.com/q/212614
favorite count: 0
possible better answer: http://stackoverflow.com/a/27230474
has answer: http://stackoverflow.com/a/27230514
has comment: http://stackoverflow.com/comment/42937835

http://stackoverflow.com/a/27194395
has body: The Log interface First, you requires an interface to be used in each class of application. e.g.: public interface Log { boolean isInfoEnabled(); void info(String str); void info(String str, Throwable t); } The wrapper class Create a class that implements that interface. It's the wrapper for log4j, e.g.: class Log4jWrapper implements Log { private static final String FQCN = Log4jWrapper.class.getName(); private ExtendedLoggerWrapper log; public Log4jWrapper(Class&lt;?&gt; clazz) { Logger logger = LogManager.getLogger(clazz); log = new ExtendedLoggerWrapper((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory()); } public boolean isInfoEnabled() { return log.isInfoEnabled(); } public void info(String str) { log.logIfEnabled(FQCN, Level.INFO, null, new SimpleMessage(str), null); } public void info(String str, Throwable t) { log.logIfEnabled(FQCN, Level.INFO, null, new SimpleMessage(str), t); } } The LogFactory class. To create each Log, use a factory. e.g.: public class LogFactory { public static Log getLog(Class&lt;?&gt; clazz) { return new Log4jWrapper(clazz); } } Usage example Use this factory for each instance of Log into your application. e.g.: public class Test { private static final Log LOG = LogFactory.getLog(Test.class); public static void main(String[] args) { LOG.info("This is a test... :-)"); } }
has comment: http://stackoverflow.com/comment/85176023
has comment: http://stackoverflow.com/comment/137288642
downvote count: 0
answers question: http://stackoverflow.com/q/27182234
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/27505075
score: 0
has comment: http://stackoverflow.com/comment/43984956
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27230881
has body: You can add a -Dproduct.name="". in your JVM Option for suppressing the X-Powered-By
answers question: http://stackoverflow.com/q/27230881
type: Answer

http://stackoverflow.com/comment/43032531
comment on: http://stackoverflow.com/q/27281728
score: 0
has text: But it doesn't reach the return statement until all the permutations are finished though right?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27201043
type: Answer
has body: At the start of your method, write : NaturalNumberTuple placeholderTuple = null; This will keep this variable visible till the end of the method, and initialize it to a default value. Then, inside the loop yo change : NaturalNumberTuple placeholderTuple = remove(tuple[j]); to placeholderTuple = remove(tuple[j]);
answers question: http://stackoverflow.com/q/27201022
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27201022
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42821021
has text: @StavSaad I am just looking if it is possible.
score: 0
comment on: http://stackoverflow.com/q/27163591
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27270641
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27270737
duplicate of: http://stackoverflow.com/q/11483647
upvote count: 2
has comment: http://stackoverflow.com/comment/43016152
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2647289
downvote count: 1
type: Question
has title: Method Class in Reflection API
has comment: http://stackoverflow.com/comment/43016481
has body: This program ran fine when test() method was public but as soon as I changed its modifier to private it showed Run time error.Can anybody explain why? package ObjectClass; import java.lang.reflect.Method; public class reflect8 { public static void main(String[] args) throws Exception { Class c1 = Class.forName("ObjectClass.Reflect8A"); Object obj = c1.newInstance(); Method m1 = c1.getDeclaredMethod("test"); m1.invoke(obj); } } class Reflect8A { private void test() { System.out.println("from test..."); } }
linked to: http://stackoverflow.com/q/19135218
has answer: http://stackoverflow.com/a/27270868
accepted answer: http://stackoverflow.com/a/27270868
possible better answer: http://stackoverflow.com/a/27270737
answer count: 2
duplicate of: http://stackoverflow.com/q/2647289

http://stackoverflow.com/a/27225533
has body: I ended up injecting the constructor context.addComponent(IC.class, C.class); context.addComponent(A.class, A.class); and in class A I injected the constructor so: @Inject private IC c; So now depending on what I need I can add to the context whatever implementation of C class I need.
type: Answer
has comment: http://stackoverflow.com/comment/42932283
answers question: http://stackoverflow.com/q/27186140
score: 0

http://stackoverflow.com/q/27268002
tagged with: java
accepted answer: http://stackoverflow.com/a/27617704
answer count: 1
has title: ZK - Dynamically load more results categorically
type: AnsweredQuestion
type: Question
tagged with: zk
has answer: http://stackoverflow.com/a/27617704
score: 0
has body: I have a list of more than 5 users displayed in UI. I want to be able to dynamically load more users in a list, based on the category. If there are more than 5 users, then a label should be displayed, which when clicked, loads more users. Here is my UI code- I'm still trying to figure out how to load the respective users in respective categories, because the list of users displayed in the UI is dynamic and hence, I won't be sure which category will be available to be displayed in the UI and which one won't.

http://stackoverflow.com/comment/42983308
comment on: http://stackoverflow.com/q/27249023
type: Comment
score: 1
has text: @flashdrive2049 So your question boils down to: How does one create an admissible heuristic for an arbitrary graph?
type: QuestionComment

http://stackoverflow.com/q/27255773
answer count: 2
score: 0
has body: I've written a standard console application (web scraping) with several classes. The only thing that main fucntion does, is: - create one instance of a class - call one method from created object Now I need to add the simplest GUI which will contain one button to perform second of those aforementioned actions (call method) and textarea to display everything that NetBeans output shows now. I created new file with GUI class. It's basically a jFrame with jButton and jTextArea. I managed to get text output to work like I assumed. However I have no idea how to set the button. Netbeans creator redirects me to this part of code: private void buttonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: p1.use(); // &lt;&lt;&lt; my initial try } where p1 is object created in main class in original file. Netbeans marks "p1" as "cannot find symbol" which is understandable. However, how can I perform such a simple operation? I basically need that Button to push the program forward.
has title: Java - how to add gui which will make use of initial classes
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27256589
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/27256546
tagged with: java

http://stackoverflow.com/a/27210130
has body: If you use a HashMap with an object as a key, you need to implement two methods: boolean equals(Object other) int hashCode() Check out this question: Creating a hashCode() Method - Java
type: Answer
has comment: http://stackoverflow.com/comment/42901944
answers question: http://stackoverflow.com/q/27210096
downvote count: 1
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/42901911

http://stackoverflow.com/comment/42873384
comment on: http://stackoverflow.com/a/27193893
has text: Hey, sorry for the duplicate, I didn't see your answer before posting. Already removed it.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27232523
type: Question
score: 0
tagged with: java
tagged with: swt
has title: Blinking SWT Window in Windows 7 taskbar
tagged with: blink
answer count: 1
has comment: http://stackoverflow.com/comment/43020125
has comment: http://stackoverflow.com/comment/42942377
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52804521
has comment: http://stackoverflow.com/comment/43029087
has body: I have an SWT window and I want that it can blink when it is minimized in the taskbar. A friend of mine told me that I should try to activate (setActive()) the minimized window and then it should blink.. But that doesn't work.. Do you have any suggestions? Thanks for your help! Kind regards!

http://stackoverflow.com/comment/42998414
score: 0
type: AnswerComment
type: Comment
has text: But I've defined the ArrayList capacity as 50, so there's 50 initial empty spaces?
comment on: http://stackoverflow.com/a/27262868

http://stackoverflow.com/a/27172438
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27172223
has body: Use move method of Files class. Worked for me ;) Java doc
downvote count: 0
type: Answer

gmail
type: Tag
tags question: http://stackoverflow.com/q/27180234
tags question: http://stackoverflow.com/q/27181619
tag name: gmail

http://stackoverflow.com/comment/42886397
comment on: http://stackoverflow.com/q/27200962
score: 0
type: Comment
type: QuestionComment
has text: @Tom Can you briefly give idea about index? CREATE INDEX index_name11 ON corpus (Cor_Sentence). That way I can create. Then I can use that index name to search query instead of real column name. Is that only thing doing in the indexing in my problem? I know you sent me a link too. Thanx lot. Can you give me very brief idea?

http://stackoverflow.com/comment/43032708
has text: Especially since you already checked that front was null just before, you called for it :)
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27282119
type: Comment

http://stackoverflow.com/q/27287612
has comment: http://stackoverflow.com/comment/43042016
has comment: http://stackoverflow.com/comment/43047583
answer count: 2
has body: In this method I'm suppose to remove all zeroes from a linkedlist but I'm not sure how to access the linked list. I am not allowed to change the parameters of the method but I can change the return. How can I access the linkedlist to modify it? public domino removeZero() { // ****** student exercise return this; } This is the line that calls the method: train = train.removeZero(); The name of the class is domino. Here is the complete program http://pastebin.com/EwNJj9mV
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27287883
favorite count: 0
type: UnansweredQuestion
tagged with: linked-list
has comment: http://stackoverflow.com/comment/43042201
has answer: http://stackoverflow.com/a/27287989
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43042034
has comment: http://stackoverflow.com/comment/43042045
has comment: http://stackoverflow.com/comment/43042090
score: -1
has title: Access a linked list through a method

http://stackoverflow.com/q/27304504
upvote count: 7
type: Question
possible better answer: http://stackoverflow.com/a/27324562
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27324562
accepted answer: http://stackoverflow.com/a/27344070
tagged with: spring-data-rest
answer count: 2
downvote count: 0
score: 7
favorite count: 0
tagged with: rest
tagged with: spring
has answer: http://stackoverflow.com/a/27344070
type: AnsweredQuestion
has title: How to create and connect related resources using Spring Data REST repositories?
has body: I have a simple proof-of-concept demo using Spring Data REST / RestRepository architecture. My two entities are : @Entity @org.hibernate.annotations.Proxy(lazy=false) @Table(name="Address") public class Address implements Serializable { public Address() {} @Column(name="ID", nullable=false, unique=true) @Id @GeneratedValue(generator="CUSTOMER_ADDRESSES_ADDRESS_ID_GENERATOR") @org.hibernate.annotations.GenericGenerator(name="CUSTOMER_ADDRESSES_ADDRESS_ID_GENERATOR", strategy="native") private int ID; @RestResource(exported = false) @ManyToOne(targetEntity=domain.location.CityStateZip.class, fetch=FetchType.LAZY) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.PERSIST}) @JoinColumns({ @JoinColumn(name="CityStateZipID", referencedColumnName="ID", nullable=false) }) private domain.location.CityStateZip cityStateZip; @Column(name="StreetNo", nullable=true) private int streetNo; @Column(name="StreetName", nullable=false, length=40) private String streetName; &lt;setters and getters ommitted&gt; } and for CityStateZip: @Entity public class CityStateZip { public CityStateZip() {} @Column(name="ID", nullable=false, unique=true) @Id @GeneratedValue(generator="CUSTOMER_ADDRESSES_CITYSTATEZIP_ID_GENERATOR") @org.hibernate.annotations.GenericGenerator(name="CUSTOMER_ADDRESSES_CITYSTATEZIP_ID_GENERATOR", strategy="native") private int ID; @Column(name="ZipCode", nullable=false, length=10) private String zipCode; @Column(name="City", nullable=false, length=24) private String city; @Column(name="StateProv", nullable=false, length=2) private String stateProv; } with repositories: @RepositoryRestResource(collectionResourceRel = "addr", path = "addr") public interface AddressRepository extends JpaRepository&lt;Address, Integer&gt; { List&lt;Address&gt; findByStreetNoAndStreetNameStartingWithIgnoreCase(@Param("stNumber") Integer streetNo, @Param("street") String streetName); List&lt;Address&gt; findByStreetNameStartingWithIgnoreCase(@Param("street") String str…

http://stackoverflow.com/comment/42930400
type: QuestionComment
type: Comment
has text: Post your stacktrace
comment on: http://stackoverflow.com/q/27226351
score: 0

http://stackoverflow.com/comment/43019413
type: QuestionComment
comment on: http://stackoverflow.com/q/27275147
has text: strLine and the search term have to be converted to be lowercase and then compared. This way you ignore the case.
score: 0
type: Comment

http://stackoverflow.com/q/27194865
score: 2
answer count: 1
favorite count: 0
upvote count: 2
tagged with: classification
has answer: http://stackoverflow.com/a/27215979
type: AnsweredQuestion
has body: I am trying to use Weka in my project to classify text documents using a Naïve Bayes classifier. I found the two classes below on this site. The first class MyFilteredLearner builds, trains, evaluates, and saves the classifier to disk, this all works fine. The second class MyFilteredClassifier loads the single text string from a text file and makes it into an instance successfully. It also restores the classifier from disk. What it fails to do is to classify the instance with the method classify(), it instead returns the exception message ‘No output instance format defined’. I have spend ages searching for an answer, have tried installing the developer and stable versions of Weka, but still get the same issue. Does anybody know what is incorrect in the code or needs to be added/done differently? The file details and code are as follows: ARFF file (spam.ARFF) used to train the classifier: @relation sms_test @attribute spamclass {spam,ham} @attribute text String @data ham,'Go until jurong point, crazy.. Available only in bugis n great world la e buffet...Cine there got amore wat...' etc…………………………………………………………………… Single line text file (toClassify.txt) for the new instance: this is spam or not, who knows? Code of MyFilteredLearner: public class MyFilteredLearner { Instances trainData; StringToWordVector filter; FilteredClassifier classifier; public void loadDataset(String fileName) { try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); ArffReader arff = new ArffReader(reader); trainData = arff.getData(); System.out.println("===== Loaded dataset: " + fileName + " ====="); reader.close(); } catch (IOException e) { System.out.println("Problem found when reading: " + fileName); } } public void learn() { try { trainData.setClassIndex(0); classifier = new FilteredClassifier(); filter = new StringToWordVector(); filter.setAttributeIndices("last"); classifier.setFilter(filter); classifier.setClassifier(new NaiveBayes()); classifier.buildClassifier(trainDa…
tagged with: java
accepted answer: http://stackoverflow.com/a/27215979
has title: Error while trying to classify new instance using Java with Weka-No output instance format defined
type: Question
downvote count: 0
tagged with: weka

http://stackoverflow.com/comment/42913177
comment on: http://stackoverflow.com/q/27216573
has text: consider writing `int[] jatin` instead of `int jatin[]`, brackets at the variable is usually discouraged: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.8.3.2-array-declarations
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27236222
favorite count: 0
type: Question
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/27269305
has body: I am using an interface from a third party and they have a peculiar (to my mind at least) XML format for request/response and notification. The XML needs to look like this: 3.1 <Request_Name> Request ID ... </Request_Name> The Request tag could also be one of Notification or Response. All Messages will have only one of these three. Request and Response both have RequestID. Response has ReturnValue as well. Notifications have a Session. In order to prevent duplication I wanted to create an abstract class for each of these three types, and it almost works! What I can marshall to and unmarshall from looks like this: 3.1 <Request_Name> Request ID ... </Request_Name> Note the missing Request tag! Same for Notification and Response. All information is there but these wrapper tags are killing me! The Question: Can I put an XML tag on the abstract class? Or do I need make it non-abstract and create another top-level abstract class as the "real" abstract base class? I haven't much experience with JAXB, so I'm hoping there is a simple way to do this. I tried making the request field on message an XMLElement instead but that only changes the Request_Name tag to Request and adds a type specification. My code is basically as below, with setters and CTORs taken out for brevity. The base Message class: @XmlRootElement(name = "Message") public class Message { @XmlElement(required = true, name = "Version") private String version; private Request request; private Response response; private Notification notification; @XmlElementRef(required = false) public Request getRequest() { return request; } @XmlElementRef(required = false) public Response getResponse() { return response; } @XmlElementRef(required = false) public Notification getNotification() { return notification; } } Abstract Request class. Similar for Notification and Response: @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL) public abstract class Request { private String requestId; @XmlElement(name = "RequestID", required = tr…
tagged with: java
tagged with: jaxb
upvote count: 1
has title: JAXB: Place XML tag on abstract classes
downvote count: 0
tagged with: inheritance
has answer: http://stackoverflow.com/a/27269305
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/42953311
score: 1
comment on: http://stackoverflow.com/q/27238307
has text: `Scanner` has a [`useDelimiter`](https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#useDelimiter(java.util.regex.Pattern)) method. It also has a [`nextLine`](https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextLine()) method. In short, read [the documentation](https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/104981547
has text: @icza Ooh I see... That way i avoid reading each byte thanks a lot
type: Comment
comment on: http://stackoverflow.com/a/27265689
score: 0
type: AnswerComment

http://stackoverflow.com/q/27294040
has comment: http://stackoverflow.com/comment/43055907
favorite count: 0
type: Question
upvote count: 2
tagged with: private-network
linked to: http://stackoverflow.com/q/10269249
has comment: http://stackoverflow.com/comment/43062349
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43056980
tagged with: dspace
has comment: http://stackoverflow.com/comment/43064164
has answer: http://stackoverflow.com/a/27300653
has title: DSpace: Java mail doesn't work in the company's network
downvote count: 0
type: UnansweredQuestion
has body: I set up Dspace to send e-mail using my company's e-mail server, DSpace uses javax.mail to do this. When I try send outside of my company's network the e-mail is sent successfully, but in the company's network the email is not sent. Follows the shown error message: Error: javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? (1) There's no proxy on the way (2) I tryed to send using gmail, but I've got same scenario (3) The only related thread that I've found were solved with proxy settings, but because (1) that is not a solution (Java mail doesn't work in the company's network) (4) The used door (587) is the same configured in Thunderbird which works great both inside and outside my company's network. WHAT A MISTERY!!! O.O If some one could help, that would be great! Thanks a lot!
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/43064248
score: 2
has comment: http://stackoverflow.com/comment/43057157
has comment: http://stackoverflow.com/comment/43063317

http://stackoverflow.com/q/27207523
has body: Hi I need to convert a SortedSet> to an array of integers but not sure how to do it. This is the SortedSet I want to convert: private SortedSet&lt;List&lt;Integer&gt;&gt; coords; and this is the get method I am using which shows as an error: public List&lt;Integer&gt; getCoords() { return Arrays.asList(coords); } If I want to do something like this, would I have to go through the entire SortedList and make a new int[] array and just put all the values inside it? Or is there a much nicer way? I thought Arrays.asList could do this but now I am confused! Thanks for reading!
has comment: http://stackoverflow.com/comment/42896927
tagged with: sortedset
possible better answer: http://stackoverflow.com/a/27207579
has title: Arrays.asList not flattening in Java, what should I use instead?
has answer: http://stackoverflow.com/a/27207579
has comment: http://stackoverflow.com/comment/42896960
answer count: 3
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/42896935
favorite count: 0
has answer: http://stackoverflow.com/a/27207566
has comment: http://stackoverflow.com/comment/42896940
tagged with: integer
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42896937
has comment: http://stackoverflow.com/comment/42896930
has comment: http://stackoverflow.com/comment/42897264
type: Question
has answer: http://stackoverflow.com/a/27207567
accepted answer: http://stackoverflow.com/a/27207567
score: 1
tagged with: java

http://stackoverflow.com/comment/43064438
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27298366
has text: Select classes from this subpackage and copy. Don't know another solution ;-)
type: AnswerComment

http://stackoverflow.com/q/27181179
score: 0
has comment: http://stackoverflow.com/comment/42873657
tagged with: jar
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42874055
tagged with: spring
answer count: 0
has body: I have a jar locator1.1. On extracting the jar I can see the lib folder containing all the required jars. I also have the applicationContext-locator.xml in the locator1.1 folder. The Manifest file shows Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: abc Build-Jdk: 1.7.0_55 Main-Class: com.abc.Locator Class-Path: ./ lib/activemq-all-5.8.0.jar lib/activemq-amqp-5.8.0.jar lib/activemq-broker-5.8.0.jar lib/activemq-openwire-legacy-5.8.0.jar lib/proton-jms-0.3.0-fuse-2.jar lib/proton-0.3.0-fuse-2.jar lib/proto.... lib/spring-core-3.2...... .4.RELEASE.jar lib/commons-logging-1.1.1.jar lib/spring-jmx-2.0.8.jar lib/spring-context-3.2.4.RELEASE.jar lib/spring-expression-3.2.4.REL But on running the jar using java -jar locator1.1.jar. I am getting the following error. But all the required spring jars are there in the lib Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more
tagged with: maven
linked to: http://stackoverflow.com/q/11758594
type: Question
has title: How to make the spring maven project jar containing external jars work
tagged with: java

http://stackoverflow.com/comment/43117577
comment on: http://stackoverflow.com/q/27258908
score: 0
type: Comment
type: QuestionComment
has text: Are you sure that such property exists in your servlet.properties? Personal advise: make a as-small-as-possible testing app and make sure it works. It is also not very advisable to touch the web-app resources (WEB-INF/servlet.properties) for your supposed-to-be-webapp-neutral parent app context (though I think it is not the source of problem)

http://stackoverflow.com/q/27258591
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: graphics
answer count: 1
linked to: http://stackoverflow.com/q/11068535
has body: In my program, a the graphics on my screen are supposed to move across the screen. I have a loop that calls the draw function(the draw function is display.draw()), but whenever the amount of times the loop runs is greater than one, the display doesn't update after each time like it should. Instead, it waits until the loop finishes to update the display. below is the refreshing function that only apparently runs at the end. public void refresh() { myPanel.removeAll(); myPanel.add(display.draw()); myPanel.validate(); myPanel.repaint(); } And here's the loop. I added a 1 second sleep after each iteration to make sure it just wasn't moving faster than I could see. for(int i = 0; i &lt; 2; i++) { myGraphics.rearrange(); this.refresh(); try { Thread.sleep(1000); } catch(InterruptedException e) { } } myGraphics.rearrange() simply changes the values of the variables which the drawing function uses, changing the x and y variables for the positions of all the objects. What is happening that it's not updating?
linked to: http://stackoverflow.com/q/18210702
linked to: http://stackoverflow.com/q/23393664
score: 0
has comment: http://stackoverflow.com/comment/42990721
has answer: http://stackoverflow.com/a/27258647
has title: Java graphics not updating correctly
tagged with: drawing

http://stackoverflow.com/comment/43101498
type: Comment
comment on: http://stackoverflow.com/a/27307113
has text: The oracle option also didn't work, it just worked in eclipse again but not in the actual runnable jar file
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42911350
type: Comment
type: QuestionComment
has text: Try this: View tab = d.findViewById(R.id.tab1act); NumberPicker np = (NumberPicker) tab.findViewById(R.id.numberPicker);and see if tab is null or np. Notice that you are including the same layout (tab1act.xml) twice (you call the same xml file).
score: 0
comment on: http://stackoverflow.com/q/27215433

http://stackoverflow.com/comment/60002459
has text: Ok, now it's much more clear :-) Thanks, solved with your suggestion!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27309206

http://stackoverflow.com/a/27217092
has body: I would recommend you to use a factory method in this case. Write a static method called something like public static IdentifiedConnection openConnection(String serverAddress, int port) throws IOException { ... } This allows for better control of the creation and avoids the potential problems with leaking references to uninitialized objects. Another approach would be to take a Supplier&lt;UUID&gt; as argument to the constructor, as follows: abstract class IdentifiedConnection extends Connection { private UUID uuid; public IdentifiedConnection(String serverAddress, int port, Supplier&lt;UUID&gt; uuidSupplier) throws IOException { super(serverAddress, port); this.uuid = uuidSupplier.get(); } } and in a subclass use it as class SomeConnection extends IdentifiedConnection { public SomeConnection(String serverAddress, int port) throws IOException { super(serverAddress, port, SomeConnection::createUUID); } public static UUID createUUID() { return ...; } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42913990
type: Answer
answers question: http://stackoverflow.com/q/27217050
has comment: http://stackoverflow.com/comment/42914142
score: 2
accepted answer of: http://stackoverflow.com/q/27217050
upvote count: 2
has comment: http://stackoverflow.com/comment/42913937

http://stackoverflow.com/comment/43038583
has text: You may want to split by ", "
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27285438
type: AnswerComment

http://stackoverflow.com/comment/43035847
comment on: http://stackoverflow.com/q/27283742
type: QuestionComment
score: 0
has text: Are you looking to scale down just the dimensions of the image to fit on screen or are you wanting to reduce the file size and create a low-res version of the image?
type: Comment

processing
tags question: http://stackoverflow.com/q/27295087
type: Tag
tags question: http://stackoverflow.com/q/27202449
tags question: http://stackoverflow.com/q/27176878
tags question: http://stackoverflow.com/q/27269559
tags question: http://stackoverflow.com/q/27304520
tags question: http://stackoverflow.com/q/27205149
tags question: http://stackoverflow.com/q/27296494
tags question: http://stackoverflow.com/q/27179744
tag name: processing

http://stackoverflow.com/q/27297171
type: Question
tagged with: countdownlatch
has body: In Java once a CountdownLatch reaches its state = 0, it cannot change it, so it remains open forever. I wonder why implementors don't allow to reuse CountDownLatch?
has answer: http://stackoverflow.com/a/56694996
downvote count: 0
has comment: http://stackoverflow.com/comment/43058653
has comment: http://stackoverflow.com/comment/43058894
answer count: 3
has answer: http://stackoverflow.com/a/27297414
tagged with: synchronization
favorite count: 0
has answer: http://stackoverflow.com/a/27297525
has title: Why CountDownLatch in java cannot change its state again?
possible better answer: http://stackoverflow.com/a/27297414
tagged with: multithreading
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27297525

http://stackoverflow.com/a/27306457
answers question: http://stackoverflow.com/q/27306327
score: 0
has body: Well, first of all, you should learn how to close an inputStream, it's not hard at all: inputStream.close(); That said, to use InputStreams or a byte[] really depends on your application. A one-fits-all solution is certainly to use inputStreams (that way, you'll decide later wether to load it fully or on chunks) but if you will always use the read data as a whole (for example, reading bitmaps), there's nothing wrong with your function being self-contained and returning the whole byte array.
type: Answer

http://stackoverflow.com/comment/43061418
type: Comment
has text: There are comments from other users on the SourceForge site complaining of slowness. Possibly either the library is inefficient, or the device communications is inherently slow.
score: 1
comment on: http://stackoverflow.com/q/27298466
type: QuestionComment

http://stackoverflow.com/q/27211639
tagged with: enums
linked to: http://stackoverflow.com/q/6391777
has answer: http://stackoverflow.com/a/27211684
has comment: http://stackoverflow.com/comment/42904311
downvote count: 0
answer count: 1
has body: In my application I have an enum like that: public enum EAnimals { dogs(1, "white", "big"), cats(2, "black", "small"); private Integer animalId; private String color; private String size; EAnimals(Integer animalId, String color, String size) { this.animalId = animalId; this.color = color; this.size = size; } public Integer getAnimalId() { return animalId; } public String getColor() { return color; } public String getSize() { return size; } What I`m trying to achieve here is to get animal ID (1,2,..) from Managed Bean using switch case: public AnimalsId getDynamicAnimalId() { switch (animalId) { case EAnimals.dogs.getAnimalId(): size ="small"; return size; case EAnimals.cats.getAnimalId(): size = "big"; return size; default: return "Error"; } } In switch statement "case EAnimals.dogs.getAnimalId():" doesn't work for me and I can`t figure out how to do it. EDIT: Corrected few mistakes which I made , when I was rewriting my code from IDE to stackoverflow. I don`t have this errors in my actual code.
duplicate of: http://stackoverflow.com/q/6391777
favorite count: 0
has comment: http://stackoverflow.com/comment/42904275
tagged with: managed-bean
has title: How to use enum with switch statement?
has comment: http://stackoverflow.com/comment/42915255
accepted answer: http://stackoverflow.com/a/27211684
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42904288
upvote count: 1
tagged with: switch-statement
type: Question

http://stackoverflow.com/comment/42883686
comment on: http://stackoverflow.com/q/27199423
score: 0
type: QuestionComment
type: Comment
has text: Also @mKorbel my question is how can I hop from a JFrame (with a button for example) and jump into the java class (e.g. something.java). Hope that makes it clear.

http://stackoverflow.com/q/27209504
duplicate of: http://stackoverflow.com/q/8421103
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42901036
answer count: 0
score: 1
tagged with: java
has body: http://docs.oracle.com/javase/7/docs/api/java/lang/System.html This page is a good example of it. We have three different styles on this one page: Fully named camel case (e.g. clearProperty) Acronym-style (or C-style) abbreviation (e.g. gc for garbage collector) No camel case or _ (e.g. println or arraycopy) ' What gives?
type: Question
tagged with: naming-conventions
has comment: http://stackoverflow.com/comment/42900837
upvote count: 2
has comment: http://stackoverflow.com/comment/42900834
downvote count: 1
linked to: http://stackoverflow.com/q/8421103
favorite count: 0
has title: Naming Convention Used by Java - Why the Inconsistency?

http://stackoverflow.com/a/27270384
upvote count: 2
has comment: http://stackoverflow.com/comment/43010872
has comment: http://stackoverflow.com/comment/43010948
type: Answer
score: 2
downvote count: 0
has body: We can point only one version of java in JAVA_HOME so create a batch file with set JAVA_HOME="path-to-java-home" set path="path-to-java-home\bin" &lt;your-application&gt;.exe or &lt;your-application&gt;.sh above lines are used to overwrite existing system environment JAVA_HOME variable.
answers question: http://stackoverflow.com/q/27269955

http://stackoverflow.com/q/27227539
tagged with: arrays
has body: I'm fairly new to Java, but here's my problem. I've created an array method that holds a block of 10 integers, which the user will input. They will enter -1 when they are finished, however the -1 will be stored. Here's my code for that: public static int [] inputGrades() { Scanner kb = new Scanner (System.in); int [] iGrades = new int [10]; System.out.print("\nInput test scores, enter -1 when you're finished.\n"); for (int i =0; i&lt;iGrades.length;i++) { if (iGrades[i]&gt;=-1) { iGrades[i]=kb.nextInt(); break; } } return iGrades; } After that I'm to create a method that is supposed to count how many number values there are up to the -1. So say, the user entered 5 numbers and -1, I'd display 6. Here's what I have for that: public static int countArrayElements(int[] array) { int iCount = 0; for (int i = 0; i &lt; array.length; i ++) { if (array[i] != 0) { iCount ++; } System.out.print ("\nThere are " + iCount + "numbers in the array."); } return iCount; } All it's returning is 10 ones though. A nudge in the right direction would be greatly appreciated, thanks.
score: 0
has title: How do I create a method that displays how many elements are in the array?
has comment: http://stackoverflow.com/comment/42933390
accepted answer: http://stackoverflow.com/a/27227767
answer count: 4
has answer: http://stackoverflow.com/a/27227638
has comment: http://stackoverflow.com/comment/42932521
has answer: http://stackoverflow.com/a/27227728
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27227731
has answer: http://stackoverflow.com/a/27227767
type: Question
has answer: http://stackoverflow.com/a/27227731

http://stackoverflow.com/q/27234680
possible better answer: http://stackoverflow.com/a/27234738
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27234738
has answer: http://stackoverflow.com/a/27234767
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42945962
has comment: http://stackoverflow.com/comment/42946079
type: Question
has comment: http://stackoverflow.com/comment/42945946
has answer: http://stackoverflow.com/a/27234833
tagged with: algorithm
downvote count: 0
has comment: http://stackoverflow.com/comment/42946349
has body: I have a number , let say 4 which is in binary represented as 100 , what i will like to achieve is to complement the number i.e. replace 1 by 0 and 0 by 1 . I can achieve it like this public class Foo { public static void main(String[] args) { String binaryString = Integer.toBinaryString(4); StringBuilder out = new StringBuilder(); char[] chars = binaryString.toCharArray(); char x; for (char ch : chars) { if (ch == '1') { x = '0'; } else { x = '1'; } out.append(x); } System.out.println(Integer.parseInt(out.toString(), 2)); } } What is the most efficient way to achieve the same result in terms of time complexity? Please note that input can be very big numbers and we need to take care of Integer overflow. Updated negating a number like ~n will give wrong result , for e.g. System.out.println(~4); outputs -5 , expected 3
accepted answer: http://stackoverflow.com/a/27234767
has comment: http://stackoverflow.com/comment/42946056
has answer: http://stackoverflow.com/a/27234963
has comment: http://stackoverflow.com/comment/42945966
answer count: 4
has comment: http://stackoverflow.com/comment/42946023
favorite count: 0
upvote count: 1
has title: Binary complement 0 to 1, 1 to 0

http://stackoverflow.com/q/27216573
tagged with: eclipse
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42914060
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42913177
has answer: http://stackoverflow.com/a/27216846
has comment: http://stackoverflow.com/comment/42912918
has answer: http://stackoverflow.com/a/27216624
type: Question
has title: Enhance loop in java not working in IDE. how to make it work?
tagged with: java
has body: I am currently learning java in Eclipse IDE. and I used enhanced loop in a simple program and it is showing error. here is the code public final class enhancedFor { public static void main(String args[]){ int jatin[]={4,5,6,7,8}; int total=0; for (int x: jatin){ total+=x; } System.out.println(total); } } It is showing error where I have declared the for loop. " for each is only available if source level is 1.5 or greater."

http://stackoverflow.com/q/27290742
has title: Using variable to affect my position
answer count: 5
has answer: http://stackoverflow.com/a/27290953
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43047624
has answer: http://stackoverflow.com/a/27290946
tagged with: java
has answer: http://stackoverflow.com/a/27290916
type: Question
possible better answer: http://stackoverflow.com/a/27290953
score: 0
has answer: http://stackoverflow.com/a/27290900
accepted answer: http://stackoverflow.com/a/27290900
has answer: http://stackoverflow.com/a/27290909
has body: I am making a unit move in my game by using simple method like: getting the position north of this position. But I want different units with different speeds and I am a bit confused as how to do this. Position class: public class Position { private int x; private int y; public Position(int x, int y) { this.x = x; this.y = y; } public int getX() { return this.x; } public int getY() { return this.y; } public Position getPosToNorth() { Position position = new Position(getX(), getY() - 1); return position; } } And then in my other class I got this move method: public void move() { if(this.direction == "North") { setPosition(getPosition().getPosToNorth()); } } If I have a variable, let's say: speed = 10; how can I use this to affect how much my unit will move? Can I somehow get the speed variable from my other class into my Position class so instead of taking getY() - 1 it takes getY() - speed? I tried but didn't get it to work... thanks in advance.

http://stackoverflow.com/q/27178016
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/27178307
score: 0
accepted answer: http://stackoverflow.com/a/27178307
has body: I'm using Jersey to create a RESTful API in where there is implemented an ExceptionMapper class to catch all errors. public class ExceptionFilter implements ExceptionMapper&lt;Throwable&gt;{ public Response toResponse(Throwable thrownable) { if(thrownable instanceof PSQLExeption) { System.out.print("Error: " + ((PSQLExeption)thrownable).getQuery()); } } } Is there a way to get the query string from the exception? Or maybe implement PreparedStatement and create a method in it to get the query string?
answer count: 1
has comment: http://stackoverflow.com/comment/42844816
has title: Is there a way to get the PreparedStatement query from a PSQLException?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27305881
has body: I understand that i can use @Autowired to inject a bean in a class. Now i get curious:: I don't want to have a private attribute with @Autowired. I have a function in my controller and i want to inject bean as parameters directely in the function. I got an error saying that file and token are not beans. Is there a way to autowire or inject just the beans i need as parameters ? @Controller public class SpinalToolboxWebController { /*@Autowired private FileOperationsService fileOperationsService; @Autowired private Comparator&lt;String&gt; comparator; @Autowired private ServerResponse serverResponse; @Autowired private SoftwareCommunicationService softwareCommunicationService; @Autowired private StringBuffer stringBuffer; @Autowired private UserEnvironmentService userEnvironmentService;*/ @Autowired @RequestMapping(value="/upload", method = RequestMethod.POST, produces="application/json") public @ResponseBody ServerResponse handleUploadedFiles(@RequestParam(value = "file") MultipartFile file, @RequestParam(value="token") String token, SoftwareCommunicationService softwareCommunicationService, FileOperationsService fileOperationsService, ServerResponse serverResponse )throws IOException { System.out.println("Passing throught upload controller"); if(!fileOperationsService.isUploadedFileExtensionAllowed(file.getOriginalFilename())) { serverResponse.setUndefinedResponse(); return serverResponse; } if(fileOperationsService.uploadFile(file, token)){ serverResponse.setResponse(file, softwareCommunicationService.generateRawAndHeader(file)); } else{ serverResponse.setUndefinedResponse(); } return serverResponse; } }
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43074400
has answer: http://stackoverflow.com/a/27306010
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27306010
upvote count: 2
tagged with: spring
has title: Inject specific beans as parameters in function with multiple parameters
tagged with: spring-mvc
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/27246217
score: 1
has body: For a 100% safe solution you should analyze the expressions with a computer algebra system to see whether there are mathemiatically equal. But that's not so easy. A pragmatic approach that can be to test whether two expressions are similar: Check whether they have the same variables Compare their outputs for a number of different inputs, see if the outputs are equal You can store the variable list and outputs for a predefined set of inputs as a "hash" for the expression. This hash does not give a guarentee that two expresions are equal, but you could present expressions with the same hash to the user asking if this new rule is equal to one of these similar ones.
upvote count: 1
answers question: http://stackoverflow.com/q/27245233
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43081616
type: AnswerComment
has text: Perhaps FTL takes `groupKey` as a String key and threw this exception. Finally, after I changed the type of `groups` to `Map<Integer, List<String>>`, it worked.
comment on: http://stackoverflow.com/a/27264696
type: Comment
score: 1

http://stackoverflow.com/comment/42824986
type: AnswerComment
has text: how to pass elements from JAVA.util.List to com.util.text.List So that i could display the elements int the table?
type: Comment
comment on: http://stackoverflow.com/a/27165954
score: 0

http://stackoverflow.com/comment/43005321
type: AnswerComment
comment on: http://stackoverflow.com/a/27253077
score: 0
type: Comment
has text: And that's just the problem :-\

http://stackoverflow.com/comment/43015238
type: AnswerComment
comment on: http://stackoverflow.com/a/27266545
score: 0
type: Comment
has text: re: 'syntax error at or near "$2"' - I suspect that @oneofakind was trying to use `... INTERVAL ?` which, as you said, does not work. Your approach *does* work, for me anyway. (I tested it because I thought that `interval '1' minute * ?` might be a typo that should have been `interval '1 minute' * ?` but in fact both formats work.)

http://stackoverflow.com/comment/43042709
has text: Swift’s Array type also provides an initializer for creating an array of a certain size with all of its values set to a provided default value. You pass this initializer the number of items to be added to the new array (called count) and a default value of the appropriate type (called repeatedValue)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27287872

http://stackoverflow.com/q/27280988
tagged with: c#
duplicate of: http://stackoverflow.com/q/15574977
linked to: http://stackoverflow.com/q/15574977
upvote count: 3
has title: What is the equivalent of Java's generic wildcard ("?") in C#?
has body: In JAVA I can create property like public class MyConverter { private Map&lt;Class&lt;?&gt;, ITypeConverter&lt;?&gt;&gt; converterMap = new HashMap&lt;Class&lt;?&gt;, ITypeConverter&lt;?&gt;&gt;(); ... } how can I do this in C#? What is the equivalent of Java's ? in C#. I tried with T but T is not allowed outide of method or class
downvote count: 1
tagged with: generics
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43030744
duplicate of: http://stackoverflow.com/q/12865701
score: 2
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/12865701
type: Question

svd
type: Tag
tags question: http://stackoverflow.com/q/27233390
tag name: svd

http://stackoverflow.com/q/27295038
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27295149
has comment: http://stackoverflow.com/comment/43054865
tagged with: nullpointerexception
type: Question
tagged with: spring
accepted answer: http://stackoverflow.com/a/27295149
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27295274
tagged with: mysql
has answer: http://stackoverflow.com/a/27295274
has comment: http://stackoverflow.com/comment/43055452
has title: Cannot get all data from database using Hibernate
has comment: http://stackoverflow.com/comment/43055292
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43054812
has body: I'm trying to learn hibernate and spring. The first thing I want to do is get some data from database using Hibernate. What I am trying to do is getting all data from data base but I get null pointer exception. Here is my code; City.java (under com.hopyar.dao package) @Entity @Table(name = "Cities") public class City implements Serializable{ private static final long serialVersionUID = 2637311781100429929L; @Id @GeneratedValue @Column(name = "c_id") int id; @Column(name = "c_name") String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } CityService.java (under com.hopyar.service package) @Service public class CityService { @PersistenceContext private EntityManager em; @Transactional public List&lt;City&gt; getAllCities(){ List&lt;City&gt; result = em.createQuery("Select c From Cities c", City.class) .getResultList(); // This is where I get the exeption. System.out.println(); return result; } } spring-context.xml(under webapp/WEB-INF) &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" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;!-- Enable annotation-based Spring MVC controllers (eg: @Controller annotation) --&gt; &lt;mvc:annotation-driven/&gt; &lt;!-- Classpath sc…

http://stackoverflow.com/comment/42889025
has text: Thanks for your quick reply bud. Another question though, when you say 'get rid of the variable' does that mean the JFrame that i have declared called 'frame.' When i do that it messes up my groupLayout statement since i have added a JFrame into the layout. do i just have to remove it from the layout statement as well then? And what are you referring to as the 'remaining JFrame' Thanks in advance dude
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27202984

http://stackoverflow.com/comment/42846678
comment on: http://stackoverflow.com/q/27178923
type: Comment
type: QuestionComment
has text: Per the API the exception is `"Thrown to indicate that there is an error creating or accessing a Socket."` -- you've got a bug in code that you've not yet shown us.
score: 1

http://stackoverflow.com/a/27271979
score: 0
has body: @Aadithya Gowthaman, try this one in your editor. package com.aamir; import java.util.Scanner; public class Testing1 { public static int[] ageinput(String names[], int q2){ int holderage[] = new int[q2]; for(int x = 0; x&lt;q2;x++) { System.out.println("Please input the age of " + names[x]); Scanner age = new Scanner(System.in); int a1 = age.nextInt(); holderage[x] = a1; } return holderage; } public static String[] nameinput(int q2){ String holdername[] = new String[q2]; for (int x = 0; x&lt;q2;x++) { System.out.println("Please input the name of the person"); Scanner name = new Scanner(System.in); String n1 = name.nextLine(); holdername[x]=n1; } return holdername; } public static void output(String names[], int ages[]){ for(int x = 0; x&lt;names.length;x++){ System.out.println(names[x]+" is "+ages[x]+" years old"); } } public static void main(String[] args) { System.out.println("How many names do you want to input?"); Scanner question = new Scanner(System.in); int q1 = question.nextInt(); String [] namesArray = nameinput(q1); int [] ageArray = ageinput(namesArray, q1); output(namesArray, ageArray); } }
type: Answer
has comment: http://stackoverflow.com/comment/43107546
answers question: http://stackoverflow.com/q/27271688

http://stackoverflow.com/comment/42983383
score: 1
has text: You prefer to create duplicate String Objects? Mhh, ok. Its like prefer using raw types instead of generics.
type: AnswerComment
comment on: http://stackoverflow.com/a/27254436
type: Comment

hadoop-streaming
tags question: http://stackoverflow.com/q/27309200
type: Tag
tag name: hadoop-streaming

http://stackoverflow.com/a/27175004
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27174917
upvote count: 1
has body: Start at l-1 and end >=0. Strings run from index 0 to length-1

http://stackoverflow.com/q/27279240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43181467
has comment: http://stackoverflow.com/comment/43063715
has comment: http://stackoverflow.com/comment/43064437
has body: I have an arraylist of employees and I want to sort them according to their salaries, the program should read from a file each line contains some info of one employee. The problem is that I should use cloneable interface while sorting the array but it just doesn't work with me.. Can anyone help please? Following the sort method: public static ArrayList&lt;Worker&gt; sort(ArrayList&lt;Worker&gt; _workers) throws CloneNotSupportedException{ Worker temp; for (int i=0;i&lt;_workers.size();i++){ if ((_workers.get(i)).compareTo(_workers.get(i+1))==1){ temp=(Worker) _workers.get(i).clone(); _workers.set(i, _workers.get(i+1)); _workers.set(i+1, temp); } } return _workers; } Following the clone method(I repeated it in each of the subclasses): public SalariedEmployee clone() throws CloneNotSupportedException{ SalariedEmployee objClone=new SalariedEmployee(); objClone.setIdNumber(this.getIdNumber()); objClone.setName(this.getName()); objClone.setHours(this.getHours()); objClone.setHourRate(this.getHourRate()); return objClone; }
has answer: http://stackoverflow.com/a/27709064
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43064091
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43052994
has comment: http://stackoverflow.com/comment/43062889
answer count: 1
downvote count: 0
has title: How to read from a file and fill an arraylist?
has comment: http://stackoverflow.com/comment/43027282
has comment: http://stackoverflow.com/comment/43064189
favorite count: 0
tagged with: arraylist
tagged with: file-io
has comment: http://stackoverflow.com/comment/43064360

http://stackoverflow.com/q/27246318
tagged with: java
type: Question
tagged with: openmpi
score: 0
has answer: http://stackoverflow.com/a/27246510
has body: I'm trying to send a number across using MPI, but the data is getting corrupted. I can't figure out why. My code is: import mpi.*; public class test { public static void main(String[] args) throws MPIException{ MPI.Init(args); int rank = MPI.COMM_WORLD.Rank(); int clusterSize = MPI.COMM_WORLD.Size(); int[] send = new int[1]; int[] recv = new int[1]; send[0] = 12387394; if(rank == 0) { MPI.COMM_WORLD.Send(send[0], 0, 1, MPI.INT, 1, 17); } else { MPI.COMM_WORLD.Recv(recv, 0, 1, MPI.INT, 0, 17); System.out.println(recv[0]); } MPI.Finalize(); } } The output I get is 1. Why is that?
answer count: 1
tagged with: mpi
has title: MPI Recv data getting corrupted
accepted answer: http://stackoverflow.com/a/27246510
type: AnsweredQuestion

http://stackoverflow.com/comment/42838238
has text: Solved: "ÄÜÖ" sequence file name in bytes: [-61, -124, -61, -100, -61, -106] and in code [65, -52, -120, 85, -52, -120, 79, -52, -120]
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27173545

http://stackoverflow.com/q/27236088
answer count: 1
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/27236382
score: 1
tagged with: java
type: Question
has body: I need to get the controls to change the values in the layout. But going by the context parameter for the class it does not find the controls declared in xml returning null for each cast made. The class where I am trying to recover this data extends AsyncTask: public class WSCatalogo91 extends AsyncTask&lt;Void, ProgressAux, Boolean&gt; private ProgressBar mProgressBar; private TextView mProgressText; public WSCatalogo91(WSCatalogo91Listener listener) throws SQLException { this.listener = listener; dh = new DatabaseHelper((Activity) listener); confDao = new ConfiguracaoDao(dh.getConnectionSource()); pDao = new ProdutoDao(dh.getConnectionSource()); mProgressBar = (ProgressBar) ((Activity) listener).findViewById(R.id.progressBar); mProgressText = (TextView) ((Activity) listener).findViewById(R.id.progressBarTextView); auxProgresso = new ProgressAux(); } mProgressBar and mProgressText are null, but my context is not null, so that it is being used in lines up perfectly. Follows the xml code which declare the ids. &lt;TextView android:text="@string/progressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:id="@+id/progressBarTextView" android:maxWidth="400dp" android:maxHeight="400dp"/&gt; &lt;ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/progressBar" android:indeterminate="false" android:layout_centerHorizontal="true" android:layout_marginTop="165dp" android:minWidth="300dp" /&gt; This shows that there is a progressBar and progressBarTextView: WSCatalogo91 class: public class WSCatalogo91 extends AsyncTask&lt;Void, ProgressAux, Boolean&gt; { public WSCatalogo91(WSCatalogo91Listener listener) throws SQLException { this.listener = listener; dh = new DatabaseHelper((Activity) listener); confDao = new ConfiguracaoDao(dh.getConnectionSource()); pDao = new Produt…
has title: Get controls in a separate class of the main Activity using AsyncTask

http://stackoverflow.com/comment/43052525
type: QuestionComment
comment on: http://stackoverflow.com/q/27293517
score: 0
has text: a few mistakes (everything is in Oracle tutorial Graphics2D) 1. never to load Image nor File inside intensive paint, 2. use paintComponent or paintIcon is better in this case and 3. coordenadas should be rellative not harcoded value
type: Comment

http://stackoverflow.com/q/27308732
tagged with: numberformatexception
answer count: 2
downvote count: 1
has title: Integer.parseInt() Exception handling concept
linked to: http://stackoverflow.com/q/6115896
has answer: http://stackoverflow.com/a/27308813
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
duplicate of: http://stackoverflow.com/q/6115896
has body: Integer.parseInt() in Java is declared to throw NumberFormatException, and it is a checked exception as I think. I have read somewhere that the checked exceptions should be either caught or thrown on the calling method. But we do not need to do it with NumberFormatException. I am confused. Please help me.
has answer: http://stackoverflow.com/a/27308779

http://stackoverflow.com/a/27234163
answers question: http://stackoverflow.com/q/27233978
upvote count: 4
downvote count: 0
has body: You might want to consider doing this through cypher, and using the MERGE/ON CREATE/ON MATCH keywords. For example, you could do something like this: create (a:Person {name: "Bob"})-[:knows]-&gt;(b:Person {name: "Susan"}); MATCH (a:Person {name: "Bob"}), (b:Person {name: "Susan"}) MERGE (a)-[r:knows]-&gt;(b) ON CREATE SET r.alreadyExisted=false ON MATCH SET r.alreadyExisted=true RETURN r.alreadyExisted; This MATCH/MERGE query that I provide here will return true or false, depending on whether the relationship already existed or not. Also, FWIW it looks like the code you're using to accumulate JSON via StringBuilder objects is likely to be ponderous and error prone. There are plenty of good libraries like Google GSON that will do JSON for you, so you can create JSON objects, arrays, primitives, and so on -- then let the library worry about serializing it properly to a string . This tends to make your code a lot cleaner, easier to maintain, and when you mess something up about your JSON formatting (we all do), it's way easier to find than when you accumulate strings like that.
type: Answer
score: 4

soa
type: Tag
tag name: soa
tags question: http://stackoverflow.com/q/27233559
tags question: http://stackoverflow.com/q/27228426

http://stackoverflow.com/comment/42849823
has text: THanks David, I will try Juned's tactic first and then see about yours
score: 0
comment on: http://stackoverflow.com/a/27180599
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/96862358
type: QuestionComment
has text: Possible duplicate of [Scanner is skipping nextLine() after using next() or nextFoo()?](https://stackoverflow.com/questions/13102045/scanner-is-skipping-nextline-after-using-next-or-nextfoo)
comment on: http://stackoverflow.com/q/27309800
score: 0
type: Comment

http://stackoverflow.com/comment/42831568
type: AnswerComment
comment on: http://stackoverflow.com/a/27169461
has text: In Java6, if `a` and `b` are both `null`, `a.equals(b)` throws a `NPE`. Java 7's `Objects.equals` would return `true` if both are `null`. Also, `Objects.equals` takes two `Object` arguments, so therefore it is applicable to `(Boolean, Boolean)`.
score: 0
type: Comment

http://stackoverflow.com/q/27264613
accepted answer: http://stackoverflow.com/a/27280855
favorite count: 0
possible better answer: http://stackoverflow.com/a/27264696
tagged with: freemarker
score: 8
type: AnsweredQuestion
downvote count: 0
tagged with: java
upvote count: 8
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27264696
has body: I want to iterate a List nested in a Map, the data structure is like: Map&lt;Integer, List&lt;Integer&gt;&gt; groups = new TreeMap&lt;&gt;() // Some code else to put values into groups ... Freemarker template: &lt;#list groups?keys as groupKey&gt; ${groupKey} // It's OK here. &lt;#list groups[groupKey] as item&gt; // Exception threw here, detail message is pasted below ${item} &lt;/#list&gt; &lt;/#list&gt; Detail exception message: FreeMarker template error: For "...[...]" left-hand operand: Expected a sequence or string or something automatically convertible to string (number, date or boolean), but this evaluated to an extended_hash (wrapper: f.t.SimpleHash): ==> groups So, what is the problem? P.S. I have tried groups.get(groupKey) instead of groups[groupKey], it throws a new Exception stack: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String java.lang.String.compareTo(String.java:108) java.util.TreeMap.getEntry(TreeMap.java:346) java.util.TreeMap.get(TreeMap.java:273) freemarker.template.SimpleHash.get(SimpleHash.java:160) freemarker.core.Dot._eval(Dot.java:40) freemarker.core.Expression.eval(Expression.java:76)
has title: Freemarker: iterating nested list in hash
answer count: 2
has answer: http://stackoverflow.com/a/27280855

http://stackoverflow.com/comment/42926793
type: Comment
has text: Did you set up the GATE home correctly?
type: QuestionComment
comment on: http://stackoverflow.com/q/27196194
score: 0

http://stackoverflow.com/comment/43092340
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27295118
has text: this looks good, however there is an error relating to the line: textView.setText (list.get(i));

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/27231276

http://stackoverflow.com/a/27230859
downvote count: 0
has body: You create an object of the class, and then you call validRoom while passing in a value - for example (assuming your class is called MyClass): MyClass myClass = new MyClass(); myClass.validateRoom(5); If some of your code isn't applicable for the other situation, then you should take the applicable part and make a method out of it. Also, if you don't want to have to instantiate a class, then you can make your validation method static and then you can call it like MyClass.validateRoom(5)
answers question: http://stackoverflow.com/q/27230677
type: Answer
has comment: http://stackoverflow.com/comment/42939917
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42938902

http://stackoverflow.com/q/27240399
has title: StackArray Generic class does not work
score: 0
has comment: http://stackoverflow.com/comment/42958048
linked to: http://stackoverflow.com/q/529085
has comment: http://stackoverflow.com/comment/42957352
has body: I am beginner in Java and trying to write a StackArray. I have a tester to test my code. I have run it several times but it does not pass my push method and my search method. Can anyone give me an idea where I am doing wrong? Thank you so much in advance! import java.util.Arrays; import java.util.NoSuchElementException; public class Stack&lt;E&gt; implements StackADT&lt;E&gt;{ private E a[]; private int head, size; public Stack(){ } /*Adds the specified element to the top of the stack. Returns the item added.*/ public E push(E element){ if (a.length == size){ throw new IllegalStateException("Cannot add to full stack"); } // Since the remainder of the stack is to the RIGHT of the stack, // adding a new element pushes the head to the LEFT (+ wrap around) //head = (head - 1 + a.length) % a.length; return a[head++] = element; // return element; } /*Removes and returns the element from the top of the stack*/ public E pop(){ if (empty()){ throw new java.util.EmptyStackException(); } // We need to get a copy of the old head before we advance to the // new head. We want to return the old head, not the new head. E rval = a[head]; // Why DON'T we need to add a.length here like we did in push? head = (head + 1) % a.length; return rval; } /*Returns without removing the element at the top of the stack*/ public E peek(){ if (empty()){ throw new java.util.EmptyStackException(); } return a[head]; } /*Returns true if the stack is empty, false otherwise*/ public boolean empty(){ return size == 0; } /*Returns the 1-based position where an object is on this stack This means If the object o occurs as an item in this stack, this method returns the distance FROM THE TOP OF THE STACK of the occurrence nearest the top of the stack - the topmost item on the stack is considered to be at distance 1.*/ public int search(Object o){ // i is the LOGICAL index for (int i = 0; i &lt; size; i++){ // p is the PHYSICAL index int p = (head + i) % a.length; E e = a[p]; // e == o Are the items (null or no…
type: UnansweredQuestion
tagged with: stack
tagged with: java
type: Question
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/27241325

http://stackoverflow.com/a/27162610
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42821130
has body: Does TCP "catch up" with itself when having latency issues or does it always stay behind once the latency occurs when receiving packets? TCP backs its transmission speed off when it encounters congestion, and attempts to recover by increasing it. If so, is it rather quick to retrieving "live" data again? I don't know what that sentence means, but normally the full speed is eventually restored. How often do the packets of data get out of order with UDP? It depends entirely on the intervening network. There is no single answer to that. NB That's a pretty ordinary link you're citing. UDP stands for 'User Datagram Protocol', not 'Universal Datagram Protocol'. UDP packets do have an inherent send order, but it isn't guaranteed on receive. 'UDP is faster because there is no error-checking for packets' is meaningless. 'Error-checking for packets' implies retransmission, but that only comes into play when there has been packet loss. Comparing lossy UDP speed to lossless TCP speed is meaningless. 'UDP does error checking' is inconsistent with 'UDP is faster because there is no error-checking for packets'. 'TCP requires three packets to set up a socket connection, before any user data can be sent' and 'Once the connection is established data transfer can begin' are incorrect. The client can transmit data along with the third handshake message. The list of TCP header fields is incomplete and the order is incorrect. For TCP, 'message is transmitted to segment boundaries' is meaningless, as there are no messages. 'The connection is terminated by closing of all established virtual circuits' is incorrect. There are no virtual circuits. It's a packet-switching network. Under 'handshake', and several other places, he fails to mention the TCP four-way close protocol. The sentences 'Unlike TCP, UDP is compatible with packet broadcasts (sending to all on local network) and multicasting (send to all subscribers)' and 'UDP is compatible with packet broadcast' are meaningless (and inciden…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42834188
has comment: http://stackoverflow.com/comment/42818936
type: Answer
answers question: http://stackoverflow.com/q/27162348
accepted answer of: http://stackoverflow.com/q/27162348

http://stackoverflow.com/comment/43005226
type: AnswerComment
has text: It's not JUnit, it is because either the provider is not installed or missing from the classpath in that particular runtime coniguration. You can always test by requesting the list of providers from the `Security` class. Check that you are using the correct JRE, I sometimes find out an entirely different JRE is being used.
type: Comment
comment on: http://stackoverflow.com/a/27260575
score: 0

http://stackoverflow.com/q/27311963
tagged with: cpu-cores
has title: Multi-Threading Mechanics?
type: Question
has comment: http://stackoverflow.com/comment/43084728
has comment: http://stackoverflow.com/comment/43085496
has comment: http://stackoverflow.com/comment/43084896
score: 0
has body: I've been experimenting with multithreading and I'm really confused about a test I did. I had been doing research and everything was talking about how multithreading can allow 2 processes to run at the same time. I made this program so 3 different threads would use a for loop to count 1-10, 11-20, and 21-30 so that I could see if they actually ran at the same time how I expected them to. After running the program the output is something like 1 2 3 4 5 6 7 8 9 10 21 22 23 24 25 26 27 28 29 30 11 12 13 14 15 16 17 18 19 20 Basically any variation order of the 3 sets of numbers. So they can all be in order or have 21-30 before 11-20 sometimes. That doesn't seem like it is running at the same time, just running one after another. In the for loop in the println(i); if i change it to println(i + "a"); for 1-10 and b, c for 11-20, 21-30 The output is actually in a random order like I had expected. Like this: 1a 11b 21c 2a 22c 12b 13b 23c 3a Does the program know its doing nothing but counting up and just throw all the numbers on the screen without actually doing it? Or does adding the string at the end make it slow enough for the other threads to sneak in between the operations? I know nothing about this ha. public class Run{ static Runnable updatePosition; static Runnable render; static Runnable checkCollisions; public static void main(String[] args) { // System.out.println(Runtime.getRuntime().availableProcessors()); updatePosition = new Runnable() { @Override public void run() { for (int i = 1; i &lt;= 10; i++) { System.out.println(i); } } }; render = new Runnable() { @Override public void run() { for (int i = 11; i &lt;= 20; i++) { System.out.println(i); } } }; checkCollisions = new Runnable() { @Override public void run() { for (int i = 21; i &lt;= 30; i++) { System.out.println(i); } } }; Thread updatePositionThread = new Thread(updatePosition); Thread renderThread = new Thread(render); Thread checkCollisionsThread = new Thread(checkCollisions); updatePositionThread.s…
answer count: 1
tagged with: multithreading
linked to: http://stackoverflow.com/q/2238272
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27312315
accepted answer: http://stackoverflow.com/a/27312315
tagged with: java

http://stackoverflow.com/a/64903654
score: 0
has body: A couple of corrections in your pojo class , 1) public class ParametersType { @JsonProperty( "parameter" ) protected List<ParameterType> parameter; ...} Corrected POJO: public class Parameters { @JsonProperty( "parameter" ) protected List<Parameter> parameter; ...} Also documentFormat is a string but you have declared the type as class , protected DocumentFormatType documentFormat; Should be : protected String documentFormat;
type: Answer
answers question: http://stackoverflow.com/q/27154631

http://stackoverflow.com/q/27265084
accepted answer: http://stackoverflow.com/a/27265734
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
has body: I am using Spring MVC 3.2.4 to design a web based application. As per the requirement, (using Tiles view) Employee Name as hyperlink will be displayed on left side of the web page and on clicking them, right side will display Employee's details. There are other CRUD operations/forms exists like adding a new employee, deleting them and modify records. Therefore, Employee Name will always be displayed on left side of Tiles view just like a (dynamic) menu. My question is how this List&lt;String&gt; employeeName be managed in Spring so that it should be available throughout a session? Should ModelAttribute, Cookie or anything else be used? As of now, I have implemented this with @ModelAttribute but List&lt;String&gt; employeeName is being appeared in URL, therefore, I am planning of using Cookies. Need your kind advise on what should be the best practice/approach for handling such situations? Thanks in advance
has answer: http://stackoverflow.com/a/27265734
possible better answer: http://stackoverflow.com/a/27265379
has title: Best approach to manage a List<String> variable throughout session in Spring MVC
tagged with: spring
has answer: http://stackoverflow.com/a/27265379

http://stackoverflow.com/comment/42834579
score: 0
type: Comment
type: QuestionComment
has text: I don't have any problem I want a simple code or simple algorithm that read text.txt file and if "8888888" exist in this file then print what is the front of "8888888->"
comment on: http://stackoverflow.com/q/27171904

http://stackoverflow.com/comment/42937116
comment on: http://stackoverflow.com/a/27184713
type: Comment
has text: replacing the SchemaIndexProvider is not enough .. also there's an alternative LabelScanStoreProvider necessary to be able to run neo4j without lucene-index module =( I'll try to implement it ...
score: 0
type: AnswerComment

exception
tags question: http://stackoverflow.com/q/27242483
tags question: http://stackoverflow.com/q/27279025
tags question: http://stackoverflow.com/q/27154974
tags question: http://stackoverflow.com/q/27297654
tags question: http://stackoverflow.com/q/27220763
tags question: http://stackoverflow.com/q/27219780
tags question: http://stackoverflow.com/q/27211744
tags question: http://stackoverflow.com/q/27241619
tags question: http://stackoverflow.com/q/27247599
tags question: http://stackoverflow.com/q/27288653
tags question: http://stackoverflow.com/q/27219957
tags question: http://stackoverflow.com/q/27284223
tags question: http://stackoverflow.com/q/27173966
tags question: http://stackoverflow.com/q/27254889
tags question: http://stackoverflow.com/q/27165004
tags question: http://stackoverflow.com/q/27190774
tags question: http://stackoverflow.com/q/27210814
tags question: http://stackoverflow.com/q/27191495
tags question: http://stackoverflow.com/q/27208072
tags question: http://stackoverflow.com/q/27289274
tags question: http://stackoverflow.com/q/27247531
tags question: http://stackoverflow.com/q/27292366
tags question: http://stackoverflow.com/q/27184042
tags question: http://stackoverflow.com/q/27234223
tags question: http://stackoverflow.com/q/27237317
tags question: http://stackoverflow.com/q/27176156
type: Tag
tags question: http://stackoverflow.com/q/27266249
tags question: http://stackoverflow.com/q/27156443
tags question: http://stackoverflow.com/q/27273581
tags question: http://stackoverflow.com/q/27308074
tags question: http://stackoverflow.com/q/27267041
tags question: http://stackoverflow.com/q/27228067
tags question: http://stackoverflow.com/q/27209746
tags question: http://stackoverflow.com/q/27305339
tags question: http://stackoverflow.com/q/27154012
tags question: http://stackoverflow.com/q/27157206
tags question: http://stackoverflow.com/q/27218470
tags question: http://stackoverflow.com/q/27267107
tags question: http://stackoverflow.com/q/27254389
tags question: http://stackoverflow.com/q/27209760
tags question: http://stackoverflow.com/q/27277008
tags question: http://stackoverflow.com/q/27274418
tags question: http://stackoverflow.com/q/27280928
tags question: http://stackoverflow.com/q/27187745
tags question: http://stackoverflow.com/q/27260910
tags question: http://stackoverflow.com/q/27297752
tags question: http://stackoverflow.com/q/27259585
tags question: http://stackoverflow.com/q/27223946
tags question: http://stackoverflow.com/q/27227964
tags question: http://stackoverflow.com/q/27312175
tag name: exception
tags question: http://stackoverflow.com/q/27203646
tags question: http://stackoverflow.com/q/27240202
tags question: http://stackoverflow.com/q/27217917
tags question: http://stackoverflow.com/q/27242539
tags question: http://stackoverflow.com/q/27310579
tags question: http://stackoverflow.com/q/27208218
tags question: http://stackoverflow.com/q/27205424
tags question: http://stackoverflow.com/q/27270657
tags question: http://stackoverflow.com/q/27305779
tags question: http://stackoverflow.com/q/27236853
tags question: http://stackoverflow.com/q/27240803
tags question: http://stackoverflow.com/q/27211606
tags question: http://stackoverflow.com/q/27168421

http://stackoverflow.com/comment/42920309
type: QuestionComment
comment on: http://stackoverflow.com/q/27220597
has text: Nothing. I click on the action bar icon that should launch the camera app and nothing happens. On my physical device it launches the built in camera app no problem.
score: 0
type: Comment

http://stackoverflow.com/q/27193309
linked to: http://stackoverflow.com/q/3959206
tagged with: java
has body: I want do a log method to help with variables and their values, I want to do something like: void log(Object object) { android.util.Log.d("TAG", "The variable " + &lt;One way to get object name here&gt; + " has the value " + object); } and when I run something like this: int hits = 12; Object obj = null; String s = "nhe nhe nhem"; log(hits); log(obje); log(s); I want to get the following output: The variable hits has the value 12 The variable obj has the value null The variable s has the value nhe nhe nhem I just need one way to get the variable name, I don't know anything similar in java, but if anyone knows one way to do it.... EDIT I did an example in python that works fine: myVariableWithSomeFooName = 32 for key, value in list(locals().iteritems()): if id(value) == id(myVariableWithSomeFooName): itemName = key print "The " + str(itemName) + " has the value " + str(myVariableWithSomeFooName)
linked to: http://stackoverflow.com/q/8338633
type: Question
has title: Android get variable name
has comment: http://stackoverflow.com/comment/42874119
tagged with: variables
has answer: http://stackoverflow.com/a/27193682
answer count: 2
has answer: http://stackoverflow.com/a/27194546
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42872918
has comment: http://stackoverflow.com/comment/68066381
score: 2

http://stackoverflow.com/comment/42986263
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27256239
has text: thanks, i noticed that problem and have fixed it in the text, however i dont see why that condition isnt being met? not even for 1? I cant seem to see the problem in the code, I have my suspicions its to do with the triangleNumbers function, but im unsure of what exactly

http://stackoverflow.com/comment/43012571
has text: I think my problem is different. My program is working fine if I manually create table and then insert data without setting hbm2ddl.auto to create. The issue is that hibernate is not creating table automatically.
comment on: http://stackoverflow.com/q/27269059
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27202679
has body: To look at it another way, say your class with an abstract method did not have to be abstract, and you were allowed to instantiate it, what would the compiler to if you called that method? - there would be no actual code to run. That is why we declare the class abstract - we are marking it as 'not yet ready to use', and later create a 'concrete' subclass with zero abstract methods which can actually be used. class Horse { // &lt;== note not actually allowed... public abstract int getNeighCount(); } Horse horse = new Horse(); horse.getNeighCount(); // &lt;== what would happen here??
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27202640
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27202640
type: Answer
has comment: http://stackoverflow.com/comment/42888348
score: 2
downvote count: 0

http://stackoverflow.com/comment/43032446
score: 0
type: Comment
type: QuestionComment
has text: i have gone thru numerous tutorials but didnt find a direct reference to this technique. i think its a technique enabled by the use of struts 2 framework because even stru2 showcase examples have this kinda configurations for their examples
comment on: http://stackoverflow.com/q/27281760

http://stackoverflow.com/a/27209961
type: Answer
downvote count: 0
score: 1
has body: A 2D Array isn't completely necessary (I haven't used them much) but they can be beneficial compared to keeping a 1D array. For using a 1D array, it would work like this (say the user inputted 5 for the board size). You're going to need to keep up with the size (or width &amp; height) int[] myArray = new int[size * size]; // or if specified, it can be new int[width * height] Then, to find a way to get to the point, is do this: int x = 3; int y = 4; int point = myArray[x + y * width]; What myArray[x + y * width] will do is give you the point in the array at the provided x and y, while the top-left corner is (0, 0): [ O O O O O O O O O O O O O O O O O O O O O O O X O ] O O O O O O O O O O O O O O O O O O O O O O O X O Then, if x = 2 &amp; y = 0 we'll have: [ O O X O O O O O O O O O O O O O O O O O O O O O O ] O O X O O O O O O O O O O O O O O O O O O O O O O This works because the array loops according to the width. So if x was 5 and y was 0, it would look like: [ O O O O O X O O O O O O O O O O O O O O O O O O O ] O O O O O X O O O O O O O O O O O O O O O O O O O
upvote count: 1
answers question: http://stackoverflow.com/q/27209271

http://stackoverflow.com/comment/42943588
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27233399
has text: Can you provide more details like how `cmsSessionFactory` session factory is configured?

jersey
tags question: http://stackoverflow.com/q/27241550
tags question: http://stackoverflow.com/q/27169947
tags question: http://stackoverflow.com/q/27169510
tags question: http://stackoverflow.com/q/27284463
tags question: http://stackoverflow.com/q/27171809
tags question: http://stackoverflow.com/q/27191213
tags question: http://stackoverflow.com/q/27286257
tags question: http://stackoverflow.com/q/27303349
tags question: http://stackoverflow.com/q/27211892
tags question: http://stackoverflow.com/q/27203278
tags question: http://stackoverflow.com/q/27197211
tags question: http://stackoverflow.com/q/27269414
tags question: http://stackoverflow.com/q/27284046
tags question: http://stackoverflow.com/q/27215328
tags question: http://stackoverflow.com/q/27181507
tags question: http://stackoverflow.com/q/27160440
tags question: http://stackoverflow.com/q/27174409
tags question: http://stackoverflow.com/q/27167816
tags question: http://stackoverflow.com/q/27163925
tags question: http://stackoverflow.com/q/27292246
tags question: http://stackoverflow.com/q/27247253
tags question: http://stackoverflow.com/q/27188753
tags question: http://stackoverflow.com/q/27233554
tag name: jersey
tags question: http://stackoverflow.com/q/27226615
tags question: http://stackoverflow.com/q/27186393
tags question: http://stackoverflow.com/q/27264552
tags question: http://stackoverflow.com/q/27154884
tags question: http://stackoverflow.com/q/27197587
tags question: http://stackoverflow.com/q/27156671
type: Tag
tags question: http://stackoverflow.com/q/27178016

http://stackoverflow.com/comment/43024002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27168618
score: 0
has text: Can you please check this if it helps ? http://stackoverflow.com/questions/21764419/grails-upload-file-no-signature-for-method-getfile and this http://stackoverflow.com/questions/25736028/how-do-i-get-a-multipartrequest-out-of-a-servlet3securitycontextholderawarereque

http://stackoverflow.com/a/27217650
has comment: http://stackoverflow.com/comment/110414620
accepted answer of: http://stackoverflow.com/q/27217362
score: 21
has comment: http://stackoverflow.com/comment/110448388
downvote count: 3
upvote count: 24
has comment: http://stackoverflow.com/comment/124301269
has body: FragmentManager fm = getFragmentManager(); MainFragment fragm = (MainFragment)fm.findFragmentById(R.id.main_fragment); fragm.otherList(); This code worked best for me. And seems quite easy
answers question: http://stackoverflow.com/q/27217362
has comment: http://stackoverflow.com/comment/110373072
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/125345745
type: Answer

http://stackoverflow.com/a/27263348
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27263290
has body: You can Create a Controller Class for you to diplay the image you want. @Controller public class ImageReadFile{ // this is for mapping your image related path. @RequestMapping(value="/image/*") public void readImage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = request.getServletContext(); //here i uploaded my image in this path // You can set any path here String imagePath = "/home/somefolder/Workspaces/Images/"; String [] fragmentFilename = request.getServletPath().split("/"); //Check if image isn't set if(fragmentFilename.length &lt;= 2){ return; } String filename = fragmentFilename[2]; String requestedImage = "/"+filename; if(filename == null){ response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } File image = new File(imagePath, URLDecoder.decode(requestedImage, "UTF-8")); if(!image.exists()){ response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String contentType = sc.getMimeType(image.getName()); response.reset(); response.setContentType(contentType); response.setHeader("Content-Length", String.valueOf(image.length())); Files.copy(image.toPath(), response.getOutputStream()); } } Servlet Version. try this. @WebServlet("/image/*") public class ImageWriter extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = request.getServletContext(); //here i uploaded my image in this path // You can set any path here String imagePath = "/home/somefolder/Workspaces/Images/"; String [] fragmentFilename = request.getServletPath().split("/"); //Check if image isn't set if(fragmentFilename.length &lt;= 2){ return; } String filename = fragmentFilename[2]; String requestedImage = "/"+filename; …
accepted answer of: http://stackoverflow.com/q/27263290

http://stackoverflow.com/q/27192542
has answer: http://stackoverflow.com/a/27192691
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42870782
score: -1
has comment: http://stackoverflow.com/comment/88255886
has title: How to calculate the shortest steps for this chess
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/27192902
downvote count: 1
has comment: http://stackoverflow.com/comment/42870952
has body: Chinese chess has 8*8=64 cells. And the point is (1, 1), (1, 2)... (8, 8). And the horse walks by diagonal line of two cells from the point it is on. Calculate the shortest step(s) between two points for the horse to walk. For example (1, 1) to (4, 4). Horse goes like this (1, 1) > (2, 3) > (4, 4) 2 steps
type: UnansweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/27192603

http://stackoverflow.com/a/27178872
type: Answer
has comment: http://stackoverflow.com/comment/42846596
answers question: http://stackoverflow.com/q/27178728
has comment: http://stackoverflow.com/comment/42846603
accepted answer of: http://stackoverflow.com/q/27178728
has comment: http://stackoverflow.com/comment/42850058
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42851467
has body: Use AccountAdapter adapter = (AccountAdapter) adapterView.getWrappedAdapter() (doc). update: HeaderViewListAdapter headerViewAdapter = (HeaderViewListAdapter) adapterView.getAdapter(); AccountAdapter adapter = (AccountAdapter) headerViewAdapter.getWrappedAdapter();

http://stackoverflow.com/a/27268044
has body: You can use an iterator : cust.iterator().next().getObjectValue(); That would work only if your list has at least one element.
type: Answer
answers question: http://stackoverflow.com/q/27268027
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43007068
has comment: http://stackoverflow.com/comment/43006985

http://stackoverflow.com/a/27290028
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43054807
has comment: http://stackoverflow.com/comment/43047471
has comment: http://stackoverflow.com/comment/43081083
has comment: http://stackoverflow.com/comment/43086561
has comment: http://stackoverflow.com/comment/43050106
has comment: http://stackoverflow.com/comment/43050793
answers question: http://stackoverflow.com/q/27289931
has body: You will need to enable SMTP access in GMAIL, also you need to allow unsecure clients for your account: https://www.google.com/settings/security/lesssecureapps https://support.google.com/mail/answer/75726 Be aware that the smtp port you want to use is open in your firewall! I suggest to try a connection check from the machine where your code is running with Thunderbird if possible. Then you know if the client is able to connect.
has comment: http://stackoverflow.com/comment/43046574

http://stackoverflow.com/q/27291479
possible better answer: http://stackoverflow.com/a/27291518
favorite count: 0
has answer: http://stackoverflow.com/a/27291518
has title: Using the OR operator inside an if or just else if?
has answer: http://stackoverflow.com/a/27291563
accepted answer: http://stackoverflow.com/a/27291515
has answer: http://stackoverflow.com/a/27291856
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27291782
tagged with: java
has answer: http://stackoverflow.com/a/27291515
has answer: http://stackoverflow.com/a/27291589
has body: Good morning/afternoon/night, I'm writting a simple function which will return a boolean if the string given as an argument (in this case a two character code) is matched. I was wondering which would be considered the "Best" way to go about this, would it be using a number of || operators within a single if like below: private boolean isCodeSpecial(String code){ if( code.equalsIgnoreCase("AA") || code.equalsIgnoreCase("AB") || code.equalsIgnoreCase("SS") || code.equalsIgnoreCase("DD") || code.equalsIgnoreCase("YY") || code.equalsIgnoreCase("ZZ") || code.equalsIgnoreCase("AX") ){ return true; } return false; } Or perhaps using a series of else if statements like the below: private boolean isCodeSpecial(String code){ if(code.equalsIgnoreCase("AA")){ return true; }else if(code.equalsIgnoreCase("AB")){ return true; }else if(code.equalsIgnoreCase("SS")){ return true; }else if(code.equalsIgnoreCase("DD")){ return true; }else if(code.equalsIgnoreCase("YY")){ return true; }else if(code.equalsIgnoreCase("ZZ")){ return true; }else if(code.equalsIgnoreCase("AX")){ return true; }else{ return false; } } I'm not really concerned about performance in this application, as I know any gains/penalies will likely be minimal and almost unnoticable - but if possible I would like to know whats generally considered best practice for future reference. I guess the argument could be made that this is exactly what else if is for ? Thanks in advance, Edit: Forgot to mention that I am using Java 1.6 (so I dont beleive a simple switch is possible without the use of Enums ?)
type: Question
has answer: http://stackoverflow.com/a/27291717
score: 0
upvote count: 1
downvote count: 1
answer count: 7

http://stackoverflow.com/q/27202350
type: UnansweredQuestion
tagged with: spring
tagged with: java
has body: I want to allow users to either log into my Spring web application using the standard username / password approach or by using an OpenID Provider (e.g. Google). I tried to follow the various tutorials on the internet on that subject and got both OpenID and database username / password auth to work, but never together. As soon as I added the traditional username / password login, OpenID stopped working (When I click the OpenID login button I just get redirected to the login page again as if I were forbidden to access the /j_spring_openid_security_check page). This is my spring security config page: <security:http pattern="/login" security="none"/> <security:http pattern="/resources/**" security="none"/> <security:http pattern="/polymer/**" security="none"/> <security:http> <security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/> <security:intercept-url pattern="/**" access="ROLE_USER"/> <security:form-login default-target-url="/" login-page="/login" authentication-failure-url="/login?error" username-parameter="username" password-parameter="password"/> <security:openid-login user-service-ref="userService"> <security:attribute-exchange identifier-match="https://www.google.com/.*"> <security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true" count="1"/> <security:openid-attribute name="firstname" type="http://axschema.org/namePerson/first" required="true" /> <security:openid-attribute name="lastname" type="http://axschema.org/namePerson/last" required="true" /> <security:openid-attribute name="fullname" type="http://axschema.org/namePerson/friendly" required="true" /> </security:attribute-exchange> </security:openid-login> <security:logout logout-url="/logout" /> <security:remember-me token-repository-ref="tokenRepo" user-service-ref="userService" /> </security:http> <property name="userDetailsService" ref="userService" /> <property name="passwordEncoder" ref="passwordEncoder" /> <constructor-arg value="11"/> <security:authen…
has title: How to enable both form-based and OpenID login with Spring Security?
type: Question
has comment: http://stackoverflow.com/comment/44024325
has comment: http://stackoverflow.com/comment/44006734
tagged with: jsp
tagged with: spring-security
score: 0
tagged with: openid
answer count: 0

http://stackoverflow.com/comment/43406697
score: 0
has text: Apologies, I must be misunderstanding something, but how could you possibly have an absolute path without a root?
comment on: http://stackoverflow.com/q/27202184
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27208159
answer count: 1
has body: I hope I'm also allowed to ask questions instead of really having errors and need to fix them. I got the following code: public boolean equals(NaturalNumberTuple givenTuple) { int count = 0; if(tuple.length == givenTuple.getLength()){ for(int i = 0; i &lt; tuple.length; i++){ if(this.tuple[i] == givenTuple.tuple[i]){ count++; } } if(count == tuple.length){ return true; } } return false; } So as you can see I'm using a normal for loop but I learned that I can use a so called foreach loop for(int i : tuple){...} but if i try to use it I'm getting an error "ArrayIndexOutOfBoundsException" if I try to check two Arrays for equality. Can someone explain me why I can't use a foreach loop here?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42898243
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/42898276
type: Question
accepted answer: http://stackoverflow.com/a/27208182
tagged with: arrays
has title: Why do i have to use a for loop and not a foreach loop?
score: 0
has answer: http://stackoverflow.com/a/27208182

http://stackoverflow.com/q/27237857
score: 0
tagged with: printing
tagged with: noborder
has comment: http://stackoverflow.com/comment/42953259
has body: I have JTable which looks correct in program, but then I print it where is no borders above columns and rows only one border above all table. Here is print code: MessageFormat header = new MessageFormat("Print Report"); MessageFormat footer = new MessageFormat("Page{0,number,integer}"); try { registras_table.print(JTable.PrintMode.FIT_WIDTH, header, footer); } catch (PrinterException ex) { Logger.getLogger(pagrindinis.class.getName()).log(Level.SEVERE, null, ex); } How to set that borders for printing? Thank you!
has comment: http://stackoverflow.com/comment/42952681
has comment: http://stackoverflow.com/comment/42953187
type: UnansweredQuestion
has title: java prints Jtable with no borders above columns and rows
linked to: http://stackoverflow.com/q/24977871
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42953069
tagged with: swing
linked to: http://stackoverflow.com/q/26580954
type: Question
tagged with: jtable

database
tags question: http://stackoverflow.com/q/27214638
tags question: http://stackoverflow.com/q/27223045
tags question: http://stackoverflow.com/q/27186080
tags question: http://stackoverflow.com/q/27235880
tags question: http://stackoverflow.com/q/27253029
tags question: http://stackoverflow.com/q/27264362
tags question: http://stackoverflow.com/q/27244233
type: Tag
tags question: http://stackoverflow.com/q/27228847
tags question: http://stackoverflow.com/q/27171769
tags question: http://stackoverflow.com/q/27233536
tags question: http://stackoverflow.com/q/27228841
tags question: http://stackoverflow.com/q/27207772
tags question: http://stackoverflow.com/q/27202767
tags question: http://stackoverflow.com/q/27310726
tags question: http://stackoverflow.com/q/27168343
tags question: http://stackoverflow.com/q/27238085
tags question: http://stackoverflow.com/q/27170797
tag name: database
tags question: http://stackoverflow.com/q/27184581
tags question: http://stackoverflow.com/q/27171823
tags question: http://stackoverflow.com/q/27204672
tags question: http://stackoverflow.com/q/27213331
tags question: http://stackoverflow.com/q/27227912
tags question: http://stackoverflow.com/q/27154189
tags question: http://stackoverflow.com/q/27186211
tags question: http://stackoverflow.com/q/27305950
tags question: http://stackoverflow.com/q/27269446
tags question: http://stackoverflow.com/q/27204132
tags question: http://stackoverflow.com/q/27203100
tags question: http://stackoverflow.com/q/27298939
tags question: http://stackoverflow.com/q/27285371
tags question: http://stackoverflow.com/q/27190454
tags question: http://stackoverflow.com/q/27221253
tags question: http://stackoverflow.com/q/27200962
tags question: http://stackoverflow.com/q/27254794
tags question: http://stackoverflow.com/q/27242076
tags question: http://stackoverflow.com/q/27263971

http://stackoverflow.com/q/27210784
type: Question
has answer: http://stackoverflow.com/a/27210916
score: 0
tagged with: stopwatch
answer count: 1
accepted answer: http://stackoverflow.com/a/27210916
has body: The purpose of below code is to test the StopWatch for reset, start, suspend and resume. It should be possible to suspend a stopwatch at a given point in time and resume it later. In this case the elapse time is the cumulative total of all suspend and resume events when the timer is eventually stopped. The code works fine if i remove timer.suspend() and timer.resume(). When i run the code, thread goes to sleep for 2.3 seconds and give elapsed time 2300 in output. However, with suspend and resume method, it sleeps for 2.3 seconds but give output of 0. Can you please suggest/advice what is wrong in the code? Thank you. interface StopWatch { public void reset(); public void start(); public void stop(); public void suspend(); public void resume(); public long getElapsedTime(); public int getState(); public static final int RESET = 0, RUNNING =1, STOPPED =2, SUSPENDED = 3, RESUME = 0;} Timer Class class Timer implements StopWatch{ private long startTime; private long elaspedTime; private int state; public Timer(){reset();} public void reset(){ state = RESET; elaspedTime = 0; } public void start(){ if(state==RESET){ startTime = System.currentTimeMillis(); state = RUNNING; } } public void stop(){ if(state == RUNNING){ elaspedTime = System.currentTimeMillis() - startTime; state = STOPPED; } } public void suspend() { if(state == RUNNING){ elaspedTime = System.currentTimeMillis() - startTime; state = SUSPENDED; } } public void resume(){ if(state == RUNNING){ elaspedTime = System.currentTimeMillis() - startTime; state = RESUME; } } public long getElapsedTime() { if(state == RUNNING){ long elasped = System.currentTimeMillis() - startTime; return elasped; } else if (state == STOPPED) return elaspedTime; else if (state == RESUME) return elaspedTime; return 0; } public int getState(){ return state; }} StopWatch Test public class StopWatchTest { public static void main (String[] args){ Timer timer = new Timer(); timer.start(); try{ Thread.sleep(2300); timer.suspend(); timer.resume(…
type: AnsweredQuestion
has title: Java StopWatch Suspend and Resume timer not working
tagged with: java

http://stackoverflow.com/q/27203240
has answer: http://stackoverflow.com/a/27203364
type: UnansweredQuestion
downvote count: 1
tagged with: java
score: -1
has body: This is a little bit of my project code: public void render(int[] pixels, int offset, int row) { for (int yTile = yOffset &lt;&lt;3; yTile &lt;= (yOffset + height) &gt;&gt;3; yTile++) { int yMin = yTile * 8 - yOffset; int yMax = yMin + 8; if (yMin &lt; 0) yMin = 0; if (yMax &gt; height) yMax = height; for (int xTile = xOffset &lt;&lt;3; xTile &lt;= (xOffset + width) &gt;&gt;3; xTile++) { int xMin = xTile * 8 - xOffset; int xMax = xMin + 8; if (xMin &lt; 0) xMin = 0; if (xMax &gt; width) xMax = width; int tileIndex = (xTile &amp;(MAP_WIDTH_MASK)) + (yTile &amp;(MAP_WIDTH_MASK)) * MAP_WIDTH; for (int y = yMin; y &lt;yMax; y++) { int sheetPixel = ((y + yOffset) &amp; 7) * sheet.width + ((xMin + xOffset) &amp; 7); int tilePixel = offset + xMin + y * row; for (int x = xMin; x &lt; xMax; x++) { int colour = tileIndex * 4 + sheet.pixels[sheetPixel++]; pixels[tilePixel++] = colours[colour]; } } } } } } When I run my project, it gives me an error on this line: int colour = tileIndex * 4 + sheet.pixels[sheetPixel++]; Can you please tell me how can I can fix this error?
tagged with: eclipse
type: Question
upvote count: 0
has title: Java.lang.NullPointerException on Debug?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42889263

http://stackoverflow.com/a/27375547
has comment: http://stackoverflow.com/comment/136858258
score: 2
has body: No you can't. You would need things like the current position in each open file. That affects what data is returned on a simple sequential read. The restorer would need to open each file and get it to the correct position. That may not be possible for non-seekable streams. Program specific serialization is a much more feasible path, then setup the program from there. Also, as Heap Dumps are usually from OutOfMemory situtaions, recreating JVM from same would again throw OutOfMemoryException. If you are taking heap dump in between, then serialize your objects and restore them when you bring up jvm. (contents copied from comments of this question, Authors almas-shaikh and patricia-shanahan)
has comment: http://stackoverflow.com/comment/43213762
downvote count: 0
answers question: http://stackoverflow.com/q/27267414
has comment: http://stackoverflow.com/comment/43203948
upvote count: 2
has comment: http://stackoverflow.com/comment/128307940
type: Answer

http://stackoverflow.com/comment/43045026
type: QuestionComment
has text: I actually have same problem, I cannot launch any JWS app since I upgraded to Yosemite
type: Comment
comment on: http://stackoverflow.com/q/27283595
score: 0

http://stackoverflow.com/comment/42949895
score: 0
type: Comment
has text: @calmcalmuncle, for a better implementation, see my answer. Your object relationships were messed up to begin with.
comment on: http://stackoverflow.com/a/27236235
type: AnswerComment

listener
tags question: http://stackoverflow.com/q/27264047
tags question: http://stackoverflow.com/q/27206680
tags question: http://stackoverflow.com/q/27259950
tags question: http://stackoverflow.com/q/27244316
tags question: http://stackoverflow.com/q/27233276
type: Tag
tag name: listener
tags question: http://stackoverflow.com/q/27309502

http://stackoverflow.com/q/27193824
type: Question
has title: NullPointerException on unchanged bittorrent library of BitLet
tagged with: torrent
has comment: http://stackoverflow.com/comment/42873155
score: 0
has comment: http://stackoverflow.com/comment/42873974
has body: I just put a torrent on it, did not change the code. Console: Exception in thread "main" java.lang.NullPointerException at org.bitlet.wetorrent.Metafile.&lt;init&gt;(Metafile.java:87) at org.bitlet.wetorrent.Sample.main(Sample.java:35) It's on this: 35: Metafile metafile = new Metafile(new BufferedInputStream(new FileInputStream(filename))); In Metafile code: 87: byte[] announceByteString = ((ByteBuffer) rootDictionary.get(ByteBuffer.wrap("announce".getBytes()))).array(); I just got the source code to begin studing it, but it doesn't run. Files: Sample.java Metafile.java Bencode.java (a Metafile is a Bencode) I changed just one line (from Sample.java): From: String filename = args[0]; To: String filename = "C:\\Torrents\\Tao Of Jeet Kune Do By Bruce Lee (Pdf,Epub) Gooner.torrent"; It takes the torrent file name from the command line argument, I just put it on the code.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42875382
has comment: http://stackoverflow.com/comment/42873285
answer count: 0
tagged with: bittorrent
tagged with: java
has comment: http://stackoverflow.com/comment/42873885

http://stackoverflow.com/a/27289846
type: Answer
answers question: http://stackoverflow.com/q/27289622
score: 0
has body: Make sure to add the following permission to your manifest: &lt;uses-permission android:name="android.permission.INTERNET"/&gt; Also, Android does not support just any kind of streaming audio (especially pre kitkat), so make sure to check the compatibility of your stream here.

http://stackoverflow.com/a/27241585
answers question: http://stackoverflow.com/q/27241392
upvote count: 2
type: Answer
score: 2
has body: You don't have to worry about leaking the reference by adding the fragment as a listener via the setOnItemSelectedListener method. As you can see in the source, this method overwrites the reference to the original listener, which will remove the reference. This is a nice aspect of the android api design: setting a listener rather than adding one, as is typical in Swing, for example, is much less likely to cause a memory leak.
downvote count: 0

http://stackoverflow.com/q/27312993
tagged with: java
has answer: http://stackoverflow.com/a/27319263
type: Question
answer count: 2
tagged with: javascript
tagged with: jquery
tagged with: ajax
score: 0
has answer: http://stackoverflow.com/a/27317147
type: UnansweredQuestion
has body: 1)I need to find out the user timezone and time. For that I use Calendar currentdate1 = Calendar.getInstance(); TimeZone tz = Calendar.getInstance().getTimeZone(); System.out.println("time zone"+tz); System.out.println(tz.getDisplayName()); // (Now India Standard Time) System.out.println(tz.getID()); // (Now . Asia/Kolkata) By using this I need to find out the current time of that user1 at corresponding timezone. 2)One user2 upload video on there date. I convert that into millisecond and store it database. User1 want to see the uploading time of user2 as user1 date and time corresponding to his timezone.How can I do this.
has title: java convert milliseconds date corresponding timezone date in java
tagged with: jakarta-ee

http://stackoverflow.com/comment/42886328
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27201395
has text: Are you allowed to use regular expressions or are you limited to using `indexOf`?
type: Comment

intellij-idea
tags question: http://stackoverflow.com/q/27178870
tags question: http://stackoverflow.com/q/27200951
tags question: http://stackoverflow.com/q/27284247
tags question: http://stackoverflow.com/q/27239791
tags question: http://stackoverflow.com/q/27283453
tags question: http://stackoverflow.com/q/27193546
tags question: http://stackoverflow.com/q/27178895
tags question: http://stackoverflow.com/q/27159372
type: Tag
tags question: http://stackoverflow.com/q/27290073
tag name: intellij-idea
tags question: http://stackoverflow.com/q/27312134
tags question: http://stackoverflow.com/q/27212053
tags question: http://stackoverflow.com/q/27209057
tags question: http://stackoverflow.com/q/27192265
tags question: http://stackoverflow.com/q/27267508
tags question: http://stackoverflow.com/q/27172745
tags question: http://stackoverflow.com/q/27299618
tags question: http://stackoverflow.com/q/27197650
tags question: http://stackoverflow.com/q/27267224
tags question: http://stackoverflow.com/q/27197005
tags question: http://stackoverflow.com/q/27199418
tags question: http://stackoverflow.com/q/27223917
tags question: http://stackoverflow.com/q/27223372
tags question: http://stackoverflow.com/q/27173203
tags question: http://stackoverflow.com/q/27246065
tags question: http://stackoverflow.com/q/27191362
tags question: http://stackoverflow.com/q/27180499
tags question: http://stackoverflow.com/q/27269464
tags question: http://stackoverflow.com/q/27177818
tags question: http://stackoverflow.com/q/27249226
tags question: http://stackoverflow.com/q/27234486
tags question: http://stackoverflow.com/q/27199511
tags question: http://stackoverflow.com/q/27168504
tags question: http://stackoverflow.com/q/27188516
tags question: http://stackoverflow.com/q/27161074
tags question: http://stackoverflow.com/q/27242007
tags question: http://stackoverflow.com/q/27248618
tags question: http://stackoverflow.com/q/27296398
tags question: http://stackoverflow.com/q/27289331
tags question: http://stackoverflow.com/q/27206040
tags question: http://stackoverflow.com/q/27220475

http://stackoverflow.com/comment/43001878
has text: That will (probably incorrectly) trigger export for the first item in the list. Beware!
comment on: http://stackoverflow.com/a/27265104
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27249521
score: 0
has title: spring autowired: doesn't work
answer count: 1
has answer: http://stackoverflow.com/a/27249700
has comment: http://stackoverflow.com/comment/42973518
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: quartz-scheduler
has body: java.lang.NullPointerException when autowire a class used in quartz The entry point is: public class AppContainer { public static void main(String[] args) { ApplicationContext c1 = new ClassPathXmlApplicationContext("rabbit-listener-context.xml"); } } rabbit-listener-context.xml is: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:c="http://www.springframework.org/schema/c" xmlns:p="http://www.springframework.org/schema/p" xmlns:task="http://www.springframework.org/schema/task" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config /> app.conf <import resource="dataSources.xml" /> </beans> dataSources.xml is: <?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:jdbc="http://www.springframework.org/schema/jdbc" 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.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config /> <import resource="properties.xml"/> </beans> Then the class to b…
type: Question
accepted answer: http://stackoverflow.com/a/27249700
has comment: http://stackoverflow.com/comment/42973317

http://stackoverflow.com/a/27209595
has comment: http://stackoverflow.com/comment/42906753
has comment: http://stackoverflow.com/comment/42905817
has comment: http://stackoverflow.com/comment/42907628
has comment: http://stackoverflow.com/comment/42906747
has comment: http://stackoverflow.com/comment/42905981
type: Answer
has comment: http://stackoverflow.com/comment/42906836
answers question: http://stackoverflow.com/q/27181778
has body: The code after fixing the problems. all thanks to @kriegaex ! import java.util.*; public class Program9 { public static String getOperand() { Scanner scan = new Scanner(System.in); String stringOfInteger; System.out.print("Please enter an integer up to 50 numbers: "); stringOfInteger = scan.nextLine(); return stringOfInteger; } public static int[] convert(String operand) { int [] integer = new int[50]; char ch; int position = operand.length() - 1; for (int i = integer.length - 1; i &gt;= 0; i--) { if (position &gt;= 0) ch = operand.charAt(position--); else ch = 0; if (ch &gt;= '0' &amp;&amp; ch &lt;= '9') { integer[i] = ch - '0'; } else { integer[i] = 0; } } return integer; } public static int[] add(int[] operand1, int[] operand2) { int [] result = new int[operand1.length]; int carry = 0; for (int i = operand1.length - 1; i &gt;= 0; i--) { result[i] = operand1[i] + operand2[i] + carry; if (result[i] / 10 == 1) { result[i] = result[i] % 10; carry = 1; } else carry = 0; } return result; } public static int[] complement(int[] operand2){ int [] result = new int[operand2.length]; for (int i = operand2.length - 1; i &gt;= 0; i--) result[i] = 9 - operand2[i]; return result; } public static int[] add1(int[] operand2){ int [] result = new int[operand2.length]; result[operand2.length - 1] = 1; for (int i = result.length - 2; i &gt;= 0; i--) result[i] = 0; return result; } public static int[] negate(int[] operand2){ return add(add1(operand2), complement(operand2)); } public static void print(int[] result, String operation) { if (operation.charAt(0) == '+') System.out.print("The subtotal of the two integers = "); else if (operation.charAt(0) == '-') System.out.print("The subtraction of the two integers = "); if (result[0] == 9) { result = negate(result); System.out.print("-"); } boolean leadingZero = true; for (int i = 0; i &lt; result.length; i++) { if (leadingZero) { if (result[i] == 0) continue; leadingZero = false; } System.out.print(result[i]); } if (leadingZero == true) S…
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/42907796
has comment: http://stackoverflow.com/comment/42906758
upvote count: 0

http://stackoverflow.com/a/27197573
answers question: http://stackoverflow.com/q/27188457
has body: You're likely confused by the lexer/parser separation here. You did only provide a single example, but I can infer the following: declaration: KEY '(' STRING ')' ; KEY : '@' [a-zA-Z]+ ; STRING: '"' (~'"')* '"' ; WS: [ \t\r\n] -&gt; skip; declaration is a parser rule. It consists of a KEY (@ followed by letters), an opening parenthesis, a STRING (any text between quotes), and a closing parenthesis. KEY and STRING are the lexer rules. Be aware that the STRING rule above won't let you escape characters. If you need to be able to escape a quote with a backslash (and also a backslash with a backslash), use the following rule instead: STRING: '"' ('\\' ["\\] | ~'"')* '"'
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27188457
downvote count: 0

http://stackoverflow.com/a/27270893
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27266223
has body: In order to dynamically define the Sheet Name of an "Excel Output / Writer Step", you can do it by assigning a variable to the "Sheet Name". In your case, you first create a Kettle Job with two transformation step. In the first transformation, use the code to define a variable (say : COLUMN_NAME). The value in this variable will be used as the sheet name. In the second transformation, use the variable defined in the first ktr (i.e. COLUMN_NAME) as the sheet Name. check the image below for the Excel Writer Step: This will give a dynamic sheet name in pentaho. Hope this is what you are looking for :)
type: Answer
upvote count: 1

http://stackoverflow.com/q/27156734
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42810656
tagged with: image
accepted answer: http://stackoverflow.com/a/27166004
tagged with: jtable
downvote count: 0
answer count: 1
tagged with: button
score: 1
has comment: http://stackoverflow.com/comment/42808555
favorite count: 0
has comment: http://stackoverflow.com/comment/42811906
has body: How to add an image to a custom JTable row button, I have a JTable with a JButton in the first column and I want to put an image but, this only show when I click it. Here is my image And here are the JButtonRenderer and JButtonEditor to put a JButton in a JTable row ButtonRenderer.java import java.awt.Component; import javax.swing.JButton; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.table.TableCellRenderer; /** * * @author joepa37 */ public class ButtonRenderer extends JButton implements TableCellRenderer { public ButtonRenderer() { setOpaque(true); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(UIManager.getColor("Button.background")); } setText((value == null) ? "" : value.toString()); return this; } } ButtonEditor.java import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.DefaultCellEditor; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JOptionPane; import javax.swing.JTable; /** * * @author joepa37 */ public class ButtonEditor extends DefaultCellEditor { protected JButton button; private String label; private boolean isPushed; public ButtonEditor(JCheckBox checkBox) { super(checkBox); button = new JButton(new ImageIcon(ButtonEditor.class.getResource("image.png"))); button.setOpaque(true); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fireEditingStopped(); } }); } @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { if (isSelected) { button.setForeground(table.getSelectionForeground()); button.setBackground(table…
upvote count: 1
has title: How to add an image to a custom JTable row button
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27166004

http://stackoverflow.com/comment/68733283
score: 0
type: Comment
has text: I have the same ISSUE (Java 7 & 8) I found SOCKS proxy and it works, and works ONLY when I point it as SOCKS In the IE, winows PC) ANd when I try to use in in the PROSY connection I receve same Malformed reply from SOCKS server
type: AnswerComment
comment on: http://stackoverflow.com/a/27219355

http://stackoverflow.com/comment/42951379
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27237393
has text: The ever popular One of Spades?

http://stackoverflow.com/q/27223854
type: UnansweredQuestion
tagged with: elasticsearch
tagged with: java
type: Question
tagged with: lucene
score: 0
has title: synonym state name match in Elastic search
answer count: 1
has body: I am using elastic search for matching the location to the elastic search index. sample of Elastic search index data { "_index": "reference_2", "_type": "geonames", "_id": "AUn2LNJlZ8pWP0iSxZYS", "_version": 1, "_score": 1, "_source": { "geoNameId": "7509382", "lat": "34.64274", "longi": "64.51122", "timeZoneId": "Asia/Kabul", "countryCode": "AF", "state": "Tamil nadu", "timezone": "AFT", "stateCode": "09", "alterCityName": [ chennai ], "cityName": "chennai", "population": "0", "countryName": "India" }, "sort": [ 1, "geonames", "reference_2" ] } User can write the state as "tamilnadu" or tamil nadu, I want the program or the query to understand that tamilnadu is same as tamil nadu. can any one help me how to achieve this
has answer: http://stackoverflow.com/a/27226149

http://stackoverflow.com/comment/42892217
type: AnswerComment
comment on: http://stackoverflow.com/a/27204607
type: Comment
has text: Hey @ydmpcn I saw your [other question](http://stackoverflow.com/questions/26297243/modifying-string-on-java). Already have long since that question. So I believe you when you say you tried many things. By the way, you can also upvote in the answer. ;)
score: 0

http://stackoverflow.com/comment/42805900
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27155779
has text: You mean you want the type of an existing object to change at execution time? You can't do that. What you *can* do is have a variable of type `Tool` (the superclass) and change its value to refer to instances of different subclasses over the course of its lifetime. It's not really clear what you're trying to achieve though. Sample code would really help...
type: Comment

http://stackoverflow.com/comment/42840955
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27175756
has text: Did you debug the code? in which line are you getting the error? can you add stacktrace?
score: 0

http://stackoverflow.com/q/27230691
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42938471
type: Question
upvote count: 1
accepted answer: http://stackoverflow.com/a/27231131
answer count: 1
has title: Eclipse library
has body: there are two types of data that can be easly mixed up by the compiler. Here they're: java.util.List and org.eclipse.swt.widgets.List I need both in a method I have created and the only workaround I have found is to use the absolute path in the declaration section, at least for one of those types. I.e: java.util.List&lt;String&gt; listofstring; Any hints?
favorite count: 0
has comment: http://stackoverflow.com/comment/42938240
has answer: http://stackoverflow.com/a/27231131
tagged with: list
downvote count: 0
has comment: http://stackoverflow.com/comment/42938268

http://stackoverflow.com/comment/42806352
has text: I think it's ok for a greater than sign, if there is no preceding less than sign, as in the example of string C above. But I think my problem was the re-escaping of the content before printing, instead of immediately while parsing. I am keeping the whole content of the "string" element in one variable, even if it contains html-formatting like . When printing this variable it is difficult to distinguish whether the lt and gt signs are to be escaped or not. But while parsing, it is obvious whether its content or an (HTML formatting) element.
comment on: http://stackoverflow.com/q/27155187
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27239028
has answer: http://stackoverflow.com/a/27245308
has answer: http://stackoverflow.com/a/27247201
type: Question
has body: I would like to have in animalSniffer plugin one task to depend on compilation of all production classes (Java, Groovy, Scala) in all sourceSets and the second to depend on compilation of all test classes in all sourceSets (possibly separate test and integrationTest). I wouldn't like to depend on *classes tasks as *classes tasks should depend animalSniffer tasks (which detects Java version API incompatibilities after the compilation and can stop the build). Is there a better way in Gradle to achieve that than checking if an instance of AbstractCompile task name starts with "compileTest"?
answer count: 2
accepted answer: http://stackoverflow.com/a/27245308
upvote count: 7
tagged with: gradle
tagged with: gradle-custom-plugin
has title: How to depend on all *compile and *testCompile tasks in Gradle
tagged with: java
tagged with: groovy
type: AnsweredQuestion
downvote count: 0
score: 7
possible better answer: http://stackoverflow.com/a/27247201
favorite count: 0

http://stackoverflow.com/comment/43016417
type: Comment
has text: Added the Server Class as well.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27270434

http://stackoverflow.com/comment/42868562
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27189955
has text: Your question specifically mentions command line. However, Jenkins has a plugin to support maven release. If you perform your releases through there it allows you to provide credentials through the Jenkins UI.
score: 0

http://stackoverflow.com/comment/42967517
score: 0
type: Comment
has text: Now I am getting this error. Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Vector. Can anybody please guide me. I am doing this final DefaultTableModel model = new DefaultTableModel(data, columnNames);.
type: AnswerComment
comment on: http://stackoverflow.com/a/27225856

http://stackoverflow.com/comment/42880371
comment on: http://stackoverflow.com/q/27196376
has text: @chrylis: A _minimal_ testcase would be my first stop.
score: 4
type: Comment
type: QuestionComment

mysql
tags question: http://stackoverflow.com/q/27280536
tags question: http://stackoverflow.com/q/27153333
tags question: http://stackoverflow.com/q/27223344
tags question: http://stackoverflow.com/q/27295038
tags question: http://stackoverflow.com/q/27254794
tags question: http://stackoverflow.com/q/27174752
tags question: http://stackoverflow.com/q/27214763
tags question: http://stackoverflow.com/q/27180969
tags question: http://stackoverflow.com/q/27250271
tags question: http://stackoverflow.com/q/27203092
tags question: http://stackoverflow.com/q/27234576
tags question: http://stackoverflow.com/q/27222294
tag name: mysql
tags question: http://stackoverflow.com/q/27220626
tags question: http://stackoverflow.com/q/27243036
tags question: http://stackoverflow.com/q/27235880
tags question: http://stackoverflow.com/q/27168401
tags question: http://stackoverflow.com/q/27274306
tags question: http://stackoverflow.com/q/27301716
tags question: http://stackoverflow.com/q/27242184
tags question: http://stackoverflow.com/q/27193598
tags question: http://stackoverflow.com/q/27195750
tags question: http://stackoverflow.com/q/27257090
tags question: http://stackoverflow.com/q/27168571
tags question: http://stackoverflow.com/q/27308725
tags question: http://stackoverflow.com/q/27159875
tags question: http://stackoverflow.com/q/27181052
tags question: http://stackoverflow.com/q/27168842
tags question: http://stackoverflow.com/q/27271808
tags question: http://stackoverflow.com/q/27266561
tags question: http://stackoverflow.com/q/27180430
tags question: http://stackoverflow.com/q/27265663
tags question: http://stackoverflow.com/q/27201616
tags question: http://stackoverflow.com/q/27200494
tags question: http://stackoverflow.com/q/27264792
tags question: http://stackoverflow.com/q/27270172
tags question: http://stackoverflow.com/q/27221934
tags question: http://stackoverflow.com/q/27183619
tags question: http://stackoverflow.com/q/27271175
tags question: http://stackoverflow.com/q/27297808
tags question: http://stackoverflow.com/q/27177807
tags question: http://stackoverflow.com/q/27223045
tags question: http://stackoverflow.com/q/27208369
tags question: http://stackoverflow.com/q/27304332
tags question: http://stackoverflow.com/q/27213687
tags question: http://stackoverflow.com/q/27294457
tags question: http://stackoverflow.com/q/27273865
tags question: http://stackoverflow.com/q/27300380
tags question: http://stackoverflow.com/q/27233116
tags question: http://stackoverflow.com/q/27202767
tags question: http://stackoverflow.com/q/27204645
tags question: http://stackoverflow.com/q/27166237
tags question: http://stackoverflow.com/q/27231281
tags question: http://stackoverflow.com/q/27215187
tags question: http://stackoverflow.com/q/27218154
tags question: http://stackoverflow.com/q/27300949
tags question: http://stackoverflow.com/q/27191495
tags question: http://stackoverflow.com/q/27178593
tags question: http://stackoverflow.com/q/27193154
tags question: http://stackoverflow.com/q/27161886
type: Tag
tags question: http://stackoverflow.com/q/27167170
tags question: http://stackoverflow.com/q/27200346
tags question: http://stackoverflow.com/q/27265120
tags question: http://stackoverflow.com/q/27214757
tags question: http://stackoverflow.com/q/27272416
tags question: http://stackoverflow.com/q/27165300
tags question: http://stackoverflow.com/q/27233588
tags question: http://stackoverflow.com/q/27311097
tags question: http://stackoverflow.com/q/27220363
tags question: http://stackoverflow.com/q/27241927
tags question: http://stackoverflow.com/q/27196901
tags question: http://stackoverflow.com/q/27167072
tags question: http://stackoverflow.com/q/27266175
tags question: http://stackoverflow.com/q/27186211
tags question: http://stackoverflow.com/q/27288067
tags question: http://stackoverflow.com/q/27184960
tags question: http://stackoverflow.com/q/27269446
tags question: http://stackoverflow.com/q/27189535
tags question: http://stackoverflow.com/q/27295842

http://stackoverflow.com/comment/43074783
score: 1
has text: You could also do `.max(Comparator.comparingInt(Collection::size))` (+1)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27306083

http://stackoverflow.com/comment/42992845
type: AnswerComment
score: 0
type: Comment
has text: Thanks, but that didn't seem to work. There are two files in the /WEB-INF folder, applicationContext.xml and app-web-servlet.xml that have the <beans> complex element. the former had two declarations: <context:component-scan base-package="com.company.app" /> and <context:component-scan base-package="com.company.app.common.utils" /> the latter had just <context:component-scan base-package="com.company.app" /> I added <context:component-scan base-package="com.company.app.utilities" /> to both of them and re-started Tomcat, but it had no effect.
comment on: http://stackoverflow.com/a/27258996

http://stackoverflow.com/comment/42830809
type: Comment
comment on: http://stackoverflow.com/a/27169945
score: 0
type: AnswerComment
has text: That's going to give a result of "65"

http://stackoverflow.com/q/27270844
score: 2
tagged with: java
tagged with: linker-errors
tagged with: android-ndk
type: Question
has title: FFmpeg linker error: Error due to text relocations in libavcodec shared object
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/34873193
tagged with: ffmpeg
upvote count: 2
type: UnansweredQuestion
tagged with: android
has body: I am trying to build an Android app which uses FFmpeg native code for video decoding and encoding. I have a 64-bit machine running 32-bit Ubuntu 14.04, ADT version 23. I downloaded FFmpeg-2.4.4 (32-bit) and built it for Android following the steps mentioned here - http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/ I used latest Android NDK, that is NDK r10c. For testing, I used FFmpeg's API example code given in this link - http://ffmpeg.org/doxygen/trunk/decoding__encoding_8c-source.html I was able to build all the shared objects successfully and Android project gets compiled successfully without any errors. Following code is Android code to load all shared objects public class CallNative { public static String libName = "decode_encode" ; public CallNative(){ System.loadLibrary("avutil-54"); System.loadLibrary("swresample-1"); System.loadLibrary("avcodec-56"); System.loadLibrary("avformat-56"); System.loadLibrary("swscale-3"); System.loadLibrary("avfilter-5"); System.loadLibrary(libName); } public native int decode(String Filename, int length); } And, this is how, decode function is called from Android. Uri videoURI = Uri.parse(fileUri.toString()); String videoFilePath = getFilePathFromURI(getApplicationContext(), videoURI); Log.d("SPLASH","Entering native decode call"); CallNative n = new CallNative(); n.decode(videoFilePath, videoFilePath.length()); Log.d("SPLASH","successfully returned from decode call"); When I debugged, App crashes when it enters native function call. I get following linker error. W/linker(32244): libavcodec-56.so has text relocations. This is wasting memory and prevents security hardening. Please fix. I tried the same with FFmpeg 2.4.3 and 2.0.6 packages as well. I am getting the same error. How to resolve this?

http://stackoverflow.com/comment/43089279
type: Comment
has text: Interesting solution but it solves only that specific expression. I have to make something that will solve any possible expression that uses the same syntax ( function !<name>(...) and the closing bracket marks the end of the function , parameter ${<name>} where the closing curly brace marks its end) The problem for me is writing something that can have N number of nested functions (basically traversing inside out)
comment on: http://stackoverflow.com/a/27251402
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42964353
has text: @DanAllen I agree this method could be more efficient, but I suspect the OP is just following some simple instructions. I'm no statistician, but I question your premise that the current shuffle is not uniformly distributed. If the selection of the card is random (and uniformly distributed), then that ought to be sufficient. Yes, sometimes it will only shuffle parts of the deck but that's the whole idea behind randomness, no?
comment on: http://stackoverflow.com/q/27244297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27198069
type: Question
tagged with: google-visualization
linked to: http://stackoverflow.com/q/20469213
has title: Set bar width on ColumnChart from google chart in Java
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am having trouble setting the bar width on my bars in my ColumnChart. So far I have the following options set: private Options createOptions() { Options options = Options.create(); options.setWidth(600); options.setHeight(400); options.set3D(true); options.setEnableTooltip(false); return options; } But it seems like the option for setting the bar width is not there. If I set my width to 600 px, and only have 2 entries/bars, they will each be huge. If I have 10 it will look more normal.
downvote count: 0
has answer: http://stackoverflow.com/a/27198117
score: 1
tagged with: java

http://stackoverflow.com/q/27249547
tagged with: cellid
tagged with: lte
has title: Android Development CellID in LTE network
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I try to implement a function into my Android Application that finds out the cell id of the cell I'm in in a LTE network. I recently read a lot about using TelephonyManager.getAllCellInfo() and then filter for CellInfoLte, but also that it's not implemented on every device. So in my case calling telephonymaganger.getAllCellInfo() returns null. I'm testing with a Samsung phone, what seems not to be the best case. Is there any way to find out the Cell ID or is it just not accessible yet?
tagged with: android
has answer: http://stackoverflow.com/a/27250238
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: samsung-mobile

http://stackoverflow.com/comment/43009572
comment on: http://stackoverflow.com/q/27269637
has text: Add the language tag.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/37137209
score: 18
has comment: http://stackoverflow.com/comment/68576718
has comment: http://stackoverflow.com/comment/67247281
has body: I solved this problem going to "Preferences > General > Security > Secure Storage > Contents", open "[Default Secure Storage]", deleting the "GIT" row and finally restarting Eclipse.
has comment: http://stackoverflow.com/comment/102224506
upvote count: 18
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27209692
has comment: http://stackoverflow.com/comment/107241983

http://stackoverflow.com/comment/43073902
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27305249
has text: That all seems like it should work, but for some reason i'm still getting a exception.
type: AnswerComment

http://stackoverflow.com/comment/42960506
comment on: http://stackoverflow.com/q/27242049
type: QuestionComment
type: Comment
score: 0
has text: obviously if is not creating any problem then you in right track brother.

http://stackoverflow.com/comment/43079995
type: QuestionComment
has text: The proc signature you are showing is `PROC_A_LIST` whereas you are calling `PROC_CATEGORY_LIST` - I'm guessing the latter has > 1 parameter?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27309182

http://stackoverflow.com/a/27229286
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42939999
has comment: http://stackoverflow.com/comment/42939950
type: Answer
accepted answer of: http://stackoverflow.com/q/27229109
answers question: http://stackoverflow.com/q/27229109
score: 3
has body: First of all, you have to create an empty keystore before adding a key inside it, and your code wouldn't work because, To create an empty keystore using the above load method, pass null as the InputStream argument. See the following example to see how to pass null as argument. Creating a Keystore, public static void createStore(String path, String keyStoreName, String storePassword) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore store = KeyStore.getInstance("BKS"); char[] password = storePassword.toCharArray(); store.load(null, password); FileOutputStream fos = new FileOutputStream(path + keyStoreName); store.store(fos, password); System.out.println("New Store Created !"); fos.close(); } The above code is copied from my repo, aes-256-java-bks According to its description, it has all the features which you need, This simple code allows you to encrypt/decrypt any kind of file using AES-256 standard. It uses Bouncy Castle Keystore for Key Management. Beside Encryption, the code allows you to manage your keystore, like Creating a new Keystore, Loading an existing keystore, adding key to an existing keystore, generating new Key with user Password, deleting key from a keystore or displaying keys from given keystore, all these features could be accessed at runtime, all you need to do is execute the program. The following codes are from the same repository as mentioned above, Loading store, static KeyStore loadStore() throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, CertificateException { KeyStore store = KeyStore.getInstance("BKS"); InputStream keystoreStream = new FileInputStream(keyStoreLocation); store.load(keystoreStream, storePassword.toCharArray()); System.out.println("Key Store loaded!\n"); return store; } For security reasons, you cannot display actual keys from the keystore, but you sure could get the list of all the aliases of keys from the keystore, Check this code, private …
upvote count: 3

http://stackoverflow.com/q/27261807
has title: Retrieving a specific value in an array from JSP to Servlet
tagged with: servlets
tagged with: jstl
tagged with: arrays
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/27265247
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42998215
has body: This code creates a table out of an array of strings stored inside a session. I then have a submit button on the end of each row which when clicked should store the Stock number of reach row (placed in the 0th column of each row) and send it to the servlet. The table is displaying properly, however I cannot retrieve the Stock# column for each individual row. Where did I go wrong? Stock# Name Price Description <c:forEach items="${BooksTable}" begin="0" var="row"> <c:forEach items="${row}" var="cell"> ${cell} </c:forEach> <c:set value="${$row.count}" scope="session" var="itemID" /> </c:forEach>
type: Question
accepted answer: http://stackoverflow.com/a/27265247

http://stackoverflow.com/comment/42899020
has text: Which is line 151 of `WhackAMoleView`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27208218
score: 0

http://stackoverflow.com/q/27270121
score: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/45056643
has title: Connection between Java and Baidu Maps
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27275313
has body: I have a java code using Baidu Maps Geocode API to retrieve longitude/latitude info of an address. The problem is that the answer (an inputStream with XML/JSon format) is always the same: status = 1 and msg = Internal Service Error. At first I thought it could be a bad url created by my code, but that same url works fine in any browser. I add my code so you can see if there's something wrong with it that I didn't notice: private static final String URLDIR = "http://api.map.baidu.com"; private static final String URLPATH = "/geocoder/v2/?"; public void getGeocoding(String address) throws IOException { String HostName = AutoCompletar.getProxyName(); int HostPort = AutoCompletar.getProxyPort(); String uri = ""; String uriEncode = ""; this.latitude = ""; this.longitude = ""; this.estado = ""; System.out.print("\nCalculate lat,lng: " + address + "\n"); System.out.print("-----------------------------------------------------\n"); try { uri = URLDIR + URLPATH; String uriQuery = "address=" + address; uriQuery = uriQuery + "&amp;output=xml" + "&amp;ak=" + baiduKey; System.out.println("uriQuery: " + uriQuery); uriEncode = uri + uriQuery; System.getProperties().put("http.proxyHost", HostName); System.getProperties().put("http.proxyPort", Integer.toString(HostPort)); URL bmap = new URL(uriEncode); HttpURLConnection yc = null; if (HostName == null || HostName.equals("")) { yc = (HttpURLConnection) bmap.openConnection(); } else { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(HostName,HostPort)); yc = (HttpURLConnection) bmap.openConnection(proxy); } //yc.connect(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); InputSource inputXml = new InputSource(in); try { SimpleParser xmlParser = new SimpleParser(inputXml); System.out.println(xmlParser.toString()); this.estado = xmlParser.nodeValue("/GeocoderSearchResponse/status/text()"); System.out.print("Status: " + this.estado + "\n"); if ("0".equals(this.estado)) { this.latitude = xml…

http://stackoverflow.com/a/27290662
has comment: http://stackoverflow.com/comment/43047551
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43047677
answers question: http://stackoverflow.com/q/27290247
has comment: http://stackoverflow.com/comment/43048258
has body: Instead of using @annotation(com.proj.server.aspect.log.Loggable) as your pointcut expression use "@com.proj.server.aspect.log.Loggable * *(..)" give it a try it should work

http://stackoverflow.com/comment/42850278
type: QuestionComment
comment on: http://stackoverflow.com/q/27180711
score: 0
has text: I added a runnable version of my code. Please help. I could not figure what the arraylist is not printing out in another method.
type: Comment

http://stackoverflow.com/q/27173632
tagged with: tycho
has body: I have several OSGi bundles that are built in Eclipse using normal manifest-managed dependencies and external builds with Maven Tycho. Running the bundles inside of Eclipse on Equinox works fine. Building them with Tycho works fine. Now I want to use Tycho Surefire to run integration tests and for that I created a simple test bundle that contains some basic tests. The bundles under test rely on some other bundles present in the OSGi-container and some minor start level tweaks in order to run correctly - like I said, the bundles themself start up perfectly fine when running them normally on Equinox. So to mimic that for Tycho Surefire, I specified the following in the pom.xml of the test bundle: org.eclipse.tycho tycho-surefire-plugin 0.21.0 org.hibernate.osgi 6 true org.eclipse.tycho target-platform-configuration eclipse-plugin org.hibernate.entitymanager 4.2.12.Final eclipse-plugin org.hibernate.osgi 4.2.12.Final Interestingly, the tests failed. After some research I found out how I can access the OSGi console during/after the failed test run to investigate the problem further (OSGi console after running tycho tests). My findings are, that although all necessary bundles (all transitively derived bundles and all manually specified ones) are present in the OSGi-container only the ones with a distinctive have been started (plus the OSGi-core-bundles of course). So given the above example, my findings are that while both org.hibernate.osgi and org.hibernate.entitymanager have been resolved, only the first is in the 'ACTIVE' state. This obviously messes up the whole startup and my guess is that the tests would run fine if the bundles would start up as expected. When I look at a "normal" Eclipse-OSGi-Launch configuration, there is a parameter "Default Auto-Start" that is set to true by default. I did not find anything like that in the Tycho Surefire documentation, but is it possible that setting a specific start level for some bundles somehow overrides the auto start of …
tagged with: tycho-surefire-plugin
downvote count: 0
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/34676068
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42868181
tagged with: java
score: 6
tagged with: maven
accepted answer: http://stackoverflow.com/a/34676068
linked to: http://stackoverflow.com/q/13473452
type: Question
has title: OSGi-bundles not activating when run by Tycho surefire

http://stackoverflow.com/comment/42820667
has text: Why is this getting downvoted? What have I done incorrectly? I would rather someone explain the fault in my answer, rather than blindly downvoting without an explanation.
type: AnswerComment
comment on: http://stackoverflow.com/a/27163052
score: 0
type: Comment

http://stackoverflow.com/a/27285516
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27284303
type: Answer
score: 2
upvote count: 2
has body: I think this is one of those moments that that layout manager has thrown it's arms up in the air and said, "Well, that's the best I can do with what you've given me". If you change constraints.gridheight = 2; to constraints.gridheight = 3; for infoPanel2 it'll work. I "think" it has a combination of things to do with the total height of the second column when compared to the first (without consideration to the row spanning). Allowing the second row to expand beyond the the two rows seems to allow it to collapse the extra space. For what it's worth. I would have probably put the two columns into individual panels and laid out those two panels instead, but that's just me...
answers question: http://stackoverflow.com/q/27284303
type: AcceptedAnswer

http://stackoverflow.com/a/27175173
has body: contentPane.setLayout(null); Don't use a null layout. Layout managers have many functions. One is to set the size/location of components added to the panel. The other is do determine the preferred size of the panel. The scrollbars will appear automatically when the preferred size of the panel is greater than the size of the scrollpane. When you use a null layout the preferred size is (0, 0) so there is no reason to show the scrollbars. Read the section from the Swing tutorial on Layout Managers for more information and examples using layout managers. If you are doing custom painting on your panel, then you would override the getPreferredSize() method of your custom panel to make the scrollbars work properly.
upvote count: 1
has comment: http://stackoverflow.com/comment/42841025
has comment: http://stackoverflow.com/comment/42840002
type: Answer
has comment: http://stackoverflow.com/comment/42840068
has comment: http://stackoverflow.com/comment/42840608
has comment: http://stackoverflow.com/comment/42840104
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27174819

http://stackoverflow.com/comment/42863277
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27188426
has text: So basically, you want to enter a few actors and save them in the database, correct? Is the actors table mapped to some other table? Can you please post your model code for Actors class

http://stackoverflow.com/comment/42893463
type: QuestionComment
comment on: http://stackoverflow.com/q/27205306
score: 0
type: Comment
has text: More likely some particular aspect of your file. Try `System.out.println(AudioSystem.getAudioFileFormat(soundFile).getFormat());` and tell us what it says.

http://stackoverflow.com/q/27169080
upvote count: 1
answer count: 1
tagged with: matlab
tagged with: java
accepted answer: http://stackoverflow.com/a/27175745
linked to: http://stackoverflow.com/q/25977
type: AnsweredQuestion
has title: How to match two images whether there patterens are same or not?
favorite count: 0
has comment: http://stackoverflow.com/comment/42829476
type: Question
tagged with: wolfram-mathematica
score: -1
has answer: http://stackoverflow.com/a/27175745
has body: I want to know about that for example i have two images and wants to compare whether they are same or not i searched about it but didn't get any satisfying result also which tool or platform is better for it MATLAB, MATHEMATICA, JAVA etc and their integration with you website. Thanks in advance
downvote count: 2
has comment: http://stackoverflow.com/comment/42829469

http://stackoverflow.com/comment/134518555
comment on: http://stackoverflow.com/a/67322971
type: Comment
has text: Is a `modulename` a root package? What if I don't have a root package (all packages are inside src folder)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42917159
score: 0
type: QuestionComment
type: Comment
has text: Thanks a lot for your responses. Is it possible to know if the given two numbers are gray code neighbors in some sequence? The sequence was not specified in the question. I came across in one of the interviews. Any help is appreciated!!!
comment on: http://stackoverflow.com/q/27218894

http://stackoverflow.com/a/27267858
has body: You have a super class Weapon, which takes a WeaponType. Your WeaponType is an interface which has the shoot and reload methods. public class Weapon { WeaponType weaponType; public Weapon(WeaponType weaponType) { this.weaponType = weaponType; } public void shoot() { this.weaponType.shoot(); } public void reload() { this.weaponType.reload(); } } Your interface: public interface WeaponType { public void shoot(); public void reload(); } Your shotgun class: public class Shotgun implements WeaponType { @Override public void shoot() { System.out.println("Shotgun shoot!"); } @Override public void reload() { System.out.println("Shotgun reload!"); } } Example usage: Weapon myShotgun = new Weapon(new Shotgun()); myShotgun.shoot(); myShotgun.reload();
type: Answer
answers question: http://stackoverflow.com/q/27267583
score: 0

http://stackoverflow.com/a/27270748
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43013231
downvote count: 0
has comment: http://stackoverflow.com/comment/43014610
has comment: http://stackoverflow.com/comment/43013008
accepted answer of: http://stackoverflow.com/q/27268879
has comment: http://stackoverflow.com/comment/43013174
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43014089
type: Answer
has body: The answer is in your question: just set stripper.setStartPage( p ); stripper.setEndPage( p ); accordingly. So you would loop somewhat like this: int pageCount = document.getDocumentCatalog().getAllPages().size(); for (int p = 0; p &lt; pageCount; ++p) { //... your options stripper.setStartPage(p); stripper.setEndPage(p); FileOutputStream fos = new FileOutputStream(new File(f5+(p+1)+".html")); stripper.writeText(document, fos); fos.close(); } Btw if you get an exception relating to the sorting comparator, use setSortByPosition(false), or wait for version 1.8.8 where this problem is fixed.
has comment: http://stackoverflow.com/comment/43013406
has comment: http://stackoverflow.com/comment/43012806
answers question: http://stackoverflow.com/q/27268879
has comment: http://stackoverflow.com/comment/43012901

http://stackoverflow.com/comment/43053306
type: QuestionComment
comment on: http://stackoverflow.com/q/27293989
has text: That was why I was asking ;-)
score: 0
type: Comment

http://stackoverflow.com/q/27222159
tagged with: spring-boot
has body: Spring Boot with Spring Data Rest - how to use a custom error handler. Created an error controller I tried to skip the default error handler by using following code. Why it is not working! @Configuration @EnableJpaRepositories @Import(RepositoryRestMvcConfiguration.class) @EnableAutoConfiguration(exclude = { BasicErrorController.class }) @EnableMetrics public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); ..................... ..................... and error controller as below @Component @RestController @RequestMapping(value = "/error") public class CustomErrorController extends BasicErrorController { public CustomErrorController(ErrorAttributes errorAttributes) { super(errorAttributes); // TODO Auto-generated constructor stub } private static final String PATH = "/error"; @RequestMapping(value = PATH) public String error() { return "Error handling"; } @Override public String getErrorPath() { return PATH; } }
answer count: 2
tagged with: spring-data-rest
downvote count: 0
has answer: http://stackoverflow.com/a/27222260
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67980378
has title: Error Contoller Howto : Spring-boot + Spring-Data-Rest
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/27268869
accepted answer: http://stackoverflow.com/a/27289414
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: graph
has body: I have a very rare problem. I have a java program that inserts into A NEO4j database. The program is working fine on my local_host environment, but when I deployed it to the server(where the neo4j is located) the DB is not updated . Here is what I do //First delete the DB ExecutionEngine engine = new ExecutionEngine(db); engine.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r"); Transaction tx = db.beginTx(); //insertion here tx.success(); tx.close(); //look if it was correctly updated System.out.println("NODES: " + engine.execute("START n=node(*) RETURN count(n)").dumpToString()); System.out.println("RELATIONSHIPS: " +engine.execute("START r=relationship(*) RETURN count(r)").dumpToString()); db.shutdown(); If I look at the logs everything is working fine UPDATED NODES: +----------+ | count(n) | +----------+ | 99 | +----------+ 1 row RELATIONSHIPS: +----------+ | count(r) | +----------+ | 76 | +----------+ 1 row But when I look into the Neo4J Db via the browser nothing has happened the previous results are still there!. Keep in notice that if I run the same program on my Local_host environment the behavior is the same but in this occasion it is correctly updated Thank you in advance
has comment: http://stackoverflow.com/comment/43023456
answer count: 1
has title: Neo4J results not updating
has answer: http://stackoverflow.com/a/27289414
score: 0
tagged with: neo4j

http://stackoverflow.com/q/27283571
score: -1
has title: Emulating this curl code on android
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27283720
linked to: http://stackoverflow.com/q/3505930
has body: I have a script that is written in PHP but I need to make it into an android app. How do I get the same result? $url = "http://54.193.106.113/ING004/android1/WebServer/Web/sogame/newControl/nmMail/getMailList? sign=".strtoupper($sign); $connection = curl_init($url); curl_setopt($connection, CURLOPT_POSTFIELDS, $finalData); curl_setopt($connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($connection, CURLOPT_ENCODING, "gzip"); $result = curl_exec($connection); $err = curl_error($connection); $baseObj = json_decode($result, true); curl_close($connection);
favorite count: 0
tagged with: android
tagged with: php
tagged with: curl
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27283720
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/42905987
type: AnswerComment
has text: You can just remove function words to achieve that.
type: Comment
comment on: http://stackoverflow.com/a/27212164
score: 0

http://stackoverflow.com/comment/42978948
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27225200
type: AnswerComment
has text: How have you defined the INPUT result ? Please enable devMode and check carefully server logs and app logs for a stacktrace

http://stackoverflow.com/comment/42894330
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27205811
has text: flush() is pointless, it happens in commit. You haven't added anything to receivedVotes at any point (set it at both sides of the relation).

http://stackoverflow.com/a/27260064
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42994123
answers question: http://stackoverflow.com/q/27259957
downvote count: 0
has comment: http://stackoverflow.com/comment/42994156
has body: Consider the number of times the loops run. The first goes for sqrt(n) / 2 iterations, the second sqrt(n) / 4 and the last for 8 + j where j is some value (constant in the loop). Thus, for this entire code we have a complexity of sqrt(n) / 2 + sqrt(n) / 4 + 8 + j. In order to get the Big O notation, we take the fastest increasing one of these, ignoring constants i.e. sqrt(n). This gives us that the code runs in sqrt(n) time for a large n. Now we simply have to find an n such that sqrt(n) = 40 which is simply 40^2 = 1600. Note also that this question is a bit silly, considering that Big O notation deals with only comparisons with large values of n (as we disregard constants and most terms). As such to do any form of computation like this with them is very odd indeed.

http://stackoverflow.com/q/27226958
answer count: 1
has comment: http://stackoverflow.com/comment/42932788
has title: Apache Camel : Polling the old files when I run as stand alone java project. Is there a way to poll only the new files
has body: I have a requirement to transfer the files from my local specific folder location to other location. I am using Apache Camel as a stand alone project and here is my code from(file:&lt;location&gt;?noop=true).to(file:&lt;location&gt;) Whenever I run as a Java project, It keeps on polling the old files as well which is moved on previous run. Is there a way to poll only the new files and also I am unable to log the file transfers Example: On First run : source directory has Folder1/image1 from(file:Folder1?noop=true).to(file:Folder2) Will move the image1 to Folder2 location and image1 will remain in the Folder1. Now I am going to run the java file again and I added one more file image2 to the source directory FFolder1/image1 &amp; image2 Now In this case I want only the image2 file to be processed, but the code process the image1 as well.
has comment: http://stackoverflow.com/comment/42932285
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42931732
has comment: http://stackoverflow.com/comment/42932673
tagged with: apache-camel
has answer: http://stackoverflow.com/a/27234942
accepted answer: http://stackoverflow.com/a/27234942
has comment: http://stackoverflow.com/comment/42931566
score: 0

http://stackoverflow.com/comment/43031369
type: Comment
score: 0
has text: @markspace: Correct me if I'm wrong, but the guarantees for `final` only apply to objects *which have never been seen by any other thread*. Consequently, all that would be required to honor `final` semantics is to design the VM so that memory associated with an object won't get cached before a core acquires a reference, and ensure that when a constructor that wrote at least one `final` field exits, all pending writes go out to main RAM before any other writes to main RAM are performed. That could be a lot cheaper than a volatile `read`. Otherwise...
comment on: http://stackoverflow.com/a/27279701
type: AnswerComment

http://stackoverflow.com/comment/43004641
type: Comment
comment on: http://stackoverflow.com/a/27262098
type: AnswerComment
score: 0
has text: Glad, it worked out. Feel free to accept this as the answer to your question.

http://stackoverflow.com/a/27288199
answers question: http://stackoverflow.com/q/27277210
upvote count: 4
has comment: http://stackoverflow.com/comment/127852549
type: AcceptedAnswer
downvote count: 0
has body: This solution creates a third PDF file with the contents like you asked for. Note that pages are zerobased, so the "3" in your question must be a "2". PDDocument a1doc = PDDocument.load(file1); PDDocument b1doc = PDDocument.load(file2); PDDocument resDoc = new PDDocument(); List&lt;PDPage&gt; a1Pages = a1doc.getDocumentCatalog().getAllPages(); List&lt;PDPage&gt; b1Pages = b1doc.getDocumentCatalog().getAllPages(); // replace the 3rd page of the 2nd file with the 1st page of the 1st one for (int p = 0; p &lt; b1Pages.size(); ++p) { if (p == 2) resDoc.addPage(a1Pages.get(0)); else resDoc.addPage(b1Pages.get(p)); } resDoc.save(file3); a1doc.close(); b1doc.close(); resDoc.close(); If you want to work from the command line instead, look here: https://pdfbox.apache.org/commandline/ Then use PDFSplit and PDFMerge.
has comment: http://stackoverflow.com/comment/127955073
has comment: http://stackoverflow.com/comment/127954764
type: Answer
has comment: http://stackoverflow.com/comment/43047902
has comment: http://stackoverflow.com/comment/43047780
accepted answer of: http://stackoverflow.com/q/27277210
has comment: http://stackoverflow.com/comment/127857467
score: 4

http://stackoverflow.com/comment/42980354
has text: Are you sure the file exists cause this code works fine for me...make sure you declare `String testFile;` I don't see it declared anywhere also `Scanner S = new Scanner(System.in);`.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27252959

deserialization
type: Tag
tags question: http://stackoverflow.com/q/27174238
tags question: http://stackoverflow.com/q/27275127
tags question: http://stackoverflow.com/q/27306176
tags question: http://stackoverflow.com/q/27277724
tags question: http://stackoverflow.com/q/27309645
tag name: deserialization
tags question: http://stackoverflow.com/q/27191973
tags question: http://stackoverflow.com/q/27238657
tags question: http://stackoverflow.com/q/27194787
tags question: http://stackoverflow.com/q/27221035
tags question: http://stackoverflow.com/q/27250386

http://stackoverflow.com/comment/43064499
comment on: http://stackoverflow.com/a/27295642
type: Comment
has text: @stokito : the problem occurs on strings that have no zone information to be parsed.
score: 1
type: AnswerComment

http://stackoverflow.com/a/27202878
upvote count: 3
has comment: http://stackoverflow.com/comment/42888698
downvote count: 1
answers question: http://stackoverflow.com/q/27202855
type: Answer
score: 2
has body: Short answer: no, you need to import it. Having said this, you could still execute A.g() without importing if you use refection API. Keep in mind that would add unnecessary complexity to your code.

http://stackoverflow.com/q/27169954
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to store password in ldap server using java
has body: I need to store password in the ldap server using java code.I have to specify any of the encryption method available from ldap while storing the password.how to do it??
answer count: 2
has answer: http://stackoverflow.com/a/27170844
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27170063

http://stackoverflow.com/a/27285588
has body: For the first block of code: 406 means Not Acceptable. Look at your request() method target.request(MediaType.TEXT_XML_TYPE). From the Javadoc of request() if states Invocation.Builder request(MediaType... acceptedResponseTypes) Start building a request to the targeted web resource and define the accepted response media types. Invoking this method is identical to: webTarget.request().accept(types); So basically, in your request, you are saying that you will only Accept: text/plain. Now look at your resource methods. Look at the @Produces. None of them "produce" text/plain. It's all json or xml. That's why you get the exception. Change the accept to application/xml (or MediaType.APPLICATION_XML) on the client side, and you should no longer get this error. For the second question: I'm assuming you mean why does it work when you test it from the browser. If you send a request from the browser by simply typing in the url, it will send out the request with many Accept types. If you have firebug (for FireFox) or the developer tools (for Chrome), if you send out a request, you will see a header similar to Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 You can see application/xml in there. Even if application/xml wasn't there, the wild card */* is there, so basically almost all media types are acceptable as a return type when working in the browser. For your last question: Look at the API for SyncInvoker, which Invocation.Builder extends from. You will see different overrloaded put and post methods, most of which, as you mentioned accept an Entity. There are a few different ways to build an Entity, all of which use one of the static methods. Here are some Entity.entity( body, mediaType ) Entity.json( body ) Entity.xml( body ) And many more (see the Entity link above). But all of these static method return an Entity. So we could do something like // resource method @POST @Consumes(MediaType.APPLICATION_XML) public Response getResponse(Customer custome…
has comment: http://stackoverflow.com/comment/43047765
has comment: http://stackoverflow.com/comment/43048541
upvote count: 3
has comment: http://stackoverflow.com/comment/43052320
has comment: http://stackoverflow.com/comment/43052584
has comment: http://stackoverflow.com/comment/43047763
has comment: http://stackoverflow.com/comment/43051920
has comment: http://stackoverflow.com/comment/43047041
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43047572
has comment: http://stackoverflow.com/comment/43047789
has comment: http://stackoverflow.com/comment/43048552
has comment: http://stackoverflow.com/comment/43052654
has comment: http://stackoverflow.com/comment/43086370
has comment: http://stackoverflow.com/comment/43046746
accepted answer of: http://stackoverflow.com/q/27284046
has comment: http://stackoverflow.com/comment/43051792
type: Answer
answers question: http://stackoverflow.com/q/27284046
score: 3
has comment: http://stackoverflow.com/comment/43047479
has comment: http://stackoverflow.com/comment/43047027
downvote count: 0
has comment: http://stackoverflow.com/comment/43046984
has comment: http://stackoverflow.com/comment/43048672
has comment: http://stackoverflow.com/comment/43047110
has comment: http://stackoverflow.com/comment/43046909
has comment: http://stackoverflow.com/comment/43047006
has comment: http://stackoverflow.com/comment/43052402
has comment: http://stackoverflow.com/comment/43048464

http://stackoverflow.com/q/27288644
type: Question
has title: ByteBuffer's equals
answer count: 2
has comment: http://stackoverflow.com/comment/43045985
has answer: http://stackoverflow.com/a/27290868
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/46476235
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27292446
linked to: http://stackoverflow.com/q/964332
tagged with: bytebuffer
tagged with: memory-mapped-files
has comment: http://stackoverflow.com/comment/43048379
has body: I have a boolean method of files comparison. It get's part of bb and check out on equal. If parts equal - get next block. If position (point) > file size and all blocks are equal - return true. Works on small files (10MB), but have troubles on big one. private static boolean getFiles(File file1, File file2) throws IOException { FileChannel channel1 = new FileInputStream(file1).getChannel(); FileChannel channel2 = new FileInputStream(file2).getChannel(); int SIZE; MappedByteBuffer buffer1, buffer2; for (int point = 0; point &lt; channel1.size(); point += SIZE) { SIZE = (int) Math.min((4096*1024), channel1.size() - point); buffer1 = channel1.map(FileChannel.MapMode.READ_ONLY, point, SIZE); buffer2 = channel2.map(FileChannel.MapMode.READ_ONLY, point, SIZE); if (!buffer1.equals(buffer2)) { return false; } } return true; } How can I modify it? Change the size of blocks?
tagged with: equals

http://stackoverflow.com/q/27273581
has body: A discussion in Code Review chat determined the following behaviour from a ScheduledExecutorService: A task scheduled to run fails with a 'serious' problem, but there's no report, exception, or log of the problem. In other contexts, the application would normally terminate with an Error. In the context of the ScheduledExecutorService, though, there is no Exception/Error 'handling' at all. First, to fabricate a problem. The following class has a static initializer that is guaranteed to fail: public class InitializerFault { private static final int value = Integer.parseInt("fubar"); @Override public String toString() { return "" + value; } } When run as: public static void main(String[] args) { System.out.println(new InitializerFault()); } it produces (which is exactly what I would expect): Exception in thread "main" java.lang.ExceptionInInitializerError at SimpleHandler.main(SimpleHandler.java:5) Caused by: java.lang.NumberFormatException: For input string: "fubar" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at InitializerFault.<clinit>(InitializerFault.java:4) ... 1 more But, when run as: private static final Thread buildThread(Runnable r) { Thread t = new Thread(r, "TestThread"); t.setDaemon(true); System.out.println("Built thread " + t); return t; } public static void main(String[] args) throws InterruptedException { // use a thread factory to create daemon threads ... can be non-daemon as well. ScheduledExecutorService ses = Executors.newScheduledThreadPool( 2, (r) -> buildThread(r)); ses.scheduleAtFixedRate( () -> {System.out.println(new InitializerFault());}, 500, 1000, TimeUnit.MILLISECONDS); Thread.sleep(3000); System.out.println("Exiting"); } it produces just: Built thread Thread[TestThread,5,main] Exiting There is no mention of any error, no fault, no dump, nothing. This ExceptionInInitializerError has resulted in a complicate…
favorite count: 0
has comment: http://stackoverflow.com/comment/43022009
tagged with: scheduledexecutorservice
type: Question
tagged with: exception
answer count: 1
upvote count: 13
tagged with: java
linked to: http://stackoverflow.com/q/3875739
has title: ScheduledExecutorService and uncaught Error
downvote count: 0
type: UnansweredQuestion
score: 13
has answer: http://stackoverflow.com/a/27273868

http://stackoverflow.com/q/27219898
has answer: http://stackoverflow.com/a/27227044
score: 5
downvote count: 0
tagged with: jsp
has title: Convert String to Integer JSP
favorite count: 0
has answer: http://stackoverflow.com/a/44888795
answer count: 5
tagged with: http://stackoverflow.com/tag/html
has body: I am a beginner using JSP. I want to display a list of incrementing integers using a maximum range of the users choice. Entering: 6 should display the following: number 1 number 2 number 3 number 4 number 5 number 6 input.jsp &lt;body&gt; &lt;input type="number" name="numberMax" required&gt; &lt;input type="submit" value="submit"&gt; &lt;/body&gt; jspResult.jsp &lt;body&gt; &lt;% int numberMax = request.getParameter("numberMax"); // Cannot convert from String to int %&gt; for (int i = 1; i &lt;= numberMax; i++) { %&gt; &lt;ul&gt; &lt;li&gt;&lt;%= i %&gt;&lt;/li&gt; &lt;/ul&gt; &lt;% } %&gt; &lt;/body&gt; How can I convert the input to an integer in order for the jsp scriptlet to print.
has answer: http://stackoverflow.com/a/27226625
accepted answer: http://stackoverflow.com/a/27226625
upvote count: 5
possible better answer: http://stackoverflow.com/a/44888795
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42918993
tagged with: java
tagged with: scriptlet
has answer: http://stackoverflow.com/a/31362974
type: Question
has answer: http://stackoverflow.com/a/27219952

search-engine
type: Tag
tags question: http://stackoverflow.com/q/27169522
tag name: search-engine

http://stackoverflow.com/a/27187616
has comment: http://stackoverflow.com/comment/42894980
answers question: http://stackoverflow.com/q/27186782
downvote count: 2
has body: This should solve your problem. Scanner input = new Scanner(System.in); //Convert the Scanner object to a String String str = input.toString(); //Get the beginning index for "nice" int begin = str.indexOf("nice"); //Get the ending index for "nice" int end = str.indexOf(" ", begin ); //Replace the string between begin and end with NICE str.replace("nice", "NICE");
score: -2
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/42863237

http://stackoverflow.com/q/27296249
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: NLS_CHARACTERSET WE8ISO8859P1 and UTF8 issues in Oracle
has comment: http://stackoverflow.com/comment/43057478
has comment: http://stackoverflow.com/comment/43057724
has answer: http://stackoverflow.com/a/27296789
upvote count: 4
score: 3
answer count: 1
has body: I am currently using a Database in oracle which has NLS_CHARACTERSET WE8ISO8859P1 so lets say I store a value in varchar2 field which is maž (accented character) so in database it gets stored as maå¾ . Now when I try to retrieve it with query select * from table where fieldValue = 'maž' it returns 0 rows, and then when i try to insert it again it gives me a constraint error saying value already exist. How to overcome such situation. I am doing this via Java code
favorite count: 0
accepted answer: http://stackoverflow.com/a/27296789
tagged with: oracle-database

http://stackoverflow.com/comment/42892998
comment on: http://stackoverflow.com/q/27204997
score: 0
has text: I am sorry, I not understand your meaning :(
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42925663
has text: If you have say defined @WebFault for class FaultResponse with custom message structure, then you can throw FaultReponse
comment on: http://stackoverflow.com/a/27193472
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27217565
tagged with: file
type: Question
possible better answer: http://stackoverflow.com/a/27217640
has answer: http://stackoverflow.com/a/27217622
tagged with: java
has answer: http://stackoverflow.com/a/27217640
has comment: http://stackoverflow.com/comment/42914770
score: 0
has comment: http://stackoverflow.com/comment/42914890
answer count: 2
tagged with: arraylist
has body: I have created this code to save students info to txt file but it only saves the name. I can't find what's wrong with this any ideas? I'm not getting any errors programma runs just fine expect some error handling and other things i have to add. Main class public class Main { public static void main(String[] args) throws IOException { File fileName = new File("Students.txt"); ArrayList Students = new ArrayList(); String studentName = " "; String studentSName = " "; String idstudent = " "; String course = " "; while (!studentName.isEmpty()) { studentName = JOptionPane.showInputDialog("Student's Name: "); studentSName = JOptionPane.showInputDialog("Student's Surname: "); idstudent = JOptionPane.showInputDialog("Student's IDnumber: "); course = JOptionPane.showInputDialog("Student's Course: "); if (!studentName.isEmpty()) { Students.add(studentName); } } try { FileWriter fw = new FileWriter(fileName); Writer output = new BufferedWriter(fw); int sz = Students.size(); for (int i = 0; i &lt; sz; i++) { output.write(Students.get(i).toString() + "\n"); } output.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "file not found"); } } } 2nd class: public class filereading { public static void main(String[] args) { String FileName = "students.txt"; String line; ArrayList Students = new ArrayList(); try { BufferedReader input = new BufferedReader(new FileReader(FileName)); if (!input.ready()) { throw new IOException(); } while ((line = input.readLine()) != null) { Students.add(line); } input.close(); } catch (IOException e) { System.out.println(e); } int sz = Students.size(); for (int i = 0; i &lt; sz; i++) { System.out.println(Students.get(i).toString()); } } }
has title: Java Array save input to txt file
has comment: http://stackoverflow.com/comment/42914737
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27217622

http://stackoverflow.com/comment/43065572
type: AnswerComment
has text: This isn't what I'm looking for but I used some of the codes you inputted which would start the time and get the current time. But it keeps on saying that start_time and current_time should be in long rather than in int. But if I convert it to long the time shown will become 1417716395:1417716295, I don't know what happened.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27300544

http://stackoverflow.com/q/27267544
has comment: http://stackoverflow.com/comment/43006214
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27567836
favorite count: 0
has comment: http://stackoverflow.com/comment/43005996
tagged with: windows
has title: Java code for remote date of other server doesn't run in windows XP (it runs in Windows 8)
has body: I have this code for remote date. Could anyone help me understand how to get this to work in Windows XP or show me code for the same purpose that runs in Windows XP? Thank you very much. try { Date remoteDate = null; URL url = new URL("https://www.google.gr/?gws_rd=ssl"); URLConnection urlConn = url.openConnection(); HttpURLConnection conn1 = (HttpURLConnection) urlConn; conn1.setConnectTimeout(10000); conn1.setReadTimeout(10000); conn1.setInstanceFollowRedirects( true ); conn1.setRequestProperty( "User-agent", "spider" ); conn1.connect(); Map&lt;String,List&lt;String&gt;&gt; header = conn1.getHeaderFields(); for (String key : header.keySet()) { if (key != null &amp;&amp; "Date".equals(key)) { List&lt;String&gt; data = header.get(key); String dateString = data.get(0); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss"); try { remoteDate = sdf.parse(dateString); System.out.print("hi"+remoteDate); } catch (ParseException ex) { Logger.getLogger(JFrame0.class.getName()).log(Level.SEVERE, null, ex); } break; } } } catch (IOException ex) { Logger.getLogger(JFrame0.class.getName()).log(Level.SEVERE, null, ex); } I've just installed Netbeans and the error is: SEVERE: null java.text.ParseException: Unparseable date: "Wed, 03 Dec 2014 10:18:09 GMT" at java.text.DateFormat.parseenter code here(DateFormat.java:357) at ast_v1.JFrame0.&lt;init&gt;(JFrame0.java:215) at ast_v1.JFrame0$18.run(JFrame0.java:1596) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchT…
score: -1
has comment: http://stackoverflow.com/comment/43006457
type: UnansweredQuestion
tagged with: remote-access
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43006087
tagged with: java

http://stackoverflow.com/q/27188516
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27188921
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42863424
has comment: http://stackoverflow.com/comment/42863322
type: UnansweredQuestion
has body: I am trying to run a project created with GWT. In Intellij Idea I have created a Run Configuration of type GWT Configuration with the folowing: dev mode parameter: -noserver -bindAddress 127.0.0.1 -codeServerPort 9997 -war D:\projects\greensoft\trunk\out\artifacts\sd_extern_war_exploded server: Default When I start it prints: Connected to the target VM, address: '127.0.0.1:60552', transport: 'socket' Nov 28, 2014 12:45:31 PM java.util.prefs.WindowsPreferences &lt;init&gt; WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. Dev Mode initialized. Startup URLs: http://127.0.0.1:8888/chestionar.html?gwt.codesvr=127.0.0.1:9997 http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997 But when I start the server, this url does not work: http://localhost:8080/sd-extern/chestionar.html?gwt.codesvr=127.0.0.1:9997 An alert appears with the error: Plugin failed to connect to Development Mode server at 127.0.0.1:9997 Any ideas? Thank you, Tekin.
has answer: http://stackoverflow.com/a/27203377
has answer: http://stackoverflow.com/a/27188702
has comment: http://stackoverflow.com/comment/42863528
tagged with: java
has title: GWT not working in development mode
type: Question
has comment: http://stackoverflow.com/comment/42863674
tagged with: gwt

http://stackoverflow.com/comment/42833766
has text: to make this expression of double type - the same as ((double) n) / x
comment on: http://stackoverflow.com/a/27171345
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/42897293
score: 0
comment on: http://stackoverflow.com/q/27205096
has text: That's not the error. That's only a parenthetical remark *about* the error. Post, and indeed *read,* the *actual* error message and the stack trace. Edit them into your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/67750323
score: 0
type: Comment
type: QuestionComment
has text: still not solved...
comment on: http://stackoverflow.com/q/27187749

http://stackoverflow.com/comment/42976781
type: AnswerComment
has text: @OlaviMustanoja It would if you wanted to signal an implementation error, but the OP wants this method to be "silently" disabled, or disabled in an acceptable state.
score: 0
comment on: http://stackoverflow.com/a/27241554
type: Comment

http://stackoverflow.com/comment/43056356
comment on: http://stackoverflow.com/a/27295412
type: Comment
type: AnswerComment
has text: @dtrunk : fixed the `@Bean annotation` ... I understand your point, by I'm afraid you are overriding Spring MVC at a lower level and I often read that Spring is extensible but not (easily) modifiable.
score: 0

http://stackoverflow.com/a/52077719
type: Answer
has body: Good news, the FlameGraph repository has "a script" to work with jstacks already in it. https://github.com/brendangregg/FlameGraph It's the stackcollapse-jstack.pl. It seems that by default it expects just stack trace after stack trace in its input, and counts each one as "a sample point." So you can just do multiple jstack's into a file (run this once or a few times, or once a second "for awhile" etc.): jstack pid_of_your_jvm &gt;&gt; my_jstack Then execute that script: ./stackcollapse-jstack.pl my_jstack &gt; my_jstack.folded and finally convert to flamegraph: ./flamegraph.pl --color=java my_jstack.folded &gt; my_jstack.svg No third party helpers required (though they may still be useful). Note also that the stackcollapse-jstack.pl file discards non RUNNABLE threads, you may want to tweak that if you want to also include "idle" threads (typically you don't). Apparently you could use the linux "perf" command to generate stacks for a java process, as well, see the README https://github.com/brendangregg/FlameGraph This might include more native calls, for instance.
score: 8
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/27228972

http://stackoverflow.com/q/27269598
has comment: http://stackoverflow.com/comment/43009672
has comment: http://stackoverflow.com/comment/43010163
type: UnansweredQuestion
has title: Minimum bit program
has comment: http://stackoverflow.com/comment/43010017
tagged with: c++
has comment: http://stackoverflow.com/comment/43009905
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43016399
type: Question
has comment: http://stackoverflow.com/comment/43009634
tagged with: algorithm
answer count: 1
has comment: http://stackoverflow.com/comment/43015422
has answer: http://stackoverflow.com/a/27269861
has comment: http://stackoverflow.com/comment/43012975
has body: I am new in Java. I try to learn it from Java Just in Time. Writer: So program to calculate how many bits would be needed to represent a given number of different values. And program is: int numberOfValues = Integer.parseInt(args[0]); int noOfBits = 0; while (Math.pow(2, noOfBits) &lt; numberOfValues) noOfBits = noOfBits + 1; But book writer is ask to write this in other version. Writer: In this task you will write a variation of the MinimumBitWidth program which works a little more efficiently. Instead of computing a power of 2 in the loop condition on each iteration, your version will accumulate 2 to the power of noOfBits in a separate variable. This can be done by initialising your new variable to 1, and simply doubling its value each time you increment noOfBits. You will use the same test data as used for the previous version of the program. Maybe because of weak English I don't understand what he means. Thanks for help. :)

http://stackoverflow.com/q/27206040
score: 11
accepted answer: http://stackoverflow.com/a/27207281
type: AnsweredQuestion
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/40650965
favorite count: 0
has answer: http://stackoverflow.com/a/27206173
has answer: http://stackoverflow.com/a/35848764
type: Question
tagged with: android
upvote count: 11
has answer: http://stackoverflow.com/a/37962536
linked to: http://stackoverflow.com/q/26675814
tagged with: java
has answer: http://stackoverflow.com/a/27207281
tagged with: gradle
has answer: http://stackoverflow.com/a/35191335
possible better answer: http://stackoverflow.com/a/35682548
answer count: 9
has answer: http://stackoverflow.com/a/33279181
has answer: http://stackoverflow.com/a/35682548
has comment: http://stackoverflow.com/comment/42894553
has answer: http://stackoverflow.com/a/27381873
tagged with: ssl
has title: Android Studio / Intellij, Gradle Error:Cause: peer not authenticated
has body: Having a fight with IntelliJ at the moment. The darn thing won't download Gradle 2.1 I have an Android project hosted on GitHub, which I have cloned to my laptop. I have got working SSL certificates, I know this as I can download SDK software from google using SSL, and I can also download Gradle 1.12. The message I have received from IntelliJ is the rather infamous Error:Cause: peer not authenticated error. From the terminal running IntelliJ I get this: * What went wrong: A problem occurred configuring root project 'SomeAndroidProject'. &gt; Could not resolve all dependencies for configuration ':classpath'. &gt; Could not resolve com.android.tools.build:gradle:0.13.0. Required by: :SomeAndroidProject:unspecified &gt; Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'. &gt; peer not authenticated I have search far and wide across the internet, with no avail. Please help me wise SO guru's!

http://stackoverflow.com/q/27206963
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27207062
has title: new to json parsing - how to get an array within an array
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27207105
possible better answer: http://stackoverflow.com/a/27207038
has answer: http://stackoverflow.com/a/27207038
has body: from the following link , I need to get the value stored in "media". Here is my code: Content = Content.replace("jsonFlickrFeed(", ""); Content = Content.replace("})", "}"); jsonResponse = new JSONObject(Content); JSONArray jsonMainNode = jsonResponse.optJSONArray("items"); // this works great! But I can not access past "items"
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27207062
tagged with: android

http://stackoverflow.com/q/27240662
tagged with: java
has comment: http://stackoverflow.com/comment/42957811
has comment: http://stackoverflow.com/comment/42957955
type: Question
tagged with: iterator
tagged with: hashmap
tagged with: arraylist
score: 0
has body: I want to iterate through each key of a hashmap and compare it to each key below it (so I don't compare keys twice). I want to see which slopes are perpendicular to each other. If the product of the slopes is -1, they are and I will do something with the arraylists with those keys. So far I have built the map using: Map&lt;Double, List&lt;Double&gt;&gt; map = new HashMap&lt;Double, List&lt;Double&gt;&gt;(); for(int i = 0; i &lt; n; i++) { for(int j = i + 1; j &lt; n; j++) { if(line[4][i] == line[4][j]) { double distance = 7.0; //distance(); List&lt;Double&gt; array = (map.containsKey(line[4][i])) ? map.get(line[4][i]):new ArrayList&lt;Double&gt;(); array.add(distance); map.put(line[4][i], array); // System.out.println(Arrays.asList(array)); // System.out.println(distance); } } } And attempt to iterate through the map with: Iterator&lt;Entry&lt;Double, List&lt;Double&gt;&gt;&gt; i = map.entrySet().iterator(); while(i.hasNext()) { Entry next = i.next(); i.remove(); for(Entry e : map.entrySet()) { System.out.println(next + " " + e); //ERROR: The method parseDouble(String) in the type Double is not applicable for the arguments (Object) if((Double.parseDouble(next.getKey()) * (Double.parseDouble(e.getKey()))) == -1) System.out.println("pair"); //do something } } But I can't parse an object to a double, and I'm lost as to how to continue. Any help is appreciated
has title: Iterating through hashmap keys and comparing
answer count: 1
has comment: http://stackoverflow.com/comment/42957848
has answer: http://stackoverflow.com/a/27240884
accepted answer: http://stackoverflow.com/a/27240884
type: AnsweredQuestion

http://stackoverflow.com/q/27188536
has comment: http://stackoverflow.com/comment/44159758
has comment: http://stackoverflow.com/comment/42863523
has answer: http://stackoverflow.com/a/40147626
tagged with: android
accepted answer: http://stackoverflow.com/a/40147626
has comment: http://stackoverflow.com/comment/60520825
linked to: http://stackoverflow.com/q/11820266
has answer: http://stackoverflow.com/a/74753904
tagged with: android-recyclerview
linked to: http://stackoverflow.com/q/49460762
has answer: http://stackoverflow.com/a/51901956
has comment: http://stackoverflow.com/comment/42863876
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/60520789
tagged with: performance
has comment: http://stackoverflow.com/comment/44772141
linked to: http://stackoverflow.com/q/37885863
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/40189168
linked to: http://stackoverflow.com/q/29363321
has answer: http://stackoverflow.com/a/51005659
type: Question
linked to: http://stackoverflow.com/q/60880908
has answer: http://stackoverflow.com/a/62981958
has answer: http://stackoverflow.com/a/28236828
score: 97
has answer: http://stackoverflow.com/a/45939145
has answer: http://stackoverflow.com/a/40259895
has answer: http://stackoverflow.com/a/47702290
possible better answer: http://stackoverflow.com/a/29646809
answer count: 16
has answer: http://stackoverflow.com/a/54249806
has answer: http://stackoverflow.com/a/47816939
has answer: http://stackoverflow.com/a/37752666
has answer: http://stackoverflow.com/a/29646809
has answer: http://stackoverflow.com/a/48450411
has comment: http://stackoverflow.com/comment/60515936
has body: I have created RecyclerView example basing on Creating Lists and Cards guide. My adapter have a pattern implementation only for inflate the layout. The problem is the poor scrolling performance. This in a RecycleView with only 8 items. In some tests I verified that in Android L this problem does not occurs. But in the KitKat version the decreasing of performance is evident.
has comment: http://stackoverflow.com/comment/42882243
favorite count: 0
has comment: http://stackoverflow.com/comment/60521847
upvote count: 97
has comment: http://stackoverflow.com/comment/60521933
has title: Android RecyclerView Scrolling Performance
has answer: http://stackoverflow.com/a/48907364

http://stackoverflow.com/q/27271688
answer count: 2
downvote count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/43013351
favorite count: 0
type: UnansweredQuestion
has title: Methods' outputting twice with arrays
has comment: http://stackoverflow.com/comment/43013310
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43013279
tagged with: methods
has answer: http://stackoverflow.com/a/27271979
type: Question
has answer: http://stackoverflow.com/a/27271807
linked to: http://stackoverflow.com/q/11643222
score: -2
has body: I have to basically make a program that would add a name given a prompt and place it in the array. It should do the same for the age of the person. I have been forced to do this with methods. The only issue i am having is that with the 3rd last line, the name get's asked twice. I don't know how to fix that. Any help is appreciated. public class Testing1 { public static int[] ageinput(String names[], int q2){ int holderage[] = new int[q2]; for(int x = 0; x&lt;q2;x++) {`` System.out.println("Please input the age of " + names[x]); Scanner age = new Scanner(System.in); int a1 = age.nextInt(); holderage[x] = a1; } return holderage; } public static String[] nameinput(int q2){ String holdername[] = new String[q2]; for (int x = 0; x&lt;q2;x++) { System.out.println("Please input the name of the person"); Scanner name = new Scanner(System.in); String n1 = name.nextLine(); holdername[x]=n1; } return holdername; } public static void output(String names[], int ages[]){ for(int x = 0; x&lt;names.length;x++){ System.out.println(names[x]+" is "+ages[x]+" years old"); } } public static void main(String[] args) { System.out.println("How many names do you want to input?"); Scanner question = new Scanner(System.in); int q1 = question.nextInt(); output(nameinput(q1),ageinput(nameinput(q1),q1)); } }
has comment: http://stackoverflow.com/comment/43013321

http://stackoverflow.com/a/27267440
type: Answer
has comment: http://stackoverflow.com/comment/43006312
answers question: http://stackoverflow.com/q/27267345
upvote count: 1
score: 1
has body: That's probably you are missing a comma after your "Would you like to ry again?" string in below: JOptionPane.showInputDialog(null, "Would you like to ry again?" JOptionPane.YES_NO_OPTION, JOptionPane.Question_Message, null, options, options [0]); It should be: JOptionPane.showInputDialog(null, "Would you like to ry again?", JOptionPane.YES_NO_OPTION, JOptionPane.Question_Message, null, options, options [0]); Also you defined scanner as below: static Scanner Scan new = Scanner (System.in); Which should be static Scanner Scan = new Scanner (System.in); Another thing is i dont see you defined options anywhere. So you might need to declare and initialize it before using in below line: JOptionPane .showInputDialog(null, "Would you like to ry again?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); Note: Java is case sensitive, so Question_Message is not same as QUESTION_MESSAGE.
has comment: http://stackoverflow.com/comment/43006115
downvote count: 0

http://stackoverflow.com/q/27276084
has title: JButton added but not showing up at runtime
tagged with: button
has answer: http://stackoverflow.com/a/27276763
has answer: http://stackoverflow.com/a/27276170
possible better answer: http://stackoverflow.com/a/27276763
accepted answer: http://stackoverflow.com/a/27276170
favorite count: 0
score: -1
tagged with: swing
tagged with: jbutton
has comment: http://stackoverflow.com/comment/43021439
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43057477
tagged with: java
has body: I'm using a book to learn java. I'm have made a Swing window but when I try to make JButtons, they are not visible at runtime. I've copied the code exactly as it is, but it is still not visible. Here is the code: import javax.swing.*; class Buttons extends JFrame { JPanel pnl = new JPanel(); public Buttons() { super("Swing Window"); setSize(500,200); setDefaultCloseOperation(EXIT_ON_CLOSE); add(pnl); setVisible(true); pnl.add(new JButton("Click Me")); } public static void main(String[] args) { Window gui = new Window(); } }
downvote count: 1
type: Question
answer count: 2
upvote count: 0

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/27181874
tag name: android-gridview

http://stackoverflow.com/comment/109401443
type: AnswerComment
has text: @yadab, How did this answer get 2 upvotes when it completely contradicts the other answers?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27254766

http://stackoverflow.com/comment/43049014
type: Comment
comment on: http://stackoverflow.com/a/27291083
has text: so the full path to the client.jar is the following? /Applications/MyApp.app/Contents/Java/libs/myJar.jar?
type: AnswerComment
score: 0

http://stackoverflow.com/a/27291782
score: 0
type: Answer
has body: considering both the best and worst case scemerios, both of your choices will be equally efficent because in both the cases same number of comparisons are to be performed... but as answered by jon first one will be little readable than the second one... what if you also try switch case ... that will have a performance edge i guess..
answers question: http://stackoverflow.com/q/27291479

http://stackoverflow.com/a/27285552
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43066470
answers question: http://stackoverflow.com/q/27272857
has body: C extends Client&lt;N,C&gt;, but Client&lt;N,C&gt; (the type of this) does not necessarily extend C (the parameter type of attachOtherClient()). but it is impossible to create subclasses that breaks this safety Not impossible. Consider class TCP extends Network&lt;MK, TCP&gt; { } class MK extends Client&lt;TCP, MK&gt; { } class MK2 extends Client&lt;TCP, MK&gt; { } This satisfies all the bounds and compiles properly. Yet inside MK2, if you pass this to attachOtherClient(), you will be passing a MK2 to something that expects MK, which is obviously wrong.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43047461
score: 1
accepted answer of: http://stackoverflow.com/q/27272857

http://stackoverflow.com/q/27204308
has answer: http://stackoverflow.com/a/27204617
tagged with: tostring
has title: How to print out instance of object that is stored in an array
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42891781
tagged with: java
has comment: http://stackoverflow.com/comment/42891497
has comment: http://stackoverflow.com/comment/42891295
type: Question
has body: So I need to print out the different instances of the array. Using the code below. Everything in the array prints out even the portion of the array that is not filled with anything. If i add a break statement in each if statement it only prints the last instance of that array and not everything that that stored. public static void display(ExampleA[] example) { for(int pos = 0; pos &lt; example.length; pos++) { output += "Example number " + (i + 1); if(example[pos] instanceof A) { output += example[pos].toString() + "\n\n"; } if(example[pos] instanceof B) { output += example[pos].toString() + "\n\n"; } } What I would like it to do is print out everything in the array grouped together by the instance. and not the whole array that is partially empty.
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/27204617
score: 0
has comment: http://stackoverflow.com/comment/42902603
has comment: http://stackoverflow.com/comment/42892171
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42891455
favorite count: 0
tagged with: instanceof

http://stackoverflow.com/a/27225005
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42930187
has body: If you are using eclipse, try clean project, and then clean Tomcat directory. Also make sure that maven dependencies are present in WEB-INF/lib, if not, this is configurable from Project Properties > Deployment Assembly
accepted answer of: http://stackoverflow.com/q/27224936
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42930725
answers question: http://stackoverflow.com/q/27224936
has comment: http://stackoverflow.com/comment/42930599
has comment: http://stackoverflow.com/comment/42931259

http://stackoverflow.com/comment/42852639
type: AnswerComment
has text: If that's the case, then it could be shifted to `List<? super CursorContainer>`. I didn't see anywhere that we were writing to the list at first (I *guess* that's what `list(new **?**(cursor));` means), but I also don't see anywhere that we read from the list, either.
type: Comment
comment on: http://stackoverflow.com/a/27182292
score: 0

http://stackoverflow.com/comment/42885215
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27187321
has text: check this link out maybe there is some problem in your default encoding: http://decoding.wordpress.com/2010/03/18/eclipse-how-to-change-the-console-output-encoding/
score: 0

http://stackoverflow.com/comment/42975166
type: Comment
has text: I have in that bean @Expose private String title;
comment on: http://stackoverflow.com/a/27249942
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43062868
score: 0
comment on: http://stackoverflow.com/q/27299261
has text: I wonder if it's JavaFX or your window manager creating the shadow?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/45056643
comment on: http://stackoverflow.com/q/27270121
score: 0
type: Comment
type: QuestionComment
has text: Baidu Maps requires you to register the SDK, are you sure you did that first?

http://stackoverflow.com/comment/43087348
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27295160
has text: @DaveSyer You're right, this was my first direction. However, I thought that creating one OAuth2RestTemplate per resource owner would not be performant at all. Especially, since I'm interacting with the same server, I wanted to reuse TCP connections but I don't think it's possible when multiple OAuth2RestTemplate are used, right?

http://stackoverflow.com/q/27188953
has body: I have started working on Lucene (v 4.10.2) Search Based Ranking/Scoring. Consider the following Scenario: I am searching 'Mark' in my search box. Auto-complete result shows Top 5 people named 'Mark' (although there might be hundreds of Mark in the Lucene index files). I go on Mark Zuckerberg's profile which is placed on 4th place in the beginning of the search. Say I have clicked his profile a lot of times. Now according to me, next time I search 'Mark', 'Mark Zuckerberg' should come at the top of the list. Several questions coming in my mind (even I don't know that I'm on right track or not): 1) How to achieve this using Lucene library ? (Automated or custom based scoring) 2) Can we change the scoring after any search? 3) Does Lucene library stores the scoring in indexed files? 4) Can we store the scoring in the indexed files? Please let me know if I'm on the right track or not.
has answer: http://stackoverflow.com/a/27208617
tagged with: lucene
type: Question
tagged with: search
answer count: 1
downvote count: 0
favorite count: 0
score: 2
has title: Automated vs Custom Lucene Scoring
upvote count: 2
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42996720
comment on: http://stackoverflow.com/a/27247974
score: 0
type: AnswerComment
type: Comment
has text: Yes, we check and cast the document objects to the actual type.

http://stackoverflow.com/q/27171066
tagged with: bullet
type: Question
has body: Please let me understand the following: 1)Is there any limitations on maximum size of a model (from blender exported to fbx to g3dj) that can be loaded in libgdx. 2)Is There any Limitations on maximum size of an object that bullet physics can handle. And also can any one please provide on best practices for Models and corresponding physics objects that can be followed to have better efficiancy. Thank you.
tagged with: game-physics
tagged with: blender
tagged with: libgdx
score: 0
answer count: 1
has title: Libgdx blender bullet Maximum size of model , object
has comment: http://stackoverflow.com/comment/42837696
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27173482
has comment: http://stackoverflow.com/comment/42851741
tagged with: java

http://stackoverflow.com/a/27206064
has body: Get the intent which has started your activity using the getIntent() method: Intent intent = getIntent(); Your data is represented as strings, then you can use intent.getStringExtra(String name) method. In your case: String id = intent.getStringExtra("id"); String name = intent.getStringExtra("name");
answers question: http://stackoverflow.com/q/27205978
score: 0
type: Answer

http://stackoverflow.com/comment/43034177
has text: "...after its parent thread "dies"?..." I don't know about .NET, but in Java, there is no parent/child relationship between threads. If thread P created thread C, that may mean something to your application, but it means nothing to the JVM.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27282515
type: QuestionComment

http://stackoverflow.com/comment/42954401
type: AnswerComment
comment on: http://stackoverflow.com/a/27238856
type: Comment
score: 1
has text: @hfontanez: I agree, better to go M-V-C if possible.

http://stackoverflow.com/comment/43054583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27294864
has text: @Eypros I guess what he wants is some kind of "replace everything but `xyz` with `---`" instead of "replace `xyz` with `---`". Most probably the question could be rephrased to: Please tell me how to use a regular expression replace accordingly.

http://stackoverflow.com/a/27243686
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42963173
has comment: http://stackoverflow.com/comment/42963246
score: 0
answers question: http://stackoverflow.com/q/27243098
has comment: http://stackoverflow.com/comment/42963418
has comment: http://stackoverflow.com/comment/42963137
has comment: http://stackoverflow.com/comment/43064276
type: Answer
has comment: http://stackoverflow.com/comment/42996292
accepted answer of: http://stackoverflow.com/q/27243098
has comment: http://stackoverflow.com/comment/42998254
has body: You are getting null from the other class is because you are creating a new object rather then passing the value into the other class. This can be done by putting a constructor inside your UserMainWindow class and accepting a String for the name. If you already have a constructor just accept String as a parameter and create a variable for the string and set it.. example code : (NOTE this is the UserMainWindow class) private String savedName; public UserMainWindow(String savedName){ this.savedName = savedName; } now in the class you are creating this object, pass it the string like this: (and this is the class you are creating the userMainWindow class) UserMainWindow wind = new UserMainWindow(savedName); Now you should have savedName saved inside your other frame (user main window) while the other frame is discarded.
has comment: http://stackoverflow.com/comment/43072812
has comment: http://stackoverflow.com/comment/42989805
has comment: http://stackoverflow.com/comment/42963258

http://stackoverflow.com/q/27251443
tagged with: java
tagged with: listview
type: Question
tagged with: array-address
score: 0
has comment: http://stackoverflow.com/comment/42976953
tagged with: android
has comment: http://stackoverflow.com/comment/42977595
has comment: http://stackoverflow.com/comment/42977804
has body: In android application I am using adapter for populating ListView control like below: public class ChildActivity extends ActionBarActivity implements GetChildList { private ListView lv_child; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_child); List&lt;String&gt; array = new ArrayList&lt;String&gt;(); // for e.g array ["num1", "num2"] lv_child = (ListView)findViewById(R.id.lv_child); ArrayAdapter&lt;String&gt; adapterChild = new ArrayAdapter&lt;String&gt;(ChildActivity.this, android.R.layout.simple_list_item_1,array); lv_child.setAdapter(adapterChild); } } but i don't understand where its is simple_list_item_1 declare at this line ArrayAdapter&lt;String&gt; adapterChild = new ArrayAdapter&lt;String&gt;(ChildActivity.this, android.R.layout.simple_list_item_1,array); Kindly suggest me, waiting for reply.
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/27249535
has title: where isimple_list_item_1 is declare in adapter parameters android java

http://stackoverflow.com/comment/42834398
has text: But... I can't find that line in your question. Can you post the whole code?
comment on: http://stackoverflow.com/a/27159486
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43051101
type: Comment
type: QuestionComment
has text: I think you may have saved the day! Thank you very much mKorbel.
comment on: http://stackoverflow.com/q/27292117
score: 0

http://stackoverflow.com/comment/42924670
score: 1
comment on: http://stackoverflow.com/q/27223020
type: Comment
type: QuestionComment
has text: This is very likely a behaviour of gedit that you can only work around. Maybe something like `Runtime.getRuntime.exec("bash -c gedit /usr/local/share/SomeFolder/Readme.txt");` can help.

http://stackoverflow.com/comment/42976375
comment on: http://stackoverflow.com/q/27251010
score: 0
type: Comment
has text: No I am selecting the correct element and there are no errors when running via the Grid. Works fine locally.
type: QuestionComment

http://stackoverflow.com/q/27305590
has body: [Update]Problem is different, nothing about csv file format. Question would be "While using File Writer to write a csv file last few records are missing. In my java application i need to append more than 65535 rows in a csv file. but it only writes 65535 rows in a sheet. I haven't used any libraries. some final records missing. how to resolve this.......... public void writeSubmission(){ try { writer = new FileWriter("res/sample.csv"); writer.append("PhraseId"); writer.append(','); writer.append("Sentiment"); writer.append('\n'); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void readTestData(){ String path="res/test.tsv"; Calculation cal=new Calculation(); int counter=0; try { BufferedReader bReader = new BufferedReader(new FileReader(path)); String line; writeSubmission(); bReader.readLine(); while ((line = bReader.readLine()) != null) { String datavalue[] = line.split("\t"); writer.append(datavalue[0]); writer.append(','); try { double value=cal.calculate(datavalue[2]); System.out.println(value); String val; if(value&lt;-0.4) { val="0"; } else if(value&gt;-0.4 &amp;&amp; value&lt;-0.1) { val="1"; } else if(value&gt;-0.1 &amp;&amp; value&lt;+0.1) { val="2"; } else if(value&gt;+0.1 &amp;&amp; value&lt;+0.40) { val="3"; } else{ val="4"; } counter++; writer.append(val); } catch (Exception e) { // TODO Auto-generated catch block System.out.println(e); } writer.append('\n'); } System.out.println(counter); bReader.close(); } catch (FileNotFoundException e) { e.printStackTrace(); System.out.println(e); } catch (IOException e){ e.printStackTrace(); System.out.println(e); } }
type: Question
has comment: http://stackoverflow.com/comment/43074139
score: -2
has comment: http://stackoverflow.com/comment/43074688
has comment: http://stackoverflow.com/comment/43074670
has comment: http://stackoverflow.com/comment/43074712
has comment: http://stackoverflow.com/comment/43073939
upvote count: 2
has comment: http://stackoverflow.com/comment/43073940
has comment: http://stackoverflow.com/comment/43074057
answer count: 2
has comment: http://stackoverflow.com/comment/117053032
has comment: http://stackoverflow.com/comment/43073984
tagged with: http://stackoverflow.com/tag/csv
possible better answer: http://stackoverflow.com/a/27305618
has comment: http://stackoverflow.com/comment/43073876
favorite count: 0
has comment: http://stackoverflow.com/comment/43074361
has title: Write more than 65535 rows in a csv file
linked to: http://stackoverflow.com/q/7121871
has comment: http://stackoverflow.com/comment/43074126
has comment: http://stackoverflow.com/comment/43073818
downvote count: 4
has comment: http://stackoverflow.com/comment/43074167
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27306090
accepted answer: http://stackoverflow.com/a/27306090
has comment: http://stackoverflow.com/comment/43073992
tagged with: java
has answer: http://stackoverflow.com/a/27305618
has comment: http://stackoverflow.com/comment/43074098
has comment: http://stackoverflow.com/comment/43073895
has comment: http://stackoverflow.com/comment/43074148

http://stackoverflow.com/comment/42819844
type: Comment
type: QuestionComment
has text: The perspective in this example is to demonstrate the usefulness of volatile to immediately make available changes to a volatile variable that holds an immutable object. A new cache object is being created on a certain condition and that is the reason for it to be not final.
score: 0
comment on: http://stackoverflow.com/q/27163080

http://stackoverflow.com/comment/66011814
comment on: http://stackoverflow.com/a/27162589
type: Comment
has text: Jersey Test Framework starts and stop container for each test. I want to reuse the Grizzly container for all tests. Do you recommend A) Using JerseyTest and then subclassing TestContainerFactory B) Ignore JerseyTest and use the above approach with Client API? Wonder which one is performance-friendly (I have a jersey app using jersey-spring bridge to achieve DI hence all beans such as dao, service, resource are annotated with spring annotations).
score: 1
type: AnswerComment

http://stackoverflow.com/q/27233669
has title: Is it possible to reverse a linked list with a single statement within a loop?
has answer: http://stackoverflow.com/a/27235240
accepted answer: http://stackoverflow.com/a/27235240
has comment: http://stackoverflow.com/comment/42949946
score: 0
has comment: http://stackoverflow.com/comment/42944734
answer count: 1
has comment: http://stackoverflow.com/comment/42943989
has body: Assume we have ListNode { ListNode next; int number; //gets sets } Is it possible to reverse the list using a loop with only one string whithin a loop? Something like this: for(...) { // only one string of code (one statement) } One guy told me that it's possible but I don't understand how. Can you help with that please? Thanks!
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42943973
tagged with: data-structures

http://stackoverflow.com/comment/42926115
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27224003
has text: did you reboot? It's clearly a PATH issue.
type: Comment

http://stackoverflow.com/comment/42896759
score: 0
type: Comment
type: QuestionComment
has text: Just setting the style (not calling `setDisable()` or `event.consume()`) in the handlers works fine for me. Can you create an [MCVE](http://stackoverflow.com/help/mcve) that demonstrates the problem?
comment on: http://stackoverflow.com/q/27206706

http://stackoverflow.com/comment/43048286
type: Comment
comment on: http://stackoverflow.com/a/27281763
type: AnswerComment
has text: I forgot to write @Override for onPrepared but my answer was right, just a small typo. Compare.
score: 0

http://stackoverflow.com/q/27195604
tagged with: file
answer count: 1
has body: I've tried searching for questions like mine, found alot but non of the answers worked for me. I'm working with Android studio and trying to open a text file from a java class, but no matter what I do or how I'm trying to open it - I'm getting this error: "... open failed: ENOENT (No such file or directory)" As you can see - I also tried two options: 1. creating a "File" class (then at the watches window I tried to invoke - "canRead()" function but getting back "false" value. 2. trying to send the ctor of "FileReader" class the path of my file. non of them worked. thanks alot! public void fillDatabase(){ File file = new File("C:\\fillStops.txt"); SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DELETE FROM " + STOPS_TABLE_NAME); try { FileInputStream fileInputStream = new FileInputStream(file); FileReader fileReader = new FileReader("C:\\fillStops.txt"); BufferedReader bufferedReader = new BufferedReader(fileReader); StringBuffer stringBuffer = new StringBuffer(); String line; while ((line = bufferedReader.readLine()) != null) { this.addStop(line); } fileReader.close(); } catch (Exception e){ String s = e.getMessage(); } }
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42876385
has comment: http://stackoverflow.com/comment/42876765
has answer: http://stackoverflow.com/a/27195995
has comment: http://stackoverflow.com/comment/42876727
has title: Can't read textfile in java (Android studio)
type: Question
tagged with: android
score: 0

http://stackoverflow.com/comment/42872932
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27191581
score: 0
has text: @Marcelo Tataje yes of course I have included that. I already achieved stuff like changing buttons to red if I click them and similar simple stuff but have no idea how to "simulate" movement.

http://stackoverflow.com/comment/43082963
type: Comment
type: QuestionComment
has text: With powermock you can mock static methods but you probably shouldn't unless it's legacy or unavailable for refactoring code. @Abhish you need to clarify your question
comment on: http://stackoverflow.com/q/27311073
score: 0

http://stackoverflow.com/comment/42990733
score: 0
type: AnswerComment
type: Comment
has text: I decided to rename the method `toBigDecimal`.
comment on: http://stackoverflow.com/a/27235713

http://stackoverflow.com/comment/42830999
has text: JDK that was downloaded from Oracle site. http://www.oracle.com/technetwork/java/javase/downloads/index.html
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27169650
score: 0

http://stackoverflow.com/comment/42960806
score: 0
type: AnswerComment
type: Comment
has text: Did you wrote the index for book in your db or else you just put @Indexed annotation in java class automatically consider this table as index.
comment on: http://stackoverflow.com/a/27242294

http://stackoverflow.com/comment/42944850
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27222394
has text: yes i waited for 60 sec i was getting illegalStateException previously....but then i added return statement after rd.forward method.....so now i don't see any illegalStateException in my eclipse console.
score: 0

http://stackoverflow.com/q/27165484
linked to: http://stackoverflow.com/q/5604390
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42825088
has comment: http://stackoverflow.com/comment/42825246
has body: I never worked with type aliases, but this concept seems to be a very useful feature adding semantics over same-typed objects and defending from common typos. Let's say, there is void foo(float volume, float weight). It's ok if it's invoked like this: foo(v, m), but foo(m, v) is not an obvious typo. void process(Iterable&lt;File&gt; javaPath, Iterable&lt;File&gt; classPath) can be another use case. Unfortunately there are no type aliases in Java, and some workarounds are a true overkill: aggregating a single field into a class (boxing a primitive into an object; an object in an object having an extra reference; more complicated serializing/deserializing rules) extending one class from another one (like how do i create some variable type alias in Java - impossible for primitives; classes may be final or have an inaccessible constructor). So both of them have drawbacks and runtime/performance cost. As far as I can see, in Java, runtime-based "type aliasing" might be replaced with compile-time checks, like @NotNull and @Nullable are processed. Are there any static type-alias checkers/APT tools featuring support for constructions like void foo(@Volume float volume, @Weight float weight), so that checker could verify such "type safety" at compile time and require passed variables/constants and literals to be annotated (at declaration and call sites respectively)? This question also has been raised because I'm currently working on a Java-source code processing tool that can use multiple back-ends (currently, JDT only). As long as I want it to be JDT-agnostic, I would like to have business objects for types, methods and fields. Despite, I lose a lot of information coming from JDT AST, the best current approach for my tool is use of strings (it allows to perform some analysis that's enough for the scope of the tool). But methods like void process(String type, String field, String method) are confusing, so I've created Type, Field and Method that represent the domain objects…
score: 1
has title: Java: Type aliases support annotation processing tool (APT)?
tagged with: java
has comment: http://stackoverflow.com/comment/42825275
upvote count: 1
has comment: http://stackoverflow.com/comment/42824578
type: Question
tagged with: annotation-processing
tagged with: type-alias
has answer: http://stackoverflow.com/a/27166828
has comment: http://stackoverflow.com/comment/42825081
tagged with: type-safety
has comment: http://stackoverflow.com/comment/42824994
has comment: http://stackoverflow.com/comment/42825120
has comment: http://stackoverflow.com/comment/42824331
has comment: http://stackoverflow.com/comment/42825192
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43073109
type: Comment
has text: Please tag the question with what programming language you are using.
score: 0
comment on: http://stackoverflow.com/q/27305114
type: QuestionComment

http://stackoverflow.com/q/27304748
has title: Significant performance differences in JTextPane when text contains linefeed
has answer: http://stackoverflow.com/a/27315078
type: UnansweredQuestion
tagged with: jtextpane
tagged with: performance
has body: I wrote a method that writes hello world!\n 10000 times in a JTextPane. I recognized a significant performance drop when using hello world! without linefeed. Example: import java.awt.BorderLayout; import javax.swing.*; import javax.swing.text.*; public class JTextPaneTest { JTextPane textPane = new JTextPane(); Document doc = new DefaultStyledDocument(); //constructor JTextPaneTest() { for(int i=0;i&lt;10000;i++) { try { doc.insertString(doc.getLength(), i+" hello world!", null); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } textPane.setDocument(doc); createWindow(); } public void createWindow() { JFrame frame = new JFrame(); frame = new JFrame("frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setLocationRelativeTo(null); frame.getContentPane().add(new JScrollPane(textPane), BorderLayout.CENTER); frame.setVisible(true); } public static void main(String[] args) { System.out.println("start..."); float startTime = System.nanoTime(); new JTextPaneTest(); float stopTime = System.nanoTime() - startTime; System.out.println("elapsed time main: "+stopTime/1000000000+ "s"); } } what could be the reason for that phenomena? Any ideas?
tagged with: java
has comment: http://stackoverflow.com/comment/43093045
type: Question
answer count: 1
score: 0

http://stackoverflow.com/q/27254147
accepted answer: http://stackoverflow.com/a/27254190
possible better answer: http://stackoverflow.com/a/27254196
tagged with: android
favorite count: 0
has body: This seems really straightforward but I can't get around this exception. I'm using Eclipse ADT and working on a basic Android project. Here's the JSON I'm parsing: { "activated": 1, "message": [ { "type": "dialog", "name": "testdialog01", "list": [ "Truck 001", "Truck 002", "Truck 003", "Truck 004", "Truck 006" ], "heading": "Which truck are you currently driving?", "id": 17 } ] } Here's the code I'm parsing it with: JSONObject jsonRes = new JSONObject(response); JSONArray msgs = jsonRes.getJSONArray("message"); for (int i=0; i&lt;msgs.length(); i++) { JSONObject jsonObj = msgs.getJSONObject(i); String type = jsonObj.getString("type"); String diaName = jsonObj.getString("name"); String diaHeading = jsonObj.getString("heading"); JSONArray diaList = jsonRes.getJSONArray("list"); //exception thrown } The "list" portion of the JSON is a valid JSONArray. Debugger confirms this. I get a "No value for list" JSONException when I hit getJSONArray line above. What gives? The top level "message" array is similar, only its values are wrapped in curly braces whereas "list" is just an array of strings. I tested this JSON at jsonlint.com and it's valid, but maybe just isn't agreeable with the standard org.json API? I don't control the incoming JSON so I'm not able to easily test this theory myself. Thanks!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27254196
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
tagged with: eclipse
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has title: Java: Simple JSON Array throws "org.json.JSONException: No value for ..."
tagged with: arrays
has answer: http://stackoverflow.com/a/27254190

http://stackoverflow.com/q/27293156
has body: I have a http:outbound-gateway as follows: &lt;int:channel id="fromEmployeeChannel" /&gt; &lt;int-http:outbound-gateway url="localhost:8080/api/employees" request-channel="fromEmployeeChannel" http-method="POST" expected-response-type="java.lang.String" reply-channel="employeeAdded" &gt; &lt;/int-http:outbound-gateway&gt; How do I handle the different HTTP response status? Also how to handle error if I receive some error like 404 Not Found?
tagged with: spring-integration
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27294413
has title: Handle http response in Spring Integration
accepted answer: http://stackoverflow.com/a/27294413
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
type: AnsweredQuestion
score: 2

variables
tags question: http://stackoverflow.com/q/27164907
tag name: variables
tags question: http://stackoverflow.com/q/27193309
tags question: http://stackoverflow.com/q/27281172
tags question: http://stackoverflow.com/q/27207400
tags question: http://stackoverflow.com/q/27155504
tags question: http://stackoverflow.com/q/27293966
tags question: http://stackoverflow.com/q/27219641
tags question: http://stackoverflow.com/q/27162365
tags question: http://stackoverflow.com/q/27282489
type: Tag
tags question: http://stackoverflow.com/q/27309396
tags question: http://stackoverflow.com/q/27236183
tags question: http://stackoverflow.com/q/27231532
tags question: http://stackoverflow.com/q/27243098
tags question: http://stackoverflow.com/q/27160797
tags question: http://stackoverflow.com/q/27194258

http://stackoverflow.com/q/27173049
has comment: http://stackoverflow.com/comment/42836567
tagged with: orm
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27173826
score: 0
answer count: 1
has body: I have one parent table with composite primary key (idOne, idTwo): Parent table ----------------- idOne | idTwo |......other columns ----------------- 1 | 11191 2 | 11191 And one child table.Child table key consist of (idOne, idTwo, child_type): Child table ------------------------------------------ idOne | idTwo | child_type .......other columns ------------------------------------------- 1 | 11191 | typeOne 2 | 11191 | typeTwo The POJO structure is bit different. Parent POJO has two variable of reference type Child. Below is the Parent POJO structure Parent ------------ Child typeOneChild; Child typeTwoChild; So while retrieving the data from DB and populating the parent pojo, I also need to populate the typeOneChild and typeTwoChild pojos, based on the child_type column value. If the child_type column value is typeOne, then this row will be used for populate the typeOneChild pojo and for column value typeTwo, it will populate the typeTwoChild. So basically when I will retrieve the parent details it should execute the below sqls: Select * from parent table where idOne=1 and idTwo=11191; Select * from child table where idOne=1 and idTwo=11191 and child_type= 'typeOne' Select * from child table where idOne=1 and idTwo=11191 and child_type= 'typeTwo' I know in normal scenario, the table and pojo structure is not as expected but we cannot change the table and model structure. So please tell me how can I achieve this in hibernate?
type: UnansweredQuestion
has title: How to populate two child member variables of same pojo type in hibernate

http://stackoverflow.com/comment/42938374
score: 1
comment on: http://stackoverflow.com/q/27230742
type: QuestionComment
has text: Use batch for this: https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/batch.html
type: Comment

http://stackoverflow.com/a/27162690
type: Answer
answers question: http://stackoverflow.com/q/27162496
score: 0
has comment: http://stackoverflow.com/comment/42818530
has body: If you are not using maven, generate your projects war file and then go to your webapp directory which is under the tomcat folder. It might be something like that if you are using windows C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps copy war file here. Then under the bin\ start your tomcat with startup.bat. This is old school method without maven. Take a look and research about maven.

http://stackoverflow.com/comment/43056235
has text: I don't think your idea will even been compiled. First, can I really have @Value("${someThingFromPropertyFile}") above static variable? My requirenment is to be able to read the value from any place in my code, so the variable has to been accessible from all code. As far as I remenber I can't compile @Value("$...") above static variable as I can with @Value("#...") above a setMethod setting a static variable. Second, the only significant difference in your suggestion is the getMethod (getUrl) not been static. If I didn't understand your suggestion properly, please correct me.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27282742

http://stackoverflow.com/comment/42958865
type: Comment
comment on: http://stackoverflow.com/a/27240693
score: 0
type: AnswerComment
has text: @Stephen C, there is a way to use `String.replaceAll` in a case-insensitive manner by including `"(?i)"`, as I've demonstrated in my answer

http://stackoverflow.com/comment/42976535
type: Comment
has text: Not being to have a reasonable heuristic is a problem: an overestimating heuristic means that the algorithm can't be guaranteed to find the *shortest* path. If there's no way to come up with such an heuristic, you'll need to use another algorithm
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27249023

client-server
tags question: http://stackoverflow.com/q/27282997
tags question: http://stackoverflow.com/q/27304494
tags question: http://stackoverflow.com/q/27239613
type: Tag
tags question: http://stackoverflow.com/q/27172090
tag name: client-server
tags question: http://stackoverflow.com/q/27186492
tags question: http://stackoverflow.com/q/27204159
tags question: http://stackoverflow.com/q/27214985
tags question: http://stackoverflow.com/q/27213593
tags question: http://stackoverflow.com/q/27269889

http://stackoverflow.com/q/27230221
downvote count: 0
has answer: http://stackoverflow.com/a/27230325
accepted answer: http://stackoverflow.com/a/27230325
score: 1
tagged with: java
type: Question
has title: Access enum name through reflection
has body: I am trying to access the name of an enum through reflection (the name field of the Enum class) but I get a NoSuchFieldException. See below a simple example: the program prints 5 for the Integer but throws an Exception for the enum. Is there an elegant way to get the inspect method to work for enums? public class Test { static enum A { A; } public static void main(String[] args) throws Exception { Integer i = 5; System.out.println(inspect(i, "value")); // prints 5, good A a = A.A; System.out.println(inspect(a, "name")); // Exception :-( } private static Object inspect(Object o, String fieldName) throws Exception { Field f = o.getClass().getDeclaredField(fieldName); f.setAccessible(true); return f.get(o); } }
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: enums
tagged with: reflection

http://stackoverflow.com/q/27195385
tagged with: java
tagged with: ip
type: Question
has title: Why does my chat program only work when both clients are on the same machine?
has comment: http://stackoverflow.com/comment/42875983
has comment: http://stackoverflow.com/comment/42877257
tagged with: udpclient
score: 0
tagged with: udp
has body: I'm learning some UDP and am creating a Client - Server - Client chat program. The way it's set up is that the Server runs first, and is always listening for some commands from the clients on port X. The client, on the other hand, sends commands to the server on port X if it wants to log in or send a message, but it's listening on port Y for incoming packets from the server. The server, of course, sends messages on port Y, as well. If Client A logs in (first thing user has to do), the server receives the client's username and then gets the client's IP based off of the packet it received, and stores both in a map with the username as the key. When Client B logs in, the same process happens. Now Client A can send messages to client B (and vice versa), because both their usernames and IPs are stored in the server. This all works fine when both clients are on the same machine, but once I try to run client B on a different machine, it seems as if the packet never reaches the server. There are no errors, the program doesn't crash, but the server never receives anything. I tried a bunch of different IPs for the client to send to - one I got from running 'ipconfig' on my command line, another from googling "what is my ip address?", a third IP I got from printing out to the console InetAddress.getLocalHost() - all three of these IPs are different, and none seems to work. On both machines I went to the firewall and allowed both port X and Y for UDP connections for inbound and outbound activities. This does not seem to help. Here is my Server code: public static void main(String args[]) throws IOException{ UDPServer SERVER = new UDPServer(); //calls the run() method SERVER.start(); } public UDPServer() throws IOException{ sock = new DatagramSocket(PORT_NUMBER, InetAddress.getLocalHost()); } public void run(){ System.out.println("Waiting for Client"); while(true){ try{ //======================================================================================================== //P…
answer count: 1
has answer: http://stackoverflow.com/a/27195566
accepted answer: http://stackoverflow.com/a/27195566
tagged with: sockets
type: AnsweredQuestion

http://stackoverflow.com/comment/42922217
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27221713
score: 0
has text: Have a look at this. http://www.java2s.com/Code/Java/Development-Class/UsejavautilTimertoscheduleatasktoexecuteonce5secondshavepassed.htm

http://stackoverflow.com/q/27221035
type: Question
has body: I'm trying to use Java 8 lambdas and have a general question about object serialization. For example the following input prints 5 if the executor.execute has only one method and runs the code block without serializing it. However if I serialize the lambda expression via SerializedLambda and deserialize it back, it prints null since it doesn't have the previous context in this new deserialized object. Moreover, it compiles without any complaint since the first context resolves outside variables. (finalVar in this example): final int finalVar = 5; executor.execute(() -&gt; { System.out.println(finalVar); }); I wonder whether it's possible to tell the SerializedLambda to include finalVar into serialization output without implementing an interface that has a field for finalVar variable and set the value of it to a field when constructing. AFAIK, this is the cleanest way to do such thing in Java: final int finalVar = 5; executor.execute(new Runnable() { int myVar = finalVar; public void run() { System.out.println(myVar); } ); I'm not even sure about that but I think the compiler can find out the outside variables and also serialize and include them when I try to serialize that lambda. Is there any trick for Java to do such thing or is there any language that has such feature?
answer count: 1
downvote count: 0
tagged with: serializable
has answer: http://stackoverflow.com/a/28931169
tagged with: deserialization
upvote count: 6
has comment: http://stackoverflow.com/comment/42924829
favorite count: 0
tagged with: serialization
tagged with: scala
accepted answer: http://stackoverflow.com/a/28931169
has comment: http://stackoverflow.com/comment/44618945
score: 6
has comment: http://stackoverflow.com/comment/45343121
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/45348522
tagged with: java
linked to: http://stackoverflow.com/q/23837215
has title: Including outside variables when serializing an object

http://stackoverflow.com/comment/42899841
type: Comment
type: QuestionComment
score: 0
has text: thank you again Paul Lammertsma
comment on: http://stackoverflow.com/q/27200137

http://stackoverflow.com/a/27223731
has comment: http://stackoverflow.com/comment/42926532
has comment: http://stackoverflow.com/comment/42926844
has body: When you want to split your given line into parts, you can do it similar to final String string = "status.test.status.close.name = Closed"; final String[] split = string.substring(0, string.indexOf("=")).split("\\."); System.out.println("split = [" + split[0] + ", " + split[1] + ", " + split[2] + ", " + split[3] + ", " + split[4] + "]"); // split = [status, test, status, close, name ] and pick the appropriate values out of split afterwards.
has comment: http://stackoverflow.com/comment/42928316
answers question: http://stackoverflow.com/q/27223634
has comment: http://stackoverflow.com/comment/42926776
score: 0
has comment: http://stackoverflow.com/comment/42926900
has comment: http://stackoverflow.com/comment/42934909
type: Answer

http://stackoverflow.com/comment/42960879
type: QuestionComment
score: 0
has text: @HareshChhelana whne i use sysout below your line it shows 0 instead 2650,can you tell me why?
comment on: http://stackoverflow.com/q/27242049
type: Comment

http://stackoverflow.com/a/27286606
downvote count: 0
has body: The method getSalaries() is declared and defined thusly: public int [][] getSalaries() { return salaries; } It is defined to return a two dimensional array, and the result you're seeing is the default toString() returned from such a beast. To get an actual number, your method should return a number, perhaps a double or an int, your choice, and inside the method body, you should iterate through your 2-D array summing up all the salaries.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27286586

http://stackoverflow.com/comment/43045041
comment on: http://stackoverflow.com/a/27289108
score: 0
type: Comment
has text: so how can i implement a customerized interface so that client can only upload their files diectly to ftp server?
type: AnswerComment

http://stackoverflow.com/a/35461082
type: Answer
has body: You can use JMX to look into Tomcat's internals, including the current list of sessions. Use jvisualvm to connect to a running Tomcat and look-around for the interesting data. Then use the JMX API to connect to the (in-process) JMX server from your application and find the (Session) Manager bean to get everything.
score: 0
answers question: http://stackoverflow.com/q/27202925

http://stackoverflow.com/comment/42937531
type: QuestionComment
comment on: http://stackoverflow.com/q/27230250
score: 0
type: Comment
has text: Yes, both the Java application and the JavaScript are running on the client.

http://stackoverflow.com/q/27294527
has comment: http://stackoverflow.com/comment/43053924
has title: JLabels in GridLayout are Not Always Painted
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43055916
has answer: http://stackoverflow.com/a/27297586
accepted answer: http://stackoverflow.com/a/27297586
tagged with: paintcomponent
tagged with: repaint
tagged with: jlabel
upvote count: 3
has comment: http://stackoverflow.com/comment/43053994
has body: I am creating a basic Tic-Tac-Toe application in Java Swing, and for this purpose, I have started investigating drawing. However, I have encountered an issue when a subclass of JPanel contains more than one instance of a subclass of JLabel, which overrides the paintComponent(Graphic) method, in a GridLayout array format embedded in itself. The issue is that only the first element in this array is painted. An example for the customized subclass of JLabel: import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JLabel; @SuppressWarnings("serial") public class DrawLabel extends JLabel { private boolean hasPaint; public DrawLabel() { super(); this.hasPaint = false; } public void draw() { hasPaint = true; repaint(); } public void clear() { hasPaint = false; repaint(); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if (hasPaint) { g2.drawOval(getX(), getY(), getWidth(), getHeight()); } else { g2.clearRect(getX(), getY(), getWidth(), getHeight()); } } } An example for the customized subclass of JPanel: import java.awt.Dimension; import java.awt.GridLayout; import javax.swing.JPanel; @SuppressWarnings("serial") public class DrawPanel extends JPanel { private Dimension size; private DrawLabel[][] fields; public DrawPanel(Dimension d) { super(); this.size = d; this.fields = new DrawLabel[size.height][size.width]; this.setLayout(new GridLayout(size.height, size.width)); for (int i = 0; i &lt; size.height; i++) { for (int j = 0; j &lt; size.width; j++) { this.fields[i][j] = new DrawLabel(); this.add(fields[i][j]); } } } public void draw(int row, int col) { fields[row][col].draw(); } public void clear() { for (int i = 0; i &lt; size.height; i++) { for (int j = 0; j &lt; size.width; j++) { fields[i][j].clear(); } } } } An example of an issue-provoking scenario: import java.awt.BorderLayout; …
tagged with: swing
has comment: http://stackoverflow.com/comment/43058069
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43056058
tagged with: java

http://stackoverflow.com/q/27204252
has body: So I'm trying to save objects to Parse.com server. But I get the 11-29 09:05:34.265 23256-23256/ionictech.com.hipku E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.ClassCastException: ionictech.com.hipku.ParseApplication cannot be cast to ionictech.com.hipku.Content.MainActivity at ionictech.com.hipku.Content.UploadActivity$2.onClick(UploadActivity.java:196) error in logcat. Every time I hit the save button the error pops up. I guess I'm not casting it right does anybody know another way to cast the ParseApplication? Here is my code: @Override public void onClick(View v) { Ads ads = ((MainActivity) getApplicationContext ()).getCurrentAds (); //When user hit the save buttton. //add data to ads object. ads.setTitle (adTitle.getText ().toString ()); ads.setMessage (adMessage.getText ().toString ()); //associate ad with the user ads.setUser (ParseUser.getCurrentUser ()); //The multimedia will be saved in the actionbar method //Saves all data to Parse.com ads.saveInBackground (new SaveCallback () { @Override public void done(ParseException e) { if (e == null) { (UploadActivity.this).setResult (Activity.RESULT_OK); (UploadActivity.this).finish (); } else { Toast.makeText (UploadActivity.this, "Error saving", Toast.LENGTH_SHORT ) .show (); } } }); And here is my MainActivity code: public class MainActivity extends ActionBarActivity { DrawerLayout mDrawerLayout; ListView mDrawerList; ActionBarDrawerToggle mDrawerToggle; String mTitle; ActionBar ab; protected Ads ads; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView (R.layout.layout); ads = new Ads (); ab = getSupportActionBar (); ab.setBackgroundDrawable (new ColorDrawable (Color.parseColor ("#ff9900"))); FragmentTransaction ft = getFragmentManager ().beginTransaction(); ft.replace (R.id.content_frame, new ContentFeed ()); ft.commit (); mTitle = (String) getTitle (); mDrawerLayout = (DrawerLayout) findViewById (R.id.drawer_layout); mDrawerList = (ListView) …
score: 0
tagged with: java
has title: ParseApplication cannot be cast to MainActivity
tagged with: logcat
has answer: http://stackoverflow.com/a/27204680
type: Question
type: AnsweredQuestion
tagged with: android
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/27204680
tagged with: parse-platform
answer count: 1

http://stackoverflow.com/comment/69835340
has text: @Pandiaraj - The image shown here seems like a ListBox. In that u can select multiple values. Check what type of html element it is. eg:- (Check whether it is a Select element). If it is a select element, Why not to use Select obj = new Select(element); obj.SelectByText("Australia"). And if u want to select multiple values use advance for loop in java to acheive the same
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27189182

http://stackoverflow.com/comment/42859084
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27184581
score: 0
has text: Download the jdbc driver, and copy the jar file in your projects jar...

http://stackoverflow.com/q/27158992
has body: I have been using jFrame to build a GUI. I had to insert images in the GUI, for which i inserted a label and put the image as an icon for the label. Now, i have to find out the position of the image in terms of the x and y co-ordinates and i am unable to do that. I have used setLocaction(x,y); but it still doesn't seem to work. I even disabled the layout manager by using setLayout(null); What is the possible solution for this problem? Edit Basically i am creating a Solar system GUI using Swing, so the positions of the planets are to be set by me. I being new to java, there is being some difficulty in implementing the layouts.
has comment: http://stackoverflow.com/comment/42811960
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42811967
type: Question
has comment: http://stackoverflow.com/comment/42812379
has comment: http://stackoverflow.com/comment/42814111
linked to: http://stackoverflow.com/q/6592468
tagged with: java
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42812350
has answer: http://stackoverflow.com/a/27160036
favorite count: 0
has answer: http://stackoverflow.com/a/27161164
has title: Positioning a label using swing in java

http://stackoverflow.com/q/27274396
duplicate of: http://stackoverflow.com/q/13102045
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has body: When ever I run this the output is: "Please input your name" I enter it "Please enter student number" I enter it "Please input the student name" "please enter the student number" String nameChoice = ""; do{ System.out.println("Please input the students name"); String name = s.nextLine(); nameChoice = name; System.out.println("Please enter that students number"); int studentNo = s.nextInt(); }while(!nameChoice.equalsIgnoreCase("done"));
type: UnansweredQuestion
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27274465
type: Question
linked to: http://stackoverflow.com/q/13102045
has title: do-while loop that either takes an int or a string?

http://stackoverflow.com/q/27197831
has comment: http://stackoverflow.com/comment/42880479
has answer: http://stackoverflow.com/a/27197957
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26077771
tagged with: string
has comment: http://stackoverflow.com/comment/42880526
favorite count: 0
has answer: http://stackoverflow.com/a/27198034
has body: Here i have two strings that prints each character occurred how many times but i want that result in descending order. public static void main(String[] args) { TreeMap tm = new TreeMap(); String s = "ajklfajdlkfajsdklfjalljaklsdfjaklsdjf"; int[] counts = new int[128]; for (int i = 0; i &lt; s.length(); i++) { char ch = s.charAt(i); if (ch &lt; 128) { counts[ch]++; } else { System.out.println("out of range"); } } for (char c = 0; c &lt; 128; c++) { if (counts[c] != 0) { tm.put(counts[c], c); // System.out.println(c + " occured " + counts[c] + "times"); } } for(int i=0;i&lt;tm.size();i++){ System.out.println(tm.get(i)); } } This code giving output as:null,null,null,s,d but i need ouput as: j l a f k d s .please guide me.
type: Question
accepted answer: http://stackoverflow.com/a/27198150
upvote count: 1
score: 0
tagged with: java
has title: String sort descending order using java based on number of times character repeated
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/27198150
possible better answer: http://stackoverflow.com/a/27197957

http://stackoverflow.com/q/27234916
linked to: http://stackoverflow.com/q/8826270
possible better answer: http://stackoverflow.com/a/27235465
type: Question
accepted answer: http://stackoverflow.com/a/27234970
has answer: http://stackoverflow.com/a/27235465
has comment: http://stackoverflow.com/comment/42946400
has title: How to get number of milliseconds from start of day
tagged with: date
answer count: 2
downvote count: 0
favorite count: 0
tagged with: timer
upvote count: 8
has answer: http://stackoverflow.com/a/27234970
has comment: http://stackoverflow.com/comment/42946614
tagged with: android
has body: For example, if it's 1 p.m (13:00) and I need to get the number 46800000 (13 hours from beginning o day) in milliseconds. Could anyone please help?
score: 8
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27236389
accepted answer of: http://stackoverflow.com/q/27235880
has comment: http://stackoverflow.com/comment/42949948
has body: I am not sure what you were trying to do there with the SortingUser, but I'd go with much simpler code, and let SQL do its own sorting. It's usually very efficient at that, especially if you have the proper indexes on the table. public int getLeaguePosition(String username) { try { String leagueName = getLeague(username); System.out.println("League Name: " + leagueName); // This is returning all the users in the same league sorted by descending points. String query = "SELECT * FROM Users WHERE CurrentLeague = ? ORDER BY TotalPoints DESC"; preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, leagueName); resultSet = preparedStatement.executeQuery(); int leaguePosition = 0; while(resultSet.next()) { // Since the result set is already sorted, the first player has the most points, so his // leaguePosition is one. The second has the next best number of points, so his position // is two, and so on. So we keep the leaguePosition var based on the number of the row. leaguePosition++; // And if the user name retrieved actually matches the one that we passed, then this is // his league position. String retrievedUsername = resultSet.getString("Username"); if ( retrievedUsername.equals( username ) ) { break; } } resultSet.close(); return leaguePosition; } catch(Exception e) { System.out.println("Couldn't get league position for: " + username); e.printStackTrace(); } return 0; }
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27235880
has comment: http://stackoverflow.com/comment/42949713

http://stackoverflow.com/q/27279551
tagged with: apache-storm
type: Question
answer count: 2
tagged with: yaml
score: 4
has body: I took the sample word-count code and tried to submit to a remote nimbus server without submitting to LocalCluster.I used the following code in client side and the following yaml configuration the server and ZK is started separately. When I submit using the below code in the client side I get the following error, when I ran the ./storm jar file/path/jar-file.jar ut.pending":5000,"storm.zookeeper.servers":"149.160.221.43","topology.max.task.parallelism":3} 308 [main] WARN backtype.storm.StormSubmitter - Topology submission exception: Field storm.zookeeper.servers must be an Iterable of java.lang.String Exception in thread "main" InvalidTopologyException(msg:Field storm.zookeeper.servers must be an Iterable of java.lang.String) at backtype.storm.generated.Nimbus$submitTopology_result.read(Nimbus.java:2466) at org.apache.thrift7.TServiceClient.receiveBase(TServiceClient.java:78) at backtype.storm.generated.Nimbus$Client.recv_submitTopology(Nimbus.java:162) at backtype.storm.generated.Nimbus$Client.submitTopology(Nimbus.java:146) at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:98) at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:58) at storm.starter.WordCountTopology.main(WordCountTopology.java:110) Topology building code: System.setProperty("storm.jar","/Users/lginnali/work/airavata/storm/storm/examples/storm-starter/target/storm-starter-0.10.0-SNAPSHOT.jar"); TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentenceSpout(), 5); BoltDeclarer split = builder.setBolt("split", new SplitSentence(), 8); split.shuffleGrouping("spout"); builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word")); Config conf = new Config(); conf.put(Config.NIMBUS_HOST, "localhost"); conf.put(Config.NIMBUS_THRIFT_PORT,6627); conf.put(Config.STORM_ZOOKEEPER_PORT,2181); conf.put(Config.STORM_ZOOKEEPER_SERVERS,"localhost"); conf.setNumWorkers(20); conf.setMaxSpoutPending(5000); if (args != nul…
has answer: http://stackoverflow.com/a/27305667
favorite count: 0
has title: <InvalidTopologyException InvalidTopologyException(msg:Field storm.zookeeper.servers must be an Iterable of java.lang.String)>
upvote count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/37180642

http://stackoverflow.com/comment/43045872
type: QuestionComment
comment on: http://stackoverflow.com/q/27289671
has text: Your `primekey` is only incremented in case `sort == 6` but where do you set this var?
score: 0
type: Comment

http://stackoverflow.com/a/27199120
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/27197156
score: -1
has body: The Solution: Operations.txt contains the list of numbers separated by spaces: 5 8 6 + + 10 50 30 * 6 + - ....... Here the code: import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; public class Operations { static String[] stack = new String[100]; static int index=-1; public static void main(String[] args) throws FileNotFoundException, IOException { File f = new File ("C:\\Operations.txt"); Scanner input = new Scanner(f); String line; while(input.hasNextLine()) { line = input.nextLine(); String [] opes = line.split("\\s+"); for(int i=0; i&lt;opes.length;i++) { if (opes[i].matches("[\\*+-/]")) { push(calculate(opes[i])); } else push(opes[i]); } System.out.println(line+" = "+pop()); } } public static void push(String value) { index++; stack[index]=value; } public static String pop() { String value = stack[index]; index--; return value; } public static String calculate(String operation) { double res = 0.0; double ope1=Double.parseDouble(pop()); double ope2=Double.parseDouble(pop()); switch (operation) { case "+": res = ope1 + ope2; break; case "-": res = ope1 - ope2; break; case "*": res = ope1 * ope2; break; case "/": res = ope1 / ope2; break; } return String.valueOf(res); } }
downvote count: 1

http://stackoverflow.com/a/27213539
answers question: http://stackoverflow.com/q/27213291
accepted answer of: http://stackoverflow.com/q/27213291
type: AcceptedAnswer
upvote count: 34
has comment: http://stackoverflow.com/comment/92905356
type: Answer
has comment: http://stackoverflow.com/comment/42907748
downvote count: 0
score: 34
has body: Official document: Headers that need to be added to every request can be specified using a RequestInterceptor. The following code creates a RequestInterceptor that will add a User-Agent header to every request. RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { request.addHeader("User-Agent", "Retrofit-Sample-App"); } }; RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("https://api.github.com") .setRequestInterceptor(requestInterceptor) .build();

http://stackoverflow.com/q/27253467
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42990602
has comment: http://stackoverflow.com/comment/67914952
has comment: http://stackoverflow.com/comment/42984392
score: 0
has body: I have a webservice client using CXF and Spring. The client proxy is created as spring managed @Bean, and registered to the SpringBus. The soap webservice requires a HTTP header named "Auth=[pass]", whereas pass must be a dynamic value, unique for each user that uses the client. Here is the problem: I created an AbstractOutDatabindingInterceptor that puts the HTTP header before sending the XML to the webservice. Which works fine for hardcoded pass. But I need to obtain the pass inside the interceptor dynamically. Therefore, I would somehow have to pass the currently logged in user INTO the interceptor itself. So that the interceptor then could fetch the proper authorization pass. @Configuration public class AppConfig { @Autowired SpringBus bus; @PostConstruct public void init() { bus.getOutInterceptors().add(new AbstractOutDatabindingInterceptor(Phase.MARSHAL) { @Override public void handleMessage(Message message) throws Fault { Map&lt;String, List&lt;String&gt;&gt; headers = (Map&lt;String, List&lt;String&gt;&gt;) message.get(Message.PROTOCOL_HEADERS); headers.put("Auth", Arrays.asList("dynamic pass per user"); //TODO how to get the current user dynamically? } }); } @Bean public WebservicePort getPort() { WebservicePort port = new Webservice(bus); return port; } } @Service public class WebserviceClient { @Autowired private WebservicePort port; @Autowired private AuthService authService; public void run() { //construct the xmlRequest User user = authService.getCurrentUser(); port.send(xmlRequest); //invoke the auto-generated webservice stub } } Of course I cannot change the auto generated method signature send(xml). How can I get the current user into the OutInterceptor at time of sending dynamically, and just for this send request? It must be threadsafe regarding the cxf client proxy, as multiple user might send a request simultaneously.
has title: How to pass dynamic values to CXF OutInterceptor?
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: spring
answer count: 0
tagged with: cxf

http://stackoverflow.com/q/27253527
tagged with: browser
has answer: http://stackoverflow.com/a/27253704
linked to: http://stackoverflow.com/q/13250061
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42995004
type: UnansweredQuestion
tagged with: swing
duplicate of: http://stackoverflow.com/q/13250061
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: I am trying to create a simple Java browser using eclipse Luna 4.4.1 I manage to create the browser but I have 2 issues. The display of the pages. When my browser shows the pages it shows them broken, for example "google.com", the background is blue, messed up letters, and i even show contented that in a normal browser doesn't show The Google search engine doesn't work, even though the Yahoo engine works. This is my code import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.util.Stack; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; class EditorPaneFrame extends JFrame { private JTextField url; private JButton backButton; private JEditorPane editorPane; private Stack urlStack = new Stack(); public EditorPaneFrame() { setTitle("Java Web Browser"); setSize(1000,800); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); // set up text field and load button for typing in URL url = new JTextField(30); url.addActionListener( //action listener for when the user press enter new ActionListener(){ public void actionPerformed(ActionEvent event) { try { // remember URL for back button urlStack.push(url.getText()); editorPane.setPage("http://"+url.getText()); } catch(Exception e) { editorPane.setText("Error: " +e); } } } ); // set up back button and button action backButton = new JButton("Back"); backButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if(urlStack.size()&lt;=1) return; try { urlStack.pop(); String urlString = (String)urlStack.peek(); url.setText(urlString); editorPane.setPage…
type: Question
has title: Simple browser display issues

http://stackoverflow.com/comment/42987193
has text: Paint in responsible for, amongst other things, preparing the Graphics state for painting, painting the border of the component, background, child components and you should call it first, before you do any custom painting
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27241517
type: Comment

http://stackoverflow.com/q/27309232
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27309387
answer count: 4
has answer: http://stackoverflow.com/a/27309387
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27309346
tagged with: apache-pig
has comment: http://stackoverflow.com/comment/43091735
upvote count: 2
linked to: http://stackoverflow.com/q/18893390
tagged with: java
type: Question
has title: Replacing characters inside the quoted string
has answer: http://stackoverflow.com/a/27309476
has answer: http://stackoverflow.com/a/27309658
has comment: http://stackoverflow.com/comment/43082084
has body: As part of my project, I have a CSV file which has comma separated values. But there are few fields which are in quotes. As a result the data is not loaded correctly. For example: if the data is ==>> car, deer, "bear, cat" In the above example, ideally there should be 3 columns. But its being treated as 4 columns due to the presence of a comma between rat and mat. The field "rat,mat" is not clubbed and considered as a single field. Please suggest if there is something in PIG to handle such scenarios
accepted answer: http://stackoverflow.com/a/27309346
has comment: http://stackoverflow.com/comment/43080365

http://stackoverflow.com/q/27215707
has comment: http://stackoverflow.com/comment/42911536
has comment: http://stackoverflow.com/comment/42911613
has comment: http://stackoverflow.com/comment/42911716
has comment: http://stackoverflow.com/comment/42911385
type: UnansweredQuestion
has body: The goal is is to ask what the capitol is of each state, state whether right or wrong, and then give total number of correct answers at the end. When compiling it gives me no errors, but when i try to run it it says: java.uitl.NoSuchElementException: No line found (in java.util.Scanner) There are probably more errors then just this one, but i would rather just focus on this one first. Any feedback would be appreciated, thanks! Code: import java.util.*; import java.io.*; public class States { public static void main(String[] args) throws java.io.IOException { Scanner inputt = new Scanner (System.in); String[][] cs = new String [50][1]; while (true) { String in = " "; boolean ans = false; int tally = 0; int count = 0; load(cs); in = input(count, cs); ans = check(in, count, cs); if (ans == true) { tally ++; continue; } count= count +2; if (count &gt; 100) { System.out.println("The count of correct answers is " + tally + "."); break; } }//end main method while loop }//end main method public static void load(String[][] cs) throws java.io.IOException { String filName = " "; filName = "C://Users/Troy/Documents/Class Documents/CSC 225/StateCapitals.txt"; Scanner inputt = new Scanner(new File(filName)); for (int row = 0; row &lt; cs.length; row ++) { for (int col = 0; col &lt; cs[row].length; col ++) { cs[row][col] = inputt.nextLine(); } }//end for loop inputt.close(); }//end load method public static String input(int count, String[][] cs) { Scanner inputt = new Scanner (System.in); System.out.print("What is the capital of " + cs[count][0] + "? -"); String t = inputt.nextLine().trim().toUpperCase(); return t; }//end input method public static Boolean check(String in, int count, String [][] cs) { boolean correct = false; if (cs[count +1][0].compareTo(in)==0) { correct=true; System.out.println("Your answer is correct."); } else { System.out.println("The correct answer should be " + cs[count + 1][0]); } return correct; }//end check method }//end class
has comment: http://stackoverflow.com/comment/42912128
has comment: http://stackoverflow.com/comment/42911369
has title: Beginner Java Programmer Struggling (no line found)
tagged with: java
has answer: http://stackoverflow.com/a/27215948
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42912816
has comment: http://stackoverflow.com/comment/42911836
has comment: http://stackoverflow.com/comment/42912210
answer count: 1

http://stackoverflow.com/q/27182976
has comment: http://stackoverflow.com/comment/42924560
tagged with: grails
has body: I am trying to powerMock a static method like this: mockStatic(staticExample.class); PowerMockito.doNothing().when(staticExample.class); staticExample.addErrorIfNull(any(staticExample.class), any(String.class), any(Object.class), any(String.class), any(Object[].class)); //line 3 But it is not getting mocked and throwing a null pointer exception at line3 The same code is working when I am using eclipse as IDE. Is this is an issue due to grails 2.2-powermock 1.5 compatibility?
has comment: http://stackoverflow.com/comment/42926273
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42922640
tagged with: powermock
has title: powermock isnt working with grails(IntelliJ) but working with java(Eclipse IDE)
has comment: http://stackoverflow.com/comment/42868836
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/27245588
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27246062
accepted answer: http://stackoverflow.com/a/27246062
type: AnsweredQuestion
tagged with: multithreading
has title: How can i achieve this multiple threading scenario of file scanner?
type: Question
has body: I would like to achieve this: In my application, i will have a single thread(producer) which will do some processing from user input(the directory user want to crawl) and add all the name of folders in that directory into a linkedBlockingQueue named A, and at the same time while producer is adding into A, multiple consumer thread lets say 2, will be taking out the folder name of what is in A. Each consumer thread will take out one object at a time, processing it and put into another priorityBlockingQueue named B. I now having issue with the threads, what i have done now: main: Thread[] workerThreads = new Thread[numOfThreads]; for (int i = 0; i &lt; numOfThreads; i++) { /* for each thread to concurrently retrieving directories from the workQueue * and placing data into another structure(matchQueue)*/ workerThreads[i] = new Thread(new WorkerThread(workQueue, matchQueue, pattern)); workerThreads[i].start(); // System.out.println("Thread "+ i +" Started"); } Thread mainThread = new Thread(new ProducerThread(workQueue, args)); mainThread.start(); // System.out.println("Main Thread Started"); // when threads done, join them together for (int i = 0; i &lt; numOfThreads; i++) { try { workerThreads[i].join(); System.out.println("worker thread " + i + "joined"); } catch (InterruptedException e) { } } my producer thread: public class ProducerThread implements Runnable { private LinkedBlockingQueue&lt;String&gt; workQueue; private String[] args; public ProducerThread(LinkedBlockingQueue&lt;String&gt; workQueue, String[] args) { this.workQueue = workQueue; this.args = args; } public void run() { // process every argument sequentially // for(String arg : args) for (int i = 1; i &lt; args.length; i++) { processDirectory(args[i]); if(i==args.length-1){ fileCrawler.producerFinished = true; } } } } my worker thread: public class WorkerThread implements Runnable { private LinkedBlockingQueue&lt;String&gt; workQueue; private PriorityBlockingQueue&lt;String&gt; matchQueue; private Stri…
tagged with: java

http://stackoverflow.com/q/27281172
tagged with: java
has comment: http://stackoverflow.com/comment/43055668
type: Question
has answer: http://stackoverflow.com/a/27281990
has answer: http://stackoverflow.com/a/27282742
has comment: http://stackoverflow.com/comment/43032256
has body: The code below is working perfectly but I am in doubt if I am using the best approach for the requirenment: read, from a couple of places, property from a properties file in a Spring project. Basically, I created a public class with static variables. Now I am using Spring 3 plus JDK6. I might upgrade Spring to 4 soon but I will not be able to chnage JDK version. mvc-dispatcher-servlet.xml Properties File url = http://localhost:8080/MHE2/ lastpage = log/display/last firstpage = log/display/first previouspage = log/display/previous nextpage = log/display/next One sample of using the property value. There will be a lot of case like these //calling rest web service DefaultHttpClient httpClient = new DefaultHttpClient(); //Apache HttpClient HttpPost postRequest = new HttpPost(Ut_Properties.getUrl() + Ut_Properties.getLastpage()); Public class with static variables package com.mastercard.mhe.utilities; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Component("ut_Properties") @Scope("singleton") public class Ut_Properties { private static String url; private static String lastpage; private static String firstpage; private static String previouspage; private static String nextpage; @Autowired public Ut_Properties(@Value("${url}") String url, @Value("${lastpage}") String lastpage, @Value("${url}") String previouspage, @Value("${lastpage}") String nextpage) { Ut_Properties.setUrl(url); Ut_Properties.setLastpage(lastpage); Ut_Properties.setUrl(previouspage); Ut_Properties.setLastpage(nextpage); } public static String getUrl() { return url; } public static void setUrl(String url) { Ut_Properties.url = url; } public static String getFirstpage() { return firstpage; } public static void setFirstpage(String firstpage) { Ut_Properties.firstpage = firstpage; } public static String getPreviouspage() { return p…
score: 0
possible better answer: http://stackoverflow.com/a/27282742
answer count: 2
tagged with: variables
accepted answer: http://stackoverflow.com/a/27281990
linked to: http://stackoverflow.com/q/27070823
tagged with: spring
tagged with: properties
tagged with: spring-mvc
type: AnsweredQuestion
has title: Is a good practice to use static variables for holding properties from file in a Spring MVC project

http://stackoverflow.com/q/27302747
has title: How to use Arraylist over different classes
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27302789
tagged with: oop
tagged with: java
upvote count: 1
downvote count: 1
has body: Im trying to add a dog (nyHund) which is created in a different class, to an Arraylist i created using a constructor in another class, but whenever i try to use the Arraylist in the "register" class, im getting the error that the arraylist name can't be resolved. First class: public class Hund { private String namn; private int ålder; private double vikt; private String ras; public Hund(String hundnamn, int hundålder, String hundras, double hundvikt) { this.namn = hundnamn; this.ålder = hundålder; this.ras = hundras; this.vikt = hundvikt; } public String getNamn() { return namn; } public int getÅlder() { return ålder; } public double getSvanslängd() { if (ras=="tax"){ return 3.7; }else{ return ((vikt*ålder)/10); } } public String toString() { return namn + "\n" + ålder + "\n"+ras+"\n"+vikt+"\n"+getSvanslängd(); } } Second Class import java.util.ArrayList; public class testning { public static void main(String[] args) { Hund nyHund = new Hund("Daisy", 13, "labrador", 22.3); System.out.println(nyHund.toString()); Register.läggTillHund(nyHund); } } And the Third class: import java.util.ArrayList; public class Register { public static void läggTillHund(Hund nyHund){ hundRegister.add(nyHund); System.out.println(nyHund); } private Register(){ ArrayList&lt;Hund&gt; hundRegister = new ArrayList&lt;Hund&gt;(); } } The problem i am experiencing is with "hundRegister.add(nyHund)" any thoughts? or pointers where im going wrong? (very new at Java) Best Regards Oskar
type: Question
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43083892
type: Comment
type: QuestionComment
has text: I tried using innerHTML but it is not working
comment on: http://stackoverflow.com/q/27311256
score: 0

http://stackoverflow.com/q/27257301
has comment: http://stackoverflow.com/comment/42988373
tagged with: compiler-errors
accepted answer: http://stackoverflow.com/a/27257404
has comment: http://stackoverflow.com/comment/42988257
type: AnsweredQuestion
tagged with: object
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42989752
has body: I'm running into a weird compilation issue, and I don't even know if it is a compiling or linking or syntax problem or what. Sorry to be so vague, but I'm struggling to even diagnose this problem. To explain: I am in the middle of writing a fairly large Java program - for me, anyway. In my code, I set up an array of "widget" objects. The widgets are defined a "widget.java," file; the code which creates and populates the widget array is in another file. Trying to figure this out before I posted anything, I stripped down my code and wrote a little toy version, below: import java.io.*; import java.lang.String; import java.lang.NullPointerException; public class arrayObjTest { public static void main(String[] args) throws IOException { widget yellow = new widget("Yellow"); widget[] myWidgets = new widget[3]; myWidgets[0] = new widget("Blue"); myWidgets[1] = new widget("Red"); myWidgets[2] = yellow; } } class widget { String color; public widget(String a) { color = a; } } The toy version (above) compiles just fine. But when I import just this... 129 widget[] myWidgets = new widget[3]; 130 131 myWidgets[0] = new widget("Blue"); ...into my big code, I get these compilation errors: C:\Users\Pete\Desktop\Java Playground\widgetSim&gt; C:\Users\Pete\Desktop\Java Playground\widgetSim&gt; C:\Users\Pete\Desktop\Java Playground\widgetSim&gt;"C:\Program Files\Java\jdk1.8.0_20\bin\javac.exe" widgetMachine.java .\widgetObject.java:131: error: ']' expected myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: ';' expected myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: illegal start of type myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: &lt;identifier&gt; expected myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: ';' expected myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: illegal start of type myWidgets[0] = new widget("Blue"); ^ .\widgetObject.java:131: error: &lt;identifier&gt; expecte…
answer count: 1
tagged with: arrays
score: 0
has title: Weird Compiling/Linking Issue While Adding Objects in an Array
has answer: http://stackoverflow.com/a/27257404

http://stackoverflow.com/comment/42971271
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27244155
has text: sorry, i did not understand
type: Comment

http://stackoverflow.com/comment/43071468
type: Comment
has text: @GáborBakos I think it's clear I was talking about explicit casts. The implicit cast is in the language rules to define the semantic effect, but there is no reason for the underlying implementation to perform an actual 32-bit addition and a conversion.
comment on: http://stackoverflow.com/a/27304202
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42862513
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27188008
has text: so what's the issue?
score: 0

http://stackoverflow.com/a/27212164
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42905398
accepted answer of: http://stackoverflow.com/q/27211974
has comment: http://stackoverflow.com/comment/42905538
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42905987
has body: To the best of my knowledge, there is no ready made library that will perform this. There is, however, a simple method to achieve the goal! First, we need to know function words, which don't have much semantic meaning of their own, but are important for grammatical and structural relationships. Some function words are "of", "about", "my", etc. For more details, please consult the following resources: The Wikipedia page on Function Words Function Words (pdf slides from New York Univ.) The Wikipedia page also has an external link from where you can download a list of function words in English. Once that list is obtained, we can simply use an ordinary word-splitter, and then combine one word w_k with the following word w_(k+1) if w_k is a function word. This approach will achieve the following results: "United States of America" ==> "United", "States", "of America" "Dark Knight of Gotham" ==> "Dark", "Knight", "of Gotham" "key with rings" ==> "key", "with rings" For more sophisticated grouping of words, we need to move beyond "splitting", and venture into the territory of shallow parsing. Phrase chunking, in particular, can be very helpful in this case. Consider, for example, Capital of the United States of America, word splitting as above will yield "capital", "of the united", "states", "of america" ... which is probably not desirable. Phrase chunking, on the other hand will yield [Capital] [of] [the United States] [of] [America] Now, we can join the prepositions (if that is required) to the subsequent phrase to obtain [Capital] [of the United States] [of America] A good phrase chunking program is made available by the cognitive computing group at Univ. of Illinois at Urbana-Champaign, including an online demo.
has comment: http://stackoverflow.com/comment/42908098
has comment: http://stackoverflow.com/comment/42905336
score: 3
has comment: http://stackoverflow.com/comment/42905916
downvote count: 0
answers question: http://stackoverflow.com/q/27211974

http://stackoverflow.com/comment/53664032
type: Comment
has text: Possible duplicate of [Eclipse Incremental Builder Plugin does not work](http://stackoverflow.com/questions/12987596/eclipse-incremental-builder-plugin-does-not-work)
score: 0
comment on: http://stackoverflow.com/q/27254903
type: QuestionComment

http://stackoverflow.com/comment/43094756
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27307474
has text: It's nearly certain that there is nothing NetLogo-specific about this problem.

http://stackoverflow.com/comment/78926285
type: AnswerComment
has text: https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27299644

http://stackoverflow.com/a/27180616
has comment: http://stackoverflow.com/comment/42850194
has comment: http://stackoverflow.com/comment/42849907
has comment: http://stackoverflow.com/comment/42849877
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42850664
has comment: http://stackoverflow.com/comment/42850274
has body: You may try to use CASE to add a column indicating that movie has been rated by the respective email or not. This is not tested but you may get the concept: statement = (PreparedStatement) con .prepareStatement("" + "SELECT FILM,(film_total_ratings/number_of_ratings) as ratings_rating " + "FROM( " + "SELECT COUNT(*) as number_of_ratings, FILM, " + " SUM(RATING) as film_total_ratings, " + " SUM(CASE WHEN EMAIL LIKE '%"+email+"%' THEN 1 ELSE 0 END) as rated" + " FROM ratings GROUP BY film HAVING rated=0 " + "ORDER BY rating DESC" + ") TMP_Film");
has comment: http://stackoverflow.com/comment/42850107
has comment: http://stackoverflow.com/comment/42849944
has comment: http://stackoverflow.com/comment/42850449
has comment: http://stackoverflow.com/comment/42850200
type: Answer
has comment: http://stackoverflow.com/comment/42850283
has comment: http://stackoverflow.com/comment/42849799
has comment: http://stackoverflow.com/comment/42849795
accepted answer of: http://stackoverflow.com/q/27180430
has comment: http://stackoverflow.com/comment/42850511
answers question: http://stackoverflow.com/q/27180430

http://stackoverflow.com/comment/42862823
has text: That it doesn't work well. For the String '123' I get a matrix {[1][1],[1][1]}. It seems like only the first digit insert into the matrix.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27188008

integrity
type: Tag
tags question: http://stackoverflow.com/q/27288752
tag name: integrity

http://stackoverflow.com/comment/42996040
score: 0
comment on: http://stackoverflow.com/a/27261457
type: AnswerComment
has text: Thank you so much for the detailed explanation, I will implement it and let you know how it goes once I get back to my computer. I'll also upvote you once I get the rep. Thanks again bud.
type: Comment

http://stackoverflow.com/q/27180189
has answer: http://stackoverflow.com/a/27180281
accepted answer: http://stackoverflow.com/a/27180281
tagged with: arraylist
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/27180364
has body: I am trying to solve a problem but the limit of array 1000 and problem giving a input unknown number. I just add element in ArrayList until size 1000 and stop the adding element. I try to the adding element the following codes but this is not my programming just trying. Adding element 0 to 14. How can I add until size 10? public static void main(String[] args) { ArrayList&lt;Integer&gt; str=new ArrayList&lt;Integer&gt;(); int y=str.size(); do { for(int i=0; i&lt;15; i++) str.add(i); System.out.println(str); } while(y!=10); }
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27180364
score: 1
tagged with: java
has title: How to add element to Arraylist until as I want to limit?
type: Question

http://stackoverflow.com/a/27258294
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42990606
type: Answer
has comment: http://stackoverflow.com/comment/42990222
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42990792
has body: A char in Java is a 16-bit Unicode character. A "byte" is an 8-bit byte. You're using writeBytes to write a string as 38 bytes, but readChar to read them back in as 19 characters. writeBytes will write the low order 8 bits of each 16-bit character of the string. So if your string was "ABCD", the bytes it would write are 0x41 0x42 0x43 0x44 Then when you read them back in as 16-bit characters, it will read the first two characters either as 0x4142 0x4344 or 0x4241 0x4443 depending on how the byte ordering is handled. Either way, instead of "ABCD", you will get some strange Unicode characters whose code points are U+4142 or U+4241, and U+4344 or U+4443. (They are probably not displaying correctly.)
answers question: http://stackoverflow.com/q/27258002
has comment: http://stackoverflow.com/comment/42990283
has comment: http://stackoverflow.com/comment/42990366
accepted answer of: http://stackoverflow.com/q/27258002

http://stackoverflow.com/a/27267819
answers question: http://stackoverflow.com/q/27267583
downvote count: 0
has body: Try same like you used composition and using interface like: interface Weapon { void shoot(); void reload(); } class ModifiedRifle implements Weapon { Rifle myRifle; Shotgun myShotgun; public ModifiedRifle (Rifle rifle, Shotgun shotgun) { this.myRifle = rifle(); this.myShotgun = shotgun; } public void shoot() { myRifle.shoot(); } public void reload() { myShotgun.reload(); } }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/42957146
has text: Possible dupe of http://stackoverflow.com/questions/4932282/android-r-cannot-be-resolved-to-a-variable
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27240312

http://stackoverflow.com/comment/43042862
has text: @ElliottFrisch, sure. The initialization of the constants is a slightly different story, and the use of a property file could be combined with all ways of representing the values mentioned so far.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27288035

http://stackoverflow.com/comment/42815796
type: AnswerComment
comment on: http://stackoverflow.com/a/27161073
has text: about this error what should I do? `The method getDrawable(int) is undefined for the type Context`
type: Comment
score: 0

http://stackoverflow.com/a/27224814
has body: Use a fixed thread pool, via the executor API: Executor executor = Executors.newFixedThreadPool(5); // all jobs are submitted sequentially, but only 5 jobs execute concurrently at a time for(Runnable job : jobs) { executor.execute(job); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27224758
type: Answer
accepted answer of: http://stackoverflow.com/q/27224758
upvote count: 3
score: 3

http://stackoverflow.com/comment/42832824
has text: The `main` (1st code extract) shown is not the one used for the stacktrace (there's no `WriteOutputIntoExcel` used). Can we see the actual code? And you should properly indent your code, as is it's hard to read
score: 1
type: Comment
comment on: http://stackoverflow.com/q/27169948
type: QuestionComment

http://stackoverflow.com/q/27188424
tagged with: java
tagged with: struts
has body: i am fairly new to the struts environment and i have been looking around for this kind of thing but cannot find it anywhere else. my problem is that i need to configure the OIDAuthenticationFilter. although there is an example in the MitreId website, i cant seem to translate it into the framework i am using which is struts. what is in the example that i have seen is using some kind of spring security which i am not sure how it works but i understand what it is doing/configuring: https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/wiki/Client-configuration the code is too large and i am not going to paste it here for that reason... in my code, in web.xml is have the following so far: AuthenticationFilter com.something.AuthenticationFilter AuthenticationFilter *.do and the authentication filter calss is extending the OIDAuthenticationFilter: public class AuthenticationFilter extends OIDCAuthenticationFilter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { } } i know how to use it in struts and setting the rest up in web.xml, but what i dont know is how do i translate what the example is doing or how it is doing to the way i am doing. as i can see, many things are given values and many classes have parameters being set in the example. thanks :)
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27247025
has comment: http://stackoverflow.com/comment/42969040
favorite count: 0
tagged with: openid
tagged with: filter
has comment: http://stackoverflow.com/comment/42931239
type: AnsweredQuestion
has title: MitreId Client authentication filter configuration
accepted answer: http://stackoverflow.com/a/27247025
upvote count: 1
has comment: http://stackoverflow.com/comment/42873211
type: Question
has comment: http://stackoverflow.com/comment/42927698
score: 1

http://stackoverflow.com/q/27179678
has body: I am making a program using Java that will output the users zodiac sign. When I compile this code it highlights 0219 and says "integer number too large." I am a beginner so if this is a stupid error please be nice. Thanks System.out.println("Please enter your birthday month and day as a four digit number"); System.out.println("(Ex: 0514 for May 14th):"); double d = key.nextDouble(); if (d &gt;= 0101 &amp;&amp; d &lt;= 0120) { System.out.println("You are a Capricorn."); } else if (d &gt;= 0121 &amp;&amp; d &lt;= **0219**) { System.out.println("You are an Aquarius."); } else if (d &gt;= 0220 &amp;&amp; d &lt;= 0320) { System.out.println("You are a Pisces."); } else if (d &gt;= 0321 &amp;&amp; d &lt;= 0420) { System.out.println("You are an Aries."); } else if (d &gt;= 0421 &amp;&amp; d &lt;= 0521) { System.out.println("You are a Taurus."); } else if (d &gt;= 0522 &amp;&amp; d &lt;= 0621 ) { System.out.println("You are a Gemini."); } else if (d &gt;= 0622 &amp;&amp; d &lt;= 0723 ) { System.out.println("You are a Cancer."); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27179697
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27179701
has title: Too large of an integer
upvote count: 1
type: Question
answer count: 2
downvote count: 0
tagged with: bluej
has comment: http://stackoverflow.com/comment/42848073
favorite count: 0

http://stackoverflow.com/a/27293159
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27293073
type: Answer
has body: The first thing why you are getting only Dog as output is because you are having your System.out.println(str); statement inside if block which will only run when there is element called Dog. For other elements it won't print anything. Second thing, if you want your output to be Dog, Cat, Rat then you won't get it by using lst.set(0, str); because set method will replace the element at position 0. So your Cat element will be replaced by Dog. Therefore you won't get Cat in your output. For Info about set method EDIT: Try with add() method in spite of set(). while(iterate.hasNext()){ String str = iterate.next(); if(str.equalsIgnoreCase("Dog")){ iterate.remove(); lst.add(0, str); } }
score: 0
accepted answer of: http://stackoverflow.com/q/27293073

typeconverter
type: Tag
tags question: http://stackoverflow.com/q/27237777
tag name: typeconverter

http://stackoverflow.com/q/27255474
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42986025
has comment: http://stackoverflow.com/comment/43010775
has comment: http://stackoverflow.com/comment/42984919
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/42986473
has comment: http://stackoverflow.com/comment/42984938
downvote count: 0
has answer: http://stackoverflow.com/a/27255686
has comment: http://stackoverflow.com/comment/42984915
answer count: 1
favorite count: 0
has title: How to find an instance constructor call in Java debug in Eclipse?
has body: I stopped at some breakpoint in some object instance. I have multiple instances of this class, called in various place. Is it possible to find that constructor call, which has created namely this instance? Constructor call is not in stack in the case.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42986067
score: 1
tagged with: java
upvote count: 1

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/27214323
tags question: http://stackoverflow.com/q/27159242
tag name: google-oauth

http://stackoverflow.com/q/27197005
has comment: http://stackoverflow.com/comment/42878888
score: 7
tagged with: java
type: Question
has body: This project is using Ant as its build system. Can I debug the project when I run it via Ant?
has comment: http://stackoverflow.com/comment/65292791
tagged with: intellij-idea
tagged with: ant
possible better answer: http://stackoverflow.com/a/50129331
downvote count: 0
has answer: http://stackoverflow.com/a/50129331
has answer: http://stackoverflow.com/a/27197025
has title: Does Intellij IDEA support debugging a project built with ant?
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/65292735
has answer: http://stackoverflow.com/a/37967567
accepted answer: http://stackoverflow.com/a/27197025
upvote count: 7
linked to: http://stackoverflow.com/q/975271
type: AnsweredQuestion
tagged with: build
linked to: http://stackoverflow.com/q/3039933

http://stackoverflow.com/comment/43061623
comment on: http://stackoverflow.com/a/27298707
type: AnswerComment
score: 1
has text: `'%'` will allow connections from any ip address, and port `3306` is the default port. This in combination is asking for bots et al to try brute forcing. I'd recommend either changing to a non-standard port (not fool proof but will get past most dumb bots) and/or limiting the user account to only the IP address necessary it will connect from (ie your office's public static ip address).
type: Comment

http://stackoverflow.com/a/27241126
has comment: http://stackoverflow.com/comment/43021837
type: Answer
has comment: http://stackoverflow.com/comment/42959636
has comment: http://stackoverflow.com/comment/42959183
answers question: http://stackoverflow.com/q/27241039
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27241039
has comment: http://stackoverflow.com/comment/42959615
has comment: http://stackoverflow.com/comment/42996886
score: 1
upvote count: 1
type: AcceptedAnswer
has body: What you need is a static Context object. For that, you can use the application context. Assuming your application manifest is as follows: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.app.package" ... &lt;application android:name=".MyApp" ... 1) Create an application class with a public static method to return this context. package my.app.package; // This should match the package path in your Manifest public class MyApp extends android.app.Application { // This should match the app name in your manifest private static MyApp appContext; public MyApp() { appContext = this; } public static Context getAppContext() { return appContext; } } 2) Then in your activity, you can make statically obtain the context and resolve the resource: public final String CYPHER = MyApp.getContext().getResources.getString(R.string.cypher_txt);
has comment: http://stackoverflow.com/comment/43021819

http://stackoverflow.com/q/27289467
has comment: http://stackoverflow.com/comment/43046311
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27290982
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43045295
tagged with: jsoup
has comment: http://stackoverflow.com/comment/43047944
score: 0
answer count: 1
has title: How to extract text between hyperlink tag
has comment: http://stackoverflow.com/comment/43045278
has body: Im trying to get text between an &lt;a&gt; tag but it doesnt want to work but it does work for &lt;strong&gt; tags Code: Example with a tag not working public static void init() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, IOException{ Document doc = Jsoup.connect("https://www.google.com.au/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=example").timeout(20*1000).get(); Elements taglink=doc.select("#rso &gt; div.srg &gt; li:nth-child(1) &gt; div &gt; h3 &gt; a"); StringBuilder sb = new StringBuilder(taglink.text()); System.out.println("Text "+sb); }
has answer: http://stackoverflow.com/a/27290982
has comment: http://stackoverflow.com/comment/43045563

http://stackoverflow.com/comment/42886452
score: 1
type: QuestionComment
has text: You declared statements after `return nonwallExits;`. Those statements will never be reached.
type: Comment
comment on: http://stackoverflow.com/q/27201541

http://stackoverflow.com/comment/43069407
score: 0
type: AnswerComment
has text: @markspace: If rather than creating a new temporary object the code stored a reference to the array into a static volatile field whose sole reason for existence was to "pretend" to make the array available to other threads, then *provided that no other array reference was visible to any other thread prior to that* I would think that any practical memory implementation would behave as required, but I really wish there were a clean way to simply say "cleanly publish this array if no other thread has seen it yet, and do whatever you like if another thread has seen it".
type: Comment
comment on: http://stackoverflow.com/a/27280120

http://stackoverflow.com/comment/43238253
type: QuestionComment
comment on: http://stackoverflow.com/q/27275894
has text: You should probably put your self-found solution in as an answer rather than an edit. This is allowed. Currently, the question is listed under "unanswered" which doesn't reflect reality.
score: 0
type: Comment

http://stackoverflow.com/a/27216503
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27216388
has body: If you look at the JavaDoc of ActiveProfiles annotation, it contains this text: ActiveProfiles is a class-level annotation that is used to declare which active bean definition profiles should be used when loading an ApplicationContext for test classes. Meaning it is only supposed to be used to declare active Spring profiles for test classes. So If put it on a Configuration class it should have no effect. And as for the @Profile annotation, it can be used on both method and class level. If you use it on method annotated with @Bean in configuration class, only that bean will belong to the profile. If you use it on configuration class, it will be applied to all the beans within the configuration class, if you use it on @Component class, the profile will be applied to the bean represented by that class. @Profile annotation JavaDoc provides more detailed explanation of these rules. Why I have to use the @Profile annotation on a **configuration class* instead annotate directly my beans? Well if all beans in given configuration class should be active only for certain profile(s) then it makes sense to declare that globally on the configuration class to avoid having to individually specify the profile on all beans. But If you were to annotate all indiviudal beans it would work as well.
type: Answer
upvote count: 23
score: 23
accepted answer of: http://stackoverflow.com/q/27216388

http://stackoverflow.com/a/27273822
score: 20
has body: Using delegates: void AttemptSomethingAsync(Action onSuccess, Action&lt;string&gt; onError1, Action onError2 = null) { // ... } // Call it using: AttemptSomethingAsync(onSuccess: () =&gt; { Yes(); }, onError1: (msg) =&gt; { OhNo(msg); }); Or, using a class class AttemptSomethingHandler { Action OnSuccess; Action&lt;string&gt; OnError1; Action OnError2; } void AttemptSomethingAsync(AttemptSomethingHandler handler) { // ... } // And you call it like AttemptSomethingAsync(new AttemptSomethingHandler() { OnSuccess = () =&gt; { Yes() }; }); Or events public delegate void SuccessHandler(); public delegate void ErrorHandler(string msg); class SomethingModel { public event SuccessHandler OnSuccess; public event ErrorHandler OnError1; public void AttemptSomethingAsync() { // ... } } // Use it like var model = new SomethingModel(); model.OnSuccess += Yes; model.AttemptSomethingAsync(); private void Yes() { }
answers question: http://stackoverflow.com/q/27273328
has comment: http://stackoverflow.com/comment/94537567
upvote count: 20
type: Answer
downvote count: 0

http://stackoverflow.com/q/27210854
has body: When I compute paths again as vertex C to M Correct path should be C -&gt; B -&gt; N -&gt; M But it is A -&gt; B -&gt; N -&gt; M I used this code Dijkstra Algorithm This is the picture for my graph:
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/27211189
favorite count: 0
has title: Dijkstra Algorithm: wrong path
has answer: http://stackoverflow.com/a/27211189
has comment: http://stackoverflow.com/comment/42903118
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42903087
tagged with: dijkstra
type: Question
has comment: http://stackoverflow.com/comment/42903140
tagged with: algorithm

http://stackoverflow.com/comment/42852845
has text: @Nitin I have changed `String lon= latsMap.get("lons"+i);` to `String lon= lonMap.get("lons"+i);` . By mistake I wrote `latsMap` in place of `lonMap` . May be this could be the reason you were not getting Location .
type: AnswerComment
comment on: http://stackoverflow.com/a/27165812
type: Comment
score: 0

http://stackoverflow.com/q/27245165
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42971083
type: Question
has comment: http://stackoverflow.com/comment/42970607
has title: Writing a ZIP on the fly?
downvote count: 0
has comment: http://stackoverflow.com/comment/42968534
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
upvote count: 2
type: UnansweredQuestion
has body: At the moment I am tracing a load of files that come into my system to a directory. The issue is that I am running out of iNodes (the number of files I can store). For "replay" reasons (there are other reasons too), I would like the files to be separate files, so I can't just write to one file. I am wondering whether I can replace this with code that will write the files to a ZIP on the fly. However, my concern is - what happens if the JVM crashes during procesing for whatever reason, do will I end up with a corrupt ZIP file? Or is there a way that I can ensure that the ZIP is valid after every "write"?
score: 2

http://stackoverflow.com/a/27157347
upvote count: 1
score: 1
has body: The answer is highly situational. In general, you want to handle exceptions elegantly whenever possible. That is, try to resolve / ignore them where you can. An IndexOutOfBoundsException is very often an example of where this is not possible. Hard breaks because of exceptions is a last-resort. Do this only when your program cannot continue. This question's answer has a good post on it. When to throw an exception?
downvote count: 0
answers question: http://stackoverflow.com/q/27157206
type: Answer

http://stackoverflow.com/a/27198304
score: 1
accepted answer of: http://stackoverflow.com/q/27198289
has body: Your fields should not be static. That means one per class (not instance) private static int endMiles, startMiles,fillUp, days,distance; should be private int endMiles, startMiles,fillUp, days,distance;
upvote count: 1
answers question: http://stackoverflow.com/q/27198289
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/30445129
type: Answer
has body: If you have registered the receiver in the onCreate then unregister it in it's onDestroy method. If you have registered the receiver in the onResume then unregister it in it's onPause method. If you have registered the receiver in the onStart then unregister it in it's onStop method.
upvote count: 1
answers question: http://stackoverflow.com/q/27298700
score: 1
downvote count: 0

http://stackoverflow.com/q/27221428
has comment: http://stackoverflow.com/comment/42921968
tagged with: jar
downvote count: 0
tagged with: manifest
has comment: http://stackoverflow.com/comment/42922920
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27221509
has comment: http://stackoverflow.com/comment/42922022
has comment: http://stackoverflow.com/comment/42922477
possible better answer: http://stackoverflow.com/a/27221487
has answer: http://stackoverflow.com/a/27221487
score: 2
type: AnsweredQuestion
has body: I recently created a simple tic tac toe program and I've been trying to make it into a jar and I using cmd. I manage to get the jar,but when I click it nothing happens. After more research I figure it's a manifest problem as I didn't do anything to it or can even find one. Now this manifest thing has been really confusing me I have created my own manifest several times as just a txt, but that didn't work and I read that it would create it's own manifest, but I couldn't find that anywhere. Can Someone clarify were this manifest comes from or how to create one. Java code: import javax.swing.JFrame; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.*; import javax.swing.ImageIcon; import javax.swing.SwingUtilities; import javax.swing.JButton; import javax.swing.JLabel; public class TicTacToe extends JFrame { // GUI constants private static final int WIDTH = 400; // display width private static final int HEIGHT = 300; // display height // TicTacToe layout constants private static final int NUM_ROWS = 3; // number of tic-tac-toe rows private static final int NUM_COLS = 3; // number of tic-tac-toe columns private static final int TOTAL_CELLS = NUM_ROWS * NUM_COLS; private static final int MAX_MOVES = NUM_ROWS * NUM_COLS; // max number of moves // TicTacToe image, message and default cell value constants private static final ImageIcon X_IMAGE = new ImageIcon("images.jpg", ""); // image for X private static final ImageIcon O_IMAGE = new ImageIcon("O.jpg", ""); // image for O private static final String GAME_ENDS_IN_TIE = "nobody wins cause blame john wells"; // tie message private static final String NON_PLAYER_CELL_VALUE = "-"; // "-" is a non player cell // Private TicTacToe members private JButton[] cells; private CellButtonHandler[] cellHandlers; private String gameWinner; private int xGoesFirst; // private int[] press = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // private String xMess = "Cross for you laymens out there"; // private String oMess = "Naugh…
has title: Making a jar manifest. Where does it come from do I make my own?
tagged with: java
has comment: http://stackoverflow.com/comment/42922741
has comment: http://stackoverflow.com/comment/42921706
type: Question
accepted answer: http://stackoverflow.com/a/27221509
answer count: 2

http://stackoverflow.com/a/27208670
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27206354
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27206354
has comment: http://stackoverflow.com/comment/42912329
has body: During sorting swaps the value of 'nums[pivotIndex]' can change. Use fixed pivot instead: public static void quickSort(Integer[] nums, int left, int right) { final int pivot = nums[(left + right) / 2]; // &lt;== Fix pivot value. int l = left; int r = right; while (l &lt;= r) { while (nums[l] &gt; pivot) { l++; } while (nums[r] &lt; pivot) { r--; } if (l &lt;= r) { int tmp = nums[l]; nums[l] = nums[r]; nums[r] = tmp; l++; r--; } } if (left &lt; r) { quickSort(nums, left, r); } if (l &lt; right) { quickSort(nums, l, right); } }
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42912414

http://stackoverflow.com/comment/43222256
type: QuestionComment
comment on: http://stackoverflow.com/q/27281316
has text: I had similar problem. Try disabling Push mode
score: 0
type: Comment

http://stackoverflow.com/a/27209170
has comment: http://stackoverflow.com/comment/42900533
has comment: http://stackoverflow.com/comment/42900271
answers question: http://stackoverflow.com/q/27209154
has comment: http://stackoverflow.com/comment/42900483
downvote count: 0
has comment: http://stackoverflow.com/comment/42900449
has comment: http://stackoverflow.com/comment/42900515
has comment: http://stackoverflow.com/comment/42900330
type: Answer
has comment: http://stackoverflow.com/comment/42900245
score: 1
has comment: http://stackoverflow.com/comment/42900395
upvote count: 1
has body: Right here: return ((double) (p2.getY() - p1.getY()) / (p1.getX() - p2.getX())); Should be return ((double) (p2.getY() - p1.getY()) / (p2.getX())-p1.getX() ); Since the slope formula says that m=(y2-y1)/(x2-x1)
has comment: http://stackoverflow.com/comment/42900374

http://stackoverflow.com/a/27279961
type: Answer
has comment: http://stackoverflow.com/comment/43028633
accepted answer of: http://stackoverflow.com/q/27279787
answers question: http://stackoverflow.com/q/27279787
score: 1
upvote count: 1
has body: You should be putting your Bitmap creation on a separate thread (i.e. getPath(...) and rotateBitmap(...), not your Intent to pick a photo (pickPhoto(View view). Also, instead of rotating your Bitmap by creating a new Bitmap, why not just set the Bitmap on an ImageView and use View.setRotation(float x)? This way, you wouldn't be creating a new Bitmap every time you rotate the image.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42821473
type: QuestionComment
comment on: http://stackoverflow.com/q/27163714
has text: Why are you declaring `XXMaxPermSize` twice? Back on topic, I found [this](https://bugs.eclipse.org/bugs/show_bug.cgi?id=361005) post, which explains how this is a known bug, and contains a patch that should fix your issue
score: 0
type: Comment

http://stackoverflow.com/a/27246136
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42979182
downvote count: 0
has body: Ok, now I understand your question. The answer is that validation stops if there are one or more violations within a given group. To quote the spec: Processing a group is defined in Section 4.6, “Validation routine” ; if one of the groups processed in the sequence generates one or more constraint violations, the groups following in the sequence must not be processed. This ensures that a set of constraint is evaluated only if another set of constraint is valid. See http://beanvalidation.org/1.1/spec/#constraintdeclarationvalidationprocess-groupsequence-groupsequence In your case there is a violation in the Default group which means the Special group is never validated.
has comment: http://stackoverflow.com/comment/139027106
upvote count: 2
answers question: http://stackoverflow.com/q/27173960

http://stackoverflow.com/comment/42900627
has text: yes, I did change the code. I changed `System.out.print(operation.charAt(0) == '-' ? "Difference = " : "Sum = ");` to `if (operation.charAt(0) == '+') System.out.print("The subtotal of the two integers = "); if (operation.charAt(0) == '-') System.out.print("The subtraction of the two integers = ");` I believe it made something wrong, but not sure what exactly..
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27200635
type: AnswerComment

video
tags question: http://stackoverflow.com/q/27290285
type: Tag
tags question: http://stackoverflow.com/q/27208820
tag name: video

http://stackoverflow.com/comment/42829154
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27168767
has text: I'm not the person down vote. Sorry anyone else may be. Why I couldn't put while statement. Why should I comment that?

http://stackoverflow.com/comment/43083190
type: QuestionComment
comment on: http://stackoverflow.com/q/27311281
has text: Please correct the typo in ` VALUE_2 = 0, VALUE_2 = 1`
score: 0
type: Comment

relative-path
type: Tag
tags question: http://stackoverflow.com/q/27230727
tag name: relative-path

http://stackoverflow.com/comment/42925396
comment on: http://stackoverflow.com/q/27223494
score: 1
has text: Why do you want to create Null ArrayList? You can provide the capacity during the ArrayList initialization and it will reserve the memory for exact number of elements: new ArrayList(5); Iterator will work fine in that case as well.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27299375
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27301400
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/72206991
has answer: http://stackoverflow.com/a/72206991
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
favorite count: 0
has title: JPA @OrderBy() Through Relational Table
accepted answer: http://stackoverflow.com/a/27301400
tagged with: sql-order-by
has body: I need some help with the JPA Framework. I've read some answers "kind of" about this topic but I couldn't reach any conclusion. First heres an examplo of the design i'm wooking with. @BusinessObject public class ClassA { @Column(name = "ID", nullable = false) private Long id; @OneToMany(mappedBy = "classAAttr") private Collection&lt;ClassAB&gt; classABCollection; //STUFF AND OTHER COLUMNS..... } public class ClassAB { @Column(name = "ID", nullable = false) private Long id; @JoinColumn(name = "TABLE_A_ID", referencedColumnName = "ID") @ManyToOne private ClassA classAAttr; @JoinColumn(name = "TABLE_B_ID", referencedColumnName = "ID") @ManyToOne private ClassB classBAttr; //STUFF AND OTHER COLUMNS..... } @BusinessObject public class ClassB { @Column(name = "ID", nullable = false) private Long id; @Column(name = "ORDERCLAUSE", nullable = false) private String orderClause; //STUFF AND OTHER COLUMNS..... } So I need to order the classABCollection in ClassA by the orderClause attribute in ClassB, but I can't find the right @OrderBy() clause AND/OR location for it. I've read some things about the Comparator Interface but, unfortunately, due to business policy, I need to be sure that there is no other way... How Should I Do It? Thank you guys in advance.
upvote count: 1
tagged with: relational
tagged with: collections

http://stackoverflow.com/comment/43125202
has text: Thanks for this but I can't find `getdtablesize()` on Android. Can you show me where that is defined?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27330406
type: Comment

http://stackoverflow.com/q/27219780
type: Question
has title: Array index out of bounds exception - no obvious reason for exception
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/42918820
has body: Good evening gang :) ! Was just wondering if anybody could spot what I am doing wrong here? I have made an array sorter that changes one of the arrays values if duplicates are found. The code is here for (int j = 0; j &lt; arrayIn.length; j++){ int temp = j++; if (arrayIn[j] == temp) arrayIn[j] = DUPLICATEREMOVE; } Where DUPLICATEREMOVE is a final int initialised at 70. I write a simple test program and compile which works as expected, but when I run it throws up an array index out of bounds exception. After further digging I also know that if I comment out this line: arrayIn[j] = DUPLICATEREMOVE; then the program works as expected. So the exception is being thrown from this line. I also have changed the statement to have the constant displayed instead, i.e: arrayIn[j] = 7; The int temp was also an experiment as before the if condition read as: if (arrayIn[j] == arrayIn[j++]) which I thought could have been throwing the error. I am a little duked into what I am doing wrong so if anybody can spot what I am doing wrong it would be much appreciated :) ! Thanks.
answer count: 2
has answer: http://stackoverflow.com/a/27219811
downvote count: 1
favorite count: 0
tagged with: exception
type: UnansweredQuestion
upvote count: 0
tagged with: overflow
tagged with: java
has comment: http://stackoverflow.com/comment/42918716
has comment: http://stackoverflow.com/comment/42918728
has answer: http://stackoverflow.com/a/27219785

http://stackoverflow.com/a/27168946
score: 0
has body: Apparently the problem is not related to the return type of getS but the project setup expects SArray to have an application entry point.
type: Answer
answers question: http://stackoverflow.com/q/27168901

http://stackoverflow.com/comment/43031792
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27281011
has text: What compiler are you using and what version of Java are you on? This runs fine for me in eclipse with Java 7

http://stackoverflow.com/a/27184598
accepted answer of: http://stackoverflow.com/q/27183050
answers question: http://stackoverflow.com/q/27183050
has comment: http://stackoverflow.com/comment/42858756
type: Answer
has comment: http://stackoverflow.com/comment/42861251
has body: in LoginAction change String username; with String userID; //variable should match with tag name attribute and create new setters and getters for userID.
score: 0
has comment: http://stackoverflow.com/comment/42857156
has comment: http://stackoverflow.com/comment/42922380
type: AcceptedAnswer

http://stackoverflow.com/q/27259627
has comment: http://stackoverflow.com/comment/42992601
answer count: 3
favorite count: 0
type: UnansweredQuestion
has title: multithreading, start, join -java
tagged with: multithreading
has answer: http://stackoverflow.com/a/27259766
upvote count: 1
has comment: http://stackoverflow.com/comment/42993739
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27259759
has answer: http://stackoverflow.com/a/27259887
type: Question
has body: What is wrong with doing this? I'm currently learning about threads thread1.start(); thread1.join(); thread2.start(); thread2.join(); EDIT: I know this is an error, as it's in the source that I'm learning from. However, the source does not provide an answer as to why it's wrong And what is the difference between using and not using .join on a thread?
downvote count: 0

http://stackoverflow.com/q/27187124
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27187175
favorite count: 0
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/27187175
tagged with: jdbc
type: AnsweredQuestion
has body: I want to connect my application with database. I'm using eclipse. JDBC driver added to class path and after compilation I have a message eror: Could not load requested class : com.postgresql.Driver my hibernate.cfg.xml looks like: org.hibernate.dialect.PostgreSQLDialect com.postgresql.Driver jdbc:postgresql://localhost:5432/postgres Dou You have any idea?
upvote count: 2
type: Question
tagged with: java
tagged with: hibernate
tagged with: eclipse
score: 2
has title: PostgreSQL driver "Unable to load class "

http://stackoverflow.com/q/27210275
has comment: http://stackoverflow.com/comment/42902217
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27210892
answer count: 2
has comment: http://stackoverflow.com/comment/42902358
has comment: http://stackoverflow.com/comment/42902321
downvote count: 0
has body: Let's say I have the following class: public class MyClass&lt;T&gt; { Class&lt;T&gt; type; List&lt;T&gt; items; public Class&lt;T&gt; getType() { return type; } ... } I need to store objects of the above class in a generic container: public class MyContainer&lt;T&gt; { Class&lt;T&gt; type; List&lt;MyClass&lt;T&gt;&gt; myClasses; public Class&lt;T&gt; getType() { return type; } ... } Let's say later in my code I'm given a generic object as an argument: public class Main { public static void main() { List&lt;MyContainer&lt;?&gt;&gt; containers; ... } public void someMethod(MyClass&lt;?&gt; myClass){ ... } } I have type T as reflection. I need to cast MyClass&lt;?&gt; back to its intended type. So if it was declared as MyClass&lt;String&gt; I need to cast it back to MyClass&lt;String&gt;. I can't seem to do this with the reflection type because it is only capable of casting T, not MyClass&lt;T&gt;. I could cast T by doing this for example: myClass.getType().cast(myClass.getItem()); // Where getItem returns an object of the type T But what I want is this: myClass.getType().cast(myClass); // getType() returns T not MyClass&lt;T&gt; So the question is, how do I cast a generic base type along with its reflection type, given the scenario above?
favorite count: 0
has answer: http://stackoverflow.com/a/27211067
has title: How can a generic base type be cast via reflection in Java?
possible better answer: http://stackoverflow.com/a/27211067
has answer: http://stackoverflow.com/a/27210892
upvote count: 1
type: AnsweredQuestion
tagged with: reflection

http://stackoverflow.com/comment/43057860
comment on: http://stackoverflow.com/a/27295251
has text: I already have multiple packages to group actions logically (for example, everything that deals with item management is in the item package). I also have multiple interceptors, not just the login example. to go through with your plan, I would need dozens of packages like the Item_Login_NoMessage_ClearCache_StorePreferences package. How would you deal under those circumstances?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42905894
type: QuestionComment
has text: Thanks mug4n for the link. I guess it's not the same as Java for android where I can just implement serializable and it will just work in another activity.
score: 0
comment on: http://stackoverflow.com/q/27210593
type: Comment

http://stackoverflow.com/a/27719988
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27243698
has body: If you're using standard analyzer, elasticsearch tokenizes every word by default using white space tokenizer. You can use query string query for your search in that case, where you can add multiple fields to search in. Also query string query's default operator is "OR". So if your search term is "nosql delhi" (as in your case), it is translated into "nosql OR delhi" and searched in all the fields specified in the query. This way you can search multiple terms in multiple fields. Hope that helps.

http://stackoverflow.com/comment/42941998
type: Comment
score: 0
has text: By nothing happens I mean i get the HTTP Status 404 (description - The requested resource is not available). The UserController is in package package com.iquestgroup.webapp.
type: AnswerComment
comment on: http://stackoverflow.com/a/27231946

http://stackoverflow.com/q/27225059
has answer: http://stackoverflow.com/a/29560116
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44584883
has body: I'm experiencing a strange issue in my webapp using struts 2.3.3 and spring 3.2.8. In one of my JSP I'm trying to retrieve a simple attribute of my action: JSP: &lt;%@taglib prefix="s" uri="/struts-tags"%&gt; &lt;s:property value="getName()" /&gt; &lt;s:property value="name" /&gt; I have defined the getter getName() and the attribute name in my action. When I deploy the webapp in tomcat 7 sometimes the first property is not displayed (completely empty) whereas the second one is correctly rendered. I just need to restart tomcat to have both working. I suspect an initialization issue but I can't find anything in tomcat logs. I even tried to remove the precompiled jsps from tomcat folder to force a recompilation. Has someone experienced a similar issue in the past? I've seen on struts documentation that they generally used the second method to access action attribute &lt;s:property value="name" /&gt; I will try to move all my calls to this method but I was wondering why sometimes both methods work and sometimes the first one is failing... UPD: Here is the action code: public abstract AbstractAction extends ActionSupport implements ServletRequestAware, ServletResponseAware { @Autowired private PublisherComponent publisherComponent; private String name; /* ... */ public String getName() { return publisherComponent.getPublisher().getName(); } } All my actions are subclasses of AbstractAction. The name attribute is not used inside the action itself, only in the JSP. The publisherComponent.getPublisher() retrieved a "Publisher" instance from MySQL, the DAO functions are working correctly (Unit tests succeed and &lt;s:property value="name" /&gt; also returns the correct name value).
has title: struts property get attribute
score: 3
tagged with: java
tagged with: struts2
type: Question
has comment: http://stackoverflow.com/comment/42929788
has comment: http://stackoverflow.com/comment/44302155
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/a/27240795
answers question: http://stackoverflow.com/q/27240431
upvote count: 2
type: Answer
score: 2
has body: Looks like you are mixing dependency versions.. try using jersey-server-1.8 and jersey-json-1.8 (and adjust their dependencies versions) Maven could help you out on this.. EDIT: Try using the following jars
accepted answer of: http://stackoverflow.com/q/27240431
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42859886
type: Comment
has text: User was asking what's wrong with his code. Inproper naming of classes certainly is, no matter whether its just a convention or not.
comment on: http://stackoverflow.com/a/27174654
type: AnswerComment
score: 0

http://stackoverflow.com/q/27254197
has body: Lets say i already have an application running in my computer (hlds.exe) Now how do i actually send commands to it. It is running using console. I need to send commands "restart", "ChangeLevel" using java. How do i do that? Thanks for your help
favorite count: 0
has comment: http://stackoverflow.com/comment/42982558
has answer: http://stackoverflow.com/a/36866834
has comment: http://stackoverflow.com/comment/42982392
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: process
has title: How to interact with already running process using java
type: Question
has comment: http://stackoverflow.com/comment/43055076
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42854993
comment on: http://stackoverflow.com/q/27181991
has text: Just the way the data looks in your output. It looks like you have an off-by-1 error or something in your transform. Impossible to say exactly but that is what it looks like.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27257459
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42989659
has comment: http://stackoverflow.com/comment/42988649
has comment: http://stackoverflow.com/comment/42989959
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/43565662
has answer: http://stackoverflow.com/a/43565662
has answer: http://stackoverflow.com/a/27258657
tagged with: servlets
tagged with: response
has body: I suppose this is some kind of dependency problem so here is my tree: [INFO] Sikor:BrowserGame:war:1.0-SNAPSHOT [INFO] +- junit:junit:jar:3.8.1:test [INFO] +- org.springframework:spring-context:jar:4.1.1.RELEASE:compile [INFO] | +- org.springframework:spring-aop:jar:4.1.1.RELEASE:compile [INFO] | +- org.springframework:spring-beans:jar:4.1.1.RELEASE:compile [INFO] | +- org.springframework:spring-core:jar:4.1.1.RELEASE:compile [INFO] | | \- commons-logging:commons-logging:jar:1.1.3:compile [INFO] | \- org.springframework:spring-expression:jar:4.1.1.RELEASE:compile [INFO] +- org.springframework:spring-webmvc:jar:4.1.1.RELEASE:compile [INFO] | \- org.springframework:spring-web:jar:4.1.1.RELEASE:compile [INFO] +- org.springframework:spring-context-support:jar:4.1.1.RELEASE:compile [INFO] +- org.springframework.security:spring-security-web:jar:3.2.5.RELEASE:compile [INFO] | +- aopalliance:aopalliance:jar:1.0:compile [INFO] | \- org.springframework.security:spring-security-core:jar:3.2.5.RELEASE:compile [INFO] +- org.springframework.security:spring-security-config:jar:3.2.5.RELEASE:compile [INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.5.RELEASE:compile [INFO] | \- org.springframework.security:spring-security-acl:jar:3.2.5.RELEASE:compile [INFO] +- org.thymeleaf:thymeleaf-spring4:jar:2.1.3.RELEASE:compile [INFO] | \- org.thymeleaf:thymeleaf:jar:2.1.3.RELEASE:compile [INFO] | +- ognl:ognl:jar:3.0.6:compile [INFO] | \- org.unbescape:unbescape:jar:1.0:compile [INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.1.RELEASE:compile [INFO] +- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.2.7:compile [INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.5.FINAL:compile [INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile [INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile [INFO] | +- org.hibernate:hibernate-core:jar:4.3.5.Final:compile [INFO] | | +- antlr:antlr:jar:2.7.7:compile [INFO] |…
answer count: 3
has comment: http://stackoverflow.com/comment/42990549
has comment: http://stackoverflow.com/comment/42990141
has comment: http://stackoverflow.com/comment/42989193
downvote count: 0
has comment: http://stackoverflow.com/comment/42989300
favorite count: 0
has comment: http://stackoverflow.com/comment/42990017
has comment: http://stackoverflow.com/comment/42988547
has title: NoSuchMethodError while calling response.getStatus()
accepted answer: http://stackoverflow.com/a/27258657
has comment: http://stackoverflow.com/comment/42988883
tagged with: spring
has answer: http://stackoverflow.com/a/46316290

http://stackoverflow.com/q/27163399
type: Question
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/42820791
has answer: http://stackoverflow.com/a/27163506
score: 0
tagged with: swing
answer count: 1
has title: How can I draw an image part by part?
tagged with: java
type: UnansweredQuestion
tagged with: image
has body: class DrawIma extends JPanel{ protected void paintComponent(Graphics g) { super.paintComponent(g); for (int i=0;i&lt;20;i++){ for (int j=0;j&lt;20;j++) { g.drawImage(BuArr[i*20+j], 20*i, 20*j, 20, 20, null); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } } } In this part, BuArr are the 400 blocks divided from a BufferedImage, now i want them to be draw one by one, but the method can not draw the blocks separately, how can i do this?
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/42820499

http://stackoverflow.com/comment/43157537
score: 0
comment on: http://stackoverflow.com/a/27317008
type: Comment
has text: can you tell how to clean the project
type: AnswerComment

http://stackoverflow.com/q/27238006
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42963358
tagged with: vector
has comment: http://stackoverflow.com/comment/42953749
answer count: 2
has answer: http://stackoverflow.com/a/27241203
downvote count: 0
favorite count: 0
tagged with: geometry
possible better answer: http://stackoverflow.com/a/27238372
has comment: http://stackoverflow.com/comment/42954594
has comment: http://stackoverflow.com/comment/43013335
has comment: http://stackoverflow.com/comment/43013507
has answer: http://stackoverflow.com/a/27238372
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27241203
has body: In Java, what is the best way to determine if a point (of which I have many) given in 6 dimensions lies on the same plane as other points in a 6-dimensional space? It's clear how to do that in 2D and 3D, but as far as I know some of the concepts such as cross product, etc, do not generalise to higher dimensions (or only to a specific few). It would also be helpful to find a way to answer the same question for points on lines in 6D. More general, I have given a higher dimensional point cloud and I want to determine if some of these points lie on the same plane.
has title: Determine coplanar (or collinear) points in higher dimensions with Java
upvote count: 2

http://stackoverflow.com/comment/43071487
type: QuestionComment
has text: Aside from your main question, if you're new to OWLAPI I'd recommend to use OWLAPI 4.0.1 and JFact 4.0.0, unless you have a reason to use older versions.
comment on: http://stackoverflow.com/q/27284954
score: 0
type: Comment

http://stackoverflow.com/comment/42856973
comment on: http://stackoverflow.com/q/27184092
has text: @greenapps Inmediately when the server detect the number of faces
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27293036
has answer: http://stackoverflow.com/a/27293536
has title: From JTextField to JFormattedTextField
tagged with: jformattedtextfield
has comment: http://stackoverflow.com/comment/43053878
tagged with: swing
tagged with: jtextfield
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43052077
tagged with: java
has comment: http://stackoverflow.com/comment/43051579
accepted answer: http://stackoverflow.com/a/27293536
has body: In NetBeans I've created a project with many of JTextField's. Now I understand that I should validate it. Is it possible to "cast" text fields to JFormattedTextField's?
has comment: http://stackoverflow.com/comment/43051355
tagged with: validation
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43052210
has comment: http://stackoverflow.com/comment/43051292

http://stackoverflow.com/q/27309065
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/43080067
has answer: http://stackoverflow.com/a/27309529
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: complexity-theory
accepted answer: http://stackoverflow.com/a/27309529
has body: Below is an algorithm which is used to generate multiple sets. Precisely it solves the following question Print all combination of element in the array such that first element of array is d and next element in the array can be +1 or -1 the previous element in the array. Code was required. Input: num=4, level=3. Output - 4, 3, 2 || 4, 3, 4 || 4, 5, 4 || 4, 5, 6. This question does not uses int[] arr = new int[level] as a data store which eventually gets copied into a list of int arrays. What is the space complexity of the following code ? Is it O(level) ie the storage used to solve the problem or is it O(2^level - 1) ie the size of the return type ? public static List&lt;int[]&gt; getCombinations(int num, int level) { final List&lt;int[]&gt; combinations = new ArrayList&lt;int[]&gt;(); int[] arr = new int[level]; computeCombinations(num, level - 1, 0, combinations, arr); // note : its level - 1, since currentlevel is set to 0. return combinations; } private static void computeCombinations(int num, int level, int currLevel, List&lt;int[]&gt; list, int[] arr) { arr[currLevel] = num; if (currLevel == level) { // list.add(arr); &lt;- wrong to do it so int[] temp = new int[arr.length]; System.arraycopy(arr, 0, temp, 0, arr.length); list.add(temp); return; } computeCombinations(num - 1, level, currLevel + 1, list, arr); computeCombinations(num + 1, level, currLevel + 1, list, arr); }
score: 1
upvote count: 1
has title: Does return value account for space complexity
tagged with: space-complexity

http://stackoverflow.com/q/27297879
has comment: http://stackoverflow.com/comment/43099949
has comment: http://stackoverflow.com/comment/50153357
favorite count: 0
tagged with: angularjs
has body: I have to write a controller in my project using servlets. I've done it before but I've never worked with AngularJS, so I did it via request.setAttribute() and request.getParameter() and put Java code inside of a JSP page. But now frontend developer used AngularJS and I have to return him a JSON object. And I have no idea how to do it. Here's the code of abTestCtrl.js: app.controller("abTestCtrl", function($scope, $location, $http) { $scope.title = "no title"; $scope.description = "no description"; $scope.getParam = $location.search()['id']; if($scope.getParam === undefined)$scope.getParam = 0; //$scope.getParam=2; //path: localhost8080/UIUM.../servlet-name.java //with two ids //web.xml: serverlet mapping for the path if($scope.getParam==='0'||$scope.getParam === 0){ var saveButton = document.getElementById("saveButton"); saveButton.classList.remove("hidden"); } else{ $http.get('http://localhost:8080/UIUM_IMT4003/ABTestController', {command:'getTestCaseInfo', testcaseID:$scope.getParam}). success(function(data, status, headers, config) { // this callback will be called asynchronously // when the response is available console.log('request succesful'); console.log(data); console.log(status); console.log(headers); console.log(config); }). error(function(data, status, headers, config) { // called asynchronously if an error occurs // or server returns response with an error status. console.log('request not succesful'); }); } and my processRequest() code from the servlet: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, ClassNotFoundException { response.setStatus(HttpServletResponse.SC_OK); response.setContentType("application/json; charset=UTF-8"); //PrintWriter printout = response.getWriter(); JSONObject jObject = null; RequestDispatcher view = null; TestcaseRepository testcaseRepo = new TestcaseRepository(); String command = request.getParameter("command"); if(command == null) { …
has comment: http://stackoverflow.com/comment/43060717
has answer: http://stackoverflow.com/a/27299122
has comment: http://stackoverflow.com/comment/43060839
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/27299122
tagged with: javascript
tagged with: servlets
has title: How to return JSON object to AngularJS using Java Servlet
has comment: http://stackoverflow.com/comment/51204940
downvote count: 0
answer count: 1

jsonmodel
type: Tag
tags question: http://stackoverflow.com/q/27164108
tag name: jsonmodel

http://stackoverflow.com/comment/42909174
type: Comment
comment on: http://stackoverflow.com/a/27214209
score: 0
type: AnswerComment
has text: It wants btnPlay to be static. I make it static and I hope that won't cause it any more troubles. It works now :)

orm
tags question: http://stackoverflow.com/q/27204132
tags question: http://stackoverflow.com/q/27159829
tags question: http://stackoverflow.com/q/27212600
tags question: http://stackoverflow.com/q/27264687
tags question: http://stackoverflow.com/q/27260526
tags question: http://stackoverflow.com/q/27213688
tags question: http://stackoverflow.com/q/27188076
tags question: http://stackoverflow.com/q/27280818
tags question: http://stackoverflow.com/q/27173049
tags question: http://stackoverflow.com/q/27169767
tags question: http://stackoverflow.com/q/27284228
tag name: orm
tags question: http://stackoverflow.com/q/27202235
tags question: http://stackoverflow.com/q/27205652
type: Tag
tags question: http://stackoverflow.com/q/27155241
tags question: http://stackoverflow.com/q/27244120
tags question: http://stackoverflow.com/q/27293367
tags question: http://stackoverflow.com/q/27221620
tags question: http://stackoverflow.com/q/27171823
tags question: http://stackoverflow.com/q/27239857
tags question: http://stackoverflow.com/q/27311179
tags question: http://stackoverflow.com/q/27197161
tags question: http://stackoverflow.com/q/27305950

generics
tags question: http://stackoverflow.com/q/27261950
tags question: http://stackoverflow.com/q/27308929
tags question: http://stackoverflow.com/q/27272857
tags question: http://stackoverflow.com/q/27282474
tags question: http://stackoverflow.com/q/27209976
tags question: http://stackoverflow.com/q/27280988
tags question: http://stackoverflow.com/q/27259747
tags question: http://stackoverflow.com/q/27155596
tags question: http://stackoverflow.com/q/27208839
tags question: http://stackoverflow.com/q/27313327
tags question: http://stackoverflow.com/q/27230928
type: Tag
tags question: http://stackoverflow.com/q/27206953
tags question: http://stackoverflow.com/q/27168619
tags question: http://stackoverflow.com/q/27186456
tags question: http://stackoverflow.com/q/27161991
tags question: http://stackoverflow.com/q/27268867
tags question: http://stackoverflow.com/q/27159933
tags question: http://stackoverflow.com/q/27238168
tags question: http://stackoverflow.com/q/27291808
tags question: http://stackoverflow.com/q/27189075
tags question: http://stackoverflow.com/q/27255336
tags question: http://stackoverflow.com/q/27260370
tags question: http://stackoverflow.com/q/27274198
tags question: http://stackoverflow.com/q/27229428
tags question: http://stackoverflow.com/q/27234302
tags question: http://stackoverflow.com/q/27272754
tags question: http://stackoverflow.com/q/27256518
tags question: http://stackoverflow.com/q/27272780
tags question: http://stackoverflow.com/q/27284731
tags question: http://stackoverflow.com/q/27154322
tags question: http://stackoverflow.com/q/27171823
tags question: http://stackoverflow.com/q/27243472
tags question: http://stackoverflow.com/q/27297389
tags question: http://stackoverflow.com/q/27275034
tags question: http://stackoverflow.com/q/27162013
tags question: http://stackoverflow.com/q/27280652
tags question: http://stackoverflow.com/q/27283001
tags question: http://stackoverflow.com/q/27157953
tags question: http://stackoverflow.com/q/27283479
tags question: http://stackoverflow.com/q/27308736
tags question: http://stackoverflow.com/q/27234928
tags question: http://stackoverflow.com/q/27166610
tags question: http://stackoverflow.com/q/27272545
tag name: generics
tags question: http://stackoverflow.com/q/27289897
tags question: http://stackoverflow.com/q/27200291
tags question: http://stackoverflow.com/q/27305818
tags question: http://stackoverflow.com/q/27256894
tags question: http://stackoverflow.com/q/27261434

http://stackoverflow.com/comment/42867426
type: Comment
comment on: http://stackoverflow.com/a/27190416
score: 0
type: AnswerComment
has text: if i want to thorw exception when access DB by the method, how can i do through @Transactional, thank

http://stackoverflow.com/q/27312821
type: Question
has comment: http://stackoverflow.com/comment/43087094
has comment: http://stackoverflow.com/comment/43086893
accepted answer: http://stackoverflow.com/a/27351171
has comment: http://stackoverflow.com/comment/43086990
has comment: http://stackoverflow.com/comment/43086542
score: 0
has comment: http://stackoverflow.com/comment/43086290
has comment: http://stackoverflow.com/comment/43086669
tagged with: sql
has answer: http://stackoverflow.com/a/27351171
answer count: 1
has body: Below is the code snipped for my POJO and the HQL query to retrieve the roles for the given account. For some reason the HQL query results in a '0' rows selected even though a match exists in the DB. @Entity @Table(name="account_roles") public class AccountRoles implements Serializable { @Column(name = "roleName") private String roleName; @Column(name = "accountNumber") private String accountNumber; @Id @Column(name = "iD") private int iD; public String getRoleName() { return roleName; } public void setRoleName(String roleName){ this.roleName = roleName;} public String getAccountNumber() { return accountNumber;} public void setAccountNumber(String accountNumber){ this.accountNumber = accountNumber;} public int getId() { return iD;} public void setId(int iD){ this.iD = iD; } } @Override @SuppressWarnings("unchecked") public AccountRoles getKey(String accountNum, String roleName) throws Exception{ String sql = "from AccountRoles where accountNumber= :accountNumber AND roleName= :roleName"; Session session = getSessionFactory().getCurrentSession(); List&lt;AWSAccountRoles&gt; accountRoles; try{ accountRoles = session.createQuery(sql) .setString("accountNumber",accountNum) .setString("roleName",roleName) .list(); if(accountRoles.size() &gt;0 ){ System.out.println(" found at least 1 row"); return accountRoles.get(0); }else{ System.out.println("returned empty list"); return null; } }catch (Exception ex){ ex.printStackTrace(); throw ex; } DDL for the table is as follows: CREATE TABLE `account_roles` ( `iD` int(11) NOT NULL AUTO_INCREMENT, `accountNumber` varchar(15) NOT NULL, `roleName` varchar(25) NOT NULL, PRIMARY KEY (`id`), KEY `accountNumber` (`accountNumber`,`roleName`) ) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1; Need some help with debugging why the query results in an empty list ( or '0' rows )
has title: Issues with Hibernate HQL select query
has comment: http://stackoverflow.com/comment/43086858
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: hql
has comment: http://stackoverflow.com/comment/43086086

http://stackoverflow.com/q/27175445
has comment: http://stackoverflow.com/comment/42840808
downvote count: 1
has body: Possible noob question but I cant get my method with parameters in one class to call in the other ? FirstClass public class Firstclass { public static void main(String[] args) { Test1 test = new Test1(); test.Passingvalue(); test.myMethod(); } } SecondClass import java.util.Scanner; public class Test1 { public void Passingvalue (){ Scanner Scan = new Scanner(System.in); System.out.println("File Name ? "); String txtFile = Scan.next(); } public void myMethod(String txtFile){ System.out.print("Scan this file" + txtFile); } }
has comment: http://stackoverflow.com/comment/42840741
type: Question
has answer: http://stackoverflow.com/a/27175481
has comment: http://stackoverflow.com/comment/42840672
has comment: http://stackoverflow.com/comment/42840477
accepted answer: http://stackoverflow.com/a/27175718
has title: How to call a method with parameter from a diffrent class
score: 0
has answer: http://stackoverflow.com/a/27175918
favorite count: 0
has answer: http://stackoverflow.com/a/27175681
answer count: 5
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/27175718
has comment: http://stackoverflow.com/comment/42840303
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42840441
possible better answer: http://stackoverflow.com/a/27175494
tagged with: java
has answer: http://stackoverflow.com/a/27175494
upvote count: 1
tagged with: methods

http://stackoverflow.com/comment/42861743
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27187118
type: AnswerComment
has text: @DontRelaX fantastic sir..really its too cool..here some idiots did not understands the ques..they wanted to block..thnx again

http://stackoverflow.com/comment/43082733
has text: it is maven-surefire-plugin 2.6
score: 0
comment on: http://stackoverflow.com/q/27294425
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27282796
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27282992
upvote count: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/43033981
type: Question
has answer: http://stackoverflow.com/a/27282857
has body: Okay, so I want to read things in from a file. They look like this: 70 Fresno Credit Bureau Fresno CA 93714 And I want it to be in pieces, with the 70 going to an int, Fresno Credit Bureau and Fresno to go into separate strings, the state initials into separate chars, and finally feeding that last zip code into another int. I've attempted to read it piecemeal using Scanner, and I've attempted to read it in wholesale as a string buffer and no dice either way. while(gre.hasNextLine()){ imidate = gre.nextInt(); gre.skip(" "); han = gre.next(); gre.skip(" "); luke = gre.next(); gre.skip(" "); bok = gre.next().charAt(0); mander = gre.next().charAt(1); gre.skip(" "); imate = gre.nextInt(); theTree.addNode(imate, han, luke, bok, mander, imidate); } Which is probably screwing up on the parsing somewhere, from the looks of it, but I can't tell where. Any suggestions? Comments? Concerns?
possible better answer: http://stackoverflow.com/a/27282940
answer count: 3
has answer: http://stackoverflow.com/a/27282940
has comment: http://stackoverflow.com/comment/43034058
favorite count: 0
accepted answer: http://stackoverflow.com/a/27282857
has title: trying to parse inputs that go int string string char int
tagged with: input
has comment: http://stackoverflow.com/comment/43034197
score: 2

http://stackoverflow.com/comment/42989564
has text: You should open and close a connection in the shortest possible scope.
type: QuestionComment
comment on: http://stackoverflow.com/q/27257927
score: 0
type: Comment

http://stackoverflow.com/q/27279187
downvote count: 0
accepted answer: http://stackoverflow.com/a/27279263
favorite count: 0
has title: Java regular expression for password validation
tagged with: regex
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27279263
has body: I have sample of Java REGEX which I want to use on a dynamic way to validate the password. I don't know is this possible through the regular expression, but I would like to hear some opinions. Other options always there are, but I would like to implement it like this. Sample REGEX to validate a password: ((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20}) The point is that possible to to have dynamic number of digits for example? It is configurable and can be changed. Numbers must be mixed up through the entire length of the password.
tagged with: validation
answer count: 1

http://stackoverflow.com/a/27248142
has body: Its because the protein data object has to be initialized before you call the setter method. Hope this helps
score: 0
answers question: http://stackoverflow.com/q/27247990
type: Answer

http://stackoverflow.com/comment/43073072
comment on: http://stackoverflow.com/a/27303298
score: 0
type: AnswerComment
type: Comment
has text: Thank you very much for your answer. Please see my edit above though; I need to decide which method to run depending on the _combination_ of filled/unfilled fields, rather than just if one field is empty

http://stackoverflow.com/comment/42976361
has text: The `@Id` annotation on many columns including the `Date` field? Did you decorate the `Date` field by the `@Temporal` annotation such as `@Temporal(TemporalType.Timestamp)` or `@Temporal(TemporalType.DATE)` in your real code?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27250720

http://stackoverflow.com/comment/43060225
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27297876
type: Comment
has text: Did you put the break inside the catch brackets or outside?

http://stackoverflow.com/comment/42873682
has text: @msrd0 It is not one statement, in both solutions your improvement hint and his, the condirtion needs two statements. You just wrote it in one line. This does not save anything.
comment on: http://stackoverflow.com/a/27193963
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/44564512
comment on: http://stackoverflow.com/q/27258103
score: 0
type: Comment
type: QuestionComment
has text: Was this solved for you? Are you still there?

http://stackoverflow.com/a/28802371
answers question: http://stackoverflow.com/q/27283595
type: Answer
has body: Note: The below points should be read keeping into mind that they are tested with Mac OS X 10.10.2 and Java 7 &amp; 8. I have observed the behavior of the installations of the JDK/JRE for Java 7 &amp; 8 on Mac OS X 10.10(assuming this should go well with Mac OS X 10.7.3 and later, when Mac OS started supporting java 7 and later). On a Mac machine, either JRE 7 or JRE 8 can be installed into the default location which is /Library/Internet Plug Ins/JavaAppletPlugin.plugin/. As we upgrade from JRE 7 to JRE 8, the earlier version gets overridden from the system. The command java -version wouldn't show any thing until you have installed JDK. We can have two or more versions of JDK on the same system. They can be found from directory /Library/Java/JavaVirtualMachines/. By default, the command java -version would always show the latest JDK installer on the system. As we remove or upgrade the JDK from the system, java -version command shows the results accordingly. As per my requirements, I never had to set the JAVA_HOME. As I stated above that JRE can be found from the path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/ and in postscript I initiated my application using command /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java This way, we don't to remove the JDK1.6 from our system. Rather, if we are running our application with just java then make sure correct version of JDK is installed but if we are running our application using the JRE then make sure you provide the full path of the JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
score: 0

http://stackoverflow.com/comment/43049925
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27290127
score: 0
has text: @RishiKeshPathak i cant do that cause there is no thymeleaf-extras-tiles3-spring4 library yet

http://stackoverflow.com/q/27245017
has body: Hie guys. I am very new to stack exchange and I am currently doing a research on graph theory. The set of questions I'm going to ask are very introductory since I'm a beginner level programmer (not acquainted with hashing, buckets, vectors etc data structure wise). My idea is to take in a dataset of the form (timestamp t, node i, node j) which says that there is an edge between i and j at time t. The idea is to search the neighborhood set of each nodes and hash them. If their "vectors" (I don't understand what that is) hash into the same bucket - they are candidates for cluster formation. But he problem is I want to do experiments and try to run it. But have no idea how do I implement a hash function, and then bucket them together. I'm not saying help me out with the code. But a pointer (pseudo code) would be very helpful. Like telling me to initialize a hash table etc etc
downvote count: 4
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27245138
favorite count: 0
accepted answer: http://stackoverflow.com/a/27245138
tagged with: python
has title: LSH implementation for finding clusters
tagged with: minhash
tagged with: java
score: -4
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42886219
type: QuestionComment
has text: I can't see why eclipse would do that. Post full example that eclipse warns on.
comment on: http://stackoverflow.com/q/27190283
score: 0
type: Comment

http://stackoverflow.com/a/27175124
type: Answer
has body: See as an example Math#max: public static double max(double a, double b) Since it's static, it means that it's not associated with any object. You can simply call it. Now look at PrintStream#println: public void println(boolean x) Since it's not static, you cannot directly call it by writing PrintStream.println(something). Think about it, it really make sense that max is static since it doesn't have to be associated with an object, it doesn't really needs an information about an object as it doesn't care about it. It has a well defined behavior for all objects. No special treatment for some objects over others.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27175059
upvote count: 1

http://stackoverflow.com/comment/42894808
type: Comment
has text: In that case, how do I transfer information from the threads in the array to the main thread?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27204773

http://stackoverflow.com/q/27202640
favorite count: 0
tagged with: abstract-class
tagged with: abstract
has answer: http://stackoverflow.com/a/27202678
answer count: 4
accepted answer: http://stackoverflow.com/a/27202679
has title: Why must a class which contains an abstract method be abstract?
has answer: http://stackoverflow.com/a/27202679
has body: I don't understand why a class, which contains an abstract method, must be abstract.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27202678
tagged with: java
has answer: http://stackoverflow.com/a/27202677
score: -1
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/42888239
upvote count: 1
has answer: http://stackoverflow.com/a/27202682

http://stackoverflow.com/comment/43162119
score: 0
type: AnswerComment
has text: tyvm! that answers it
type: Comment
comment on: http://stackoverflow.com/a/27318358

http://stackoverflow.com/q/27168565
answer count: 1
has comment: http://stackoverflow.com/comment/42864673
has comment: http://stackoverflow.com/comment/42830677
tagged with: paragraphs
has body: I think that paragraph elements by definition creates a new line but I need to insert elements as the first element of a page not moving down existing elements. Is there another element I can use instead of paragraph? I think that only tables and paragraphs are available and I understand that tables contains paragraphs so they don't work for my purpose. Or maybe exists any property I can set to avoid the new paragraph moving the other elements? I tried keepNext and keepLines but is not what I'm looking for.
has answer: http://stackoverflow.com/a/27196677
has comment: http://stackoverflow.com/comment/42832815
tagged with: openxml
has title: Avoid carriage return in paragraph with doxc4j
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42876411
type: Question
tagged with: docx4j
tagged with: carriage-return
has comment: http://stackoverflow.com/comment/42876557
has comment: http://stackoverflow.com/comment/42861333
score: 0
has comment: http://stackoverflow.com/comment/42834669

http://stackoverflow.com/comment/43043736
comment on: http://stackoverflow.com/q/27288636
score: 0
has text: No i want to load/import the file that i selected by clicking a Button.Like what we open a file in windows File Open explorer.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27295015
favorite count: 0
has body: I have strange problem with JMagick library. I use Debian, so I have installed libjmagick6-java and libjmagick6-jni, and here are steps I have done: I have copied jmagick-6.6.9.jar from /usr/share/java/ to $JAVA_HOME/jre/lib/ext/. I have set /usr/lib/jni (where is libJMagick.so) as native library location in: JRE System library (in eclipse) jmagick-6.6.9.jar (in eclipse) Also I have tested JMagick in simple Java project and there it works, but in the second project which is web application running in Tomcat 6, it just doesn't work.. Here is my code which WORKS - so jmagick must be installed right: public class Main { public static void main(String[] arg) { MagickImage image = null; ImageInfo imageInfo = null; try { imageInfo = new ImageInfo("/home/firzen/IMG_0120.JPG"); image = new MagickImage(imageInfo); System.out.println(image.getDimension().width); } catch (MagickException e) { System.out.println(e); } image.destroyImages(); } } And here is the code in webapp which is NOT WORKING: public void init() { ServletContext sc = getServletContext(); cacheHandlers = (Map&lt;String, CacheContext&gt;) sc.getAttribute("handlers"); Boolean applicationReady = (Boolean) sc.getAttribute("ready"); isReady = cacheHandlers != null &amp;&amp; Boolean.TRUE.equals(applicationReady); System.out.println("zde"); MagickImage image = null; ImageInfo imageInfo = null; try { imageInfo = new ImageInfo("/home/firzen/IMG_0120.JPG"); image = new MagickImage(imageInfo); System.out.println(image.getDimension().width); } catch (MagickException e) { System.out.println(e); } image.destroyImages(); } Finally here is the exception thrown by mentioned code: java.lang.UnsatisfiedLinkError: no JMagick 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 magick.Magick.&lt;clinit&gt;(Magick.java:18) at cz.bach.mrimage.MrImageSrv.init(MrImageSrv.java:44) at javax.servlet.GenericServlet.i…
has answer: http://stackoverflow.com/a/27503522
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
upvote count: 4
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27503522
tagged with: tomcat
score: 4
has title: Cannot got JMagick working
tagged with: jmagick

http://stackoverflow.com/comment/42972582
type: Comment
comment on: http://stackoverflow.com/a/27249055
has text: Deinum, you are right but that will only work from Spring managed beans. Since the OP seems to be creating this object himself (newBuilder()) this will not work.
score: 1
type: AnswerComment

http://stackoverflow.com/a/27255371
upvote count: 2
has body: Looks like you're overcomplicating this by quite a degree! You've got a SwingWorker, which executes on a background thread; and then that's kicking off another thread of its own. I think you want your ActionListener to start a SwingWorker to do the sorting, and that can use SwingUtilities.invokeLater() to schedule a repaint whenever it feels like it. Or else do your updates in the process() method, and call publish() to trigger that to do a repaint.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27255244
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27255244
has comment: http://stackoverflow.com/comment/43078840

http://stackoverflow.com/comment/42806930
score: 0
type: Comment
type: QuestionComment
has text: I've rolled back your question, since it seemed like you were adding a new one into it. If you've got another question, feel free to ask a new question.
comment on: http://stackoverflow.com/q/27156158

http://stackoverflow.com/q/27222592
linked to: http://stackoverflow.com/q/2056221
has body: I want to create an Image slide from gallery (filePath). I want my code auto search all image in this filePath and put it in an ArrayList. But I don't know how?
has comment: http://stackoverflow.com/comment/42923758
score: 0
has answer: http://stackoverflow.com/a/27226977
answer count: 1
has title: How can I get all Image from gallery?
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/43080899
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27303404
has text: Perfect. Thats the solution. Thanks a lot.
score: 0

http://stackoverflow.com/comment/42830826
score: 1
type: Comment
has text: A path is hierarchical like `/a/b/c/d` - there will always be a part that exists already, and it can't fail just in between because that would result in a different part like `/a/b/d/`. So "true" is only then returned when it had to create (at least) that last path part (`d`) and succeeded, the parts before must exist in logical consequence.
type: QuestionComment
comment on: http://stackoverflow.com/q/27169703

http://stackoverflow.com/comment/42848072
score: 0
type: Comment
has text: maybe this wikipedia article will help: http://en.wikipedia.org/wiki/Binary_heap You are looking to implement the shape property of the heap, not necessarily the heap property. I am unfortunately unable to write up a full answer right now, maybe I will later though.
type: QuestionComment
comment on: http://stackoverflow.com/q/27179341

http://stackoverflow.com/a/27174756
upvote count: 5
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27174716
has body: Because of return Statement at the very first line. Once return is called, following lines doesn't matter. I don't know what questionText is doing, but it may work fine even without the first line itself. Cheers

http://stackoverflow.com/q/27183842
has comment: http://stackoverflow.com/comment/42855473
downvote count: 1
type: Question
tagged with: call
tagged with: java
has comment: http://stackoverflow.com/comment/42854957
has title: Call method before each method
answer count: 2
has answer: http://stackoverflow.com/a/27183955
favorite count: 0
has answer: http://stackoverflow.com/a/27184112
has comment: http://stackoverflow.com/comment/42854987
has body: Is it possible to call a method before every method without calling it programmatically before every method? For example when I've got a logger which should log "Hey" before each method, I could log manually before every method. But is there a way that every method triggers the log?
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42854977
upvote count: 1
tagged with: methods

http://stackoverflow.com/a/27266973
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27245601
accepted answer of: http://stackoverflow.com/q/27245601
has body: I was able to solve this problem.. The reason why some classes from service play jar was not being copied in apk was because jar was built on Java 7 and dx tool was not able to process it. I changed the build tool version in gradle script from 18.0.1(dx can only process java 6) to 19.0.3( dx tool can process Java 7). Hopefully this will help other people.

http://stackoverflow.com/q/27247599
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27247755
has title: Catched exception is not handle with the correct method
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27247818
accepted answer: http://stackoverflow.com/a/27247755
possible better answer: http://stackoverflow.com/a/27247640
has answer: http://stackoverflow.com/a/27247851
has answer: http://stackoverflow.com/a/27247640
downvote count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/42969962
has body: I have the simple code below : class Test { public static void main(String[] args) { Test t = new Test(); try { t.throwAnotherException(); } catch (AnotherException e) { t.handleException(e); } try { t.throwAnotherException(); } catch (Exception e) { System.out.println(e.getClass().getName()); t.handleException(e); } } public void throwAnotherException() throws AnotherException { throw new AnotherException(); } public void handleException(Exception e) { System.out.println("Handle Exception"); } public void handleException(AnotherException e) { System.out.println("Handle Another Exception"); } } class AnotherException extends Exception { } Why the method called in the second catch is the one with the signature void handleException(Exception e) whereas the kind of exception is AnotherException?

http://stackoverflow.com/comment/43082828
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27309932
has text: I misread your comment. Do you have regout.txt open? If yes, close it. The batch deletes the file then recreates its, so I'm not sure the problem. It's late where I am, but will check in once more tonight.
type: AnswerComment

http://stackoverflow.com/comment/42863794
type: QuestionComment
has text: Well... I was hoping that it wasn't a bug. How can I code without switch statement :( ... short from changing IDE... until this problem is fixed, I may have to disable content assist :(
score: 0
comment on: http://stackoverflow.com/q/27188135
type: Comment

http://stackoverflow.com/comment/45714799
type: Comment
type: QuestionComment
has text: Yep getting the same behind a proxy Feb 25, 2015 6:28:49 PM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data: 987910A362F4B747
comment on: http://stackoverflow.com/q/27252733
score: 0

http://stackoverflow.com/q/27299372
score: 0
possible better answer: http://stackoverflow.com/a/27299661
answer count: 3
has comment: http://stackoverflow.com/comment/43063333
has answer: http://stackoverflow.com/a/27299661
accepted answer: http://stackoverflow.com/a/27299520
has body: I am working on a practice assignment to improve my understanding of driver and resource class, I have created a resource class in which holds my code for any possible Bank Account being created. I then need to output that account and it's information, here are the instructions: A. BankAccount.java and TestBankAccount.java a. Assignment – text book (Project 5-5, p.197). Complete a UML summary for the resource class. Write 2 constructors and all accessor and mutator methods for the field variables. Write a toString() method. b. Output – should appear exactly as the output shown below. The balance statement will come from the toString() method. Format the toString() method with String.format(). All other outputs are string literals (in quotes). Open account Mickey has a current balance of $0.00 Deposit $500.00 Mickey has a current balance of $500.00 Withdraw $125.25 Mickey has a current balance of $374.75 Open account Minnie has a current balance of $1,000.00 Withdraw $73.21 Minnie has a current balance of $926.79 Open account Goofy has a current balance of $10,000.00 Close account Goofy has a current balance of $0.00 My code for the resource class: public class BankAccount { private String ownerName; private double balance; public BankAccount() { ownerName = ""; balance = 0.00; } public BankAccount(String name, double bal) { ownerName = name; balance = bal; } public String toString() { return ownerName + " has a current balance of " + String.format("%1$,.2f", balance); } public String getOwnerName() { return ownerName; } public void setOwnerName(String name) { ownerName = name; } public void deposit(double d) { balance+=d; } public void withdrawl(double w) { balance-=w; } } My code for the Driver class: public class BankAccountDriver { public static void main(String[] args) { BankAccount micky = new BankAccount("Micky", 0.00); System.out.println("Open Account " + micky); System.out.println("Deposit $500.00 "); } } I am stuck on doing the math for depositing, withdraw…
tagged with: currency
has comment: http://stackoverflow.com/comment/43062974
has comment: http://stackoverflow.com/comment/43063751
type: AnsweredQuestion
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/43065175
has comment: http://stackoverflow.com/comment/43064422
has answer: http://stackoverflow.com/a/27299520
type: Question
has title: Java BankAccount issue with resource class and math
has answer: http://stackoverflow.com/a/27299795
has comment: http://stackoverflow.com/comment/43063586
has comment: http://stackoverflow.com/comment/43063444
has comment: http://stackoverflow.com/comment/43064300
has comment: http://stackoverflow.com/comment/43063778

http://stackoverflow.com/a/27202984
has comment: http://stackoverflow.com/comment/42890680
has body: The answer to the actual question you've asked is "use a layout manager in a JFrame and/or JPanel to position components, but think you already know that. You've used a GroupLayout manager in one of your two JFrames. I think your problem may be that you have two of them. You declare a JFrame variable in DrawCarPark, and that class also extends JFrame. You probably don't need or want both, and it may be confusing you -- if you expect things to show up in the declared JFrame, the JFrame methods you call without reference to that instance will pass the compiler since DrawCarPark extends JFrame, but they won't be doing what you want. If you want one window with all your GUI elements in it, get rid of either the variable or the extension to JFrame. I might suggest using a different layout manager for the remaining JFrame -- its default is BorderLayout, and it seems to me that might be better for what you want. Put your buttons into a JPanel (using whatever other layout manager you want, GroupLayout or whatever), and put that panel in the NORTH section of the BorderLayout. Then put your CarPark panel into the CENTER of that BorderLayout, and the resulting JFrame will have both. Good luck with it.
answers question: http://stackoverflow.com/q/27202768
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/42889025

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/27176272
tags question: http://stackoverflow.com/q/27194708
tags question: http://stackoverflow.com/q/27162134
type: Tag
tags question: http://stackoverflow.com/q/27210280
tags question: http://stackoverflow.com/q/27196321
tags question: http://stackoverflow.com/q/27199105
tags question: http://stackoverflow.com/q/27300679

http://stackoverflow.com/q/27252655
accepted answer: http://stackoverflow.com/a/27252759
has title: Replace single element in list with two or more other elements without disturbing the order of the remaining elements
type: AnsweredQuestion
score: 3
tagged with: list
has comment: http://stackoverflow.com/comment/42979664
has comment: http://stackoverflow.com/comment/42979369
upvote count: 3
has comment: http://stackoverflow.com/comment/42979345
tagged with: java
has comment: http://stackoverflow.com/comment/42979309
has comment: http://stackoverflow.com/comment/42980405
type: Question
has comment: http://stackoverflow.com/comment/42979511
has comment: http://stackoverflow.com/comment/42979858
has comment: http://stackoverflow.com/comment/42979339
has comment: http://stackoverflow.com/comment/42979614
has body: Is there a way to replace a single element in a list with TWO or more other elements without disturbing the rest of the list ? I understand you can replace one element with another, but i'm looking for more than one element to be added. The use case is that I would like to split a given element into two or more elements based on a particular condition. For example: Let's say the list contains the path from node A to node F on a Graph as follows: A -> B -> C -> D -> E -> F I would like to replace node C with two other elements say node X and node Y. The final list should look as follows: A -> B -> X -> Y -> D -> E -> F Note: I am still thinking through the implementation and I have not finalized on using any particular type of list (ArrayList, LinkedList etc.) yet.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42979418
linked to: http://stackoverflow.com/q/8725387
favorite count: 0
has comment: http://stackoverflow.com/comment/42979751
has answer: http://stackoverflow.com/a/27252759

http://stackoverflow.com/comment/43085531
has text: @BuhakeSindi I am compiling with Maven which I assume uses JAVA_HOME which (should be) 64 bit but when compiling with IntelliJ which uses the same path as JAVA_HOME it works.
comment on: http://stackoverflow.com/q/27312134
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43002448
type: Comment
has text: Be aware that setting the scope to prototype is only effective if you ask the Spring context to supply the bean. I've seen a lot of code where the author thought prototype bestowed some miraculous behavior that cured all their threading issues!
comment on: http://stackoverflow.com/a/27263760
score: 0
type: AnswerComment

http://stackoverflow.com/q/27263602
answer count: 1
linked to: http://stackoverflow.com/q/27262255
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27270920
tagged with: java
has comment: http://stackoverflow.com/comment/42999439
type: Question
has body: I have parse notifications set up for my android app using Parse 1.7.1 sdk version. But in the new android this method with parse says to call is depreciated. PushService.setDefaultPushCallback(this, MainActivity.class); But when it is removed the notification is sent from parse.com as I can see on the website but it does not arrive to the phone? How can this be changed so that the push will arrive? Without using the depreciated method? Thanks for the help in advance.
score: 0
has title: Android - Can not Receive Push from Parse.com
tagged with: push-notification

http://stackoverflow.com/comment/42913844
type: Comment
has text: I can fix it ;) I need to make this algorithm as faster as possible too, because it must works with VERY BIG graphs. Thanks a lot again!
comment on: http://stackoverflow.com/a/27215604
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42828832
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27168571
type: QuestionComment
has text: @MiyaG Not any exception. Doesn't print any thing in calling method inside wile statement.("Helooo2") But huge ("Helooo1" ) set prints.

http://stackoverflow.com/comment/42908650
type: Comment
has text: The potential problem: It seems like you are never clearing the "visited" flags of the nodes, by calling `node.setVisited(false)` on all nodes. If it runs forever, a debug output (as mentioned above) might already be helpful. If not, try to create a http://stackoverflow.com/help/mcve (with main method and a small example graph).
type: QuestionComment
comment on: http://stackoverflow.com/q/27212679
score: 0

activemq-classic
tags question: http://stackoverflow.com/q/27289282
tags question: http://stackoverflow.com/q/27248778
tags question: http://stackoverflow.com/q/27267972
tags question: http://stackoverflow.com/q/27222839
tags question: http://stackoverflow.com/q/27154821
tags question: http://stackoverflow.com/q/27270403
tag name: activemq-classic
type: Tag

http://stackoverflow.com/q/27291532
accepted answer: http://stackoverflow.com/a/27291924
has body: I am building an application (using spring-integration) which is supposed to recieve Request object from whatever-inbound-gateway and call MS SQL stored procedure. The Request object contains String attribute procedureName and List&lt;Pair&lt;String, Object&gt;&gt; attribute parameters. The problem is that I can't find a solution, how to pass List of parameters when I don't know it's length at compile time. Config for outbound gateway: &lt;int-jdbc:stored-proc-outbound-gateway id="outbound-gateway-procedure" request-channel="requestChannel" data-source="dataSource" stored-procedure-name-expression="payload.procedureName" sql-parameter-source-factory="someParameterSourceFactory" &gt; &lt;/int-jdbc:stored-proc-outbound-gateway&gt; If I knew that I have exactly 2 parameters in the list and their names are 'first' and 'second', I would configure sql-parameter-source-factory the way like this: &lt;bean id="someParameterSourceFactory" class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory"&gt; &lt;property name="parameterExpressions"&gt; &lt;map&gt; &lt;entry key="first" value-type="java.lang.String" value="payload.parameters.get(1).second"/&gt; &lt;entry key="second" value-type="java.lang.String" value="payload.parameters.get(2).second"/&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; But i do not know neither number of parameters no their names at compile time. Any suggestions? UPD: Stored procedure looks like this: create procedure [dbo].[pnzLimitUtilization_Show] ( @BookDate datetime , @LegalGroupList varchar(4000) , @Currency char(3) , @FilterForAny nvarchar(255) = '' , @RiskZone char(1) = 'A' , @WithZerroExposure char(1) = '0' , @Transliteration bit = 0 , @IsNewMethodology bit = 0 , @UtilizationType char(1) = 'A' , @PartyGroupList varchar(255) = NULL , @HostName varchar(255) = NULL , @ShowCloseExpiration bit = 0 , @CloseExpirationDays int = 90 , @WhatIfDealFilter char(1) = 'R' , @HideLESublimits bit = 0 ) as begin .... New config:…
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27291924
tagged with: spring
has title: Inconstant number of parameters in stored-proc-outbound-gateway
tagged with: spring-jdbc
tagged with: spring-integration
upvote count: 2
tagged with: java
answer count: 1

http://stackoverflow.com/comment/42801633
has text: I don't know if you're aware of it. Eclipse is not based on Swing, it uses its own toolkit called SWT. Means, these guys achieved what you see not by using Swing but by using SWT.
comment on: http://stackoverflow.com/q/27153470
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27202449
score: 0
has body: I am writing a Processing project (Processing is based on Java). I want to run the code inside one thread in another thread (the main thread). //This method runs in the main thread public void draw() { } //This is a callback that runs in a separate thread void addTuioObject(TuioObject tobj) { rect(0, 0, 20, 10); } The rect(0,0,20,10) does not run in the main thread (it is supposed to draw a rectangle on the screen). I suppose this is because it runs in a separate thread. How would I make this code run in the main thread?
answer count: 2
possible better answer: http://stackoverflow.com/a/27202870
has answer: http://stackoverflow.com/a/27203360
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/27203360
has title: Run Code Inside One Thread In Another
type: Question
tagged with: processing
has answer: http://stackoverflow.com/a/27202870

http://stackoverflow.com/a/27304605
type: Answer
answers question: http://stackoverflow.com/q/27304556
has comment: http://stackoverflow.com/comment/43147407
score: 0
has body: public static final int findSmallestDistance(final int[] pArray) { int lMinimumDistance = Integer.MAX_VALUE; for(int i = 1; i &lt; pArray.length; i++) { int lDifference = pArray[i] - pArray[i - 1]; if(lDifference &lt; lMinimumDistance) { lMinimumDistance = lDifference; } } return lMinimumDistance; }
upvote count: 2
downvote count: 2

http://stackoverflow.com/comment/42920298
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27220369
has text: ok, so the first thing you'll need to do is to fix that. I'm still fuzzy on the purpose of the alphabeta function here. Is it looking for the best move that can be made at any given time? Just a note about code repetition. It looks like the two halves of your alphabeta function are identical, except for using true/false in the recursive call and player/opponent. In which case, remove the if/else and use an inline if statement (e.g. `if maxPlayer ? opponent : player`) makes your code much more readable

http://stackoverflow.com/comment/42822769
has text: @MiyaG Yes, that class exists.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27165132

http://stackoverflow.com/comment/42894321
type: QuestionComment
comment on: http://stackoverflow.com/q/27205588
has text: What's your question?
score: 0
type: Comment

http://stackoverflow.com/a/27243573
upvote count: 2
has body: In order to debug such applications, you can add println() lines in the right places. While this sounds a bit childish, this method of debugging, called printf-Debugging is even used by the most professional developers in some cases. I suggest you add a System.err.println("1") resp. System.err.println("2") / System.err.println("3") in each of the if-branches of mouseClicked() to find out why it's not properly recording the points. Hint: You probably want variable i to have a different scope than now`. Registering the MouseListener should not be done in paintComponent(). If you think a little bit about this, it should be obvious. Ask yourself: How often do I need to register the MouseListener? Only once. How often is paintComponent() called? Many times. So, the addMouseListener() is certainly in the wrong place. Once you fixed these, you might notice that you have to hide/unhide, resize or (on some OS) move the window in order for your polygons to be redrawn. That's because once you've changed the appearance by recording a new coordinate for your polygon, you don't tell Java that the component needs to be redrawn. The programming model usage by extension which you apply is still shown on many web pages and in many books as of today, but it's plainly wrong because it often violates the LSP - Liskov Substitution Principle. In your case, extending the JPanel for a PolygonsPanel is almost right, because that is a kind of Painting Canvas which in fact is a new component, so, creating a new class that is a component is perfect for that. Just JPanel might not be the best superclass for it, check out the class hierarchy of Swing class a bit and you will discover a better superclass. However, in Triangle, you do not really want to extend JFrame, you merely use JFrame without adding any new reusable features to it, so subclassing is not right in that case.
downvote count: 0
has comment: http://stackoverflow.com/comment/42965240
answers question: http://stackoverflow.com/q/27243279
type: Answer
score: 2

http://stackoverflow.com/q/27171558
has answer: http://stackoverflow.com/a/27171658
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27171658
has body: writeUTF function accepts string. Is there any way to pass integer? OutputStream os = s.getOutputStream(); DataOutputStream dos = new DataOutputStream(os); int count = 8; dos.writeUTF((count); //Error on Sending integer value.
tagged with: java
downvote count: 1
type: Question
score: -1
has title: send int in writeUTF in java
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/43567443
favorite count: 0
possible better answer: http://stackoverflow.com/a/43567443
tagged with: sockets

http://stackoverflow.com/a/27200292
answers question: http://stackoverflow.com/q/27200247
type: Answer
has body: Put all the fields in a List of some kind and loop over them Use one or more InputVerify to perform post validation of the field, see Validating Input for more details Use one or more DocumentFilters to do real-time validation, see Implementing a Document Filter and DocumentFilter Examples for more details
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/27200247
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27240882
has comment: http://stackoverflow.com/comment/42962683
has comment: http://stackoverflow.com/comment/42960157
has comment: http://stackoverflow.com/comment/42962995
has comment: http://stackoverflow.com/comment/42960196
has comment: http://stackoverflow.com/comment/42958947
type: AcceptedAnswer
has body: you are allowed to use toUpperCase() ? try this one Scanner input=new Scanner(System.in); System.out.println("Enter a sentence with words including java"); String sentence=input.nextLine(); String find="java"; String replace="JAVA"; String result=""; result = sentence.toLowerCase(); result = result.replace(find,replace); System.out.println(result); } reply with the result :)) Update : Based on I've got everything done but my code won't read in mixed cases for example:JaVa, JAva,etc. you can use your code Scanner input=new Scanner(System.in); System.out.println("Enter a sentence with words including java"); String sentence=input.nextLine(); String find="java"; String replace="JAVA"; String result=""; int n; do{ //for you to ignore(converts the sentence to lowercase) either lower or upper case in your sentence then do the nxt process sentence = sentence.toLowerCase(); n=sentence.indexOf(find); if(n!=-1){ result =sentence.substring(0,n); result=result +replace; result = result + sentence.substring(n+find.length()); sentence=result; } }while(n!=-1); System.out.println(sentence); } Update 2 : I put toLowerCase Convertion outside the loop. public static void main(String[] args){ String sentence = "Hello my name is JAva im a jaVa Man with a jAvA java Ice cream"; String find="java"; String replace="JAVA"; String result=""; int n; //for you to ignore(converts the sentence to lowercase) either lower or upper case in your sentence then do the nxt process sentence = sentence.toLowerCase(); System.out.println(sentence); do{ n=sentence.indexOf(find); if(n!=-1){ result =sentence.substring(0,n); result=result +replace; result = result + sentence.substring(n+find.length()); sentence=result; } }while(n!=-1); System.out.println(sentence); } RESULT hello my name is java im a java man with a java java ice cream hello my name is JAVA im a JAVA man with a JAVA JAVA ice cream
has comment: http://stackoverflow.com/comment/42958970
score: 0
accepted answer of: http://stackoverflow.com/q/27240645
type: Answer
has comment: http://stackoverflow.com/comment/42958595
answers question: http://stackoverflow.com/q/27240645
has comment: http://stackoverflow.com/comment/42962497
has comment: http://stackoverflow.com/comment/42963242
has comment: http://stackoverflow.com/comment/42958843

http://stackoverflow.com/comment/42904698
has text: Ah - yes, Unsafe. I've worked with it in the past, you cannot use the singleton because its so volatile it is secured by a class loader check. Here's an excellent post on the topic: http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27201855
type: Comment

http://stackoverflow.com/a/27311673
answers question: http://stackoverflow.com/q/27310547
has body: Do you get ArrayIndexOutOfBoundsException? Try checking the dimensions of the array. This is usually thrown to indicate that an array has been accessed with an illegal index...
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43084213

curl
tags question: http://stackoverflow.com/q/27200686
tags question: http://stackoverflow.com/q/27266538
tags question: http://stackoverflow.com/q/27283571
tags question: http://stackoverflow.com/q/27212743
tags question: http://stackoverflow.com/q/27310733
tag name: curl
type: Tag
tags question: http://stackoverflow.com/q/27187141

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/27293982
type: Tag

http://stackoverflow.com/a/27186260
accepted answer of: http://stackoverflow.com/q/27184960
answers question: http://stackoverflow.com/q/27184960
has comment: http://stackoverflow.com/comment/42923509
has comment: http://stackoverflow.com/comment/42863112
has comment: http://stackoverflow.com/comment/42860669
has comment: http://stackoverflow.com/comment/42868220
has comment: http://stackoverflow.com/comment/42923012
has comment: http://stackoverflow.com/comment/42860166
has comment: http://stackoverflow.com/comment/42862420
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42861788
has body: I dont think you need @IdClass on class ProductId. It's required only for entity in which you are using this composite id. And this particular error is caused by the fact that you try to use integer but you have to use ProductId class. Try this way @SuppressWarnings("serial") @Entity @IdClass(ProductId.class) @Table(name = "Product", catalog = "orangeDB") public class Product implements java.io.Serializable { private Integer prodId; private Category category; private char prefix = 'P'; private String product; private int quantity; private double price; private int discount; @Id @Column(name = "prodId", nullable = false) public Integer getProdId() { return this.prodId; } public void setProdIt(Integer prodId) { this.prodId = prodId; } @Id @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "catId", referencedColumnName = "catId", nullable = false, insertable = false, updatable = false) public Category getCategory() { return this.category; } public setProductId(ProductId productId){ this.prodId = productId.getProdId(); this.category = productId.getCategory(); } //getter&amp;setters } in ProductId class: private Integer prodId; private Category category; public ProductId(Integer prodId, Category category) { this.prodId = prodId; this.category = category; } getters&amp;setters and then set it with: Category category = new Category(); ProductId pId = new ProductId(1, category); //id, category product.setProductId(pId); and try this as well: new Product(1, category); // pls add this constructor The main reason why you missed that is probably the fact that setter from Produt and IdClass ProductId have similar names. And in case od using IdClass you dont need any @GeneratedValue annotation.
score: 0
type: Answer

http://stackoverflow.com/comment/42988030
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27201847
has text: Glad you got it solved! Could you either post an answer or delete the question?
score: 0

http://stackoverflow.com/a/27231274
type: Answer
has body: This is the normal array String representation in Java, consisting in: A number of [ based on the dimension Either a letter for the primitive type (i.e. I for int), or L[fully qualified class name] for Objects @ The array's hash code For one-dimensional arrays, use java.util.Arrays.toString(myArray). For multi-dimensional arrays, use java.util.Arrays.deepToString(myArray). Edit (adding previous comment to answer) You probably want to investigate JSON.parse to parse your Java array from JavaScript.
answers question: http://stackoverflow.com/q/27231194
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42939298
has comment: http://stackoverflow.com/comment/42939377

http://stackoverflow.com/comment/42841224
type: QuestionComment
has text: Adding Stacktrace and errors: Move disk 0 from 0 to 2 Move disk 1 from 0 to 1 Error placing disk: 2 Move disk 2 from 0 to 2 Exception in thread "main" java.util.EmptyStackException at java.util.Stack.peek(Stack.java:102) at java.util.Stack.pop(Stack.java:84) at Tower.moveTopTo(Tower.java:26) at Tower.moveDisks(Tower.java:46) at Tower.main(Tower.java:60)
comment on: http://stackoverflow.com/q/27175756
score: 0
type: Comment

http://stackoverflow.com/a/27228495
has body: You can use 'try catch' . boolean flag=false; do { try { into firstno=scan.nesting(); flag=true; } catch(Exception e) { System.out.print("please insert only number"); } }while(flag!=true); Using a try catch you can catch exception and the message
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27228067

http://stackoverflow.com/comment/43010212
comment on: http://stackoverflow.com/q/27269640
type: Comment
type: QuestionComment
has text: Your question is unclear. You say you want to use RFC 3339 to pass to an object that does not take a string. But RFC 3339 *is* a string format.
score: 0

oracle11g
tags question: http://stackoverflow.com/q/27271261
tags question: http://stackoverflow.com/q/27154071
tags question: http://stackoverflow.com/q/27255802
type: Tag
tags question: http://stackoverflow.com/q/27169126
tag name: oracle11g
tags question: http://stackoverflow.com/q/27249211
tags question: http://stackoverflow.com/q/27281407
tags question: http://stackoverflow.com/q/27211972
tags question: http://stackoverflow.com/q/27200494

http://stackoverflow.com/a/27226625
has comment: http://stackoverflow.com/comment/66253035
type: Answer
accepted answer of: http://stackoverflow.com/q/27219898
score: 13
answers question: http://stackoverflow.com/q/27219898
downvote count: 2
upvote count: 15
type: AcceptedAnswer
has body: Try using this: &lt;%int no = Integer.parseInt(request.getParameter("numberMax"));%&gt; Its working for me.

http://stackoverflow.com/comment/43048352
score: 0
type: Comment
has text: have you missing super.onCreate() first line in onCreate() ?
type: QuestionComment
comment on: http://stackoverflow.com/q/27290991

http://stackoverflow.com/comment/43551657
has text: Thanks for your comment ..This code will print content which are there in text file ,but how I can set paper width etc with the help of text file .. text file should have [definition] ,[Header],[Detail] etc .so that text file should contain x,y coordinate of statement which I want to print and font size and etc.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27562191

http://stackoverflow.com/a/27217382
answers question: http://stackoverflow.com/q/27217370
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: You've gotten your syntax and code wrong for writing to files. Please Google and check the right syntax for writing to files using java. Plenty of resources available. You'll learn better if you try it yourself. FYR, here is one: http://www.tutorialspoint.com/java/java_files_io.htm

http://stackoverflow.com/a/27215356
downvote count: 0
has body: No the value 256 is hard coded into the source: PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), Hex.decode(salt), 1024, 256); This can be found in AesBytesEncryptor on line 54 at least up to release 3.2.5. Note that Spring uses the Apache license, so there is nothing stopping you from creating your own implementation that uses 128 as constant.
has comment: http://stackoverflow.com/comment/42912311
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42916693
has comment: http://stackoverflow.com/comment/42913264
answers question: http://stackoverflow.com/q/27207759
has comment: http://stackoverflow.com/comment/42916747
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27207759
has comment: http://stackoverflow.com/comment/42917332
type: AcceptedAnswer

http://stackoverflow.com/q/27202812
score: 3
tagged with: performance
downvote count: 0
tagged with: java
tagged with: scalability
type: Question
upvote count: 3
has body: Spring Roo appears to be a great framework with true order of magnitude productivity improvements. However I am reading that Roo aims mainly at rapid prototyping or smaller applications. My question is, whether Spring Roo has proved to be suited also for larger, production-ready web applications, subject to important scalability and performance requirements.
tagged with: spring-roo
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27204082
type: UnansweredQuestion
tagged with: spring
has title: Spring Roo for larger applications

http://stackoverflow.com/comment/42845794
comment on: http://stackoverflow.com/q/27178431
score: 0
type: Comment
type: QuestionComment
has text: An exit status of `1` indicates an error. You should read the error stream (`p.getErrorStream()`), it will probably contain the error message. It would be helpful if you shared it. Are you running the java program from command line?

http://stackoverflow.com/comment/42946370
type: Comment
comment on: http://stackoverflow.com/q/27234519
has text: @brso05 - The structure in his sample is an array of arrays -- no Maps required.
score: 0
type: QuestionComment

search
tags question: http://stackoverflow.com/q/27177908
tags question: http://stackoverflow.com/q/27243437
type: Tag
tags question: http://stackoverflow.com/q/27258865
tags question: http://stackoverflow.com/q/27263564
tags question: http://stackoverflow.com/q/27188953
tags question: http://stackoverflow.com/q/27281847
tags question: http://stackoverflow.com/q/27203100
tags question: http://stackoverflow.com/q/27172225
tag name: search
tags question: http://stackoverflow.com/q/27186695

http://stackoverflow.com/comment/43000329
has text: Dumby me didn't even think about making the 1-spot checks.. Thanks! I'll throw this together tomorrow, I appreciate the feedback!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27264155
type: AnswerComment

http://stackoverflow.com/comment/52961059
type: AnswerComment
has text: This is a good start, but for a general solution, you'll need to scrub any MIME headers before you get the XML, and if it's multipart with SDP, you'll also need to scrub the SDP part which might come before the PIDF
type: Comment
comment on: http://stackoverflow.com/a/27219510
score: 0

http://stackoverflow.com/a/28606523
has body: The Spring version FishEye uses internally (3.0.5 in 3.6.1, 3.1.4 as of 3.7), is not exposed to plugins. Instead they get a spring runtime from the Atlassian plugin system (https://bitbucket.org/atlassian/atlassian-plugins). FishEye uses plugins 3.0.x, so the Spring version that's available to plugins is 2.5.6. Neither FishEye, the plugin system nor any of the bundled plugins include spring-ldap, so you can't set the dependency scope to (as this causes the library not to be included in the plugin jar, instead expecting it be available via an OSGI import). So what I believe you should try is to bundle a version of spring-ldap that's compatible with Spring 2.5.6. To solve the BeanDefinitionParsingException, you might need to exclude some transitive dependencies that are provided by the plugin system (use mvn dependency:tree to find those). Disclosure: I'm a dev working on FishEye/Crucible
score: 0
has comment: http://stackoverflow.com/comment/45575644
type: Answer
answers question: http://stackoverflow.com/q/27280197

http://stackoverflow.com/a/27268414
type: Answer
upvote count: 1
has body: Calling table.setAutoCreateRowSorter(true) means that a RowSorter will be created when the table's model is changed (it's in the JavaDoc!). Since the model is never changed, a RowSorter is not created. Add a call to table.setModel(model) after table.setAutoCreateRowSorter(true). You need to tell the table that its data are Double objects, not Strings - because you want to sort them like Doubles and only display them as Strings. Set the data in the array to a Double object: data[i][0] = new Double(i); And edit the table model thus: DefaultTableModel model = new DefaultTableModel(data, columns) { private static final long serialVersionUID = 1L; @Override public Class getColumnClass(int col) { if (col == 0) { return Double.class; } return String.class; } }; And now implement a custom cell renderer for the first column: JTable table = new JTable(model); class PercentRenderer extends javax.swing.table.DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable itable, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel oLabel = (JLabel) super.getTableCellRendererComponent(itable, value, isSelected, hasFocus, row, column); if (value instanceof Double) { oLabel.setText(round.format(100. * (double) value) + "%"); } return oLabel; } } table.getColumnModel().getColumn(0).setCellRenderer(new PercentRenderer());
score: 1
answers question: http://stackoverflow.com/q/27267146
downvote count: 0

http://stackoverflow.com/a/27238965
type: Answer
answers question: http://stackoverflow.com/q/27238168
has body: Don't use arrays. Use collections. Using arrays requires more code, more care and gives no measurable benefit. Using collections leverages the code and care built into the JDK. If you've got an array of HashEntry, you're most of the way to a Map - just use a constant order map: Map&lt;SomeKey, SomeValue&gt; map = new LinkedHashMap&lt;SomeKey, SomeValue&gt;();
score: 0

http://stackoverflow.com/q/27247346
has comment: http://stackoverflow.com/comment/42990334
tagged with: applet
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42969624
has body: I have a working applet on my Tomcat server but in this applet I need to save information locally. I used writefile.. and it was working on eclipse, but it doesn't work like that on a server.. I did a lot of research to do a servlet to be able to save the information in an html file. I know I have to use a Post, but I don't know how. I also want to know if the servlet is just a Servlet.class placed in my tomcat folder and how to call it from my java application?
has answer: http://stackoverflow.com/a/27260853
has title: Java Applet on Tomcat using servlet?
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
tagged with: servlets
score: 0
answer count: 1

http://stackoverflow.com/a/76579935
downvote count: 1
score: -1
upvote count: 0
has body: I had a very large conf file and this solution worked in my case : https://discuss.elastic.co/t/changing-logstash-heap-size/69542/4 LS_JAVA_OPTS="-Xmx2g -Xms1g" bin/logstash -e ""
type: Answer
answers question: http://stackoverflow.com/q/27156145

http://stackoverflow.com/comment/42888564
has text: See [this](http://dev.mysql.com/doc/refman/5.1/en/regexp.html#operator_regexp) for details.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27202808

http://stackoverflow.com/comment/42805975
score: 0
type: QuestionComment
type: Comment
has text: @LuiggiMendoza That would return a file system path, not really helping at all (unless you'd go read the application server's config files through that).
comment on: http://stackoverflow.com/q/27155579

http://stackoverflow.com/comment/42929938
type: Comment
has text: @Donal Hard to see what difference that makes, or indeed what the question is really about at all.
comment on: http://stackoverflow.com/a/27225593
score: 0
type: AnswerComment

http://stackoverflow.com/a/27220548
has body: Basically, you want to off load the scaling of the image to a background thread, scaling is time consuming and you don't want to do within the context of the Event Dispatching Thread. This then raises a few more issues. You don't want to scale the image until you really have to to and you really only want the latest result. Instead of trying to scale the image on EVERY change, you can setup a small, single repeat timer which you reset each time you want to make a change. This will consolidate the multiple resize requests down to as few requests as possible. This example uses a javax.swing.Timer set to a short 125 millisecond delay. So it will wait at least 125 milliseconds between requests for a change before actually triggering the update. Next, it uses a ExecutorService set up with a single thread. This provides us with the means to "attempt" to cancel any pre-existing operations, as we don't want there result and start our latest request. Next, the actual scaling operation employs a two step scale, first, it tries to do a fast, low quality scale which can be put on the screen quickly and then performs a slower, high quality scale which is updated at some time in the future... import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Transparency; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JPanel; imp…
answers question: http://stackoverflow.com/q/27219914
upvote count: 2
has comment: http://stackoverflow.com/comment/42920857
accepted answer of: http://stackoverflow.com/q/27219914
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42920648
has comment: http://stackoverflow.com/comment/42920934
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/27282000
downvote count: 4
upvote count: 0
favorite count: 0
has title: Homework Help: Why won't variables return
has comment: http://stackoverflow.com/comment/43032545
answer count: 1
has body: I can't figure this out My variables aren't returning to print in the output message I have no idea where I am going wrong and my teacher tells me to go through the code line by line and check for logic and syntax errors. Any help would be appreciated. package selfhelpstore; import javax.swing.JOptionPane; public class SelfHelpStore { private static String getStringInput(String prompt) { String input = JOptionPane.showInputDialog(prompt); String nullFlag = "n"; int i = 1; while (i&lt;=2) if (input == null) { System.exit(0); }else if (input.isEmpty()) { i++; nullFlag = "y"; prompt = JOptionPane.showInputDialog("Re-enter: "); } else { i=4; nullFlag = "n"; } if (!input.isEmpty()) { nullFlag = "n"; } if (nullFlag.equals("y")) { JOptionPane.showMessageDialog(null, "Null or blank - exiting..."); System.exit(0); } return prompt; } public static void main(String[] args) { String openingMsg, nameInputMsg, customerName, nameOutputMsg, returnInputMsg, customerReturn, returnOutputMsg, greetingOutputMsg, outputMsg,coverInputMsg, coverMsg ; openingMsg = "*** Welcome to Self Help Book Store Online Ordering System ***\n" + " It's a great day to read a book!"; JOptionPane.showMessageDialog(null, openingMsg); nameInputMsg = getStringInput("Please enter your name: "); customerName = nameInputMsg; returnInputMsg = getStringInput("Are you a returning customer (yes or no)? "); customerReturn = returnInputMsg; coverInputMsg = getStringInput("would you like this book in hard cover or paper back?"); coverMsg = coverInputMsg; nameOutputMsg = "Welcome " + customerName + ".\n\n"; returnOutputMsg = "Your return customer status is " + customerReturn + ".\n"; greetingOutputMsg = "Thank you for visiting our Self Help Book Store!" + "\n" + "Your " + coverMsg + " should be mailed in less than two business days.\n"; outputMsg = nameOutputMsg + returnOutputMsg + greetingOutputMsg; JOptionPane.showMessageDialog(null, outputMsg); System.exit(0); } }
score: -4
tagged with: input
has comment: http://stackoverflow.com/comment/43032597
has answer: http://stackoverflow.com/a/27282168
type: AnsweredQuestion
tagged with: java
tagged with: methods
accepted answer: http://stackoverflow.com/a/27282168
has comment: http://stackoverflow.com/comment/43032581
has comment: http://stackoverflow.com/comment/43032644
type: Question

http://stackoverflow.com/comment/42965096
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27241899
has text: Thanks again,can I use this command directly in my string sql in the method where I have used +stringDate+"' and '"+timestr+"' .

http://stackoverflow.com/q/27263959
type: AnsweredQuestion
tagged with: algorithm
has title: Which algorithm is better for a Tic-Tac-Toe board with varying side length? (Or is there a better one?)
has comment: http://stackoverflow.com/comment/43000082
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27264155
has comment: http://stackoverflow.com/comment/43000063
has body: I've been working on a project for my Java class. In this project, we create a simple Tic-Tac-Toe game with a pretty GUI, all of that is swell, I made it work just fine. I ran into my problem when I got to checking if one of the two players has won. The game is 2 player, no AI, as of right now but that wouldn't really impact the algorithm needed to check if the player is a winner or not. The variable that makes it difficult for me is that the board size can be changed from 3x3 to 4x4 to 5x5 --> 1,000x1,000 and beyond. I need a way to check if the player won regardless of the board size. The 2 algorithms I could think of are: Algorithm 1: 1. Go through every row HORIZONTALLY, add 1 to an integer if its an x, 1 to a different integer if its an o, and then check the next slot, if it is the same as the previous, add another point, if it is null or the opposite, reset the points to 0, and restart, continuing in place down the row. 2. Go through every row VERTICALLY, do the same method of points ^. 3. Go through every DIAGONAL going down to the LEFT, same method of points ^. 4. Go through every DIAGONAL going down to the RIGHT, same method of points ^. *** The Diagonal Methods here would have to exclude the corner pieces so we don't get an OOB error. Pros: Less coding Easier to code Cons: Does more computer than Algorithm 2 Not as "smart" What happens if board size is 1,000,000 --&gt; So many more computations to complete... Algorithm 2: This algorithm would take the spot you just played and... 1. Check up 2, if they are both the same as played you win. 2. Check up 1, check down 1, if they are both the same as played you win. 3. Check down 2, if they are both the same as played you win. 4. Check right 2, if they... 5. Check right 1, left 1 if they... 6. Check left 2, if they ... 7. Check upwards right diag 2, if they.. 8. Check upward right diag 1, check downward left diag 1, if they... 9. Check downwards 2, if they... 10. Check upwards left diag 2, if they... 11. Check u…
tagged with: tic-tac-toe
type: Question
has answer: http://stackoverflow.com/a/27264155

http://stackoverflow.com/comment/43121839
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27268340
has text: glad i could be of help :)

http://stackoverflow.com/q/27254073
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27259468
type: AnsweredQuestion
upvote count: 1
has title: ExecutorService.invokeAll and shutdown
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27259468
has body: So I have some Callable tasks, sensitive to interruptions, which I submit to the ExecutorService using invokeAll. After 5 seconds from another method I call executorService.shutdownNow after which I call the awaitTermination, which returns true, so all seems good. The problem is the executor never terminates. Due to logging I know that each one of my tasks finished. nevertheless the invokeAll still blocks on f.get when i is equal to the number of threads of the executor: The following code is obtained from AbstractExecutorService + some logging. @Override public &lt;T&gt; List&lt;Future&lt;T&gt;&gt; invokeAll(Collection&lt;? extends Callable&lt;T&gt;&gt; tasks) throws InterruptedException { if (tasks == null) throw new NullPointerException(); ArrayList&lt;Future&lt;T&gt;&gt; futures = new ArrayList&lt;Future&lt;T&gt;&gt;(tasks.size()); boolean done = false; try { List&lt;Callable&lt;T&gt;&gt; list = new ArrayList&lt;Callable&lt;T&gt;&gt;(); for (Callable&lt;T&gt; t : tasks) { list.add(t); RunnableFuture&lt;T&gt; f = newTaskFor(t); futures.add(f); execute(f); } for (int i = 0, size = futures.size(); i &lt; size; i++) { Future&lt;T&gt; f = futures.get(i); if (!f.isDone()) { log.info("Future %s is not done!. Task %s", i, list.get(i)); try { log.info("Get from future %s", i); // NEXT LINE BLOCKS FOR i= NUMBER OF THREADS f.get(); log.info("Got result from future %s", i); } catch (CancellationException ignore) { } catch (ExecutionException ignore) { } } } log.info("Obtained all!"); done = true; return futures; } finally { if (!done) for (int i = 0, size = futures.size(); i &lt; size; i++) futures.get(i).cancel(true); } } Am I not suppose to use invokeAll with shutdown? I guess not, after all they are in the same class. Why does it get blocked, only when i= the number of threads of the executor?
tagged with: concurrency
tagged with: executor

http://stackoverflow.com/comment/94756452
score: 3
has text: setDrawingCacheEnabled() and setDrawingCacheQuality() are deprecated. Instead use hardware acceleration. https://developer.android.com/reference/android/view/View.html#setDrawingCacheEnabled(boolean)
type: Comment
comment on: http://stackoverflow.com/a/40147626
type: AnswerComment

http://stackoverflow.com/comment/42978812
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27252385
has text: something be null. so you get NullPointerException.:)
score: 0

http://stackoverflow.com/a/27268443
score: 0
has body: public class Test{ public static void main(String[] args) throws IOException { Test test = new Test(); System.out.println(""+test.generate()); } public String generate() throws IOException { DateFormat dateFormat = new SimpleDateFormat("ddMM"); Date date = new Date(); String currentDate = dateFormat.format(date); String idNumber = generateIdNumber(currentDate); String complete = currentDate + idNumber; return complete; } public String generateIdNumber(String currentDate) throws IOException{ Properties idNoProp = new Properties(); InputStream idNoInput = new FileInputStream("idNumber.properties"); //java properties file idNoProp.load(idNoInput); String idNumber = idNoProp.getProperty("idNumber"); int idNo = Integer.valueOf(idNumber); String strOnlyDay = currentDate.substring(0, 2); System.out.println(strOnlyDay);// will return the first two characters of the day String result = ""; if (idNo &lt; 10) { result = "0" + idNo; } else { result = "" + idNo; } idNo++; OutputStream output = new FileOutputStream("idNumber.properties"); if (strOnlyDay.equals("01")){ idNo = 1; } idNoProp.setProperty("idNumber", "" + idNo); idNoProp.store(output, null); return result; } } Try to pass the value of your current date into generateIdNumber than see the code. I hope this will help. Hoping you will preserve the value of idNo.
type: Answer
answers question: http://stackoverflow.com/q/27266703

http://stackoverflow.com/q/27180499
has body: I have a GUI clock in Java (intelliJ 14) that uses a simple timer to update, when I run the program from IntelliJ the timer and clock work fine. However, when I export the project as an executable .jar file, and run it, the timer doesn't run at all, causing the clock to freeze. Code for the clock: private static final JLabel Clock = new JLabel(""); protected static final DateFormat CLOCK_FORMAT = new SimpleDateFormat("hh:mm:ss a"); Clock.setBounds(482, 360, 135, 35); contentPane.add(Clock); Clock.setFont(new Font("DS-Digital", Font.PLAIN, 27)); Timer timer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { updateClock(); } }); timer.start(); updateClock(): protected void updateClock() { Clock.setText(CLOCK_FORMAT.format(System.currentTimeMillis())); } Whenever I run this from IntelliJ it works perfectly fine, but if I export it as a .jar the timer is never called. Any help would be great, thanks in advance!
score: 0
tagged with: intellij-idea
tagged with: clock
has comment: http://stackoverflow.com/comment/42849636
tagged with: timer
has comment: http://stackoverflow.com/comment/42849486
has comment: http://stackoverflow.com/comment/57378344
has title: Java timer not running in executable .jar file?
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/comment/43014149
type: QuestionComment
comment on: http://stackoverflow.com/q/27272187
score: 0
type: Comment
has text: No **recursion** (= calling itself), yes **iteration** (= multiple steps).

http://stackoverflow.com/q/27180309
has comment: http://stackoverflow.com/comment/42849287
favorite count: 0
has answer: http://stackoverflow.com/a/27180395
has body: I have a for loop over a list: boolean initialized = false for(final Share share : shares) { someInstance.check(new someCallback() { @Override public void onSuccess() { // do something } }); } initialized = true; In each step a asynchronous operation is performed which is called check(). I want to set the initialized = true when all check() operations are completed. Is there a way I can do this in Java/GWT? How do I know when all asynchronous Operations from a For Loop are finished?
type: AnsweredQuestion
has title: How do I know when all asynchronous Operations from a For Loop are finished?
has answer: http://stackoverflow.com/a/27180404
upvote count: 3
type: Question
tagged with: gwt
score: 3
has answer: http://stackoverflow.com/a/27188716
tagged with: java
accepted answer: http://stackoverflow.com/a/27180395
answer count: 3
possible better answer: http://stackoverflow.com/a/27180404
downvote count: 0

http://stackoverflow.com/comment/42977856
type: AnswerComment
type: Comment
has text: Yes, that's how you would implement it internally. You would however never expose define class to the outside.
comment on: http://stackoverflow.com/a/27211959
score: 0

http://stackoverflow.com/q/27153444
tagged with: java
tagged with: cpu
has title: Access cpu registers
type: Question
possible better answer: http://stackoverflow.com/a/27153727
has comment: http://stackoverflow.com/comment/42801356
downvote count: 0
has comment: http://stackoverflow.com/comment/42801224
accepted answer: http://stackoverflow.com/a/27153555
tagged with: assembly
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42801482
tagged with: cpu-registers
favorite count: 0
linked to: http://stackoverflow.com/q/7480783
has answer: http://stackoverflow.com/a/27153555
has answer: http://stackoverflow.com/a/27153727
has answer: http://stackoverflow.com/a/27153575
has body: Is there any way to access / modify the cpu's registers from Java just like in Assembly? (eax, rip, ax, etc.) I don't know if it would be useful in any way, but I think it would be quite interesting. And is there a way to get the "save point" of variables like in c / c++: &amp;variable Thanks in advance, I hope you've understood what I mean.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42801854
score: 1

http://stackoverflow.com/a/27205963
answers question: http://stackoverflow.com/q/27205801
has body: Well I guess somewhere you compute the difference between the actual angle and the next one, something like turn = newDirection - actualDirection. Doing 10 - 350 = -340 tells you AI it needs to turn -340°. However, (10 - 350 + 360) % 360 = 20 tells your AI it needs to turn +20°. Adding the 360 is to make sure your angle is positive, so the modulo will work as expected (because -340 % 360 = -340). What you really want, is never turn more than 180°. Thus, add another 180 before reducing between 0 and 360, and then remove them, that will shift your result in [-180,180] while staying module 360° (thus the same angle) : turn = (newDirection - actualDirection + 540) % 360 - 180 Then you breakup this turn however you want if you don't want it to do in one go, for example 5 degrees at a time like you seem to be already doing.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/27298351
tagged with: inheritance
score: 0
has title: Class, interface or enum expected
answer count: 2
has comment: http://stackoverflow.com/comment/43061060
has answer: http://stackoverflow.com/a/27303215
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43060994
has body: I have to name all the errors in this code, but I don't know is wrong in class B i got the error class, interface or enum expected. What does that mean? public abstract class A { private double a; public A(A r){ a = r.a; } public A(double a){ this.a = a; } public double ma(){ return a; } public abstract int mv(); } public class B extends A { private int b; public B() { super(); //ne postoji konstruktor } public B(B o) { b=o.b; } //nije pozvan odgovarajuci konstruktor } public B(int r) { super(b); b=r; } //HERE }
tagged with: java
possible better answer: http://stackoverflow.com/a/27298482
has answer: http://stackoverflow.com/a/27298482
type: Question
accepted answer: http://stackoverflow.com/a/27303215
tagged with: enums

http://stackoverflow.com/a/27176323
answers question: http://stackoverflow.com/q/27176286
has comment: http://stackoverflow.com/comment/42843017
has comment: http://stackoverflow.com/comment/42842769
has comment: http://stackoverflow.com/comment/42842566
has comment: http://stackoverflow.com/comment/42842971
has body: class name @ hex hashCode is the default toString() implementation in Java. [I is the class name of an int array. Use Arrays.toString for a legible result: System.out.println(Arrays.toString(hi)); This is how the class name of an array is represented: "[" * array dimensions + component type. (more information here)
has comment: http://stackoverflow.com/comment/42842818
has comment: http://stackoverflow.com/comment/42842700
score: 0
has comment: http://stackoverflow.com/comment/42842636
type: Answer

http://stackoverflow.com/comment/118493092
has text: Consider gcloud command line to stop the version. https://cloud.google.com/sdk/gcloud/reference/app/versions/stop
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27229407

http://stackoverflow.com/a/27237005
score: 2
accepted answer of: http://stackoverflow.com/q/27236801
has comment: http://stackoverflow.com/comment/42950827
has body: The reason that your test case is running all the lines in the "real" method, is because your mock object is never being used anywhere. As written, you cannot mock MemberUtil in your HistoryServiceImpl, because you are manually instantiating it in the getCaseHistory() method. You need to make getCaseHistory() get its MemberUtil from somewhere else, so that you can inject your mock version in your test class. The simplest solution would be to define your MemberUtil as a member variable, so that the @InjectMocks annotation can override the default value: class HistoryServiceImpl implements CaseHistory { MemberUtil memberUtil = new MemberUtil(); @Override public List&lt;CaseHistoryDto&gt; getCaseHistory(Individual member, Individual provider) { ... } } Alternately you could have HistoryServiceImpl accept an externally provided MemberUtil, either in its constructor or via a setter method. You can then easily pass in a mocked version in your test class. Generally, utility classes are stateless, so another possible solution would be to convert MemberUtil to make all of its methods static. Then you can use something like PowerMock to mock your static methods.
has comment: http://stackoverflow.com/comment/42951180
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27236801

http://stackoverflow.com/comment/43212859
score: 0
type: AnswerComment
type: Comment
has text: I'm not a big fan of GWT. I would recommend you Roo with Spring MVC. On the other side, in my company we use gvNIX as development tool, a Roo distribution that includes Datatables, jQuery, Bootstrap 3 and more. To learn more visit www.gvnix.org. Here you have a good reference of a project developed with gvNIX: http://www.europapress.es/comunitat-valenciana/noticia-cerca-40-empleados-publicos-solicita-carrera-profesional-primeras-24-horas-20141123115615.html (spanish)
comment on: http://stackoverflow.com/a/27204082

http://stackoverflow.com/q/27217164
has comment: http://stackoverflow.com/comment/42914635
tagged with: multidimensional-array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27217586
has body: I have been having trouble with multidimensional arrays. I want to add a user name to the first row then use a second embedded for loop to add a user Id. I just don't know how to assign it to the user input. int rows = 2; int cols = 2; Scanner input = new Scanner(System.in); String[][] info = new String [rows][cols]; for (int row = 0; row &lt; rows; row++) { for (int col = 0; col &lt; cols; col++) { System.out.printf("Please enter name for user %d", row +1); info[rows][cols] = input.nextLine(); } I don't know what code I would need to add the user name to the first row. Example of input: Please enter name for user 1: Billy Smith Please enter name for user 2: Estelle Geddis Then for the user id (Have not coded this for loop) Please enter ID for Billy Smith: bSmithSATX Please enter ID for Estelle Geddis: eGeddisLACA
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/42914653
type: Question
has comment: http://stackoverflow.com/comment/42914674
has title: Multidimensional Array with String Variables
has comment: http://stackoverflow.com/comment/42914141
has comment: http://stackoverflow.com/comment/42914125
answer count: 1

http://stackoverflow.com/comment/43074545
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27305461
has text: When I'm deleting, I'm deleting a object, so I'm not sure how to get the rows number filled when using removeRow(?).
type: Comment

http://stackoverflow.com/a/27487899
downvote count: 0
has body: A Question of Semantics From my understanding of the subject, an absolute path can only be absolute if it can be traced back to it's root. As such there should never be an absolute path without a root. Ultimately this just comes down to semantics and although we can find definitions that define the absolute path such (egs below); "the absolute path contains the root directory and all other subdirectories" "absolute path is a path that points to the same location on one file system regardless of the present working directory or combined paths. As such it must always contain the root directory." The only real question left after this point is whether the definition by the Java API follows suit. The only place I can find reference to the definition of an absolute path (with reference to the root element) from an official Oracle source is from inside the official Java tutorial. The official Java tutorials say An absolute path always contains the root element If this statement is to be believed, then no file system (no matter how obscure) can contain a Path that the Java API will consider absolute, unless it also considers it to contain a root. You could argue that in some non-heirarchical file systems you might fall into some issues deciding whether a file can be it's own root. However, by this definition in the Path API (emphasis mine), a path should not represent a non-hierarchical element; A Path represents a path that is hierarchical and composed of a sequence of directory and file name elements
upvote count: 14
type: Answer
has comment: http://stackoverflow.com/comment/43407774
score: 14
has comment: http://stackoverflow.com/comment/43408123
answers question: http://stackoverflow.com/q/27202184
has comment: http://stackoverflow.com/comment/43408199

http://stackoverflow.com/comment/43218267
type: Comment
comment on: http://stackoverflow.com/a/27252056
score: 0
type: AnswerComment
has text: Nope, no identity generator.

http://stackoverflow.com/comment/43070674
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27303459
score: 0
has text: @fge +1 to you. Using StringBuilder to construct a return value is an important, standard approach to a variety of problems.

http://stackoverflow.com/a/27183958
has comment: http://stackoverflow.com/comment/42855506
type: Answer
has body: if cursor is not null it return datandtime and stop here. So it doesn't execute this line: return null;
score: 0
has comment: http://stackoverflow.com/comment/42855375
answers question: http://stackoverflow.com/q/27183921

http://stackoverflow.com/q/27298440
has body: Is there a simple way to kill a Spring Cloud Config Client on startup if the server is not running? I haven't been able to find any examples online, and I'm wondering if there is some code that already exists that can be reused, or if this is something that is better handled on a case by case basis?
score: 2
possible better answer: http://stackoverflow.com/a/27306677
upvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27307891
type: Question
answer count: 2
downvote count: 0
tagged with: spring-cloud
favorite count: 0
has answer: http://stackoverflow.com/a/27306677
accepted answer: http://stackoverflow.com/a/27307891
has title: Kill Spring Cloud Client if Server is not running
tagged with: spring

http://stackoverflow.com/q/27198403
score: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42881423
tagged with: loops
has comment: http://stackoverflow.com/comment/42881267
duplicate of: http://stackoverflow.com/q/7081339
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42881427
linked to: http://stackoverflow.com/q/11923128
has comment: http://stackoverflow.com/comment/42881357
has comment: http://stackoverflow.com/comment/42881279
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42881412
has comment: http://stackoverflow.com/comment/42881318
has comment: http://stackoverflow.com/comment/42881271
has body: I've been tearing into the Netty networking library trying to learn how to write some basic NIO networking code when I ran into something that didn't look right to me, a for-loop without anything inside of it, here's the code: for (;;) { SocketChannel acceptedSocket = channel.socket.accept(); if (acceptedSocket == null) { break; } registerAcceptedChannel(channel, acceptedSocket, thread); } I immediately checked the documentation tutorials of loops, located here and couldn't find anything relating to this statement. The commentation directly above this code states the following: // accept connections in a for loop until no new connection is ready But this doesn't really explain to me how it works, or why, it just says what it's doing. If you need the entire method, here it is: @Override protected void process(Selector selector) { Set&lt;SelectionKey&gt; selectedKeys = selector.selectedKeys(); if (selectedKeys.isEmpty()) { return; } for (Iterator&lt;SelectionKey&gt; i = selectedKeys.iterator(); i.hasNext();) { SelectionKey k = i.next(); i.remove(); NioServerSocketChannel channel = (NioServerSocketChannel) k.attachment(); try { // accept connections in a for loop until no new connection is ready for (;;) { SocketChannel acceptedSocket = channel.socket.accept(); if (acceptedSocket == null) { break; } registerAcceptedChannel(channel, acceptedSocket, thread); } } catch (CancelledKeyException e) { // Raised by accept() when the server socket was closed. k.cancel(); channel.close(); } catch (SocketTimeoutException e) { // Thrown every second to get ClosedChannelException // raised. } catch (ClosedChannelException e) { // Closed as requested. } catch (Throwable t) { if (logger.isWarnEnabled()) { logger.warn( "Failed to accept a connection.", t); } try { Thread.sleep(1000); } catch (InterruptedException e1) { // Ignore } } } }
has comment: http://stackoverflow.com/comment/42881366
has title: Java for(;;) loop?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42881270
linked to: http://stackoverflow.com/q/8880870
linked to: http://stackoverflow.com/q/26653968
answer count: 1
linked to: http://stackoverflow.com/q/6347862
has answer: http://stackoverflow.com/a/27198420
linked to: http://stackoverflow.com/q/7081339

http://stackoverflow.com/q/27207360
tagged with: apache-httpcomponents
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27213406
score: 0
has title: How rewrite target URL in reverse proxy developed with Apache http-core-4.3.3
answer count: 1
has answer: http://stackoverflow.com/a/27213406
has body: I am developing a reverse proxy using http-core-4.3.3, and I need to rewrite the url, for example /srv001/curstomer/id has to be rewrite to /curstomer/id My development is based on this example https://hc.apache.org/httpcomponents-core-ga/httpcore/examples/org/apache/http/examples/ElementalReverseProxy.java This is my proxy handler public void handle( final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException { long start = System.currentTimeMillis(); DefaultBHttpClientConnection outconn = (DefaultBHttpClientConnection) context.getAttribute(ProxyContext.HTTP_OUT_CONN); context.setAttribute(HttpCoreContext.HTTP_CONNECTION, outconn); context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, this.target); System.out.println("&gt;&gt; Request URI: " + request.getRequestLine().getUri()); // Remove hop-by-hop headers ... this.httpexecutor.preProcess(request, this.httpproc, context); final HttpResponse targetResponse = this.httpexecutor.execute(request, outconn, context); this.httpexecutor.postProcess(response, this.httpproc, context); // Remove hop-by-hop headers ... response.setStatusLine(targetResponse.getStatusLine()); response.setHeaders(targetResponse.getAllHeaders()); response.setEntity(targetResponse.getEntity()); System.out.println("&lt;&lt; Response: " + response.getStatusLine()); final boolean keepalive = this.connStrategy.keepAlive(response, context); context.setAttribute(ProxyContext.HTTP_CONN_KEEPALIVE, new Boolean(keepalive)); long end = System.currentTimeMillis(); System.out.println("-- request took (msec): " + Long.toString(end - start)); } I've tried to rewrite the target url at request, but there is no set method for doing that. How can I rewrite the target URL ?
tagged with: reverse-proxy

http://stackoverflow.com/comment/43047736
has text: faster than what, exactly? if you're comparing to arrays, the main reason is because an array has a fixed size, and so would need to be 'recreated' on insert/delete
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27290897

http://stackoverflow.com/comment/43004116
comment on: http://stackoverflow.com/a/27259129
has text: Ok, that's clear. So fixing the warning is simply done by repressing it?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42866993
score: 0
type: AnswerComment
has text: Only leave the **4 lines** inside the if block - remove all what is surrounding these lines (if, else, all the brackets and the else contents too).
type: Comment
comment on: http://stackoverflow.com/a/27188988

http://stackoverflow.com/comment/42834871
type: QuestionComment
has text: No it's not a cam (?) problem. Also it's not my problem that you cannot understand. No they must not overlap. It's simple. Just partition an array into subarrays. That's all. No special requirements.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27170738

marker
tag name: marker
type: Tag
tags question: http://stackoverflow.com/q/27236329

http://stackoverflow.com/q/27241207
has title: Issues re-starting a finish()ed android activity
linked to: http://stackoverflow.com/q/12276027
has comment: http://stackoverflow.com/comment/42959814
has comment: http://stackoverflow.com/comment/42958972
tagged with: java
has comment: http://stackoverflow.com/comment/42959897
downvote count: 1
has comment: http://stackoverflow.com/comment/42959718
type: Question
tagged with: crash
score: -1
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/27245363
has body: I have two android activities with one single button on both. The activity DetailsActivity is my MAIN activity. public class DetailsActivity extends Activity { @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.details_activity_layout); } @Override public void onResume() { super.onResume(); } public void gotoSubDetails(View view) { Intent intent = new Intent(this, SubDetailsActivity.class); startActivity(intent); finish(); } } And my SubDetailsActivity is as follows: public class SubDetailsActivity extends Activity { @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.sub_details_activity_layout); } @Override public void onResume() { super.onResume(); } public void gotoDetails(View view) { Intent intent = new Intent(this, DetailsActivity.class); startActivity(intent); // Restarting the finish()ed activity here. finish(); } } And this is how I mentioned my button in details_activity_layout.xml for DetailsActivity.java: &lt;Button android:id="@+id/details_submit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/to_sub_details" android:onClick="gotoSubDetails" /&gt; And this is how I have mentioned my button in sub_details_activity_layout.xml for SubDetailsActivity.java: &lt;Button android:id="@+id/sub_details_submit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/back_to_details" android:onClick="gotoDetails" /&gt; These are my both activities in AndroidManifest.xml: &lt;activity android:name="DetailsActivity"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="SubDetailsActivity"&gt; &lt;/activity&gt; When I click the button in DetailsActivity, the activity finish()es properly and SubDetailsActivity starts up. But when I cli…
has answer: http://stackoverflow.com/a/27245264
tagged with: android-activity
has answer: http://stackoverflow.com/a/27245558
has comment: http://stackoverflow.com/comment/42959562
favorite count: 0
has comment: http://stackoverflow.com/comment/42958858
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/127690884
type: AnswerComment
comment on: http://stackoverflow.com/a/34583598
type: Comment
has text: This worked for me and the "GC overheard limit exceeded" error I was getting against a large oracle table and exporting it as a csv.
score: 0

http://stackoverflow.com/comment/42854261
has text: @Nitin Update your code with the new one. I need to see what is going on in the code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27165812

http://stackoverflow.com/comment/42975217
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27250476
has text: Can you give code for us with your webView?

http://stackoverflow.com/a/27218332
has body: Scanner in many of its methods expects pattern representing regular expressions (regex). This happens also in case of skip method, but in regex | is meta-character representing OR operator. To make it simple literal you need to escape it by adding \ before it (remember that to create \ literal in String you also need to escape it with another \). So regex representing | character is \| which needs to be written as String "\\|". Other problem is that skip requires regex which needs to match entire part which needs to be skipped and this part must appear exactly after position of Scanner's cursor, so in case of data like 1 | when we will invoke nextInt() cursor will be set right after 1 (I will mark it with I) 1I | so pattern which we want to skip is space+|. Last problem is that your file doesn't have correct values in all lines (it has lines containing only | | where we won't be able to use nextInt() because next element will not be int. In that case we can simply test if this line starts with integer by using hasNextInt() and if it doesn't read consume it without processing its content by invoking nextLine(). So your code can look like File textFile = new File("input.txt"); try (Scanner sc = new Scanner(textFile)) { while (sc.hasNextLine()) { if (sc.hasNextInt()) { System.out.println("id = " + sc.nextInt()); System.out.println("value = " + sc.nextInt()); if (sc.hasNext("\\|")) sc.skip(" \\|"); } else { sc.nextLine(); // skip line if it doens't contain more integers } } } catch (FileNotFoundException e) { System.out.println("File not found: " + textFile); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27217816
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42946103
score: 2
accepted answer of: http://stackoverflow.com/q/27217816

http://stackoverflow.com/a/27223416
type: Answer
downvote count: 1
upvote count: 5
score: 4
has body: That's only an IntelliJ Ultimate Edition feature. If you want it, you'll have to pay for a license.
answers question: http://stackoverflow.com/q/27223372

http://stackoverflow.com/comment/42821904
comment on: http://stackoverflow.com/q/27164723
has text: Disable multiple selection?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43038170
has text: @ElliottFrisch It's just an example - just any time of using the parenthesis.
score: 0
comment on: http://stackoverflow.com/q/27285162
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43072339
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27304602
has text: The code you posted looks incomplete. Also, it appears you count even numbers in `evenNumbers`, but then never use it anywhere.

http://stackoverflow.com/comment/42985483
comment on: http://stackoverflow.com/q/27255843
score: 0
type: Comment
has text: while (true) is better form than for(;;)
type: QuestionComment

http://stackoverflow.com/a/27223650
score: 0
type: Answer
has body: Two common optimizations come to mind, which can be used individually or together: 1) If you your goal is to be able to increase the throughput of inserted records, then you can consider tuning the size of your MySQL datasource connection pool. How it is done depends on which web/application server and the connection pool implementation you use. 2) If the goal is to keep the server responsive, then you may consider performing asynchronous inserts, basically trading additional memory usage for improved response time of the web tier. If you use a J2EE 7 compliant application server, then this should be relatively easy using the Java EE concurrency API, otherwise you should be able to use the "traditional" java.util.concurrent APIs, even though the J2EE spec doesn't encourage it.
answers question: http://stackoverflow.com/q/27223045

http://stackoverflow.com/comment/43042484
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27286594
type: Comment
has text: BatchList should consists of: C:\install\Batch1.jar C:\install\Batch2.jar C:\install\Batch3.jar C:\install\Batch4.jar installList should consists of: C:\install\sql1.sql C:\install\sql2.sql C:\install\sql3.sql C:\install\sql4.sql uninstallList should consists of:: C:\uninstall\sql1.sql C:\uninstall\sql2.sql C:\uninstall\sql3.sql C:\uninstall\sql4.sql

http://stackoverflow.com/comment/42935363
comment on: http://stackoverflow.com/q/27229109
type: QuestionComment
type: Comment
has text: Is `keyStoreName` in the `FileInputStream()` an existing keystore? Or did you try to create a new keystore using that name?
score: 1

http://stackoverflow.com/q/27213703
tagged with: java
type: UnansweredQuestion
upvote count: 4
tagged with: jpa
downvote count: 0
favorite count: 0
type: Question
has body: I have the following entity @Entity @Table(name = "merchants") public class Merchant implements Serializable { ... @ElementCollection @CollectionTable(name = "keywords", joinColumns = @JoinColumn(name = "merchant_id")) private List&lt;String&gt; keywords; ... } which has corresponding static metamodel @Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor") @StaticMetamodel(Merchant.class) public abstract class Merchant_ { ... public static volatile ListAttribute&lt;Merchant, String&gt; keywords; ... } How do I write queries using CriteriaBuilder to check if keywords attribute contains given value?
score: 4
has title: Using field of type ListAttribute of static metamodel in a CriteriaQuery
tagged with: criteria-api
answer count: 1
has answer: http://stackoverflow.com/a/27213961

http://stackoverflow.com/q/27248795
has answer: http://stackoverflow.com/a/27250076
type: Question
accepted answer: http://stackoverflow.com/a/27251148
answer count: 2
has title: Why does JUnit ignore @Category annotations on base classes?
has answer: http://stackoverflow.com/a/27251148
upvote count: 1
tagged with: junit
has body: In my project it happens that I have base classes for some of my test categories. So it would be handy if I could add the annotation @Category(MyCategory.class) to the base class to add all the test in all the subclasses to my category at once. It is actually possible to add this annotation at class level, but JUnit / surefire igores it on base classes. I think this behaviour is inconsistent and confusing. Is there a reason why JUnit does not support this?
favorite count: 0
possible better answer: http://stackoverflow.com/a/27250076
tagged with: maven-surefire-plugin
type: AnsweredQuestion
tagged with: junit4
downvote count: 0
has comment: http://stackoverflow.com/comment/42973453
score: 1
tagged with: java

http://stackoverflow.com/comment/43077748
type: AnswerComment
score: 0
type: Comment
has text: Okay so I used your code but now, whenever its backtracking and reaches a junction it has already met, this comes up and it freezes `Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at RobotData.searchJunction(Explorer.java:248) at RobotData.reverseHeading(Explorer.java:261) at Explorer.backtrack(Explorer.java:74) at Explorer.junction(Explorer.java:122) at Explorer.controlRobot(Explorer.java:56) ... 5 more`
comment on: http://stackoverflow.com/a/27307137

http://stackoverflow.com/comment/42935921
has text: @ıɯɐƃoʇ ǝızuǝʞ: in principle, the answer is *yes*, it is possible to encounter torn writes on a 64 Bit JVM as there is no guaranty that a 64 Bit JVM uses 64 Bit Updates all the time. E.g. it’s optimizer still might read/write a 32 Bit half value if it knows that the other half has not been modified (by that thread). This might also apply when utilizing SIMD extensions like SSE which can process more items in one step when using smaller data sizes. It’s still unlikely that you ever *see* such a torn update and there’s no example code to exhibit it, but you can’t rely on atomicity for 64 Bit.
comment on: http://stackoverflow.com/a/27192886
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27204058
has comment: http://stackoverflow.com/comment/42890947
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27204034
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/27204034
has body: Did you try SimpleDateFormat dateFormatter = new SimpleDateFormat("dd-MMM-yyyy"); instead of SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM yyyy"); (note the hyphens, since your pattern doesn't match your input) Also helpful: using Locale.US as recommended by @ZouZou

http://stackoverflow.com/comment/42960066
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27227281
has text: How do I check if it is Ntlm or Kerberos?

http://stackoverflow.com/a/27283861
downvote count: 0
answers question: http://stackoverflow.com/q/27283801
score: 1
has body: In this case you don't need to explicitly say that e is one of the field of this. instance because in current scope there are no other variables called e so you can skip this. part (it will be added by compiler automatically). But if your method signature would look like public void intializeVariable(char e) { .. } and you would like to assign value passed as e argument to field e you would need to write it as this.e = e; // ^ ^-- methods local variable // | // +------ field
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42847867
score: 0
type: Comment
type: QuestionComment
has text: @KickButtowski Sure, open a chat ;)
comment on: http://stackoverflow.com/q/27179330

http://stackoverflow.com/a/27229871
type: Answer
has body: Straight forward answer "All static data stored in context of a class(which is global memory) and All object data like instance variables(which is specific to each object--own copy) stored in Object scoped memory" changes to static variables will reflect to all objects bcz it's a global memory and changes to instance variable is specific to object level A object1=new A(); a=5 b=6 A object2=new A(); a=5 b=6 object1.method(); a=6 b=6 object2.method(); a=7 b=6
answers question: http://stackoverflow.com/q/27229714
score: 0

http://stackoverflow.com/a/27193532
has comment: http://stackoverflow.com/comment/42874497
has body: The problem is the first for loop. In Java, you cannot just put code under a class - it needs to be in a method, constructor or anonymous block. Since this seems like intinialization code, a constructor seems appropriate: public class Memory { File folder = (new File("mypictures")); File[] pictures = folder.listFiles(); ImageIcon im = new ImageIcon(); Card[] allCards; Random random = new Random(); /** Defaylt constructor to initialize allCards: */ public Memory() { allCards = new Crad[im.length]; for(int i = 0; i &lt; im.length; i++) { allCards[i] = new Card(new ImageIcon(pictures[i].getPath())); } } // rest of the class
answers question: http://stackoverflow.com/q/27193390
score: 0
type: Answer

http://stackoverflow.com/q/27237936
has comment: http://stackoverflow.com/comment/42952983
tagged with: mariadb
favorite count: 0
has body: I'm getting this error when I set my adapter. I already have a ListView with id lv_cine in my view. Edit 1: added the wrong codes but they are the same as this. Edit 2: Ok i managed to get past the first error, but now i'm getting a similar one: 12-01 20:43:44.445 7617-7617/com.example.maria.maria E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.maria.maria, PID: 7617 java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference at android.widget.SimpleAdapter.getCount(SimpleAdapter.java:93) at android.widget.ListView.setAdapter(ListView.java:487) at com.example.maria.maria.Cinema$GetContacts.onPostExecute(Cinema.java:146) at com.example.maria.maria.Cinema$GetContacts.onPostExecute(Cinema.java:67) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Here is my activity (Cinema.java): public class Cinema extends Activity { private ProgressDialog pDialog; ListView listView; private static String url = "http://viniciuscoelho.com/android/dados"; // JSON Node nomes private static final String TAG_CATEGORIA = "cinema"; private static final String TAG_NOME = "nome"; private static final String TAG_DATA = "data"; private static final String TAG_ENDERECO = "endereco"; private static final String TAG_LINK = "link"; private static final String TAG_DESC = "desc"; // contacts JSONArray JSONArray dados = null; // Hashmap for ListView ArrayList&lt;HashMap&lt;String, String&gt;&gt; lis…
tagged with: android
duplicate of: http://stackoverflow.com/q/218384
has title: "Null object" error when setting a adapter
has comment: http://stackoverflow.com/comment/42953268
has answer: http://stackoverflow.com/a/27238935
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27238935
has answer: http://stackoverflow.com/a/27238544
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
possible better answer: http://stackoverflow.com/a/27238544
tagged with: listadapter
answer count: 2

http://stackoverflow.com/a/27159456
has comment: http://stackoverflow.com/comment/42814180
has comment: http://stackoverflow.com/comment/42813451
answers question: http://stackoverflow.com/q/27159348
has comment: http://stackoverflow.com/comment/42813061
score: 0
has comment: http://stackoverflow.com/comment/42813991
has body: You can always just create a method like public static boolean isPalindrome(String str) { String opposite = ""; for(int a = str.length()-1;a&gt;0;a++) { opposite+=str.charAt(a); } return opposite.equals(str); } Edit: I'm going to write the way to implement it. for(char c1: digit1) { for(char c2: digit1) { for(char c3: digit1) { for(char c4: digit1) { for(char c5: digit1) { String tempCheck = ""+c1+c2+c3+c4+c5; if(isPalindrome(tempCheck)) { System.out.println(tempCheck); } } } } } }
type: Answer

http://stackoverflow.com/comment/43038528
comment on: http://stackoverflow.com/q/27285428
has text: Yes, I know. Have you figured it out too?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42870498
type: Comment
comment on: http://stackoverflow.com/a/27191880
score: 1
type: AnswerComment
has text: The problem of this approach is that the CPU may be busy computing on other processes while running the program. So this way isn't an exact solution for processing time

http://stackoverflow.com/a/27247011
answers question: http://stackoverflow.com/q/27245283
has comment: http://stackoverflow.com/comment/42971323
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42969438
type: Answer
accepted answer of: http://stackoverflow.com/q/27245283
has body: Here is an example of drag and drop to change the order of panels(does not support sorting). DragMouseAdapter#mouseDragged(...): search drag panel, remove form parent panel and open cursor window. DragMouseAdapter#mouseReleased(...): search drop location, insert dragging panel, close cursor window. import java.awt.*; import java.awt.dnd.*; import java.awt.event.*; import java.net.*; import java.util.*; import javax.swing.*; public class RearrangeOrderOfPanelsTest2 { public JComponent makeUI() { Box box = Box.createVerticalBox(); DragMouseAdapter dh = new DragMouseAdapter(); box.addMouseListener(dh); box.addMouseMotionListener(dh); int idx = 0; for (JComponent c : Arrays.asList( new JLabel("&lt;html&gt;111&lt;br&gt;11&lt;br&gt;11"), new JButton("2"), new JCheckBox("3"), new JTextField(14))) { box.add(createToolbarButton(idx++, c)); } JPanel p = new JPanel(new BorderLayout()); p.add(box, BorderLayout.NORTH); return p; } private static JComponent createToolbarButton(int i, JComponent c) { JLabel l = new JLabel(String.format(" %04d ", i)); l.setOpaque(true); l.setBackground(Color.RED); JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(5, 5, 5, 5), BorderFactory.createLineBorder(Color.BLUE, 2))); p.add(l, BorderLayout.WEST); p.add(c); p.setOpaque(false); return p; } public static void main(String... args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } public static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(new RearrangeOrderOfPanelsTest2().makeUI()); f.setSize(320, 240); f.setLocationRelativeTo(null); f.setVisible(true); } } class DragMouseAdapter extends MouseAdapter { private static final int xoffset = 16; private static final Rectangle R1 = new Rectangle(); private static final Rectangle R2 = new Rectangle(); private static Rectangle prevRect; private fin…

http://stackoverflow.com/a/27181116
upvote count: 3
has body: It looks like this is fixed in the 4.12 beta versions of JUnit. Here's a description of the issue, and its resolution: https://github.com/junit-team/junit/issues/637
answers question: http://stackoverflow.com/q/27178848
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27178848
type: Answer
score: 3

http://stackoverflow.com/comment/42986875
type: AnswerComment
has text: so can u give any solution for me to get multiple created div that text box values to java using req.getParam...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27256559

http://stackoverflow.com/comment/42919452
type: Comment
comment on: http://stackoverflow.com/q/27219914
type: QuestionComment
has text: *"I'm update my question"* Let me know when there is an MCVE.
score: 0

http://stackoverflow.com/q/27156395
tagged with: java
tagged with: lotus-domino
score: -1
linked to: http://stackoverflow.com/q/9655181
type: Question
has comment: http://stackoverflow.com/comment/42835837
linked to: http://stackoverflow.com/q/140131
has comment: http://stackoverflow.com/comment/42834840
answer count: 1
has comment: http://stackoverflow.com/comment/42813562
favorite count: 0
linked to: http://stackoverflow.com/q/14464827
has answer: http://stackoverflow.com/a/27245922
has comment: http://stackoverflow.com/comment/42817855
has comment: http://stackoverflow.com/comment/42813458
has body: I have a tricky problem within my Lotus Domino application. We have been using EPDQ to handle payments for our shopping cart but customer wants to switch to Netpay which works differently in that you encrypt your own transaction information using their encryption key and initialisation vector. They helpfully provided some sample java, the encrytion function from this is below but although Lotus Domino was OK importing the libraries needed for the encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.IvParameterSpec; It could not resolve the last library I need import org.apache.commons.codec.binary.Hex; My Java skills aren't great but my understanding is that all this seems to be doing is generating a byte string for the encryption process. There is a matching decryption function which also needs this library, is there another alternative way of achieving its effect? In my agent you can import loads of different libraries but none so far contain what I need. public static String encrypt_cbc(String input, String key, String iv){ byte[] crypted = null; try{ //byte[] key_byte = Hex.decodeHex(key.toCharArray()); byte[] key_byte = DatatypeConverter.parseHexBinary(key); SecretKeySpec key_spec = new SecretKeySpec(key_byte, "AES"); //byte[] iv_byte = Hex.decodeHex(iv.toCharArray()); byte[] iv_byte = DatatypeConverter.parseHexBinary(IV); IvParameterSpec iv_spec = new IvParameterSpec(iv_byte); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key_spec, iv_spec); crypted = cipher.doFinal(input.getBytes()); }catch(Exception e){ System.out.println(e.toString()); } String crypted_hex = Hex.encodeHexString(crypted); return crypted_hex; } Thursday 21:13 - Honing in on a solution, replacing Hex.decodeHex with DatatypeConverter.parseHexBinary seems like a good start although its not liking the call to cipher.init or doFinal so still have work to do. I've not yet gone down the path of incorpo…
has title: Encrypting string in java - Lotus Domino Integration (Netpay)
tagged with: encryption
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42966998
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27245922

http://stackoverflow.com/comment/43041314
type: Comment
comment on: http://stackoverflow.com/a/27273024
type: AnswerComment
has text: I am using joda datetime
score: 0

http://stackoverflow.com/q/27217401
tagged with: python
has comment: http://stackoverflow.com/comment/42914482
tagged with: java
has answer: http://stackoverflow.com/a/72523377
has answer: http://stackoverflow.com/a/27217513
type: Question
has title: Operator in Java like // in python?
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/57453225
has answer: http://stackoverflow.com/a/27217503
has body: Is there a form of the // operator that is used in python that I can use in java, or some sort of workaround? 10 // 3 = 3
tagged with: operators
favorite count: 0
upvote count: 2
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27218072

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/27251535
tags question: http://stackoverflow.com/q/27218087
tag name: dayofweek

http://stackoverflow.com/q/27223586
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42925460
has title: Google cloud messaging (GCM) library not found in Android SDK manager
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27223699
has body: I want to implement push notification in my android app .So i wanted to install Google cloud messaging library from the android SDK manager.But i dont see it in the Extras section of the sdk manager.Some people suggested that updating the sdk manager will make the GCM library visible.Others suggest that the GCM library is deprecated and i just need to use Google play services library.Which one among the two is true and how do i fix the issue?
tagged with: android
has answer: http://stackoverflow.com/a/27223668
type: UnansweredQuestion

http://stackoverflow.com/q/27228607
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42948186
tagged with: css
linked to: http://stackoverflow.com/q/26971528
linked to: http://stackoverflow.com/q/7055393
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42935569
has body: I've been trying for some days to center an image horizontally inside a .docx file generated from HTML with docx4j without success. What I've tried so far (and works in HTML) is: &lt;div align="center"&gt;&lt;img alt="" src="data:image/png;base64,/9j/4AAQSkZJ..."&gt;&lt;/div&gt; (by centering outer div) &lt;div&gt;&lt;img alt="" src="data:image/png;base64,/9j/4AAQSkZJ..." clase="img-default"&gt;&lt;/div&gt; with the following commands inside Style tag: .img-default { margin: 0 auto; display: block; height: auto; max-width: 100%; } The code I'm using to generate the .docx is available here, guided from this question. Thanks!
has comment: http://stackoverflow.com/comment/42934623
type: Question
tagged with: docx4j
has title: Center image horizontally inside .docx generated with docx4j
tagged with: image
accepted answer: http://stackoverflow.com/a/27240551
has comment: http://stackoverflow.com/comment/42955283
upvote count: 1
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27240551
favorite count: 0

output
tags question: http://stackoverflow.com/q/27284242
tags question: http://stackoverflow.com/q/27205424
tag name: output
tags question: http://stackoverflow.com/q/27299033
type: Tag
tags question: http://stackoverflow.com/q/27298551
tags question: http://stackoverflow.com/q/27206306
tags question: http://stackoverflow.com/q/27160064
tags question: http://stackoverflow.com/q/27234564
tags question: http://stackoverflow.com/q/27306777

http://stackoverflow.com/a/27302625
has comment: http://stackoverflow.com/comment/43085783
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43086828
has comment: http://stackoverflow.com/comment/43085974
has body: Keep an array of FlatCheckBoxs: private FlatCheckBox [] check = new FlatCheckBox[6]; and use an enum to retrive what checkbox you need: private enum Names { fourniture(0), nourriture(1), voyages(2), habillement(3), medias(4), autres(5); private int val; Names(int a) { val = a; } public int get() { return val; } }; Now use: public void checkboxState() { for(FlatCheckBox fb : check) { if (fb.isChecked()) { } } } And you can access individual elements of the array like this: FlatCheckBox fourniture = check[Names.fourniture.get()]; I would use the enum for a better readability, using [0], [1] ... can be confusing and lead to programming errors.
answers question: http://stackoverflow.com/q/27299223
has comment: http://stackoverflow.com/comment/43085358
accepted answer of: http://stackoverflow.com/q/27299223
has comment: http://stackoverflow.com/comment/43085469
downvote count: 0
score: 2
type: AcceptedAnswer

http://stackoverflow.com/q/27198017
has body: I try to configure my EntityManager programmatically. My vendor is OpenJPA and I write a simple console application. Here is my code public static void main(String[] args) { Map&lt;String, String&gt; properties = new HashMap&lt;&gt;(); properties.put("openjpa.ConnectionDriverName", "org.postgresql.Driver"); properties.put("openjpa.ConnectionURL", "jdbc:postgresql://localhost:5432/shop"); properties.put("openjpa.ConnectionUserName", "bob"); properties.put("openjpa.ConnectionPassword", "secret"); properties.put("openjpa.RuntimeUnenhancedClasses", "supported"); properties.put("openjpa.MetaDataFactory", "jpa(Types=de.jpa.demo.dto.Category;de.jpa.demo.dto.User;de.jpa.demo.dto.Order;de.jpa.demo.dto.Product)"); properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(foreignKeys=true)"); EntityManagerFactory factory = Persistence.createEntityManagerFactory("test", properties); OpenJPAConfiguration configuration = ((EntityManagerFactoryImpl) factory).getConfiguration(); MetaDataRepository repositoryInstance = configuration.getMetaDataRepositoryInstance(); repositoryInstance.addPersistenceAware(Category.class); repositoryInstance.addPersistenceAware(Order.class); repositoryInstance.addPersistenceAware(Product.class); repositoryInstance.addPersistenceAware(User.class); manager = factory.createEntityManager(); } But I get an error javax.persistence.PersistenceException: No persistence providers available for "test" after trying the following discovered implementations: org.apache.openjpa.persistence.PersistenceProviderImpl at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:182) at de.jpa.demo.dto.OpenJpaUserRepositoryIT.init(OpenJpaUserRepositoryIT.java:56) at de.jpa.demo.dto.OpenJpaUserRepositoryIT.before(OpenJpaUserRepositoryIT.java:22) What I'm doing wrong?
tagged with: openjpa
type: Question
has title: OpenJPA: How to configure EntityManager programmatically?
tagged with: java
score: 0
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/27206716
tagged with: entitymanager
type: UnansweredQuestion

http://stackoverflow.com/q/27164881
has answer: http://stackoverflow.com/a/27183499
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27167463
favorite count: 0
has title: Passing multiple values from Servlet to JSP but I get only 1 value in JSP
has body: I am trying to pass both latitude and longitude values from a Servlet to a JSP but I get only 1 value in the JSP Servlet page for(int i=0;i&lt;json.length();i++) { String lat=json.getJSONObject(i).get("lat").toString(); String lon=json.getJSONObject(i).get("lon").toString(); lats[i]=lat; lons[i]=lon; request.setAttribute("lats", lats[i]); request.setAttribute("lons", lons[i]); System.out.println(lats[i]+","+lons[i]); } JSP page var len=&lt;%=request.getAttribute("len")%&gt;; lats[0]=&lt;%=request.getAttribute("lats")%&gt;; &lt;% String[] lats=(String[]) request.getAttribute("lats");%&gt; &lt;% String[] lons=(String[]) request.getAttribute("lons");%&gt; for(i=0;i&lt;len;i++) { var locations =[ ['&lt;%=request.getAttribute("cid")%&gt;',lats,lon] ]; alert(locations); } Where am I going wrong?
possible better answer: http://stackoverflow.com/a/27165812
has comment: http://stackoverflow.com/comment/42822247
has answer: http://stackoverflow.com/a/27165812
has answer: http://stackoverflow.com/a/27165208
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27167463
has comment: http://stackoverflow.com/comment/42825794
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42823286
tagged with: servlets

http://stackoverflow.com/comment/43016278
type: QuestionComment
comment on: http://stackoverflow.com/q/27271625
has text: This is a eclipse problem if the class is present and you can see it in front you. I had it many times, normally I would clean the project, or just delete the .eclipse folder(In linux), check Project settings to ensure classpaths are proper.
score: 0
type: Comment

http://stackoverflow.com/comment/43082870
has text: Well, a point is tiny, and it can be easily overlooked ;-) And "width" really *is* the width: integral part, decimal point, fractional digits (!) and even the sign, if negative.
score: 0
comment on: http://stackoverflow.com/q/27310770
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27253864
upvote count: 1
tagged with: loops
type: Question
tagged with: arraylist
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27254098
tagged with: string
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27254098
score: 1
tagged with: java
has body: I have created an ArrayList that holds "accounts" created by a user. I'm now trying to write a "login" function that loops through the ArrayList and checks the user input against accounts already existing in the accounts ArrayList. This is my loop; for(UserInfo createdUser : auctionAccounts){ if(enteredUser.equals(createdUser.userName) &amp;&amp; enteredPass.equals(createdUser.passWord)){ System.out.println("Welcome: " +createdUser.userName); returnToMenu(); }else{ System.out.println("Username or Password is wrong!"); loginAccount(aI); } } This works absolutely fine if there is only one account in the ArrayList. However when there is more than one account in the list, I can only ever login to the first account, and none after that. I have also tried using the ArrayList.contains() method instead of .equals(), however this produces the same results. EDIT: just to add, this is how I create accounts; UserInfo createdUser = new UserInfo(); System.out.println("---- Enter a username ----"); createdUser.setUsername(scanner.next()); System.out.println("---- Enter a password ----"); createdUser.setPass(scanner.next()); this.aI.createAccount(createdUser); accountHandler(aI);
has title: ArrayList String compares

http://stackoverflow.com/comment/43077947
comment on: http://stackoverflow.com/q/27307799
score: 0
type: QuestionComment
type: Comment
has text: @OldProgrammer I am using NetBeans. I am currently messing around with the debugger. What are the advantages of using this?

http://stackoverflow.com/a/27295975
score: 3
accepted answer of: http://stackoverflow.com/q/27295505
downvote count: 0
answers question: http://stackoverflow.com/q/27295505
has body: I resolved this problem including a VBox inside my button, and then including several Labels inside the VBox. Like this: The result is: If there is a more elegant way to have the same result, please, let me know. Thank you.
has comment: http://stackoverflow.com/comment/116085336
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27244974
type: Question
tagged with: weblogic
tagged with: java
tagged with: eclipse
has body: i have tomcat project the directory structure is previously i was using tomcat server, whenever i modified .java files i used to build the project and restarted the server in eclipse through plugin than the changes would have taken effect. Now in my company they changed from tomcat to weblogic since i am new to it, i used to build war file every time and deploy manually to check the changes. Can any one tell me how to do hot deployment in web logic. i googled it but it says i need to change project type to dynamic project, that i cant do since it already in development. is their better way just make changes to java file build and no need to restart the server through eclipse in weblogic 12c. Eclipse IDE luna weblogic 12c server project type : tomcat project structure
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42969072
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42966425
has answer: http://stackoverflow.com/a/27245511
has comment: http://stackoverflow.com/comment/42966620
tagged with: windows
has comment: http://stackoverflow.com/comment/42966865
score: -1
has comment: http://stackoverflow.com/comment/42983933
has title: hot deployment of tomcat project in weblogic?
linked to: http://stackoverflow.com/q/26525685
downvote count: 1

executorservice
type: Tag
tags question: http://stackoverflow.com/q/27171980
tags question: http://stackoverflow.com/q/27297306
tags question: http://stackoverflow.com/q/27246717
tag name: executorservice
tags question: http://stackoverflow.com/q/27234504
tags question: http://stackoverflow.com/q/27313622
tags question: http://stackoverflow.com/q/27269068
tags question: http://stackoverflow.com/q/27301473
tags question: http://stackoverflow.com/q/27207797

http://stackoverflow.com/a/27255686
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27255474
downvote count: 0
has body: No, that's not possible; as @ajb's comment says, the constructor call is long gone by the time the object is used in other ways. One option you have is to set a breakpoint in the constructor and note the object ID of each instance as it passes through the constructor (Object ID is visible in the Variables view, as the value of this. Then when the other breakpoint is hit, you can look at the ID and know which object it refers to.
has comment: http://stackoverflow.com/comment/42985868
has comment: http://stackoverflow.com/comment/42985992
upvote count: 2
has comment: http://stackoverflow.com/comment/42985459
has comment: http://stackoverflow.com/comment/42986565
has comment: http://stackoverflow.com/comment/42985843

http://stackoverflow.com/comment/42873548
type: AnswerComment
score: 0
type: Comment
has text: This isn't the answer I was hoping for (as I cannot just upgrade my Gson jar), but it looks to be my only resolution. I'll just have to manually double-escape the input before handing it Gson so that it doesn't get itself into trouble. Thanks!
comment on: http://stackoverflow.com/a/27193999

http://stackoverflow.com/q/27201782
tagged with: java
has answer: http://stackoverflow.com/a/53133628
has title: MyBatis:collection via annotation in one query
accepted answer: http://stackoverflow.com/a/27217760
score: 9
type: Question
downvote count: 0
tagged with: mybatis
favorite count: 0
possible better answer: http://stackoverflow.com/a/41516376
has answer: http://stackoverflow.com/a/41516376
tagged with: sql
answer count: 4
has body: I have an xml mapper - one select and one result mapper. It works without problems. But I want to use annotations. My mapper: &lt;resultMap id="readItemsRM" type="com.company.Item"&gt; &lt;id property="id" column="Id"/&gt; &lt;result property="comment" column="Comment"/&gt; &lt;collection property="textItems" ofType="com.company.TextItem"&gt; &lt;id property="id" column="TxId"/&gt; &lt;result property="name" column="TxName"/&gt; &lt;/collection&gt; &lt;/resultMap&gt; So I did like this @Results({ @Result(id=true, property="id", column="Id"), @Result(property="comment", column="Comment"), ///,??? }) public List&lt;Item&gt; select(); I can't understand how can I map my collection via annotation without executing one more sql query. As all the examples I found suppose executing one more query. Please help.
has answer: http://stackoverflow.com/a/27217760
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/58395524
upvote count: 9

http://stackoverflow.com/comment/42861800
score: 0
type: Comment
has text: okay i fixed the unknown column. now im getting Ljava.lang.object: cannot be cast to org....ComputerNode...
comment on: http://stackoverflow.com/a/27184656
type: AnswerComment

http://stackoverflow.com/comment/42958279
type: QuestionComment
has text: I would use an array
comment on: http://stackoverflow.com/q/27238673
score: 0
type: Comment

http://stackoverflow.com/q/27201543
accepted answer: http://stackoverflow.com/a/27211959
type: AnsweredQuestion
has body: I have written a Java Classloader to load classes from a jar file. Enumeration&lt;JarEntry&gt; entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry element = entries.nextElement(); if (element.getName().endsWith(".class")) { //Class Manipulation via ASM //Loading class with MyClassloader } } The Problem is: When I load a Class, which Sublcass from a Class in the same Jar and the subclass isn't already loaded, I get a ClassNotFoundException. Example: class A extends B{} Class B{} Because of the alphabetical order, Class A is loaded first. I Get a ClassNotFoundException for Class B. At this time, Class B isn't loaded.
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/27211959
answer count: 1
downvote count: 0
tagged with: java-bytecode-asm
has title: How to load classes from jar file in correct order
favorite count: 0
tagged with: classloader
has comment: http://stackoverflow.com/comment/42886502

http://stackoverflow.com/a/27308632
answers question: http://stackoverflow.com/q/27308481
score: 0
type: AcceptedAnswer
type: Answer
has body: It means that the class MyThreads either require you to first write a method with name run or the way you are doing provides the ability to change the existing run method behaviour where you are declaring. It is like overriding if run method is already there or creating the method when you want to create object. This provides the ability to create objects of MyThreads without having to change the original class or creating multiple classes. public class TestThread { public static void main (String [] args) { Thread t = new MyThreads() { public void run() { System.out.println(" foo"); } }; t.start(); Thread t1 = new MyThreads() { public void run() { System.out.println(" this time it is somethidn else"); } }; t1.start(); System.out.println("out of run"); } } Little modification to your code shows the advantage of having this feature. If you observe run method of t1 is doing something different than what is in t. So it is now completely new thread.
accepted answer of: http://stackoverflow.com/q/27308481
has comment: http://stackoverflow.com/comment/43079862

http://stackoverflow.com/comment/42924298
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27222417
has text: Tell whoever gave you this to learn programming. These methods effectively do nothing. They are useless. They do a bunch of work then throw it away.
score: 0

http://stackoverflow.com/a/27205662
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42894052
downvote count: 0
type: Answer
has body: You don't need Thread.sleep(), you don't need recursion or while loop. You need stateful player. And your UI should only change the state of the player. See an example in https://stackoverflow.com/a/7524627/2078908 private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); private ScheduledFuture&lt;?&gt; playingTask; private FileInputStream playing; public void playMet() { stopPlaying(); playingTask = executor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { playMet(); } }, 0, 1000, TimeUnit.MILLISECONDS); } public void playMetOnce(){ try { IOUtils.close(playing); playing = new FileInputStream(new File("Click1.wav")); AudioStream as = new AudioStream(playing); AudioPlayer.player.start(as); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } public void stopPlaying(){ try { AudioPlayer.player.stop(); IOUtils.close(playing); playing = null; if (playingTask != null) { playingTask.cancel(false); } playingTask = null; } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
answers question: http://stackoverflow.com/q/27205368

http://stackoverflow.com/q/27203094
has comment: http://stackoverflow.com/comment/42889024
accepted answer: http://stackoverflow.com/a/27203477
score: 7
has body: Why can't I convert my Person object into Json? My Person Model: @Entity public class Person extends Model { @Id private Long id; private String value; } A controller method: import com.fasterxml.jackson.databind.JsonNode; import models.Person; import play.Logger; import play.db.ebean.Model; import play.mvc.Controller; import play.mvc.Result; import views.html.index; import java.util.List; import static play.data.Form.form; import static play.libs.Json.toJson; ... public static Result getJsonPersons() { List&lt;Person&gt; persons = new Model.Finder(Long.class, Person.class).all(); JsonNode jsonNode = toJson(persons); Logger.debug("JSON &gt; "+jsonNode.toString()); return ok(jsonNode); } Action route: GET /persons controllers.Application.getJsonPersons() Resulting JSON returned by the controller method: [{},{},{},{},{}]
favorite count: 0
has title: Why does play.libs.Json.toJson return an empty object?
upvote count: 7
type: AnsweredQuestion
tagged with: playframework-2.3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/42889082
tagged with: playframework
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27203477

http://stackoverflow.com/comment/42827447
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27167893
has text: XNOR would be this `~(element ^ set[i]);` but now the `~` is after the loop.

http://stackoverflow.com/a/27211331
answers question: http://stackoverflow.com/q/27211191
has body: Here is how I would solve this problem: areaBox.addFocusListener(generateFocusListener("Area", "Enter Area Name ")); cityBox.addFocusListener(generateFocusListener("City", "Enter City Name ")); FocusListener generateFocusListener(final String title, final String text) { return new FocusListener(){ @Override @Deprecated public void onFocus(Widget widget) { // initial focus happens here TextBox box = (TextBox) widget; box.setTitle(title); } @Override public void onLostFocus(Widget widget) { // Focus is lost for the first time TextBox box = (TextBox) widget; if(box.getText().length() &gt;= 4 ) { box.setStyleName("gwt-TextBox-Success"); // Change focus listener so that now once pressed it resets box.addFocusListener(new FocusListener(){ @Override @Deprecated public void onFocus(Widget widget) { TextBox box = (TextBox) widget; box.setText(null); box.setStyleName("gwt-TextBox-AE"); } @Override @Deprecated public void onLostFocus(Widget widget) { TextBox box = (TextBox) widget; if(box.getText().length() &gt;= 4 ) { box.setStyleName("gwt-TextBox-Success"); } else { box.setStyleName("gwt-TextBox-Error"); box.setText(text); } } }); } else { box.setStyleName("gwt-TextBox-Error"); box.setText(text); } } }; }
has comment: http://stackoverflow.com/comment/42910700
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42910407
type: Answer
accepted answer of: http://stackoverflow.com/q/27211191

http://stackoverflow.com/comment/43051298
type: QuestionComment
has text: Can you update to show what you are doing with the URL?
comment on: http://stackoverflow.com/q/27291272
score: 0
type: Comment

http://stackoverflow.com/a/27211067
has comment: http://stackoverflow.com/comment/42903826
has comment: http://stackoverflow.com/comment/42904433
answers question: http://stackoverflow.com/q/27210275
has comment: http://stackoverflow.com/comment/42904026
type: Answer
has comment: http://stackoverflow.com/comment/42904312
score: 0
has body: Since T doesn't exist at runtime, which you know, you can't use it. You also can't get a Class&lt;List&lt;T&gt;&gt;. myClass.getType().cast(myClass.getItem()) doesn't really work for you because if you have a MyClass&lt;?&gt; then you also have a Class&lt;?&gt; which only returns Object. A Class&lt;T&gt; doesn't really help you either, because you need to actually know what T is. You can pretty much do two things. Use decisions: if(myClass.getType() == String.class) { @SuppressWarnings("unchecked") final MyClass&lt;String&gt; myStrings = (MyClass&lt;String&gt;)myClass; // use MyClass&lt;String&gt; ... } Use polymorphism: MyClass&lt;String&gt; myClass = new MyClass&lt;String&gt;(..., new BiConsumer&lt;String, JTable&gt;() { // (or lambda ...) @Override public void accept(String s, JTable table) { // use String ... // configure JTable ... } }); ... elsewhere ... public void someMethod(MyClass&lt;?&gt; myClass) { someCaptureMethod(myClass); } private &lt;T&gt; void someCaptureMethod(MyClass&lt;T&gt; myClass) { Consumer&lt;T, JTable&gt; consumer = myClass.getConsumer(); for(T theT : myClass.getList()) { consumer.accept(theT, myTable); } } Generally the second example is considered the "better" way but the code might be longer in versions of Java prior to 8.
has comment: http://stackoverflow.com/comment/42904090

http://stackoverflow.com/comment/43041126
type: Comment
has text: @sjoy, how can I make it iterate through root?
type: QuestionComment
comment on: http://stackoverflow.com/q/27275169
score: 0

http://stackoverflow.com/a/27219750
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27219639
has body: Don't invoke setPreferredSize(). You should override the getPreferredSize() method of your class to do the size calculation. So basically the zoom logic should be defined in that method. Then in the zoom(..) method you invoke: revalidate(); repaint(); The zoom() method should be part of the panel that paints the image since the zoom factor is a property of this panel. This will cause the layout manager to be invoked and your new preferred size will be used in the layout of the component. Also, you should be overriding the paintComponent(...) method, not the paint(...) method to draw the image.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27219639

http://stackoverflow.com/q/27223963
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42926147
score: 0
has title: Confusing java.lang.NoSuchMethodError
has answer: http://stackoverflow.com/a/27224647
accepted answer: http://stackoverflow.com/a/27224647
tagged with: nosuchmethoderror
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
has body: I am working on a Java EE application, which runs on a WAS application server. I am also using Hibernate. JRE version 7 Here is the error I am getting: [12/1/14 9:04:37:199 SAST] 00000155 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause /operations/enrollstudents.jsp: com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.NoSuchMethodError: com/ictworx/json/JsonHelper.getJson&amp;#40;Ljava/util/List&amp;#59;[Ljava/lang/String&amp;#59;&amp;#41;Ljava/lang/String&amp;#59; at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695) at com.ibm._jsp._enrollstudents._jspService(_enrollstudents.java:187) In the last line of code above, what do the underscores mean? Where do they come from. If I click on _enrollstudents.java:187, it says "Source not found for com.ibm._jsp._enrollstudents" Which kinda makes sense since my enrollstudents.jsp page is not in the com.ibm package. Why would it think it is there? So based on what I have found so far it looks like this should have been caused because the arguments I am sending do not match the parameters of the method I am calling. However I triple checked and they do. I am sending a java.util.List and then 2 strings. And my method's parameters are a Collection, and then a vararg of String. Here is the method in the JsonHelper class: public static String getJson(Collection&lt;?&gt; objects, String ...fields) { //actual method implementation here, which has always worked. } And here is the relevant code on the page that calls the method: &lt;%@page import="com.companyname.json.JsonHelper"%&gt; &lt;% //irrelevant stuff here query = sess.createQuery("FROM JobLevel WHERE active = :active ORDER BY lower(jobLevel) ASC"); query.setBoolean("active", true); List&lt;JobLevel&gt; job_levels = (List&lt;JobLevel&gt;) query.list(); %&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;!--irrelevant stuff here--&gt; &lt;script type="t…

http://stackoverflow.com/q/27273865
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27274048
upvote count: 3
tagged with: java
downvote count: 3
tagged with: mysql
has comment: http://stackoverflow.com/comment/43017415
type: Question
answer count: 2
tagged with: jsp
score: 0
tagged with: password-encryption
has answer: http://stackoverflow.com/a/27274048
favorite count: 0
possible better answer: http://stackoverflow.com/a/27274290
has comment: http://stackoverflow.com/comment/43021251
has comment: http://stackoverflow.com/comment/43017154
has answer: http://stackoverflow.com/a/27274290
tagged with: encryption
has body: I have made a login page in jsp. The username and the password are stored in mysql. I want some suggestion for encrypt the password, and later decrypt the password(to verify if what is in password label equal with what is in database for that username).
has comment: http://stackoverflow.com/comment/43018473
has title: How to store a password?

http://stackoverflow.com/q/27181552
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: libgdx
answer count: 2
has body: In libgdx I want to move actor out of stage using movetoaction.setposition() but even when i setX coodinate to negative integer it still stops at x0. Here is snipet: move = new MoveToAction(); move.setPosition(-10, e[i].getY()); move.setDuration(5); e[i].addAction(move); stage.addActor(e[i]);
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/27182420
has title: LIBGDX MoveToAction.setPosition() to negative coordinates to move actor out of stage
has answer: http://stackoverflow.com/a/27182420
tagged with: android
has answer: http://stackoverflow.com/a/27181814
accepted answer: http://stackoverflow.com/a/27181814

http://stackoverflow.com/comment/42861788
comment on: http://stackoverflow.com/a/27186260
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your reply. But I think I did not understand your answer. The product.setProdId() method takes an argument of type Integer. But in your solution, you are passing pId, which is of type ProductId, into the setProdId(). The compiler gives an error.

http://stackoverflow.com/a/27275324
has body: Why not just add a boolean ignoreCase in the method params? Or you could make an overloaded method. public int[] count(String[] searchFor, String fileName, boolean ignoreCase) {}
has comment: http://stackoverflow.com/comment/43020154
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27275147
type: Answer
has comment: http://stackoverflow.com/comment/43020285

http://stackoverflow.com/q/27292624
has comment: http://stackoverflow.com/comment/43051115
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43050932
tagged with: ejb
tagged with: session
has comment: http://stackoverflow.com/comment/43051262
tagged with: stateless-session-bean
has answer: http://stackoverflow.com/a/27296831
has comment: http://stackoverflow.com/comment/43050832
tagged with: jpa
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43051209
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43051334
has comment: http://stackoverflow.com/comment/43053060
has body: I am trying to store an entity object to the db. But my problem is when entity object is getting persisted, it throws a null pointer exception. Below is my entity class @Entity @Table(name = "BOOK") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Book.findAll", query = "SELECT b FROM Book b"), @NamedQuery(name = "Book.findByBookid", query = "SELECT b FROM Book b WHERE b.bookid = :bookid"), @NamedQuery(name = "Book.findByBookname", query = "SELECT b FROM Book b WHERE b.bookname = :bookname"), @NamedQuery(name = "Book.findByBookdesc", query = "SELECT b FROM Book b WHERE b.bookdesc = :bookdesc"), @NamedQuery(name = "Book.findByBookprice", query = "SELECT b FROM Book b WHERE b.bookprice = :bookprice"), }) public class Book implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Size(min = 1, max = 5) @Column(name = "BOOKID") private String bookid; @Basic(optional = false) @NotNull @Size(min = 1, max = 200) @Column(name = "BOOKNAME") private String bookname; @Basic(optional = false) @NotNull @Size(min = 1, max = 200) @Column(name = "BOOKDESC") private String bookdesc; @Basic(optional = false) @NotNull @Size(min = 1, max = 200) @Column(name = "BOOKPRICE") private String bookprice; ...rest of the methods In the below code it commits to do the transaction but then it throws the null pointer exception error. @Stateless public class BookFacade extends AbstractFacade&lt;Book&gt; implements BookFacadeLocal { @PersistenceContext(unitName = "BookStore-ejbPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public BookFacade() { super(Book.class); } @Override public void create(Book book) { em.getTransaction().begin(); em.persist(book); em.getTransaction().commit(); } } Below is a screen shot of the null pointer error am getting. (Glass fish log) As you can see in the above image, when the create method is called the null ponter exception is thrown. I guess the exception is …
has comment: http://stackoverflow.com/comment/43050693
linked to: http://stackoverflow.com/q/4708035
has comment: http://stackoverflow.com/comment/43051386
score: 1
has title: Null Pointer exception when entity object is getting Persisted
tagged with: java

http://stackoverflow.com/a/27266168
has comment: http://stackoverflow.com/comment/43011724
type: Answer
has comment: http://stackoverflow.com/comment/43011363
answers question: http://stackoverflow.com/q/27248993
downvote count: 1
has body: Ok, one could complain about the question being too broad formulated but providing one possible answer would also be nice ;) So here is my suggestion: Simply create a clean API for the communication between the modules and deploy it as a JAR to your server. The module that contains the JAX-RS endpoint could also implement the API to provide the services you need (not only for internal usage but also for your REST service which then would simply delegate the request processing). Now you can simply inject a service using CDI when you need it for internal usage and as far as I know this is the fastest possible way to go for internal communication since it works directly with JAVA objects. Using CDI for the injection of the service implementation has also the benefit of decoupling the modules. I hope this helps ;)
score: -1
has comment: http://stackoverflow.com/comment/43014532
has comment: http://stackoverflow.com/comment/43014251
upvote count: 0

http://stackoverflow.com/a/27193740
has comment: http://stackoverflow.com/comment/42873803
has body: Since you are working with a single frame and a single button, I would suggest to set the following line: frame.getRootPane().setDefaultButton(submitButton); You can set a default button on each frame you control, the button you set in this method, will automatically listen to enter and invoke your actionPerformed. You can also use a KeyListener and extend the functionality for your button in this case or in future exercises or projects. Hope it helps. All the best... and happy coding :)
type: Answer
answers question: http://stackoverflow.com/q/27193179
has comment: http://stackoverflow.com/comment/42873086
has comment: http://stackoverflow.com/comment/42873112
has comment: http://stackoverflow.com/comment/42873320
has comment: http://stackoverflow.com/comment/42873154
score: 0
has comment: http://stackoverflow.com/comment/42873244

http://stackoverflow.com/a/27310660
accepted answer of: http://stackoverflow.com/q/27309773
answers question: http://stackoverflow.com/q/27309773
has body: There is no technical limit to the size of a HTTP body. In the link you refer to it seems a limit imposed by a specific object that parses the HTTP because the object uses an int for the size, this is of course possible but not related to the HTTP protocol. In HTTP you always have to give a content-length to the other side (is both for request &amp; response), if your response is really large, it is up to the client to process it in an acceptable way (e.g. stream it directly to a file backend). Chunking is nice but it is only meant for when you (the one sending the large response) don't know the actual total size of your response until you have streamed it. If you know the size beforehand, use the content-length header.
type: AcceptedAnswer
downvote count: 0
score: 39
upvote count: 39
type: Answer

http://stackoverflow.com/comment/43448587
type: AnswerComment
has text: Now happened to me! But it seems you are already on the track :) http://mail-archives.apache.org/mod_mbox/nutch-user/201412.mbox/%3CDUB402-EAS423DA6DFA62509BAE15713A926E0@phx.gbl%3E . Now I am looking forward the solution too :P
comment on: http://stackoverflow.com/a/27177490
type: Comment
score: 0

http://stackoverflow.com/a/27230755
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27230639
score: 1
downvote count: 0
has body: You have to specify named LITERALS for enums. What you can do is public enum Pitch { SOMENAME(60), SOMEOTHERNAME(62), // ... SOMELASTNAME(74); public final int value; public Pitch(int val) { this.value = val; } } Then you can access your specific values by name and you can write Pitch pitch = ...; int pitchInt = pitch.value; to work with the values.

http://stackoverflow.com/comment/43003750
has text: @DarshanLila I am sure data has been committed, because I can see records changed using mysql-client.
comment on: http://stackoverflow.com/q/27266175
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135085178
type: Comment
comment on: http://stackoverflow.com/a/37351767
has text: The link doesn't work and this solution doesn't seem to do anything, why is it marked as the answer? I changed my 'RealmObject' to a 'RealmModel' and it still complains that it's not parcelable.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43200755
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27305323
type: Comment
has text: Thanks for the reply. I did not mention it but I use session beans and not a web app. And the question was how to access the config properties and not the resource adapter.

http://stackoverflow.com/a/44653140
upvote count: 3
answers question: http://stackoverflow.com/q/27241323
has comment: http://stackoverflow.com/comment/80817064
downvote count: 0
has body: This is will be even easier in 4.5.5 1- Modify AuthoritiesConstants.java 2- Add new role in authorities.csv file re-Run the application, the new role should appear in the interface (Administration/user management/create a new user) (maybe it can be useful to delete target\h2db\db content in your app)
type: Answer
score: 3

http://stackoverflow.com/comment/72535844
comment on: http://stackoverflow.com/a/27260975
type: Comment
score: 0
type: AnswerComment
has text: Where is the "Secret Passphrase" supposed to come from? It's not secret if it's in the js

http://stackoverflow.com/a/27165954
has comment: http://stackoverflow.com/comment/42825569
has comment: http://stackoverflow.com/comment/42824180
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42825442
accepted answer of: http://stackoverflow.com/q/27165693
has comment: http://stackoverflow.com/comment/42824986
type: Answer
answers question: http://stackoverflow.com/q/27165693
score: 3
upvote count: 3
has body: There is no constructor in this class that takes a java.util.List as a parameter. Please refer to the Javadoc. You may want to work with itext's List directly: com.itextpdf.text.List a = new com.itextpdf.text.List(); a.add("10"); a.add("20"); If working with an existing java.util.List you will have to iterate over the items to add them: com.itextpdf.txt.List a = new com.itextpdf.text.List(); List&lt;Integer&gt; integersList = getListFromDb(); for(Integer item : integersList) { a.add(item.toString()); }
has comment: http://stackoverflow.com/comment/42886763
has comment: http://stackoverflow.com/comment/42825656
has comment: http://stackoverflow.com/comment/42824076

http://stackoverflow.com/comment/42961011
type: QuestionComment
comment on: http://stackoverflow.com/q/27242325
has text: @MadProgrammer,i am sorry,i am just a beginer:(,thanks for you comment!i just can not understand how the exceptions happen.....
score: 0
type: Comment

http://stackoverflow.com/comment/43068435
type: Comment
has text: Hi OnlineCop, Thanks a lot for your regex. I was trying for multiple strings and when I tried for the string - "exception is java.net.UnknownHostException: foo.page.com" it matched java.net but not foo.page.java. Can you please suggest a modification on this regex. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27302227

http://stackoverflow.com/a/58985404
answers question: http://stackoverflow.com/q/27204653
has body: You may combine underscore-java and snakeyaml libraries. Steps: Read xml file to map. Generate yml file from map. import com.github.underscore.lodash.Xml; import java.io.StringWriter; import org.yaml.snakeyaml.Yaml; Object result = Xml.fromXml(xml); Yaml yaml = new Yaml(); StringWriter stringWriter = new StringWriter(); yaml.dump(result, stringWriter); String yaml = stringWriter.toString();
type: Answer
score: 0

http://stackoverflow.com/comment/42901443
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27204818
type: Comment
has text: check this full [dependency](https://github.com/rstoyanchev/spring-websocket-portfolio/blob/master/pom.xml#L139-L150)

http://stackoverflow.com/comment/42998659
score: 0
type: Comment
type: QuestionComment
has text: @theGreenCabbage Downvotes will probably continue to roll in the longer OP refuses to reply to requests for more info.
comment on: http://stackoverflow.com/q/27262977

http://stackoverflow.com/a/27178264
type: Answer
has body: try{ BufferedReader br = new BufferedReader(new FileReader(new File("2of12inf.txt"))); String line; while ((line = br.readLine()) != null) { // process the line. int lineLength = line.length(); // assuming each line contains one word, do whatever you want to with this length } } catch (Exception e) { System.out.println("Exception caught! Should handle it accordingly: " + e); } finally { be.close(); }
has comment: http://stackoverflow.com/comment/42845522
has comment: http://stackoverflow.com/comment/42846911
answers question: http://stackoverflow.com/q/27177893
has comment: http://stackoverflow.com/comment/42845880
score: 0

http://stackoverflow.com/comment/42905602
comment on: http://stackoverflow.com/a/27212420
type: AnswerComment
has text: I can't use such methods, maybe I should add it to my question sorry
score: 0
type: Comment

http://stackoverflow.com/a/27233797
type: Answer
accepted answer of: http://stackoverflow.com/q/27209577
score: 0
answers question: http://stackoverflow.com/q/27209577
type: AcceptedAnswer
has body: I was able to answer this question with the help of the Groovy-dev list. In short, they are there because there are other use cases for which they are needed, but they are not needed in this case, and the effort to remove them in the static case is prohibitive. The exact answer ( thanks to Cedric Champeau on groovy-dev ) was: ​Now the answer is pretty simple: this is an artifact of the common infrastructure we have for both dynamic and static bytecode. Even if the code you see is suboptimal, it's not wrong at all. In Groovy, every expression has a return value so we need a local variable (slot 4 here) to store it. The fact that this return value is not used is something which is not analyzed by the compiler (in both dynamic and static mode), so it can't be optimized not to use a local variable. Making it so would be better because it would reduce the size of the bytecode and make it look more Java-like, hence making it more likely to be JIT'ed (both because the size of the bytecode is reduced and because it can look closer to patterns recognized by the JIT), but it is hard work to do so.

http://stackoverflow.com/a/27316410
type: AcceptedAnswer
score: 1
accepted answer of: http://stackoverflow.com/q/27290972
type: Answer
upvote count: 1
has body: RoadManager is part of OSMBonusPack. First of all, you should follow OSMBonusPack HowToInstall guide. And then follow OSMBonusPack tutorial.
downvote count: 0
answers question: http://stackoverflow.com/q/27290972

http://stackoverflow.com/comment/42821869
type: QuestionComment
has text: @VinceEmigh This is line 29: public static CredentialEditor promptPossibleDialog(boolean reset)
comment on: http://stackoverflow.com/q/27164453
score: 0
type: Comment

http://stackoverflow.com/comment/43003857
has text: Based on info available I suggest you to debug your code and try various examinations. See if you can find something that might be causing the problem.
score: 0
comment on: http://stackoverflow.com/q/27266175
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27260704
has comment: http://stackoverflow.com/comment/42994612
has comment: http://stackoverflow.com/comment/42994600
type: UnansweredQuestion
has body: I'm working on an assignment where I have to have an option to ask the user if they want to convert from any base to any other base. Here is the main the instructor gave us: import java.util.*; public class CSCD210Lab21 { public static void main(String [] args) { Scanner kb = new Scanner(System.in); int choice; do { choice = Lab21Methods.menu(kb); switch(choice) { case 1: Lab21Methods.convert(kb, 10, 2, '0', '1'); break; case 2: Lab21Methods.convert(kb, 10, 8, '0', '1', '2', '3', '4', '5', '6', '7'); break; case 3: Lab21Methods.convert(kb, 10, 16, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); break; case 4: int fromBase = Lab21Methods.readBase(kb, "from"); char [] fromBaseValues = Lab21Methods.readBaseValues(kb, fromBase); int toBase = Lab21Methods.readBase(kb, "to"); char [] toBaseValues = Lab21Methods.readBaseValues(kb, toBase); Lab21Methods.convert(kb, fromBase, fromBaseValues, toBase, toBaseValues); break; default: System.out.println("Thanks for using my silly base converter"); }// end switch }while(choice != 5); }// end main }// end class The main part I'm concerned about is in case 4 in the switch statement. Here is what I have so far: public static char [] readBaseValues(Scanner kb, int baseVal) { kb = new Scanner(System.in); System.out.print("Enter Base: "); baseVal = kb.nextInt(); kb.nextLine(); char valArray[] = new char[baseVal]; for(int i=0; i &lt; valArray.length; i++) { System.out.print("Enter Base Value: "); valArray[i] = kb.nextLine().charAt(0); } System.out.print(valArray); return valArray; } public static int readBase(Scanner kb, String type) { System.out.println(); System.out.print("Enter Base To Convert "+type+" : "); int num = kb.nextInt(); return num; } I've got no idea how to proceed to convert say a base 10 to a base 2 without using ParseInt. He says if we use ParseInt, we get 0 points. How else do I proceed?
has comment: http://stackoverflow.com/comment/42994731
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27260954
answer count: 2
has title: Convert from One Base to Another in Java without ParseInt
has comment: http://stackoverflow.com/comment/42994950
score: 0
has comment: http://stackoverflow.com/comment/42994579
has answer: http://stackoverflow.com/a/27260817

http://stackoverflow.com/a/27210292
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/42902402
has comment: http://stackoverflow.com/comment/42902708
has comment: http://stackoverflow.com/comment/42902573
has comment: http://stackoverflow.com/comment/46041606
answers question: http://stackoverflow.com/q/27210280
has comment: http://stackoverflow.com/comment/42902744
has comment: http://stackoverflow.com/comment/42902401
has body: When you say new String() you get a new Object reference so consider String a = "text"; String b = new String("text"); System.out.println(a == b); b = b.intern(); System.out.println(a == b); Then first a == b will display false because they are different references. If we intern() b by saying b = b.intern() we can then test again and get true. I hope that helps. The above code has worked the same way in Java since version 1.0 (and it still works this way in Java 8 today).
has comment: http://stackoverflow.com/comment/61522819
has comment: http://stackoverflow.com/comment/42902561
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/42907927

http://stackoverflow.com/comment/42827237
type: Comment
has text: @hacks4life Could you please look into the tutorial I have mentioned. I have made an edit to the answer
comment on: http://stackoverflow.com/a/27167812
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43023696
type: AnswerComment
comment on: http://stackoverflow.com/a/27275763
type: Comment
has text: Thanks for the reply. Why is BufferStrategy is not necessary? I have moving pictures in the program other than jpanel. According to link you have given : `paint() invokes paintComponent(). If ui is non-null, paintComponent() invokes ui.update(). If the component's opaque is true, ui.update() fills the component's background and invokes ui.paint(). ui.paint() renders the content of the component.` I did `panel.setOpaque(false)` I've overridden update methods of frame and panel(to do nothing) but some gray(neither panel's nor frame's background Color) background clears other objects
score: 0

http://stackoverflow.com/comment/42998127
has text: Show us the exception stack trace.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27262602
score: 2

http://stackoverflow.com/comment/42957128
score: 2
has text: What error? All you have here are two lines of incomplete code.
comment on: http://stackoverflow.com/q/27240312
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27239533
has comment: http://stackoverflow.com/comment/42955686
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27239639
tagged with: inheritance
tagged with: symbols
has title: Cannot find symbol when creating an object in IO class using inheritance
has answer: http://stackoverflow.com/a/27239639
type: AnsweredQuestion
type: Question
has body: I'm trying to create a tourist object on my IO class and the parameters are specified correctly in its respective class. However, it wouldn't compile as it says it cannot find symbol. Is it because I'm using tourist as a sub-classes? The compiler says that it cannot find symbol for variable "nam" etc.. Thanks for helping. This is a method in my IO class.. private void addMemberCard() { System.out.println("Enter Member name"); String name = reader.nextLine(); System.out.println("Select 1. Tourist, 2. Business"); System.out.println("Enter your choice"); int choice = reader.nextInt(); MemberCard m; if (choice == 1){m = new Tourist (nam, rat, cred, cit);} else if (choice == 2){m = new Business(nam, rat);} preston.addMemberCard(m); } and this is my constructor in Tourist Class public Tourist (String nam, int rat, int cred, String cit) { super(nam, rat, cred); city = cit; }
tagged with: java

http://stackoverflow.com/comment/43048210
type: Comment
has text: see http://stackoverflow.com/questions/4801366/convert-rgb-values-into-integer-pixel
score: 0
comment on: http://stackoverflow.com/q/27290729
type: QuestionComment

http://stackoverflow.com/comment/103498295
type: AnswerComment
comment on: http://stackoverflow.com/a/27210618
type: Comment
score: 1
has text: Probably a bit late to mention this but large portions of your answer have nothing to do with the question (JDBC etc.). I think it would be much more readable and useful if you only answered the specific question and added a link to the [java-time tag](https://stackoverflow.com/tags/java-time/info), where you could include all that useful (but unrelated to the question) information. In other words, the first version of your answer is IMHO better than the current one.

http://stackoverflow.com/q/27288579
has title: How to get singleton instance from a class name as string
has comment: http://stackoverflow.com/comment/43043870
has comment: http://stackoverflow.com/comment/43043824
tagged with: design-patterns
type: AnsweredQuestion
downvote count: 0
tagged with: reflection
has comment: http://stackoverflow.com/comment/43043891
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43044002
type: Question
has answer: http://stackoverflow.com/a/27449511
answer count: 2
has comment: http://stackoverflow.com/comment/43043947
accepted answer: http://stackoverflow.com/a/27288997
tagged with: singleton
upvote count: 1
has comment: http://stackoverflow.com/comment/43043784
has comment: http://stackoverflow.com/comment/43043752
has body: I am running into a strange problem. I have an interface, whose implementations tend to be stateless. So, I want them to be singletons. I get the implementation class names as strings. For example String clazz = "com.foo.Bar"; I have a rules factory to obtain instances of IRule implementations. public class RulesFactory { private static final Logger logger = LoggerFactory.getLogger(RulesFactory.class); @SuppressWarnings("unchecked") public static &lt;T extends IRule&gt; T getRuleInstance(String clazz) { try { Class&lt;?&gt; ruleObject = Class.forName(clazz); Method factoryMethod = ruleObject.getMethod("getInstance"); return (T) factoryMethod.invoke(null); } catch (ClassNotFoundException e) { logger.error("ClassNotFoundException", e); } catch (IllegalAccessException e) { logger.error("IllegalAccessException", e); } catch (SecurityException e) { logger.error("SecurityException", e); } catch (NoSuchMethodException e) { logger.error("NoSuchMethodException", e); } catch (IllegalArgumentException e) { logger.error("IllegalArgumentException", e); } catch (InvocationTargetException e) { logger.error("InvocationTargetException", e); } return null; } } The above code throws NullPointerException if the class doesn't have a static getInstance() method. In Java 6 i can't use static methods in interfaces. I don't want to create multiple instances of IRule implementations. If I can enforce a static method and invoke that static method I will get the cashed instance. But I am unable to do this. How to solve this problem?
has answer: http://stackoverflow.com/a/27288997
favorite count: 0
possible better answer: http://stackoverflow.com/a/27449511

http://stackoverflow.com/q/27274935
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27275110
has body: I would like please to call onTouch() method which is in different class than the method onOptionsItemSelected() I want to call from, here's the code: public boolean onTouch(View v, MotionEvent event) { float downx = 0, downy = 0, upx = 0, upy = 0; int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: downx = event.getX(); downy = event.getY(); break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: upx = event.getX(); upy = event.getY(); mCanvas.drawLine(downx, downy, upx, upy, mPaint); invalidate(); break; case MotionEvent.ACTION_CANCEL: break; default: break; } return true; } The method that I wanted to call onTouch() from: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.LINE_ID: //i want to call it here return true; onOptionsItemSelected() is in MainClass but onTouch() is in a subclass of MainClass. How i can do that? how i can call drawLine()? UPDATE: I tried : View v = null; MotionEvent event = null; MyView sub_class = new MyView(getBaseContext()); sub_class.onTouch(v, event); but it's crashed! Any Help please! I think this is very easy for some ppl.. They don't care :(
has answer: http://stackoverflow.com/a/27275441
answer count: 2
has title: How to call onTouch() method
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 2

http://stackoverflow.com/comment/42910128
comment on: http://stackoverflow.com/a/27213169
score: 0
type: AnswerComment
type: Comment
has text: Thanks, but I get an error. actual argument List<String> cannot be converted to ArrayList<String> byt method invocation conversion.. This is what confuses me. I don't understand how I can create a contructor with One item (string) or more than one (arrayList).. and how would I pass these through to a constructor without receiving errors

http://stackoverflow.com/comment/43012063
score: 0
has text: yes `com.vaadin.ui.TreeTable` is available in vaadin 6.7.7 (found it via `vaadin.com/api` then select your desired version). Did you include the proper jar files. Is it a maven project? Can you show more information about your setup?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27269732

http://stackoverflow.com/a/27283624
upvote count: 3
downvote count: 0
has body: When you call collection.contains(element) often for a large collection, you should not use an ArrayList, but rather a HashSet. Set&lt;String&gt; filter = new HashSet&lt;&gt;(); Collections.addAll(filter, voc.split(System.getProperty("line.separator"))); A HashSet is an optimized data structure for looking up things.
type: Answer
answers question: http://stackoverflow.com/q/27283458
score: 3

http://stackoverflow.com/q/27199573
has comment: http://stackoverflow.com/comment/42883435
has answer: http://stackoverflow.com/a/27205002
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43709022
has title: Trying to import a android project into Android studio error
score: 0
has body: I am new to android studio and tried to import a project which someone else had made into it .The project has google play services jar file in its libs folder.I got the following error while importing: Why does this error occour and how do i fix it?Will it be shown for other library files also?
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27200619

http://stackoverflow.com/a/27275056
answers question: http://stackoverflow.com/q/27273328
has body: You can use nested classes to simulate anonymous classes, but in order to use nested classes in the same way as Java you will need to pass a reference to the outer class. In Java all nested and anonymous classes have this by default, and only static ones do not. interface IMyInterface { void Foo(); } class MyClass { public void Bar() { IMyInterface obj = new AnonymousAnalog(this); obj.Foo(); } private class AnonymousAnalog : IMyInterface { public void Foo(MyClass outerThis) { outerThis.privateFieldOnOuter; outerThis.PrivateMethodOnOuter(); } } ... }
score: 2
has comment: http://stackoverflow.com/comment/80850459
has comment: http://stackoverflow.com/comment/90716606
type: Answer
upvote count: 3
downvote count: 1

http://stackoverflow.com/comment/43033809
type: QuestionComment
comment on: http://stackoverflow.com/q/27282713
score: 0
has text: Well what's wrong with `System.out.println(...)`?????
type: Comment

http://stackoverflow.com/a/27205326
answers question: http://stackoverflow.com/q/27205213
score: 0
has comment: http://stackoverflow.com/comment/42893514
has body: Try using: MODE_PRIVATE In the openFileOutput() method.
type: Answer

http://stackoverflow.com/q/27207358
type: Question
score: 0
answer count: 2
has title: Error Exception in thread "main" java.util.InputMismatchException
has answer: http://stackoverflow.com/a/27207510
accepted answer: http://stackoverflow.com/a/27207510
has answer: http://stackoverflow.com/a/27207609
possible better answer: http://stackoverflow.com/a/27207609
has body: I'm trying to make an application that reads a file and writes the sum of the numbers, the average, the number of numbers in the file, but I get an error Exception in thread "main" java.util.InputMismatchException t java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextDouble(Scanner.java:2413) at TestGradesAnalysis.main(TestGradesAnalysis.java:30) Java Result: 1 Can you help me fix the error? import java.io.FileWriter; import java.io.PrintWriter; import java.util.Scanner; import java.io.FileReader; import java.io.*; public class TestGradesAnalysis { public static void main(String args[]) throws IOException { PrintWriter outFile = new PrintWriter(new FileWriter("File.dat")); double sum = 0; int count = 0; double max = 0; double min = 0; while (in.hasNextDouble()) { sum = sum + in.nextInt(); count++; if (in.nextDouble() &gt; max) { max = in.nextDouble(); } if (min &gt; in.nextDouble()) { min = in.nextDouble(); } } double average = sum / count; outFile.println("average is" + average); outFile.println("max is" + max); outFile.println("min is " + min); outFile.println("number of grades is" + count); } This is my code These are the contents of the File.dat 28 28 28 2008 510 September 89, 2116
tagged with: debugging
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42896689
tagged with: java

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/27156311

http://stackoverflow.com/q/27307138
has comment: http://stackoverflow.com/comment/43076834
tagged with: servlets
has answer: http://stackoverflow.com/a/27320043
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43079499
has answer: http://stackoverflow.com/a/27309063
type: UnansweredQuestion
has body: I have a mysql database configured with a max_connections value of 150. I also have a Java 6 web application running in Tomcat 5.5 configured with the following setup: &lt;Resource name="jdbc/myDB" type="javax.sql.DataSource" driver="com.mysql.jdbc.Driver" username="username" password="password" maxActive="100" maxIdle="100" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true" url="jdbc:mysql://localhost:3306/myDB?autoreconnect=true" validationQuery="SELECT 1" /&gt; This application is not using any 3rd party framework just basic java servlets. I have a bug in some code in the java app that is not properly releasing opened mysql connections from the pool. I am working on identifying and fixing these. But in the meantime I need to figure out why at most there is only 25 connections being allowed to mysql. After these 25 connections are used up, the application becomes unresponsive. Can someone please help me figure out why both mysql and tomcat are configured for 100+ connections but it is only allowing 25 at a time?
tagged with: database-connection
tagged with: java
tagged with: tomcat5.5
type: Question
has title: Too few connections from Tomcat Application

http://stackoverflow.com/comment/43064962
has text: possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27300502

http://stackoverflow.com/comment/42986372
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27256293
score: 0
has text: addItem(pan, mg, 3,0,1,4, GridBagConstraints.CENTER);

http://stackoverflow.com/q/27261812
has title: Datetime expression in JPA by passing as parameter
has comment: http://stackoverflow.com/comment/42996769
has body: I want to compare a datetime function in the JPA. Just wondering how to pass it. By the way I am very new to JPA. My input date will look like this 28/12/2014 16:20 and I am parsing it as date I have to pass this as a parameter but the database table (MS SQL) consists of datetime format as 2014-12-28 16:20:38.107 Here is my code. Under @Entity (I cannot edit this code since I don't have permissions to do so. Anyway other methods are accessing this entities, I am just reusing it) @Column(name = "PublishDate", nullable = false) private Date publishDate; My Actual Code Date date = simpleDateFormat.parse(s); Message.findByPublishDate(date); After running the above code with Debug=true I have seen the passed parameter in the sql query as: messages0_.PublishDate=? that means it's not even taking the date and I get the below exception select operations0_.OperationsMessageID as Operatio1_10_, operations0_.Content as Content2_10_, operations0_.CreatedDate as CreatedD3_10_, operations0_.ExpiryDate as ExpiryDa4_10_, operations0_.PublishDate as PublishD5_10_, operations0_.Status as Status6_10_, operations0_.Title as Title7_10_, operations0_.OperationsMessageTypeID as Operatio8_10_ from OperationsMessage operations0_ where operations0_.PublishDate=? Exception Details: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:172) at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:155) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:417) at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59) at o…
has comment: http://stackoverflow.com/comment/42996718
has comment: http://stackoverflow.com/comment/42996600
score: 0
has comment: http://stackoverflow.com/comment/42996653
answer count: 2
has answer: http://stackoverflow.com/a/27261938
accepted answer: http://stackoverflow.com/a/27262525
has comment: http://stackoverflow.com/comment/42996646
possible better answer: http://stackoverflow.com/a/27261938
tagged with: datetime
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42996535
type: Question
has answer: http://stackoverflow.com/a/27262525

http://stackoverflow.com/comment/43979126
comment on: http://stackoverflow.com/a/27287623
type: AnswerComment
score: 1
type: Comment
has text: just started running into this issue after upgrading Tomcat...see more here: [Bug 57099 – loose parsing of import attribute in page directive screws up SMAP output](https://issues.apache.org/bugzilla/show_bug.cgi?id=57099) (relevant to Tomcat 7.0.57 onwards or 8.0.15 onwards)

http://stackoverflow.com/a/27302462
answers question: http://stackoverflow.com/q/27301699
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43069736
upvote count: 1
has comment: http://stackoverflow.com/comment/43072795
has body: There were a few issues and unnecessary things. You were overriding setSize() of Frame, so it wasn't computing the size of the frame correctly. You don't need the ActiveFrame class, you can just set the default close operation to exit on the frame. Swing has more or less deprecated AWT, so you should extend JFrame instead of Frame. You can override the paint() method of JFrame and put your display logic in there, calling terrain.repaint() ends up calling the paint() method. You were getting a NullPointerException in your display method because the size of the buckets did not match the maxRow and maxCol you were setting, I moved that to the constructor. GoLWorldCS import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; public class GoLWorldCS extends JFrame { private static final long serialVersionUID = -2833280938880400310L; int maxRow; int maxCol; int gen; int buckets[][]; int r = 0, c = 0, l = 1; int xDist, yDist; public GoLWorldCS(int maxRow, int maxCol) { this.maxRow = maxRow; this.maxCol = maxCol; this.buckets = new int[maxRow][maxCol]; } public void clearGrid() { while (r &lt;= maxRow - 1) { c = 0; while (c &lt;= maxCol - 1) { buckets[r][c] = 0; c = c + 1; } r = r + 1; } } public void markAlive() { while (l &gt; 1) { buckets[r][c] = 1; c++; l--; } } @Override public void paint(Graphics g) { super.paint(g); r = 0; c = 0; g.setColor(Color.blue); while (r &lt;= maxRow - 1) { c = 0; while (c &lt;= maxCol - 1) { if (buckets[r][c] != 0) { g.fillOval((c) * xDist + 50, (r) * yDist + 50, xDist, yDist); System.out.println(r + " " + c); } c = c + 1; } r = r + 1; } } public void setCellSize(int width, int height) { this.xDist = width; this.yDist = height; } public void setGenerations(int gens) { this.gen = gens; } public void setCells(int R, int C, int L) { this.r = R; this.c = C; this.l = L; } public int getRow() { return maxRow; } public int getCol() { return maxCol; } public int getGenerations() { return gen; } public int getR() { return r; } public…

http://stackoverflow.com/q/27248557
has answer: http://stackoverflow.com/a/27268927
favorite count: 0
has comment: http://stackoverflow.com/comment/42974569
upvote count: 1
has comment: http://stackoverflow.com/comment/42973843
has title: EmailValidation (email address) with RFC3696
has comment: http://stackoverflow.com/comment/42971778
type: AnsweredQuestion
score: 1
has body: I look for an email validator accepted the email address in the rfc3696 standard (who accepted the accents in the email). I try ( org.apache.commons.validator.routines.EmailValidator) "commons-validator 1.4.0" but this validator does not accept accents. I want a java api to validates an email address according to standard rfc3696. Ex Valid Email address : Loïc.Accentué@voilà.fr Thanks in advance.
tagged with: java
accepted answer: http://stackoverflow.com/a/27268927
tagged with: email-validation
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42974556
tagged with: email

http://stackoverflow.com/a/27190354
answers question: http://stackoverflow.com/q/27158389
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42873374
has comment: http://stackoverflow.com/comment/42873239
accepted answer of: http://stackoverflow.com/q/27158389
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42877632
has comment: http://stackoverflow.com/comment/42875032
type: Answer
has body: Raspberry Pi and OrientDB ... could not resist trying it out :) For your information: Using Raspberry Pi model B (512MB) Using Raspbian 7.6 (with latest patches as of 2014-11-28) Using Oracle Java 8 SE for ARM update 6 (so not the version from the Raspbian repo!) Using OrientDB 2.0-M3 Set MAXHEAP=-Xmx128m in server.sh With this configuration i am able to create / query / modify a database via HTTP without problems. OrientDB complains about the shortage of memory, but that is all: WARNING No enough physical memory available: 437MB (heap=123MB). Set lower Heap and restart OrientDB. Now running with DISKCACHE=64MB

http://stackoverflow.com/a/27174706
type: AcceptedAnswer
has body: You cant run network on UI thread , and i think you need while(1) when accept , try this : new Thread(new Runnable() { public void run() { try { Socket client = server.accept(); } catch (IOException e) { e.printStackTrace(); } } }).start();
has comment: http://stackoverflow.com/comment/42850680
type: Answer
accepted answer of: http://stackoverflow.com/q/27174556
answers question: http://stackoverflow.com/q/27174556
score: 0

http://stackoverflow.com/a/27245498
has comment: http://stackoverflow.com/comment/42974427
has comment: http://stackoverflow.com/comment/42975398
has comment: http://stackoverflow.com/comment/42971654
downvote count: 0
has comment: http://stackoverflow.com/comment/42971534
has comment: http://stackoverflow.com/comment/42974265
score: 1
has comment: http://stackoverflow.com/comment/42971339
has body: Theoretically accuracy depend on: 1) how frequently you ask for getCurrentPosition(). In some cases I use 100 ms interval. 2) which media format do you use 3) and most critical depend on implementation. Part of HW and SW related to multimedia vary from device to device and depend on device manufacturer, HW chips and OS version. I suggest you to try query current position more frequently. And probably different media files. Possible solution: You can use software implementation of media player (ex: FFMpeg can be compiled for Android). Negative side of this is CPU usage, battery drain and video decoding speed. Some devices cannot handle (too low fps) huge high quality video by without HW acceleration which is provided only by standard MediaPlayer API.
has comment: http://stackoverflow.com/comment/42971504
upvote count: 1
has comment: http://stackoverflow.com/comment/42971632
answers question: http://stackoverflow.com/q/27172472
type: Answer

http://stackoverflow.com/comment/42842636
has text: @nikpon If you look at the source of `toString()` in `Object`, you'll find this: `getClass().getName() + "@" + Integer.toHexString(hashCode())`. Arrays don't override this behavior, so it's what you see when you print an array.
type: Comment
comment on: http://stackoverflow.com/a/27176323
score: 0
type: AnswerComment

http://stackoverflow.com/q/27196153
downvote count: 0
has body: This was originally a part 2 of a different thread, but another use suggested that I separate the part 2 into it's own topic, so here we go. Original thread is here (Original Thread) I am using Jackcess to create a V2010 mdb file that I need to transfer to a client that will use Access 2013 to open it. Jackcess itself works - V2010 creates a file that Access 2013 can open when the file is FTP'd to the client by a third party software, such as FAR. However, when I try to upload this file to the client through the servlet (as is the goal of this project), Access on the client says "Unrecognized database format "...file name...". This is the code used for upload. Code itself works, file is transferred, has a non-zero size if it's saved - but Access cannot open it. Note, for content type I also tried vnd.msassess and octed-stream, with same unsuccessful results. Also, I tried closing the db and creating the FileInputStream from the file name, and, as in the example, tried to create FileInputStream by calling mydb.getFile(). No difference. response.setContentType("application/vnd.ms-access"); String fileName = "SomeFileName.mdb"; response.setHeader("Content-Disposition", "attachment; filename="+fileName); Database mydb = generateMDBFile(); FileInputStream fis = new FileInputStream(mydb.getFile()); OutputStream os = response.getOutputStream(); byte[] buffer = new byte[1024]; try { int byteRead = 0; while ((byteRead = fis.read()) != -1) { os.write(buffer, 0, byteRead); } os.flush(); } catch (Exception excp) { excp.printStackTrace(); } finally { os.close(); fis.close(); } Why does this code corrupt the mdb file? This happens every time, regardless of the size (I tried a tiny 2 column/1 row file, and a huge file with 40 columns and 80000 rows) Thank you!
tagged with: outputstream
score: 1
tagged with: corrupt
favorite count: 0
tagged with: jackcess
type: AnsweredQuestion
has title: Access (.mdb) file corrupted during servlet write to the client
tagged with: java
has answer: http://stackoverflow.com/a/27196237
upvote count: 1
has comment: http://stackoverflow.com/comment/42877383
linked to: http://stackoverflow.com/q/27137399
type: Question
tagged with: servlets
accepted answer: http://stackoverflow.com/a/27196237
answer count: 1

http://stackoverflow.com/comment/42975799
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27250720
has text: try using java.sql.Date please and lemme know if it helped

http://stackoverflow.com/comment/42972231
has text: You just need some boilerplate `pom.xml`, taken from the JMH homepage.
type: Comment
comment on: http://stackoverflow.com/a/27248966
type: AnswerComment
score: 0

http://stackoverflow.com/q/27255892
has answer: http://stackoverflow.com/a/27500949
has comment: http://stackoverflow.com/comment/42985962
score: 0
has comment: http://stackoverflow.com/comment/42986243
answer count: 2
has title: running a desktop application from another java application
has comment: http://stackoverflow.com/comment/42986410
accepted answer: http://stackoverflow.com/a/27500949
type: AnsweredQuestion
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/77927553
has body: With the help of Netbeans, I made a Java desktop application. I just made another class in that package where I just added a button. I meant it for the purpose of running Java desktop application which I made earlier. When searched for the main method of appview.java (only this contains a main) there was code like this: public static void main(String[] args) { launch(SRECOApp.class, args); } I tried to put launch(SRECOApp.class, args); in the action listener of the button, but it didn't work. Please, what should I do now?
has answer: http://stackoverflow.com/a/77927553
type: Question
linked to: http://stackoverflow.com/q/20963700
linked to: http://stackoverflow.com/q/15653118
tagged with: java

http://stackoverflow.com/a/27351514
has body: You probably intended for that method named Boot to be a constructor. public void Boot should be changed to public Boot.
score: 0
answers question: http://stackoverflow.com/q/27197334
type: Answer

http://stackoverflow.com/comment/42875211
score: 0
type: QuestionComment
type: Comment
has text: Yeah Im new to coding soo... Mistakes like this happen once in a while
comment on: http://stackoverflow.com/q/27194954

http://stackoverflow.com/a/27281511
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27271886
answers question: http://stackoverflow.com/q/27271886
downvote count: 0
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/43250144
has body: Although singletons save object creation (and later garbage collection), initialization of the singleton requires synchronization; ... Now, what exactly does "initialization of the singleton" mean in this context? Is initialization done once? Everytime it is injected? Here is the implementation of the singleton scope (it is slightly different in the released version of Guice, but the following points still stand). Every time a singleton-scoped dependency is injected anywhere, the get() method on that provider will be called to get the instance. Double-checked locking is used so that after the singleton has been created for the first time, future calls to get() are cheap: they read a single volatile field and return. On the other hand, using @Singleton DAOs means you have to access the EntityManager through a Provider in every method, which involves looking up the EntityManager in a HashMap in a ThreadLocal somewhere. Conclusion: the only way to find what choice is better for performance is to benchmark both and pick the faster one. You'll probably find that both choices are fast enough, in which case you should pick the cleanest one.

http://stackoverflow.com/q/27154579
linked to: http://stackoverflow.com/q/1054984
has comment: http://stackoverflow.com/comment/42805828
linked to: http://stackoverflow.com/q/1517635
has answer: http://stackoverflow.com/a/27154717
accepted answer: http://stackoverflow.com/a/27154717
type: AnsweredQuestion
has title: how to export data from postgresql to .csv file using jdbc?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42804240
answer count: 2
has body: I want to export data in a table by date, so I write a java program using jdbc. public void exportData(Connection conn,String filename) { Statement stmt; String query; try { stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss"); Date startDate = dateFormat.parse("2014-08-21 00:00:00"); Date endDate = dateFormat.parse("2014-08-22 00:00:00"); Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(startDate); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(endDate); Calendar thisDayCalendar = startCalendar; while(!thisDayCalendar.after(endCalendar)){ Date thisDayDate = thisDayCalendar.getTime(); thisDayCalendar.add(Calendar.DATE, 1); Date nextDayDate = thisDayCalendar.getTime(); String thisDayString = dateFormat.format(thisDayDate); String nextDayString = dateFormat.format(nextDayDate); SimpleDateFormat dateFormat1 = new SimpleDateFormat ("yyyy-MM-dd"); String fileDateString = dateFormat1.format(thisDayDate); //For comma separated file query ="COPY (SELECT * FROM signals WHERE date_time &gt;= '" + thisDayString + "' AND date_time &lt; '" +nextDayString + "' ) TO " +filename + fileDateString + ".csv delimiter ','"; stmt.executeQuery(query); //System.out.println(query); } } catch(Exception e) { e.printStackTrace(); stmt = null; } } This programming is running on a server while the database is another sever, I connect to the database in this program.But when I run the program on server, I got an error that only superuser can COPY to or from a file: org.postgresql.util.PSQLException: ERROR: must be superuser to COPY to or from a file Hint: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) at org.postgresql.core.v3.Qu…
upvote count: 2
tagged with: postgresql
possible better answer: http://stackoverflow.com/a/32728314
has comment: http://stackoverflow.com/comment/42808626
has answer: http://stackoverflow.com/a/32728314
downvote count: 1
tagged with: jdbc
favorite count: 0
has comment: http://stackoverflow.com/comment/42803598

http://stackoverflow.com/a/27163261
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27162634
answers question: http://stackoverflow.com/q/27162634
score: 3
type: AcceptedAnswer
downvote count: 0
has body: mappedBy is generally for bidirection relationship, to save extra queries for updation/insertion. Basically for OneToMany on Parent side and ManyToOne on Child Side. In your case, mappedBy means that Parent does not hold responsibility to save references to Child. So try using @JoinColumn in your case.

http://stackoverflow.com/q/27256904
has comment: http://stackoverflow.com/comment/42987814
tagged with: tomcat
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27271352
tagged with: war
has title: How do I deploy spring-boot WAR to Tomcat?
upvote count: 3
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/27271352
possible better answer: http://stackoverflow.com/a/27259841
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/42994169
has answer: http://stackoverflow.com/a/27259841
has body: I have spent a good number of hours on this before posting... I have a spring-boot application that runs nicely as a JAR, but when I try to convert it to a WAR I cant deploy it. I have tried looking for the rules for it to decide whether it Tomcat is embedded or external. The WAR looks correct with WEB-INF/lib and WEB-INF/lib-provided with no obviously misplaced jars. My Application class extends SpringBootServletInitializer. When debugging, this class sets the application context class to AnnotationConfigEmbeddedWebApplicationContext.class... is this correct? Should I expect to see Embedded classes being loaded when trying to deploy as a WAR? I am using :- 1) spring framework 4.1.2.RELEASE 2) spring-boot 1.1.9.RELEASE 3) spring security 3.2.5.RELEASE 4) Tomcat 7.0.57 The application uses both WebMvc and WebSockets... Regards My parent POM has .... org.springframework.boot spring-boot-dependencies ${spring.boot.version} pom import .... My POM contains the following spring-boot artifacts. org.springframework.boot spring-boot-starter-web provided org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-websocket org.springframework.boot spring-boot-starter-tomcat provided org.apache.tomcat.embed tomcat-embed-websocket provided org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-security This is deploying inside Tomcat 7.0.57 as a WAR with -Ddebug Sorry for so much logging ;-( .... 123143 [RMI TCP Connection(2)-127.0.0.1] DEBUG o.s.b.c.c.ConfigFileApplicationListener - Skipped config file 'classpath:/application.yaml' for profile resource not found 123143 [RMI TCP Connection(2)-127.0.0.1] INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@54d9aaa1: startup date [Wed Dec 03 09:13:08 GMT 2014]; parent: org.springframework.context.annotation.AnnotationConfigApplicatio…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43010070
score: 3
downvote count: 0

http://stackoverflow.com/q/27207506
score: 0
has title: Doubly LinkedList in Java
has comment: http://stackoverflow.com/comment/42897372
tagged with: doubly-linked-list
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42896868
tagged with: nodes
has body: So I have to implement some methods for a doubly Linked List...my main question is how to implement a remove At Index method and a reverse String method. I already have a node class. The remove At Index method gets an index (of type int) and removes the element at that index. The reverse String method returns a String that contains all of the elements in the list in the reverse order... I made a contains method I just don't know how to use it to fix these problems or if I need to use it to fix the problems... Please help!
type: Question

http://stackoverflow.com/comment/42967784
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27212539
has text: Dear Abecee, I'm new to Oracle. When i run your qquery it producing an error. "Unsupported column aliasing" . " xolumn aliasing in WITH clause is not supported yet. Specify aliasing in dedinition subquery and retry" what I want to do?

http://stackoverflow.com/comment/42847834
has text: @Pshemo Yea for lack of context ;) - Also, depending on the circumstances, it might be better to synchronize the operations (the methods been called)...but context is king ;)
comment on: http://stackoverflow.com/q/27179330
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42920733
has text: A very simple illustration of a fundamental principle in software: the internal representation of data needs not be constrained by the way it is viewed externally. :-)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27220796
score: 1

http://stackoverflow.com/a/27195897
has comment: http://stackoverflow.com/comment/42876946
has comment: http://stackoverflow.com/comment/42877013
answers question: http://stackoverflow.com/q/27195826
type: Answer
has body: Read the class-level Javadoc: Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.
has comment: http://stackoverflow.com/comment/42877105
downvote count: 0
has comment: http://stackoverflow.com/comment/42877045
has comment: http://stackoverflow.com/comment/42876914
score: 3
has comment: http://stackoverflow.com/comment/42877087
upvote count: 3
has comment: http://stackoverflow.com/comment/42877035
has comment: http://stackoverflow.com/comment/42877030

http://stackoverflow.com/q/27154494
answer count: 1
has answer: http://stackoverflow.com/a/27154945
has comment: http://stackoverflow.com/comment/42803487
favorite count: 0
has title: In eclipse how to show exception message of debugger code executed in display window?
has comment: http://stackoverflow.com/comment/42803621
score: 2
type: UnansweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/42803516
downvote count: 1
has comment: http://stackoverflow.com/comment/42803714
has comment: http://stackoverflow.com/comment/42803572
tagged with: debugging
has comment: http://stackoverflow.com/comment/42803334
tagged with: java
tagged with: eclipse
has body: I'm running a method at a breakpoint in the code display window of eclipse. It results in an exception but does not show the exception message. Anyone know how to see this when debugging in eclipse?
type: Question

http://stackoverflow.com/comment/42974060
type: AnswerComment
score: 0
type: Comment
has text: This will ignore bClass completely I believe and this is not what needed (that is ignore a field).
comment on: http://stackoverflow.com/a/27249941

http://stackoverflow.com/comment/42887539
score: 0
comment on: http://stackoverflow.com/q/27202129
type: QuestionComment
has text: Please see [this](http://stackoverflow.com/a/22478862/1025201) answer for an overview. Or [this](http://www.asgteach.com/blog/?p=219) tutorial
type: Comment

http://stackoverflow.com/q/27181662
tagged with: android
has comment: http://stackoverflow.com/comment/42851722
favorite count: 0
has comment: http://stackoverflow.com/comment/42852015
has title: ListActivity cannot be resolved to a type
downvote count: 1
has comment: http://stackoverflow.com/comment/42851638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42851659
tagged with: eclipse-juno
has comment: http://stackoverflow.com/comment/42852090
has body: I am new to Android development . While creating a Task reminder application I got stuck at this point where it says "ListActivity cannot be resolved as a type". I tried to find a solution for this but I couldn't. This is the full code. package com.android.taskreminder; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class ReminderListActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reminder_list); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.reminder_list, 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: java
has comment: http://stackoverflow.com/comment/42851650
has answer: http://stackoverflow.com/a/27181692
accepted answer: http://stackoverflow.com/a/27181692
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42851608
upvote count: 0
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/42851606
has comment: http://stackoverflow.com/comment/42851586

http://stackoverflow.com/q/27200145
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27200204
type: Question
accepted answer: http://stackoverflow.com/a/27200204
answer count: 1
has title: image not stored on server using buffer reader in android
has body: First I am consverting user selected image to base 64 string then i am sending this image to php server, There i am not getting complete base64 string. I don't know whats the problem. Here is code:- File file = new File(imagepath); //encodeImagetoString convert image to base64 string encodeImagetoString(); //encodedString is a base64 string String imageString= encodedString; EditText text= (EditText) rootView.findViewById(R.id.editText2); String shayaritext=text.getText().toString(); Spinner mySpinner=(Spinner) rootView.findViewById(R.id.spinner1); String catValue = mySpinner.getSelectedItem().toString(); UserFunctions userFunction = new UserFunctions(); json = userFunction.uploadShayariData(shayariName,catValue,shayaritext, imageString); uploadShayariData function:- @SuppressWarnings({ "deprecation", "deprecation" }) public JSONObject uploadShayariData(String name,String catValue,String shayaritext,String image){ // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("tag", shayariUpload)); params.add(new BasicNameValuePair("cat", catValue)); params.add(new BasicNameValuePair("title", name)); params.add(new BasicNameValuePair("data", shayaritext)); params.add(new BasicNameValuePair("image", image)); // getting JSON Object JSONObject json = jsonParser.getJSONFromUrl(registerURL, params); // return json return json; } PHP code:- $image3=$_POST['image']; // Get file name posted from Android App $filename = "a.png"; // Decode Image $binary=base64_decode($base); header('Content-Type: bitmap; charset=utf-8'); // Images will be saved under 'www/imgupload/uplodedimages' folder $file = fopen('uploads/'.$filename, 'wb'); // Create File fwrite($file, $binary); fclose($file);
tagged with: android
linked to: http://stackoverflow.com/q/4083702
score: 0
has comment: http://stackoverflow.com/comment/42884070
tagged with: php
has comment: http://stackoverflow.com/comment/42884053
type: AnsweredQuestion

http://stackoverflow.com/q/27232591
linked to: http://stackoverflow.com/q/882772
upvote count: 1
has body: Setup: Linux with GnuPG or Windows with GPG4Win(OpenPGP) A 2048 RSA keypair has been created by a privileged user who can access the key ring A second lower privilege user has been created for a java application to run under Permission has been granted for this user to run GPG commands but cannot access physical key ring files The key IDs are known to the java application and so is the passphrase to extract private key Java application has imported Bouncycastle library The java program needs to perform an encryption and decryption using the key pair Problem: I have successfully performed encryption and decryption using Bouncycastle. But it involved trying to read the public and private keys from the pubring and secring files. For security, I would rather not have the java application have direct access to the key ring files. What are my options. Are there any options in Bouncycastle to do this without reading the key rings or exporting the keys to separate files? Note: Using Bouncy castle is not necessary.
favorite count: 0
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/42942500
has answer: http://stackoverflow.com/a/27233242
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/27233144
tagged with: java
has comment: http://stackoverflow.com/comment/42942246
type: Question
tagged with: openpgp
has title: How to use public key OpenPGP(GPG) without access to physical key ring in Java
tagged with: security
answer count: 2

apache-spark
tags question: http://stackoverflow.com/q/27274998
tags question: http://stackoverflow.com/q/27285178
tags question: http://stackoverflow.com/q/27213742
tags question: http://stackoverflow.com/q/27268965
tags question: http://stackoverflow.com/q/27153247
tag name: apache-spark
tags question: http://stackoverflow.com/q/27253690
tags question: http://stackoverflow.com/q/27246348
type: Tag
tags question: http://stackoverflow.com/q/27283231
tags question: http://stackoverflow.com/q/27183641
tags question: http://stackoverflow.com/q/27163574

http://stackoverflow.com/comment/42850385
has text: What is debug showing? print con.getResponseCode() and see what connection says.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27180878
type: Comment

http://stackoverflow.com/comment/42988704
has text: Just to clarify: You want your program to sort the array, and make every cycle take at least a second + redraw the intermediate results? (So to make something like the neat sort visualizations)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27255244

http://stackoverflow.com/a/27197095
type: AcceptedAnswer
has body: This is an infinite loop: int decimalCopy = decimal; int len = 0; while (decimal != 0 ) { decimal = decimal / 2; len ++; decimal = decimalCopy; } I'm not sure why you have decimalCopy, I don't see that it's necessary, why not just decimal /= 2;? But since decimalCopy = decimal is never modified decimal = decimalCopy always keeps decimal equal to the initial value thus decimal never equals 0. Also the second part won't work properly since decimal = 0 after the first while loop. Two things: Why not use the knowledge of the length of the array and just use a for loop for computing the digits. If you change the parameter of method convertToBinary to final int decimal I think this will force you to properly use your decimalCopy value.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27197056
has comment: http://stackoverflow.com/comment/42881583
answers question: http://stackoverflow.com/q/27197056

http://stackoverflow.com/comment/42925676
comment on: http://stackoverflow.com/q/27223448
has text: thanks for your reply. I am not quite sure if we can use "validateRole" this kind of method in URL based on RESTFUL definition.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27261985
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42997391
type: Question
has comment: http://stackoverflow.com/comment/42999873
has body: I have an annoying problem. You see, I have created a program that basically can send files, grab files, and run commands on other computers where the program is running. I do this by exchanging messages and files through an unprotected email address using IMAP. Well, my school doesn't have some sort of online-repository to exchange files or send messages to other people, so I am using this purely for my middle school. Well, considering the fact that it works when I have the program running on my laptop and then my mom's computer, but I can't send any sort of message from school,I think it might have to something with the school firewall. NOTE: I CAN connect to the email, but I can't send any sort of email to it. I get a "java.net.SocketException: Connection reset" error when I try to click the "Send File", "Grab File", or ""Command" button in school, because those all involve sending messages. EDIT - I can't post pictures yet, as I just joined StackOverflow. Sorry :( but I can't show you what the program looks like. EDIT AGAIN - One more vote and I can add the picture! Well, here is the code I use for sending a simple message such as an error message or a request to run a command. I use the same method for sending a file too: public void sendMessage(String subject,String message) { try { 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", "587"); Session sesh = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(email, pass); } }); MimeMessage msg = new MimeMessage(sesh); msg.setFrom(new InternetAddress(EmailGUI.gui.getEmail())); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(email)); msg.setSubject(EmailGUI.gui.encrypt(subject + "AbC" + uuid.toString().replaceAll("-",""))); Multipart body = new MimeMult…
has comment: http://stackoverflow.com/comment/42997027
tagged with: jakarta-mail
upvote count: 1
tagged with: email
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42996885
has comment: http://stackoverflow.com/comment/42997085
has title: Sending an email correctly using javamail
has comment: http://stackoverflow.com/comment/42996973

http://stackoverflow.com/comment/43050376
type: AnswerComment
type: Comment
has text: @localhost I see. I have updated my answer with an example of a custom deserializer which re-use the object mapper instance.
comment on: http://stackoverflow.com/a/27275729
score: 0

http://stackoverflow.com/a/27244788
upvote count: 9
score: 9
downvote count: 0
has body: thread.join() stops the execution of current thread until the joined thread completes.. You have commented correctly.. :) Synchronization prevents multiple threads from executing the synchronized part of code on the same instance.
type: Answer
answers question: http://stackoverflow.com/q/27244677

http://stackoverflow.com/a/27187239
downvote count: 0
has comment: http://stackoverflow.com/comment/42861442
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42861569
has comment: http://stackoverflow.com/comment/42861680
upvote count: 2
answers question: http://stackoverflow.com/q/27187171
has comment: http://stackoverflow.com/comment/42861754
has comment: http://stackoverflow.com/comment/42861825
has comment: http://stackoverflow.com/comment/42861419
has comment: http://stackoverflow.com/comment/42861945
has body: For switching tabs, use newTab.sendKeys(Keys.chord(Keys.CONTROL,Keys.TAB)).perform();
has comment: http://stackoverflow.com/comment/42861727
has comment: http://stackoverflow.com/comment/42861758

http://stackoverflow.com/comment/42961113
score: 0
comment on: http://stackoverflow.com/a/27242601
has text: Oh there is a contains method, wow it wasn't even listed here in my book. Thanks.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43033603
type: Comment
score: 0
has text: Thanks for your time:) I get this compiling error now: error: cannot find symbol Platform.runLater(new Runnable() { symbol: variable Platform
type: AnswerComment
comment on: http://stackoverflow.com/a/27281964

http://stackoverflow.com/comment/42889420
comment on: http://stackoverflow.com/q/27203274
type: QuestionComment
has text: You're trying to run uncompilable code -- please never do this. Instead compile it and fix the compilation error before running. What error message does your Java **COMPILER** tell you? And which line is 197 of the Q4Lexical.java class? Also, this information is key to your question, so please do edit your question and include this information with the question, not in comments. Doing this will help us all.
type: Comment
score: 0

ms-access
tags question: http://stackoverflow.com/q/27310726
tags question: http://stackoverflow.com/q/27302445
tag name: ms-access
type: Tag

http://stackoverflow.com/comment/42867338
score: 0
type: Comment
type: QuestionComment
has text: Sorry, forgot the link for the implementation. [Here it is](http://eclipsesource.com/blogs/2012/11/02/integrating-gson-into-a-jax-rs-based-application/)
comment on: http://stackoverflow.com/q/27188753

http://stackoverflow.com/comment/42903826
comment on: http://stackoverflow.com/a/27211067
type: Comment
has text: Why is the second considered better? It seems as though the creation and management component is tightly coupled at the beginning of the code. And rather bulky if you have to rewrite the configuration code for each instance of MyClass. Also what if you want to release your code to allow others to simply "create" MyClass objects, and leave the configuration aspect within a "black box"?
score: 0
type: AnswerComment

http://stackoverflow.com/q/27219354
has answer: http://stackoverflow.com/a/27219585
has answer: http://stackoverflow.com/a/27219422
favorite count: 0
has answer: http://stackoverflow.com/a/27219893
has title: java while loop won't print the text after a the stopping condition
tagged with: while-loop
has body: I just started studying Java and I'm required to use while to decided how many players can be goalkeepers based on their number. The loop is supposed to stop after the user entered 0 and print the counted number of players that can be goalkeepers. public class Q3_201303719 { public static void main(String[] args) { Scanner input = new Scanner (System.in); int num; int count=0; System.out.println("Enter the players' numbers"); num = input.nextInt(); while ((num != 0) &amp;&amp; (num &lt; 31) &amp;&amp; (num%2==0) || (num%3==0)) count++; System.out.println(count+ " players can be goalkeepers.\n"); // Above line should be printed once the user enter 0, but in my case it won't // print and keeps asking the user to enter a number. } }
has answer: http://stackoverflow.com/a/27219468
has answer: http://stackoverflow.com/a/27219410
has comment: http://stackoverflow.com/comment/42917967
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: loops
upvote count: 1
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/27219472
accepted answer: http://stackoverflow.com/a/27219585
possible better answer: http://stackoverflow.com/a/27219893
downvote count: 0

http://stackoverflow.com/comment/42899083
type: QuestionComment
has text: Why are you using `i < Timeline.INDEFINITE` as your loop condition?
comment on: http://stackoverflow.com/q/27208476
score: 0
type: Comment

http://stackoverflow.com/comment/42838368
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27174280
type: Comment
has text: I see it, preparedStatement = connection.prepareStatement(query); resultset = preparedStatement.executeQuery();

http://stackoverflow.com/a/27235973
answers question: http://stackoverflow.com/q/27235811
upvote count: 1
type: AcceptedAnswer
has body: A getter should not be static. I made some modifications. This should work: public class Person { private String navn; private int personNummer; private int alder; public Person (String navn, int personNummer, int alder) { this.navn = navn; this.personNummer = personNummer; this.alder = alder; } public String getName() { return this.navn; } } public class Kunderegister { private Scanner input; private Person [] brukere; int i = 0; public Kunderegister () { input = new Scanner(System.in); brukere = new Person [20]; } public void leggTilBruker() { System.out.println("give the name"); System.out.println("Give name"); String name = input.nextLine(); System.out.println("Give age"); int age = input.nextInt(); System.out.println("Give number"); int number = input.nextInt(); Person a = new Person(name,number,age); brukere[i]=a; i++; } public void visPersonListe() { for (int j = 0; j &lt; brukere.length; j++) { System.out.println(brukere[j].getName()); } }
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27235811

http://stackoverflow.com/comment/42855528
score: 0
type: AnswerComment
has text: OK we will break question in Simple. Can you tell me what is the current situation ? Does it deletes the record now? If yes, then what kind of Dynamic event is thrown after Delete Action?
type: Comment
comment on: http://stackoverflow.com/a/27183460

http://stackoverflow.com/comment/43018887
type: QuestionComment
has text: @user3417644 Personally I prefer some JAX-RS clients (like Jersey client), but take a look thorugh LuiggiMendoza answer. I think his suggestions are more easier to use.
score: 1
comment on: http://stackoverflow.com/q/27274474
type: Comment

http://stackoverflow.com/comment/42819035
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27163008
score: 0
has text: @PM77-1 Still a terrible idea regardless.

http://stackoverflow.com/q/27267146
has comment: http://stackoverflow.com/comment/43005440
has title: Java jTable sort percentage values not working
has body: I was wondering why my jTable is not sorting percentage values and how I can fix this? I was hoping that I could convert the whole row into a string but that still doesn't work. What am I doing wrong? Thanks package tables; import java.awt.BorderLayout; import java.text.DecimalFormat; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class mainwindow extends JPanel { private static final long serialVersionUID = 1L; private static Object data[][]; public static void main(String[] args) { DecimalFormat round = new DecimalFormat("#.#"); JFrame testFrame = new JFrame(); testFrame.setTitle("table"); testFrame.setLayout(new BorderLayout()); data = new Object[30][3]; String test = null; for (int i = 0; i &lt; 30; i ++) { test = (String) (round.format(100 * new Double((double) i / 9)))+ "%"; // dummy values data[i][0] = test; data[i][1] = "a"; data[i][2] = "a"; } Object[] columns = {"Track #", "Title", "Length"}; DefaultTableModel model = new DefaultTableModel(data,columns) { private static final long serialVersionUID = 1L; }; JTable table = new JTable(model); JScrollPane scroll = new JScrollPane(table); table.setAutoCreateRowSorter(true); testFrame.add(scroll,BorderLayout.CENTER); testFrame.pack(); testFrame.setVisible(true); } }
linked to: http://stackoverflow.com/q/10067060
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27271513
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27268414
tagged with: sorting
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/43005278
answer count: 2

http://stackoverflow.com/comment/42907748
type: Comment
has text: perfect. I created a class `CustomRequestInterceptor` that implements `RequestInterceptor` and now I'm use: `setRequestInterceptor(new CustomRequestInterceptor())` and works. Thanks a lot !
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27213539

http://stackoverflow.com/a/27301061
has body: You have a content Uri, log it to see it. getPath returns the path part of the Uri which has nothing to do with file paths. Try using: InputStream imageStream = getContext().getContentResolver().openInputStream(imageURI);
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/27300916
downvote count: 0

http://stackoverflow.com/comment/42947188
score: 0
type: QuestionComment
type: Comment
has text: I've already tried that, but the sample codes I've googled are not as simple I can understand, or simply not working.
comment on: http://stackoverflow.com/q/27235286

http://stackoverflow.com/comment/42841543
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27175963
has text: If you only ever need two integers in the list you don't really need to use a list, prob. better to use a simple object containing to integers,.

http://stackoverflow.com/a/27238037
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43038826
accepted answer of: http://stackoverflow.com/q/27235806
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27235806
upvote count: 1
has body: You are looking for OSGi services. In OSGi you can register services in one bundle and use those services in another bundle. You can also track services that appear in an OSGi container and use them if they meet your needs. There are many tutorials on the NET that explains how you can use OSGi services. E.g.: http://www.knopflerfish.org/osgi_service_tutorial.html An example how you could use it: You specify an interface Each plug-in bundle must have an implementation of the interface and the bundle registers the instantiated object as an OSGi service. Your technology bundle (that can have plugins) tracks all OSGi services that implement the interface.
has comment: http://stackoverflow.com/comment/42958377
type: Answer
has comment: http://stackoverflow.com/comment/43051528
has comment: http://stackoverflow.com/comment/43054726

http://stackoverflow.com/comment/43086444
comment on: http://stackoverflow.com/a/27312893
type: AnswerComment
score: 0
type: Comment
has text: But how do you adjust the combination set length and the number of possible elements?

http://stackoverflow.com/comment/42804930
comment on: http://stackoverflow.com/q/27155180
type: Comment
type: QuestionComment
has text: So you're misunderstanding program execution and the _call stack_. That's what you should look into.
score: 2

parsing
tags question: http://stackoverflow.com/q/27163008
tags question: http://stackoverflow.com/q/27311083
tags question: http://stackoverflow.com/q/27202805
tags question: http://stackoverflow.com/q/27191993
tags question: http://stackoverflow.com/q/27235798
tags question: http://stackoverflow.com/q/27221882
tags question: http://stackoverflow.com/q/27285446
tag name: parsing
tags question: http://stackoverflow.com/q/27245275
tags question: http://stackoverflow.com/q/27306309
tags question: http://stackoverflow.com/q/27308966
tags question: http://stackoverflow.com/q/27187849
tags question: http://stackoverflow.com/q/27187735
tags question: http://stackoverflow.com/q/27199252
type: Tag
tags question: http://stackoverflow.com/q/27199100
tags question: http://stackoverflow.com/q/27262453
tags question: http://stackoverflow.com/q/27292779
tags question: http://stackoverflow.com/q/27251891
tags question: http://stackoverflow.com/q/27153758
tags question: http://stackoverflow.com/q/27246772
tags question: http://stackoverflow.com/q/27201605
tags question: http://stackoverflow.com/q/27272391

http://stackoverflow.com/comment/42869773
comment on: http://stackoverflow.com/q/27191646
has text: @LouisWasserman: I don't know, but this person has violated my rights as well as my client's! what is the other solution you suggest pls?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27255690
type: UnansweredQuestion
tagged with: php
has body: I am trying to utilize Jasperstarter with MSSQL on Windows with a JDBC driver. It seems never to find or connect with this driver for some reason despite using the same Driver and URL used by iReport which does work. I can execute reports that do not access the DB, but once I add the database parameters the call fails. I do not get any info back from the call, not sure where the debug stuff goes. Are there any special path settings that need to be made to get this to work? The exec call output just returns a 1 without any failure info. PHP exec command stream: "C:\\Inetpub\\wwwroot\\TekEnterpriseServer\\protected\\JasperPHP/JasperStarter/bin/jasperstarter pr ./reports/maintenance.jasper -f pdf -t generic --db-driver net.sourceforge.jtds.jdbc.Driver --db-url jdbc:jtds:sqlserver://localhost/tekenterprise"
tagged with: java
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/27513924
tagged with: jasperstarter
score: 0
answer count: 1
tagged with: jdbc
has title: Jasperstarter Usage

http://stackoverflow.com/q/27164379
tagged with: opensl
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42824204
type: UnansweredQuestion
tagged with: android
tagged with: audio
tagged with: ivr
has body: I found from one thread that OpenSL ES can be used in Android to play audio in phone call without enabling speaker phone mode. But i don't know how to do that. is there any working example?
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to use OpenSL ES to play audio on a call in Android

http://stackoverflow.com/comment/42897727
type: QuestionComment
has text: Is this a typo: digits arrays for example : (1,2,-,3). Should this be digits arrays for example : (1,-2,3). If not, I think I misunderstood your quesiton
comment on: http://stackoverflow.com/q/27207708
score: 0
type: Comment

http://stackoverflow.com/a/27242279
answers question: http://stackoverflow.com/q/27240194
has body: Try this. The config.ini file should specify org.eclipse.core.runtime@start in the osgi.bundles property. Here is the default osgi.bundles property, maybe it was (accidently) changed during some upgrade: You need to add the following line to the bottom of the eclipse.ini file: -Dosgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@start
score: 0
type: Answer

http://stackoverflow.com/comment/42831688
type: Comment
has text: Still the method declarations are missing! So,still the downvote remains!
comment on: http://stackoverflow.com/a/27164908
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42824290
comment on: http://stackoverflow.com/a/27164344
score: 0
type: Comment
has text: @MadProgrammer [I had playing with Executor & Runnable & SwingWorker, with real idiotic typo demonstrated in description and code](http://stackoverflow.com/q/7053865/714968) (to test VMs on VMWare) on short periods (a few steps, separate threads, if is alive, how, where, who's, how many), sometimes I'm lost part of without seeing a connection on virtual machine (reading data from embeded db, then after db invoked a new test on local machine:-) too, JVM memory increased, never profiled, ran on separate lan,
type: AnswerComment

http://stackoverflow.com/comment/43032825
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27282084
has text: why do you want that id? you can compare that number with your `xml` ids. see my updated answer.
type: AnswerComment

http://stackoverflow.com/comment/43383962
comment on: http://stackoverflow.com/q/27205375
has text: Without the "-n com.myapp/com.flyingsoftgames.googleplayquery.QueryReceiver", the QueryReceiver function still runs and has that S.referrer value.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42842102
type: Comment
comment on: http://stackoverflow.com/a/27176351
has text: sorry it was for Kishorer747 not seen you answer
score: 0
type: AnswerComment

http://stackoverflow.com/a/62911104
answers question: http://stackoverflow.com/q/27217280
has body: Safe way in kotlin: intent.putExtra("MOVE_DATE", date) and to read it in safe way by check for key & null check: val moveDate: Date? intent?.apply { if (hasExtra("MOVE_DATE")) { moveDate = getSerializableExtra("MOVE_DATE") as? Date moveDate?.let { print(it) } } }
score: 0
type: Answer

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/27182430
tags question: http://stackoverflow.com/q/27213803
tags question: http://stackoverflow.com/q/27201987
tags question: http://stackoverflow.com/q/27294425
tags question: http://stackoverflow.com/q/27201776
tags question: http://stackoverflow.com/q/27165585
tags question: http://stackoverflow.com/q/27234293
tags question: http://stackoverflow.com/q/27311153
tags question: http://stackoverflow.com/q/27299623
tags question: http://stackoverflow.com/q/27278343
tags question: http://stackoverflow.com/q/27181888
tags question: http://stackoverflow.com/q/27226237
tags question: http://stackoverflow.com/q/27276219
tags question: http://stackoverflow.com/q/27178255
type: Tag
tags question: http://stackoverflow.com/q/27210179
tags question: http://stackoverflow.com/q/27254589
tags question: http://stackoverflow.com/q/27182975
tags question: http://stackoverflow.com/q/27261079
tags question: http://stackoverflow.com/q/27301697
tags question: http://stackoverflow.com/q/27278225
tags question: http://stackoverflow.com/q/27223002
tags question: http://stackoverflow.com/q/27313529
tags question: http://stackoverflow.com/q/27274436
tags question: http://stackoverflow.com/q/27201763
tags question: http://stackoverflow.com/q/27223790
tags question: http://stackoverflow.com/q/27270257
tags question: http://stackoverflow.com/q/27212925
tags question: http://stackoverflow.com/q/27241039
tags question: http://stackoverflow.com/q/27154736
tags question: http://stackoverflow.com/q/27189830
tags question: http://stackoverflow.com/q/27174786
tags question: http://stackoverflow.com/q/27155187
tags question: http://stackoverflow.com/q/27185700
tags question: http://stackoverflow.com/q/27309581
tags question: http://stackoverflow.com/q/27246939
tags question: http://stackoverflow.com/q/27312054
tags question: http://stackoverflow.com/q/27267054
tags question: http://stackoverflow.com/q/27191993
tags question: http://stackoverflow.com/q/27288726
tags question: http://stackoverflow.com/q/27213150
tags question: http://stackoverflow.com/q/27259379
tags question: http://stackoverflow.com/q/27301307
tags question: http://stackoverflow.com/q/27216099
tags question: http://stackoverflow.com/q/27304352
tags question: http://stackoverflow.com/q/27271344
tags question: http://stackoverflow.com/q/27270950
tags question: http://stackoverflow.com/q/27233756
tags question: http://stackoverflow.com/q/27214332
tags question: http://stackoverflow.com/q/27291209
tags question: http://stackoverflow.com/q/27246060
tags question: http://stackoverflow.com/q/27217657
tags question: http://stackoverflow.com/q/27171847
tags question: http://stackoverflow.com/q/27155473
tags question: http://stackoverflow.com/q/27217713
tags question: http://stackoverflow.com/q/27296276
tags question: http://stackoverflow.com/q/27308966
tags question: http://stackoverflow.com/q/27254895
tags question: http://stackoverflow.com/q/27256768
tags question: http://stackoverflow.com/q/27313736
tags question: http://stackoverflow.com/q/27300109
tags question: http://stackoverflow.com/q/27257003
tags question: http://stackoverflow.com/q/27308210
tags question: http://stackoverflow.com/q/27302863
tags question: http://stackoverflow.com/q/27199035
tags question: http://stackoverflow.com/q/27156311
tags question: http://stackoverflow.com/q/27288425
tags question: http://stackoverflow.com/q/27215058
tags question: http://stackoverflow.com/q/27309108
tag name: xml
tags question: http://stackoverflow.com/q/27257994
tags question: http://stackoverflow.com/q/27222992
tags question: http://stackoverflow.com/q/27257090
tags question: http://stackoverflow.com/q/27266985
tags question: http://stackoverflow.com/q/27253375
tags question: http://stackoverflow.com/q/27236222
tags question: http://stackoverflow.com/q/27187735
tags question: http://stackoverflow.com/q/27236088
tags question: http://stackoverflow.com/q/27270121
tags question: http://stackoverflow.com/q/27240626

http://stackoverflow.com/a/27255638
has comment: http://stackoverflow.com/comment/42985784
has comment: http://stackoverflow.com/comment/42986024
downvote count: 0
has comment: http://stackoverflow.com/comment/42986214
type: Answer
answers question: http://stackoverflow.com/q/27255527
has comment: http://stackoverflow.com/comment/42985748
upvote count: 1
has comment: http://stackoverflow.com/comment/42985204
score: 1
has comment: http://stackoverflow.com/comment/42985521
has body: I would not rely on the getBackground() method of the JButton to know if it was clicked or not, for example java.awt.Component.setBackground could be called on another component that would change the background of the button. public void setBackground(Color c) { Color oldColor = background; ComponentPeer peer = this.peer; background = c; if (peer != null) { c = getBackground(); if (c != null) { peer.setBackground(c); } } // This is a bound property, so report the change to // any registered listeners. (Cheap if there are none.) firePropertyChange("background", oldColor, c); } So I would do something like: b1.addActionListener( //Anonymous Listener Class new ActionListener() { private isBlack = true; public void actionPerformed(ActionEvent e) { if(isBlack) { b1.setIcon(icon[0]); b1.setBackground(Color.WHITE); }else { b1.setIcon(null); b1.setBackground(Color.BLACK); } isBlack = !isBlack; }});
has comment: http://stackoverflow.com/comment/42985346
has comment: http://stackoverflow.com/comment/42985922

http://stackoverflow.com/a/34518225
answers question: http://stackoverflow.com/q/27202673
downvote count: 0
has body: Refreshing the book "TCP/IP Sockets in Java, 2nd Edition" came across playing with time server and client. The small demo code for TcpTimeClient.java basically does what you described. Problems I can see in your code: To get a SocketChannel, use SocketChannel.open(). The JavaDoc of Socket.getChannel() tells what to do. Use interest OP_CONNECT to try all connections first, then use interest OP_READ to find the winner. Concerns depending on the application protocol: Avoid deadlock, e.g. if server expects reading a message from client before responding and client just waits for response without writing the message first. The first winner might not be the best, consider any other QoS approaches. Or keep all connections open and switch if necessary.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/42923468
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27215196
has text: The commandname will be based on each row in the array, so i cannot set it in controller beforehand.PLease let me know if this can be done.
score: 0

http://stackoverflow.com/q/27305164
has answer: http://stackoverflow.com/a/27306100
favorite count: 0
tagged with: sockets
answer count: 4
has comment: http://stackoverflow.com/comment/119148890
has comment: http://stackoverflow.com/comment/43073197
has answer: http://stackoverflow.com/a/27305390
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67395236
has title: Java socket BufferedReader read not reading
type: Question
score: 3
has body: Im trying to make a client/server socket connection via BufferedReader and Buffered Writer, but reader not reading anything it is just hanged, where client send and flush properly. Server does not throw any exception as if client not sending anything to server. My head is going go explode... Im using same for both client and server: in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); Here is the code of server: //inside of try catch while(true){ while(!in.ready())// just to debug System.out.println("READY: " + in.ready()); //just to debug System.out.println("READY: OK"); //just to debug msg = receive().toString(); //hangs here... System.out.println("KEYIS: " + msg); ///some stuff to do .... public StringBuilder receive() throws IOException { StringBuilder str = new StringBuilder(); int tmp; while(true){ tmp = in.read(); if(tmp == 0) break; else if(tmp == -1) throw new IOException(); str.append((char)tmp); } return str; } Client code: not hanging here //inside of try catch send(KEY); //sended properly, no exception while(true){ send(KEY); // sended properly, no exception System.out.println("sent"); //System.out.println(receive().toString()); } public void send(String str) throws IOException{ out.write(str + "\n"); // //out.newLine(); //tried too, not helped out.flush(); //push message to server }
tagged with: java
has answer: http://stackoverflow.com/a/27307026
downvote count: 0

http://stackoverflow.com/q/27305037
tagged with: padding
linked to: http://stackoverflow.com/q/19195657
linked to: http://stackoverflow.com/q/4580982
has title: Bad padding exceptions in DES
favorite count: 0
has body: Have a project in my coding class and I can't figure out this one. The encryption of the file goes just fine it encrypts just fine but whenever I get to the decoding I get this error: Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded. I don't know why this is happening so that is why I'm here. Here's the code: package Test; import java.io.*; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.util.*; public class FileDecryptor { private static String filename; private static String password; private static FileInputStream inFile; private static FileOutputStream outFile; public static void main(String[] args) throws Exception { // File to decrypt. filename = "Test.txt.des"; String password = "super_secret_password"; inFile = new FileInputStream(filename); outFile = new FileOutputStream(filename + ".dcr"); PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray()); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES"); SecretKey passwordKey = keyFactory.generateSecret(keySpec); byte[] salt = new byte[8]; inFile.read(salt); int iterations = 100; PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, iterations); Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES"); cipher.init(Cipher.DECRYPT_MODE, passwordKey, parameterSpec); outFile.write(salt); byte[] input = new byte[64]; int bytesRead; while ((bytesRead = inFile.read(input)) != -1) { byte[] output = cipher.update(input, 0, bytesRead); if (output != null) outFile.write(output); } byte[] output = cipher.doFinal(); if (output != null) outFile.write(output); inFile.close(); outFile.flush(); outFile.close(); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43120317
tagged with: cryptography
tagged with: netbeans
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43074989
upvote count: 1
has comment: http://stackoverflow.com/comment/43073356
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43072911
score: 0

http://stackoverflow.com/comment/43053727
type: Comment
comment on: http://stackoverflow.com/a/27294079
score: 0
type: AnswerComment
has text: I have username and password for windows remote server. sql server uses windows authentication, for sql server i dont have username and password.

http://stackoverflow.com/comment/42873821
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27194042
has text: I've edited my code to fix this problem. I didn't realize a newline value might be stuck in the scanner. See my updated code above.
score: 0

http://stackoverflow.com/comment/42901427
score: 4
comment on: http://stackoverflow.com/q/27209872
has text: You're missing `+` operators that allow you to concatenate your String. i.e., `numArray[i] + "which is" + (100*numArray[i]/theSum) + " % of the sum."`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43071314
score: 0
type: QuestionComment
has text: "Sorry I should of clarified about those" - ok, so do it now, by editing your question.
type: Comment
comment on: http://stackoverflow.com/q/27304059

http://stackoverflow.com/a/27225114
has body: JNI exceptions propagate to the Java layer. The problem is that they only do so when the JNI method returns. In the meantime it may have perpetrated all kinds of self-harm while in an invalid state due to a prior exception. You need to get hold of the JNI source code and fix it, or complain to the vendor/supplier if you can't.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27224546
type: Answer
answers question: http://stackoverflow.com/q/27224546
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42928249
upvote count: 3

http://stackoverflow.com/comment/42881341
comment on: http://stackoverflow.com/a/27197501
type: Comment
has text: [Don't use `setPreferredSize()` when you really mean to override `getPreferredSize()`](http://stackoverflow.com/q/7229226/230513), for [example](http://stackoverflow.com/a/14011536/230513).
score: 0
type: AnswerComment

spring-boot
tags question: http://stackoverflow.com/q/27256904
tags question: http://stackoverflow.com/q/27294878
type: Tag
tags question: http://stackoverflow.com/q/27273754
tags question: http://stackoverflow.com/q/27183635
tags question: http://stackoverflow.com/q/27171334
tags question: http://stackoverflow.com/q/27179310
tags question: http://stackoverflow.com/q/27313736
tags question: http://stackoverflow.com/q/27266345
tags question: http://stackoverflow.com/q/27209057
tags question: http://stackoverflow.com/q/27233536
tag name: spring-boot
tags question: http://stackoverflow.com/q/27297308
tags question: http://stackoverflow.com/q/27290127
tags question: http://stackoverflow.com/q/27286287
tags question: http://stackoverflow.com/q/27287735
tags question: http://stackoverflow.com/q/27189047
tags question: http://stackoverflow.com/q/27222159
tags question: http://stackoverflow.com/q/27268048
tags question: http://stackoverflow.com/q/27186474
tags question: http://stackoverflow.com/q/27230702

http://stackoverflow.com/a/27160974
type: Answer
downvote count: 0
score: 1
has body: I need to keep a reference to certain activities, so that I can invoke one of their methods on an asynchronous event (web result) no matter which activity I'm currently ruining Please use an event bus (LocalBroadcastManager, greenrobot's EventBus, Square's Otto, etc.). Please do not "keep a reference to certain activities". Lets say the activity is in the background, and the system needs resources and destroys my activity. This never happens. Android terminates processes due to low memory conditions; it does not destroy individual activities due to low memory conditions.
upvote count: 1
answers question: http://stackoverflow.com/q/27160852

http://stackoverflow.com/comment/42924022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27215196
has text: Can you show us your controller?
score: 0

http://stackoverflow.com/comment/43036230
comment on: http://stackoverflow.com/a/27260794
has text: I'd recommend launching the applet using the [Deployment Toolkit Script](http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/deployment_advice.html) rather than pure HTML.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27319727
has comment: http://stackoverflow.com/comment/43158575
accepted answer of: http://stackoverflow.com/q/27295586
answers question: http://stackoverflow.com/q/27295586
type: AcceptedAnswer
downvote count: 0
has body: Try using a TypedQuery instead of Query: TypedQuery q = em.createQuery("select s from States s", States.class); List stateList = q.getResultList(); See also the following: java.lang.ClassCastException: sametype cannot be cast to sametype Some of the people who got this error had it clear up when they restarted their server. So try a clean build, restart, and redeploy.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/27207396
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27212438
has comment: http://stackoverflow.com/comment/42897068
tagged with: android
has body: I try to draw some Pie Chart graph but got different result: This is on Android 4.3(correct variant) On Android 4.1 get next(incorrect variant): My code below: @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // int saveFlag = Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG // | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG; // int sc = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, saveFlag); // canvas.translate(0, 0); float temp = 0; float values[] = {700, 500, 300, 444, 222}; values = calculateData(values); float[] value_degree; value_degree = new float[values.length]; for (int i = 0; i &lt; values.length; i++) { value_degree[i] = values[i]; } int height = getHeight(); int width = getWidth(); Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setStrokeWidth(20f); mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(getResources().getColor(R.color.circle_background)); int radius = (int) ((height / 2) + (Math.pow((double) width, 2) / (8 * height))) / 2; float left = width / 2 - radius; float top = height / 2 - radius; float right = width / 2 + radius; float bottom = height / 2 + radius; RectF rectF = new RectF(left, top, right, bottom); canvas.drawOval(rectF, mPaint); rectF.set(left + 11f, top + 11f, right - 11f, bottom - 11f); mPaint.setColor(Color.GRAY); mPaint.setStyle(Paint.Style.FILL); Random r; for (int i = 0; i &lt; value_degree.length; i++) { if (i == 0) { r = new Random(); int color = Color.argb(100, r.nextInt(256), r.nextInt(256), r.nextInt(256)); mPaint.setColor(color); canvas.drawArc(rectF, 270, value_degree[i], true, mPaint); } else { if (i == 1) { temp += value_degree[i - 1] + 270 - 360; } else { temp += value_degree[i - 1]; } r = new Random(); int color = Color.argb(255, r.nextInt(256), r.nextInt(256), r.nextInt(256)); mPaint.setColor(color); canvas.drawArc(rectF, temp, value_degree[i], true, mPaint); } } mPaint.setColor(getResources().getColor(R.color.circle_ba…
has comment: http://stackoverflow.com/comment/42896880
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27212438
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42897265
has title: Different views depending on android versions
upvote count: 1

http://stackoverflow.com/comment/42922622
score: 1
has text: Yeah, the question is far from clear. I want to know what _an object is created with "Michigan"_ means.
comment on: http://stackoverflow.com/q/27221634
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27172977
score: 31
downvote count: 0
has body: Option 1: Add a boolean field to your enum. public static enum FileType { CSV(true), XML(false), XLS(false), TXT(true), FIXED_LENGTH(true); private final boolean interesting; FileType(boolean interesting) { this.interesting = interesting; } public boolean isInteresting() { return this.interesting; } } ... if (fileType!=null &amp;&amp; fileType.isInteresting()) { ... } Option 2: use an EnumSet. EnumSets use bitfields under the hood, so they are very fast and low memory. Set&lt;FileType&gt; interestingFileTypes = EnumSet.of(FileType.CSV, FileType.TXT, FileType.FIXED_LENGTH); ... if (interestingFileTypes.contains(fileType)) { ... } Option 3: use a switch, as kocko suggests
upvote count: 31
type: Answer
answers question: http://stackoverflow.com/q/27172882
has comment: http://stackoverflow.com/comment/42836411

http://stackoverflow.com/q/27261498
tagged with: maven-cobertura-plugin
tagged with: java
has body: With Maven I can generate multiple different types of code coverage reports with Cobertura by changing the reporting section of my POM, ala ... org.codehaus.mojo cobertura-maven-plugin html xml Alternately, I can generate a single type of report from the Maven command line, ala ... mvn clean cobertura:cobertura -Dcobertura.report.format=xml How can I generate multiple different report types from the Maven command line? Apparently, I can only do one. ... I've tried this below, and it does not work! mvn clean cobertura:cobertura -Dcobertura.report.formats=xml,html (NOTE: The above property uses "formats" versus "format". The above always creates the default HTML report without seeing the two specified formats. I'm using Maven 3.2.3 and Cobertura plugin version 2.0.3.) Please help, my Googol Fu is failing. ... Anyone know if this is possible or not?
has title: Generating multiple Cobertura report formats via Maven command line
tagged with: sonarqube
upvote count: 4
has answer: http://stackoverflow.com/a/27266436
type: AnsweredQuestion
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cobertura
type: Question
tagged with: maven
accepted answer: http://stackoverflow.com/a/27266436
score: 4

http://stackoverflow.com/comment/111460004
has text: https://stackoverflow.com/questions/5117191/spring-jdbc-connection-pool-best-practices
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27166721
type: QuestionComment

http://stackoverflow.com/q/27272758
upvote count: 1
has body: I am trying to pass parameter in neo4j Cypher Query with like operator from Spring data neo4j. Please tell me its right way to pass parameter with like operate .. please help me. Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put(queryAfterSubstutuet(collabVo), groupIdAfterSubstituet(collabVo)); map.put("display_name",input); Result&lt;Map&lt;String, Object&gt;&gt; result = neoOperation.query( collabVo.getSearchQuery(), map); Its my getSearchQuery MATCH (n:OrganizationUnit {id:{class}})-[r:PART]-(c)-[r1:STUDENTROLE]-(f) where f.firstName =~"{display_name}.*" RETURN f But it's throwing error Caused by: java.util.regex.PatternSyntaxException: Illegal repetition [STDERR] {display_name}.* [STDERR] at java.util.regex.Pattern.error(Pattern.java:1924) [STDERR] at java.util.regex.Pattern.closure(Pattern.java:3104) [STDERR] at java.util.regex.Pattern.sequence(Pattern.java:2101) [STDERR] at java.util.regex.Pattern.expr(Pattern.java:1964) [STDERR] at java.util.regex.Pattern.compile(Pattern.java:1665) [STDERR] at java.util.regex.Pattern.&lt;init&gt;(Pattern.java:1337) [STDERR] at java.util.regex.Pattern.compile(Pattern.java:1022)
type: Question
has answer: http://stackoverflow.com/a/27285646
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
accepted answer: http://stackoverflow.com/a/27285646
tagged with: spring-data-neo4j
tagged with: cypher
tagged with: regex
has title: How to pass dynamic parameter in neo4j Cypher Query with like operator
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/42986631
score: 0
has text: Please post the logcat stack trace. If you can get it to crash with the debug version (by unplugging the USB cable) that would be the better stack trace to post. If it only happens with the exported version, then try turning off ProGuard and see if that resolves the problem; if so, then there's a ProGuard configuration issue.
comment on: http://stackoverflow.com/q/27256492
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43107837
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27307113
type: Comment
has text: The reason you're likely getting a null pointer exception is because the image doesn't exist in the root location of the jar, you need to provide the path for it relative to src...

http://stackoverflow.com/a/27261976
answers question: http://stackoverflow.com/q/27260618
score: 2
has comment: http://stackoverflow.com/comment/42997560
has comment: http://stackoverflow.com/comment/43032410
downvote count: 0
has body: This is not possible, unfortunately, because Android Wear devices have no direct access to the Internet (and hence cannot use sockets, HttpURLConnection, or any of the like). See for example: Does Android Wear support HttpURLConnection - getting EOFException Direct internet connection on Android Wear? The only supported way of getting data "out" of the Wearable device is using the Data or Message APis as described in the article you mention (Data Layer).
upvote count: 2
type: Answer

http://stackoverflow.com/a/27308197
has comment: http://stackoverflow.com/comment/43078819
downvote count: 0
answers question: http://stackoverflow.com/q/27308166
has body: input is a local variable to the main method which you then try to use in the createArray method. If you want input to be accessible in other methods, it needs to be a member or static variable. Or in your case, since you only use input in createArray, you can move the creation of input to the createArray method.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43078841
score: 2

http://stackoverflow.com/a/27240002
score: 0
type: Answer
has body: With java 8 you can do the following List&lt;Integer&gt; integers = IntStream.range(0, 10).boxed().collect(Collectors.toList()); Collections.shuffle(integers); As shown in this answer.
answers question: http://stackoverflow.com/q/27239341

http://stackoverflow.com/a/27173254
type: Answer
has comment: http://stackoverflow.com/comment/42836847
has comment: http://stackoverflow.com/comment/42837058
has body: Do this. webButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Execute when button is pressed } }); If you want to use the ActionListener interface then, implement it in your Frame class and then replace that instanceOfSmartphone with webButton.addActionListener(this); And put this outside the method public void actionPerformed(ActionEvent e) { if(e.getSource() == webButton) { } }
score: 0
answers question: http://stackoverflow.com/q/27173174

http://stackoverflow.com/a/27247201
type: Answer
has comment: http://stackoverflow.com/comment/42994399
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27239028
downvote count: 0
has body: If you need to differentiate between production and test compile tasks/source sets, checking whether the name contains test (case-insensitive) is the best solution that's available.

http://stackoverflow.com/comment/42935695
has text: Why not simply use a Java CSV library?
score: 0
comment on: http://stackoverflow.com/q/27229266
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42805543
type: Comment
type: QuestionComment
has text: @Imm Thanks for the idea but if I just put that in place of `T <: Foo[_]` it doesn't compile; I am trying to use that same existential constraint in another way but I mostly get errors saying that the overriding method has an incompatible type.
comment on: http://stackoverflow.com/q/27154322
score: 0

http://stackoverflow.com/comment/42971906
type: Comment
has text: New to these terms so what you're saying is remove the Spinner initialization outside setSpinnerData?
comment on: http://stackoverflow.com/a/27248122
score: 0
type: AnswerComment

http://stackoverflow.com/comment/108470064
comment on: http://stackoverflow.com/a/27295153
type: AnswerComment
score: 0
type: Comment
has text: Just an additional input, if you need to access environment variable from inside your java code, accessing it from System.getProperty(<key>) would be a better option than System.getEnv(<key>) since I found out that the getEnv was not returning the value on some machines.

http://stackoverflow.com/q/27301905
has body: I would like to be able to enter numbers as well as arithmetic operators in a TextEdit to represent latitude and longitude. So I need numbers, decimal points, and additional and subtraction operators (+/-) &lt;EditText android:id="@+id/dia_latitude" style="@style/Heading" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:inputType="number" /&gt;
type: Question
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/12021068
tagged with: eclipse
has title: How to enter Number and Arithmatic characters in Android
accepted answer: http://stackoverflow.com/a/27301936
duplicate of: http://stackoverflow.com/q/12021068
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27301936
upvote count: 1
has comment: http://stackoverflow.com/comment/43067767

http://stackoverflow.com/a/27322096
answers question: http://stackoverflow.com/q/27297904
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43295115
has body: From what I see in the latest gradle docs, Test has a systemProperties property which takes a Map. There is no systemProperty. So, I believe you want the following (untested...see #2 below): def user_login ="" def pass_login ="" gradle.taskGraph.whenReady { taskGraph -&gt; user_login = System.console().readLine("\nPlease enter username: ") pass_login = System.console().readPassword("\nPlease enter password: ") test { systemProperties "username": user_login, "password": pass_login } } I also wanted to add that I see a few issues with your approach that you may want to reconsider. gradle is a build tool/platform and builds are intended to require the least amount of human intervention. Shouldn't this be automated? Entering your user name and password will grow very tiresome, very quickly. I believe you should consider using gradle properties. That way the build user sets their user name and password in their user gradle.properties file. This has the added benefit of being available to multiple builds without the need to ever prompt the user. Why is this happening in a taskGraph closure? How does this depend on the taskGraph being setup? How will other tasks in your build use this? I don't believe that your code will work. The test task, provided by whichever plugin you're using, has already been configured by the time the taskGraph is ready. Google gradle configuration vs execution to get plenty of discussions on the topic, or use this example. Consider using: /** * ~/.gradle/gradle.properties */ userName = me userPassword = YouWillNeverKnow /** * build.gradle */ apply plugin: 'java' test { // use safe navigation to avoid missing property exception systemProperties "username": project?.userName, "password": project?.userPassword } } I tested the above, using my spock unit testing for my groovy project and it worked.
has comment: http://stackoverflow.com/comment/43295022

http://stackoverflow.com/a/27167708
downvote count: 0
answers question: http://stackoverflow.com/q/27167661
score: 5
has comment: http://stackoverflow.com/comment/42827017
upvote count: 5
has body: A Private function is not visible nor callable from its children; hence these are two completely different functions. There is nothing to overwrite from the perspective of the child class, because it is not aware that the parent even has a print() function.
type: Answer

http://stackoverflow.com/a/27279261
score: 2
has body: Why don't you use a single for loop, something like this: for (int i = 0; i &lt; Vec.size() - 2; i+=3) { area = triangle_area_calculator(Vec.get(i), Vec.get(i+1), Vec.get(i+2)); }
answers question: http://stackoverflow.com/q/27279189
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27279189
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43007728
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27268010
type: Comment
has text: Yes indeed. Finally I have checked that link and I found the solution.

http://stackoverflow.com/a/27153399
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27152824
answers question: http://stackoverflow.com/q/27152824
type: Answer
downvote count: 0
has body: Extract it yourself. In your example path is 6 characters long plus length of id. String path = ctx.request().path(); String id = path.substring(6, path.length()); This solution depends on route's length. Alternatively, you can pass the start and end parameters to your action: @With({ ArgsAction.class }) @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface Args { int start() default -1; int end() default -1; } And use it in action class to extract parameter: public class ArgsAction extends Action&lt;Args&gt; { @Override public Promise&lt;Result&gt; call(Context ctx) throws Throwable { final int start = configuration.start(); final int end = configuration.end(); if (start != -1) { final String path = ctx.request().path(); String arg = null; if (end != -1) { arg = path.substring(start, end); } else { arg = path.substring(start, path.length()); } // Do something with arg... } return delegate.call(ctx); } } Usage in JobManager controller: @Args(start = 6) public getlist(Integer id) { return ok(); }

http://stackoverflow.com/comment/43298438
score: 0
type: Comment
type: AnswerComment
has text: From what I understood, this will output the sum of all paths, is there a way to get the sum of each path separately? Thanks!
comment on: http://stackoverflow.com/a/27262680

http://stackoverflow.com/a/27173871
score: 1
answers question: http://stackoverflow.com/q/27173606
has body: You should try to find the service that is providing the data for the web and use it for your app. Check the following service: http://dongxi.douban.com/j/feed/ and the parameters with the console.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42837773
has comment: http://stackoverflow.com/comment/42838433
has comment: http://stackoverflow.com/comment/42936503
type: Answer
has comment: http://stackoverflow.com/comment/42852380
has comment: http://stackoverflow.com/comment/42838100
has comment: http://stackoverflow.com/comment/42838123
has comment: http://stackoverflow.com/comment/42837747
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27173606

http://stackoverflow.com/comment/42842667
has text: Are you trying to instantiate a playlist when it is an activity? What the heck is going on in that code? Please go learn Android basics
score: 0
comment on: http://stackoverflow.com/q/27176509
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42844345
comment on: http://stackoverflow.com/q/27177750
has text: Welcome to SO. Please read [ask], and update your question with more specific details. Show table schema, sample data etc. Also, show any SQL you have tried.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27294063
has comment: http://stackoverflow.com/comment/43057879
tagged with: java
has body: I am trying to make a Java JDialog where symbols are displayed in a tableish way. In fact something similar to charmap for windows: But I ran into some issues: I need the JDialog to be re-sizable so I can't choose to have a table as display, because it needs to be dynamically scaled.(To clarify I mean not just the adjustment of the width of every cell, but the actual amount of the cells in the row/column) The symbols obviously need to be wrapped in some sort of listener friendly component. But if I choose JButtons, everything looks wrong, because of the different character width in pixel. Since I have to loop through the symbols to create JButtons I can only make Objects with no name. So how do I even find out which button was pressed? here is what I've got so far: Code Updated 05.12.2014 import java.awt.Dimension; import javax.swing.JDialog; import javax.swing.JScrollPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.border.EmptyBorder; import java.awt.Color; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; public class SymbolDialog extends JDialog{ private char[] math = {8704, 8707, 8708, 8710, 8712, 8713, 8715, 8716, 8721, 8723, 8728, 8730, 8734, 8743, 8744, 8745, 8746, 8747, 8776, 8793, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8837, 8838, 8839}; private final String[] sTypes = {"Math","Logic", "Arrows"}; private JPanel pan = new JPanel(); public SymbolDialog(){ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { System.out.println("catdch 1"); } catch (InstantiationException e1) { System.out.println("catdch 2"); } catch (IllegalAccessException e1) { System.out.println("catdch 3"); } catch (Unsupporte…
type: Question
has comment: http://stackoverflow.com/comment/43057616
has comment: http://stackoverflow.com/comment/43054104
has title: Java Symbol Table Dialog
has comment: http://stackoverflow.com/comment/43054565
has comment: http://stackoverflow.com/comment/43054848
linked to: http://stackoverflow.com/q/18858312
score: 0
has comment: http://stackoverflow.com/comment/43056155
has comment: http://stackoverflow.com/comment/43058440
has comment: http://stackoverflow.com/comment/43054188
has answer: http://stackoverflow.com/a/37649504
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43053961
has comment: http://stackoverflow.com/comment/43069766
has comment: http://stackoverflow.com/comment/43098192
favorite count: 0
has comment: http://stackoverflow.com/comment/43096056
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/43076546
has comment: http://stackoverflow.com/comment/43056025
has comment: http://stackoverflow.com/comment/43054554
has comment: http://stackoverflow.com/comment/43095322
has comment: http://stackoverflow.com/comment/43054173

http://stackoverflow.com/a/27161402
upvote count: 2
has comment: http://stackoverflow.com/comment/42816472
type: Answer
has body: Add 3 JLabels or JButtons (whatever will be displaying the images) into a JPanel container. The JPanel will likely use a GridLayout(1, 3, horizontal_gap, 0) layout. Place all images as ImageIcons into an ArrayList. Shuffle the ArrayList when needed After shuffling place the Icons into the JLabels/JButtons in a for loop using the setIcon(...) method. Note that your JPanel should override paintComponent, not paint. The paint method is responsible for painting a component's children and borders, and it does not use double buffering by default, making a more dangerous method to override. Putting in a while (true) loop into your Swing GUI without regard to threading is extremely dangerous. Putting this into a painting method such as paint is GUI suicide. Never do this since a painting method is a major determinant in the perceived responsiveness of your program. If you slow it down, the program will be perceived as being slow and poorly responsive, and thus it must be lean and fast as possible, and you should have painting and only painting code within it. Your paint method has program logic in it, something that also shouldn't be done. You don't have full control over whether or even if a painting method will be called, and so program logic should never be placed inside one of these. As MadProgrammer well notes, don't use the src path for your images as this won't exist once you build your program into a jar file. Better to Create a resource directory in the jar file, and to refer to your images as resources, not as files.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27161375
has comment: http://stackoverflow.com/comment/42816481

http://stackoverflow.com/comment/43042940
type: QuestionComment
comment on: http://stackoverflow.com/q/27288116
has text: @JonSkeet I have updated the some more code, hope that is helpful for you
score: 0
type: Comment

http://stackoverflow.com/comment/42802767
type: Comment
type: QuestionComment
has text: @shkschneider It doesn't seem to be able to work. I've tried it many time before coming here
comment on: http://stackoverflow.com/q/27154160
score: 0

http://stackoverflow.com/a/27219676
upvote count: 1
answers question: http://stackoverflow.com/q/27218985
has comment: http://stackoverflow.com/comment/42918533
type: Answer
has body: There is no way of setting a password on a SQLite database in the standard SQLite distribution. The way you make a connection to a SQLite database in Java is: Class.forName("org.sqlite.JDBC"); // force loading of SQLite JDBC driver Connection conn = DriverManager.getConnection("jdbc:sqlite:/path/to/file.db"); Make sure when you run the program, that the SQLite JDBC driver is on the classpath.
has comment: http://stackoverflow.com/comment/42919047
has comment: http://stackoverflow.com/comment/42918556
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42923303
has comment: http://stackoverflow.com/comment/42919556

http://stackoverflow.com/q/27302247
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43067801
tagged with: android
tagged with: fragment
score: -1
has answer: http://stackoverflow.com/a/27302406
tagged with: java
downvote count: 1
type: Question
tagged with: http://stackoverflow.com/tag/json
has body: im trying to load content from a URL with Volley into a listview in a fragment, but every time i get a NullPointerException und i dont really know what im doing wrong. I hope you can help me and point out my mistakes: public class Neuigkeiten extends Fragment { // Neuigkeiten URL public static final String neuigkeitenURL = //my URL // Log tag private static final String TAG = Neuigkeiten.class.getSimpleName(); private ProgressDialog progress; private List&lt; NeuigkeitenBean &gt; neuigkeitenListe = new ArrayList&lt; NeuigkeitenBean &gt;(); private ListView listView; private CustomListAdapter adapter; @Override public View onCreateView( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { View neuigkeitenView = inflater.inflate(R.layout.listmainview , container , false); progress = new ProgressDialog(getActivity()); listView = (ListView) neuigkeitenView.findViewById(R.id.list); adapter = new CustomListAdapter(this , neuigkeitenListe); listView.setAdapter(adapter); // hole die SharedPreferences final SharedPreferences sharedPf = PreferenceManager .getDefaultSharedPreferences(getActivity().getBaseContext()); // hole die Datenbank, die nachher zum Server geschickt werden muss String datenbank = sharedPf.getString("Datenbank" , ""); //POST Parameter JSONObject parameter = new JSONObject(); try { parameter.put("datenbank" , datenbank); } catch (JSONException je) { //wenn das hier auf die Fresse fliegt breche alles ab; je.printStackTrace(); } JsonObjectRequest jsonAntwort = new JsonObjectRequest(Method.POST , neuigkeitenURL , parameter , new Response.Listener&lt; JSONObject &gt;() { @Override public void onResponse( JSONObject response ) { Log.d(TAG , response.toString()); progress.hide(); // Parsing json for (int i = 0; i &lt; response.length(); i++) { try { NeuigkeitenBean neuigkeitenBean = new NeuigkeitenBean(); neuigkeitenBean.setUeberschrift(response.getString("head")); neuigkeitenBean.setText((response.getString("content"))); neuigkeitenBean.…
has comment: http://stackoverflow.com/comment/43068168
has title: NullPointerException by loading JSON Content with volley
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android-volley

http://stackoverflow.com/a/27158417
answers question: http://stackoverflow.com/q/27157496
score: 0
has comment: http://stackoverflow.com/comment/42811709
type: Answer
has comment: http://stackoverflow.com/comment/42811579
has comment: http://stackoverflow.com/comment/42811318
upvote count: 1
downvote count: 1
has body: For this problem, I'm going to make some assumptions: a) You know all inputs will be integers b) You don't need to do anything with the integers, just print them (ie: arithmetic) c) You only want to reverse the order, not any other kind of orders d) Your integers are separated by spaces always If assumption B is correct Since you are reading the inputs in as a string, and since your example uses space separated values, you then need to 1) Separate the inputs and 2) Print them individually (in reverse order) So to do the first point, you can use a string utility that separates a string based on a character. How to split a string. If you aren't familiar with arrays, here is reference. It would look something like. String input = console.nextLine(); String[] inputArray = input.split(" "); At this point, inputArray would look like {"10", "15", "40", "100", "3400"}. Now you just need a way to display each in reverse order. An easy way to do this would be with a for loop because you can direct it and you know how many times it will execute. Since you want to print in reverse order, you will start at the end and work to the beginning. Like this: for (int i = inputArray.length - 1; i &gt;= 0; i--) { Then simply print out the element of the array, making your loop look thus: for (int i = inputArray.length - 1; i &gt;= 0; i--) { System.out.println(inputArray[i]); } If assuption B is not correct This would mean you need you use the integers in some way. This will simply add one step to the previous process (i.e. "If assumption B is correct") where you convert ("parse") the string into an integer. So starting with the code from the previous section: String input = console.nextLine(); String[] inputArray = input.split(" "); for (int i = inputArray.length - 1; i &gt;= 0; i--) { System.out.println(inputArray[i]); } We first want to create a structure to hold the integers, then we want to put each string into the integer array. We do this by using the static Integer.valueOf(String …
has comment: http://stackoverflow.com/comment/42811887

http://stackoverflow.com/a/68321635
answers question: http://stackoverflow.com/q/27174273
downvote count: 0
type: Answer
upvote count: 1
has body: java.time The java.util Date-Time API and their formatting API, SimpleDateFormat are outdated and error-prone. It is recommended to stop using them completely and switch to the modern Date-Time API*. Also, quoted below is a notice from the home page of Joda-Time: Note that from Java SE 8 onwards, users are asked to migrate to java.time (JSR-310) - a core part of the JDK which replaces this project. Do not use a fixed text for the timezone: Do not use a fixed text (e.g. 'UTC') for the timezone because that approach may fail for other locales. Solution using java.time, the modern Date-Time API: import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Locale; public class Main { public static void main(String[] args) { String strDateTime = "Sat Nov 01 20:08:07 UTC 2014"; DateTimeFormatter dtf = DateTimeFormatter.ofPattern("E MMM d H:m:s z u", Locale.ENGLISH); ZonedDateTime zdt = ZonedDateTime.parse(strDateTime, dtf); System.out.println(zdt); } } Output: 2014-11-01T20:08:07Z[Etc/UTC] ONLINE DEMO For any reason, if you need to convert this object of ZonedDateTime to an object of java.util.Date, you can do so as follows: Date date = Date.from(zdt.toInstant()); Learn more about the modern Date-Time API from Trail: Date Time. Just for the sake of completeness Just for the sake of completeness, I have written the following solution using Joda Date-Time API: import java.util.Locale; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; public class Main { public static void main(String[] args) { String strDateTime = "Sat Nov 01 20:08:07 UTC 2014"; DateTimeFormatter dtf = DateTimeFormat.forPattern("E MMM d H:m:s z y").withLocale(Locale.ENGLISH); DateTime dt = dtf.parseDateTime(strDateTime); System.out.println(dt); } } Output: 2014-11-01T20:08:07.000Z * For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time…
score: 1

http://stackoverflow.com/comment/42971074
type: Comment
type: QuestionComment
score: 0
has text: Check if you have a active transaction and if is generating any sql
comment on: http://stackoverflow.com/q/27248205

http://stackoverflow.com/comment/42967774
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27227512
has text: Well then how do you write to your database? How do you read from it? Can you use streams to do either?

http://stackoverflow.com/comment/43047863
comment on: http://stackoverflow.com/q/27290951
has text: Check length of array before accessing it `emp[0]`, `emp[1]` etc
score: 1
type: Comment
type: QuestionComment

comparable
tags question: http://stackoverflow.com/q/27310357
tags question: http://stackoverflow.com/q/27155596
tag name: comparable
tags question: http://stackoverflow.com/q/27297389
type: Tag
tags question: http://stackoverflow.com/q/27194947

http://stackoverflow.com/q/27207000
tagged with: udp
upvote count: 1
has title: ArrayIndexOutOfBoundsException when Getting Integer from Byte Buffer
tagged with: arrays
tagged with: bytebuffer
favorite count: 0
has body: I am trying to send a 28KB text file, over UDP with 8 byte prepending header containing sequence number and packet size for each packet sent. When attempting to send the file with packet size of 1000 bytes, after receiving 8KB of the file I get the ArrayIndexOutOfBoundsException when running the line Getting int from the byte buffer that wraps around my byte array: packetSize = buff.getInt(); The client code is as follows: FileOutputStream fos = null; fos = new FileOutputStream(sDstPath); FileChannel fc = fos.getChannel(); while(dataBytesRcvd &lt;= fileSize) { if((fileSize - dataBytesRcvd) &lt; (packetSize - 8)) //added to adjust last packet's size packetSize = fileSize - dataBytesRcvd + 8; DatagramPacket packet = new DatagramPacket(bytes, packetSize, dp.getSocketAddress()); ds.receive(packet); ByteBuffer buff = ByteBuffer.wrap(bytes); seqNum = buff.getInt(); seq[seqNum]=1; packetSize = buff.getInt(); dataBytesRcvd += (packetSize-8); fc.write(buff); buff.clear(); } It should be noted that increasing the byte array size to 4 more bytes than the packet size, didn't help either. What could be wrong with it?
tagged with: byte
downvote count: 0
answer count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/27169503
has answer: http://stackoverflow.com/a/27275913
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43000665
tagged with: android
score: 6
has comment: http://stackoverflow.com/comment/42975168
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/42830086
tagged with: java
has body: I have created simple app to test the scenario which is failing with NoClassDefFoundError. Lets take for example i have Test1 android project with Class TestClass with some methods. This Test1 project i exported as a test1.jar and exported only source folder with Class TestClass and classpath and .project files. In another android project Test2 i added this test1.jar in my libs folder. And in this Test2 project i have a class Test2Class which calls methods of test1.jar class. After this i exported this Test2 project as test2.jar file following above steps. So when i use this test2.jar in another project i get this above error NoClassDefFoundError. It is the scenario of jar inside a jar. Is anywhere should i do something so i am able to access a jar inside a jar. Thanks in advance.
has title: NoClassDefFoundError in nested jar (Android)
tagged with: noclassdeffounderror
has answer: http://stackoverflow.com/a/27353432
type: Question
has comment: http://stackoverflow.com/comment/42974830
has answer: http://stackoverflow.com/a/27169715
has comment: http://stackoverflow.com/comment/43000907
linked to: http://stackoverflow.com/q/27272404
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43002613
linked to: http://stackoverflow.com/q/183292
has answer: http://stackoverflow.com/a/27249633
tagged with: jar
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42830013
has comment: http://stackoverflow.com/comment/42977607

http://stackoverflow.com/q/27185322
linked to: http://stackoverflow.com/q/3977658
has answer: http://stackoverflow.com/a/27185448
has comment: http://stackoverflow.com/comment/42857680
score: 0
has comment: http://stackoverflow.com/comment/42858343
has title: Exceeding the row limit of 65536 in Excel in JasperReports
linked to: http://stackoverflow.com/q/197762
has comment: http://stackoverflow.com/comment/42857684
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42858072
has body: While hitting the database I am getting more than 80000 records. I am using JasperReports to export those into an Excel, but an Excel can hold a row limit of 65536. How can I export all records in single report or how can I create a new excel when ever it exceeds 65536? I gone through this link but I am not getting things: Is it possible to see more than 65536 rows in Excel 2007?. Here is the main problem: list object contains more than 80000 records. How can I divide the list object into two JasperPrint objects when ever it exceed the 65536 rows? If i am able to divide the list object into two JasperPrint objects then we can happily add the two JasperPrint objects to one collection then we can add the collection object to JRExporter object here is the code to add two JasperPrint objects to collection: How do you export a JasperReport to an Excel file with multiple worksheets?. This is my code so far: JRDataSource datasource = new JRBeanCollectionDataSource( confirmList); JasperReport jasperReport = (JasperReport) JRLoader .loadObject(reportPath); Map parameters = new HashMap(); parameters.put("title", "Reports for " + "confirmed"); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, parameters, datasource); Can anyone please guide me how to do this?
tagged with: jasper-reports
tagged with: java
has comment: http://stackoverflow.com/comment/42925591
has comment: http://stackoverflow.com/comment/42858181
type: Question
answer count: 1

http://stackoverflow.com/a/27778634
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27294838
has body: Hope this should help you. You need to set the boundary in your request to inform the HTTP Request. is simple; A brief introduction to the multipart format can be found in the below link HTML 4.01 Specification for multipart The following example illustrates "multipart/form-data" encoding. If the Json Object is "MyJsonObj" , and file that need to be send is "myfile.txt", the user agent might send back the following data: Content-Type: multipart/form-data; boundary=MyBoundary --MyBoundary Content-Disposition: form-data; name="myJsonString" Content-Type: application/json MyJsonObj //Your Json Object goes here --MyBoundary Content-Disposition: form-data; name="files"; filename="myfile.txt" Content-Type: text/plain ... contents of myfile.txt ... --MyBoundary-- or if your files is of type image with name "image.gif" then, --MyBoundary Content-Disposition: file; filename="image.gif" Content-Type: image/gif Content-Transfer-Encoding: binary ...contents of image.gif... --MyBoundary-- You specify boundary in the Content-Type header so that the server knows how to split the data sent. So, you basically need to select a boundary value to: Use a value that won't appear in the HTTP data sent to the server like 'AaB03x'. Be consistent and use the same value all over the request.
downvote count: 0
has comment: http://stackoverflow.com/comment/122368813

http://stackoverflow.com/q/27156925
score: 2
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27157175
upvote count: 2
has body: I'm designing a new module and I need to know about if it is "correct" the communication between Services and Repositories corresponding to differents objects. Example: I have Object1 and Object2. Object1 is composed by many Object2. And I have this code: @Repository public class Object1Repository{} @Repository public class Object2Repository{} @Service public class Object1ServiceImpl{ private Object1Repository obj1Repo; private Object2Repository obj2Repo; } @Service public class Object2ServiceImpl{ private Object2Repository obj1Repo; } It is an acceptable practice to call from Object1Service... directly to Object2Repository? Or should I call from Object1Service to Object2Service and make all the calls to object2Repository from its corresponding Service? Many times, while I'm manipulating object1 in my services, I need to load a certain part of an object2, and I need to know if it is a good solution to call directly to the repository. This is a kind of thing that is not present in my books of Spring, and I don't have the enough experience to determine if it is a regular practice or I'm breaking the architecture. Thanks!
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: Spring Basic: Relation between Services-repositories
type: Question
has answer: http://stackoverflow.com/a/27157175

http://stackoverflow.com/a/27166719
score: 0
answers question: http://stackoverflow.com/q/27165594
has body: In Java, there is a special Runtime method for that : addShutdownHook. This allows you to initialize a thread that the JVM will try to run just before stopping. It is the place to put any cleanup you want to execute even in case of Ctrl-C of closing of parent window. Extract from javadoc : A shutdown hook is simply an initialized but unstarted thread. When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently. When all the hooks have finished it will then run all uninvoked finalizers if finalization-on-exit has been enabled. Finally, the virtual machine will halt. The shutdown hook is call even if the program ends normally. In that case, it is cleaner to remove the registered hook before exiting with removeShutdownHook (still a method from Runtime) EDIT : In the case of Windows environment, there are no real signals, but special callbacks when system is shutting down. AFAIK, the system hook is correctly called in that case, but I admit I never really tested that. In Windows, processes can be asked to terminate with 2 ways : PostQuitMessage function posts a WM_QUIT message in process event loop - normally the process should exit, but it can do its cleanup (equivallent of Unix SIG_TERM) TerminateProcess immediately stops the process and all its threads (equivallent of Unix SIG_KILL) Console processes can use a ConsoleControlHandler that can intercept Ctrl-C, Ctrl-Break or Ctrl-Close events. First two are generated through keyboard, last is generated when the user closes the console. But normally, the Oracle JVM should use the system hook mechanisme when getting the Ctrl-Close event that is processed the same as a SIGTERM.
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42826574

http://stackoverflow.com/comment/42990020
has text: Sounds like overflow. You said it's trying to do the Fibonacci value of 10,000 - which, to say is a large number, would be an understatement.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27258114
type: Comment

http://stackoverflow.com/a/27178719
answers question: http://stackoverflow.com/q/27178431
has comment: http://stackoverflow.com/comment/42846390
upvote count: 3
score: 3
has body: You can add your (normal) user to the group systemd-journal using usermod -a -G systemd-journal &lt;username&gt;. Logout and login to it for the change to take effect. This gives your user access to the system journal files without giving it complete root privileges. The group may be different for different operating system setups. You can simply take a look at which group the journal files belong to, by using ls -l /var/log/journal/ or ls -l /run/systemd/journal/ if /var/log/journal/ does not exist. I have tried this in Centos LiveCD, and the group the files belonged to was root. So you can add the user to group root, which is not the same as giving it full root permissions. Nevertheless, I suppose a better route to go would be to set ACLs on the journal files to allow a particular group to access them, because the root group may have access to a little bit too much. The manual for systemd-journald.service gives this example ACL modification command, that grants read access to the journal to wheel and adm: setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/
has comment: http://stackoverflow.com/comment/42853529
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42848126

http://stackoverflow.com/comment/42980368
comment on: http://stackoverflow.com/a/27252412
score: 0
type: AnswerComment
type: Comment
has text: Your answer looks good, but could you add an explanation for how this fixes the OPs problem?

http://stackoverflow.com/comment/43054488
type: QuestionComment
comment on: http://stackoverflow.com/q/27294864
score: 3
has text: How is it supposed to handle this: `String s = "abcwxyzabctuvwxyz";`, `s.replaceAll("xyz", "123");`
type: Comment

http://stackoverflow.com/a/27196031
has body: From what I can see, that code should work fine so I suspect your problem lies in your test cases rather than here. One thing I will mention is that use of if-return-else constructs tend to complicate your code unnecessarily. It's usually better to avoid that with something like: public static boolean search( int[] findIn, int target, int len) { if (len == 0) return false; if (findIn[len-1] == target) return true; return search(findIn, target, len-1); } I find that a lot easier to follow at a glance than trying to track what if clause I happen to be in at any given moment. In any case, both it and your version perform fine, at least for small test cases. The first time you pass in a ten-million-element array is probably when you'll discover it's not the best poster child for recursion.
score: 0
answers question: http://stackoverflow.com/q/27195883
type: Answer

http://stackoverflow.com/q/27227849
has comment: http://stackoverflow.com/comment/42933151
has title: insert into timestamp oracle column from java
has answer: http://stackoverflow.com/a/27228114
answer count: 1
accepted answer: http://stackoverflow.com/a/27228114
tagged with: oracle-database
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42933339
has comment: http://stackoverflow.com/comment/42933215
has body: i got a table made in this way CREATE TABLE WS_NAPACQ00T ( IDE_IDEN varchar2(20) PRIMARY KEY NOT NULL, CLB_CXML CLOB, SYS_DATE TIMESTAMP ); and this java code to put in dt_date current date. Timestamp dt_date = new Timestamp(System.currentTimeMillis()); String insertXML = "insert into WS_NAPACQ00T (IDE_IDEN, CLB_CXML, SYS_DATE) values ('10', 'test', '"+dt_date+"' ) "; result = statement.executeQuery(insertXML); the error is: "not a valid month" how can i resolve?
score: 0

http://stackoverflow.com/comment/43059109
comment on: http://stackoverflow.com/a/27295412
score: 0
type: AnswerComment
type: Comment
has text: This is far beyond my knowledge ! AFAIK there is no notion of `@Order` in RequestMapping annotated controller. But according to [this other anwser](http://stackoverflow.com/a/14443490/3545273), the order of mapping discovery is the order of bean creation. As ProjectSpecific depends on Base, it will be discovered after. My advice is to add a comment in a red flashing font for the case where you come back there later ...

http://stackoverflow.com/comment/42892413
score: 0
type: Comment
type: QuestionComment
has text: thats the most of the section with what was asked for
comment on: http://stackoverflow.com/q/27204927

http://stackoverflow.com/comment/124249994
type: AnswerComment
has text: In IntelliJ IDEA 2021 from the main menu: Code > Analyze Code > Module Dependencies..
type: Comment
score: 6
comment on: http://stackoverflow.com/a/27296608

http://stackoverflow.com/comment/42894886
comment on: http://stackoverflow.com/a/27200823
type: Comment
has text: hi, thanks for replying.how do we get this caps text to be input into a text box.I tried the same as u suggested along with sendKeys, it did not work.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27195138
downvote count: 1
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27195070
has body: BufferedReader reader = new BufferedReader(new FileReader("somefile.txt")); int ch; char charToSearch='a'; int counter=0; while((ch=reader.read()) != -1) { if(charToSearch == (char)ch) { counter++; } }; reader.close(); System.out.println(counter); Reference: Counting letter occurrence
answers question: http://stackoverflow.com/q/27195070
upvote count: 3
type: Answer

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/27306777

http://stackoverflow.com/comment/42946832
has text: @HotLicks array of array is just a multi-dimensional array but javascript is a very different language than java what works in javascript doesn't necessarily translate directly to Java...in this case it doesn't...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27234519
score: 0

http://stackoverflow.com/q/27262483
score: -1
has comment: http://stackoverflow.com/comment/42997591
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am trying to read the file twice but it seems only the first while loop is running.Basically, I have used the first while loop to count elements and I assigned the size of the array. I have used the second one to call the method and pass the string(each element). I tried to perform both tasks by using one while loop but I am having a difficulty to set the size of the array. Please help if anyone knows how to do it. I am looking to hear from you guys. Thank you in advance public static void main(String[] args)throws Exception { Scanner scan = new Scanner(new FileReader("first.txt")); int count = 0; while(scan.hasNext()) { count ++; String s = scan.next(); } ArrayList&lt;String&gt; []words = new ArrayList[count]; while(scan.hasNext()) { String f = scan.next(); hash(f,count); //call method } scan.close(); //System.out.println(count); }
upvote count: 0
has comment: http://stackoverflow.com/comment/42997577
tagged with: java
has comment: http://stackoverflow.com/comment/42998464
downvote count: 1
type: Question
has title: How to read a file twice
has answer: http://stackoverflow.com/a/27262538
has comment: http://stackoverflow.com/comment/42998274

http://stackoverflow.com/comment/43078021
comment on: http://stackoverflow.com/a/27307772
score: 0
type: AnswerComment
type: Comment
has text: OK. This is starting to make some more sense. But, question: I'm trying to add a button below other components. I don't want it to occupy just first column, because I don't want it to resize the first column. Is this possible? It would make sense to use two columns (i.e. gridwidth = 2), but this doesn't work.

http://stackoverflow.com/a/27254196
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27254147
has body: Your line: JSONArray diaList = jsonRes.getJSONArray("list"); //exception thrown Should be: JSONArray diaList = jsonObj.getJSONArray("list"); //all good!
downvote count: 0

http://stackoverflow.com/a/27286665
has comment: http://stackoverflow.com/comment/43041873
has comment: http://stackoverflow.com/comment/43040618
type: Answer
answers question: http://stackoverflow.com/q/27286586
has comment: http://stackoverflow.com/comment/43041208
has comment: http://stackoverflow.com/comment/43041040
has comment: http://stackoverflow.com/comment/43041021
score: 0
has body: You're calling the function getSalaries() which returns an array. You should be calling ssObj.getAllSalaries(). The string you're getting is probably a reference to the salaries array object.

http://stackoverflow.com/a/27157419
has comment: http://stackoverflow.com/comment/42809166
type: Answer
has comment: http://stackoverflow.com/comment/42809134
answers question: http://stackoverflow.com/q/27157292
has comment: http://stackoverflow.com/comment/42814123
has comment: http://stackoverflow.com/comment/42814006
has comment: http://stackoverflow.com/comment/42811991
has comment: http://stackoverflow.com/comment/42815299
score: 0
has body: Did you try to split with a lookbehind assertion?: (?&lt;== [0-9]{1,1000} =) or use find with: \\[.*?(?:= [0-9]+ =|$)

http://stackoverflow.com/a/27253542
upvote count: 1
has body: Problem solved. Another component was including spring boot jar which was as a dependency including tomcat 7.0.54 libraries.
accepted answer of: http://stackoverflow.com/q/27250100
answers question: http://stackoverflow.com/q/27250100
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/27225499
has title: How to get "last saved by" Office file attribute in Java
tagged with: xslf
score: 4
upvote count: 4
answer count: 2
has body: I am trying to get the "last saved by" attribute from MS Office 2013 file(docx, xlsx, pptx ...). I am using Apache POI, but I can get only the Author of the file with the following code: OPCPackage pkg = OPCPackage.open(file); POIXMLProperties props = new POIXMLProperties(pkg); props.getCoreProperties().getCreator(); Is there a way to get "last saved by" attribute?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27226317
has answer: http://stackoverflow.com/a/27225793
type: AnsweredQuestion
tagged with: apache-poi
possible better answer: http://stackoverflow.com/a/27225793
tagged with: java
accepted answer: http://stackoverflow.com/a/27226317
type: Question

http://stackoverflow.com/a/27212462
has comment: http://stackoverflow.com/comment/42905688
type: Answer
has comment: http://stackoverflow.com/comment/42905779
has body: it's not really a fair comparison as in the array you're adding int (primitive type) while in the list you're implicitly adding Integer (object), which are more heavyweight. A fair comparison would be Integer[] instead of int[]. Autoboxing will take care of the conversions so this is all you need to change to make for a valid comparison. Likely the print operation requires objects after all, so outputting the array requires more time there creating the objects, whereas the list already has them at that point.
answers question: http://stackoverflow.com/q/27212423
has comment: http://stackoverflow.com/comment/42905783
has comment: http://stackoverflow.com/comment/42905730
score: 0

http://stackoverflow.com/q/27164907
has comment: http://stackoverflow.com/comment/42822200
favorite count: 0
has answer: http://stackoverflow.com/a/27165791
type: UnansweredQuestion
has body: I have a Java program that contains multiple classes, all of which extend JPanel (except for the class containing the main method). I am trying to pass int variables from one class to another and, using some previously asked questions, came up with this: Class RollPanel public int getbrainCount() { return brainCount; } Class BrainsPanel (where I am trying to send the variable) void setbrainCount() { RollPanel rollpanel = new RollPanel(); brainCount = rollpanel.getbrainCount(); } This doesn't give any errors, but when I add brainCount to a label to see its value, it is always 0. brainCount is declared at the class level of RollPanel, then given a value with this code which is in a button listener: value1 = generator.nextInt(3) + 1; value2 = generator.nextInt(3) + 1; value3 = generator.nextInt(3) + 1; //rollTotal++; //Counts how many brains were rolled. if (value1 == 1) brainCount++; if (value2 == 1) brainCount++; if (value3 == 1) brainCount++; I understand that just declaring a variable will automatically mean its value will be zero at first(which I assume is why it is displayed as zero), but how can I pass its updated value after the above code to brainsPanel so I can add its value to a label in brainsPanel? Would getBrainCount() come after the button listener? I feel like I'm overlooking something simple here... EDIT: I think the problem isn't with the setter as it is the getter. Since in RollPanel(where the getter is) I declare brainCount as an int its initial value is 0, so when the getter gets the value it always remains at 0 even though brainCount should be altered in the button listener. Here is RollPanel in its entirety. How can I make the getter get the updated value of brainCount instead of its initial 0? package zombiedice; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; public class RollPanel extends JPanel { JLabel die1Label, die2Label, die3Label, testLabel; JButton rollButton, sortButton; JPanel dicePanel, buttonPan…
has comment: http://stackoverflow.com/comment/42842253
upvote count: 1
has comment: http://stackoverflow.com/comment/42822173
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42842489
answer count: 2
downvote count: 0
tagged with: variables
has title: Passing variables to another classes (Java)
has comment: http://stackoverflow.com/comment/42842289
has answer: http://stackoverflow.com/a/27166082

http://stackoverflow.com/comment/43027469
comment on: http://stackoverflow.com/q/27277667
score: 0
has text: I'm surprised your container isn't doing the decoding for you. You can use `URLDecoder`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27313148
has body: I suspect the for-loop and the counter inside it and the way you create a n ew instance of the thread. I would do it that way. for (int i = 1; i &lt;= logfile.getTotalLines(); i++) { t = new Thread(threadFile, "logFile_Thread_" + i); t.start(); } static Runnable threadFile = new Runnable() { public void run() { // TODO Auto-generated method stub ++currentLine; timer.schedule(new timedTask(), (long) logfile.getFileHash().get(currentLine).getTimeStampInMilli()); } }; Because the counter in the for-loop, will get always its maximum value wihch will be applied to all the Timertasks. in other words, if yu have a loop for 5 iterations the counter will get its maximum value depending on how the counter was initalised and then this counter values you use it to parse a specific datat from your file which means you alwas get the value frm the last line then apply it to the timerTask
has comment: http://stackoverflow.com/comment/43087361
has comment: http://stackoverflow.com/comment/43086668
has comment: http://stackoverflow.com/comment/43086984
type: Answer
has comment: http://stackoverflow.com/comment/43088611
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43087662
answers question: http://stackoverflow.com/q/27312350
has comment: http://stackoverflow.com/comment/43086830
has comment: http://stackoverflow.com/comment/43086726
upvote count: 1

http://stackoverflow.com/q/27190283
has comment: http://stackoverflow.com/comment/42866831
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42866740
favorite count: 0
has body: Suppose I have n boolean values, where n is a relatively small number (3-5 or so). Let's say that the values are properties of a class, each of which can be set or unset independently. So, there are 2n possible combinations. Now I want to distinguish between these combinations in a switch-like fashion. Currently, I usually do something like this: int mask = (bool1 ? 1 : 0) + (bool2 ? 2 : 0) + (bool3 ? 4 : 0) + ... ; switch (mask) { case 0b000: // all variables false case 0b001: // only bool1 true case 0b011: // only bool1 and bool2 true ... } This works all right, but I do not find it very elegant. Is there some best practice (in Java) or Java idiom for cases like this?
tagged with: idioms
has comment: http://stackoverflow.com/comment/42886281
type: UnansweredQuestion
score: 6
upvote count: 6
has title: Switch construct for combinations of booleans
has answer: http://stackoverflow.com/a/27218409
tagged with: java
has comment: http://stackoverflow.com/comment/42886312
has comment: http://stackoverflow.com/comment/42866944
type: Question
has comment: http://stackoverflow.com/comment/42866796
has comment: http://stackoverflow.com/comment/42886219
has comment: http://stackoverflow.com/comment/42886175

http://stackoverflow.com/a/27268745
score: 1
upvote count: 1
has body: Unfortunately, this method is not available before API 18. Even with the use of reflection, the method is not available. If you want use this method, you can use a workaround from SherlockNavigationDrawer library : try { setHomeAsUpIndicator = ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator", Drawable.class); setHomeActionContentDescription = ActionBar.class.getDeclaredMethod( "setHomeActionContentDescription", Integer.TYPE); // If we got the method we won't need the stuff below. return; } catch (NoSuchMethodException e) { // Oh well. We'll use the other mechanism below instead. } final View home = activity.findViewById(android.R.id.home); if (home == null) { // Action bar doesn't have a known configuration, an OEM messed with things. return; } final ViewGroup parent = (ViewGroup) home.getParent(); final int childCount = parent.getChildCount(); if (childCount != 2) { // No idea which one will be the right one, an OEM messed with things. return; } final View first = parent.getChildAt(0); final View second = parent.getChildAt(1); final View up = first.getId() == android.R.id.home ? second : first; if (up instanceof ImageView) { // Jackpot! (Probably...) upIndicatorView = (ImageView) up; } Source: https://github.com/nicolasjafelle/SherlockNavigationDrawer/blob/master/SherlockNavigationDrawer/src/com/sherlock/navigationdrawer/compat/SherlockActionBarDrawerToggleHoneycomb.java#L97 As you can see, if it is not possible to access methods, he try to directly get the ImageView. When you have it, you can directly do a setContentDescription or whatever you want.
answers question: http://stackoverflow.com/q/27246978
accepted answer of: http://stackoverflow.com/q/27246978
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43185728
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27327002
type: AnswerComment
has text: Tried it. Throws the following error: with-clause not allowed on fetched associations; use filters. I'm looking for filters now but I don't think it's possible to use them with Spring Data JPA.

http://stackoverflow.com/a/27193842
score: -2
has body: Try \\t instead of \t. Split function needs to see the escape character.
downvote count: 3
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27193812

http://stackoverflow.com/q/27298224
tagged with: jsoup
upvote count: 0
has answer: http://stackoverflow.com/a/27305669
answer count: 1
tagged with: objective-c
favorite count: 0
has body: How to translate jsoup to Objective-C? I'm a newbie and much unfamiliar with Java. Recently I'd like to use jsoup in my iOS project by j2objc, but it seems hard for me. When I execute cd /path/to/jsoup-master j2objc -sourcepath ./src/main/java -classpath /Users/wildcat/Downloads/j2objc-0.9.5/lib/javax.inject-1.jar -d ./src/main/ojbc ./src/main/java/org/jsoup/*/*.java There are many packages not found, such as org.w3c.dom . I downloaded these files about org.w3c.dom but there are so many packages not found that it's difficult to handle it. They maybe belong to the standard libs of Java such as javax.net , how could I finished the translation of jsoup? Is that possible? Thanks!
score: -2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27305669
tagged with: java
downvote count: 2
type: Question
has title: How to translate jsoup to Objective-C?
tagged with: j2objc

http://stackoverflow.com/a/27157331
accepted answer of: http://stackoverflow.com/q/27153987
upvote count: 1
has body: If the location starts with http:, https:, mailto:, file:, ftp: then it's used as a final location to redirect using response.sendRedirect(). Parameters in the result using &lt;param&gt; tag in this case are ignored.
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27153987
type: Answer

http://stackoverflow.com/comment/42828954
has text: You are not the first with this issue. In fact everybody meets it. I have no code at hand at the moment. Google/search for 'convert gallery/mediastore path to file path'.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27168558
score: 1

http://stackoverflow.com/a/27289581
accepted answer of: http://stackoverflow.com/q/27289245
type: Answer
score: 0
has body: I would suggest creating a holder class, that holds an OSD object, which in turns implements Comparable public class OSDHolder implements Comparable&lt;OSDHolder&gt; { private final OSD obj; public OSDHolder(OSD obj) { this.obj = obj; } public long getTiming() { this.obj.getUpdatedOn().getTime(); } @Override public int compareTo(OSDHolder o) { if (this.getTiming() &gt; o.getTiming()) return 1; else if (this.getTiming &lt; o.getTiming()) return -1; return 0; } } Then you can simply add the contents of both lists to one list as OSDHolder type ArrayList&lt;OSDHolder&gt; holders = new ArrayList&lt;&gt;(); for (OSD osd:awbThingTypeOSDs) { holders.add(new OSDHolder(osd)); } for (OSD osd:LDDthingTypeOSDs) { holders.add(new OSDHolder(osd)); } Then sort holders with either Collections.sort() or Arrays.sort()
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27289245

http://stackoverflow.com/a/27191576
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/27191495
has body: The line in the stacktrace: at CreateDB.createTables(CreateDB.java:35) Tells you the line in you code that the error occurs at. My guess is that line 35 is: statement.execute("DROP TABLE Auditorium"); You can't drop a table that doesn't exist. Try: statement.execute("DROP TABLE IF EXISTS Auditorium");
downvote count: 0

http://stackoverflow.com/a/27228190
score: 4
has comment: http://stackoverflow.com/comment/42933623
type: Answer
accepted answer of: http://stackoverflow.com/q/27227951
answers question: http://stackoverflow.com/q/27227951
has body: You can deploy your webapp to tomcat directly from Eclipse: 1st. Open the "Servers" view in Eclipse, and it will allow you to configure a tomcat instance. 2nd. Add your webapp to the tomcat Then you can debug and hot deploy any changes to the project.
has comment: http://stackoverflow.com/comment/131997423
upvote count: 4
has comment: http://stackoverflow.com/comment/83303221
type: AcceptedAnswer
downvote count: 0

paypal
tags question: http://stackoverflow.com/q/27183847
tags question: http://stackoverflow.com/q/27275250
type: Tag
tags question: http://stackoverflow.com/q/27192265
tag name: paypal

http://stackoverflow.com/q/27202171
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27202194
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27202249
tagged with: loops
type: Question
tagged with: datagram
possible better answer: http://stackoverflow.com/a/27202249
has title: Kill a Thread working with flag in Java
answer count: 2
tagged with: while-loop
has answer: http://stackoverflow.com/a/27202194
downvote count: 0
has body: I implemented my own Thread in Java this way : public class MyThread extends Thread{ protected boolean exit = false; protected void kill(){ exit = true; } } So when I create a thread, the method run() looks like : public void run() { ... while(!exit) { ... } } My question is the following : I'm using my thread class to receive and send datagrams. But when the thread is waiting for a datagram, if I call the function MyThread.kill(), the thread will still wait a next packet before ending itself... How can I kill my thread without waiting for an another packet ? Thank you very much
favorite count: 0

http://stackoverflow.com/a/27216263
score: 0
answers question: http://stackoverflow.com/q/27216018
type: Answer
has body: you could also use this pattern to capture text between ", " , |([^\]\[]+?)(?=, |\]) Demo , # ", " | # OR ( # Capturing Group (1) [^\]\[] # Character not in [^\]\[] +? # (one or more)(lazy) ) # End of Capturing Group (1) (?= # Look-Ahead , # ", " | # OR \] # "]" ) # End of Look-Ahead

http://stackoverflow.com/comment/43034829
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27283134
has text: @SanjayT.Sharma I know that. That's why I use 128 for example and not 127, which is explained in other Q/As.
score: 1

http://stackoverflow.com/a/27210618
accepted answer of: http://stackoverflow.com/q/27205256
score: 14
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/103498295
has body: You need to specify your definition of a week. String Representation Of A Year-Week One option is strings. The ISO 8601 standard defines a week as beginning on a Monday, ending on Sunday, with the first week of the year being the first to contain a Thursday, resulting in 52 or 53 weeks a year. The standard also defines a string representation for this week-of-year span of time in the format of YYYY-Www (or omitting hypen, YYYYWww) such as 2014-W07. A day within the week is represented by a digit where Monday is 1 and Sunday is 7, in the format YYYY-Www-D (or omitting hyphen, YYYYWwwD) such as 2014-W07-2 (a Tuesday in 7th week of year). The W is important to disambiguate from a year-month such as 2014-07 being July of 2014. java.time The java.time package built into Java 8 and later is inspired by Joda-Time but entirely re-architected. See Tutorial. In java.time, an Instant is a moment on the timeline in UTC. Apply a time zone (ZoneId) to get a ZonedDateTime. Use LocalDate to get a date-only value with no time-of-day and no time zone. Note that determining the first moment of a day in java.time requires an extra step when compared to Joda-Time: We must go through the LocalDate class to call its atStartOfDay method. ZoneId zoneId = ZoneId.of ( "America/Montreal" ); ZonedDateTime now = ZonedDateTime.now ( zoneId ); LocalDate firstDayOfThisWeek = now.toLocalDate ().with ( DayOfWeek.MONDAY ); LocalDate firstDayOfNextWeek = firstDayOfThisWeek.plusWeeks ( 1 ); ZonedDateTime thisWeekStart = firstDayOfThisWeek.atStartOfDay ( zoneId ); ZonedDateTime nextWeekStart = firstDayOfNextWeek.atStartOfDay ( zoneId ); Unfortunately, java.time lacks the equivalent of Joda-Time's Interval. Fortunately we have ThreeTen Extra, the project that extends java.time (310 being the number of the JSR defining java.time). This library includes an Interval class that integrates with java.time. This Interval class is more limited than that of Joda-Time as it supports only Instant objects without tim…
type: Answer
answers question: http://stackoverflow.com/q/27205256
upvote count: 14

http://stackoverflow.com/a/29646809
type: Answer
downvote count: 2
has comment: http://stackoverflow.com/comment/62974400
score: 13
has comment: http://stackoverflow.com/comment/62954705
upvote count: 15
has body: I solved this problem by adding the following flag: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#setHasStableIds(boolean)
answers question: http://stackoverflow.com/q/27188536

http://stackoverflow.com/comment/42882678
type: Comment
has text: Thanks for the reply.My class PayloadProcessorTest.java has some dependencies means my class methods calling some other class methods and those classes connected to database by using properties file configurations. I need all those classes and dependents to a jar. I used maven-assembly plugin but it created jar for only PayloadProcessorTest.class.I am updating my plugin above. can you plase tell me how can i get jar for PayloadProcessorTest with all dipendent classes
comment on: http://stackoverflow.com/a/27165214
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43115821
score: 0
has text: if i dont do the unregister thing..does that error can cause a problem to the app ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27299144

http://stackoverflow.com/comment/43194734
has text: I did as you suggested and called the compiler directly. I called Maven with the -X option and in Maven's logs I was able to spot the call it makes to the GWT compiler. Now I'm able to execute that call without invoking Maven which saves me about 5 seconds. Thanks a lot =)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27290233
type: AnswerComment

http://stackoverflow.com/comment/42849108
has text: @ghostrider great :) it happens to everyone once in a while!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27180264
type: Comment

formatting
tags question: http://stackoverflow.com/q/27157445
tag name: formatting
type: Tag

http://stackoverflow.com/q/27208716
has title: Sort String[] array based on number present in the String
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42899377
has answer: http://stackoverflow.com/a/27208892
accepted answer: http://stackoverflow.com/a/27208892
type: Question
answer count: 2
tagged with: arrays
downvote count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/27208775
has comment: http://stackoverflow.com/comment/42899369
has answer: http://stackoverflow.com/a/27208775
has body: I have an array that looks like: array[] = {1c, 13d, 11d, 10d, 1h, 13h, 5s, 2s, 12d} I want to sort the array based on the number present in the array So the end result would be: {1c, 1h, 2s, 5s, 10d, 11d, 12d, 13d, 13h} Is there a way to do it?
has comment: http://stackoverflow.com/comment/42899362
score: -3
type: AnsweredQuestion

http://stackoverflow.com/a/27183675
score: 1
upvote count: 1
has body: For accessing classes of different projects you may require to build jar file of that project i.e. P1 and put that jar file into build path of another project let's say P2. Than build P2 project. Now your are able to access classes of P1 Project into Project P2.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27183437

http://stackoverflow.com/a/27212258
accepted answer of: http://stackoverflow.com/q/27212167
type: AcceptedAnswer
downvote count: 0
has body: Mat.mul() does a per element mutiplication (same as Core.multiply()), and both Mat's need to have the same dimensions for that. what you obviously wanted, is the 'matrix multiplication'. while this would be a simple mat*vec in c++, in java you have to use gemm for this: Mat r = new Mat(2, 2, CvType.CV_32F); r.put(0, 0, 0.707); r.put(0, 1, -0.707); r.put(1, 0, 0.707); r.put(1, 1, 0.707); Mat v = new Mat(1, 2, CvType.CV_32F); double d1 = 1.00; double d2 = 2.00; v.put(0, 0, d1); v.put(0, 1, d2); Mat final_mat = new Mat(); Core.gemm(v,r,1,new Mat(),0,final_mat); System.err.println(final_mat.dump()); [2.1210001, 0.70700002]
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/27212167
score: 6

http://stackoverflow.com/comment/69922234
type: Comment
has text: I tried your solution but it is setting a number value as string. Any solution to this? eg : tried to set login count to 1, it was returned as : "loginCount":"1"
score: 0
comment on: http://stackoverflow.com/a/28691028
type: AnswerComment

sqlite
tags question: http://stackoverflow.com/q/27287814
tags question: http://stackoverflow.com/q/27208805
tags question: http://stackoverflow.com/q/27217352
tags question: http://stackoverflow.com/q/27309066
tags question: http://stackoverflow.com/q/27294772
tags question: http://stackoverflow.com/q/27253029
tags question: http://stackoverflow.com/q/27278537
tags question: http://stackoverflow.com/q/27191610
tags question: http://stackoverflow.com/q/27175539
type: Tag
tags question: http://stackoverflow.com/q/27238530
tags question: http://stackoverflow.com/q/27218985
tags question: http://stackoverflow.com/q/27155926
tags question: http://stackoverflow.com/q/27180211
tags question: http://stackoverflow.com/q/27271387
tags question: http://stackoverflow.com/q/27294637
tags question: http://stackoverflow.com/q/27186211
tags question: http://stackoverflow.com/q/27278394
tags question: http://stackoverflow.com/q/27179848
tags question: http://stackoverflow.com/q/27276943
tags question: http://stackoverflow.com/q/27296969
tags question: http://stackoverflow.com/q/27215714
tags question: http://stackoverflow.com/q/27301539
tags question: http://stackoverflow.com/q/27303857
tags question: http://stackoverflow.com/q/27201388
tags question: http://stackoverflow.com/q/27256881
tags question: http://stackoverflow.com/q/27169361
tags question: http://stackoverflow.com/q/27212788
tags question: http://stackoverflow.com/q/27217575
tags question: http://stackoverflow.com/q/27303300
tags question: http://stackoverflow.com/q/27199470
tags question: http://stackoverflow.com/q/27231624
tags question: http://stackoverflow.com/q/27158769
tags question: http://stackoverflow.com/q/27163845
tags question: http://stackoverflow.com/q/27257862
tags question: http://stackoverflow.com/q/27195404
tags question: http://stackoverflow.com/q/27216443
tags question: http://stackoverflow.com/q/27292088
tag name: sqlite

http://stackoverflow.com/a/27259577
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/27259411
has body: Because another class needs to be able to invoke it.
score: -1

http://stackoverflow.com/comment/42875324
type: QuestionComment
comment on: http://stackoverflow.com/q/27195039
has text: Try a for loop, counting from 10 down to 5. Inside the loop, another loop which does a sysout of stars.
score: 0
type: Comment

http://stackoverflow.com/comment/42836870
type: Comment
comment on: http://stackoverflow.com/a/27173360
has text: this changed total_list too.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42927698
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27188424
score: 0
has text: Sorry i am not sure what you mean, but if you mean the framework i am using then no i haven't got a problem. i just dont know how to configure the filter that is all.

http://stackoverflow.com/a/27166828
has comment: http://stackoverflow.com/comment/43150996
answers question: http://stackoverflow.com/q/27165484
has comment: http://stackoverflow.com/comment/42853683
has comment: http://stackoverflow.com/comment/42825883
has comment: http://stackoverflow.com/comment/42828253
has comment: http://stackoverflow.com/comment/42828022
has body: If your problem is it looks ambiguous when you call foo(v,m) that people may mistakenly wrote foo(m,v) without any warning or visible clue of error, you may use a fluent-builder-like pattern: (Code not tested, just wrote to demonstrate the idea) public class MyClass { public class FooStub { int volume; int weight; public FooStub withVolume(int v) { this.volume = v; return this; } public FooStub withWeight(int w) { this.weight = w; return this; } public int run() { // or call it getResult() or whatever you want Assert.notNull(volume); Assert.notNull(weight); return foo(volume,weight); // calling method of outer class } } public int foo(int volume, int weight) { // you even hide this if you want return volume * weight; } public FooStub foo() { return new FooStub(); } } By doing so, caller can do MyClass myObj = ....; int result = myObj.foo().withVolume(a).withWeight(b).run(); // which is the same as result = myObject.foo(a,b);
score: 0
has comment: http://stackoverflow.com/comment/42825740
has comment: http://stackoverflow.com/comment/42828316
has comment: http://stackoverflow.com/comment/42828345
type: Answer
has comment: http://stackoverflow.com/comment/42825677

http://stackoverflow.com/comment/42916747
type: Comment
has text: Usually you simply compare the hash, but decryption would amount to the same thing, when performed properly. You could use decryption or - even better - an additional key derivation if you want to use the password for different purposes, but usually the hash is simply compared.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27215356

http://stackoverflow.com/q/27242095
tagged with: text
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42960345
score: -1
has comment: http://stackoverflow.com/comment/42960351
upvote count: 0
answer count: 1
has body: This is part of a program that will count the occurrences of each letter within the text file. I want it to print something like A:4 B:23 C:32 and instead it prints A:0B:0C:0A:0B:0C:0A:0B:0C:0 which does not even find all of the occurrences of each letter. What am I doing wrong here? Thanks for the help!! char ch = line.charAt(0); int Acounter=0; int Bcounter=0; int Ccounter=0; switch (ch) { case 'A': Acounter++; break; case 'B': Bcounter++; break; case 'C': Ccounter++; break; } bw.write ("A:" + Acounter); bw.write ("B:" + Bcounter); bw.write ("C:" + Ccounter);
has title: Java: Count occurrences of characters in text file
favorite count: 0
tagged with: character
type: UnansweredQuestion
tagged with: count
has answer: http://stackoverflow.com/a/27242832

http://stackoverflow.com/a/27309373
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27309339
answers question: http://stackoverflow.com/q/27309339
score: 0
type: AcceptedAnswer
has body: You can use the key from your iteration over the first map to get the value for the second one: double sum = 0.00; for (Map.Entry&lt;String, Double&gt; hm : hm1.entrySet()) { double hm2Value = hm2.get(hm.getKey()); sum += hm.getValue() * hm2Value; } Note that this only works if both maps have the same keys. If keys are missing in either, then you have to think about how to deal with that.
type: Answer
has comment: http://stackoverflow.com/comment/43080331
upvote count: 1

http://stackoverflow.com/comment/43076264
type: QuestionComment
has text: A quick glance at the javadoc would have given you the answer!
type: Comment
comment on: http://stackoverflow.com/q/27306971
score: 0

http://stackoverflow.com/a/27287763
score: 1
has body: The reason that it gets stuck is that it waiting to read a line that was sent to this from the other end. There is nothing coming so it is getting stuck. In order for it to not be stuck if there is no data forthcoming on it, you could set a socket timeout. Note that the socket will still be valid. Here it is: socket.setSoTimeout(200); // Add this below the socket creation line. Timeout of 200 ms. And try { String serverMessage = in.readLine(); // it will timeout in 200 ms if (serverMessage != null) { System.out.println(serverMessage); } } catch (SocketTimeoutException e) // log } Please update the timeout to whatever is required but do make sure that it is not too little in that it would loop like crazy. Hope this helps.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27287351

http://stackoverflow.com/comment/42908700
comment on: http://stackoverflow.com/a/27214142
has text: Output is as following `/home/karl/workspace/sslarp/lib:/home/karl/workspace/sslarp/lib`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42902570
score: 0
type: Comment
has text: That seems to be a trend. Every teacher I ever had was far worse at programming than any entry level programmer I have met.
type: AnswerComment
comment on: http://stackoverflow.com/a/27209588

http://stackoverflow.com/q/27192184
has comment: http://stackoverflow.com/comment/42912164
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/2946338
score: -1
tagged with: class
has answer: http://stackoverflow.com/a/27192698
has comment: http://stackoverflow.com/comment/42870493
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/42870697
has title: Class.forName() throws ClassNotFoundException
has body: So this is my first time posting, please be gentle :3 General overview: My goal is to be able to give my program a XSD file, then the program generates a bean, generates a nice GUI using reflection on the bean, then I can enter appropriate values into the textfields and then the program updates the bean with the values and finally marshalls the bean into a nice XML. It's coming along pretty good, but yesterday I stumbled over an error that I can't figure out.. StackTrace java.lang.ClassNotFoundException: X.Y.Z.BEAN_FILE_WITHOUT_.JAVA at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at X.Y.Z.GenerateXMLService.generateBean(GenerateXMLService.java:101) at X.Y.Z.view.Gui$1.handle(Gui.java:56) at X.Y.Z.view.Gui$1.handle(Gui.java:1) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown S…
favorite count: 0
has comment: http://stackoverflow.com/comment/42870234
accepted answer: http://stackoverflow.com/a/27192698
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42870807
tagged with: java
has comment: http://stackoverflow.com/comment/42870735
type: Question

groovy
tags question: http://stackoverflow.com/q/27208003
tags question: http://stackoverflow.com/q/27313433
tags question: http://stackoverflow.com/q/27290213
tags question: http://stackoverflow.com/q/27209577
type: Tag
tags question: http://stackoverflow.com/q/27168201
tags question: http://stackoverflow.com/q/27186334
tags question: http://stackoverflow.com/q/27183782
tags question: http://stackoverflow.com/q/27237677
tags question: http://stackoverflow.com/q/27306176
tags question: http://stackoverflow.com/q/27250386
tags question: http://stackoverflow.com/q/27239028
tags question: http://stackoverflow.com/q/27313529
tags question: http://stackoverflow.com/q/27304580
tags question: http://stackoverflow.com/q/27159905
tags question: http://stackoverflow.com/q/27217944
tags question: http://stackoverflow.com/q/27297904
tags question: http://stackoverflow.com/q/27212499
tag name: groovy

http://stackoverflow.com/q/27195039
has answer: http://stackoverflow.com/a/48953806
has answer: http://stackoverflow.com/a/27195159
score: -3
has answer: http://stackoverflow.com/a/27195102
has body: I want to write a program that prints out the following pattern by using loop. Right now I am able to print it by using only system.out.println. I have no idea which loop I should make. The pattern will be: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * My code: package pettern; public class Pettern { public static void main(String[] args) { //initializing String tenStar = "* * * * * * * * * *"; String NineStar = "* * * * * * * * *"; String EightStar = "* * * * * * * *"; String SevenStar = "* * * * * * *"; String SixStar = "* * * * * *"; String FiveStar = "* * * * *"; //printing them out System.out.println(tenStar); System.out.println(NineStar); System.out.println(EightStar); System.out.println(SevenStar); System.out.println(SixStar); System.out.println(FiveStar); } }
possible better answer: http://stackoverflow.com/a/27195154
has title: How to make a loop to print the following pattern?
tagged with: while-loop
tagged with: for-loop
has answer: http://stackoverflow.com/a/27195154
type: AnsweredQuestion
upvote count: 0
tagged with: string
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/22681510
accepted answer: http://stackoverflow.com/a/27195102
has comment: http://stackoverflow.com/comment/42875324
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/27195189
tagged with: loops
has comment: http://stackoverflow.com/comment/42875380
answer count: 5

http://stackoverflow.com/q/27159398
has answer: http://stackoverflow.com/a/27162450
has title: Integrating JSP with Apache SOLR
score: 0
has comment: http://stackoverflow.com/comment/42813302
answer count: 1
type: UnansweredQuestion
tagged with: jsp-tags
has body: Can someone help me with integrating JSP with Apache SOLR? I am new to Apache SOLR and havn't used JSP much in recent years but know the working of it. I have developed the UI in JSP and want to accept the user query from JSP and query them in Apache SOLR. Thanks in advance.
tagged with: java
tagged with: solr
has comment: http://stackoverflow.com/comment/42812750
type: Question
tagged with: apache
tagged with: jsp

http://stackoverflow.com/comment/42978380
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27251847
type: AnswerComment
has text: try find(), without arguments

http://stackoverflow.com/q/27204532
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/27204607
has comment: http://stackoverflow.com/comment/42892056
downvote count: 6
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/42892021
upvote count: 1
type: Question
has body: I want increase the numbers in a string. For example; I want to modify "HTML[0].BODY[0]/UL[1]/LI[10]/A[1]" to "HTML[1].BODY[1]/UL[2]/LI[11]/A[2]" Note: I accept the answer, but I want to add my tryings; replace("8", "9").replace("7", "8").replace("6", "7").replace("5", "6").replace("4", "5").replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1") and I realize that 9 could not change so I tried for(int i=0;i&lt;s.length();i++){ if (Character.isDigit(s.charAt(i))) { int a=Integer.parseInt(s, s.charAt(i))+1; s.charAt(i)=(char)a; System.out.println(s.charAt(i)); } } This did not work also.. second note: Generally, I tried to write all codes, and due to points I get an warning. And I did not want to write part of codes
has comment: http://stackoverflow.com/comment/42891999
has answer: http://stackoverflow.com/a/27204607
has title: extracting numbers from string and modifying them in java
answer count: 1
linked to: http://stackoverflow.com/q/26297243

http://stackoverflow.com/a/27221372
has comment: http://stackoverflow.com/comment/42921689
type: AcceptedAnswer
has body: Start by reading the documention for Scanner(String) public Scanner(String source) Constructs a new Scanner that produces values scanned from the specified string. Parameters: source - A string to scan What you probably want is Scanner(File) public Scanner(File source) throws FileNotFoundException Constructs a new Scanner that produces values scanned from the specified file. Bytes from the file are converted into characters using the underlying platform's default charset. Parameters: source - A file to be scanned Throws: FileNotFoundException - if source is not found
has comment: http://stackoverflow.com/comment/42921673
accepted answer of: http://stackoverflow.com/q/27221351
answers question: http://stackoverflow.com/q/27221351
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/27282783
has body: Your logic is wrong. You want: while (!rep.toUpperCase().equals("O") &amp;&amp; !rep.toUpperCase().equals("N")); That is, you want to loop to run while the answer (is not O) and (is not N). You can also flip the logic: while (!(rep.toUpperCase().equals("O") || rep.toUpperCase().equals("N"))); Run while the answer is not (O or N).
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43033989
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27282703

http://stackoverflow.com/comment/43119979
has text: i don't agree that this is a duplicate. i'm trying to go to backend to get some "values". I'm just trying to filter second list depending on the first dropdown value.
comment on: http://stackoverflow.com/q/27178062
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43080770
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27309245
has text: ok I followed that link min ago... but there are three methods missed: setShowcaseItem(), setText() and setShowcase()

panel
tags question: http://stackoverflow.com/q/27311239
type: Tag
tag name: panel

http://stackoverflow.com/comment/42914692
score: 0
comment on: http://stackoverflow.com/a/27192698
type: Comment
has text: Hmm okay.. So if I use the file, then compile it using _javac_ and continue it should work?
type: AnswerComment

http://stackoverflow.com/comment/43015029
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27272733
has text: How about if the user enters `++!!Zabc??`?
type: AnswerComment

http://stackoverflow.com/comment/42808514
type: AnswerComment
has text: I'm glad your problem was solved, but be sure to be precise as to what solved it so future viewers can identify their problem. Also, the accepted solution gets listed first, so also make sure to mark whichever answer has your fix as the accepted solution.
comment on: http://stackoverflow.com/a/27156771
type: Comment
score: 0

http://stackoverflow.com/comment/42998927
comment on: http://stackoverflow.com/q/27263301
score: 0
has text: Try using ` Early Breakfast `
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42918528
has text: I would suggest you read a basic Java tutorial on what `static` means and how to use it.
score: 0
comment on: http://stackoverflow.com/q/27219641
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27262531
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27814893
has comment: http://stackoverflow.com/comment/43042575
has body: in spring doc, For example, RabbitMQ creates auto-delete queues when destinations like /exchange/amq.direct/position-updates are used I tried a few times, but I cannot make it work to auto-delete the queue. pls help give more details, such as 1. how to set the url for subscribe on client side? 2. any setting need to be done in rabbitmq in advanced? 3. how to set the url in controller?
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: spring
tagged with: rabbitmq
has comment: http://stackoverflow.com/comment/43038525
upvote count: 1
has comment: http://stackoverflow.com/comment/43008948
answer count: 1
has title: how to auto-delete the queue if using spring + stomp + full broker with rabbitmq
tagged with: stomp

http://stackoverflow.com/comment/42890243
has text: he needs to inject both constructor and field
type: AnswerComment
comment on: http://stackoverflow.com/a/27186516
score: 0
type: Comment

http://stackoverflow.com/q/27211812
has body: I'm passing through a java test and the following issue has come up: Why is the following claim wrong? An Error that might be thrown in a method must be declared as thrown by that method, or be handled within that method. I couldn't get an example of such an ill-formed program. I really have no idea.
has answer: http://stackoverflow.com/a/27211836
has comment: http://stackoverflow.com/comment/42904570
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27211836
type: AnsweredQuestion
has title: Error that is thrown
upvote count: 2
tagged with: java
downvote count: 3
type: Question
score: -1

http://stackoverflow.com/comment/43084492
comment on: http://stackoverflow.com/q/27303562
type: Comment
type: QuestionComment
has text: While you've provided some clear code samples, it would still be helpful to include an [MCVE](http://stackoverflow.com/help/mcve) so we can play a little.
score: 1

http://stackoverflow.com/comment/42971401
score: 0
comment on: http://stackoverflow.com/q/27248372
type: QuestionComment
type: Comment
has text: Well, you cache searches, but not search results. So if there's no ongoing search for the keyword, a new one is started even if a similar search was done just before.

http://stackoverflow.com/q/27204766
score: 0
has body: //working out what patients have not been seen in 1 year. import java.util.ArrayList; import java.util.Calendar; public class PatientTest { public static void main(String[] args){ Calendar cal1 =Calendar.getInstance(); PatientExtended Patient1 = new PatientExtended("Ian", "04/12/1970", "M", cal1); Calendar cal2 =Calendar.getInstance(); cal2.set(2012, 11, 8); PatientExtended Patient2 = new PatientExtended("Bob", "13/08/1989", "M", cal2); ArrayList&lt;PatientExtended&gt;mylist = new ArrayList &lt;PatientExtended&gt;(); mylist.add(Patient1); mylist.add(Patient2); System.out.println(PatientExtended(mylist)); } public static ArrayList&lt;PatientExtended&gt; PatientExtended(ArrayList&lt;PatientExtended&gt; PatientArrayList){ Calendar lastYear = Calendar.getInstance(); int year = lastYear.get(Calendar.YEAR); year = year -1; lastYear.set(Calendar.YEAR, year); ArrayList&lt;PatientExtended&gt;notSeenAllYear = new ArrayList &lt;PatientExtended&gt;(); for(int i =1; i&lt;=1; i++){ System.out.println(i); int check = PatientArrayList.get(i).getlastSeen().compareTo(lastYear); if (check &lt;= 1){ notSeenAllYear.add(PatientArrayList.get(i)); } } return notSeenAllYear; //return new array } }
answer count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/27204915
type: UnansweredQuestion
has title: How do I Junit test whether a (single) patient has been seen within a year or not
tagged with: java
type: Question

http://stackoverflow.com/comment/42985784
has text: @vaxquis Okay, but see my response to Xavier above.
comment on: http://stackoverflow.com/a/27255638
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43624281
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27184788
has text: All the images used in the above screenshot are of the format `jpg`. If there is something that is not working, please create a new question with a [MCVE](http://stackoverflow.com/help/mcve) and link this question/answer in it.
type: Comment

http://stackoverflow.com/comment/42877006
score: 0
type: AnswerComment
has text: From the question's wording, I don't think it's unreasonable to assume that he's specifically using the Latin alphabet.
type: Comment
comment on: http://stackoverflow.com/a/27195980

http://stackoverflow.com/a/27207281
upvote count: 26
has comment: http://stackoverflow.com/comment/42907722
score: 26
has comment: http://stackoverflow.com/comment/76226721
answers question: http://stackoverflow.com/q/27206040
type: AcceptedAnswer
downvote count: 0
has body: Change your repositories syntax in build.gradle as following. See following question. repositories { jcenter { url "http://jcenter.bintray.com/" } }
type: Answer
accepted answer of: http://stackoverflow.com/q/27206040

http://stackoverflow.com/a/27245654
type: Answer
has comment: http://stackoverflow.com/comment/42981915
answers question: http://stackoverflow.com/q/27231852
upvote count: 1
score: 1
downvote count: 0
has body: First of all, you can listen / request with any root controller like below. @Controller @RequestMapping ("/") public class RootCtrl { Logger logger = Logger.getLogger(RootCtrl.class); @RequestMapping (value = "/", method = {RequestMethod.GET, RequestMethod.POST}) public String index(ModelMap model) { // redirect to login page return "redirect:admin/index"; }} With that controller, you will map all requests to root. Than you may redirect request to your login controller. It's all about request mapping. Your loginController or webController shold listen a request which should be specified before. In my application, login controller listens /admin request paths. Than, my login controller is like this: @Controller @RequestMapping ("/admin") public class LoginCtrl { @RequestMapping (value = "/index", method = {RequestMethod.GET, RequestMethod.POST}) public String index(@RequestParam (value = "captchaId", defaultValue = "") String captchaId, ModelMap model, HttpServletRequest request, HttpServletResponse response) { if(StringUtils.isNullOrEmpty(captchaId)){ captchaId = RandomGUID.getRandomGUID(); } model.addAttribute("captchaId", captchaId); // redirect to login page return "login"; } When you will get request from this path : localhost/SampleProject/admin/index. Mappings will work.

http://stackoverflow.com/comment/42970691
type: Comment
has text: at com.example.currencyconverter2.MainActivity.showResult(MainActivity.java:68) Check This line... This has null pointer exception
type: QuestionComment
comment on: http://stackoverflow.com/q/27248048
score: 0

http://stackoverflow.com/q/27281823
has title: 2D Array print format in Java
possible better answer: http://stackoverflow.com/a/27282005
favorite count: 0
accepted answer: http://stackoverflow.com/a/27281974
type: AnsweredQuestion
has body: I have an assignment where it asks the user for input on the size of a 2D array, then asks for the numbers that goes in the array, and then makes some calculations (like sum &amp; max). What I'm having trouble with is when it asks the user for the numbers that go in the array I can't get it to format the way it's supposed to be for the assignment. Also having trouble with displaying the final array in the format it should be in as well. Example for user input: Enter [0][0]: Enter [0][1]: Etc. Example for final array display: [1,2,3] [4,5,6] etc. here's my code so far and I've commented the parts that I need help with. import java.util.Arrays; import java.util.Scanner; class Array2DMethods { public static int[][] readInputs() { Scanner keyboard = new Scanner(System.in); System.out.print(" How many rows? "); int rows = keyboard.nextInt(); System.out.print(" How many columns? "); int columns = keyboard.nextInt(); int[][] ret = new int[rows][columns]; for (int i = 0; i &lt; ret.length; i++) { for (int j = 0; j &lt; ret[i].length; j++) { /*Need to format it like this: Enter [0][0]: Enter [0][1]: etc. until it forms the 2D Array but not sure how to get it to print out like that. */ System.out.print(" Enter " + ret + ": "); ret[i][j] = keyboard.nextInt(); } } return ret; } public static int max(int[][] anArray) { int ret = Integer.MIN_VALUE; for (int i = 0; i &lt; anArray.length; i++) { for (int j = 0; j &lt; anArray[i].length; j++) { if (anArray[i][j] &gt; ret) { ret = anArray[i][j]; } } } return ret; } public static void rowSum(int[][] anArray) { int rows = anArray.length; int cols = anArray[0].length; int[] sum = new int[rows]; for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { sum[i] += anArray[i][j]; } } for (int x = 0; x &lt; anArray.length; x++) { System.out.println("Sum of row " + x + " = " + sum[x]); } } public static void columnSum(int[][] anArray) { int rows = anArray.length; int cols = anArray[0].length; int[] sum = new int[cols]; for (int …
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27282005
answer count: 2
has answer: http://stackoverflow.com/a/27281974
tagged with: arrays
downvote count: 0

http://stackoverflow.com/q/27247337
type: Question
has body: I want my J2EE application had ability to programmatically start/stop Websphere Message Broker 7.0.1 or Integration Bus 9. MQ Explorer already have this feature, so i know it's possible to code this in java. What instrument should i use to implement this functionality? I've tried both MQ java API, PCF, CMP API, but didn't find any specific command.
tagged with: administration
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27603210
tagged with: messagebroker
tagged with: pcf
tagged with: ibm-mq
has title: How to start/stop Websphere Message Broker using Java?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27603210
tagged with: java

http://stackoverflow.com/comment/43051039
comment on: http://stackoverflow.com/q/27292866
type: Comment
type: QuestionComment
score: 0
has text: probably the variable "json" is null. You should use a debugger and investigate.

http://stackoverflow.com/q/27225597
duplicate of: http://stackoverflow.com/q/6146808
possible better answer: http://stackoverflow.com/a/27225968
tagged with: jsp
favorite count: 0
linked to: http://stackoverflow.com/q/23365225
accepted answer: http://stackoverflow.com/a/27225934
type: AnsweredQuestion
has body: I have viewprofile action that displays the user's details and transaction history. History.java: public class History { private String transactionId; private Date transactionDate; private String movieTitle; private BigDecimal schedulePrice; private String mallName; private int scheduleCinema; private Date scheduleDate; private Time scheduleTime; // getters and setters } ViewProfileAction.java: public class ViewProfileAction extends ActionSupport implements SessionAware, RequestAware { private static final long serialVersionUID = 1L; private Map<String, Object> session; private Map<String, Object> request; @Override public String execute() throws Exception { if(!session.containsKey("currentUserId")) { return "index"; // return to index if not logged in } String currentUserId = (String) session.get("currentUserId"); UserManager um = new UserManager(); String registeredUserEmail = um.getCurrentUserDetail("user_email", currentUserId); Date registeredDate = um.getRegisteredDate(currentUserId); int totalTransactions = um.getTotalTransactions(currentUserId); List<History> historyList = new DatabaseManipulator().getTransactionHistory(currentUserId); request.put("registeredUserEmail", registeredUserEmail); request.put("registeredDate", registeredDate); request.put("totalTransactions", totalTransactions); request.put("historyList", historyList); return SUCCESS; } @Override public void setSession(Map<String, Object> session) { this.session = session; } @Override public void setRequest(Map<String, Object> request) { this.request = request; } } user-profile.jsp: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> TRANSACTION HISTORY <c:choose> <c:when test="${historyList.isEmpty()}"> NO RECORDED TRANSACTIONS </c:when> <c:otherwise> <c:forEach var="history" items="historyList"> ${history.transactionDate} ${history.movieTitle} ${history.schedulePrice} ${history.mallName} ${history.scheduleCinema} ${history.scheduleDate} ${history.scheduleTime} </c:forEach> </c:otherwi…
upvote count: 2
has title: PropertyNotFoundException: Property 'X' not found on type X
score: 1
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27225934
has answer: http://stackoverflow.com/a/27225968
linked to: http://stackoverflow.com/q/6146808
tagged with: struts2
answer count: 2
tagged with: jstl

http://stackoverflow.com/q/27230702
has answer: http://stackoverflow.com/a/75804112
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/46546359
tagged with: spring-boot
has answer: http://stackoverflow.com/a/29347219
tagged with: performance
has comment: http://stackoverflow.com/comment/46551063
tagged with: java
has answer: http://stackoverflow.com/a/79281810
has comment: http://stackoverflow.com/comment/46537669
has answer: http://stackoverflow.com/a/53751844
has body: I have a Spring Boot application. I've added a lot of dependencies (unfortunately, looks I need all of them) and the startup time went up quite a lot. Just doing a SpringApplication.run(source, args) takes 10 seconds. While that might not be much compared to what are "used" to, I'm unhappy that it takes that much, mostly because it breaks the development flow. The application itself is rather small at this point, so I assume most of the time is related to the added dependencies, not the app classes themselves. I assume the issue is classpath scanning, but I am not sure how to: Confirm that is the issue (i.e. how to "debug" Spring Boot) If it really is the cause, how can I limit it, so it gets faster? For example, if I know that some dependency or package does not contain anything that Spring should be scanning, is there a way to limit that? I assume that enhancing Spring to have parallel bean initialization during startup would speed up things, but that enhancement request has been open since 2011, without any progress. I see some other efforts in Spring Boot itself, such as Investigate Tomcat JarScanning speed improvements, but that is Tomcat specific and has been abandoned. This article: http://www.nurkiewicz.com/2010/12/speeding-up-spring-integration-tests.html although aimed at integration tests, suggests using lazy-init=true, however I do not know how to apply this to all beans in Spring Boot using Java configuration - any pointers here? Any (other) suggestions would be welcome.
type: Question
tagged with: startup
has answer: http://stackoverflow.com/a/53999437
linked to: http://stackoverflow.com/q/35709234
has comment: http://stackoverflow.com/comment/59644488
has answer: http://stackoverflow.com/a/49663075
has title: Speed up Spring Boot startup time
linked to: http://stackoverflow.com/q/8501975
linked to: http://stackoverflow.com/q/38721235
has answer: http://stackoverflow.com/a/39642208
has comment: http://stackoverflow.com/comment/86336334
has comment: http://stackoverflow.com/comment/42963796
has answer: http://stackoverflow.com/a/35994135
has answer: http://stackoverflow.com/a/55261352
downvote count: 0
has answer: http://stackoverflow.com/a/59654120
has answer: http://stackoverflow.com/a/61335982
has comment: http://stackoverflow.com/comment/46537688
favorite count: 0
score: 184
has answer: http://stackoverflow.com/a/53999302
answer count: 12
has comment: http://stackoverflow.com/comment/108136433
upvote count: 184

http://stackoverflow.com/comment/43064856
type: QuestionComment
score: 0
has text: but you said you're getting an error when opening with Adobe Reader...
comment on: http://stackoverflow.com/q/27278316
type: Comment

http://stackoverflow.com/q/27160247
type: Question
tagged with: syntax-error
upvote count: 0
accepted answer: http://stackoverflow.com/a/27160345
score: -2
answer count: 1
tagged with: arrays
favorite count: 0
tagged with: compiler-errors
downvote count: 2
has answer: http://stackoverflow.com/a/27160345
has body: My professor gave this example in class and it worked perfectly for him, but when I copied it down and tried to run it myself, I'm getting a number of errors. i.e expandArray() in the type classExample is not appplicable for the arguments(int, int) i.e for expandArray() : insert "...VariableDeclarartorId" to complete FormalParameterList i.e. Syntax errors on "}" tokens. I think it has to do with the placement of the class PartArray, because he seemed to have it in the classExample, but my TA just told me that you can't declare a class within another class. Did I make a mistake copying it down? public class classExample{ public static int INITIAL_SIZE = 100; public static void main(String[] args) { PartArray part = new PartArray();//object part.array = new String[INITIAL_SIZE];//field part.array[part.size++] = "Bob"; part.array[part.size++] = "Percy"; expandArray(part.size, 2*INITIAL_SIZE); System.out.println(part); System.out.println("part.size: " + part.size); System.out.println("part.array.length: " + part.array.length); System.out.println("part.array[0]: " + part.array[0]); System.out.println("part.array[1]: " + part.array[1]); System.out.println("part.array[2]: " + part.array[2]); }//main public static void expandArray(PartArray.full, int newSize){ String[] newArray = new String[newSize]; for(int pos = 0; pos &lt; full.array.length; pos ++) //every position in fullArray {newArray[pos] = full.array[pos]; }//for full.array = newArray; //match object return; }//expandArray }//classExample class PartArray { //local container to hold partially filled array public int INITIAL_SIZE = 100; public int size = 0; //number of entries in array public String[] array = new String[INITIAL_SIZE];//storage location }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42814294
tagged with: java
has title: Partial Array Error

http://stackoverflow.com/q/27172223
tagged with: boolean
has comment: http://stackoverflow.com/comment/42835052
downvote count: 0
linked to: http://stackoverflow.com/q/13826045
has body: File oldfile = new File("C:\\NewText Document.txt"); File newfile = new File("C:\\Hello Buddy.txt"); if (oldfile.renameTo(newfile)) { System.out.println("Rename succesful"); } else { System.out.println("Rename failed"); } I'm planning on developing it into a file normalizer, but I just want to get this done first. I've tried using the absolute path, makes no difference. Constantly returning "Rename Failed".
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/27172438
accepted answer: http://stackoverflow.com/a/27200672
has comment: http://stackoverflow.com/comment/42835005
tagged with: filepath
has answer: http://stackoverflow.com/a/27172593
type: AnsweredQuestion
tagged with: file
upvote count: 1
has title: I'm trying to Rename a File using Java But It is Not Working for Some Reason
has answer: http://stackoverflow.com/a/27200672
type: Question
score: 1
tagged with: java
tagged with: file-rename
possible better answer: http://stackoverflow.com/a/27172438
has comment: http://stackoverflow.com/comment/42835037
linked to: http://stackoverflow.com/q/1000183

http://stackoverflow.com/comment/43069689
type: Comment
score: 2
has text: you'll want to look into sql transactions.
type: QuestionComment
comment on: http://stackoverflow.com/q/27303300

mongodb-java
tags question: http://stackoverflow.com/q/27288373
tag name: mongodb-java
tags question: http://stackoverflow.com/q/27235072
type: Tag

http://stackoverflow.com/comment/42972469
type: Comment
has text: Actually, I've checked what the maven build amounts to, there are no special steps. You can easily reproduce all that without Maven, all you'll need to do is download the JMH jar.
comment on: http://stackoverflow.com/a/27248966
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42978805
has text: Ok, i checked it on another table, it works even with java.util.Date. I didnt mention, that im using 3 parameters in primary key, therefore i have three id annotation. I will add more details to my topic.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27250720
score: 0

http://stackoverflow.com/q/27249260
has comment: http://stackoverflow.com/comment/42973032
has answer: http://stackoverflow.com/a/27250131
upvote count: 1
answer count: 1
has title: java.lang.OutOfMemoryError: Java heap space while deploying GWT application to Google App Engine
favorite count: 0
has comment: http://stackoverflow.com/comment/42972876
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/42972828
has comment: http://stackoverflow.com/comment/42978955
has comment: http://stackoverflow.com/comment/42972948
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42978902
tagged with: gwt
has body: ------------ Deploying frontend ------------ Preparing to deploy: Created staging directory at: '/var/folders/14/l6tq2_1x17s0p1bcq5nsqphwthd17d/T/appcfg2818721238209183883.tmp' Scanning for jsp files. java.lang.OutOfMemoryError: Java heap space This error occurs while deploying my application to google app engine from eclipse.
linked to: http://stackoverflow.com/q/1565388

http://stackoverflow.com/q/27232920
possible better answer: http://stackoverflow.com/a/27235007
has title: Picketlink 2.6+ Jboss AS 7.1.1
type: AnsweredQuestion
tagged with: java
has body: I was wondering if it was possible to use picketlink 2.6 or newer on jboss as 7.1.1? The installer says only eap or wildfly, but I am forced to use as7 so that doesn't work for me... Is it a case of installing the modules myself, or does it just not work? Thanks
type: Question
tagged with: picketlink
has answer: http://stackoverflow.com/a/27235007
tagged with: server
tagged with: jboss
score: 0
has answer: http://stackoverflow.com/a/27271222
answer count: 2
accepted answer: http://stackoverflow.com/a/27271222

http://stackoverflow.com/comment/42936868
type: QuestionComment
comment on: http://stackoverflow.com/q/27228656
has text: @LimboExile, it's empty when you first open it. With the the "Network" open, refresh the page.
score: 0
type: Comment

http://stackoverflow.com/comment/42948356
has text: You return the first matching league position, what are you asking here? By the way `leaguePosition = i + 1;` looks wrong to me.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27235880
type: QuestionComment

http://stackoverflow.com/a/27181319
has comment: http://stackoverflow.com/comment/42894453
type: Answer
answers question: http://stackoverflow.com/q/27180969
has comment: http://stackoverflow.com/comment/42921768
has body: I think your key store config have some problem. Please check this link. Also, please attach error report.
has comment: http://stackoverflow.com/comment/42898634
downvote count: 1
upvote count: 0
score: -1

http://stackoverflow.com/comment/42802062
comment on: http://stackoverflow.com/q/27153841
type: Comment
has text: bascially i tried to output this in my mainclass with : " c.getN()" , with getters and setters already generated.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42836148
has text: theoretically is way to go, you have to save unique id for those Objects, to change in your answer to get/putClientProperty
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/27172824
type: Comment

http://stackoverflow.com/comment/42892420
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27204792
has text: @m0skit0: Well you've said the rest is trivial - which suggests building the comparator is trivial, which suggests to me that it doesn't require any extra information. It seems to me that that's *not* the simplest way of doing this... and that even if it were, calling `keySet()` is the trivial part, not the ordering.
score: 0

http://stackoverflow.com/comment/42964510
comment on: http://stackoverflow.com/q/27244544
score: 5
has text: Are you sure this exception comes from the function you have shown ? I would have said its probably a memory-heap exceeded error (which generally occurs when dealing with large bitmaps) but your stack-trace is completely different :/
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27161190
tagged with: string
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27161354
has comment: http://stackoverflow.com/comment/42816269
type: Question
has comment: http://stackoverflow.com/comment/42816576
has comment: http://stackoverflow.com/comment/42816560
has comment: http://stackoverflow.com/comment/42816036
tagged with: palindrome
has comment: http://stackoverflow.com/comment/42816070
score: 0
has comment: http://stackoverflow.com/comment/42816617
has comment: http://stackoverflow.com/comment/42816008
has body: Here i have code to check whether given string is palindrome or not but don't know the procedure to reduce characters from last.To make change the character i need to follow the rule as: Eg String input="abcde".Letter 'e' can be converted to 'd' but not 'e' to 'd' if character becomes 'a' we can't change further.Here is my code: public static void main(String[] args) { String input = "abcd"; String temp = input; String output = ""; for (int i = output.length() - 1; i &gt;= 0; i--) { output = output + output.charAt(i); } if(temp.equals(output)){ System.out.println("String is palindrome"); }else{ System.out.println("Not a palindrome"); } } output order logic is as follows: if input is =abcd abcc('d' converted to 'c')and check for palindrome abcb('c' converted to 'b')and check for palindrome abca('b' converted to 'a')and check for palindrome abba('a' further we can't change so shift to previous letter 'c' and change to 'b') and check for palindrome String is palindrome and count is=4 if input=cbdf cbde('f' converted to 'f')and check for palindrome cdbd('e' converted to 'd')and check for palindrome cdbc('d' converted to 'c')and check for palindrome cdbb('c' converted to 'b')and check for palindrome cdba('b' converted to 'a')and check for palindrome cdaa('a' further we can't change so shift to previous letter 'b' and change to 'a') and check for palindrome ccaa('a' further we can't change so shift to previous letter 'd' and change to 'c') and check for palindrome cbaa('c' converted to 'b')and check for palindrome caaa('a' further we can't change so shift to previous letter 'c' and change to 'b') and check for palindrome baaa('b' converted to 'a')and check for palindrome aaaa now string is palindrome String is palindrome and count is=10 finally i need the count to make string palindrome.
has title: How to reduce character from given String until it becomes to palindrome in java
has comment: http://stackoverflow.com/comment/42816606
answer count: 1
has answer: http://stackoverflow.com/a/27161354

http://stackoverflow.com/q/27248009
has comment: http://stackoverflow.com/comment/42987865
has comment: http://stackoverflow.com/comment/42973991
has comment: http://stackoverflow.com/comment/42970865
score: 0
answer count: 2
tagged with: symbols
has answer: http://stackoverflow.com/a/27248703
has answer: http://stackoverflow.com/a/27248153
has comment: http://stackoverflow.com/comment/42970822
has comment: http://stackoverflow.com/comment/42970856
type: UnansweredQuestion
has body: In Java what is exactly a "symbol"? I encountered code like RuleContext.USERNAME described as symbol. I think of it as a property of the object RuleContext. Isn't it? In manuals such as "Thinking in Java ed.3" I cannot find "symbol" at all. Thank you!
has comment: http://stackoverflow.com/comment/42970803
tagged with: java
has title: Symbols in Java
type: Question

clipboard
tags question: http://stackoverflow.com/q/27264303
tag name: clipboard
tags question: http://stackoverflow.com/q/27176734
type: Tag

http://stackoverflow.com/comment/42863192
type: QuestionComment
score: 3
has text: Post your code and point out your exact problem please. So far, the task seems pretty clear.
comment on: http://stackoverflow.com/q/27188446
type: Comment

http://stackoverflow.com/comment/42898538
type: QuestionComment
type: Comment
has text: FATAL EXCEPTION: main java.lang.NullPointerException on the line onLaodFinished(Loader<Cursor> where the image is imChild.setImageBitmap(bmImg);
comment on: http://stackoverflow.com/q/27208222
score: 0

http://stackoverflow.com/comment/43097785
type: Comment
has text: Thank you for your answer @Nazgul, I'm going to try a little more with the Terracotta Enterprise cluster before changing to replication via RMI, but I'll consider that!
comment on: http://stackoverflow.com/a/27278198
score: 0
type: AnswerComment

http://stackoverflow.com/a/27170132
has comment: http://stackoverflow.com/comment/42915547
type: Answer
accepted answer of: http://stackoverflow.com/q/27169767
answers question: http://stackoverflow.com/q/27169767
has comment: http://stackoverflow.com/comment/42913029
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42831448
has body: Changes aren't actually cascaded. What CascadeType.REMOVE means is essentially ON DELETE CASCADE, i.e. remove any orphaned rows. While there is a ON UPDATE CASCADE it is less used and only affects the other end of the foreign key. If you make changes to an object that is handled by the ORM, the changes will be persisted. However it has nothing to do with cascading. So if you don't want to update SomeEntityInfo in the database, don't update it in your code. EclipseLink is doing its job perfectly fine here.
has comment: http://stackoverflow.com/comment/42831377

http://stackoverflow.com/q/27195883
has comment: http://stackoverflow.com/comment/42876814
has comment: http://stackoverflow.com/comment/42877049
has answer: http://stackoverflow.com/a/34917873
has comment: http://stackoverflow.com/comment/42877010
has comment: http://stackoverflow.com/comment/42876955
has comment: http://stackoverflow.com/comment/42876925
has title: Java: Recursively search an array for an integer given an array, integer, and array length
has comment: http://stackoverflow.com/comment/42877197
answer count: 4
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/64622660
has comment: http://stackoverflow.com/comment/42876896
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/42876900
possible better answer: http://stackoverflow.com/a/27196031
tagged with: java
has comment: http://stackoverflow.com/comment/42877080
has comment: http://stackoverflow.com/comment/42877231
upvote count: 2
has answer: http://stackoverflow.com/a/27196213
accepted answer: http://stackoverflow.com/a/27196213
has answer: http://stackoverflow.com/a/27196031
tagged with: arrays
has comment: http://stackoverflow.com/comment/42877579
has comment: http://stackoverflow.com/comment/42877052
favorite count: 0
has body: I'm trying to write a recursive method that accepts an int array, number of elements in the array, and an integer, and returns whether the integer is present as an element in the array.I just can't figure out why I this isn't working for all my test cases. Any help would be much appreciated! public static boolean search(int[] findIn, int target, int len){ if(len == 0){ return false; }else if(findIn[len-1] == target){ return true; }else{ return search(findIn, target, len-1); } } Yes I realize there are better ways other than recursion to do this, but it is required that I do it this way. My main method looks like this: I'm just hard-coding it for the time being: int[] arr = {1}; System.out.println(search(arr,1,1)); Testcases:

http://stackoverflow.com/comment/42849988
comment on: http://stackoverflow.com/q/27180711
score: 1
has text: There is nothing as "global" in Java. And, please write a smallest runnable code to demonstrate your problem. And, please give a sensible title
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42998521
comment on: http://stackoverflow.com/a/27263027
type: Comment
has text: The matrix is initialized in another class as a square array, specifically like this int[][] adjMatrix = new int[n][n];
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42916787
type: QuestionComment
comment on: http://stackoverflow.com/q/27218746
has text: Can you post the errors? See the [help/on-topic] about writing a good question so we can answer it better (and quicker).
score: 3
type: Comment

http://stackoverflow.com/a/27266330
has comment: http://stackoverflow.com/comment/43003991
type: Answer
has comment: http://stackoverflow.com/comment/43004689
has comment: http://stackoverflow.com/comment/43003876
score: 2
has body: You should not kill a thread. You should make it stop. If you have a loop, you should stop this loop. If you have some time consuming function, like network connect, you should stop this network function instead of killing thread. There is no guarantee to stop a thread with Thread.stop() function
has comment: http://stackoverflow.com/comment/43004047
has comment: http://stackoverflow.com/comment/43004316
upvote count: 3
answers question: http://stackoverflow.com/q/27266249
downvote count: 1

http://stackoverflow.com/q/27158106
score: 41
downvote count: 0
answer count: 1
tagged with: websocket
linked to: http://stackoverflow.com/q/33910639
favorite count: 0
has answer: http://stackoverflow.com/a/27161986
accepted answer: http://stackoverflow.com/a/27161986
has comment: http://stackoverflow.com/comment/81891704
upvote count: 41
linked to: http://stackoverflow.com/q/47551224
type: AnsweredQuestion
tagged with: spring-4
tagged with: java
has body: Is there a way to use WebSockets with SockJS client and Spring 4 server but not using STOMP? Based on this tutorial from Spring's website, I know how to set up a WebSocket based application using Stomp and Spring 4. On the client side, we have: var socket = new SockJS('/hello'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe('/topic/greetings', function(greeting){ showGreeting(JSON.parse(greeting.body).content); }); }); And on the server side, we have the following in the controller: @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws Exception { Thread.sleep(3000); // simulated delay return new Greeting("Hello, " + message.getName() + "!"); } Now, I understand that @MessageMapping("/hello") ensures that if a message is sent to a destination "/hello", then the greeting() method will be called. And since the stompClient is subscribed to "/topic/greetings", the @SendTo("/topic/greetings") will send the message back to the stompClient. But the problem with the above is that stompClient is a Stomp object. And I want to simply use sock.send('test'); and have it delivered to my server's destination. And I want to do @SendTo("myownclientdestinationmap"), I can receive it by sock.onmessage = function(e) { console.log('message', e.data); }; So, any way to do this with Spring 4, SockJS and without Stomp? Or does Spring 4 WebSocket only supports Stomp?
tagged with: sockjs
type: Question
has title: WebSocket with Sockjs & Spring 4 but without Stomp

http://stackoverflow.com/q/27269837
has body: This is going to be a long post in order to properly explain the issue, so please bear with me. It could also require some knowledge of the internals of the JNA library (v 4.1.0), or ability to examine its source code. In a few words, we have issues when obtaining pointers to native functions from a 3rd-party component that is written in C. The problematic pointers seem to break the JNA functionality, because of repeating pointer values. The issue is observed repetitively when we execute the JNA bindings as part of the child JVM process within another JVM process. Background We are integrating with a 3rd party tool for Windows written in C. The tool manufacturer has provided us with the C header files and a dll that we must inter-operate with trough our Java code. The dll contains structures that expose function pointers, which we are mapping to Java interfaces via JNAerator, I will refer to it as the interop.dll. The interop.dll communicates with the 3rd party tool (that is pre-installed on the system), thus it is kind of a communication sdk. For testing purposes, we have recently been provided with a stub.dll (again from that manufacturer), which does not require the 3rd party tool to be running, or installed at all. The interop.dll is responsible to decide whether to use the stub or the real 3rd party tool, and automatically chooses the stub if it is present in the bin directory. So, in any case, we have to map a fixed number of functions exposed by the interop.dll. To assist in that, the interop.dll would contain the following function: void* (__cdecl *ObtainInterface)( const char* interfaceName ); and we would map it in Java like this: public interface ObtainInterface_callback extends Callback { Pointer apply(String interfaceName); }; public ObtainInterface_callback ObtainInterface; This function is used to "extract" another function from the either the 3rd party tool or the stub.dll and then export it to a Java interface by using its pointer value. In other wo…
tagged with: dll
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/43017479
has title: Pointer issues when mapping native C functions to Java interface with JNA
tagged with: interop
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43030075
favorite count: 0
tagged with: jna
has comment: http://stackoverflow.com/comment/43055985
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/27273080
has comment: http://stackoverflow.com/comment/43015704
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43018010
type: Question
has answer: http://stackoverflow.com/a/27273080

http://stackoverflow.com/comment/43026398
score: 0
comment on: http://stackoverflow.com/a/27278579
type: Comment
has text: Updated a bit the answer with a simple example how you can save the constructor parameter in a field.
type: AnswerComment

http://stackoverflow.com/q/27235891
type: Question
answer count: 2
score: 0
tagged with: android-listview
tagged with: android
accepted answer: http://stackoverflow.com/a/27236150
has body: I am developing an android application with a custom list view ( with a single image and two text views) The class mainactivity has .... public class MainActivity extends ActionBarActivity { String[] memetitles; String[] memedesc; ListView list; int[] images = {R.drawable.angry_icon,R.drawable.happy_icon,R.drawable.kid_icon,R.drawable.scare_icon,R.drawable.warn_icon}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Resources res = getResources(); memetitles = res.getStringArray(R.array.titles); memedesc = res.getStringArray(R.array.notneed); list = (ListView) findViewById(R.id.listView1); Itarray adapter = new Itarray(this,memetitles,memedesc,images); list.setAdapter(adapter); setTitle("Tamil Memer"); } The class for combining two layouts into a single list view has class Itarray extends ArrayAdapter&lt;String&gt;{ Context context; int[] image; String[] tit1; String[] tit2; Itarray(Context c , String[] titles ,String[] notneed, int imgs[]) { super(c , R.layout.single_row,titles); this.context = c; this.image = imgs; this.tit1 = titles; this.tit2 = notneed; } public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View row = convertView; if(row == null) { LayoutInflater inf = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inf.inflate(R.layout.single_row , parent , false); } ImageView myImage = (ImageView) row.findViewById(R.id.imageView1); TextView tit = (TextView) row.findViewById(R.id.textView1); TextView des = (TextView) row.findViewById(R.id.textView2); myImage.setImageResource(image[position]); tit.setText(tit1[position]); des.setText(tit2[position]); return row; } } The two layout files : (the one with the image and the textviews) &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent…
possible better answer: http://stackoverflow.com/a/40154528
has title: onclick Listener for custom listview
has answer: http://stackoverflow.com/a/40154528
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/27236150
tagged with: listview

http://stackoverflow.com/comment/42918958
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27196423
type: Comment
has text: Increasing the heap size worked for the Android Studio AVD I just need to figure out how to do this on the Genymotion emulator now

http://stackoverflow.com/q/27274299
has comment: http://stackoverflow.com/comment/131871154
tagged with: spring
has answer: http://stackoverflow.com/a/27274531
tagged with: java
type: Question
has body: I'm trying to change the session timeout in spring via Java Config (no web.xml). It looks quite simple if you don't mind hard coding the timeout, however this isn't desired. Is there a way to use the @Value annotation during initialisation? E.g. @PropertySource("classpath:/com/example/demo.properties") public class Initialiser implements WebApplicationInitializer { /** Session timeout in seconds. */ @Value(value = "${session-timeout}") private int sessionTimeout; @Override public void onStartup(final ServletContext container) { container.addListener(new SessionListener(sessionTimeout)); } } The field at runtime is 0 as it appears that you can't inject values during startUp. Is there anyway round this? Thanks for any help.
score: 0
answer count: 1
has title: Use property value in spring initialisation
has comment: http://stackoverflow.com/comment/43018998
type: UnansweredQuestion

http://stackoverflow.com/q/27292744
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/43051090
has comment: http://stackoverflow.com/comment/43072328
has title: Android NDK - Build does not find NDK includes such as <Queue>,
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43056130
has answer: http://stackoverflow.com/a/33938557
tagged with: java
tagged with: android-ndk
accepted answer: http://stackoverflow.com/a/33938557
type: Question
has comment: http://stackoverflow.com/comment/43054692
has body: I have set up NDK as described in the installation guide, have set the PATH variable to my NDK installation. Now when building my app in Android Studio, I'm getting a build error which says me that the include could not be found. This is my first NDK project so I guess that something is wrong with the configuration and the compiler does not know where to look for the include files. I have also set the NDK-directory in the local.properties - file. The compiler can be found but the includes not. Here is the compiler output: Error:Execution failed for task ':app:compileDebugNdk'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: D:\android-ndk-r10c\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=D:\Programmieren\SoundTouch-Android-master\app\build\intermediates\ndk\debug\Android.mk APP_PLATFORM=android-20 NDK_OUT=D:\Programmieren\SoundTouch-Android-master\app\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=D:\Programmieren\SoundTouch-Android-master\app\build\intermediates\ndk\debug\lib APP_ABI=all Error Code: 2 Output: D:\Programmieren\SoundTouch-Android-master\app\src\main\jni\soundtouch-jni.cpp:3:17: fatal error: queue: No such file or directory #include ^ compilation terminated. make.exe: *** [D:\Programmieren\SoundTouch-Android-master\app\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/soundtouch/D_\Programmieren\SoundTouch-Android-master\app\src\main\jni\soundtouch-jni.o] Error 1 I hope you have an idea and can help me.
score: 0
has comment: http://stackoverflow.com/comment/43050929

http://stackoverflow.com/comment/43010182
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27269928
has text: nice it worked! thanks! now i know that List can be like that.
score: 0

http://stackoverflow.com/a/27173806
has comment: http://stackoverflow.com/comment/42838112
has body: You place your panel at frame NORTH. In north, your panel will take only the widows width. So he has no height (or 1px height). So try to define a size to your panel: panel.setPreferedSize(new Dimension(200, 200)); Else, as suggested in comment, place your panel into the CENTER of the frame. Replace: frame.add(panel,BorderLayout.NORTH); by frame.add(panel,BorderLayout.CENTER); In center, your panel will get the panel width and height (substract your button height).
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27173627
downvote count: 0
has comment: http://stackoverflow.com/comment/42837619

http://stackoverflow.com/comment/42972877
has text: since this was posted last night, I'll bump it up to make sure it didn't get buried.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27238524

http://stackoverflow.com/comment/43045186
comment on: http://stackoverflow.com/q/27289187
score: 0
type: Comment
type: QuestionComment
has text: That sounds right. Using `Accept: application/xml` gives the same answer as in Firefox/Chrome. I am wondering if this behaviour is right. But anyway, it won't really matter as clients won't be asking for an xml answer, I was just wondering that it looked wrong when first trying it in a browser.

http://stackoverflow.com/comment/43015654
type: Comment
has text: @Joren I've upated the answer.
score: 0
comment on: http://stackoverflow.com/a/27270634
type: AnswerComment

http://stackoverflow.com/comment/43059204
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27297453
has text: `this` & `compareTo`!

http://stackoverflow.com/comment/42916708
comment on: http://stackoverflow.com/a/27218580
type: Comment
type: AnswerComment
has text: Ah thanks, thought i had to specify the exact index.
score: 0

http://stackoverflow.com/q/27180729
has comment: http://stackoverflow.com/comment/42849950
tagged with: inner-classes
answer count: 0
tagged with: java
type: Question
tagged with: scope
has body: I know that local variables are not allowed to use within the inner classes. It must be a instance variable or a final one. Someone has said that it is because of the inner class object may exist out of the scope of method. But I want to know why it is only for InnerClasses. When it is allowed for others. Basically I want to know why Approach 2 is allowed when Approach 1 is not. Approach 1 : MainGUI class private void initializeGUI(){ JTextArea rqJTextArea = new JTextArea(); JTextArea rsJTextArea = new JTextArea(); JButton button = new JButton("Ok"); // http://www.javaprogrammingforums.com/java-swing-tutorials/278-how-add-actionlistener-jbutton-swing.html button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ rsJTextArea.setText(rsJTextArea.getText() + "\n" + rqJTextArea.getText()); // Cannot refer to a non-final variable rsJTextArea inside an inner class defined in a different method } }); } Approach 2 : MainGUI class private void initializeGUI(){ JTextArea rqJTextArea = new JTextArea(); JTextArea rsJTextArea = new JTextArea(); JButton button = new JButton("Ok"); SendActionListner sendActionListner = new SendActionListner(); sendActionListner.setRqJTextArea(rqJTextArea); sendActionListner.setRsJTextArea(rsJTextArea); button.addActionListener(sendActionListner); } SendActionListner class public class SendActionListner implements ActionListener { public void actionPerformed(ActionEvent e) { rsJTextArea.setText(rsJTextArea.getText() + "\n" + rqJTextArea.getText()); } public JTextArea getRqJTextArea() { return rqJTextArea; } public void setRqJTextArea(JTextArea rqJTextArea) { this.rqJTextArea = rqJTextArea; } public JTextArea getRsJTextArea() { return rsJTextArea; } public void setRsJTextArea(JTextArea rsJTextArea) { this.rsJTextArea = rsJTextArea; } JTextArea rqJTextArea = null; JTextArea rsJTextArea = null; }
score: 0
has comment: http://stackoverflow.com/comment/42851868
has title: Why local variables are not allowed to use within the inner classes when it is allowed for others
has comment: http://stackoverflow.com/comment/42851297
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1299837

http://stackoverflow.com/comment/42972583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27225454
has text: @PelitMamani I'm using Traccar system for tracking device it's open source and the input method implied in the server and data inserted correctly and they are exist in the database. The problem is in reading from database. and please read the following comment

http://stackoverflow.com/q/27192809
has answer: http://stackoverflow.com/a/28328876
tagged with: picketlink
has title: Picketlink Source Compile Error
has body: I am trying to compile picketlink from source but it keeps failing with the same error when running either mvn install or mvn package. It always fails on 'PicketLink Identity Management API' with the error Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project picketlink-idm-api: Compilation failure error: java.lang.NullPointerException I have tried with versions 2.5.0, 2.5.1, 2.5.2, 2.6.0, and 2.6.1. Whats wrong and how can I fix this? Thanks
tagged with: jboss
tagged with: security
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42872601
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question

http://stackoverflow.com/comment/42881333
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27198432
score: 1
has text: I did not get the same results. If I ran it "as it was" it would terminate after entering only 1 non number and the question stated "_When the exception occurs twice_". In other words, it never let me "Try Again".

http://stackoverflow.com/q/27269864
has title: Create JavaFX self-contained application (with custom JDK) in Eclipse
downvote count: 0
favorite count: 0
has body: As the title suggests, I would like to create a self-contained JavaFX application, using an other JDK/JRE than the system default. Netbeans is capable of doing this, however, I do not yet know how to do this in Eclipse. By using e(fx)clipse, you are able to generate a build file (build.fxbuild). With Netbeans, the following needs to be added to the build.xml to include the custom JDK in the jar (this is just the example from Oracle): <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}" nativeBundles="all" outdir="${basedir}/${dist.dir}" outfile="${application.title}"> <fx:application name="${application.title}" mainClass="${javafx.main.class}"/> <fx:resources> <fx:fileset dir="${basedir}/${dist.dir}" includes="BrickBreaker.jar"/> </fx:resources> <fx:info title="${application.title}" vendor="${application.vendor}"/> </fx:deploy> So, is this possible in Eclipse? And if so, how can I bundle the JDK with the jar? Any help is greatly appreciated! EDIT: Added build output from console I'm working on Mac OSX 10.10.1, Yosemite. Buildfile: /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/build.xml setup-staging-area: [delete] Deleting directory /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/externalLibs [delete] Deleting directory /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/project [delete] Deleting directory /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/projectRefs [mkdir] Created dir: /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/externalLibs [copy] Copying 1 file to /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/externalLibs [mkdir] Created dir: /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/project [copy] Copying 4 files to /Users/RobinTrietsch/EclipseProjects/octocash-updater/OctoCash Updater/build/project [mkdir] Created dir: /Users/RobinTriets…
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/27276391
score: 3
tagged with: java
tagged with: javafx
tagged with: eclipse
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/34806591

http://stackoverflow.com/comment/42948845
type: QuestionComment
score: 3
has text: It's an internal class of the JDK and you should never use it directly.
comment on: http://stackoverflow.com/q/27236082
type: Comment

http://stackoverflow.com/a/27185926
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Not sure I picked this up correctly, but I would use a ThreadPoolExecutor with single thread, passing a PriorityBlockingQueue in it. All your tasks will go to that queue, the login tasks will have higher priority so they will all be processed before any message-processing tasks. Also if message-processing-task is in progress, it will complete before the client-login-tasks kicks in. Would that be what you need?
accepted answer of: http://stackoverflow.com/q/27184060
has comment: http://stackoverflow.com/comment/42984431
answers question: http://stackoverflow.com/q/27184060
type: AcceptedAnswer

http://stackoverflow.com/a/27228032
type: Answer
has body: The getValueAt() method of the TableModel interface returns a descendant of Object. Your error message indicates it is a String. So it seems that you should convert the Object reference returned to a String reference with a cast. Then convert that String to a double with Double.parseDouble(). parseDouble will throw a NumberFormatException if the string is not a valid double: try { numberRow = TOrders.getSelectedRow(); String temp = (String) TOrders.getModel().getValueAt(numberRow, 3); subCost = Double.parseDouble(temp); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null, "Item in table was not a valid double - " + e.getMessage() ); } If you want to deal with currency data, you may want to put it in a BigDecimal. Constructing a BigDecimal with a String that does not contain a valid decimal number throws a NumberFormatException. try { numberRow = TOrders.getSelectedRow(); String temp = (String) TOrders.getModel().getValueAt(numberRow, 3); subCost = new BigDecimal(temp); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null, "Item in table was not a valid decimal number"); }
score: 0
answers question: http://stackoverflow.com/q/27218687

http://stackoverflow.com/comment/43005090
has text: Sure. Each document indexed and associated with an id and a type. I need to do a massive select (selecting all documents from one index). I need to have opportunity to get type of returned document. There is a class in jest client that called Hit. I have ability to get source of the returned document, but do not have an ability to get type. It's possible to return response (list of documents in my case) as json string. But i need to parse it by myself to retrieve index, type - to extend Hit class. However ES java client has SearchHit interface that contain method getType() - one that i need
comment on: http://stackoverflow.com/q/27226782
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27265027
type: Answer
answers question: http://stackoverflow.com/q/27264506
has body: Since "no thirdparty applications, only jdk", then you should try JConsole, it's part of JDK, displays all kinds of infomation of java applications which should meet your need. See here: Exposing a Resource for Remote Management By JConsole Generally, what you should do: First, Start your java application on the remote machine with properties that expose the application for remote management, e.g. java -Dcom.sun.management.jmxremote.port = 9999 \ -Dcom.sun.management.jmxremote.authenticate = false \ -Dcom.sun.management.jmxremote.ssl = false \ YOUR_APP Then, Start jconsole on the local machine, connect to the remote process exposed above by the format "HOSTNAME:PORT". After connected, just check out what you need in the tab "Thread".
score: 0
has comment: http://stackoverflow.com/comment/43001760

http://stackoverflow.com/a/27573055
downvote count: 0
has body: You have to make calculation outside loop. System.out.println("Hari : "+day); System.out.println("Total : Rp."+totkes); System.out.println("Diskon : Rp."+ptgn); ptg = totkes * diskon; System.out.println("Total Bayar : Rp."+(totbay = totkes-ptg));
answers question: http://stackoverflow.com/q/27252683
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27252683
type: AcceptedAnswer
type: Answer
score: 3

http://stackoverflow.com/q/27166258
tagged with: header
favorite count: 0
has title: Open WebSocket connection with authentication cookie
tagged with: android
type: AnsweredQuestion
tagged with: cookies
tagged with: java
has answer: http://stackoverflow.com/a/27291783
linked to: http://stackoverflow.com/q/22692763
type: Question
score: 4
has body: I have the same issue as Websockets and cookies in Android, and I have been trying to solve it as the first comment suggested, WebSocketClient( URI serverUri , Draft protocolDraft , Map httpHeaders , int connectTimeout) using Java-WebSocket, as well as looking at many other APIs such as Jetty and AndroidAsync. But despite this I am unable to open up a websocket connection. I have an Apache http cookie, and need this to authenticate myself to the server with a WebSocket. What is the correct way of translating a cookie into a httpHeader, or is there any neat way to simply add the entire cookie in the authentication when connection to a websocket? Maybe I am just missing the obvious.. Apologies for possible misuses of terms, but I hope you get the general idea. Any help would be much appreciated, thank you!
upvote count: 4
accepted answer: http://stackoverflow.com/a/27291783
answer count: 1
downvote count: 0
tagged with: websocket

http://stackoverflow.com/q/27262849
has comment: http://stackoverflow.com/comment/42998423
has comment: http://stackoverflow.com/comment/42998181
score: 0
linked to: http://stackoverflow.com/q/5045420
has body: What is the proper way to invoke a thread's run() method at a fixed rate? Should I implements Runnable and use Thread#sleep() in parallel with math based on System#nanoTime() or should I extends Thread and use an ScheduledExecutorService? I would want this logic to be executed every #ms regardless of processing time, example: Loop takes 32ms Thread waits 228ms (250-32) then executes loop again. Loop takes 17ms Thread waits 233ms (250-17) then executes loop again. This would mean that just using Thread#sleep() by itself would not be a proper solution, I know I can get pretty close to this effect by calculating the amount of milliseconds to sleep() using a start/end/elapsed variable and using nanoTime() for reference, but is this the "Correct" way to do it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42998617
has title: Proper way to execute thread logic at a fixed rate
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/42914060
comment on: http://stackoverflow.com/q/27216573
has text: Your JDK is very old. Consider JDK7 or JDK8.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27261343
score: 0
answers question: http://stackoverflow.com/q/27261315
has body: Create an array of Object class or define a parent class for Pilots and Passengers and then create an array of your superclass. You will be able to add any child class objects to parent class array.
type: Answer
has comment: http://stackoverflow.com/comment/42995976

http://stackoverflow.com/comment/42806647
comment on: http://stackoverflow.com/q/27156198
type: QuestionComment
type: Comment
score: 2
has text: Fix your title to describe the actual problem you are having and show a example code that indicates your problem.

http://stackoverflow.com/comment/43035166
type: AnswerComment
comment on: http://stackoverflow.com/a/27282832
score: 0
has text: Yes, it sounds like that, but we don't _know_ that for a fact. I'm giving him the benefit of the doubt here.
type: Comment

http://stackoverflow.com/comment/128185379
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27312491
has text: I got this exception when generating token we havent passed client id and secret,grant type all these parameters programatically.

http://stackoverflow.com/comment/42988270
type: Comment
has text: @E_net4, I cannot agree with you. OP is looking for _solution_ and does not have (or at least did not provide) any reason against generics. I guess that such reasons do not really exist. This is java-style solution. Other solutions that I can imagine require casting.
comment on: http://stackoverflow.com/a/27257081
score: 0
type: AnswerComment

http://stackoverflow.com/q/27251517
downvote count: 0
accepted answer: http://stackoverflow.com/a/27251591
has title: Method overloading and passing null
type: Question
has body: I have the following 2 methods overloaded in a class : public class Test{ public static void main(String []args) throws ParseException{ Test t = new Test(); t.testMethod(null); } public void testMethod(Object o){ System.out.println("Object"); } public void testMethod(String s){ System.out.println("String"); } } When I invoke the method testMethod it print "String". When I add one more overloaded method : public void testMethod(StringBuilder sb){ System.out.println("String"); } It throws me compiler error : The method testMethod is ambigous for type Test.. All this happens when I invoke the method with null My questions are : Why it prints String and not Object? Why is there compilation error on adding third method?
favorite count: 0
linked to: http://stackoverflow.com/q/5229809
answer count: 3
score: 5
duplicate of: http://stackoverflow.com/q/5229809
has answer: http://stackoverflow.com/a/27251591
tagged with: overloading
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/27251569
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42977211
tagged with: null
has answer: http://stackoverflow.com/a/27252060
has answer: http://stackoverflow.com/a/27251569

mocking
tags question: http://stackoverflow.com/q/27279370
tags question: http://stackoverflow.com/q/27223063
tags question: http://stackoverflow.com/q/27212484
tag name: mocking
type: Tag

http://stackoverflow.com/a/27198107
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27198085
has body: This should get you started http://www.dreamincode.net/forums/topic/28410-application-to-japplet-and-reverse/ It was the first item in a Google Search, so next time look there first.
type: Answer
answers question: http://stackoverflow.com/q/27198085
score: 1
upvote count: 1

http://stackoverflow.com/comment/43035051
has text: I want to make an app, which will be run in a web server (tomcat) and people connect to the web server. So, I've created a native application as a Google Chrome app. But there is no app_key or app_secret in it :(
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27283306

http://stackoverflow.com/a/27247460
downvote count: 0
score: 15
type: Answer
has body: You can check the Image : If you don't fine the Maven Projects there then you can open it from Bottom Left part of Intellij IDEA, there's one Square Button there. click on it. If You don't have configure the maven path then you also need to configure maven directory also. Using maven settings.
upvote count: 15
answers question: http://stackoverflow.com/q/27246065

http://stackoverflow.com/comment/42803859
comment on: http://stackoverflow.com/q/27153987
has text: @RomanC I edited the question, I made it work with an alternative way. looks like the parameters themself are perfectly fine. It's the 'param' tag that doesn't work when redirecting. Why?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27313759
type: Question
has comment: http://stackoverflow.com/comment/43089652
tagged with: java
has answer: http://stackoverflow.com/a/27315910
has body: I am trying to create a code that calculates the student's GPA using two comboBox that holds grades and units. grade String [] grade = {"A", "B", "C", "D", "E", "F"}; unit String[] unit = {"1", "2", "3", "4", "5", "6"}; For each course there will be a corresponding comboBox comboGrade and comboUnit components holding the values of the array grade and unit respectively. Given that there will be 10 courses, the comboBox grade and unit will be 10 each. I managed this using two ArrayList ArrayList&lt;JComboBox&gt; courseGrade; and ArrayList&lt;JComboBox&gt; courseUnit; to hold the 10 comboBoxes using the following code: //grade String[] grades = {"A","B","C","D","E","F"}; courseGrade = new ArrayList&lt;&gt;(); for (int i=0;i&lt;10;i++){ JComboBox comboGrade = new JComboBox(grade); courseGrade.add(comboUnit); //adds the comboBox to the ArrayList } //unit String[] unit = {"1","2","3","4","5","6"}; courseUnit = new ArrayList&lt;&gt;(); for (int i=0;i&lt;10;i++){ JComboBox comboUnit = new JComboBox(unit); courseUnit.add(comboUnit); //adds the comboBox to the ArrayList } I got the selected item using this ItemListener: public void itemStateChanged(ItemEvent evt){ String item; if (evt.getStateChange()==ItemEvent.SELECTED){ item = (String) evt.getItem(); for each of the comboBox and then added it to a new ArrayList ArrayList&lt;Integer&gt; gradeSelected; switch (item) { case "A": gradeSelected.add(A); break; case "B": gradeSelected.add(B); break; case "C": gradeSelected.add(C); break; case "D": gradeSelected.add(D); break; case "E": gradeSelected.add(E); break; case "F": gradeSelected.add(F); break; } where A, B, C, D, E, F are integer constants representing 5,4,3,2,1,0 respectively Now here is my problem.... What if the user DESELECTS the SELECTED item and then selects a new item from the comboBox ? //I thought of `ItemEvent.DESLECTED`; How do i respond to such event? given that once the user has already selected an item it has been added to the ArrayList "gradeSelected". How…
tagged with: itemlistener
score: 0
answer count: 1
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43089563
type: UnansweredQuestion
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/43090881
has comment: http://stackoverflow.com/comment/43090488
has title: Manipulating ComboBox items
tagged with: swing

http://stackoverflow.com/a/27273138
has comment: http://stackoverflow.com/comment/43016032
downvote count: 0
has comment: http://stackoverflow.com/comment/43016240
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27272545
score: 1
has body: What you actually need is called a type token. Pass a type token to the constructor of your class, if you want to access that type independently. Here is a simplified example that you can easily work into your own classes: public class Generified&lt;T&gt; { private T value; private Class&lt;T&gt; typeToken; public Generified(Class&lt;T&gt; typeToken) { this.typeToken = typeToken; } public T get() { return value; } public void set(T value) { this.value = value; } public void someMethod() { System.out.println(typeToken.getName()); } public static void main(String[] args) { Generified&lt;Integer&gt; generified = new Generified&lt;&gt;(Integer.class); generified.someMethod(); } } Running this program will produce the output java.lang.Integer Note that you still have type safety. The following code - for example - will not compile: Generified&lt;Integer&gt; generified = new Generified&lt;&gt;(String.class);

http://stackoverflow.com/q/27217860
has body: I'm using JPA/Hibernate for a few years and they are really useful. but i have some philosophical problems with the design. the main problem is why should I make all my class properties public(create public setter/getter) just because Hibernate wants to access them even though it can access them without this permission ( through reflection) and in this design getters and setters should be so simple to reduce overhead and then practically they loose their philosophy of being which is controlling access to fields.i.e. in this design getters and setters become shared between Database Access(JPA) and System Domain which need different design criteria. (you probably don'nt need to check a value before setting it to a field when you load it from database because you've done this check before!) can any body explain any reason for this design? I know that it's helpful in some cases but in most of them it's not.! just one more problem that it has is that setters are almost useless when loading an object from database as object is partially loaded and there is no order for it( so it almost force us to implement setters so simple and just a copy from input to filed) !
accepted answer: http://stackoverflow.com/a/27223190
has comment: http://stackoverflow.com/comment/42917182
has comment: http://stackoverflow.com/comment/42915470
upvote count: 1
has title: Java JPA/Hibernate anti-pattern
tagged with: design-patterns
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42919736
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27223190
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42924749
has comment: http://stackoverflow.com/comment/42919714

http://stackoverflow.com/comment/42832269
type: QuestionComment
comment on: http://stackoverflow.com/q/27170469
has text: I suppose you have put @Transactional on your service class?
score: 0
type: Comment

http://stackoverflow.com/a/27290726
has comment: http://stackoverflow.com/comment/43047459
has body: Both intLists and numLists point to the same array, containing a List&lt;Double&gt; at that point. However, since the compiler thinks intLists[0] is of type List&lt;Integer&gt;, it will add a cast to Integer when you retrieve an object from it. So your fifth line is equivalent to double d2 = (Integer)intLists[0].get(0); This will fail because intLists[0].get(0) is in fact a Double. It is key to understand that after line three both intList and numList are the same and your List with Integer 1 is gone. The reason you can come to this point is line two. Here you assign List&lt;Double&gt;[] to an array of which the element type is List&lt;? extends Number&gt;. This should not be allowed. It's a known bug in the java type system and is the reason usage of arrays is discouraged. See this article for more info. If you try to do the same with Lists, you will notice you cannot. List&lt;List&lt;Integer&gt;&gt; intLists = Arrays.asList(Arrays.asList(1)); List&lt;List&lt;? extends Number&gt;&gt; numLists = intLists; // compile fails here. numLists.set(0, Arrays.asList(0.01d)); double d1 = (Double)numLists.get(0).get(0); // ok double d2 = intLists.get(0).get(0); // why java.lang.ClassCastException ?
answers question: http://stackoverflow.com/q/27289897
accepted answer of: http://stackoverflow.com/q/27289897
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/42982527
comment on: http://stackoverflow.com/q/27254302
score: 9
has text: You can't `put("001", "DM");`. `"DM"` is not an `ArrayList<String>`. What do you actually mean?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27170019
has comment: http://stackoverflow.com/comment/106956183
answers question: http://stackoverflow.com/q/27169234
type: Answer
has body: First make an alphanumerical comparator splitting the string in String or Integer parts. public class AlphaNumericalComparator implements Comparator&lt;String&gt; { @Override public int compare(String o1, String o2) { List&lt;Object&gt; parts1 = partsOf(o1); List&lt;Object&gt; parts2 = partsOf(o2); while (!parts1.isEmpty() &amp;&amp; !parts2.isEmpty()) { Object part1 = parts1.remove(0); Object part2 = parts2.remove(0); int cmp = 0; if (part1 instanceof Integer &amp;&amp; part2 instanceof Integer) { cmp = Integer.compare((Integer)part1, (Integer)part2); } else if (part1 instanceof String &amp;&amp; part2 instanceof String) { cmp = ((String) part1).compareTo((String) part2); } else { cmp = part1 instanceof String ? 1 : -1; // XXXa &gt; XXX1 } if (cmp != 0) { return cmp; } } if (parts1.isEmpty() &amp;&amp; parts2.isEmpty()) { return 0; } return parts1.isEmpty() ? -1 : 1; } private List&lt;Object&gt; partsOf(String s) { List&lt;Object&gt; parts = new LinkedList&lt;&gt;(); int pos0 = 0; int pos = 0; boolean wasDigit = false; while (true) { if (pos &gt;= s.length() || Character.isDigit(s.charAt(pos)) != wasDigit) { if (pos &gt; pos0) { String part = s.substring(pos0, pos); parts.add(wasDigit? Integer.valueOf(part) : part); pos0 = pos; } if (pos &gt;= s.length()) { break; } wasDigit = !wasDigit; } ++pos; } return parts; } }; Then use this comparator in your own one, in Java 8 you may simply use Comparator's static methods.
upvote count: 9
score: 9
has comment: http://stackoverflow.com/comment/106902570
downvote count: 0

http://stackoverflow.com/comment/42826636
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27167370
type: Comment
has text: @ortis yes, but if you've added a field, you already edited the code :)

http://stackoverflow.com/q/27268876
has title: Animation does not reproduce after first attempt
has answer: http://stackoverflow.com/a/27270650
answer count: 1
tagged with: android
tagged with: animation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27270650
tagged with: java
has body: At first it runs smoothly as intended and finishes but after that it stops at midway both on a device and on genymotion emulators. Interestingly with the same animations it finishes and it is reproducible if I string together only 3-5. I am using Android Studio 1.0 RC2. The Relevant part of the MainActivity private static final String ANIM = "Animation"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button) findViewById(R.id.button); final ImageView iv = (ImageView) findViewById(R.id.imageV); iv.setVisibility(View.INVISIBLE); final Animation slideUpFromBottom = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_in_bottom); final Animation slideLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_out_left); final Animation slideInFromLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_in_left); final Animation slideOutAtBottom = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_out_bottom); final Animation slideOutAtTop = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_out_top); final Animation slideInFromTop = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_in_top); final Animation slideInFromRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_in_right); final Animation slideOutToRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_out_right); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { slideUpFromBottom.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Log.d(ANIM,"Startes slideUpFromBottom"); iv.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { Log.d(ANIM, "Finished slideUpFromBottom"); slideLeft.setStartOffset(100); iv.setVisibility(View.INVISIBLE)…
type: Question
score: 0

http://stackoverflow.com/a/29914494
downvote count: 0
has body: You may have resolved this by now but try using. "TableStyleMedium9" I am new to POI at the moment but from my understanding this is a per-defined style in excel so this should work ... as to how to create your own table styles in POI I haven't explored myself yet ... if I find out how I will post back
type: Answer
answers question: http://stackoverflow.com/q/27289443
score: 1
upvote count: 1

http://stackoverflow.com/q/27229429
has body: WHen trying to call google's dfp forecast api, I am getting this stacktrace on google app engine. Code seems to be working fine with main method. This is the log: java.lang.reflect.InvocationTargetException com.google.appengine.runtime.Request.process-b731c8eef2f008b1(Request.java) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:45) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActi…
upvote count: 1
answer count: 1
has title: NoSuchMethodError on google app engine
favorite count: 0
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/27230544
type: AnsweredQuestion
tagged with: google-dfp
downvote count: 0
has answer: http://stackoverflow.com/a/27230544
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/43076322
comment on: http://stackoverflow.com/a/27306985
type: AnswerComment
has text: I tried what you said, but no go. Still have the same error.
score: 0
type: Comment

http://stackoverflow.com/q/27167099
tagged with: java
tagged with: glassfish
score: 0
has answer: http://stackoverflow.com/a/27167390
has title: apache tomcat and glassfish server not decoding utf-8 characters?
tagged with: jsp
tagged with: tomcat
has answer: http://stackoverflow.com/a/27167618
answer count: 3
has body: This is my Jsp page: JSP Page <% String msg="206_John_help i m in trouble,delhi,อินเดีย_30.64741430_76.817313799"; String result = java.net.URLEncoder.encode(msg, "UTF-8"); System.out.println("The msg is "+result); String result1=java.net.URLDecoder.decode(result, "UTF-8"); System.out.println("The decoded msg is "+result1); %> The output is 206_John_help i m in trouble,delhi,???????_30.64741430_76.817313799 I am always getting ?????? instead of thai alphabets. How can I get the Thai alphabets while decoding?
linked to: http://stackoverflow.com/q/4900157
tagged with: utf-8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42826127
type: Question
has answer: http://stackoverflow.com/a/27168213

http://stackoverflow.com/a/27199638
has body: The string argument am calling in the above class is this: code: String str = A.c(socks.getInputStream()); DataSplitter dataSplitter = DataSplitter.get_data_splitter(str); I debugged further and saw that map doesn't contain any string key value called "Host". Am out of ideas on how to get the mapped in key using hashmap. Please any further suggestions on how to go about restructuring my code?
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/42883917
answers question: http://stackoverflow.com/q/27193641

http://stackoverflow.com/comment/43079264
has text: Also worth noting that the run method is what is actually run (funnily enough) when you create the new thread by calling start(). If you were to call the run() method directly instead of start(), it would not run as a separate thread.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27308620

http://stackoverflow.com/comment/43115549
has text: Are you sure it's a brand problem instead of Android version problem? Please provide Android version of the Note 2 and the Z2 for reference.
score: 0
comment on: http://stackoverflow.com/q/27241651
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43034323
type: Comment
type: QuestionComment
has text: @DavidWallace He sure does.
score: 0
comment on: http://stackoverflow.com/q/27157742

http://stackoverflow.com/a/27221302
answers question: http://stackoverflow.com/q/27221145
accepted answer of: http://stackoverflow.com/q/27221145
type: Answer
upvote count: 3
has body: I don't think that it is possible to put 2 @WebServlet annotations on the same class, however you can accomplish your goal by mapping the servlet to 2 different URLs like this: @WebServlet(name=”Servlet1”, urlPatterns={"/url1", "/url2"}) public class ServClass extends HttpServlet { And then you can determine which URL was used by examining the request object. For reference, see the servlet 3.0 spec.
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27278083
answer count: 2
has title: Adding multiple buttons to a Java frame efficiently using NetBeans
score: 0
has answer: http://stackoverflow.com/a/27278381
tagged with: user-interface
has comment: http://stackoverflow.com/comment/43025593
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27278563
tagged with: java
has body: Good Evening all I'm attempting to add multiple buttons to a frame on the press of a previous button so lets say I have a go button on a frame when I press that I want to be able to display a number of buttons that represent months while removing the Go button previously (I'd post an image but not enough reputation points). I've tried putting them in a panel and making them visible as the panel becomes visible but that doesn't seem to work. Once I've pressed the month button I then want a bunch of buttons to be shown that correspond to dates Any clues as to how to do this You may have guessed I'm fairly new to Java I haven't posted any code as I'd rather get a rough idea as to how this can be achieved then attempt to do it myself so to speak Many Thanks
type: Question

http://stackoverflow.com/a/27294538
has body: You can change the selection mode of your filechooser. chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); Oracle File Chooser tutorial
answers question: http://stackoverflow.com/q/27294023
type: Answer
score: 0

http://stackoverflow.com/comment/43071160
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27304062
has text: So maybe try to use `ArrayAdapter(Context context, int resource, T[] objects)` constructor to provide your data by calling `super(context, R.layout.fragment_badges_listrow, badges.toArray())` in `BadgesListAdapter` constructor.
score: 0

http://stackoverflow.com/q/27247990
type: Question
possible better answer: http://stackoverflow.com/a/27248142
answer count: 2
tagged with: mapping
has comment: http://stackoverflow.com/comment/42970721
upvote count: 2
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27248066
has title: Null Pointer Exception in setter of entity in hibernate
has body: I am trying to map one-to-one relation between User and ProteinData Entity but getting null pointer exception in setter in My User Entity. My main service code Program.java public class Program { public static void main(String a[]){ Session session=HibernateUtility.getSessionFactory().openSession(); session.beginTransaction(); User user=new User(); user.addHistory(new UserHistory(new Date(),"set name to akku")); user.setName("akku"); user.getProteinData().setTotal(234); user.addHistory(new UserHistory(new Date(),"set goal to 234")); session.save(user); session.getTransaction().commit(); session.beginTransaction(); User loadedeUser=(User)session.get(User.class,1); System.out.println(loadedeUser.getName()); System.out.println(loadedeUser.getProteinData().getGoal()); for(UserHistory history:loadedeUser.getHistory()){ //System.out.println("key is: "+ history.getKey()); System.out.println(history.getEntryTime().toString()+" "+history.getEntry()); } loadedeUser.getProteinData().setTotal(loadedeUser.getProteinData().getTotal()+50); loadedeUser.addHistory(new UserHistory(new Date(),"added 32 proteins")); session.getTransaction().commit(); session.close(); HibernateUtility.getSessionFactory().close(); } } User Entity public class User { private int id; private String name; private ProteinData proteinData; private List&lt;UserHistory&gt; history=new ArrayList&lt;UserHistory&gt;(); public User(){ setProteinData(new ProteinData()); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public ProteinData getProteinData() { return proteinData; } public void setProteinData(ProteinData proteinData) { this.proteinData = proteinData; try{ proteinData.setUser(this); //Null Pointer Exception here }catch(Exception e){ e.printStackTrace(); } } public List&lt;UserHistory&gt; getHistory() { return history; } public void setHistory(List&lt;UserHistory&gt; history) { this…
tagged with: setter
accepted answer: http://stackoverflow.com/a/27248066
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27248142
favorite count: 0
tagged with: one-to-one

http://stackoverflow.com/comment/140061574
comment on: http://stackoverflow.com/a/29579193
score: 0
type: AnswerComment
has text: This answer is great! But for practical purposes, it leads directly to the question of eligibility for garbage collection of the enclosing class (for non-capturing lambdas). In many cases that's effectively "never" as far as I understand. So, while non-capturing lambdas _can_ be garbage collected, in _practice_ we almost might as well think of them as not being so. Or am I missing something?
type: Comment

http://stackoverflow.com/a/27181285
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27181160
has body: I'm a bit confused. In the code that you have posted up, the Set should not be erased, because you have defined it as static. Are you saying that when you make it not static, then it gets erased when you call the class? I'm assuming that the class works as you have posted it, but you want to make the Set non-static, but that when you do that, it gets erased. So the first thing to do is: private final HashSet&lt;Integer&gt; pSet = new HashSet&lt;&gt;(); // Changed to private The problem, then, is that your calling code has to say Number n = new Number(15); // Or whatever number you're calling it with so every time you call it, it gets a fresh copy of Number and your Set is gone. So instead, make your calling code only create one Number(), but have a new method in Number that looks like: public void setNumber(int n){ number = n; } Then every time you want to call number, you can call number.setNumber(5); number.isBoolean();

android-layout
tags question: http://stackoverflow.com/q/27216099
tag name: android-layout
tags question: http://stackoverflow.com/q/27306913
tags question: http://stackoverflow.com/q/27193767
type: Tag
tags question: http://stackoverflow.com/q/27300502
tags question: http://stackoverflow.com/q/27282668
tags question: http://stackoverflow.com/q/27215117
tags question: http://stackoverflow.com/q/27184822
tags question: http://stackoverflow.com/q/27300328
tags question: http://stackoverflow.com/q/27227011
tags question: http://stackoverflow.com/q/27290162
tags question: http://stackoverflow.com/q/27288762
tags question: http://stackoverflow.com/q/27253172
tags question: http://stackoverflow.com/q/27247871
tags question: http://stackoverflow.com/q/27181268
tags question: http://stackoverflow.com/q/27286993
tags question: http://stackoverflow.com/q/27235891
tags question: http://stackoverflow.com/q/27182430
tags question: http://stackoverflow.com/q/27270993

http://stackoverflow.com/q/27284228
has answer: http://stackoverflow.com/a/27299846
favorite count: 0
has answer: http://stackoverflow.com/a/27294019
upvote count: 2
possible better answer: http://stackoverflow.com/a/27299846
tagged with: hibernate-mapping
accepted answer: http://stackoverflow.com/a/27294019
has title: How to query by custom object entity property with JPA and Hibernate
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: hibernate
tagged with: orm
has body: Writing a DAO method to retrieve appUsers by email where email is of class EmailAddress. Been searching around for how to do this to no avail. Is there a way to retrieve records based off of the value of a custom object? This seems to work when I have a property that is of type String or int but how do I get records matching my EmailAddress object? Tried the following but not working: public List&lt;AppUser&gt; findByEmail(EmailAddress email) { log.debug("finding " + getTable() + " instance by example"); AppUser appUser = new AppUser(); appUser.setEmail(email); try { List&lt;AppUser&gt; results = this.sessionFactory.getCurrentSession() .createCriteria(AppUser.class) .add(Example.create(appUser)).list(); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } } Here's are the pertinent parts of my AppUser class @Entity @Table(name="AppUser") public class AppUser extends BaseEntity { ... @Column(name="Email") private EmailAddress email; ... /** * Gets this AppUser's associated email * * @return this AppUser's associated email */ public EmailAddress getEmail() { return this.email; } /** * Sets this AppUser's associated email * * @param email this AppUser's associated email */ public void setEmail(EmailAddress email) { this.email = email; } } And here is my EmailAddress class public class EmailAddress implements Serializable { private static final long serialVersionUID = -6999956021169014445L; private static final String AT_DELIMTER = "@"; private String emailAddress; public EmailAddress() {} public EmailAddress(String emailAddress) { setEmailAddress(emailAddress); } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) throws IllegalArgumentException { if (StringUtils.isEmpty(emailAddress)) throw new IllegalArgumentException("Parameter emailAddress cannot be blank."); else if (!EmailValidator.getInstan…
type: Question
tagged with: jpa
downvote count: 0
answer count: 2

http://stackoverflow.com/a/27248674
answers question: http://stackoverflow.com/q/27248294
has comment: http://stackoverflow.com/comment/42972699
has comment: http://stackoverflow.com/comment/42972559
downvote count: 0
score: 1
has body: I also had the same issue. Ask your Server admin for the permissions for using the database for both web and mobile. After that paste your php files in public_html.
upvote count: 1
has comment: http://stackoverflow.com/comment/42972880
type: Answer

http://stackoverflow.com/q/27200688
favorite count: 0
has comment: http://stackoverflow.com/comment/42892643
accepted answer: http://stackoverflow.com/a/27208709
has body: Dagger is advertised as "A fast dependency injector for Android and Java". But I'm not able to make it run without Gradle 'android' plugin. compile 'com.squareup.dagger:dagger:1.2.1' provided 'com.squareup.dagger:dagger-compiler:1.2.1' There is no provided in 'java' or 'application' gradle plugin I'm using. It is even mentioned in this bug report. Making it both 'compile' yelds no result. The same java.lang.IllegalStateException: Module adapter for class ... could not be loaded. is thrown. How gradle with 'java' and 'application' can be configured to use dagger annotation processor?
has title: How to use Dagger in non-Android Gradle Java application?
score: 8
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27208709
tagged with: gradle
upvote count: 8
type: Question
tagged with: dependency-injection
tagged with: java
tagged with: dagger
answer count: 1

http://stackoverflow.com/comment/42889279
type: Comment
comment on: http://stackoverflow.com/q/27203236
score: 0
has text: Well, there was no annotations prior to 1.5; and I guess trying and `public @interface Whatever` in 1.4 or less was a compile error... Haven't tried ;)
type: QuestionComment

http://stackoverflow.com/q/27254812
possible better answer: http://stackoverflow.com/a/27255016
tagged with: calendar
type: Question
score: -2
answer count: 3
accepted answer: http://stackoverflow.com/a/27254912
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27255016
favorite count: 0
has title: Calendar error in Java
has body: I use Calendar c = Calendar.getInstance() to store the current date. But when i try to view i find an error. c.get(Calendar.MONTH+1) is egual to 49. Why? Thank you.
has answer: http://stackoverflow.com/a/27254912
tagged with: android
has answer: http://stackoverflow.com/a/27255160
has comment: http://stackoverflow.com/comment/42983481
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43011416
has text: System.out.println(new File("login.properties").getAbsolutePath()); you'll get a directory
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27270657

http://stackoverflow.com/comment/43046421
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27290079
has text: A map is probably *not* what you want; what if there are multiple tests with the same expected value?
score: 0

http://stackoverflow.com/a/27210701
score: 5
has comment: http://stackoverflow.com/comment/42902846
has comment: http://stackoverflow.com/comment/42902859
has body: A determenistic order just means that it's constantly reproducible - the same input will always provide the same iteration order. In this case, the answer is "all of the above". Although most Set's and Map's ordering can't be trusted, it is still determenistic, and will remain the same until the underlying implementation is changed (e.g., if you change or upgrade JVMs). A predictable order is something more, though - it means that the collection guarantees the order items are returned when iterating the collection. Both "linked" types you mentioned above do that - the order that items were inserted to the collection is the order they will be returned when iterating over it. The "tree" types also guarantee a deterministic order of iteration - a sorted one.
has comment: http://stackoverflow.com/comment/42902907
has comment: http://stackoverflow.com/comment/139720735
type: Answer
upvote count: 6
downvote count: 1
answers question: http://stackoverflow.com/q/27210560

http://stackoverflow.com/comment/43068646
comment on: http://stackoverflow.com/a/27302703
type: AnswerComment
has text: @user1908375 `Class<T>` already provides [`newInstance()`](http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#newInstance%28%29) method. You do need a parameterless constructor in order for this to work.
score: 0
type: Comment

http://stackoverflow.com/a/27502460
has comment: http://stackoverflow.com/comment/43470817
has comment: http://stackoverflow.com/comment/43477521
has body: Just delete all files in these two folders: C:\Users\Ghost\AppData\Roaming\NetBeans\7.4\ C:\Users\Ghost\AppData\Local\NetBeans\Cache\7.4\ And try to create a bug report in Netbeans's Bugzilla: https://netbeans.org/bugzilla/
has comment: http://stackoverflow.com/comment/43476163
has comment: http://stackoverflow.com/comment/43976371
type: Answer
answers question: http://stackoverflow.com/q/27277305
has comment: http://stackoverflow.com/comment/45233188
score: 0

http://stackoverflow.com/q/27220422
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42919979
has comment: http://stackoverflow.com/comment/42919876
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/604424
has title: How to load parts of a file using jFrame into an ArrayList in Java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27220453
has body: I am writing a program for an assignment that uses a jFrame UI to read the contents of a notepad file full of "grades" (A, B, C, C+ etc) and then calculate the total number of grades, and the highest and lowest grades. In the jFrame, the user inputs a file name (I do not want to use JFileChooser because that is not part of the assignment) and clicks "load" to load the file. I am struggling with the Load() method. So far, I have: public ArrayList&lt;LetterGrade&gt; Load(File file) throws FileNotFoundException { ArrayList&lt;LetterGrade&gt; grades = new ArrayList(); try{ Scanner input = new Scanner(file); String grade = input.nextLine(); grades.add(LetterGrade.grade); } catch (FileNotFoundException ex) { System.out.printf("ERROR: %s", ex); } return grades; I know that there is a problem in the line that says grades.add(LetterGrade.grade) because I can only add a LetterGrade enum (A, AMinus, BPlus, B etc) to the ArrayList "grades" whereas grade is a String. How can I make it so that when Scanner reads the file, it takes each grade and adds it to the ArrayList called "grades"? Also, I only want to take grades that are part of my LetterGrade enum, so would I use an if/else to filter that? Thanks for the help, and I will respond as quickly as possible to questions.
tagged with: swing
has answer: http://stackoverflow.com/a/27220444
has comment: http://stackoverflow.com/comment/42920436
has comment: http://stackoverflow.com/comment/42919993
tagged with: java

http://stackoverflow.com/comment/43023044
type: Comment
has text: They are not consecutive. I just ordered it that way to make it clear to read. There are about 50-80 files in that folder.
score: 0
comment on: http://stackoverflow.com/q/27276896
type: QuestionComment

http://stackoverflow.com/comment/43010797
score: 0
type: QuestionComment
has text: Thank you Roman! I think ORM works through REFLECTION to access private fields of a class. But I am not sure about this.
type: Comment
comment on: http://stackoverflow.com/q/27261630

timer
tag name: timer
tags question: http://stackoverflow.com/q/27275179
tags question: http://stackoverflow.com/q/27160592
tags question: http://stackoverflow.com/q/27304519
tags question: http://stackoverflow.com/q/27271956
tags question: http://stackoverflow.com/q/27312350
tags question: http://stackoverflow.com/q/27194554
tags question: http://stackoverflow.com/q/27165049
type: Tag
tags question: http://stackoverflow.com/q/27231827
tags question: http://stackoverflow.com/q/27239567
tags question: http://stackoverflow.com/q/27154621
tags question: http://stackoverflow.com/q/27234916
tags question: http://stackoverflow.com/q/27270680
tags question: http://stackoverflow.com/q/27180499
tags question: http://stackoverflow.com/q/27263496
tags question: http://stackoverflow.com/q/27277029
tags question: http://stackoverflow.com/q/27227119
tags question: http://stackoverflow.com/q/27159840
tags question: http://stackoverflow.com/q/27209374
tags question: http://stackoverflow.com/q/27283711
tags question: http://stackoverflow.com/q/27255244
tags question: http://stackoverflow.com/q/27247910
tags question: http://stackoverflow.com/q/27221772
tags question: http://stackoverflow.com/q/27286997
tags question: http://stackoverflow.com/q/27300237
tags question: http://stackoverflow.com/q/27218014
tags question: http://stackoverflow.com/q/27281781

http://stackoverflow.com/a/27293169
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43061289
has body: When you get "unfortunately ,xyz has stopped working" , always put some breakpoints and DEBUG your code properly.Check your LOGCAT, you will land up finding the problems you are facing when your app crashes. Thanks!
type: Answer
answers question: http://stackoverflow.com/q/27293034
score: 1
has comment: http://stackoverflow.com/comment/43051558

http://stackoverflow.com/a/27289275
has comment: http://stackoverflow.com/comment/43045065
upvote count: 3
has body: You might use an enum type. Something like, enum Direction { NORTH(Color.RED), WEST(Color.BLUE), EAST(Color.BLACK), SOUTH( Color.GREEN); Direction(Color c) { color = c; } private Color color; public static Direction fromName(String name) { for (Direction d : Direction.values()) { if (d.name().equalsIgnoreCase(name)) { return d; } } return NORTH; } public Color getColor() { return color; } } Then, you can use it like Direction.fromName("south").getColor(); // &lt;-- green.
has comment: http://stackoverflow.com/comment/43044950
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43044988
type: Answer
has comment: http://stackoverflow.com/comment/43045046
answers question: http://stackoverflow.com/q/27289210

http://stackoverflow.com/q/27212679
answer count: 1
has comment: http://stackoverflow.com/comment/42906086
has comment: http://stackoverflow.com/comment/42909812
tagged with: java
accepted answer: http://stackoverflow.com/a/27215604
has comment: http://stackoverflow.com/comment/42908650
tagged with: graph
type: AnsweredQuestion
has title: Update the graph in Ford-Fulkerson
has body: I'm implementing the Ford-Fulkerson algorithm but i have some problem in updating the graph after augmenting phase. My data structure doesn't make this easy i guess. To represent the graph i use this: private Map&lt;Vertex, ArrayList&lt;Edge&gt;&gt; outgoingEdges; That is, i associate at each Vertex its list of outgoing edges. To manage the backward edges, i associated a "opposite" edge for each edge in the graph. Any kind of suggestion is appreciated. public class FF { /** * Associates each Vertex with his list of outgoing edges */ private Map&lt;Vertex, ArrayList&lt;Edge&gt;&gt; outgoingEdges; public FF() { outgoingEdges = new HashMap&lt;Vertex, ArrayList&lt;Edge&gt;&gt;(); } /** * Returns the nodes of the graph */ public Collection&lt;Vertex&gt; getNodes() { return outgoingEdges.keySet(); } /** * Returns the outgoing edges of a node */ public Collection&lt;Edge&gt; getIncidentEdges(Vertex v) { return outgoingEdges.get(v); } /** * Adds a new edge to the graph */ public void insertEdge(Vertex source, Vertex destination, float capacity) throws Exception { if (!(outgoingEdges.containsKey(source) &amp;&amp; outgoingEdges.containsKey(destination))) throw new Exception("Unable to add the edge"); Edge e = new Edge(source, destination, capacity); Edge opposite = new Edge(destination, source, capacity); outgoingEdges.get(source).add(e); outgoingEdges.get(destination).add(opposite); e.setOpposite(opposite); opposite.setOpposite(e); } /** * Adds a new node to the graph */ public void insertNode(Vertex v) { if (!outgoingEdges.containsKey(v)) outgoingEdges.put(v, new ArrayList&lt;Edge&gt;()); } /** * Ford-Fulkerson algorithm * * @return max flow */ public int fordFulkerson(Vertex source, Vertex destination) { List&lt;Edge&gt; path = new ArrayList&lt;Edge&gt;(); int maxFlow = 0; while(bfs(source, destination, path)) { // finds the bottleneck float minCap = bottleneck(path); // updates the maxFlow maxFlow += minCap; // updates the graph &lt;-- this updates only the local list pa…
type: Question
tagged with: ford-fulkerson
has comment: http://stackoverflow.com/comment/42907173
has answer: http://stackoverflow.com/a/27215604
score: 0
has comment: http://stackoverflow.com/comment/42908635

http://stackoverflow.com/a/27189815
score: 1
has comment: http://stackoverflow.com/comment/42865864
has comment: http://stackoverflow.com/comment/42866908
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27189545
has body: EDIT Added logic for more questions... Expand it in similar fashion for everything you need. You could expand this code into a single method as well so you avoid code replication. Check answer from user alaster for an example. Try this. It will store the name variable in case you want to use it further. We use a boolean to keep asking the user to input his name until he validates it. Of course, you can still use while(true) and then break if the name is valid, but I prefer this method since the code is more clear and easier to understand. private static boolean isVerified(String verify) { if (verify.equalsIgnoreCase("yes")) { return true; } else if (verify.equalsIgnoreCase("no")) { return false; } else return false; } public static void main(String[] args) { Scanner input = new Scanner(System.in); boolean validName = false; boolean validTelephoneNo = false; boolean validAddress = false; String name=""; String telephoneNo=""; String address=""; while (!validName) { System.out.print("Enter your name: "); name = input.next(); System.out.println("Are you sure your name is " + name + "?"); final String verify = input.next(); if (isVerified(verify)) { System.out.println("Verified! Your name is: " + name); validName = true; } else { System.out.println("Not verified! Please type your name again."); } } while (!validTelephoneNo) { System.out.print("Enter your telephone nummber: "); telephoneNo = input.next(); System.out.println("Are you sure your telephone number is " + telephoneNo + "?"); final String verify = input.next(); if (isVerified(verify)) { System.out.println("Verified! Your telephone number is: " + telephoneNo); validTelephoneNo = true; } else { System.out.println("Not verified! Please type your telephone number again."); } } while (!validAddress) { System.out.print("Enter your address: "); address = input.next(); System.out.println("Are you sure your address is " + address + "?"); final String verify = input.next(); if (isVerified(verify)) { System.out.println("V…
has comment: http://stackoverflow.com/comment/42866871
downvote count: 0

http://stackoverflow.com/q/27160612
favorite count: 0
has body: I'm developing a web app with Java 6 EE and DB2. I created a table function that receives 3 parameters and returns a table. CREATE FUNCTION MY_FUNCTION (PARAM1 VARCHAR(5), PARAM2 VARCHAR(10), PARAM3 INTEGER) RETURNS TABLE ( FIELD1 VARHCHAR(5), FIELD2 VARCHAR(10), FIELD3 INTEGER ) RETURN SELECT FIELD1, FIELD2, FIELD3 FROM TABLE_1 WHERE FIELD1 = PARAM1 || '_MAIN' AND FIELD2 = PARAM2 || '_MAIL' AND FIELD3 = PARAM3 + 47 I'm trying to execute a function in Java with prepared statement as follows (using wildcards): PreparedStatement stmt = conn.prepareStatement("SELECT * FROM TABLE(MY_FUNCTION(?, ?, ?)) AS TABLE"); But when I run my code, I get an SQLSyntaxErrorException in the prepared statement: java.sql.SQLSyntaxErrorException: [SQL0418] A statement contains a use of a parameter marker that is not valid at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:828) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:699) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:669) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1660) at com.ibm.as400.access.AS400JDBCPreparedStatement.&lt;init&gt;(AS400JDBCPreparedStatement.java:248) at com.ibm.as400.access.AS400JDBCCallableStatement.&lt;init&gt;(AS400JDBCCallableStatement.java:120) at com.ibm.as400.access.AS400JDBCConnection.prepareCall(AS400JDBCConnection.java:1840) at com.ibm.as400.access.AS400JDBCConnection.prepareCall(AS400JDBCConnection.java:1741) Note: If I hardcode the parameters like this (without wilcards) works: PreparedStatement stmt = conn.prepareStatement("SELECT * FROM TABLE(MY_FUNCTION('" + var1 + "', '" + var2 + "', '" + var3 + "')) AS TABLE"); What I want to achieve is to call the functions with the wildcards to improve the processing of the function. Thanks in advance Solution with @user384842 answer PreparedStatement stmt = conn.prepareStatement("SELECT * FROM TABLE(MY_FUNCTION(cast(? as VARCHAR(5)), cast(? as VARCHAR(10)), cast(? as IN…
score: 2
downvote count: 0
tagged with: user-defined-functions
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27160788
accepted answer: http://stackoverflow.com/a/27160788
tagged with: java
tagged with: prepared-statement
type: Question
upvote count: 2
has title: Java call User Defined Table Function DB2 with prepared statement
answer count: 1
tagged with: db2

http://stackoverflow.com/comment/43043904
type: QuestionComment
type: Comment
has text: it is in my drawer_list_item.xml.
comment on: http://stackoverflow.com/q/27288413
score: 0

http://stackoverflow.com/a/27228198
has comment: http://stackoverflow.com/comment/42933963
answers question: http://stackoverflow.com/q/27227951
score: 0
has body: Here is a link were you can run tomcat in eclipse: http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html
type: Answer
has comment: http://stackoverflow.com/comment/42934003

http://stackoverflow.com/q/27270747
tagged with: java
has comment: http://stackoverflow.com/comment/43011526
has answer: http://stackoverflow.com/a/27270999
type: Question
has comment: http://stackoverflow.com/comment/43011781
accepted answer: http://stackoverflow.com/a/27270999
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans
upvote count: 1
has title: How to verify the user input in a textfield to compare it with a variable?
type: AnsweredQuestion
has body: I want to verify the user input (number) in a textfield that if it's bigger than 9 or not. Note that the number from 1 to 9. if it's bigger than 9 I want to show a jOptionPane some code i have traied: else if(jTextField1.contains()){ // want to compare it if it's bigger than 9 or not jOptionPane1.showMessageDialog(this,"Please enter the number of the tab"); // wich means from 1 to 9 } So how to do that with java? Thanks in advance :)
score: 1

http://stackoverflow.com/comment/43097895
score: 0
type: AnswerComment
has text: for point 1 record starting with same token can not have different fieldset mappers i think.but we can solve this problem by taking care of field length of record in custom fieldset mapper. for point 2.yes.we can process all type of records in a single reader as i shared the example.i am using this code in my project with out hassle.
type: Comment
comment on: http://stackoverflow.com/a/27287230

http://stackoverflow.com/q/27273777
tagged with: tomcat7
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27400833
has title: Spring REST service doesn't fired with certain symbols in URL
downvote count: 0
has body: I work on rest service on java. This service include Spring mvc model. And it works ok, but when i use Russian char х in url, i have 404 and spring method in controller doesn't run. I transfer this data with url encode. localhost:8080/x/test Service code: @RequestMapping(value = "{id}/test", method = RequestMethod.GET) @ResponseBody public String getListOfResources(HttpServletRequest request, HttpServletResponse httpServletResponse, @PathVariable(value = "id") String id) { System.out.println(test); }
possible better answer: http://stackoverflow.com/a/27274495
favorite count: 0
has answer: http://stackoverflow.com/a/27274495
tagged with: rest
tagged with: spring
has comment: http://stackoverflow.com/comment/43017068
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27400833
upvote count: 2

http://stackoverflow.com/comment/138927682
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27287281
has text: Using absolute path to a directory or file is not recommended
type: AnswerComment

http://stackoverflow.com/q/27215328
type: Question
upvote count: 4
answer count: 3
tagged with: jersey
downvote count: 0
tagged with: jersey-2.0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27216199
possible better answer: http://stackoverflow.com/a/27215459
has answer: http://stackoverflow.com/a/27215459
has answer: http://stackoverflow.com/a/43748571
accepted answer: http://stackoverflow.com/a/27216199
has body: I want to create simple Jersey 2 Client app with Maven (Server app is also implemented and runs). My pom.xml 4.0.0 com.client RestClient jar 1.0-SNAPSHOT RestClient http://maven.apache.org junit junit 3.8.1 test org.glassfish.jersey.core jersey-client 2.13 provided org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 java code package com.client; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; import javax.ws.rs.client.Invocation.Builder; public class App { public static void main( String[] args ) { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080").path("simple-service-webapp/rest/myresource"); Builder builder = target.request(); //Response response = builder.get(); String result = builder.get(String.class); System.out.println(target.getUri().toString()); System.out.println("Result=" + result); } } I build app by command mvn package and everything pass. Then, I run app by java -cp target/RestClient-1.0-SNAPSHOT.jar com.client.App and then error occurs: Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder at com.client.App.main(App.java:20) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.client.ClientBuilder 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.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) ... 1 more It seems that libraries are not included, because files tree of projeckt looks: . ├── pom.xml ├── src │ ├── main │ │ └── java │ │ └── …
tagged with: maven
tagged with: jersey-client
type: AnsweredQuestion
tagged with: java
has title: Jersey 2 client with maven

http://stackoverflow.com/q/27180913
has comment: http://stackoverflow.com/comment/42850261
has body: How do I read this information in Java and convert it into a readable format? Could anyone please give me some idea where to start? 5200 0000 5300 0000 5400 0000 c51e a406 0200 0400 0000 0000 0000 0000 0000 0000 5220 0000 5320 0000 5420 0000 ba1e 9e06 0900 0400 0000 0000 0000 0000 0000 0000 0140 0000 0240 0000 0340 0000 270f 4b06 0100 0400 0000 0000 0000 0000 0000 0000 EDIT: It's an ex2 filesystem. (It's a 20,480KB file(filesystem) where most of it contain just 0000 0000 0000 0000). EDIT2: I'm trying to understand how an ex2 filesystem is laid out on disk and how both files and directories can be located and read. If anyone could briefly explain this to me would be much appreciated. EDIT3: I've found some libraries that might help but not quite sure it they are useful of what I want? java.nio.ByteBuffer java.nio.ByteOrder java.nio.channels.FileChannel java.nio.file.FileSystems
has answer: http://stackoverflow.com/a/27180948
tagged with: java
has title: Java how to read bytes into String
type: Question
tagged with: filesystems
score: 0
answer count: 1
tagged with: kernel
tagged with: linux
type: UnansweredQuestion

multithreading
tags question: http://stackoverflow.com/q/27202449
tags question: http://stackoverflow.com/q/27278638
tags question: http://stackoverflow.com/q/27202171
tags question: http://stackoverflow.com/q/27214985
tags question: http://stackoverflow.com/q/27257359
tags question: http://stackoverflow.com/q/27167588
tags question: http://stackoverflow.com/q/27209375
tags question: http://stackoverflow.com/q/27228072
type: Tag
tags question: http://stackoverflow.com/q/27302697
tags question: http://stackoverflow.com/q/27266249
tags question: http://stackoverflow.com/q/27225265
tags question: http://stackoverflow.com/q/27216803
tags question: http://stackoverflow.com/q/27273088
tags question: http://stackoverflow.com/q/27286690
tags question: http://stackoverflow.com/q/27275894
tags question: http://stackoverflow.com/q/27162335
tags question: http://stackoverflow.com/q/27202340
tags question: http://stackoverflow.com/q/27259948
tags question: http://stackoverflow.com/q/27283559
tags question: http://stackoverflow.com/q/27292881
tags question: http://stackoverflow.com/q/27165006
tags question: http://stackoverflow.com/q/27246717
tags question: http://stackoverflow.com/q/27188279
tags question: http://stackoverflow.com/q/27269844
tags question: http://stackoverflow.com/q/27194708
tags question: http://stackoverflow.com/q/27182266
tags question: http://stackoverflow.com/q/27289638
tags question: http://stackoverflow.com/q/27260171
tags question: http://stackoverflow.com/q/27158548
tags question: http://stackoverflow.com/q/27251431
tags question: http://stackoverflow.com/q/27164311
tags question: http://stackoverflow.com/q/27232641
tags question: http://stackoverflow.com/q/27158418
tags question: http://stackoverflow.com/q/27234504
tags question: http://stackoverflow.com/q/27259627
tags question: http://stackoverflow.com/q/27278797
tags question: http://stackoverflow.com/q/27189057
tags question: http://stackoverflow.com/q/27265709
tags question: http://stackoverflow.com/q/27227283
tags question: http://stackoverflow.com/q/27308956
tags question: http://stackoverflow.com/q/27218779
tags question: http://stackoverflow.com/q/27231193
tags question: http://stackoverflow.com/q/27222646
tags question: http://stackoverflow.com/q/27187328
tags question: http://stackoverflow.com/q/27280390
tags question: http://stackoverflow.com/q/27313622
tags question: http://stackoverflow.com/q/27221772
tags question: http://stackoverflow.com/q/27216098
tags question: http://stackoverflow.com/q/27181952
tags question: http://stackoverflow.com/q/27233901
tags question: http://stackoverflow.com/q/27233958
tags question: http://stackoverflow.com/q/27198336
tags question: http://stackoverflow.com/q/27171223
tags question: http://stackoverflow.com/q/27252006
tags question: http://stackoverflow.com/q/27311963
tags question: http://stackoverflow.com/q/27299541
tags question: http://stackoverflow.com/q/27189002
tags question: http://stackoverflow.com/q/27222519
tags question: http://stackoverflow.com/q/27232860
tags question: http://stackoverflow.com/q/27208999
tags question: http://stackoverflow.com/q/27279371
tags question: http://stackoverflow.com/q/27198826
tags question: http://stackoverflow.com/q/27269068
tags question: http://stackoverflow.com/q/27207262
tags question: http://stackoverflow.com/q/27164453
tags question: http://stackoverflow.com/q/27308483
tags question: http://stackoverflow.com/q/27255244
tags question: http://stackoverflow.com/q/27284164
tags question: http://stackoverflow.com/q/27163066
tags question: http://stackoverflow.com/q/27287774
tags question: http://stackoverflow.com/q/27155504
tags question: http://stackoverflow.com/q/27268287
tags question: http://stackoverflow.com/q/27250450
tags question: http://stackoverflow.com/q/27283462
tags question: http://stackoverflow.com/q/27252852
tags question: http://stackoverflow.com/q/27309700
tags question: http://stackoverflow.com/q/27245731
tags question: http://stackoverflow.com/q/27287351
tags question: http://stackoverflow.com/q/27268645

http://stackoverflow.com/comment/42878093
score: 0
type: AnswerComment
has text: I can't use this method for now, I need it with simple methods.
type: Comment
comment on: http://stackoverflow.com/a/27196331

http://stackoverflow.com/comment/43051289
score: 0
has text: Obviously because I want to get Hibernate's idea of how to update the schema to match the entities, but do something else with it rather than just apply it as is.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27252546

http://stackoverflow.com/q/27309852
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/27309898
has body: I have a java class called Constants filled with variables. And currently if I want to use that variable in an activity I have to use it like this. Constants.variable = "blah blah"; Is there a way to import my Constants class into my activity so that I can just use it like a normal variable like this variable = "blah blah"; I have tried import com.myname.appname.Constants; but this doesn't seem to work. Thanks for the help in advance.
has answer: http://stackoverflow.com/a/27309959
upvote count: 4
has title: Android - Import Java Class into Activity
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/38114378
answer count: 4
score: 4
linked to: http://stackoverflow.com/q/2903166
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27309907

http://stackoverflow.com/a/27238296
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42953374
has comment: http://stackoverflow.com/comment/42953294
type: AcceptedAnswer
upvote count: 1
has body: Try this public static void main(String[] args) { for(int i = 1; i &lt;= 10; i++) { for(int j = 1; j &lt;= 10; j++) { System.out.print(i*j + "\t"); } System.out.println(); } } If you want more space between numbers, just add it to the first System.out.print() To add a tab use the scape sequence "\t"
type: Answer
has comment: http://stackoverflow.com/comment/42953420
has comment: http://stackoverflow.com/comment/42953279
accepted answer of: http://stackoverflow.com/q/27238198
answers question: http://stackoverflow.com/q/27238198

http://stackoverflow.com/q/27255746
score: 0
has answer: http://stackoverflow.com/a/27257694
has title: What exactly is required to use an external object in a GWT web application
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27257694
tagged with: java
has body: The actual code is on a server that doesn't have internet access so I am going to use pseudocode here to try to explain what I'm trying to accomplish. I have a project called MyCoolHMI Contained within it is a GWT website with multiple client/server/shared sub packages For this example I am working in MyCoolHMI /com/src/foods/cookies/client/ShowCookieList.java I have another project in the same workspace called IGotYerCookies which contains among other things a database DAO/DTO that allow access to a the_best_cookies table. The dao and dto are called com.src.gotyercookies.database.TheBestCookiesDAO.java and com.src.gotyercookies.database.TheBestCookiesDTO.java I need to call TheBestCookiesDAO.getBestCookie() which returns List containing the top 3 cookies from ShowCookieList.java. What exactly do I need to do in order for (other than class path stuff) ShowCookieList.java to use TheBestCookiesDAO and TheBestCookiesDTO?. I have written Service and ServiceAsync classes and placed them in MyCoolHMI /com/src/foods/cookies/shared for a DAO and a DTO. I have also written ServiceAsyncImpl for the DAO and DTO and put them in the same directory with TheBestCookiesDAO/DTO in IGotYerCookies. I can't wrap my brain around how to handle the DTO when it comes back from the callback, or how to set arrange the actual call to get one back.. In the end server is where the Impl class had to go and shared is where the Service and ServiceAsync ended up. Then I had to put an entry in the web.xml file.
type: Question
tagged with: gwt-rpc
answer count: 1

http://stackoverflow.com/comment/42920640
type: Comment
type: QuestionComment
has text: *"over the few seconds it takes to do its work batched into a single publish after all work is complete"* - This is how `SwingWorker` works, it's kind of waiting for a "low" in the you worker to push the values passed to `publish` over to the EDT. If you add a `Thread.yield` or even a small `Thread.sleep` in your processing, you will find more values get pushed to the `process` method...
comment on: http://stackoverflow.com/q/27219994
score: 0

hsv
tags question: http://stackoverflow.com/q/27234846
tag name: hsv
type: Tag

http://stackoverflow.com/a/27189770
score: 0
type: Answer
has body: Fixed by editing the Environment variable PATH, just remove the first line before the semi-colon its something like C:/ProgramData/Oracle... and add your 64bit java Variable
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27187879
answers question: http://stackoverflow.com/q/27187879

http://stackoverflow.com/comment/46826092
has text: sorry for not getting back to you on what has been going on. I wasnt able to get it to work so I kinda abandoned it and used the print function that android have introduced instead. Really appreciate the help you provided.
type: AnswerComment
comment on: http://stackoverflow.com/a/27444273
score: 0
type: Comment

http://stackoverflow.com/a/27312252
has body: Error was not due to the code fragment in the question. Compilation failed as the code was not written inside a method. Writing the code with in a method fixes the problem. public static void main(String args[]){ int[][][] mat3d = new int[3][][]; mat3d[0] = new int[3][]; mat3d[0] = new int[5][]; } This compiles fine.
answers question: http://stackoverflow.com/q/27311974
downvote count: 0
has comment: http://stackoverflow.com/comment/43089840
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/43080929
type: Comment
has text: Thanks for your comment but I have tested above code :)
comment on: http://stackoverflow.com/a/27309476
type: AnswerComment
score: 0

http://stackoverflow.com/a/27288077
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27288011
has body: See these lines public static void main(String [] args) { String serverName = args[0]; //&lt;-- Expecting a value int port = Integer.parseInt(args[1]); //&lt;-- Expecting a value The args[] is a string array containing arguments that you pass via command line. And when you try to run it from eclipse directly, you arent specifying these values which results in args[] to be an empty array and thus args[0] gives an ArrayIndexOutOfBoundsException To solve this, either create a run configuration from within eclipse (see screenshot) and specify arguements that you want eclipse to pass when running this class. YOu can do this by right-clicking the project, select run, then run-configurations --&gt; double click on java_application and pass in the information that you want. You may need to specify the main class name when specifying arguments so that eclipse can recognize which main class to pass args to. OR you can just hardcode these values directly in the class itself (for testing)
type: Answer
answers question: http://stackoverflow.com/q/27288011

http://stackoverflow.com/comment/43213762
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27375547
score: 1
has text: Point is you didn't answer their question. (or rather your first line is correct but you didn't list why / what. instead you discuss a specific circumstance that generates dump that would not be useful to restore from). The second paragraph I think is on point but the first isn't.

http://stackoverflow.com/q/27196689
score: 1
tagged with: java
has body: There are several variables of a Java objects instance. instance.blora instance.sragen instance.kudus There are also Strings storing the names of these variables. String str; str.add("blora"); str.add("sragen"); str.add("kudus"); How can I set the values of the instance using str[1], str[2], and str[3]? (Somehow like instance.(str[0]))
type: Question
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/42878630
has comment: http://stackoverflow.com/comment/42878697
favorite count: 0
has comment: http://stackoverflow.com/comment/42878379
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42878293
tagged with: object
has title: Accessing/Setting instance variables: Name is stored in String variable

http://stackoverflow.com/comment/42936882
has text: @nikoliazekter Not in all languages.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27229705
score: 0

http://stackoverflow.com/comment/43003775
type: Comment
comment on: http://stackoverflow.com/q/27264362
type: QuestionComment
has text: Where are `mydb.Flights` ,'mydb.Payment' tables
score: 0

http://stackoverflow.com/q/27245737
tagged with: java
has title: JUnit functional tests for GUI elements: suppress dialogs from opening
has body: I would like to run a test which is not a unit test and not a full GUI integration test. The class which is to be tested shows dynamic UI content. My Problem is, that in some situtations an informative popup window is opened. Is there any way to suppress dialogs from opening for JUnit tests? Using a programmatic approach like a boolean within the class is probably quite confusing to other developers?!
type: Question
tagged with: functional-testing
has comment: http://stackoverflow.com/comment/42978157
score: 0
has comment: http://stackoverflow.com/comment/42966753
tagged with: junit
has comment: http://stackoverflow.com/comment/42967171
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42966623
answer count: 0

http://stackoverflow.com/q/27159851
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27161184
has title: Getting error importing opencsv package
answer count: 1
downvote count: 0
tagged with: opencsv
favorite count: 0
has body: I am trying to use opencsv to manipulate csv files in java I am using BlueJ as my IDE When I compile the code I get the following error package au.com.bytecode.opencsv does not exist. I also tried to compile using javac in command prompt in windows 7 but I get the same error. I havetried surfing the web and alt of people have the same problem biy no one has given the solution to the problem. Here is my code import java.io.FileReader; import java.util.Arrays; import au.com.bytecode.opencsv.CSVReader; public class TubeBlue1 { @SuppressWarnings("resource") public static void main(String[] args) throws Exception { //Build reader instance //Read data.csv //Default seperator is comma //Default quote character is double quote //Start reading from line number 2 (line numbers start from zero) CSVReader reader = new CSVReader(new FileReader("data.csv"), ',' , '"' , 1); //Read CSV line by line and use the string array as you want String[] nextLine; while ((nextLine = reader.readNext()) != null) { if (nextLine != null) { //Verifying the read data here System.out.println(Arrays.toString(nextLine)); } } } } Please help me fix this problem. Thanks Vishal Ved
type: UnansweredQuestion
score: 1

http://stackoverflow.com/a/31605838
score: 0
answers question: http://stackoverflow.com/q/27201478
type: Answer
has body: You didn't create a connection to Hbase. You need to create a connection to hbase using your config HConnectionManager.createConnection(config)

http://stackoverflow.com/a/27215324
upvote count: 2
has comment: http://stackoverflow.com/comment/42911129
has comment: http://stackoverflow.com/comment/42910737
answers question: http://stackoverflow.com/q/27215213
type: Answer
has body: I think that using interfaces is still very important. You case is very special but there is a way to solve it without usage of concrete classes. There is interface named RandomAccess. It is tag interface that does not declare methods but it should be used by implementors or List that do provide randome access to elements. So, you can define your method that requires random access list as following: public &lt;E, L extends List&lt;E&gt; &amp; RandomAcess&gt;void algorithm(L list); You will not be able to pass linked list to this method, but ArrayList will work. As you an expect now you can change implemtation of list without changing your algorithm. For example you can use thread safe CopyOnWriteArrayList that will allow yo to make you processing multithreaded without explicit syncrhonized statements.
score: 2
downvote count: 0

http://stackoverflow.com/comment/94908908
comment on: http://stackoverflow.com/a/27268340
has text: @Bond-JavaBond Trying to understand why you need both annotation.. is this because @ Aspect is AspectJ specific and not Spring specific ? And in order to make Spring aware of it you have to add the @ Component ?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/27258389
has comment: http://stackoverflow.com/comment/42991811
upvote count: 1
has comment: http://stackoverflow.com/comment/42992175
downvote count: 0
has comment: http://stackoverflow.com/comment/42991995
has comment: http://stackoverflow.com/comment/42992276
has body: Although Jackson does not have automated support for switching between CsvSchemas on per-row basis (which would suggest you'd need to do two-phase processing; first read or bind as String[], then use ObjectMapper.convertValue()), it might be possible to use existing support for polymorphic deserialization. This would rely on some commonality on column naming, so I don't know if it is realistic or not. Assuming it'd work, you would need a base class that has property that matches logical name of first column to use; and then subtypes with similarly matching property names. You would use @JsonTypeInfo on base class, and use 'name' as type id; and either use @JsonTypeName on sub-classes, or refer from base class using @JsonSubTypes annotations. That is, use the usual Jackson configuration. If this does not work, two-phase processing may not be a bad choice. It would result in all cell values being read as distinct objects, but as long as they are not retained (that is, you only keep one rows full of data in memory), short-term garbage usually is not that problematic for GC (long-term garbage is the expensive kind).
has comment: http://stackoverflow.com/comment/42991147
type: Answer
has comment: http://stackoverflow.com/comment/42992461
has comment: http://stackoverflow.com/comment/42992959
answers question: http://stackoverflow.com/q/27251891
has comment: http://stackoverflow.com/comment/42991872
score: 1

http://stackoverflow.com/comment/42815854
score: 0
comment on: http://stackoverflow.com/a/27161093
type: Comment
has text: Why would the user deliberately disclose the information that is sent by manipulating the encryption code? I'm not sure you've got the attack scenario right.
type: AnswerComment

http://stackoverflow.com/comment/42867361
has text: what is "Capture.PNG" ? I mean, which image does it store ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27188729

http://stackoverflow.com/comment/42965364
score: 0
type: AnswerComment
has text: he can just run java -cp catalina.jar org.apache.catalina.util.ServerInfo
type: Comment
comment on: http://stackoverflow.com/a/27245117

http://stackoverflow.com/q/27236082
has answer: http://stackoverflow.com/a/27236584
possible better answer: http://stackoverflow.com/a/27236185
type: Question
has answer: http://stackoverflow.com/a/27236185
upvote count: 9
has comment: http://stackoverflow.com/comment/42948883
has body: I was writing a Java program, and when I tried to use a string, a suggestion that popped up was com.sun.org.apache.xpath.internal.operations.String. What is com.sun.org.apache.xpath.internal.operations.String, and when should I use it? I have looked online, but I cannot find the documentation. Thank you!
tagged with: java
score: 9
has title: What is the purpose of com.sun.org.apache.xpath.internal.operations.String?
answer count: 2
has comment: http://stackoverflow.com/comment/42948907
downvote count: 0
accepted answer: http://stackoverflow.com/a/27236584
tagged with: string
linked to: http://stackoverflow.com/q/8565708
has comment: http://stackoverflow.com/comment/42948678
has comment: http://stackoverflow.com/comment/42949210
has comment: http://stackoverflow.com/comment/42948845
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42948703
has comment: http://stackoverflow.com/comment/42948897

http://stackoverflow.com/q/27219060
has answer: http://stackoverflow.com/a/27219080
tagged with: arrays
has answer: http://stackoverflow.com/a/27219108
possible better answer: http://stackoverflow.com/a/27219080
answer count: 3
has title: Printing individual values from an array?
has comment: http://stackoverflow.com/comment/42917362
has answer: http://stackoverflow.com/a/27219082
has body: I'm working on a school project where I need to have the user input a list of family members and their age and state using three arrays. Program needs to print the average of age of the family and names of anyone living in texas. I currently have everything working except after several hours of reaserch I'm still unable to figure out how to print the names of those living in tx. Any pointers would be greatly appreciated. If this is a duplicate, I'll happily delete, thus far I'm unable to find a solution that I could understand. Thanks in advance! import java.util.Scanner; public class Family { public static void main ( String [] args ) { int age_total = 0; int counter = 0; String stop = "stop"; int num = 0; double age_average =0; Scanner scan = new Scanner (System.in); System.out.println("How many family members would you like to add?"); num = scan.nextInt(); String [] name = new String [num]; int [] age = new int [num]; String [] state = new String[num]; for ( int i = 0; i &lt; name.length; i++ ) { System.out.println("Please enter a family member's name:"); name[i] = scan.next(); System.out.println("Thanks, please enter his/her age here:"); age[i] = scan.nextInt(); System.out.println("Awesome! Please enter the two letter abbreviation " "for the state where he/she currently resides? "); state[i] = scan.next(); age_total += age[i]; counter ++; } for ( int i = 0; i &lt; name.length; i++ ) { System.out.println ( name[i] ); } age_average = age_total/counter; System.out.println("The average age is " + age_average + " years old."); } }
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27219082

http://stackoverflow.com/q/27223790
has title: Java SAX parse XML file
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27224181
tagged with: java
has comment: http://stackoverflow.com/comment/42926181
has comment: http://stackoverflow.com/comment/42926048
accepted answer: http://stackoverflow.com/a/27224181
type: Question
answer count: 1
has body: I have one xml file to process, but the xml file is not in conventional xml format, normally xml have the following format, then i can use java's SAXParser to extract the info: 123456 985632 896523 123343 935632 856523 But now my xml is in this form, i cant use the SAXParser technique to search for start-tag, and end-tag. Any idea please? ... Normally java SAX parser use the following methods to detect xml's start tag, xml's eng tag, and xml's content, but since my xml dont even have proper end tag, i not sure whether i can use java SAX parser or not. public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { } public void endElement(String uri, String localName, String qName) throws SAXException { } public void characters(char ch[], int start, int length) throws SAXException { }
has comment: http://stackoverflow.com/comment/42926220
tagged with: http://stackoverflow.com/tag/xml
score: 0

http://stackoverflow.com/comment/42967222
type: AnswerComment
has text: I never read books, only articles and docs. Try this http://docs.opencv.org/doc/tutorials/tutorials.html
type: Comment
comment on: http://stackoverflow.com/a/27214700
score: 0

http://stackoverflow.com/comment/42835595
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27172420
has text: It is not necessary to create the array with the correct size. `String[] array = s.toArray(new String[0]);` works as well. Or to avoid the `empty array` warning use `String[] array = s.toArray(new String[1]);`
type: AnswerComment

http://stackoverflow.com/a/27168418
has body: Have you tried below code? context.lookup("ejblocal:"+MyObjectInterfaceLocal.class.getName()) Webshpere uses different default binding pattern for remote and local interfaces.
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/27166631
answers question: http://stackoverflow.com/q/27166631
downvote count: 0
type: AcceptedAnswer
score: 8

eclipse
tags question: http://stackoverflow.com/q/27215706
tags question: http://stackoverflow.com/q/27277851
tags question: http://stackoverflow.com/q/27302374
tags question: http://stackoverflow.com/q/27213582
tag name: eclipse
tags question: http://stackoverflow.com/q/27153841
tags question: http://stackoverflow.com/q/27261097
tags question: http://stackoverflow.com/q/27230691
tags question: http://stackoverflow.com/q/27184247
tags question: http://stackoverflow.com/q/27216958
tags question: http://stackoverflow.com/q/27192089
tags question: http://stackoverflow.com/q/27257003
tags question: http://stackoverflow.com/q/27261724
tags question: http://stackoverflow.com/q/27279863
tags question: http://stackoverflow.com/q/27152866
tags question: http://stackoverflow.com/q/27233868
tags question: http://stackoverflow.com/q/27275401
tags question: http://stackoverflow.com/q/27189688
tags question: http://stackoverflow.com/q/27241144
tags question: http://stackoverflow.com/q/27173974
tags question: http://stackoverflow.com/q/27158942
tags question: http://stackoverflow.com/q/27227951
tags question: http://stackoverflow.com/q/27196202
tags question: http://stackoverflow.com/q/27188135
tags question: http://stackoverflow.com/q/27280653
tags question: http://stackoverflow.com/q/27305047
tags question: http://stackoverflow.com/q/27256604
tags question: http://stackoverflow.com/q/27235806
tags question: http://stackoverflow.com/q/27174697
tags question: http://stackoverflow.com/q/27228538
tags question: http://stackoverflow.com/q/27206766
tags question: http://stackoverflow.com/q/27274419
tags question: http://stackoverflow.com/q/27226036
tags question: http://stackoverflow.com/q/27180095
tags question: http://stackoverflow.com/q/27239633
tags question: http://stackoverflow.com/q/27184777
tags question: http://stackoverflow.com/q/27312701
tags question: http://stackoverflow.com/q/27254722
tags question: http://stackoverflow.com/q/27271817
tags question: http://stackoverflow.com/q/27291369
tags question: http://stackoverflow.com/q/27278507
tags question: http://stackoverflow.com/q/27253029
tags question: http://stackoverflow.com/q/27274192
tags question: http://stackoverflow.com/q/27187879
tags question: http://stackoverflow.com/q/27190094
tags question: http://stackoverflow.com/q/27301867
tags question: http://stackoverflow.com/q/27154160
tags question: http://stackoverflow.com/q/27215642
tags question: http://stackoverflow.com/q/27200912
tags question: http://stackoverflow.com/q/27159076
tags question: http://stackoverflow.com/q/27278537
tags question: http://stackoverflow.com/q/27240194
tags question: http://stackoverflow.com/q/27259238
tags question: http://stackoverflow.com/q/27229628
tags question: http://stackoverflow.com/q/27188472
tags question: http://stackoverflow.com/q/27263997
tags question: http://stackoverflow.com/q/27260435
tags question: http://stackoverflow.com/q/27281906
tags question: http://stackoverflow.com/q/27239949
tags question: http://stackoverflow.com/q/27304402
tags question: http://stackoverflow.com/q/27180640
tags question: http://stackoverflow.com/q/27159372
tags question: http://stackoverflow.com/q/27296969
tags question: http://stackoverflow.com/q/27244974
tags question: http://stackoverflow.com/q/27212403
tags question: http://stackoverflow.com/q/27287011
tags question: http://stackoverflow.com/q/27278873
tags question: http://stackoverflow.com/q/27313447
tags question: http://stackoverflow.com/q/27227570
tags question: http://stackoverflow.com/q/27191624
tags question: http://stackoverflow.com/q/27167170
tags question: http://stackoverflow.com/q/27183369
tags question: http://stackoverflow.com/q/27238616
tags question: http://stackoverflow.com/q/27253527
tags question: http://stackoverflow.com/q/27242264
tags question: http://stackoverflow.com/q/27161902
tags question: http://stackoverflow.com/q/27285830
tags question: http://stackoverflow.com/q/27259453
tags question: http://stackoverflow.com/q/27169503
tags question: http://stackoverflow.com/q/27281102

java-stream
tags question: http://stackoverflow.com/q/27290437
tags question: http://stackoverflow.com/q/27244408
tags question: http://stackoverflow.com/q/27195089
tags question: http://stackoverflow.com/q/27230506
tags question: http://stackoverflow.com/q/27161463
tag name: java-stream
type: Tag
tags question: http://stackoverflow.com/q/27276009
tags question: http://stackoverflow.com/q/27159680
tags question: http://stackoverflow.com/q/27228961
tags question: http://stackoverflow.com/q/27174700
tags question: http://stackoverflow.com/q/27247238
tags question: http://stackoverflow.com/q/27179175
tags question: http://stackoverflow.com/q/27283442

http://stackoverflow.com/comment/42973048
comment on: http://stackoverflow.com/q/27249393
score: 1
has text: "but keep getting error" / "more errors": what errors?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/74514655
comment on: http://stackoverflow.com/a/27301091
has text: I think here is the time to start to indent your code.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43450065
comment on: http://stackoverflow.com/a/27177490
has text: Seems solved here: https://issues.apache.org/jira/browse/NUTCH-1899 . You can make the modifications shown in the patch in your local source code (because still is not commited to trunk). Thanks to Sebastian Nagel and Talat Uyarer.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42800447
score: 0
comment on: http://stackoverflow.com/q/27153032
has text: Please include the relevant part of your code to understand your problem.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27258641
has comment: http://stackoverflow.com/comment/42997397
answers question: http://stackoverflow.com/q/27258468
upvote count: 1
has comment: http://stackoverflow.com/comment/42997963
has comment: http://stackoverflow.com/comment/42998546
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42993198
has body: You must be confused with array's length property and string's length() method. The methods will have to be accessed with () (parenthesis) and the properties can be accessed by just names. Array.length String.length() UPDATE: You need to initialize the counters above the for loop. They are resetting to 0 in each iteration of the loop. int Acounter=0; int Bcounter=0; int Ccounter=0; these should be above the for loop.Another suggestion is, in java variables has to start with a lower case letter (and classes should start with upper case letter). Ex: ACounter should be aCounter.
type: Answer
has comment: http://stackoverflow.com/comment/42997911
has comment: http://stackoverflow.com/comment/42996949

http://stackoverflow.com/q/27267266
tagged with: post
type: Question
has body: I'm new in JSON and am working on a Coinbase API. See here. So I'm trying to POST this data over HTTP: { "transaction": { "to": "user1@example.com", "amount": "1.234", "notes": "Sample transaction for you" } } How would I do this in Java? I know how to create a program to GET a response but not how to POST a request. Here is my Program for Response: import java.io.IOException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import com.coinbase.api.Coinbase; import com.coinbase.api.CoinbaseBuilder; public class CoinbaseExample { static String API_KEY = "My API KEY"; static String API_SECRET = "MY API SECRET"; public static String getHttp(String url, String body) throws InvalidKeyException, NoSuchAlgorithmException, ClientProtocolException, IOException { String nonce = String.valueOf(System.currentTimeMillis()); String message = nonce + url + (body != null ? body : ""); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(API_SECRET.getBytes(), "HmacSHA256")); String signature = new String(Hex.encodeHex(mac.doFinal(message.getBytes()))); HttpRequestBase request; if (body == null || body.length() == 0) request = new HttpGet(url); else { HttpPost post = new HttpPost(url); post.setEntity(new StringEntity(body)); request = post; } request.setHeader("ACCESS_KEY", API_KEY); request.setHeader("ACCESS_SIGNATURE", signature); request.setHeader("ACCESS_NONCE", nonce)…
has title: How to POST JSON data over HTTP in Java?
score: 0
has comment: http://stackoverflow.com/comment/43005591
answer count: 1
has comment: http://stackoverflow.com/comment/43005899
has answer: http://stackoverflow.com/a/27267358
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43005651
tagged with: http

http://stackoverflow.com/comment/43255084
comment on: http://stackoverflow.com/a/27301961
score: 0
type: AnswerComment
type: Comment
has text: Hello Morag, thanks for answering. Ins't possible because the queue is used by many other applications and we don't know exactly what impact this config could have considering this scenario.

http://stackoverflow.com/a/27304709
answers question: http://stackoverflow.com/q/27304556
has body: Here's some pseudocode: Be smallest = a number surely greater than the one you're looking for For each element i in array except the first Be n = array[i] - array[i-1] If n &lt; smallest then smallest = n End If End For
score: 0
type: Answer

http://stackoverflow.com/a/27308245
answers question: http://stackoverflow.com/q/27307998
score: 0
type: AcceptedAnswer
has body: You can have a loop and compare the objects one by one on the given attributes( Id for choice2 and lastName for choice 3). For choice 2 : - System.out.print("Enter 901 number: "); int studentID = Integer.parseInt(myScanner.nextLine()); for(Student student : sList){ if(student.getStudentID == studentId){ System.out.println(student); break; // As student Id is unique.So, once we found the student no need to loop further. } } For choice 3, compare it on lastName and do not put break statement as there can be many with same lastName.
accepted answer of: http://stackoverflow.com/q/27307998
type: Answer

http://stackoverflow.com/comment/42855318
score: 0
has text: User if condition to check if the input statement is valid or not, if not valid, throw an exception, catch it in catch block.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27184042

http://stackoverflow.com/q/27200580
accepted answer: http://stackoverflow.com/a/27200641
has comment: http://stackoverflow.com/comment/42884791
favorite count: 0
has comment: http://stackoverflow.com/comment/42884809
tagged with: android
has comment: http://stackoverflow.com/comment/42884938
has body: I am developing my app with Maven build tool.. In my assets folder I have fonts/DroidSansFallback.ttf.. And my activity_main.xml is:-- <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="99dp" android:layout_marginTop="78dp" android:text="hello world" /> and my HelloAndroidActivity.java is:-- public class HelloAndroidActivity extends Activity { TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/DroidSansFallback.ttf"); tv = (TextView) findViewById(R.id.textView1); tv.setTypeface(tf); } } Here I want to change my text fonts..But the app is stopped.. My logcat error is:-- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arijit.patra.love/com.arijit.patra.love.HelloAndroidActivity}: java.lang.RuntimeException: native typeface cannot be made at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2346) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2398) at android.app.ActivityThread.access$800(ActivityThread.java:159) Can anyone tell me where is the problem??
tagged with: maven
has comment: http://stackoverflow.com/comment/42884863
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27200641
possible better answer: http://stackoverflow.com/a/27200616
has title: In Android How to set Text?
has comment: http://stackoverflow.com/comment/42884731
downvote count: 1
linked to: http://stackoverflow.com/q/7531856
has answer: http://stackoverflow.com/a/27200616
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42884861
upvote count: 0
duplicate of: http://stackoverflow.com/q/7531856
score: -1
linked to: http://stackoverflow.com/q/12766930
has comment: http://stackoverflow.com/comment/42884774
has comment: http://stackoverflow.com/comment/42884819
has comment: http://stackoverflow.com/comment/42884944

http://stackoverflow.com/q/27288264
has title: Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
favorite count: 0
tagged with: ruby
type: UnansweredQuestion
has body: I am beginner in shoes app, when I was trying to run a shoes app in the Ubuntu 12.04 terminal using shoes samples/test22.rb I'm getting this error: Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again. So how can I solve this or some one help me to run a simple shoes app in ubuntu and make a desktop app?
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/31100471
has comment: http://stackoverflow.com/comment/55185966
tagged with: jruby
answer count: 1
downvote count: 1
tagged with: shoes
tagged with: ubuntu-12.04

http://stackoverflow.com/comment/42961179
score: 0
type: QuestionComment
has text: You can `override` protected method outside your own package if you inherit from the class that it belongs to.
type: Comment
comment on: http://stackoverflow.com/q/27242617

http://stackoverflow.com/q/27301497
tagged with: mq
downvote count: 0
tagged with: jms
favorite count: 0
tagged with: ibm-mq
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27301961
score: 2
tagged with: java
tagged with: splunk
type: Question
has body: Im trying to put a message in a MQ Queue. Here is my source code: QueueConnection queueConn; QueueSession queueSession; QueueSender queueSender; queueConn = connectionFactory.getConnection(); queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueSender = queueSession.createSender(queueSession .createQueue(KEY_CONFIG_QUEUE_NAME)); queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT); TextMessage message = queueSession.createTextMessage(logBase); queueSender.send(message); I don't have the source code from the queue consumer, that is the one who sends the messages to SPLUNK. But at SPLUNK console, I could realize that the message is composed by JMS HEADER + my text message (logBase). Id like the messages without JMS Header. Could someone help me to understand where the problem is? Could be at consumer? Maybe a wrong or missing SPLUNK config??
has answer: http://stackoverflow.com/a/27312247
has title: Using JMS to put a Message in a MQ Queue And Consuming Message by SPLUNK
answer count: 2

http://stackoverflow.com/comment/43095006
has text: I ended up doing this only. Its my understanding that, 0 and 0.0.0.0 are supposed to represent wild-card addresses.
type: AnswerComment
comment on: http://stackoverflow.com/a/27303570
score: 0
type: Comment

http://stackoverflow.com/q/27157445
accepted answer: http://stackoverflow.com/a/27158899
score: 0
has comment: http://stackoverflow.com/comment/42810086
has body: I have declared "price" and "category", now I wish to display like this: productname price id amount water 25 3 3(bottles) (a list at the end of output that shows the bill) How to do that? This is what I've tried so far: do { String Enterproducts=in.next(); if(Enterproducts.equals("Stop")){ break; } int n = in.nextInt(); for(int i=0; i&lt;category.length; i++){ if(Enterproducts.equals(category[i])){ System.out.print(" "+category[i]+" "+price[i]+" "+n); System.out.println(); } } } while(in.hasNext());
has title: How to display a list of bill?
tagged with: billing
has answer: http://stackoverflow.com/a/27158899
has comment: http://stackoverflow.com/comment/42811711
type: AnsweredQuestion
tagged with: java
tagged with: formatting
type: Question
answer count: 1

authentication
tags question: http://stackoverflow.com/q/27293527
tags question: http://stackoverflow.com/q/27208153
tags question: http://stackoverflow.com/q/27183439
tags question: http://stackoverflow.com/q/27203830
tags question: http://stackoverflow.com/q/27282163
tags question: http://stackoverflow.com/q/27186053
tags question: http://stackoverflow.com/q/27248110
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/27274840
tags question: http://stackoverflow.com/q/27192139
tags question: http://stackoverflow.com/q/27192456
tags question: http://stackoverflow.com/q/27171802
tags question: http://stackoverflow.com/q/27215714
tags question: http://stackoverflow.com/q/27216096

http://stackoverflow.com/comment/42832467
comment on: http://stackoverflow.com/q/27170632
score: 0
has text: I have to run few JS on another site (like clicking few links or buttons) for many times. But after each click the page will refresh and so I have to run the JS again manually(on Console panel). But I am trying to create a JAVA application which will open link in browser, click the link by JS(Which will be run by JAVA App), then the page will refresh automatically, then again clicking the link by JS and continue for an hour. How can I do that? @Gimby
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42847393
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27179144
has text: @LuiggiMendoza OP claims in the question that this column is not referenced at all.

http://stackoverflow.com/a/27233144
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42943047
answers question: http://stackoverflow.com/q/27232591
score: 1
upvote count: 1
has body: Your Java application can call gnupg with whatever privileges the user that executes the application currently has. Fortunately, gnupg supports a wealth of command-line options that allow you to supply all necessary arguments and read/collect back status and results, such as -batch, -options or -status-fd. You can call programs from Java and read their results back using Java's ProcessBuilder or higher level libraries such as Plexus Utils On the other hand, there is at least one java-based wrapper library that speaks directly with the GnuPG executable. While platform-dependent, this probably has speed advantages over spawning a process for each transaction; and will probably spare you a lot of implementation effort figuring out command-line options. Note that using GnuPG this way bypasses BouncyCastle entirely -- you would be automating calls to GnuPG, effectively using it as your "library".

http://stackoverflow.com/a/27247752
has comment: http://stackoverflow.com/comment/42974801
has comment: http://stackoverflow.com/comment/42974426
score: 0
has comment: http://stackoverflow.com/comment/42974383
has comment: http://stackoverflow.com/comment/42971859
has comment: http://stackoverflow.com/comment/42973699
has comment: http://stackoverflow.com/comment/42973470
type: AcceptedAnswer
has body: Try the below code (working for both FF and Chrome): //Sending blank to the industry dropdown so the list is visible driver.findElement(By.xpath("//input[@id='cjaInd']")).sendKeys(""); Actions act = new Actions(driver); //Selecting the checkbox containing text exactly as "Accounting , Finance" act.moveToElement(driver.findElement(By.xpath("//div[@id='indCja']//ul[@class='ChkboxEnb']//a[.='Accounting , Finance']"))).click().perform(); //Selecting the checkbox containing text exactly as 'Strategy , Management Consulting Firms' act.moveToElement(driver.findElement(By.xpath("//div[@id='indCja']//ul[@class='ChkboxEnb']//a[.='Strategy , Management Consulting Firms']"))).click().perform(); //For clicking outside so as the dropdown closes and we can proceed with other action(s) act.moveToElement(driver.findElement(By.xpath("//label[.='Industry']"))).click().perform(); //Sending blank to the Job Category dropdown so the list is visible driver.findElement(By.xpath("//input[@id='cjaJob']")).sendKeys(""); //Selecting the checkbox containing text exactly as Application Programming, Maintenance act.moveToElement(driver.findElement(By.xpath("//div[@id='jcCja']//ul[@class='ChkboxEnb']//a[.='Application Programming, Maintenance']"))).click().perform(); //Selecting the checkbox containing text exactly as "Site Engineering, Project Management" act.moveToElement(driver.findElement(By.xpath("//div[@id='jcCja']//ul[@class='ChkboxEnb']//a[.='Site Engineering, Project Management']"))).click().perform(); //For clicking outside so as the dropdown closes and we can proceed with other action(s) act.moveToElement(driver.findElement(By.xpath("//label[.='Industry']"))).click().perform();
has comment: http://stackoverflow.com/comment/42974573
has comment: http://stackoverflow.com/comment/42974895
has comment: http://stackoverflow.com/comment/42974125
accepted answer of: http://stackoverflow.com/q/27246849
has comment: http://stackoverflow.com/comment/42971228
type: Answer
answers question: http://stackoverflow.com/q/27246849
has comment: http://stackoverflow.com/comment/42970603
has comment: http://stackoverflow.com/comment/42971181
has comment: http://stackoverflow.com/comment/42973284
has comment: http://stackoverflow.com/comment/42971394
has comment: http://stackoverflow.com/comment/42972694

http://stackoverflow.com/comment/42845373
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27178059
has text: Can you also address the issue why we can access class B's toString(), yet not able to access class B's variable?
score: 0

http://stackoverflow.com/a/27603210
type: Answer
has comment: http://stackoverflow.com/comment/44204533
accepted answer of: http://stackoverflow.com/q/27247337
answers question: http://stackoverflow.com/q/27247337
has body: The CMP API isn't able to do this because there needs to something on the other end already listening to the MQ Queues in order to respond to the CMP message. The toolkit and IBX actually breaks out to the shell from java to start brokers which is why they can only start and stop local brokers
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43629301
has comment: http://stackoverflow.com/comment/44204460

http://stackoverflow.com/comment/43013527
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27270089
has text: I haven't downvoted it. However, next time you should decide if it is a Java or a JavaScript question.

http://stackoverflow.com/q/27269675
has comment: http://stackoverflow.com/comment/43012000
has comment: http://stackoverflow.com/comment/43030500
score: 15
has comment: http://stackoverflow.com/comment/43011732
has answer: http://stackoverflow.com/a/27271305
downvote count: 1
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43009785
has answer: http://stackoverflow.com/a/42230632
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43012169
has comment: http://stackoverflow.com/comment/43019791
has answer: http://stackoverflow.com/a/27271475
tagged with: lambda
has comment: http://stackoverflow.com/comment/43011688
tagged with: java-8
has comment: http://stackoverflow.com/comment/43012920
tagged with: java
has comment: http://stackoverflow.com/comment/43011419
has body: Is there any way (method, lambda, or elegant construct) to find an element in a list based on a given comparator? I wrote a method like this: private static &lt;T&gt; boolean contains(List&lt;T&gt; list, T item, Comparator&lt;? super T&gt; comparator) { return list.stream() .anyMatch(listItem -&gt; comparator.compare(listItem, item) == 0 ); } But I'm looking to replace it with something that would be more elegant. I don't want to add any dependency, so no Guava, "commons", etc. I'm really looking for a pretty way to do this in Java 8. EDIT: Some example of what I'd consider more elegant (here is the using code): // sadly, this method doesn't exist // nor is there a static one in Collections // but maybe you can think of another way? if (list.containsSame(item, comparator)) { // ... }
has comment: http://stackoverflow.com/comment/43019524
type: Question
has answer: http://stackoverflow.com/a/27274699
has title: List::contains with comparator
upvote count: 16
has comment: http://stackoverflow.com/comment/43019869
has comment: http://stackoverflow.com/comment/43011184

http://stackoverflow.com/comment/42980741
has text: What do u mean cloning is a bad idea??
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27253108

http://stackoverflow.com/a/27244720
downvote count: 0
has comment: http://stackoverflow.com/comment/42964659
type: Answer
answers question: http://stackoverflow.com/q/27244677
score: 6
upvote count: 6
has body: The synchronized keyword enables a locking mechanism that allows threads to not step on each other. Java documentation describes this as a way to " preventing thread interference and memory consistency errors". If you use join(), it makes sure that as soon as a thread calls join,the current thread(running thread) will not execute unless the thread you have called join is finished. I think the diagram below might help visualize this better. Source

http://stackoverflow.com/comment/42959096
type: QuestionComment
comment on: http://stackoverflow.com/q/27241185
type: Comment
has text: If you replace the second piesss with the first piesss nothing will change. Could you make the replacement instructions a little clearer. Please do so by editing your question.
score: 0

http://stackoverflow.com/q/27261370
type: UnansweredQuestion
downvote count: 1
has title: Android - Equilivent of NSOject in Java
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27263366
type: Question
upvote count: 0
tagged with: ios
tagged with: android
answer count: 1
tagged with: objective-c
favorite count: 0
has body: I have made an iOS project and I have a class of NSObject that gets some data from the web and stores it and then I can call the methods made in that class in other class by importing the NSObject? I am now making an android version of this app and am wondering how I could go about doing the same thing? Would I want to make a java class for this? Im not sure what or if there is something that would be similar to this? Some of the methods in this NSObjects class .m file look like this -(void)populateMenuArray { self.menuData=[NSMutableArray arrayWithCapacity:7]; self.dayMeals=[NSMutableArray arrayWithCapacity:7]; for (int i=0;i&lt;7;i++) { [self.menuData addObject:[NSMutableDictionary new]]; [self.dayMeals addObject:[NSMutableArray new]]; } } And then I have a long method like this to parse some xml from the web and I am trying to replicate this in my android app -(void)parseXML:(NSData *)menuData { TFHpple *Parser = [TFHpple hppleWithHTMLData:menuData]; NSString *XpathQueryString = @"//day"; NSArray *Nodes = [Parser searchWithXPathQuery:XpathQueryString]; for (TFHppleElement *element in Nodes) { NSString *dayString=element.attributes[@"name"]; MealDay day=[MealData deliDayForString:dayString]; if (day != MealDayUnknown) { NSMutableDictionary *dayDict=(NSMutableDictionary *)self.menuData[day]; NSMutableArray *dayMeals=self.dayMeals[day]; NSArray *mealsArray=[element childrenWithTagName:@"meal"]; for (TFHppleElement *mealElement in mealsArray) { NSString *mealName=mealElement.attributes[@"name"]; [dayMeals addObject:mealName]; NSMutableDictionary *counterDict=(NSMutableDictionary *)dayDict[mealName]; if (counterDict == nil) { counterDict=[NSMutableDictionary new]; dayDict[mealName]=counterDict; } NSArray *countersArray=[mealElement childrenWithTagName:@"counter"]; for (TFHppleElement *counterElement in countersArray) { NSString *counterName=counterElement.attributes[@"name"]; if (counterName != nil) { NSMutableArray *itemsArray=(NSMutableArray *)counterDict[counterNam…

http://stackoverflow.com/q/27261640
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/14445070
tagged with: expandablelistadapter
type: Question
accepted answer: http://stackoverflow.com/a/27273862
answer count: 1
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/27273862
upvote count: 1
tagged with: android
has title: ExpandableListAdapter getChildrenCount null pointer exception when activity restored
has body: this exception is driving me nuts. When ever my main activity's process gets killed and then restored my app force closes due to a null pointer exception in my expandableListView. This is my first android app and first time writing java so I am a bit of a n00b. It is a timetable app and it is using a Cursor Loader to load in the data to the list from a content provider. What am i doing wrong here? Thanks in advance. Logcat: 12-03 00:21:42.235: E/AndroidRuntime(2341): FATAL EXCEPTION: main 12-03 00:21:42.235: E/AndroidRuntime(2341): Process: com.crevitus.timetable, PID: 2341 12-03 00:21:42.235: E/AndroidRuntime(2341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crevitus.timetable/com.crevitus.timetable.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.app.ActivityThread.access$800(ActivityThread.java:144) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.os.Handler.dispatchMessage(Handler.java:102) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.os.Looper.loop(Looper.java:135) 12-03 00:21:42.235: E/AndroidRuntime(2341): at android.app.ActivityThread.main(ActivityThread.java:5221) 12-03 00:21:42.235: E/AndroidRuntime(2341): at java.lang.reflect.Method.invoke(Native Method) 12-03 00:21:42.235: E/AndroidRuntime(2341): at java.lang.reflect.Method.invoke(Method.java:372) 12-03 00:21:42.235: E/AndroidRuntime(2341): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 12-03 00:21:42.235: E/AndroidRuntime(2341): at …
favorite count: 0
downvote count: 0
tagged with: expandablelistview
type: AnsweredQuestion

http://stackoverflow.com/q/27293994
has answer: http://stackoverflow.com/a/27331570
has answer: http://stackoverflow.com/a/27295642
favorite count: 0
score: 19
has title: How to parse ZonedDateTime with default zone?
tagged with: java-8
type: AnsweredQuestion
upvote count: 19
has body: How to parse ZoneDateTime from string that doesn't contain zone and others fields? Here is test in Spock to reproduce: import spock.lang.Specification import spock.lang.Unroll import java.time.ZoneId import java.time.ZoneOffset import java.time.ZonedDateTime import java.time.format.DateTimeFormatter @Unroll class ZonedDateTimeParsingSpec extends Specification { def "DateTimeFormatter.ISO_ZONED_DATE_TIME parsing incomplete date: #value #expected"() { expect: ZonedDateTime.parse(value, DateTimeFormatter.ISO_ZONED_DATE_TIME) == expected where: value | expected '2014-04-23T04:30:45.123Z' | ZonedDateTime.of(2014, 4, 23, 4, 30, 45, 123_000_000, ZoneOffset.UTC) '2014-04-23T04:30:45.123+01:00' | ZonedDateTime.of(2014, 4, 23, 4, 30, 45, 123_000_000, ZoneOffset.ofHours(1)) '2014-04-23T04:30:45.123' | ZonedDateTime.of(2014, 4, 23, 4, 30, 45, 123_000_000, ZoneId.systemDefault()) '2014-04-23T04:30' | ZonedDateTime.of(2014, 4, 23, 4, 30, 0, 0, ZoneId.systemDefault()) '2014-04-23' | ZonedDateTime.of(2014, 4, 23, 0, 0, 0, 0, ZoneId.systemDefault()) } } First two test passed, all others failed with DateTimeParseException: '2014-04-23T04:30:45.123' could not be parsed at index 23 '2014-04-23T04:30' could not be parsed at index 16 '2014-04-23' could not be parsed at index 10 How can I parse incomplete dates with time and zone setted to default?
tagged with: java
accepted answer: http://stackoverflow.com/a/27331570
type: Question
tagged with: java-time
tagged with: date
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27295642

http://stackoverflow.com/a/27184510
type: Answer
accepted answer of: http://stackoverflow.com/q/27183610
score: 0
answers question: http://stackoverflow.com/q/27183610
type: AcceptedAnswer
has body: Hiii, I got the answer, I was sending array after using json_encode to gearman, turns out sending directly to it worked. public function test() { $test = $this-&gt;serviceManager-&gt;get('test\Model\test'); //print_r($test);exit; $message = array( 'to' =&gt; 'abhi', 'message' =&gt; 'this is a test', ); $test-&gt;sendtoJavaWorker($message); }

performance
tags question: http://stackoverflow.com/q/27212423
tags question: http://stackoverflow.com/q/27188536
tags question: http://stackoverflow.com/q/27158637
tags question: http://stackoverflow.com/q/27217352
tags question: http://stackoverflow.com/q/27284001
tags question: http://stackoverflow.com/q/27261510
tags question: http://stackoverflow.com/q/27154508
tags question: http://stackoverflow.com/q/27295356
tags question: http://stackoverflow.com/q/27279787
tags question: http://stackoverflow.com/q/27226782
tags question: http://stackoverflow.com/q/27283458
tags question: http://stackoverflow.com/q/27191285
tags question: http://stackoverflow.com/q/27276423
tags question: http://stackoverflow.com/q/27286434
tags question: http://stackoverflow.com/q/27238636
tags question: http://stackoverflow.com/q/27272302
tags question: http://stackoverflow.com/q/27178593
tags question: http://stackoverflow.com/q/27237909
tags question: http://stackoverflow.com/q/27193997
tags question: http://stackoverflow.com/q/27304838
tags question: http://stackoverflow.com/q/27257359
tags question: http://stackoverflow.com/q/27294525
tags question: http://stackoverflow.com/q/27194981
tags question: http://stackoverflow.com/q/27225606
tags question: http://stackoverflow.com/q/27230702
tags question: http://stackoverflow.com/q/27248559
tag name: performance
tags question: http://stackoverflow.com/q/27289473
tags question: http://stackoverflow.com/q/27304748
tags question: http://stackoverflow.com/q/27271059
tags question: http://stackoverflow.com/q/27223946
type: Tag
tags question: http://stackoverflow.com/q/27202812
tags question: http://stackoverflow.com/q/27188626
tags question: http://stackoverflow.com/q/27185523

http://stackoverflow.com/comment/43049033
type: AnswerComment
has text: Yes, that it correct. When I run the jar from inside the package, everything seems to work fine. So maybe there is something wrong with the package.
type: Comment
comment on: http://stackoverflow.com/a/27291083
score: 0

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/27307341
tag name: android-actionbar
tags question: http://stackoverflow.com/q/27182035
tags question: http://stackoverflow.com/q/27170564

http://stackoverflow.com/q/27291131
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27291215
tagged with: crc32
tagged with: java
type: Question
upvote count: 4
has body: My application use CRC32 to check two contents or two files are same or not. But when I try it use to generate unique id, I see the problem, with the two different string, the CRC32 can be same. Here is my Java code. Thanks in advance. public static String getCRC32(String content) { byte[] bytes = content.getBytes(); Checksum checksum = new CRC32(); checksum.update(bytes, 0, bytes.length); return String.valueOf(checksum.getValue()); } public static void main(String[] args){ System.out.println(getCRC32("b5a7b602ab754d7ab30fb42c4fb28d82")); System.out.println(getCRC32("d19f2e9e82d14b96be4fa12b8a27ee9f")); }
score: 4
has comment: http://stackoverflow.com/comment/43049973
answer count: 3
possible better answer: http://stackoverflow.com/a/27302030
downvote count: 0
has answer: http://stackoverflow.com/a/27302030
has title: Different text but same CRC checksum?
favorite count: 0
has answer: http://stackoverflow.com/a/27291284
accepted answer: http://stackoverflow.com/a/27291284

http://stackoverflow.com/a/27179710
answers question: http://stackoverflow.com/q/27156798
has comment: http://stackoverflow.com/comment/43426204
has body: That way would be Java Web Start. It provides 'auto-update' out of the box, but also allows apps. to take programmatic control of updates.
downvote count: 0
has comment: http://stackoverflow.com/comment/43425424
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/27263631
has comment: http://stackoverflow.com/comment/42999527
has body: Use txtName.setVisible(false); instead of homeScreen.remove(txtName); Basically, if you want to call remove, you will need to revalidate and repaint container... You'll also want to ensure that your UI is create within the context of the Event Dispatching Thread, see Initial Threads for more details
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27263563
answers question: http://stackoverflow.com/q/27263563
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43068087
has text: It would be easier to help if you could show a complete class. Is `recursiveEvaluate` a member of `ExpNode`? And do `getLeft` and `getRight` return another `ExpNode`? If so, your code should rather look something like `return this.getLeft().evaluate() + this.getRight().evaluete()`. You wouldn't need two functions in that case. Or are you probably supposed to implement the *Visitor Pattern*?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27302277
score: 0

http://stackoverflow.com/q/27224171
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27224479
has body: I'm using netbeans 8.0 ide with jdk 8. And I want to view a report using jasper which includes a bar chart. But it gets error like this: java.lang.NoClassDefFoundError: org/jfree/chart/plot/PlotOrientation at net.sf.jasperreports.charts.type.PlotOrientationEnum.(PlotOrientationEnum.java:42) What are the jar files needed to display a jasperreport with a bar chart , in a netbeans ide 8.0. Anyone please help me.
tagged with: java
type: Question
tagged with: jasper-reports
answer count: 1
score: 0
has title: what are the jar files needed to display a jasperreport with a bar chart , in a netbeans ide 8.0
has comment: http://stackoverflow.com/comment/42926762
tagged with: netbeans

http://stackoverflow.com/comment/43036192
score: 0
type: Comment
type: QuestionComment
has text: You should try to install the JDK rather than just the JRE. What do you see if your run `/usr/libexec/java_home -V` in a terminal window?
comment on: http://stackoverflow.com/q/27283595

http://stackoverflow.com/q/27201210
favorite count: 0
has answer: http://stackoverflow.com/a/27201628
type: AnsweredQuestion
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27201628
tagged with: object
tagged with: oop
score: 1
tagged with: java
has body: I have an object with fields of different types, mainly String, Float, Integer. I need to write a method to check an array of such objects, whether specific fields, identified by a certain string identifiers, are not null and not empty. For example, I have the following fields: String field1; Integer field2; String field3; and an identifiers: String IDENTIFIER_FIELD_1 = "IDENTIFIER_1"; String IDENTIFIER_FIELD_2 = "IDENTIFIER_2"; If I pass an ArrayList&lt;String&gt; with IDENTIFIER_FIELD_1 to my method, I want to check field1 only, if I pass an ArrayList&lt;String&gt; with IDENTIFIER_FIELD_1 and IDENTIFIER_FIELD_2, I would like to check both field2 and field2. Is there any effective way in Java to do such checks for an array of objects? The only solution I come up with is to check every field using string comparison but that wouldn't be effective at all.
has title: Checking object fields based on string identifiers
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/27201233
has answer: http://stackoverflow.com/a/27201344
has answer: http://stackoverflow.com/a/27201233

http://stackoverflow.com/q/27188753
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42893123
has title: retrieve JsonObject in POST with jersey
has comment: http://stackoverflow.com/comment/42866966
has comment: http://stackoverflow.com/comment/42886988
has comment: http://stackoverflow.com/comment/42873538
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
score: 4
has comment: http://stackoverflow.com/comment/42890925
type: Question
has comment: http://stackoverflow.com/comment/42866392
has answer: http://stackoverflow.com/a/27202578
tagged with: jersey
has comment: http://stackoverflow.com/comment/42866592
downvote count: 0
has comment: http://stackoverflow.com/comment/42867338
has comment: http://stackoverflow.com/comment/42873151
has answer: http://stackoverflow.com/a/27189005
favorite count: 0
has body: I have some problems in my application, I send a POST request, but I cannot retrieve the JsonObject in my server, this is the code to send: String quo = "{\"network\": {\"label\": \"new net 111\",\"cidr\": \"10.20.105.0/24\"}}"; GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); JsonParser json = new JsonParser(); JsonObject jo = (JsonObject)json.parse(quo); ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); WebTarget target = client.target("http://localhost:7999/jersey/rest/network/"+tenant_id); Response oj = target.request().accept(MediaType.APPLICATION_JSON) .header("X-Auth-Token", token) .post(Entity.json(gson.toJson(jo))); Trying to retrieve with: @POST @Produces(MediaType.APPLICATION_JSON) @Path("/{tenant_id}") public String createNetwork(@HeaderParam(value = "X-Auth-Token") String authToken, @PathParam(value = "tenant_id") String tenant_id, JsonObject network){ Response response = client.target(NOVA_ENDPOINT+tenant_id) .request(MediaType.APPLICATION_JSON) .header("X-Auth-Token", authToken) .post(Entity.json(gson.toJson(network))); System.out.println("Hello"); String responseJson = response.readEntity(String.class); JsonObject network seems to be empty, in fact it doesn't execute the method ("Hello is not printed"), the error I get is "Invalid request body" (because the JsonObject is empty I think).. What's wrong with my code? Ok, I understood that the problem is related to Json handling such as I'm using Gson. This is my improved code (simplified version) following users suggestion, but I still have problems.. Client Side: package openstack; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.server.ResourceConfig; import …
has comment: http://stackoverflow.com/comment/42887157
tagged with: rest
answer count: 3
has comment: http://stackoverflow.com/comment/42887274
has comment: http://stackoverflow.com/comment/42887623
has comment: http://stackoverflow.com/comment/42888083
upvote count: 4
has comment: http://stackoverflow.com/comment/42867190
has comment: http://stackoverflow.com/comment/42873517
has comment: http://stackoverflow.com/comment/42873550
has comment: http://stackoverflow.com/comment/42867953
has answer: http://stackoverflow.com/a/43799647

http://stackoverflow.com/comment/42857263
has text: What is the problem you want to solve? No dependency on anything Scala? No trace of anything Scala? Be able to continue development in Java, of code that was originally written in Scala?
comment on: http://stackoverflow.com/q/27183641
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27300434
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43076985
has body: I had this same problem when using a Grsec enabled kernel. For java to play nice, I had to disable MPROTECT on the java binary. You can use the paxctl utility for this: paxctl -m /usr/lib/jvm/java-7-openjdk/jre/bin/java You'll need to do paxctl -c on the binary first if you've never used it on that binary before: paxctl -c /usr/lib/jvm/java-7-openjdk/jre/bin/java More information about paxctl can be found at: http://en.wikibooks.org/wiki/Grsecurity/Additional_Utilities
has comment: http://stackoverflow.com/comment/43073670
has comment: http://stackoverflow.com/comment/43076965
type: Answer
has comment: http://stackoverflow.com/comment/43077093
has comment: http://stackoverflow.com/comment/43077065
answers question: http://stackoverflow.com/q/27262629
has comment: http://stackoverflow.com/comment/43073456
upvote count: 12
accepted answer of: http://stackoverflow.com/q/27262629
has comment: http://stackoverflow.com/comment/43068546
score: 12

http://stackoverflow.com/q/27312604
has answer: http://stackoverflow.com/a/41789798
has title: Android 4.4 set default sms application without user confirmation
score: 3
tagged with: java
has body: Is it possible to change default sms application on Android 4.4 without user knowledge? I'm trying to do it on a ROOTED Galaxy S5 using reflection and invoking system methods, so here is what I done so far: Created small app that implements all things needed for app to be a SMS manager (as per http://android-developers.blogspot.in/2013/10/getting-your-sms-apps-ready-for-kitkat.html) and I can make it default sms app but Android asks me to confirm that in dialog. Now I'm exploring android source code and I found something in this class: https://github.com/android/platform_packages_apps_settings/blob/2abbacb7d46657e5863eb2ef0035521ffc41a0a8/src/com/android/settings/SmsDefaultDialog.java So I'm trying to invoke internal method: SmsApplication.setDefaultApplication(mNewSmsApplicationData.mPackageName, this); via reflection and here is how I done it so far: Class[] params = new Class[2]; params[0]=String.class; params[1]=Context.class; Class cls = null; try { cls = Class.forName("com.android.internal.telephony.SmsApplication"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Method method = null; try { method = cls.getDeclaredMethod("getSmsApplicationData", params); } catch (NoSuchMethodException e) { e.printStackTrace(); } try { Object[] params2 = new Object[2]; params2[0]=getPackageName(); params2[1]=getApplicationContext(); Log.d("Current package", getPackageName()); method.invoke(null, params2); } catch (InvocationTargetException e) { e.printStackTrace(); } And I made this app system app and put it into folder /system/priv-app, rebooted phone and started it successfully with adb, but when I click on the button that executes code above, nothing happens. No errors, no log output, but default app is still Messaging (com.android.mms). Is there any way to do this?
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-4.4-kitkat
tagged with: android
tagged with: smsmanager
tagged with: sms
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/a/27265209
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27265097
has body: try java -cp pathtojarlib:. JdbcExample where pathtojarlib is the path of your connector library

http://stackoverflow.com/comment/43015751
comment on: http://stackoverflow.com/q/27273088
score: 0
type: Comment
type: QuestionComment
has text: because you have just one thread, and it is mainThread, you must create multiple threads.

http://stackoverflow.com/q/27188506
upvote count: 0
score: -3
has body: public static float recursiveUse(float n2){ if(n2 == 1) return 1; return recursiveUse(1/n2); } public static void main(String[] args) { float n2; Scanner stdin = new Scanner(System.in); System.out.println("Please enter a number: "); n2 = stdin.nextFloat(); System.out.print(1+(recursiveUse(n2))); } /* Write a Java application that uses recursion to compute the results of the following series: m(i) = 1 + 1/2 + 1/3 + 1/4 + 1/5 … + 1/i */ I am currently having a problem with a stack overflow exception. I am pretty sure it is because base is in correct. My question is how do I find the base for the series just above. I have searched the site and I couldn't find anything applicable for this problem. Thank you
has title: Stack overflow and finding a base
tagged with: recursion
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27188872
accepted answer: http://stackoverflow.com/a/27188872
possible better answer: http://stackoverflow.com/a/27188779
type: Question
answer count: 2
tagged with: stack-overflow
favorite count: 0
downvote count: 3
has comment: http://stackoverflow.com/comment/42863399
has comment: http://stackoverflow.com/comment/42863534
has answer: http://stackoverflow.com/a/27188779

http://stackoverflow.com/q/27206540
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/27207908
has comment: http://stackoverflow.com/comment/42897386
answer count: 1
has comment: http://stackoverflow.com/comment/42896399
has title: abbreviations in android via xml or java
has comment: http://stackoverflow.com/comment/42897257
has comment: http://stackoverflow.com/comment/42897353
tagged with: android
tagged with: facebook
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42897233
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27207908
has body: first of all. i have tried searching my question in stackoverflow and not founded the exact answer there are some related questions but those are not the answer of my questions. may be i dont know what we call that thing which i gonna ask you. i am creating an xml file in eclipse in which i am going to show abbreviations of words. for example fb: facebook //no new line added for bigger screen gm: gmail sof: stack over flow these are just examples. in my code i want to create 2 textviews or something like that first textview will show the abbreviations and 2nd will show the exact English for that abbreviation. but some times on small screens the abbreviation may go out of screen or may include /n or new line and my all other abbreviations will be wrong like this example. fb: face //a new line added for small screen gm: book sof: gmail :stack over flow basically i want you to tell me that how to arrange the code so the textview should either scroll and do not include the new line. or if textview2 include enter than textview1 should have an enter too. please help me

http://stackoverflow.com/comment/42854298
score: 0
has text: Thanks!! surely will check it and let u know the feedback. Thanks once again.
comment on: http://stackoverflow.com/q/27182905
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42914585
score: 1
type: Comment
comment on: http://stackoverflow.com/q/27214517
type: QuestionComment
has text: Maybe not your class, but some library it is using, is compiled with Java 7. Are you sure about other environments? Since in WebSphere v8.5 you can switch to Java 7, so maybe you did that on other environments and thats why it is working there.

http://stackoverflow.com/comment/42988475
type: QuestionComment
comment on: http://stackoverflow.com/q/27257385
has text: What is the output of `ls -lR src` / the output of the compiler?
score: 0
type: Comment

http://stackoverflow.com/a/32234471
type: Answer
score: 4
upvote count: 4
downvote count: 0
has body: import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args)throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(in.readLine()); int[] c=new int[100]; String[][] dt=new String[100][10300]; for(int i=0;i&lt;n;i++) { String[] str=in.readLine().split(" "); int val=Integer.parseInt(str[0]); if(i&lt;n/2) dt[val][c[val]]="-"; else dt[val][c[val]]=str[1]; c[val]++; } StringBuilder sb=new StringBuilder(""); for(int i=0;i&lt;100;i++) if(i&lt;n) for(int k=0;k&lt;c[i];k++) if(dt[i][k]!=null) sb.append(dt[i][k]+" "); else break; System.out.println(sb.toString()); } }
answers question: http://stackoverflow.com/q/27288928

http://stackoverflow.com/a/27227044
upvote count: 1
has body: You can use JSTL tags. The conversion from String to int then is done in the Expression Language. &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;There are ${param.numberMax} numbers.&lt;/p&gt; &lt;ul&gt; &lt;c:forEach begin="1" end="${param.numberMax}" varStatus="no"&gt; &lt;li&gt;&lt;c:out value="number ${no.count}"/&gt;&lt;/li&gt; &lt;/c:forEach&gt; &lt;/ul&gt; &lt;/body&gt; The request parameters one gets as param.numberMax inside ${...}. The varStatus object contains properties like first or last time in loop and such. Here the &lt;c:out &gt; tag is not needed, it can escape XML entities like turning a &amp; into correct &amp;amp;.
score: 1
answers question: http://stackoverflow.com/q/27219898
downvote count: 0
type: Answer

http://stackoverflow.com/a/27157084
answers question: http://stackoverflow.com/q/27156842
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42822936
upvote count: 2
has body: What if you use this? System.out.println(Fairy.create(Locale.forLanguageTag("en")).text().word());

http://stackoverflow.com/q/27218746
answer count: 1
has title: Conversion between feet and meters
has answer: http://stackoverflow.com/a/27218816
has comment: http://stackoverflow.com/comment/42916787
has comment: http://stackoverflow.com/comment/42916783
has comment: http://stackoverflow.com/comment/42916888
accepted answer: http://stackoverflow.com/a/27218816
favorite count: 0
has comment: http://stackoverflow.com/comment/42917051
downvote count: 2
type: AnsweredQuestion
has body: public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("This program converts between feet and meters"); System.out.printf("%5s%12s%6s%12s%12s\n","Feet","Meters","|","Meters","Feet"); System.out.println(" "); for(double f = 1.0, m = 20; f &lt;= 10.0; f++, m += 5.0){ System.out.printf("%5.1f%12.3f%6s%12,1f%12.3f\n", f, footToMeter(f), "|", m, meterToFoot(m)); } } public static double footToMeter(double foot){ return foot * 0.3048; } public static double meterToFoot(double meter){ return meter / 0.3048; } Results should be like: Feet Meters | Meters Feet 1.0 0.305 | 20.0 65.574 2.0 0.610 | 25.0 81.967 But instead I get the following Exception: Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '1' at java.util.Formatter.checkText(Formatter.java:2503) at java.util.Formatter.parse(Formatter.java:2467) at java.util.Formatter.format(Formatter.java:2414) at java.io.PrintStream.format(PrintStream.java:920) at java.io.PrintStream.printf(PrintStream.java:821) at Ex6_9.main(Ex6_9.java:15)
tagged with: java
has comment: http://stackoverflow.com/comment/42916741
type: Question
upvote count: 0
score: -2

http://stackoverflow.com/a/27860345
type: Answer
answers question: http://stackoverflow.com/q/27170555
has comment: http://stackoverflow.com/comment/73856613
has body: I managed to do so by adding a couple of lines in a method of the stub (the one you call to invoke the web service). I identified the line, i.e. _operationClient.execute(true); that effectively contacts the web service and added just after it: _operationClient.getMessageContext("Out").getEnvelope().serialize(System.out); _operationClient.getMessageContext("In").getEnvelope().serialize(System.out);
score: 15
upvote count: 15
has comment: http://stackoverflow.com/comment/102232270
downvote count: 0
has comment: http://stackoverflow.com/comment/89621865

http://stackoverflow.com/comment/42859995
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27172476
has text: I tried the spell checker api's found here: http://stackoverflow.com/questions/14268998/google-spell-api-and-tinymce however they see it is and it's as correct as it is ;) So spell checkers can not be used for that purpose unfortunately
type: Comment

http://stackoverflow.com/comment/42822624
comment on: http://stackoverflow.com/q/27165132
score: 0
has text: Make sure this class exist in jar file `org/apache/commons/io/output/DeferredFileOutputStream` and let us know.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27617704
accepted answer of: http://stackoverflow.com/q/27268002
answers question: http://stackoverflow.com/q/27268002
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: You can create each Groupbox by Java upon categories, so that there is no problem to know mapping between users and categories.
downvote count: 0
score: 1

http://stackoverflow.com/comment/43005036
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27244431
has text: @flup initially that was my question now my question is there a way to edit json file without re writing the entire file. so that it can be more code be efficient.

http://stackoverflow.com/q/27297654
linked to: http://stackoverflow.com/q/7635501
type: AnsweredQuestion
score: 2
has title: Why does the program not terminate when a method that throws RuntimeException is called without handling the exception in Java?
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27297761
has comment: http://stackoverflow.com/comment/43059727
has answer: http://stackoverflow.com/a/27297936
has answer: http://stackoverflow.com/a/27297761
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43059712
favorite count: 0
has body: Class 1: package hf; public class apples { public static void main(String[] args) { Good good = new Good(); good.method(); } } Class 2: package hf; public class Goodie extends NullPointerException { } Class 3: package hf; public class Good { public void method() throws Goodie { System.out.println("Goodmethod"); throw new Goodie(); } } I have not used any try/catch block to catch the NullPointerException(which extends RunTimeException) that is thrown when I call good.method() in class 1. When I run the program, the console in Eclipse indicates that the program is still running because it does not show at the top of the console box, like it usually does when the program execution is over. Why is the program still running? How can I bring the program execution to halt without pressing the red stop button?
tagged with: exception
possible better answer: http://stackoverflow.com/a/27297936

http://stackoverflow.com/comment/43027880
score: 0
has text: That's not the issue, the issue is the first command doesn't actually call the XML file. That is the correct format that JWrapper reads.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27279445

list
type: Tag
tags question: http://stackoverflow.com/q/27224758
tags question: http://stackoverflow.com/q/27249894
tags question: http://stackoverflow.com/q/27172195
tags question: http://stackoverflow.com/q/27179618
tags question: http://stackoverflow.com/q/27298649
tags question: http://stackoverflow.com/q/27230691
tags question: http://stackoverflow.com/q/27312077
tags question: http://stackoverflow.com/q/27179372
tags question: http://stackoverflow.com/q/27162000
tags question: http://stackoverflow.com/q/27195204
tags question: http://stackoverflow.com/q/27168077
tags question: http://stackoverflow.com/q/27277844
tags question: http://stackoverflow.com/q/27237945
tags question: http://stackoverflow.com/q/27158206
tags question: http://stackoverflow.com/q/27294313
tags question: http://stackoverflow.com/q/27239018
tags question: http://stackoverflow.com/q/27268027
tags question: http://stackoverflow.com/q/27215773
tag name: list
tags question: http://stackoverflow.com/q/27291808
tags question: http://stackoverflow.com/q/27215213
tags question: http://stackoverflow.com/q/27305840
tags question: http://stackoverflow.com/q/27175963
tags question: http://stackoverflow.com/q/27289768
tags question: http://stackoverflow.com/q/27238636
tags question: http://stackoverflow.com/q/27291061
tags question: http://stackoverflow.com/q/27183122
tags question: http://stackoverflow.com/q/27263256
tags question: http://stackoverflow.com/q/27235589
tags question: http://stackoverflow.com/q/27277872
tags question: http://stackoverflow.com/q/27219917
tags question: http://stackoverflow.com/q/27154874
tags question: http://stackoverflow.com/q/27253018
tags question: http://stackoverflow.com/q/27239341
tags question: http://stackoverflow.com/q/27165719
tags question: http://stackoverflow.com/q/27305949
tags question: http://stackoverflow.com/q/27229382
tags question: http://stackoverflow.com/q/27189507
tags question: http://stackoverflow.com/q/27160206
tags question: http://stackoverflow.com/q/27274612
tags question: http://stackoverflow.com/q/27179744
tags question: http://stackoverflow.com/q/27181052
tags question: http://stackoverflow.com/q/27252655
tags question: http://stackoverflow.com/q/27260972
tags question: http://stackoverflow.com/q/27236217
tags question: http://stackoverflow.com/q/27282401

jsf
tags question: http://stackoverflow.com/q/27216774
type: Tag
tags question: http://stackoverflow.com/q/27258624
tags question: http://stackoverflow.com/q/27212963
tags question: http://stackoverflow.com/q/27231194
tags question: http://stackoverflow.com/q/27162250
tags question: http://stackoverflow.com/q/27261659
tags question: http://stackoverflow.com/q/27178575
tags question: http://stackoverflow.com/q/27292951
tags question: http://stackoverflow.com/q/27167170
tags question: http://stackoverflow.com/q/27188769
tag name: jsf
tags question: http://stackoverflow.com/q/27227951
tags question: http://stackoverflow.com/q/27274877
tags question: http://stackoverflow.com/q/27173658
tags question: http://stackoverflow.com/q/27172775
tags question: http://stackoverflow.com/q/27176408
tags question: http://stackoverflow.com/q/27157411
tags question: http://stackoverflow.com/q/27214517
tags question: http://stackoverflow.com/q/27187745
tags question: http://stackoverflow.com/q/27259694

http://stackoverflow.com/comment/42949538
has text: Free form parsing "up to" `like ( or [ but not '` will be the death nail. No matter what you do, it won't be good enough. Have to define hard delimiters.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27234588
type: Comment

http://stackoverflow.com/comment/42972794
comment on: http://stackoverflow.com/q/27249209
has text: I would like to add both name and times, so names contains both.
score: 0
type: Comment
type: QuestionComment

character-encoding
tags question: http://stackoverflow.com/q/27297165
tag name: character-encoding
type: Tag
tags question: http://stackoverflow.com/q/27196310
tags question: http://stackoverflow.com/q/27260985

http://stackoverflow.com/a/27252426
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27252273
answers question: http://stackoverflow.com/q/27252273
type: AcceptedAnswer
downvote count: 0
has body: That is normally not possible. The prepare phase of a two-phase commit should do everything necessary to make the transaction durable, except making it visible to others. After a prepare has been completed successfully a commit should always be possible. Once a two-phase commit has been committed it cannot be backed out. If a commit of an already prepared transaction fails (eg because the resource is temporarily unavailable), then the resource manager should be able to recover the transaction and retry the commit. If this is not possible, then the resource doesn't support true two-phase commit and is probably faking it (for example by ignoring the prepare call). So the successful commit should not be rolled back, but the failed commit should be retried!
type: Answer

http://stackoverflow.com/a/27272763
score: 1
upvote count: 1
has body: I don't know how you are compiling this, because for me, it doesn't. These lines are problematic: TrueVminus = (double) (Math.pow((Math.PI), 4))/90; TrueEminus = (double) TrueVminus - fminus1; Etminus = (double) (TrueEminus/TrueVminus)*100; You convert the results to doubles, but the variables themselves are floats. If you do it like this: TrueVminus = (float) (Math.pow((Math.PI), 4))/90; TrueEminus = (float) TrueVminus - fminus1; Etminus = (float) (TrueEminus/TrueVminus)*100; then it works for me
has comment: http://stackoverflow.com/comment/43045659
downvote count: 0
has comment: http://stackoverflow.com/comment/43045572
has comment: http://stackoverflow.com/comment/43167301
has comment: http://stackoverflow.com/comment/43116544
type: Answer
answers question: http://stackoverflow.com/q/27272504
has comment: http://stackoverflow.com/comment/43117948
has comment: http://stackoverflow.com/comment/43044924

http://stackoverflow.com/a/27283824
type: Answer
answers question: http://stackoverflow.com/q/27283801
upvote count: 4
downvote count: 0
score: 4
has body: This is used to indicate a field of current object. public void intializeVariable(char z) { this.e = z; } If you change the above method to public void intializeVariable(char e) { this.e = e; } This will work normally. Compiler will know the "e" is the parameter and the this.e is the field of the object.

http://stackoverflow.com/a/27165620
type: Answer
downvote count: 0
score: 1
has body: I will get a String Array of names from user(Can of size 2,5,1) You get the input from user, you hit the database with query: SELECT (WHATEVER_YOU_NEED) FROM SCHEMA_NAME.TABLE_NAME WHERE COLUMN IN (USER_PROVIDED_INPUT); You store this result in List. Get all names of USERS table in a String array (named as all_names) and then compare my input string(i.e names) with this all_names String. So if names is subset of all_names then return true else return false. Yes, you are right, so you will use Use Collection.containsAll(): boolean isSubset = listA.containsAll(listB); And, if your database has unique names (which I guess can be duplicate), you can simply get the count from SQL Query and match it with the user input. I hope this will help.
upvote count: 1
answers question: http://stackoverflow.com/q/27165300

http://stackoverflow.com/q/27255244
has comment: http://stackoverflow.com/comment/43078731
favorite count: 0
tagged with: timer
tagged with: multithreading
has body: I've been having problems with getting my thread to work 100% correctly as currently it is returning my graph already sorted even when I update the thread inside my sorting algorithm while it is still sorting. Maybe there is a piece of code that I may be missing because I feel that I just about have it now. private class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == button1){ int[] array2=array; for (int i = 1; i &lt; array2.length; i++) { int thingToInsert = array2[i]; int j = i - 1; while (j &gt;= 0 &amp;&amp; thingToInsert&lt;array2[j]) { array2[j+1] = array2[j]; j--; } array2[j+1] = thingToInsert; (new UpdateTextFieldThread()).execute(); } } } } private class UpdateTextFieldThread extends SwingWorker&lt;Void, Integer&gt; { static final int THREAD_DELAY = 1000; protected Void doInBackground() { ExecutorService service = Executors.newSingleThreadExecuto(); try { Runnable r = new Runnable() { @Override public void run() { try { Thread.sleep(THREAD_DELAY); display.repaint(); } catch (InterruptedException e) { e.printStackTrace(); } } }; Future&lt;?&gt; f = service.submit(r); f.get(2, TimeUnit.MINUTES); } catch (final InterruptedException e) { // The thread was interrupted during sleep, wait or join } catch (final TimeoutException e) { // Took too long! } catch (final ExecutionException e) { // An exception from within the Runnable task } finally { service.shutdown(); } return null; } This is what I did to achieve what I wanted. private class UpdateTextFieldThread extends SwingWorker&lt;Void, Integer[]&gt; { static final int THREAD_DELAY = 1000; protected Void doInBackground() { if(base==1){ array2=array; try { Integer[] array3=array; for (int i = 1; i &lt; array3.length; i++) { Thread.sleep(THREAD_DELAY); int thingToInsert = array3[i]; int j = i - 1; while (j &gt;= 0 &amp;&amp; thingToInsert&lt;array3[j]) { array3[j+1] = array3[j]; j--; } array3[j+1] = thingToInsert; publish(array3); } }…
has answer: http://stackoverflow.com/a/27255371
tagged with: swing
type: AnsweredQuestion
downvote count: 0
has title: Updating thread at the right moment
score: 1
tagged with: java
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/42988704
answer count: 1
accepted answer: http://stackoverflow.com/a/27255371

http://stackoverflow.com/comment/42824994
score: 0
comment on: http://stackoverflow.com/q/27165484
type: QuestionComment
type: Comment
has text: Unless you can tell me how it can check an input `int` is a `Volume` or not, I don't think it is a feasible idea to use annotation in such case. If you are looking for way to reduce unexpected typo, a fluent-builder like pattern maybe what you want: something like `foo().withVolume(a).withWeight(b).run()`. Of course there are extra development effort but if the method parameter is really that ambiguous and easy to mix up, it worth the extra effort. And, value object in C# doesn't solve the problem. Yes, instantiating from stack is having smaller overhead, but

http://stackoverflow.com/comment/42906984
comment on: http://stackoverflow.com/q/27196376
type: Comment
type: QuestionComment
has text: @Cole Because `0` has the ASCII value 48, not 0 :)
score: 0

http://stackoverflow.com/comment/42821446
comment on: http://stackoverflow.com/q/27164230
has text: and what should be the output?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27246399
tagged with: resteasy
tagged with: rest
has comment: http://stackoverflow.com/comment/42971874
has comment: http://stackoverflow.com/comment/42970049
has answer: http://stackoverflow.com/a/27248451
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42969161
upvote count: 1
has body: I have to model the rest service operations where I am trying to create a URI to hit Java Inner classes. Let me know if this can be achieved using Rest Web Service? I am using rest easy for my services. Edit: (using code provided by answer from peeskillet) javax.ws.rs.ProcessingException: Unable to invoke request at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:407) Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8081 refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:283) ... 26 more Caused by: java.net.ConnectException: Connection refused
type: Question
has comment: http://stackoverflow.com/comment/42971105
has comment: http://stackoverflow.com/comment/42975835
accepted answer: http://stackoverflow.com/a/27248451
has title: Rest Service URI mapping to Java Inner Classes
answer count: 1
downvote count: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/42976393
has comment: http://stackoverflow.com/comment/42981732
favorite count: 0

http://stackoverflow.com/a/27296005
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27294243
has body: Apache Commons library has already implemented this method,you don't need to write again. Code : return StringUtils.remove(base, remove);

http://stackoverflow.com/a/28931169
type: Answer
has body: Regardless of variable scope, serialized lambdas will include outside variables as long as the types of those variables are Serializable. Make sure that's the case and you're good to go.
accepted answer of: http://stackoverflow.com/q/27221035
answers question: http://stackoverflow.com/q/27221035
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27301990
has comment: http://stackoverflow.com/comment/43068490
has body: use Resources resources = getResources(); image.setImageDrawable(resources.getDrawable(R.drawable.myfirstimage));
score: 0
answers question: http://stackoverflow.com/q/27301798
type: Answer

http://stackoverflow.com/comment/42862744
type: QuestionComment
comment on: http://stackoverflow.com/q/27188135
has text: Well, you have probably found a bug in Eclipse. Open a bug report ;)
score: 5
type: Comment

http://stackoverflow.com/comment/42968461
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27246062
type: AnswerComment
has text: thanks after reading ur suggestion i think i get it already. thanks. i need a do while loop ffor my workerThread run(). and the codition to the while is to check if my producer produced finished already. thanks alot.

http://stackoverflow.com/q/27269719
has comment: http://stackoverflow.com/comment/43012019
has comment: http://stackoverflow.com/comment/43010513
has comment: http://stackoverflow.com/comment/43029378
tagged with: mouse
has comment: http://stackoverflow.com/comment/43013154
has comment: http://stackoverflow.com/comment/43014299
has comment: http://stackoverflow.com/comment/43011235
has comment: http://stackoverflow.com/comment/43010116
has comment: http://stackoverflow.com/comment/43011408
has comment: http://stackoverflow.com/comment/43010712
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/16743427
has comment: http://stackoverflow.com/comment/43013049
tagged with: swing
has comment: http://stackoverflow.com/comment/43046637
type: Question
has comment: http://stackoverflow.com/comment/43012096
has comment: http://stackoverflow.com/comment/43013619
has comment: http://stackoverflow.com/comment/43011918
has body: An application had a short popup menu with configuration. After some time the configuration had grown, and I want to call a dialogue instead the popup menu. But when I call the dialog on mouse event, strange things happen. The mouseReleased is called several times in stack. Every time it is called for the same component (the correct one), so, it is not due to calling the same event from several overlaying components. It seems, that I simply can't call dialogue instead of popup menu, ok. But what is happening? The adapter: class ConfigTriggerListener extends MouseAdapter{ ... @Override public void mouseReleased(MouseEvent ev) { if (ev.isPopupTrigger()) { &lt;-- breakpoint cont.showScreenModal(ConfigDlg.class, DynProps.createFromValues(ConfigDlg.CONFIG_CONTROL_CLASS, ORundownConfig.class)); } } } CallStack after right click and pause on the breakpoint: octopus.client.core.rundown.RundownClock$ConfigTriggerListener.mouseReleased(RundownClock.java:164) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) java.awt.Component.processMouseEvent(Component.java:6505) javax.swing.JComponent.processMouseEvent(JComponent.java:3320) java.awt.Component.processEvent(Component.java:6270) java.awt.Container.processEvent(Container.java:2229) java.awt.Component.dispatchEventImpl(Component.java:4861) java.awt.Container.dispatchEventImpl(Container.java:2287) java.awt.Component.dispatchEvent(Component.java:4687) java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) java.awt.LightweightDispatcher.processMouseEvent(Container…
score: 0
tagged with: events
has title: Why MouseReleased event is stacked ( several times )?
has comment: http://stackoverflow.com/comment/43044339
has comment: http://stackoverflow.com/comment/43011433
has comment: http://stackoverflow.com/comment/43011736
type: UnansweredQuestion

http://stackoverflow.com/a/27175033
has comment: http://stackoverflow.com/comment/42844298
has comment: http://stackoverflow.com/comment/42853003
has body: By default, the eval function itself will take and hold a global write lock. By setting nolock to true all you are doing is preventing that lock from being taken by eval. Setting nolock does not impact whether operations within the JavaScript code itself takes a write lock, so any update, insert, findAndModify etc. operation that you perform in the code itself will still take a lock just like any other write operation (for reference, this is essentially straight from the docs). There is no alternative or way around this, you can't write data to the database without impacting your locking, if you are writing data (including updates) then you have to take a write lock. Running operations server side and inside an eval statement does not change that. It's worth noting that the warning message you have posted is just that, a warning. It means that the query in question tried to yield (usually because it was doing a fault to disk) and could not because of the nature of the lock it held at the time - it is not an error. I would recommend running this outside an eval block to see what it looks like then and remove eval from the equation entirely.
has comment: http://stackoverflow.com/comment/42842173
answers question: http://stackoverflow.com/q/27167794
has comment: http://stackoverflow.com/comment/42853473
score: 0
type: Answer

http://stackoverflow.com/comment/42838145
score: 0
comment on: http://stackoverflow.com/q/27174157
type: Comment
type: QuestionComment
has text: Tell me if I understand you correctly, whenever the user is registering, the form should by default mark the ROLE_USER, ROLE_ADMIN, as checked in the form and then save that which is defined in collection. Correct? So user basically has no control over which role he gets...correct?

http://stackoverflow.com/comment/42897790
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27207918
has text: Like @jjm said, how are you getting the data from Amazon? Is it in a text file? Are you reading it in and storing it some way? We need more information than the structure of the Amazon output dump. Please provide some code of what you have tried

http://stackoverflow.com/q/27223703
tagged with: media-player
has body: I'm new to Java and my friend helped me to write this code. I'm getting errors on because I think I'm using the wrong syntax. I've added comments to the code, where I'm having problems. I'm not even sure if I should be putting this code inside or outside of oncreate. Can anyone please point me to the directions for a good Java learning resource also. @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class MainActivity extends ActionBarActivity { public MediaPlayer mediaPlayer; @Override protected void onCreate(Bundle savedInstanceState) { /*super.onCreate(savedInstanceState);*/ setContentView(R.layout.activity_main); getActionBar().hide(); mediaPlayer = new MediaPlayer(); //getting an error on this line for invalid syntax. //not sure what to put here playB() throws IOException { playSound(R.raw.b) } //not sure what to put here playSound(int resId) throws IOException { URI uri = URI.parse("android://com.max.bead/" + resId); if(mediaPlayer.isPlaying()) { mediaPlayer.stop(); } else { mediaPlayer.setDataSource(getApplicationContext(), uri); mediaPlayer.prepare(); mediaPlayer.play(); } } }
has answer: http://stackoverflow.com/a/27223784
tagged with: android
has answer: http://stackoverflow.com/a/27223925
has title: Getting weird errors while using media player
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/43062614
comment on: http://stackoverflow.com/q/27295582
has text: In a test env, I want to separately specify replacement beans (like Springockito) without dependence on order (which is a feature of Spring that is not guaranteed to always be supported)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27254000
answer count: 3
has title: Java - Mix up letters
downvote count: 0
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/27254127
has answer: http://stackoverflow.com/a/27254127
accepted answer: http://stackoverflow.com/a/27254288
has body: Can someone give me an example of how to split Strings before you scramble the letters I can scramble the words but it changes the length of the words too Example: input : Hello my name is Jon output: e imanoJs my nlolHe But it should be like this input : Hello my name is Jon output: Hlelo my nmae is Jon so the first and last letter should stay in place here is my code so far public class MixUp{ public static void main(String[] args){ String cards="Hello my Name is Jon, nice to meet you"; System.out.println("Input String = " + cards); cards = shuffle(cards); System.out.println("Shuffled String = " + cards); } static String shuffle(String cards){ if (cards.length()&lt;=1) return cards; int split=cards.length()/2; String temp1=shuffle(cards.substring(0,split)); String temp2=shuffle(cards.substring(split)); if (Math.random() &gt; 0.5) return temp1 + temp2; else return temp2 + temp1; } }
has answer: http://stackoverflow.com/a/27254182
score: 2
upvote count: 2
tagged with: shuffle
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: split
has answer: http://stackoverflow.com/a/27254288

http://stackoverflow.com/comment/42920618
has text: @AvinashRaj: I have formatted the query. Thanks for telling me ...I dint know
comment on: http://stackoverflow.com/q/27215466
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27302793
answer count: 3
has answer: http://stackoverflow.com/a/27303091
favorite count: 0
tagged with: timezone
has comment: http://stackoverflow.com/comment/43072457
accepted answer: http://stackoverflow.com/a/27304980
type: AnsweredQuestion
score: 3
tagged with: simpledateformat
tagged with: java
possible better answer: http://stackoverflow.com/a/27303091
has title: Unparseable Date In America/Mazatlan timezone
tagged with: date
has answer: http://stackoverflow.com/a/27304980
type: Question
downvote count: 0
has body: I'm on America/Los_Angeles TZ, and when I try to render midnight in the America/Mazatlan TZ, I get the following exception: Exception in thread "main" java.text.ParseException: Unparseable date: "12:00 AM" Here is my code to reproduce this: DateFormat dateFormat = new SimpleDateFormat("h:mm a"); TimeZone timeZone = TimeZone.getTimeZone("America/Mazatlan"); dateFormat.setTimeZone(timeZone); dateFormat.setLenient(false); Date parse = dateFormat.parse("12:00 AM"); I'm aware the commenting out the setLenient(false) will fix the issue, I'm just not sure why that is a fix as other timezones in the same offset, such as America/Inuvik do not cause issues like this. Any assistance would be great.
upvote count: 3
has answer: http://stackoverflow.com/a/27303628

http://stackoverflow.com/a/27161130
has comment: http://stackoverflow.com/comment/43031199
has body: Address already in use implies that there are not enough ports on the local side available for creating a connection. You would see a lot of entries if you check the network stats. Assuming it is windows, for the exact way to get the listing, check the platform docs. For an understanding of the issue, you can also read: http://khanna111.com/articles/TCPAAIU.html Note that the top 2 figures on that page are jumbled. There is an explanation of the TIME_WAIT stage as well. The cause, if you only have that one application doing jdbc running, then the probable cause could be that TCP connections to the database server are being created and either not closed or rate of creating and closing the connections is greater than a threshold that leads to this issue. You would need to investigate a connection pool in any case if you do not already have one. If there are other applications on the same host that deal with network traffic then you would need to take a look at those as well.
has comment: http://stackoverflow.com/comment/43060536
type: Answer
has comment: http://stackoverflow.com/comment/43033344
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27160906
has comment: http://stackoverflow.com/comment/43032007
has comment: http://stackoverflow.com/comment/43060280
has comment: http://stackoverflow.com/comment/43030343
upvote count: 1

http://stackoverflow.com/q/27178518
has comment: http://stackoverflow.com/comment/42872322
score: 0
has comment: http://stackoverflow.com/comment/42845893
has comment: http://stackoverflow.com/comment/42846008
linked to: http://stackoverflow.com/q/21955256
type: UnansweredQuestion
has body: I am writing a very simple code to connect MS Access database to my java program using netBeans. The driver ucanaccess and MS access file is placed in the very same folder. Kindly guide me through it. public static void main(String[] args) { // TODO code application logic here Connection c = null; Statement s = null; ResultSet rs = null; try{ Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); c = DriverManager.getConnection("jdbc:ucanaccess://First1.accdb"); s = c.createStatement(); s.executeUpdate("insert into std values(5, 'junaid')"); //set classpath=.c:./*; }catch(Exception e) { System.out.println(e); } }
has comment: http://stackoverflow.com/comment/42846610
tagged with: jdbc
has title: ClassNotFound Exception for jdbc "uncanaccess" path setting for MS Access
duplicate of: http://stackoverflow.com/q/21955256
tagged with: ucanaccess
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42845930
has comment: http://stackoverflow.com/comment/42846077
type: Question
has comment: http://stackoverflow.com/comment/42846271

http://stackoverflow.com/comment/42989725
has text: Is it actual for java 6 ?
type: AnswerComment
comment on: http://stackoverflow.com/a/27257890
score: 0
type: Comment

http://stackoverflow.com/q/27218263
has body: Problem: I'm unable to move the poor pacman, through the left and right arrowkeys. I'm basicly trying to use "difference" as the x-coordinate in which the pacman is designed around; if "difference" is changed, the pacman will move. It would be nice having someone to shed some light upon this glorious pacman game. I would prefer a simple solution rather than having to redesigning the whole code; i'm fairly new. Main: public class Benyt { public static void main(String[] args) { JFrame vindue = new JFrame ("Eksamensspil"); vindue.add(new Pacman()); vindue.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); vindue.setSize(317,540); vindue.setVisible(true); Graphics g = vindue.getGraphics(); Bold bold = new Bold(g, 125, 400); } } The pacman class: package eksamensspil; import java.awt.*; import java.awt.geom.*; import javax.swing.*; // import java.awt.Graphics; import java.awt.event.*; public class Pacman extends JPanel implements KeyListener { GeneralPath pacman; GeneralPath bane; int difference = 0; // constructor public Pacman() { tegnPacman(); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.draw(bane); g2.drawString("Point: ", 230, 470); g2.draw(pacman); } //keytyped public void keyTyped(KeyEvent e) { tegnPacman(); if (e.getKeyCode() == KeyEvent.VK_LEFT) difference = difference - 6; else if (e.getKeyCode() == KeyEvent.VK_RIGHT) difference = difference + 6; repaint(); } private void tegnPacman() { setBackground(Color.WHITE); // Koordinaterne defineres herunder // Koordinater int baneX = 300; int baneY = 500; // Pacman: int pacmanCenterX = 150+difference; int pacmanCenterY = 425; // ======================PACMAN====================== pacman = new GeneralPath (); //Der tegnes en hvid rektangel for at "overwrite" den gamle pacman // BasicStroke stregtype = new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND); pacman.append(new Rectangle2D.Float(0, 400, 300, 50), false); // pacman-figuren pacman.append(ne…
score: 1
tagged with: java
tagged with: keylistener
upvote count: 1
type: Question
has title: Java: Pacman doesn't move upon keyTyped
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27218342
type: UnansweredQuestion

http://stackoverflow.com/comment/42933389
score: 1
type: Comment
type: QuestionComment
has text: Those don't seem like valid reasons. In the first example, there is nothing confusing about having a variable `r` in the Javadoc; so just call it `r` and be done with it. If you need to change `r` to `random` (as per your second example), simply use Eclipse's refactoring features (Alt-Shift-c) - it will change it in the method signature, body and in the Javadoc.
comment on: http://stackoverflow.com/q/27227570

http://stackoverflow.com/q/27234504
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42951051
has answer: http://stackoverflow.com/a/27235132
has comment: http://stackoverflow.com/comment/42948590
has answer: http://stackoverflow.com/a/27235048
has comment: http://stackoverflow.com/comment/42946136
downvote count: 0
tagged with: executorservice
has title: when do we consider a worker thread as free in Executor Service
favorite count: 0
has body: I am having a conceptual problem in understanding the working of fixedthreadpool of executor service. Suppose I have a fixed pool thread of n threads and I am submitting several tasks to this service. Now if a worker is available, it executes the submitted task and other submitted tasks wait in the queue until a worker is free. My question is, when do we consider a worker as a free worker thread ? Do we consider a worker thread free as soon as it starts submitted task irrespective of task's completion or we consider a worker thread busy as long as submitted task is in progress. Let's say we have a worker thread W1 in the pool and a Task Op1 is submitted to the executor. W1 starts Op1 at time T1 and after some time Op1 finished its execution at time T3. Here T3 > T1 Now do we consider W1 as free as soon as it starts Op1 at time T1 or it is considered busy and will be free at time T3. Thanks in advance !!
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42958005
tagged with: java

http://stackoverflow.com/comment/42947557
type: QuestionComment
comment on: http://stackoverflow.com/q/27235402
has text: true!I forgot to add it! And what could I use instead of BorderLayout...?
score: 0
type: Comment

http://stackoverflow.com/comment/42828051
has text: I don't understand very well your question. Why do you want to access files inside your webapps folder? Your webapp should contain all the needed files inside the webapp and you can access all the files inside your webapp using the classpath. If i'm not wrong, the only way that you can access files outside your webapp (that you shouldn't do) is using the standard File operations using absoulte file paths. And you'll only be able to access paths if the user that is running Tomcat has read permission.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27167666

http://stackoverflow.com/a/27311229
has comment: http://stackoverflow.com/comment/43083443
has comment: http://stackoverflow.com/comment/43085476
score: 1
has comment: http://stackoverflow.com/comment/43085658
has comment: http://stackoverflow.com/comment/43085645
has comment: http://stackoverflow.com/comment/43085587
has comment: http://stackoverflow.com/comment/43084722
has comment: http://stackoverflow.com/comment/43085546
downvote count: 0
has comment: http://stackoverflow.com/comment/43085300
answers question: http://stackoverflow.com/q/27311083
has comment: http://stackoverflow.com/comment/43085734
type: Answer
has comment: http://stackoverflow.com/comment/43085825
has body: I assume your json (in the json array) without escaping and with a little formatting looks like this: [ { "__type": "GeoPoint", "latitude": 51.165691, "longitude": 10.451526 }, { "__type": "GeoPoint", "latitude": 20.593684, "longitude": 78.96288 } ] I assume __type would work when you comment out latitude and longitude and insert: obj.getString("__type"); But you are now using obj.getString on latitude and longitude while they are not strings. So use for latitude and longitude: (Edit: this is not necessary since the json parser will make it automatically a String) obj.getDouble("latitude"); edit I actually just tested your code and this worked: String jsonString = " [{\n" + " \"__type\": \"GeoPoint\",\n" + " \"latitude\": 51.165691,\n" + " \"longitude\": 10.451526\n" + " },\n" + " {\n" + " \"__type\": \"GeoPoint\",\n" + " \"latitude\": 20.593684,\n" + " \"longitude\": 78.96288\n" + " }]"; JSONArray jsonarray; try { jsonarray = new JSONArray(jsonString); for(int j=0; j&lt;jsonarray.length(); j++){ JSONObject obj = jsonarray.getJSONObject(j); String latitude = obj.getString("latitude"); String longitude = obj.getString("longitude"); Log.e("triplatitude", latitude); Log.e("triplongitude", longitude); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/43085489
has comment: http://stackoverflow.com/comment/43083216
upvote count: 1
has comment: http://stackoverflow.com/comment/43085030

http://stackoverflow.com/comment/42810815
has text: I'm trying your second suggestion with the PropertyChangeListener, but evt.getPropertyName() always returns "state" instead of "progress". Do you know why this is?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27155228

http://stackoverflow.com/q/27217362
favorite count: 0
has answer: http://stackoverflow.com/a/51087101
has comment: http://stackoverflow.com/comment/42914712
type: Question
score: 14
accepted answer: http://stackoverflow.com/a/27217650
tagged with: android
has body: I've been trying for a while already (as well, searching in here) for something to help me to refresh listView in my MainFragment, when a button is pressed in other fragment. Could sommeone explain me how to make it work? Here's MainFragment with the function (I excluded other functions, since I don't see how they contribute): public class MainFragment extends Fragment { public void otherList() { SQLite db = new SQLite(getActivity()); db.open(); Calendar sCalendar = Calendar.getInstance(); String day = sCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.ENGLISH); Cursor c = db.getAllRecords(day); Calendar cal = Calendar.getInstance(); int hour = cal.get(Calendar.HOUR_OF_DAY); arrayOfBars.clear(); if (c.moveToFirst()) { do { String country = c.getString(0); String city = c.getString(1); String bar = c.getString(2); String timeStart = c.getString(3); String[] h = timeStart.split(":"); int times = Integer.parseInt(h[0]); String timeEnd = c.getString(4); String[] h2 = timeEnd.split(":"); int timee = Integer.parseInt(h2[0]); String placeLaLo = c.getString(5); String description = c.getString(6); String likes = c.getString(7); String offer = c.getString(8); if (hour &lt; (times + 1) || hour &lt; (timee)) { getPrefs = PreferenceManager .getDefaultSharedPreferences(MainFragment.this .getActivity()); boolean lay = getPrefs.getBoolean("boolean", false); if (lay == true) { while (times &lt; timee) { timeStart = times + ":" + h[1]; times++; timeEnd = times + ":" + h2[1]; arrayOfBars.add(new BarObject(country, city, bar, timeStart, timeEnd, placeLaLo, description, likes, offer, bar)); } } else { arrayOfBars.add(new BarObject(country, city, bar, timeStart, timeEnd, placeLaLo, description, likes, offer, bar)); } } } while (c.moveToNext()); Collections.sort(arrayOfBars, new BarObject.CompST()); lv2.setAdapter(null); adapter = new BarAdapter(getActivity(), arrayOfBars); lv2.setAdapter(adapter); } else { Toast.makeText(getActivity(), "No database found", Toast.LENGTH…
has answer: http://stackoverflow.com/a/58902108
upvote count: 14
has answer: http://stackoverflow.com/a/27217461
tagged with: fragment
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/27217650
tagged with: eclipse
tagged with: listview
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27217421
downvote count: 0
has title: Calling a method in one fragment from another
possible better answer: http://stackoverflow.com/a/51087101

http://stackoverflow.com/q/27277357
has comment: http://stackoverflow.com/comment/43024715
type: Question
upvote count: 2
answer count: 1
has body: I'm trying to test for arbitrary generators of a cyclic group. I've found explanations indicating that for a Multliplicative Group Z*p, we want the following conditions to be true: q is a prime number p = 2q + 1 is a prime number p will be used for Z*p I'm trying to use the following test: If g^2 = 1 mod p, try another number If g^q != 1 mod p try another number Return the number public static BigInteger getGenerator(BigInteger p, BigInteger q){ BigInteger generator = BigInteger.ZERO; BigInteger oneModP = BigInteger.ONE.mod(p); for(long i = 2; i &lt; p.intValue()-1; i++) { generator = BigInteger.valueOf(i); if(!generator.pow(2).equals(oneModP)) //if (g^2 = 1 mod p) then go to the next number { continue; } //TODO: make a method that works with BigInteger^BigInteger. This is hackey and limits us to 32 bits if(!generator.pow(q.intValue()).equals(oneModP)) //if (g^q != 1modp) then go to the next number { continue; //next number! } //TODO: randomly generate then test. Sequential isn't really best here...just for testing purposes else { return generator; //return the first one we find for simplicity's sake } } return generator; } However, I'm getting false positives. For example, p=11 (Z*11) it' returning 9 as a generator. Shouldn't it return 2? Thank you for any assistance
accepted answer: http://stackoverflow.com/a/27280806
has title: Java BigInteger Cyclic Group Generator Search
favorite count: 0
has comment: http://stackoverflow.com/comment/43027483
has comment: http://stackoverflow.com/comment/43023970
has answer: http://stackoverflow.com/a/27280806
tagged with: cryptography
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: biginteger
tagged with: java

http://stackoverflow.com/comment/42888139
type: AnswerComment
score: 0
type: Comment
has text: Ah, ArrayList objects have size() methods instead of length(). And we have to change the signature of the corridor() method... I have edited the code above
comment on: http://stackoverflow.com/a/27202293

http://stackoverflow.com/a/48235783
downvote count: 0
has comment: http://stackoverflow.com/comment/135307539
type: Answer
score: 31
has comment: http://stackoverflow.com/comment/129840496
upvote count: 31
answers question: http://stackoverflow.com/q/27253555
has body: Similar to Alexis C's answers. but in Kotlin. Just pass the class type into function and clarify what generic type is. Here is simplified example. inline fun &lt;reified T&gt; parseArray(json: String, typeToken: Type): T { val gson = GsonBuilder().create() return gson.fromJson&lt;T&gt;(json, typeToken) } Here is example call fun test() { val json: String = "......." val type = object : TypeToken&lt;List&lt;MyObject&gt;&gt;() {}.type val result: List&lt;MyObject&gt; = parseArray&lt;List&lt;MyObject&gt;&gt;(json = json, typeToken = type) println(result) }

http://stackoverflow.com/comment/43198206
score: 0
type: Comment
has text: Sorry for the late reply, I have been busy with my studies (finals week). Sadly, I have not been able to submit this but it's okay. I'd try to figure the code out in my free time. Thank you very much for the help ajb :)
type: AnswerComment
comment on: http://stackoverflow.com/a/27284571

http://stackoverflow.com/comment/42874203
type: Comment
comment on: http://stackoverflow.com/a/27194254
has text: @ChristianKuetbach yes, I meant convert them to lists and then use the lists, as OP suggests, and then use a synchronised version if needed.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27208796
has body: I am trying to create a program which asks the user to guess a number which is randomly generated and the loop exits when the input is correct. I am also trying to stop user from entering an invalid data and want the loop to repeat until user enters a valid data. The problem is when is type in an alphabet as an input, the program repeats. thank you for helping in advance. I am using eclipse kepler Output: Try guessing the number: k You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: You have entered invalid data. Please try again Try guessing the number: while(true){ try{ System.out.println("Try guessing the number: "); guess=input.nextInt(); if(guess==sum){ System.out.println("You have guessed it correctly"); break; } }catch(InputMismatchException e){ System.out.println("You have entered invalid data. Please try again"); } }
has answer: http://stackoverflow.com/a/27208881
tagged with: java
has answer: http://stackoverflow.com/a/27208830
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/27208881
answer count: 2
score: 0
accepted answer: http://stackoverflow.com/a/27208830
has title: Trying to use Try catch in a while loop until the user answers correctly without entering invalid data(Java)
type: AnsweredQuestion

http://stackoverflow.com/comment/42917517
type: QuestionComment
type: Comment
has text: You can use debugger and find easily!
comment on: http://stackoverflow.com/q/27219164
score: 0

http://stackoverflow.com/a/27265273
has comment: http://stackoverflow.com/comment/43007165
has body: Check out this guide exampling how you can switch from Hibernate 4 to Hibernate 3. Once you enable Hibernate 3, you only need to set the JBoss Transaction Manager resolving settings.
accepted answer of: http://stackoverflow.com/q/27264707
type: Answer
answers question: http://stackoverflow.com/q/27264707
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43006996
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/27246410
type: Answer
upvote count: 1
has body: If you at least requires one Teacher (and others can be optional), i.e a one to many relation, you don't need two constructors. One is sufficient with a varargs parameter. public DespachoImpl(String nombre, Integer planta, Integer aforo, Teacher required, Teacher... moreTeachers) { super(TipoLugar.OTRO, nombre, planta, aforo); this.teacher = new HashSet&lt;Teacher&gt;(); this.teacher.add(required); this.teacher.addAll(Arrays.asList(moreTeachers)); }
has comment: http://stackoverflow.com/comment/42967862
has comment: http://stackoverflow.com/comment/42967849
score: 1
has comment: http://stackoverflow.com/comment/42968126
downvote count: 0
answers question: http://stackoverflow.com/q/27246277
has comment: http://stackoverflow.com/comment/42967760
has comment: http://stackoverflow.com/comment/42968067

http://stackoverflow.com/a/27243104
has body: Thanks for your inputs everyone. After so much digging I finally found the answer. This is a server side code and the fault was in client code who was interrupting server if it was not returning result in specified time limit. Of course client's time limit was less than server's timeout limit. Although they were catching the interrupted exception thrown from server, but this was wrapped under UndeclaredThrowableException as server was using dynamic proxies.
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27171980
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27171980

http://stackoverflow.com/a/27160090
answers question: http://stackoverflow.com/q/27160038
has body: probably it depends on the language, but I assume there is no difference. The syntax of the first example is easier but there is no counter so you should probably also declare another variable. In the second case you have it already..
type: Answer
score: 0

http://stackoverflow.com/a/27208641
has body: add this to your code: textResult = (TextView)findViewById(R.id.textResult);
accepted answer of: http://stackoverflow.com/q/27207402
answers question: http://stackoverflow.com/q/27207402
has comment: http://stackoverflow.com/comment/42899292
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42899264

http://stackoverflow.com/comment/42812007
has text: *"You just forgot to set the size"* - If you had actually added something to the frame, you'd only have to call pack, which would size the window according to the requirements of the contents AND the frames borders
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27158338
type: Comment

http://stackoverflow.com/a/27313073
type: Answer
upvote count: 3
has body: This is an ISO 8601 formatted date with the T omitted between the date and time (see: In an ISO 8601 date, is the T character mandatory?)
has comment: http://stackoverflow.com/comment/43086807
score: 3
answers question: http://stackoverflow.com/q/27313005
downvote count: 0
has comment: http://stackoverflow.com/comment/43087402

inputmismatchexception
tags question: http://stackoverflow.com/q/27244335
tags question: http://stackoverflow.com/q/27297752
tags question: http://stackoverflow.com/q/27221591
type: Tag
tag name: inputmismatchexception

http://stackoverflow.com/q/27230602
has answer: http://stackoverflow.com/a/27230707
score: 0
has body: I want so save "Object" inside an array. I DONT want to save "new Object()" inside an array. Why? I have 3 big If Statements where i check if a Instance is instanceof SomeClass, e.g. if (x instanceof String) { SomeMethod(x, String); } I Plan Something like: Class&lt;?&gt;[] classes = {Object, String, SomeOtherClass}; for (int i = 0; i &lt; 3; i++) { if (x instanceof classes [i]) { SomeMethod(x, classes [i]); } } However this is working Class&lt;?&gt;[] classes = {Object.class, String.class, SomeOtherClass.class}; but then i can't use instanceof any more. Any Suggestions? P.S: while searching for this i only found how to save an Instance of a Class inside an array, not the Class itself... Edit: at the Position of SomeMethod i want to use a generic Type based on the Class (Object,String). This does not work with Object.class, String.class.
type: UnansweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/27230726
tagged with: java
type: Question
has title: Java Object itself in array
answer count: 2
tagged with: arrays

methods
tags question: http://stackoverflow.com/q/27307388
tags question: http://stackoverflow.com/q/27236568
tags question: http://stackoverflow.com/q/27222645
tags question: http://stackoverflow.com/q/27261104
tags question: http://stackoverflow.com/q/27183842
tags question: http://stackoverflow.com/q/27161160
tags question: http://stackoverflow.com/q/27161439
tags question: http://stackoverflow.com/q/27219641
tags question: http://stackoverflow.com/q/27215850
tag name: methods
tags question: http://stackoverflow.com/q/27295127
tags question: http://stackoverflow.com/q/27184659
tags question: http://stackoverflow.com/q/27162365
tags question: http://stackoverflow.com/q/27282263
tags question: http://stackoverflow.com/q/27172448
tags question: http://stackoverflow.com/q/27189284
tags question: http://stackoverflow.com/q/27219267
tags question: http://stackoverflow.com/q/27264173
tags question: http://stackoverflow.com/q/27162996
tags question: http://stackoverflow.com/q/27304510
type: Tag
tags question: http://stackoverflow.com/q/27197191
tags question: http://stackoverflow.com/q/27307342
tags question: http://stackoverflow.com/q/27212872
tags question: http://stackoverflow.com/q/27216588
tags question: http://stackoverflow.com/q/27238701
tags question: http://stackoverflow.com/q/27156158
tags question: http://stackoverflow.com/q/27220629
tags question: http://stackoverflow.com/q/27259162
tags question: http://stackoverflow.com/q/27222417
tags question: http://stackoverflow.com/q/27214741
tags question: http://stackoverflow.com/q/27311979
tags question: http://stackoverflow.com/q/27261929
tags question: http://stackoverflow.com/q/27158206
tags question: http://stackoverflow.com/q/27240940
tags question: http://stackoverflow.com/q/27229502
tags question: http://stackoverflow.com/q/27263398
tags question: http://stackoverflow.com/q/27305490
tags question: http://stackoverflow.com/q/27282000
tags question: http://stackoverflow.com/q/27248559
tags question: http://stackoverflow.com/q/27158755
tags question: http://stackoverflow.com/q/27225459
tags question: http://stackoverflow.com/q/27284145
tags question: http://stackoverflow.com/q/27307875
tags question: http://stackoverflow.com/q/27302277
tags question: http://stackoverflow.com/q/27297475
tags question: http://stackoverflow.com/q/27183429
tags question: http://stackoverflow.com/q/27277791
tags question: http://stackoverflow.com/q/27175445
tags question: http://stackoverflow.com/q/27217837
tags question: http://stackoverflow.com/q/27284369
tags question: http://stackoverflow.com/q/27271688
tags question: http://stackoverflow.com/q/27178835
tags question: http://stackoverflow.com/q/27273680

http://stackoverflow.com/comment/43041393
comment on: http://stackoverflow.com/q/27287074
score: 0
type: QuestionComment
type: Comment
has text: @Sniper Of course it could be different. It's configurable.

http://stackoverflow.com/q/27155840
has answer: http://stackoverflow.com/a/27156022
has comment: http://stackoverflow.com/comment/42806569
has comment: http://stackoverflow.com/comment/42806538
has answer: http://stackoverflow.com/a/27156250
has comment: http://stackoverflow.com/comment/42806504
tagged with: java
score: 0
has title: How would I create this loop that examines integers in an array?
has comment: http://stackoverflow.com/comment/42806134
tagged with: arrays
has body: What I am doing is creating a matrix with a set number of rows and columns, and I am filling that table with random integers from range of 0 to 9. What I want to do now is determine if there is a consecutive even integer that repeats four times next to each other in the table. For instance, something like this: 2 5 8 7 1 3 2 9 4 7 5 1 2 0 3 8 0 1 2 7 In that table, two appear consecutively, diagonally from the first spot. It can also be like this: 9 5 3 7 0 2 5 7 3 1 8 5 0 2 9 4 5 1 7 5 In this table, five appear vertically down from the second spot. I have created the two-dimensional array as shown here: public static void main(String[] args) { int[][] randomTable = new int[5][5]; for (int row = 0; row &lt; randomTable.length; row++) { for (int column = 0; column &lt; randomTable[row].length; column++) { randomTable[row][column] = (int)(Math.random() * 10 + 0); System.out.print(randomTable[row][column] + " "); } System.out.println(); } } When testing the array, if the array contains those four consecutive even integers as I detailed above, I need it to return true. I know I need to create a loop, but how would I do this?
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27156056
has comment: http://stackoverflow.com/comment/42806237
has comment: http://stackoverflow.com/comment/42806250
type: Question
has answer: http://stackoverflow.com/a/27156501
has answer: http://stackoverflow.com/a/27156274

http://stackoverflow.com/comment/42912653
type: QuestionComment
score: 1
has text: I think they are speaking about the specific `TreeMap` methods. For example, if you declare `map` as a `TreeMap`, `map.firstEntry().setValue(2);` throws an exception.
comment on: http://stackoverflow.com/q/27216384
type: Comment

http://stackoverflow.com/q/27239567
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42955756
has comment: http://stackoverflow.com/comment/42955768
answer count: 0
has comment: http://stackoverflow.com/comment/42956056
tagged with: java
tagged with: swing
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42983603
linked to: http://stackoverflow.com/q/15756210
has body: I have been having trouble with getting my timer to show my bar graph updating itself over time instead, what I have is my graph being sorted automatically even though I set the timer to update every couple of seconds. Here are my paint and updatetextfieldthread method. private class Display extends JPanel { private Color color = Color.RED; public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.RED); Dimension d = getPreferredSize(); int clientWidth = d.width; int clientHeight = d.height; int barWidth = clientWidth / array.length; int x=0, y=0; int base=410; for(int i=0;i&lt;array.length;i++){ x+=30; y+=30; int linethickness=20; int linelength=50; g.setColor(Color.red); g.fillRect(x, base-linelength*array[i], linethickness , linelength*array[i]); g.setColor(Color.black); g.drawRect(x, base-linelength*array[i], linethickness, linelength*array[i]); } } } private class UpdateTextFieldThread extends SwingWorker&lt;Void, Integer&gt; { static final int THREAD_DELAY = 1000; protected Void doInBackground() { ExecutorService service = Executors.newSingleThreadExecutor(); try { Runnable r = new Runnable() { @Override public void run() { insertionSort(array); display.repaint(); } }; Future&lt;?&gt; f = service.submit(r); f.get(2, TimeUnit.MINUTES); } catch (final InterruptedException e) { // The thread was interrupted during sleep, wait or join } catch (final TimeoutException e) { // Took too long! } catch (final ExecutionException e) { // An exception from within the Runnable task } finally { service.shutdown(); } return null; } protected void process(java.util.List&lt;Integer&gt; list) { textfield.setText("" + list.get(list.size() - 1)); } } now revised: I'm breaking down my sorting method step by step and I am updating the thread inside of it but it is still not breaking down my graph. private class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == button1){ int[] array2=…
has title: Using a timer for my visually updating bar graph
tagged with: timer

http://stackoverflow.com/q/27266324
has title: Rendering multiple Images efficently
has answer: http://stackoverflow.com/a/27266416
answer count: 1
has body: I am prototyping a game where I need to render ~30 64x64 blocks to the Screen. Normally I do stuff like that with libgdx, but I want to use the native Java methods this time. For a sample test I load 10 blocks and render them - dropping my fps from around 300 to 35. The Laptop I have here is kinda bad, but I didn't expect him to break down so early. If you could just take a look at my code and give me possible hints about how to render more efficently - that would be great. I guess I didn't grasp the concept of the BufferedImage and Graphics 100% too. Btw, my specs are: * i5-2520M CPU @2.5GHZ (getting around 30% load while Debugging) * 4GB Ram * NO Gpu -----------------CODE---------------------------------------- The Graphics and Image declarations: public BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); public Graphics2D g; The Loop while (running) { long now = System.nanoTime(); unprocessed += (now - lastTime) / nsPerTick; GraphicUtil.setDelta(now - lastTime); lastTime = now; boolean shouldRender = true; while (unprocessed &gt;= 1) { ticks++; gameTick(); unprocessed -= 1; shouldRender = true; } if (shouldRender) { frames++; input.tick(); render(); } if (System.currentTimeMillis() - lastTimer1 &gt; 1000) { lastTimer1 += 1000; System.out.println(ticks + " ticks, " + frames + " fps"); frames = 0; ticks = 0; } } The render()-method in my main Loop public void render() { BufferStrategy bs = getBufferStrategy(); if(bs == null) { createBufferStrategy(2); return; } switch(currentScreenId) { case Screen.MENUSCREENID : menuScreen.handleInput(); menuScreen.render(); break; case Screen.HOWTOSCREENID : howToScreen.handleInput(); howToScreen.render(); break; case Screen.GAMESCREENID : gameScreen.handleInput(); gameScreen.render(); break; } Graphics g2 = bs.getDrawGraphics(); g2.drawImage(GraphicUtil.toCompatibleImage(image), 0, 0, getWidth(), getHeight(), null); g2.dispose(); // bs.show(); } The render()-Method in my gameScreen public void ren…
score: 0
type: UnansweredQuestion
tagged with: bufferedimage
type: Question
tagged with: graphics
tagged with: java
tagged with: render
tagged with: image

http://stackoverflow.com/a/27196327
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27196080
downvote count: 0
answers question: http://stackoverflow.com/q/27196080
type: Answer
has body: Something like this? TreeMap&lt;String, List&lt;String&gt;&gt; treeMap3 = new TreeMap&lt;&gt;(treeMap1); for (String k : treeMap3.keySet()) { if (treeMap2.containsKey(k)) { treeMap3.get(k).addAll(treeMap2.get(k)); } } return treeMap3;
score: 2

http://stackoverflow.com/comment/42903766
score: 0
type: Comment
has text: Actually, I use try/catch blocks at all levels. I posted some more code in the EDIT part. About the lock part, I'm just a newbie to Hibernate and I think I implemented it the wrong way. I thought that, because the `buildLockRequest` comes always before the commit transaction, it actually lock the entity BEFORE doing stuff on it. Am I wrong? What is the right way? About the lock on insert operation, I thought that it was necessary because some values of entities have unique constraints: what happens, for example, if two different users try to register with the same email address or nickname?
comment on: http://stackoverflow.com/a/27207636
type: AnswerComment

http://stackoverflow.com/q/27303161
tagged with: jbpm
answer count: 1
has answer: http://stackoverflow.com/a/27328658
type: UnansweredQuestion
tagged with: java
type: Question
has title: jBPM 6.1 cannot resume process
has body: We can suspend a process instance like this : org.jbpm.process.instance.ProcessInstance processInstance = //...; processInstance.setState(STATE_SUSPENDED); and to resume it : kieSession.getWorkItemManager().completeWorkItem(processInstance.getId(), params); but it doesn't work! ... what is the problem? Thanks.
score: 0

http://stackoverflow.com/comment/42958972
has text: The code you posted is confusing. You state "And my SubDetailsActivity is as follows:", yet the code that follows is "class DetailsActivity..."
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27241207
type: Comment

http://stackoverflow.com/comment/42881267
has text: It's an infinite loop.
score: 0
comment on: http://stackoverflow.com/q/27198403
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43066979
score: 1
comment on: http://stackoverflow.com/q/27301697
has text: You can do this. Please post the code you tried and tell us where you are having an issue. Is your issue getting the screen size? Or is the issue with limiting the chars for `EditText`?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/69098068
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27229579
has text: you mean not implemented in standard java perhaps, but there definitely are libraries.

http://stackoverflow.com/q/27307490
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/43077815
has body: If i have 3 apples and 2 buckets I could organize them as follows: 1 apple in bucket A and 2 apples in bucket B 2 apples in bucket A and 1 apple in bucket B 3 apples in bucket A and 0 apples in bucket B 3 apples in bucket B and 0 apples in bucket A etc.. I am trying to cook up some kind of program that will generate such combinations for me when the number of apples can be any number and the number of buckets can also be any number. My gut tells me that there will be some recursion involved but, i can't even get started. Can someone point me in the right direction?
tagged with: combinations
has comment: http://stackoverflow.com/comment/43077275
tagged with: java
has comment: http://stackoverflow.com/comment/43103689
has answer: http://stackoverflow.com/a/27308204
tagged with: optimization
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27307841
type: UnansweredQuestion
favorite count: 0
type: Question
has title: Code to generate all possible combinations

http://stackoverflow.com/q/27242689
has answer: http://stackoverflow.com/a/27242974
tagged with: android
has comment: http://stackoverflow.com/comment/42961379
has comment: http://stackoverflow.com/comment/42961263
has comment: http://stackoverflow.com/comment/42962002
favorite count: 0
has title: EditText does not take the value if entered a float value
possible better answer: http://stackoverflow.com/a/27242754
upvote count: 1
has answer: http://stackoverflow.com/a/27242754
downvote count: 1
accepted answer: http://stackoverflow.com/a/27242974
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42961298
has body: Here's my code if(numberbyUser.getText().toString().equals("")) { //Toast.makeText(getApplicationContext(), "Please Enter a Number", Toast.LENGTH_SHORT).show(); message = "Please Enter a Number !!"; DialogFunction(); } If I enter a value for eg: 1.5 code goes into the above loop. But for values which are not decimal code just works fine. Can somebody please tell me whats going wrong?
has answer: http://stackoverflow.com/a/27243393
score: 0
answer count: 3

http://stackoverflow.com/comment/43150836
type: AnswerComment
comment on: http://stackoverflow.com/a/27301256
type: Comment
has text: Did you figure out the issue? I cant believe this configuration has any issue even after creating a file.
score: 0

http://stackoverflow.com/a/27211173
has comment: http://stackoverflow.com/comment/69216065
type: Answer
has comment: http://stackoverflow.com/comment/77975732
has comment: http://stackoverflow.com/comment/77975773
accepted answer of: http://stackoverflow.com/q/27211012
has comment: http://stackoverflow.com/comment/42903555
has comment: http://stackoverflow.com/comment/42903541
has comment: http://stackoverflow.com/comment/61119597
has comment: http://stackoverflow.com/comment/100179985
answers question: http://stackoverflow.com/q/27211012
has comment: http://stackoverflow.com/comment/42903642
has body: There are two different Jersey major versions, 1.x and 2.x, You seems to be trying to use a combination of both, which won't work. The 2.x versions don't have some classes as in 1.x and vice versa. If you want to use Jersey 2.x, then you should be using Response, rather than ClientResponse Response response = target.request().put(Entity.json(friend)); // .json == automatic 'application/json' See Working with the Client API for 2.x Also as mentioned in your previous post, the getters and setters should be public for the Friend class Also see the WebTarget API Basic breakdown. Calling request() on WebTarget returns an Invocation.Buidler Invocation.Builder builder = target.request(); Once we call put, we get back a Response Response response = builder.put(Entity.json(friend)); To extract a known type from the response, we could use readEntity(Class type) String responseString = response.readEntity(String.class); response.close();
upvote count: 53
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/132099972
downvote count: 0
score: 53
has comment: http://stackoverflow.com/comment/42903583

http://stackoverflow.com/q/27209154
has body: I am trying to write a java project. I have problem in Slope method! I am using a tester given by our instructor to run and test my code. When I run the program, the result says the expected output is 1.5, but I get -1.5. I can't figure out where I am doing wrong. Thank you in advance! //Segment.java public class Segment implements SegmentInterface { // two Points that hold endpoints of the segment private Point p1; private Point p2; // Default constructor that will set the endpoints to new // Points with values (0,0) and (4,4) public Segment() { //this(0, 0, 4, 4); this.p1 = new Point(0, 0); this.p2 = new Point(4, 4); } // Parameterized constructor that accepts (int x1, int y1, int x2, int y2) // and creates and sets the endpoints public Segment(int x1, int y1, int x2, int y2) { //this.p1 = new Point(x1, y1); //this.p2 = new Point(x2, y2); if(x1 == x2 &amp;&amp; y1 == y2){ throw new IllegalArgumentException("Points can't have a lenght of 0!"); } else{ this.p1 = new Point(x1, y1); this.p2 = new Point(x2, y2); } } //A parameterized constructor that accepts (Point p1, Point p2) and sets both //the endpoints to a deep copy of the Points that are passed in. //Make sure to check to see if both Points are equal. This would be a //theoretical "Segment" of length 0 which is not allowed, so throw a new //IllegalArgumentException. public Segment(Point p1, Point p2) { this.p1 = new Point(p1.getX(), p1.getY()); this.p2 = new Point(p2.getX(), p2.getY()); if(p1.equals(p2)){ throw new IllegalArgumentException("Points cannot have same values!"); } } // Copy constructor that accepts a Segment and initializes the data (of the // new Segment being created) to be the same as the Segment that was // received. public Segment(Segment other) { this(other.p1, other.p2); //if(other.p1 == other.p2){ //throw new IllegalArgumentException("Undefine!"); //} } /* * The slope method returns the slope of the Segment as a double. If the segment * is vertical, the slope is undefined. In that case, Jav…
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27209170
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42900381
score: 0
has title: Why am I getting negative sign for my java slope method?

http://stackoverflow.com/q/27234519
has comment: http://stackoverflow.com/comment/42945675
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42946254
has body: Need to achieve this JSON format of output as below using JAVA [['2008-09-30 4:00PM',4], ['2008-10-30 4:00PM',6.5], ['2008-11-30 4:00PM',5.7], ['2008-12-30 4:00PM',9], ['2009-01-30 4:00PM',8.2]] Cant use a list as the internal elements belong to string and integers (generics doesnt allow that). Tried JsonObject of Gson also, it creates a map rather than a List. http://jsfiddle.net/6heredzz/3/ Please help
has comment: http://stackoverflow.com/comment/42946956
has comment: http://stackoverflow.com/comment/42946924
has comment: http://stackoverflow.com/comment/42946864
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42946163
has comment: http://stackoverflow.com/comment/42946752
favorite count: 0
has comment: http://stackoverflow.com/comment/42947007
has comment: http://stackoverflow.com/comment/42946789
has comment: http://stackoverflow.com/comment/42946964
score: -3
has comment: http://stackoverflow.com/comment/42946764
has answer: http://stackoverflow.com/a/27235391
has comment: http://stackoverflow.com/comment/42946881
has title: convert JSON format to Java format
has comment: http://stackoverflow.com/comment/42946791
has comment: http://stackoverflow.com/comment/42947123
has comment: http://stackoverflow.com/comment/42946321
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42945751
has comment: http://stackoverflow.com/comment/42946484
has comment: http://stackoverflow.com/comment/42946832
downvote count: 3
has comment: http://stackoverflow.com/comment/42946444
has comment: http://stackoverflow.com/comment/42946545
has comment: http://stackoverflow.com/comment/42946137
has comment: http://stackoverflow.com/comment/42946992
has comment: http://stackoverflow.com/comment/42946829
has comment: http://stackoverflow.com/comment/42946405
has comment: http://stackoverflow.com/comment/42945647
has comment: http://stackoverflow.com/comment/42946696
has comment: http://stackoverflow.com/comment/42946370
type: Question
has comment: http://stackoverflow.com/comment/42946639
accepted answer: http://stackoverflow.com/a/27235391
has comment: http://stackoverflow.com/comment/42945601

http://stackoverflow.com/comment/42833062
comment on: http://stackoverflow.com/q/27171185
type: Comment
score: 0
has text: yes. Search for Process/ProcessBuilder on google and modify accordingly.
type: QuestionComment

http://stackoverflow.com/comment/42843408
type: Comment
comment on: http://stackoverflow.com/a/27177207
has text: Your the genius. You solved my big issue and valuable time. Thanx again and again. Have a nice day :) .
type: AnswerComment
score: 0

http://stackoverflow.com/a/27237852
answers question: http://stackoverflow.com/q/27237777
has comment: http://stackoverflow.com/comment/42952518
score: 0
has comment: http://stackoverflow.com/comment/42952469
has comment: http://stackoverflow.com/comment/42952441
type: Answer
has body: Try something like this: public static void main(String[] args) throws ParseException { DateFormat df = new SimpleDateFormat("MM-dd-yyyy"); //your format here Date date = df.parse("11-3-1985"); System.out.println("" + date); } This will parse a date in the given format. You can also create another DateFormat for formatting the date when you print if if you want a different format example: public static void main(String[] args) throws ParseException { DateFormat df = new SimpleDateFormat("MM-dd-yyyy"); //your format here DateFormat df1 = new SimpleDateFormat("MM/dd/yyyy"); Date date = df.parse("11-3-1985"); System.out.println("" + df1.format(date)); } This is just an example you can use whatever format you want...if you only want to give hours and seconds do that.

http://stackoverflow.com/q/27258964
answer count: 6
has answer: http://stackoverflow.com/a/27259011
score: 0
has body: Hey I have searched through stackoverflow and can't seem to find an answer. I need to check if the typed password only contains letters and numbers. here's the code System.out.println("Type the Password for the new user: "); String password = input.nextLine(); if (!password.matches("[^A-Za-z0-9]")) { System.out.println("The password must only contain letters and/or numbers"); showAddUser(); }else{ System.out.println("The password is valid"); What am I doing wrong ? Help appreciated :)
has title: regular expression java password
has answer: http://stackoverflow.com/a/27259063
possible better answer: http://stackoverflow.com/a/27259010
has answer: http://stackoverflow.com/a/27259004
has answer: http://stackoverflow.com/a/27259010
accepted answer: http://stackoverflow.com/a/27259011
has answer: http://stackoverflow.com/a/27259191
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27259203
type: Question
tagged with: passwords
tagged with: expression
tagged with: java

http://stackoverflow.com/comment/42977653
comment on: http://stackoverflow.com/q/27251677
type: Comment
has text: Check #2 here http://www.mkyong.com/webservices/jax-rs/jax-rs-pathparam-example/ Basically try to return a jersey Response, rather than String If you put a breakpoint @ return "testok"; does it enter ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43026432
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27244466
has text: @jewelsea post1: What JDK did you use for your test application? I'm using idk 8_u25 and just realized that maybe Oracle increased the security once again without telling anyone about what they changed...

http://stackoverflow.com/comment/43091491
comment on: http://stackoverflow.com/a/27248935
score: 0
type: AnswerComment
type: Comment
has text: actually I tried against more tasks again I got the RejectionExecutionException - looking at your fix it calls scheduledFuture in afterExecute as soon as isShutdown is set, but this could be set before all tasks have been started, surely it should only be called once every task that was submitted to the executor has been started ?

http://stackoverflow.com/comment/45348522
type: QuestionComment
score: 1
has text: It actually works, the reason was one of the outside variables wasn't serializable so it couldn't serialize the lambda.
comment on: http://stackoverflow.com/q/27221035
type: Comment

http://stackoverflow.com/comment/42809938
has text: I tested your fix this indeed fixes this issue.
comment on: http://stackoverflow.com/a/27157863
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27197331
upvote count: 4
has comment: http://stackoverflow.com/comment/42879479
answers question: http://stackoverflow.com/q/27197311
type: Answer
has comment: http://stackoverflow.com/comment/42879518
downvote count: 1
has body: When working with 2d arrays, drink rc cola, or play with an rc toy. It'll help you remember Row then Column. You need to fix your second array so that it adds up to the numbers you want. Like this: for (int i = 0; i &lt; 3; i++) { for (int j = 1; j &lt;= 3; j++) { System.out.print((3*i)+j); System.out.print(" "); } System.out.println(); }
score: 3

http://stackoverflow.com/q/27249637
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27249851
has answer: http://stackoverflow.com/a/27249891
has title: Convert int to byte array BufferOverflowException
answer count: 3
possible better answer: http://stackoverflow.com/a/27249789
downvote count: 0
has answer: http://stackoverflow.com/a/27249789
favorite count: 0
has answer: http://stackoverflow.com/a/27249851
tagged with: android
has body: I need to convert my Integer value into byte array. In order not to create ByteBuffer again and again at every call for my intToBytes method I defined a static ByteBuffer. private static ByteBuffer intBuffer = ByteBuffer.allocate(Integer.SIZE / Byte.SIZE); public static byte[] intToBytes(int Value) { intBuffer.order(ByteOrder.LITTLE_ENDIAN); intBuffer.putInt(Value); return intBuffer.array(); } I get BufferOverflowException when I run intToBytes method. W/System.err﹕ java.nio.BufferOverflowException W/System.err﹕ at java.nio.ByteArrayBuffer.putInt(ByteArrayBuffer.java:352) W/System.err﹕ at android.mobile.historian.Data.Convert.intToBytes(Convert.java:136) In debug mode I see that capacity of the intBuffer is 4 as I expected for my Integer value. So what is wrong here?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42973752

http://stackoverflow.com/q/27264802
downvote count: 0
has answer: http://stackoverflow.com/a/27265689
accepted answer: http://stackoverflow.com/a/27265689
tagged with: randomaccessfile
favorite count: 0
possible better answer: http://stackoverflow.com/a/27265226
upvote count: 1
has title: Bit shifting a RandomAccessFile
type: AnsweredQuestion
has body: I need to bit shift everything in a RandomAccessFile that is to the right of the file-pointer four bytes to the right so that I can write an integer into it at the file pointer. This will not compile: raf &gt;&gt; 16; I was going to use readFully() (which reads bytes from the RAF starting at the pointer) and then go from there, but that reads them into an array and a restriction of the project is that we can't use arrays. How would I go about doing this?
tagged with: bit-shift
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43001664
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27265226
has comment: http://stackoverflow.com/comment/43001613

http://stackoverflow.com/comment/43028481
has text: Now I got `java.lang.NoSuchFieldException: linkProperties` and I bet I'll get more. I can't find the right replacement for this in Android L code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27258892

http://stackoverflow.com/comment/43019769
comment on: http://stackoverflow.com/a/27274259
score: 0
type: AnswerComment
has text: Thanks so much for the explanation and suggestion. I have tried this and it outputs me "Expecting object: line 1 column 40 (char 39)". Is this because it does not read the entire json?
type: Comment

http://stackoverflow.com/a/29053442
downvote count: 0
upvote count: 2
has body: Use Tomcat 7.0.21 some tomcat version giving this error, I have also faced the same issue with version 7.0.59 .
type: Answer
answers question: http://stackoverflow.com/q/27258336
score: 2

http://stackoverflow.com/q/27219932
has answer: http://stackoverflow.com/a/27220015
tagged with: android
has body: hey i am new to android development. i tried exporting my app the process failed because of some minor errors and then i got errors all over my code. it was working perfectly fine with no errors before attempting to export. check these two pics of the xml files where the errors popped up main activity file: http://postimg.org/image/4gwdipnap/ second activity file: http://postimg.org/image/vuy1ryba3/ I didn't have any of these errors before trying to export the project. heres the code for both of the files main activity page package youngadults.camden; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.View.OnClickListener; public class FrontPage extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.front_page); findViewById(R.id.uyounadults).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(FrontPage.this, youngadultsp.class); myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(myIntent); } }); } } second activity page package youngadults.camden; import android.app.Activity; import android.os.Bundle; public class youngadultsp extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.youngadultsp_1); } }
score: 0
tagged with: java
answer count: 1
tagged with: import
has comment: http://stackoverflow.com/comment/42919617
tagged with: overriding
has title: tried exporting my app the process failed and ended up giving me errors in my code
type: UnansweredQuestion
tagged with: export
type: Question

http://stackoverflow.com/q/27186235
tagged with: tiled
has answer: http://stackoverflow.com/a/27192597
answer count: 1
has title: Highlighting a tile with transparency
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27192597
score: 0
tagged with: java
type: Question
has body: I am making turn based strategy based on a tiled map. My map contains two layers - first one is visible all the time and is used as a background, the second one is used for highlighting the tiles. Highlighted tiles shows possible movement for the player. For now the progress looks like this: My border boxes pic To make a highlighting possible I use this for loop: for(int s = 0;s&lt;7;){ for (int i = 0;i&lt;7;i++) { if ((inField(clickx + i,clicky + s)) &amp;&amp; !(tileWithPlayer(clickx + i,clicky + s))) { highlight_layer.getCell(clickx + i, clicky+s).setTile(mark); } } s++; } In this I use one tile from second layer of the map to make a border for a specific tiles. For now this tile is only 2px border of 32x32 transparent tile. To make highlighting disappear, I use similar for loop, where I set the tile to null. Selecting/deselecting tiles works great, but it is probably not the most efficient way to do this. I would like to exchange the blue border boxes into colored transparent boxes, something like in Advance wars during the movement, or as it can be seen below: Desired look pic I tried to make a semi transparent tile on the second layer in tiled, but without luck. It could be nice if there is some possibility to apply only semi-transparent color on the specific tiles, without using the second layer tile. So, my question is - how can I exchange those ugly borders, into fully colored, (semi)transparent tiles, to achieve similar result as in above picture?
tagged with: libgdx

http://stackoverflow.com/comment/42855018
comment on: http://stackoverflow.com/a/27183460
has text: Remove the Catch exception and run the script. You will get the same error message . can you give me the complete error message from there?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27256894
accepted answer: http://stackoverflow.com/a/27257148
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27256991
score: 0
answer count: 2
tagged with: generics
tagged with: inheritance
has body: I have the following code snippet which returns a type mismatch error: @SuppressWarnings("rawtypes") public Map&lt;String, Class&lt;? extends SomeClass.SuperClass&gt;&gt; subClass() { return Collections.singletonMap("hello", SomeClass.SubClass.class); } The class declaration looks like the following: public class SomeClass { public static abstract class SuperClass { } public static class SubClass extends SuperClass{ } } This returns a type mismatch error, stating: Type mismatch: cannot convert from Map&lt;String,Class&lt;SubClass&gt;&gt; to Map&lt;String,Class&lt;? extends SuperClass&gt;&gt; Why is this occurring? Regardless of whether I use "? extends SuperClass" or just "SuperClass" in the parameterized return type of subClass(), I still see this same error. I've also tried just extending SomeClass instead but that hasn't worked either.
has title: Java extending class types
possible better answer: http://stackoverflow.com/a/27256991
tagged with: collections
has answer: http://stackoverflow.com/a/27257148

http://stackoverflow.com/comment/43056354
has text: A very minor point. It would likely only cost more performance at compile time because the compiler would probably inline it.
score: 1
comment on: http://stackoverflow.com/a/27295925
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27281102
has comment: http://stackoverflow.com/comment/43031904
tagged with: eclipse
has body: Yesterday all of my projects were working but today they are not. Also Eclipse doesn't show any errors on these projects. I plug my device and click run button it tries to run the project a few seconds then says there are errors and you should fix them. But It doesn't shows any errors. I tried to download Android 5.0 yesterday but cancelled it . Is this may caused this ? Does anyone knows how to fix it ? [2014-12-03 23:57:24 - Dex Loader] Unable to execute dex: Multiple dex files define android/support/annotation/AnimRes; [2014-12-03 23:57:24 - 17.11.2014] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes; I'm seeing these errors on log. Does anyone knows what does Dalvik format failed means ??
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27281241
has comment: http://stackoverflow.com/comment/43030952
has answer: http://stackoverflow.com/a/27283065
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/7870265
has comment: http://stackoverflow.com/comment/43061248
has title: Eclipse project is not running
tagged with: java
has comment: http://stackoverflow.com/comment/43031106
has comment: http://stackoverflow.com/comment/43034520
type: Question
has comment: http://stackoverflow.com/comment/43032868

http://stackoverflow.com/q/27267919
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43006829
has comment: http://stackoverflow.com/comment/43006847
type: Question
has body: I have below classes in the same package: class Roo { public String doRooThings() { return "Rooing!"; } } class Cloo extends Roo { public static void main(String[] args) { System.out.println(doRooThings()); } } I get Cannot make a static reference to the non-static method doRooThings() from the type Roo error upon executing this. But I can call the doRooThings() method (without having to preface it with a reference) from a public method in child class like below : class Cloo extends Roo { public void testRoo() { System.out.println(doRooThings()); } public static void main(String[] args) { new Cloo().testRoo(); } } Can anyone please let me know how this works?
has answer: http://stackoverflow.com/a/27268516
tagged with: inheritance
score: 0
has answer: http://stackoverflow.com/a/27267961
has answer: http://stackoverflow.com/a/27268204
possible better answer: http://stackoverflow.com/a/27267961
linked to: http://stackoverflow.com/q/413898
accepted answer: http://stackoverflow.com/a/27268516
has answer: http://stackoverflow.com/a/27267984
has title: Why can't I call an inherited public method without prefacing it with a reference from main method?
answer count: 4

http://stackoverflow.com/comment/42851206
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27181307
score: 1
has text: @BasilBourque The problem is, the prevailing accept or highly voted answers flood out any new content. I've seen this when trying to find answers for Objective C questions, which further increases the confusion to developers with little experience with the API or programming. Granted, this is a poor example of a question...

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/27220468

http://stackoverflow.com/a/27217250
score: 0
answers question: http://stackoverflow.com/q/27216192
type: Answer
has body: This is the answer I wanted. The following Regular expression matches the first part of any UK postcode to determine whether it is a London one. Obviously this is one of my first attempts at regular expressions but I've tested every borough public static void main(String[] args) throws IOException { String postcode = "BR1 1AA"; //Revised Pattern regex = Pattern.compile("(WC|EC|BR|CR|DA|EN|HA|IG|KT|RM|SM|TW|UB|WD|(E[1-9]|E1[1-9]|E20)" + "|(N[1-9]|N1[1-9]|N2[0-2])|(NW[1-9]|NW1[0-1])" + "|(SE[1-9]|SE1[1-9]|SE2[0-8])|(W[1-9]|W1[1-4])" + "|(SW[1-9]|SW1[1-9]|SW20))"); Matcher finder = regex.matcher(postcode); if (finder.find()) { try { String value = finder.group(0); System.out.println("This is London"); } catch (NumberFormatException e) { System.out.println(e.getMessage()); } } }

http://stackoverflow.com/comment/43048976
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27291515
type: Comment
has text: @Jesper: That was an option, yes. It's a shame that `TreeSet` doesn't accept both a collection *and* a comparator in the constructor, to be honest :(

http://stackoverflow.com/a/27282139
type: AcceptedAnswer
has body: Since we are using Java I will try to solve this with Object Oriented way. We can calculate the waiting time as waitingTime[i] = serviceTime - arrivalTime[i]; where serviceTime is actually current time. Here I created a Job class to hold each job information and method to sort by arrival time. public class Job implements Comparable&lt;Job&gt;{ private String id; private int arrivalTime; private int burstTime; //Getter and setters @Override public int compareTo(Job job) { int compareArrivalTime = ((Job) job).getArrivalTime(); return this.arrivalTime - compareArrivalTime; } } Then main method with all related other methods. public static void main(String[] args) { List&lt;Job&gt; jobList = generateDummyJobs(); Collections.sort(jobList); printJobs(jobList); calculateWaitTime(jobList); } private static List&lt;Job&gt; generateDummyJobs() { List&lt;Job&gt; jobList = new ArrayList&lt;Job&gt;(); Job job1 = new Job("P1", 3, 5); Job job2 = new Job("P2", 1, 6); Job job3 = new Job("P3", 5, 2); jobList.add(job1); jobList.add(job2); jobList.add(job3); return jobList; } private static void printJobs(List&lt;Job&gt; jobList) { for(Job job :jobList) { System.out.println("[" + job.getId() + ", " + job.getArrivalTime() + ", " + job.getBurstTime() + "]" ); } } private static void calculateWaitTime(List&lt;Job&gt; jobList) { int serviceTime = 1; for(Job job :jobList) { System.out.println(job.getId() + ": " + (serviceTime - job.getArrivalTime())); serviceTime += job.getBurstTime(); } }
accepted answer of: http://stackoverflow.com/q/27280729
type: Answer
answers question: http://stackoverflow.com/q/27280729
score: 0

http://stackoverflow.com/comment/110712882
has text: Please don’t teach the young ones to use the long outdated and notoriously troublesome `SimpleDateFormat` class. At least not as the first option. And not without any reservation. Today we have so much better in [`java.time`, the modern Java date and time API,](https://docs.oracle.com/javase/tutorial/datetime/) and its `DateTimeFormatter`.
type: Comment
comment on: http://stackoverflow.com/a/62594232
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42872918
score: 0
has text: aren't you already getting names as shown..
comment on: http://stackoverflow.com/q/27193309
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43067458
comment on: http://stackoverflow.com/q/27301429
score: 0
has text: then why not set the other user null? They wouldn't be set in stone.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42855564
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27180988
has text: i think it`s different with fxml implementation
score: 0

http://stackoverflow.com/a/27549556
score: 1
has body: A week might be too long as SQS message retention itself is only 15 days. If you are okay with maximum retention of 15days, one idea is to keep the changing the visibility of a message every time you receive until it is ready for processing. The maximum allowed visibility timeout is 12 hours. More on visibility timeout and APIs for changing them, http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ChangeMessageVisibility.html http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html
downvote count: 1
has comment: http://stackoverflow.com/comment/123073516
answers question: http://stackoverflow.com/q/27226810
type: Answer
upvote count: 2

http://stackoverflow.com/q/27240231
type: Question
has comment: http://stackoverflow.com/comment/42957106
tagged with: java
has comment: http://stackoverflow.com/comment/42957574
has answer: http://stackoverflow.com/a/27240251
tagged with: command-line-interface
score: 0
answer count: 1
tagged with: backslash
has body: I want to run something similar to the following: java MyProgram C:\Path\To\My\File When I do this and output the contents of the first argument, it outputs: C:PathToMyFile This works, however: java MyProgram "C:\Path\To\My\File" But I want to be able to do the first command instead of the second. How can I achieve this?
has comment: http://stackoverflow.com/comment/42956985
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42959338
has title: Java command line argument containing backslash
has comment: http://stackoverflow.com/comment/42957092
has comment: http://stackoverflow.com/comment/42956961

http://stackoverflow.com/a/27195671
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/27194341
type: Answer
has body: You could use a try-catch block inside the while loop, and if you catch an exception just keep going to the next iteration. It is not the best solution but for you case it should work. String line; BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { while((line = read.readLine()) != null) { try { n = Integer.parseInt(line); //other stuff with n } catch (NumberFormatException e) { continue; // do nothing, and move on to the next line } } } catch (IOException e) {}
downvote count: 1

http://stackoverflow.com/comment/43048468
type: AnswerComment
has text: But I am starting to write data from 2nd col and 1st cell. then why its creating issue?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27291312

http://stackoverflow.com/comment/43029070
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27279762
type: AnswerComment
has text: I hope you didn't mind. I copy pasted that from your account's `about` panel ;)

http://stackoverflow.com/q/27170001
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42930074
score: 2
has comment: http://stackoverflow.com/comment/43257828
upvote count: 2
tagged with: http
tagged with: https
type: Question
has title: Java applet not loading on Java8/HTTPS
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/27409086
has body: I hava Java applet which will not run when using HTTPS. All works fine when testing on localhost. Also everything is working using a test server using only HTTP. In production mode where server is using only HTTPS this issue raises. The one thing that caught my attention was this: "http://www.example.com:443/ with proxy=DIRECT" Why is the connection attempted to establish to http instead of https? http + port 443 seems not quite right there... Anyone has idea how can I perhaps modify that? Would be pleased if anyone could point me to right direction with my problem. Console output: Java Plug-in 11.25.2.18 Using JRE version 1.8.0_25-b18 Java HotSpot(TM) Client VM User home directory = D:\Users\example ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to &lt;n&gt; ---------------------------------------------------- basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@1fbe203 security: Expected Main URL: https://www.example.com/example/applet/example-uploadapplet.jar basic: Plugin2ClassLoader.addURL parent called for https://www.example.com/example/applet/example-uploadapplet.jar basic: Plugin2ClassLoader.addURL parent called for https://www.example.com/example/applet/edtftpj-2.1.0.jar network: Connecting https://www.example.com/example/applet/example-uploadapplet.jar with proxy=DIRECT network: Connecting http://www.example.com:443/ with proxy=DIRECT javax.net.ssl.SSLException: Received fatal alert: protocol_version at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source) at sun…

http://stackoverflow.com/a/41282884
upvote count: 1
score: 1
has body: I don't know if this is what you meant or not, but here is my code for my database. First here is my database structure: *Root of Database :Users : :....username1 : : : :......"Name":"value" : :......"Email":"value" : :......"Password":"value" : :....username2 : : : :......"Name":"value" : :......"Email":"value" : :......"Password":"value" Here is my code for retrieve the data from database: FirebaseDatabase database= FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference().child("Users"); login=myRef.child(name); //here user will sign in using his name so it is based on user, directory will change dynamically ValueEventListener listener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { User user = dataSnapshot.getValue(User.class); String demo=user.Email; //email fetched from database } @Override public void onCancelled(DatabaseError databaseError) { } }; login.addValueEventListener(listener); Here the User.java class contains 3 String values of email,password &amp; name. public class User { public String Name; public String Email; public String Password; public User() { // Default constructor required for calls to DataSnapshot.getValue(User.class) } public User(String name,String pass, String email) { this.Name = name; this.Email = email; this.Password = pass; } }
downvote count: 0
answers question: http://stackoverflow.com/q/27187725
type: Answer

http://stackoverflow.com/comment/106902570
score: 0
type: AnswerComment
has text: Thanks gentleman your code helps me. I have to sort Alphanumeric Strings like ABC2, ABC3, ABC1 output is as expected. ABC1, ABC2, ABC3
type: Comment
comment on: http://stackoverflow.com/a/27170019

http://stackoverflow.com/comment/43259024
type: QuestionComment
has text: Keep in mind you can also still use Tomcat, via the `webapp-runner` project. See https://github.com/jsimone/webapp-runner. Probably the biggest lift in porting to Heroku, which applies to both Tomcat and Jetty, is configuration for "containerless" deployment and ensuring that your app scales properly (e.g., Redis or Memcache for session storage, since there is no session affinity or session replication in Heroku.
score: 0
comment on: http://stackoverflow.com/q/27211070
type: Comment

http://stackoverflow.com/comment/42907298
score: 0
has text: `NullpointerException` at `WordCount.main(WordCount.java:74)`. Please share the MapReduce code to find the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27201505

http://stackoverflow.com/comment/43010445
type: Comment
has text: Well, if you want to take the pixel data and convert that to grayscale, then you only need to read the image and extract the pixel data. Of course to save it again, you will need to apply the pixel data to another `BufferedImage` and save that. Based on your previous comment, I don't think you the `ColorConvertOp`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27265983

http://stackoverflow.com/comment/42934669
comment on: http://stackoverflow.com/q/27192287
has text: @JohnAment: I'm using Jackson. The error is something like: (Exception) Caused by: ...jackson.map.JsonMappingException: Can not construct instance of ...Registration, problem: abstract types can only be instantiated with additional type information. (Thank you!) ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27302093
upvote count: 1
has body: It is likely that fyp_project.main_fypproject() is a long running/blocking call, which when called from within the context of the Event Dispatching Thread, will stop it from been able to process new events, including the repaint request. Consider using something like a SwingWorker, opening the dialog first, execute the worker and when it's done method is called, close the dialog Take a look at Concurrency in Swing and Worker Threads and SwingWorker for more details
score: 1
answers question: http://stackoverflow.com/q/27301827
downvote count: 0
type: Answer

http://stackoverflow.com/q/27256604
has comment: http://stackoverflow.com/comment/42986962
upvote count: 2
tagged with: java
type: Question
tagged with: debugging
has title: Eclipse: Is it Possbile to Set Breakpoint on a Whole Module
tagged with: eclipse
has body: I have the following 2 questions regarding Eclipse debugger: The application that I work on consists of a large number of Maven modules. Is it possible to set a break point on a whole module? I often have to work on applications that I have no prior knowledge of, and thus don't know where to put a breakpoint. Is there a good place to set a break point in such apps to stop the debugger? Then I can just use the step debugger to trace and see what the code is doing. Thanks
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42987553
has answer: http://stackoverflow.com/a/33556202
type: UnansweredQuestion

http://stackoverflow.com/a/27204901
has comment: http://stackoverflow.com/comment/42892346
score: 0
type: Answer
has body: Try: for (int i =0; i&lt;10; i++) { System.out.println("* * * * *"); System.out.println(" * * * *"); }
answers question: http://stackoverflow.com/q/27204880
has comment: http://stackoverflow.com/comment/42892405

http://stackoverflow.com/comment/43002020
has text: Damn dude! Wonder why didn't I thought of it first :P! Great solution thanks
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27247691
type: AnswerComment

http://stackoverflow.com/comment/42872135
type: Comment
comment on: http://stackoverflow.com/a/27192886
has text: I am not very much sure about it but will have a read. Its good to know.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27284046
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
tagged with: jersey
linked to: http://stackoverflow.com/q/23647765
answer count: 1
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
has title: How to create RESTful web service client by Jersey2.0 or above
favorite count: 0
has answer: http://stackoverflow.com/a/27285588
accepted answer: http://stackoverflow.com/a/27285588
tagged with: rest
upvote count: 3
has body: There seems to be many examples about creating RESTful clients by Jersey 1.x, but not Jersey 2.0 or above. I referred to other questions and the Jersey's web site, but I still cannot create a client for REST due to the differences between Jersey 2.0 and the previous one. So I'd like to ask some advice. So far, my coding is like this. ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); WebTarget target = client.target("http://localhost:8080/CustomerBack2211/webresources/entities.customer"); Invocation.Builder invocationBuilder = target.request(MediaType.TEXT_XML_TYPE); Response response = invocationBuilder.get(); System.out.println(response.getStatus()); System.out.println(response.readEntity(String.class)); This produces 406 error. However, when I tried to test RESTful service by Glassfish server, the test works properly, and the server side class has its @GET methods having @Produces({"application/xml", "application/json"}). So I don't see why the coding above produces 406 error on a Java application. (i.e. the client side has @GET methods in the following way) @GET @Path("{id}") @Produces({"application/xml", "application/json"}) public Customer find(@PathParam("id") Integer id) { return super.find(id); } @GET @Override @Produces({ "application/xml"}) public List&lt;Customer&gt; findAll() { return super.findAll(); } Does any of you see what I'm doing wrong, or could you please suggest an example of a RESTful client? Any advice will be helpful...thanks in advance! In addition, I'd appreciate if you would offer information about how to invoke methods like GET, PUT and DELETE with appropriate parameters. I just needed to put an ID number (i.e. integer values) when I was testing the server side class on Glassfish RESTful test. However, it seems that I need to set "Class" and/or "Entity" values as arguments, but I cannot see any information associated with them on the Jersey website.

http://stackoverflow.com/comment/43010179
score: 0
type: AnswerComment
has text: May be you need executable jar. You can export one from eclipse. Then you start it with java -jar executable.jar
type: Comment
comment on: http://stackoverflow.com/a/27252374

http://stackoverflow.com/q/27312693
has body: I want to clarify about this: Regarding Autowiring "autodetect" In some resources, I found if "Default constructor is found, then "auto wiring constructor" applies. If not "auto wiring by type" applies. And in some resources, I found if "Default constructor is found, then "auto wiring by type" applies. If not "auto wiring constructor" applies. can anyone confirm which is the right one? confused with this.
possible better answer: http://stackoverflow.com/a/27313202
has comment: http://stackoverflow.com/comment/43086753
has comment: http://stackoverflow.com/comment/43085854
linked to: http://stackoverflow.com/q/3153546
tagged with: java
tagged with: autowired
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/43086517
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27313202
has title: Spring Autowiring autodetect
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/43085881
downvote count: 0
accepted answer: http://stackoverflow.com/a/27313123
favorite count: 0
has answer: http://stackoverflow.com/a/27313123
tagged with: spring

http://stackoverflow.com/a/27233829
has comment: http://stackoverflow.com/comment/43077637
answers question: http://stackoverflow.com/q/27232366
has comment: http://stackoverflow.com/comment/43084973
type: Answer
score: 0
has body: import java.io.*; public class AddtoFile { public void main(String arg[]) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try { FileWriter fw=new FileWriter("Student.txt",true); for(int i=0;i&lt;5;i++) { System.out.println("Enter Phone numbers"); String phone=br.readLine(); phone=phone+"\n"; fw.write(phone); } fw.close(); }catch(Exception e){System.out.println(e);} } } This should work fine. Reference Link: http://learn2geek.com/file-handling-java/

http://stackoverflow.com/comment/43351045
has text: Thanks, for the flashlight, it finally worked. As you told me, I put mysql module reference in jgroups module, and in the configuration I use the driver class. Thanks again
comment on: http://stackoverflow.com/a/27285576
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43020142
score: 0
has text: Have your tried regular expressions?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27275460

http://stackoverflow.com/comment/43012825
score: 0
has text: I doubt this has anything to do with Java. Or do you mean to say that you can kill other processes this way with no problem?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27271506

http://stackoverflow.com/comment/42844874
comment on: http://stackoverflow.com/q/27162013
score: 0
type: QuestionComment
has text: Anybody that can help...?
type: Comment

http://stackoverflow.com/a/27192819
downvote count: 0
type: AcceptedAnswer
type: Answer
has body: Turns out I was never actually adding the childGroup. if (!childData.isEmpty()) childData.add(childGroupCurrent); Turned to: if (!childGroupCurrent.isEmpty()) childData.add(childGroupCurrent); Fixed it.
score: 1
answers question: http://stackoverflow.com/q/27189322
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27189322

http://stackoverflow.com/a/27177625
score: 0
has comment: http://stackoverflow.com/comment/42845663
type: Answer
has body: As you already discovered, or simply use cases the @Where clause is just fine, but in your case, you want to filter PlaceTag by the place and tag too, so a joined is required in this situation. So, you can keep the @Where clause for Place and Tag, while for PlaceTags you need to use a JPQL query: select pt from PlaceTag pt join pt.tag t join pt.place p where t.state='ACTIVE' and p.state='ACTIVE' At least until @WhereJoinTable annotation is made to work for many-to-one associations too.
has comment: http://stackoverflow.com/comment/42844201
has comment: http://stackoverflow.com/comment/42846805
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42844433
has comment: http://stackoverflow.com/comment/42846661
has comment: http://stackoverflow.com/comment/51284205
has comment: http://stackoverflow.com/comment/42844865
answers question: http://stackoverflow.com/q/27175845
has comment: http://stackoverflow.com/comment/42847334

http://stackoverflow.com/a/27211822
has comment: http://stackoverflow.com/comment/43976208
type: Answer
has body: The name a of the local variable is only meta information. At runtime, this information is index-dependent. For a non-static method, the local variables would be stored in an array containing the references: ------------ | 0 | 1 | ------------ | this | a | ------------ Accessing a is performed by performing the ALOAD_1 instruction. What you need to do is to parse the byte code for such an instruction and to repeat it, calling the hash code method it and print it.
score: 0
answers question: http://stackoverflow.com/q/27206781

http://stackoverflow.com/comment/43019449
comment on: http://stackoverflow.com/a/27275110
has text: i have two touch listners, how i can trigger a specific one?
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/27224390
score: 1
answers question: http://stackoverflow.com/q/27224316
downvote count: 0
has body: If you don't define type of ArrayList then it ll considered as Object type so you have two option : 1 : define inputList as String like ArrayList&lt;String&gt; inputList 2 : cast it like : String URLline = (String)inputList.get(i); If you don't specify a type, you're using the old non-generic version. This would basically be equivalent to: ArrayList&lt;Object&gt; inputList= new ArrayList&lt;Object&gt;();
type: Answer
upvote count: 1

http://stackoverflow.com/q/27295720
score: 13
has answer: http://stackoverflow.com/a/27297884
has answer: http://stackoverflow.com/a/38487310
upvote count: 13
linked to: http://stackoverflow.com/q/41314732
tagged with: java
has answer: http://stackoverflow.com/a/28207608
type: Question
tagged with: wildfly-8
has body: I am facing following problem. I have spent more than 3 days on this but cannot find a solution. Please guide me what I am doing wrong here. I am new to Resteasy with wildfly. Here is the stacktrace 19:05:57,610 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-14) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUser at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.8.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final] at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-…
has answer: http://stackoverflow.com/a/27297429
downvote count: 0
answer count: 7
tagged with: jax-rs
has answer: http://stackoverflow.com/a/60294151
favorite count: 0
tagged with: resteasy
has title: javax.ws.rs.NotFoundException: Could not find resource for full path with RESTEasy and Wildfly 8.1.0.Final
tagged with: rest
has answer: http://stackoverflow.com/a/32093889
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41169877

http://stackoverflow.com/comment/43025102
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27277953
has text: if it is the same number, then it is not greater @AngelAngel

http://stackoverflow.com/a/27289567
downvote count: 0
answers question: http://stackoverflow.com/q/27288091
type: Answer
upvote count: 1
score: 1
has body: Use interfaces, Luke. Define your own extensions or (better) wrappers for the swing components you use and provide common operations which you can also implement using the JavaFX. So you can implement common operation to make the parts of your GUI visible/invisible. Additionally you should group your components in logical parts and provide technology-independent sub-controllers/sub-models for these groups. The corresponding view should have a method to make itself (in)visible. For Swing: if you want to make a part of your GUI (view) invisible, you should use the CardLayout (one card with your components and another with a blank panel). The setVisible method can cause layout issues.

http://stackoverflow.com/comment/42892168
comment on: http://stackoverflow.com/q/27204792
score: 0
has text: `unsortedMap.keySet()`, the rest is trivial. What have you tried so far?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42925472
type: QuestionComment
has text: It is fast enough that it should not make a difference; have you tried?
comment on: http://stackoverflow.com/q/27223562
score: 0
type: Comment

http://stackoverflow.com/comment/42819799
score: 0
has text: As for the variable holding the immutable object, the variable must be declared final to be safe to use across different threads. Immutability ensures the object cannot change state, but just because an object is immutable does not mean the variable holding the object is safe to use across multiple threads. You should declate it final if possible, as immutable fields are always better than mutable ones, if allowed (check out the book Hardcore Java)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27163080

binary-tree
tags question: http://stackoverflow.com/q/27243437
tag name: binary-tree
tags question: http://stackoverflow.com/q/27309099
tags question: http://stackoverflow.com/q/27286813
tags question: http://stackoverflow.com/q/27213234
type: Tag
tags question: http://stackoverflow.com/q/27285428
tags question: http://stackoverflow.com/q/27212106
tags question: http://stackoverflow.com/q/27155596
tags question: http://stackoverflow.com/q/27219895
tags question: http://stackoverflow.com/q/27302826
tags question: http://stackoverflow.com/q/27179341
tags question: http://stackoverflow.com/q/27275587
tags question: http://stackoverflow.com/q/27256473
tags question: http://stackoverflow.com/q/27154985
tags question: http://stackoverflow.com/q/27262267

http://stackoverflow.com/q/27247451
has title: MyBatis - ResultHandler is not invoked
accepted answer: http://stackoverflow.com/a/27249714
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/44712029
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/44712029
type: Question
has answer: http://stackoverflow.com/a/27249714
tagged with: mybatis
has body: I followed this example : https://code.google.com/p/mybatis/wiki/ResultHandlerExample This is my interface: public interface CountryDirRdbMapper { public static class CountryDirBaseItemWithText { public CountryDirBaseItem baseItem; } public List&lt;CountryDirBaseItem&gt; select(ResultHandler handler); } This is my xml mapper &lt;resultMap id="readItemsRM" type="CountryDirRdbMapper$CountryDirBaseItemWithText"&gt; &lt;association property="baseItem" javaType="CountryDirBaseItem"&gt; &lt;id property="id" column="Id"/&gt; &lt;result property="comment" column="Comment"/&gt; &lt;/association&gt; &lt;/resultMap&gt; This code form my DAO: SqlSession session = MyBatisConnectionFactory.getSqlSessionFactory().openSession(true); List&lt;CountryDirBaseItem&gt; list; try{ CountryDirRdbMapper mapper = session.getMapper(CountryDirRdbMapper.class); class MyResultHandler implements ResultHandler { @Override public void handleResult(ResultContext context) { System.out.println("#########################"); } } MyResultHandler handler=new MyResultHandler(); list= mapper.select(handler); } finally { session.close(); } However the result handler is never invoked. At the example I follow people say that have the same problem. So how to make it work? Or result handler is not supported in mybatis 3?
answer count: 2
tagged with: sql
upvote count: 1
favorite count: 0

http://stackoverflow.com/a/27183158
upvote count: 1
has body: You could try to override in your DynamicImageResource configureResponse() or setResponseHeaders() and set the Content Type manually on the ResourceResponse using response.setContentType("yourContentType");
score: 1
answers question: http://stackoverflow.com/q/27177813
downvote count: 0
type: Answer

http://stackoverflow.com/q/27234928
has answer: http://stackoverflow.com/a/27235014
accepted answer: http://stackoverflow.com/a/27235014
type: AnsweredQuestion
tagged with: guava
has title: Cannot resolve generic parameter TypeToken from Guava
tagged with: java
linked to: http://stackoverflow.com/q/22271779
type: Question
score: 0
has body: I am developing a framework for building generified menus for a Selenium testing framework, and I've been using Guava TypeToken to resolve the types of generic parameters, but now I've run into a problem where the type token doesn't resolve a parameter: I have an abstract base class for a builder that generates a menu option: public abstract class AbstractMenuOptionBuilder&lt;O extends IClickable&gt; { protected final TypeToken&lt;AbstractMenuOptionBuilder&lt;O&gt;&gt; typeToken = new TypeToken&lt;AbstractMenuOptionBuilder&lt;O&gt;&gt;(getClass()) { }; public abstract O create(); } This is a concrete class for a builder: public class MenuOptionBuilder&lt;O extends IClickable&gt; extends AbstractMenuOptionBuilder&lt;O&gt; { public O create() { TypeToken&lt;?&gt; genericOptionParam = typeToken.resolveType(AbstractMenuOptionBuilder.class.getTypeParameters()[0]); Class&lt;O&gt; optionClass; try { optionClass = (Class&lt;O&gt;) Class.forName(genericOptionParam.getType().getTypeName()); &lt;.... snip ....&gt; } catch(ClassNotFoundException e) { log.catching(e); return null; } } } I have an abstract base class for menus which has a method to return a list of menu options: public abstract class AbstractMenu&lt;O extends IClickable&gt; { public final List&lt;O&gt; getOptions() { //This is where my plan doesn't work. The runtime type is given by //a concrete menu class which extends AbstractMenu, but that runtime //type doesn't seem to pass through to the abstract base class for the builder. MenuOptionBuilder&lt;O&gt; builder = new MenuOptionBuilder&lt;O&gt;(new MenuOptionBean()){}; &lt;.... snip ....&gt; } } And I have a concrete menu class that extends it: //The runtime type of 'Link' is not known by the type token that is supposed to //resolve it in the abstract builder base class. public SimpleMenu extends AbstractMenu&lt;Link&gt; { &lt;.... snip ....&gt; } I was expected that the variable genericOptionParam in MenuOptionBuilder would resolve to Link, but it doesn't Inste…
answer count: 1
tagged with: generics
linked to: http://stackoverflow.com/q/20773850

http://stackoverflow.com/q/27246047
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/27246461
has answer: http://stackoverflow.com/a/27246461
type: Question
has answer: http://stackoverflow.com/a/27246541
has title: Fatal Error - Content is not allowed in prolog
accepted answer: http://stackoverflow.com/a/27246541
answer count: 2
has comment: http://stackoverflow.com/comment/42967521
has comment: http://stackoverflow.com/comment/42967749
downvote count: 0
favorite count: 0
tagged with: domdocument
has body: Similar to this question, but unfortunately didn't help I am trying to parse a String to XML in Java and keep getting the error: [Fatal Error] output.txt:1:1: Content is not allowed in prolog. I know it must be something to do with my XML string, because I ran a test with very basic XML and the error dissappeared. XML <?xml version="1.0" encoding="UTF-8"?> <?xfa generator="ff99v250_01" APIVersion="1.4.3139.0"?> <jfxpf:XPF xmlns:jfxpf="http://www.xfa.com/schema/xml-package"> <jfxpf:Package> <jfxpf:Resource Location="GenReq"> <jfxpf:Link ContentType="application/x-jetform-cft" /> </jfxpf:Resource> <jfxpf:Resource Location="default.xml"> <jfxpf:Content ContentType="text/xml" Location="default.xml"> <xfa:Data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <xfa:DataGroup> <?jetform ^Dat ^page 1?> <FR_NAME>Administrator</FR_NAME> <JFWF_DELEGATE /> <ADHOC_DLN_ACTOR /> <ADHOC_DLN_MSG /> <ADHOC_DLN_TIME /> <ADHOC_DLN_UNITS>Days</ADHOC_DLN_UNITS> <ADHOC_RMD_MSG /> <ADHOC_RMD_TIME /> <ADHOC_RMD_UNITS>Days</ADHOC_RMD_UNITS> <ADHOC_RPT_TIME /> <ADHOC_RPT_UNITS>Days</ADHOC_RPT_UNITS> <CIRCULATETO /> <COMPLETION /> <FOLLOWUP /> <MSGSUBJECT /> <OTHERFIELD /> Low <REQUEST /> <RESPONSE /> <Submit /> <ADHOC_VALIDDATA>True</ADHOC_VALIDDATA> <JFWF_TRANID>2xxyg9sffane7pwd5j8yv9t49s.1</JFWF_TRANID> <JFWF_INSTRUCTION>Initiate a General Request. Fill the request form, then identify the next participant.</JFWF_INSTRUCTION> <JFWF_TRANSPORT>HTTP</JFWF_TRANSPORT> <JFWF_STATUS>RECEIVED</JFWF_STATUS> <JFWF_ACTION /> <JFWF_CHOICE>*Select Next Participant,Cancel</JFWF_CHOICE> <JFWF_VERSION>6.2</JFWF_VERSION> <JFWF_READONLY>1</JFWF_READONLY> </xfa:DataGroup> </xfa:Data> </jfxpf:Content> </jfxpf:Resource> </jfxpf:Package> </jfxpf:XPF> However, I am having trouble finding the text that is causing this issue. My Java code is below: Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new InputSource(new StringReader(xml))); EDIT Removing the Data node works, so the erro…
linked to: http://stackoverflow.com/q/3395560
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42967407
score: 1

http://stackoverflow.com/comment/42980269
type: Comment
has text: i had try this before but it also show the same result
type: AnswerComment
comment on: http://stackoverflow.com/a/27253082
score: 0

http://stackoverflow.com/a/27182283
type: Answer
answers question: http://stackoverflow.com/q/27182199
score: 1
upvote count: 1
downvote count: 0
has body: You might use reflection, but you'll need to pass in the Class because of type-erasure. Something like, public &lt;T&gt; void dataManipulation(Class&lt;T&gt; cls, ArrayList&lt;T&gt; list, Cursor cursor) { cursor.moveToFirst(); for (int i = 0; i &lt; cursor.getCount(); i++) { Constructor&lt;T&gt;[] ctors = (Constructor&lt;T&gt;[]) cls.getConstructors(); for (Constructor&lt;T&gt; c : ctors) { Type[] types = c.getGenericParameterTypes(); if (types.length == 1) { if (types[0].getClass().equals(Cursor.class)) { list.add(c.newInstance(cursor)); break; } } } if (!cursor.isAfterLast()) { cursor.moveToNext(); } } }

http://stackoverflow.com/a/27177992
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27177814
has body: You have Layout in jFrame. Add new Layout to jPanel too.

http://stackoverflow.com/comment/42883278
score: 0
type: Comment
has text: Which class displays an error of NoClassFoundException? Please send the logcat
comment on: http://stackoverflow.com/a/27169715
type: AnswerComment

http://stackoverflow.com/a/31604097
type: Answer
has comment: http://stackoverflow.com/comment/91854531
score: 24
upvote count: 24
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/66276133
answers question: http://stackoverflow.com/q/27212598
has body: Define your model like this: public class ApiResult { private String error; private String message; private String resultCode; private MyResultObject resultObj; } Then, create a TypeAdapterFactory for MyResultObject: public class MyResultObjectAdapterFactory implements TypeAdapterFactory { @Override @SuppressWarnings("unchecked") public &lt;T&gt; TypeAdapter&lt;T&gt; create(Gson gson, TypeToken&lt;T&gt; type) { if (type.getRawType()!= MyResultObject.class) return null; TypeAdapter&lt;MyResultObject&gt; defaultAdapter = (TypeAdapter&lt;MyResultObject&gt;) gson.getDelegateAdapter(this, type); return (TypeAdapter&lt;T&gt;) new MyResultObjectAdapter(defaultAdapter); } public class MyResultObjectAdapter extends TypeAdapter&lt;MyResultObject&gt; { protected TypeAdapter&lt;MyResultObject&gt; defaultAdapter; public MyResultObjectAdapter(TypeAdapter&lt;MyResultObject&gt; defaultAdapter) { this.defaultAdapter = defaultAdapter; } @Override public void write(JsonWriter out, MyResultObject value) throws IOException { defaultAdapter.write(out, value); } @Override public MyResultObject read(JsonReader in) throws IOException { /* This is the critical part. So if the value is a string, Skip it (no exception) and return null. */ if (in.peek() == JsonToken.STRING) { in.skipValue(); return null; } return defaultAdapter.read(in); } } } Finally, register MyResultObjectAdapterFactory for Gson: Gson gson = new GsonBuilder() .registerTypeAdapterFactory(new MyResultObjectAdapterFactory()) .create(); Now, when deserializing an ApiResult json with that Gson object, resultObj will be set null if it is a string. I Hope this solves your problem =)
accepted answer of: http://stackoverflow.com/q/27212598

http://stackoverflow.com/a/27875922
answers question: http://stackoverflow.com/q/27220192
upvote count: 1
has body: Use either sitemesh or tiles for page decoration like header and footer, etc. Sitemesh is the one i recommend. Its nothing do with struts2, no need to create header and footer struts2 actions to achieve this. You can search on net for example implementation of sitemesh + struts2. If you are not willing to check on sitemesh or any other decorating framework, best create header and footer jsp or html and include(jsp:inlcude tag) it in your index.jsp or which ever the jsp you want to show header and footer.
type: Answer
has comment: http://stackoverflow.com/comment/44167088
downvote count: 0
score: 1

http://stackoverflow.com/comment/42805697
type: QuestionComment
has text: @LuiggiMendoza But that won't help with hostname or port. I could think of some hacks to get the hostname, but the port seems tricky.
comment on: http://stackoverflow.com/q/27155579
score: 0
type: Comment

http://stackoverflow.com/comment/43015889
score: 0
type: AnswerComment
has text: I have updated the question (AFTER THE ANSWER BELOW:). What do you think about it?
comment on: http://stackoverflow.com/a/27254362
type: Comment

http://stackoverflow.com/q/27198495
has body: i am trying to do my first steps in Java, and i am blocked with the next problem: i have this hieararchy class "User -> Traveller". @Entity @Inheritance(strategy=InheritanceType.JOINED) public class User { // Some properties and accessors. } @Entity @PrimaryKeyJoinColumn(name="user_id") public class Traveller extends User{ // Some properties and accessors. } So, i need search a traveller by your username which is a User class property. I try this in my TravellerDao: public Traveller findByUsername(String username){ EntityManager em = PersistenceHelper.getEm(); TypedQuery&lt;Traveller&gt; query = em.createQuery("FROM Traveller WHERE username = ?1", Traveller.class); query.setParameter(1, username); return query.getSingleResult(); } But, a javax.persitence.NoResultException is catched. Where is the problem ? In the "where" clausule ? In the join ?. Any ideas ? Notes: 1) The hierarchy works fine with "find" method. And the database is generated correctly. 2) I have an entry in the Traveller table that links up to one in User table. 3) In the database exists an user with the username that i am using to test. 4) The method get correctly the "username" parameter. EDIT: Now works. The problem was the execution order of test cases. The query works fine.
score: 0
linked to: http://stackoverflow.com/q/2536829
tagged with: jpa
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
upvote count: 1
downvote count: 1
type: Question
has title: Querying by inherited property
has answer: http://stackoverflow.com/a/27198538

http://stackoverflow.com/q/27168201
has comment: http://stackoverflow.com/comment/42827921
tagged with: annotations
type: Question
linked to: http://stackoverflow.com/q/8756768
tagged with: null
tagged with: java
has body: I searched for a @NotNull java annotation and found the one from javax. I tried to use it but ran into the same issues described here. In short: I need to set up some stuff to get it working - but I actually don't need all that (I am in plain Java/Groovy context, no JavaEE). Are there alternatives to the mentioned annotation which work standalone, where to find those?
answer count: 2
tagged with: groovy
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27168452
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4963300
has title: Where to find a NotNull java annotation
upvote count: 2
has answer: http://stackoverflow.com/a/27168377

http://stackoverflow.com/comment/42800686
type: Comment
has text: on my machine the .m2 repository is /home/ubuntu/.m2/repository -- thus my <url> should read `<url>file:/home/ubuntu/.m2/repository</ur>` is that right?
comment on: http://stackoverflow.com/a/27153067
type: AnswerComment
score: 0

http://stackoverflow.com/a/28364513
score: 1
answers question: http://stackoverflow.com/q/27217538
type: Answer
upvote count: 1
has body: Any object property graph depth is possible. For example, ${bean.bean1.bean2.bean3.bean4.bean5.bean6.bean7.bean8.bean9.beanX.property1} In your case ${messages.${column}} should be ${message.column} if I understand your question correctly
downvote count: 0

http://stackoverflow.com/q/27266249
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43009690
downvote count: 2
tagged with: multithreading
upvote count: 1
possible better answer: http://stackoverflow.com/a/27266330
has comment: http://stackoverflow.com/comment/43003698
type: Question
has body: I think killing a thread at precisely the time you want is a problem for many people. I recently ran across a way to kill a thread by throwing an exception. What are your thoughts/inputs on this? Has anyone implemented something like this before?
has comment: http://stackoverflow.com/comment/43003825
has comment: http://stackoverflow.com/comment/43003956
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43004336
tagged with: kill-process
answer count: 2
has comment: http://stackoverflow.com/comment/43003801
has comment: http://stackoverflow.com/comment/43003855
linked to: http://stackoverflow.com/q/16504140
has answer: http://stackoverflow.com/a/27266330
favorite count: 0
has title: Killing a Java thread by throwing exception
has comment: http://stackoverflow.com/comment/43003867
tagged with: exception
has answer: http://stackoverflow.com/a/27266634
accepted answer: http://stackoverflow.com/a/27266634

http://stackoverflow.com/comment/42961204
has text: You forgot to mention that it does not accept `String` parameter.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27242601
type: AnswerComment

http://stackoverflow.com/q/27300427
has answer: http://stackoverflow.com/a/27301750
has comment: http://stackoverflow.com/comment/43066782
favorite count: 0
has comment: http://stackoverflow.com/comment/43068907
type: Question
has comment: http://stackoverflow.com/comment/43066114
upvote count: 2
has body: There is a game consists of N rounds. After each round, the winner (either you or me) will be awarded one point. The player with more points at the end of the game wins. You wants that after each round in the game you are having at least M times the points than me. For Example N=3 , M=1 the possible sequence of winners of rounds are: DDD // D is you and M is me DMD DDM MDD // Is not possible as you are having 1 point and i am having zero so condition violted My approach: In a particular game the only two possibilities are that you win or I win, so I make a recursive call to calculate the score for both the possibilities. D M D // At M+1 game(M wins or D wins) D or M D or M // At M+2 game(M wins or D wins) . . . ans so on At last round return 1 Code: public static int score(int rounds, int m, int score1, int current, int score2) { int sum=0; if (current == rounds &amp;&amp; score2 == 0) return 1; if (current == rounds &amp;&amp; score1 / score2 &gt;= m) return 1; if (score2 != 0 &amp;&amp; score1 / score2 &lt; m) return 0; if (score2 == 0 || score1 / score2 &gt;= m) { sum += score(rounds, m, score1, current + 1, score2 + 1); sum += score(rounds, m, score1 + 1, current + 1, score2); } return sum; } System.out.println(score(rounds,m,m,m,0)); This solution is taking very long time for larger value of N in the range of 10^6. How can i speed up my approach.
has comment: http://stackoverflow.com/comment/43064967
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/43064821
has comment: http://stackoverflow.com/comment/43065180
answer count: 1
has comment: http://stackoverflow.com/comment/43064867
tagged with: algorithm
has title: Algorithm for overlapping sets
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/27201847
tagged with: ecdsa
tagged with: digital-signature
downvote count: 0
has answer: http://stackoverflow.com/a/27770841
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42960680
type: Question
has comment: http://stackoverflow.com/comment/42944034
has comment: http://stackoverflow.com/comment/42961665
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42896082
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42988030
upvote count: 1
answer count: 1
has body: I got this error when trying to verify ECDSA Signature in my class. The error code is: java.security.SignatureException: error decoding signature bytes. at org.bouncycastle.jcajce.provider.asymmetric.util.DSABase.engineVerify(Unknown Source) at java.security.Signature$Delegate.engineVerify(Signature.java:1172) at java.security.Signature.verify(Signature.java:623) at SDSGeneration.Signing.verify_signature(Signing.java:88) at com.sdsweb.modele.VerificationBox.checkSignature(VerificationBox.java:121) at com.sdsweb.modele.VerificationBox.verifieur(VerificationBox.java:84) at com.sdsweb.servlet.Authentification.doGet(Authentification.java:55) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)...... I'm calling the method as this in the VerificationBox.java Class : public Map&lt;Integer, String&gt; checkSignature(String data_digest, Signature SignObject, PublicKey publicKey, byte[] Signaturebyte) throws InvalidKeyException, SignatureException, NoSuchProviderException, NoSuchAlgorithmException{ Map&lt;Integer, String&gt; erreur_signature = new HashMap&lt;Integer, String&gt;(); Signing SignVerifier = new Signing(); SignVerifier.setEcdsa_signature(); SignVerifier.verify_signature(publicKey, SignVerifier.getEcdsa_signature(), data_digest, Signaturebyte); if (SignVerifier.getVerify_result()){ erreur_signature.put(j, "SIGNATURE ÉRONNÉ, CODE SDS INVALIDE"); j++; } return null; } This is the SDSGeneration.Signing Class: package SDSGeneration; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PublicKey; import java.security.Signature; import java.security.KeyPair; import java.security.SignatureException; //This class provide an instance of all object which are needed to sign data public class Signing { public Signing() { } public Signing(KeyPair keygen) { } //ECDSA Signature Object private Signature ecdsa_signature; //KeyPair object private KeyPair keygen; //Final…
favorite count: 0
has comment: http://stackoverflow.com/comment/42909929
tagged with: security
has comment: http://stackoverflow.com/comment/42888409
has comment: http://stackoverflow.com/comment/42888551
has title: Error decoding signature bytes : "java.security.SignatureException: error decoding signature bytes"

http://stackoverflow.com/comment/42835437
type: Comment
score: 0
type: AnswerComment
has text: Very good answer, I understand what you mean but I'm not familiar with `modal dialogs`. Plus, my `"Log-in Window"` class has a lot of code inside it (for authentication purposes and other checks).. Is there an easy way to convert the `"Log-in Window"` class to a modal dialog? Is it simple?
comment on: http://stackoverflow.com/a/27172349

http://stackoverflow.com/comment/42930060
has text: Are you using `save()` or `saveOrUpdate()` ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27226056

http://stackoverflow.com/a/27230514
has comment: http://stackoverflow.com/comment/42938397
upvote count: 1
has comment: http://stackoverflow.com/comment/42938063
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42938281
has comment: http://stackoverflow.com/comment/42938260
has body: @Override always bothered me also, because it is used for both overriding the actual superclass method, and implementing an interface method. So, the documentation in taht part isn't written in the best way. considering that interfaces only contain 'empty' methods This isn't true anymore, in Java 8 interfaces can contain default implementations for declared methods.
score: 1
has comment: http://stackoverflow.com/comment/42937994
answers question: http://stackoverflow.com/q/27230419

http://stackoverflow.com/q/27177475
has comment: http://stackoverflow.com/comment/42901690
has title: how to disable the lucene kernel extension in neo4j
answer count: 1
downvote count: 0
tagged with: neo4j
score: 1
tagged with: lucene
favorite count: 0
has body: We're using Neo4j in our current project and want to use lucene's facetet search features so updating to lucene 4 is necessary... When I exclude "neo4j"s dependency to "neo4j-lucene-index" in my Maven POM I get an exception when trying to start the graphdatabase: java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:351) at org.neo4j.kernel.EmbeddedGraphDatabase.&lt;init&gt;(EmbeddedGraphDatabase.java:56) at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:90) at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:199) . . . Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager@3bd93525' was successfully initialized, but failed to start. Please see attached cause exception. at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115) at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:328) ... 35 more Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource@295f7c4b' was successfully initialized, but failed to start. Please see attached cause exception. at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115) at org.neo4j.kernel.impl.transaction.XaDataSourceManager.start(XaDataSourceManager.java:164) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507) ... 37 more Caused by: java.lang.IllegalArgumentException: No schema index provider org.neo4j.kernel.api.index.SchemaIndexProvider found. Kernel extensions available on classpath: Does neo4j work without lucene ? looking forward to…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27184713
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43061201

http://stackoverflow.com/a/27223188
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27222345
has body: To check whether an app is installed in the device use following method and params GooglePlayStorePackageNameOld &amp; GooglePlayStorePackageNameNew both holds the package names of apps private static final String GooglePlayStorePackageNameOld = "com.google.market"; private static final String GooglePlayStorePackageNameNew = "com.android.vending"; use and modify the following method accordingly to check if the app is presently installed in the device or not public boolean isAppInstalled() { PackageManager packageManager = getApplication().getPackageManager(); List&lt;PackageInfo&gt; packages = packageManager .getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); for (PackageInfo packageInfo : packages) { if (packageInfo.packageName.equals(GooglePlayStorePackageNameOld) || packageInfo.packageName .equals(GooglePlayStorePackageNameNew)) { googlePlayStoreInstalled = true; break; } else { googlePlayStoreInstalled = false; } } return googlePlayStoreInstalled; } and to navigate user to a particular Play Store link use the following code final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } EDIT According to your code Intent LaunchIntent = getPackageManager() .getLaunchIntentForPackage("com.Ch.Example.pack"); startActivity(LaunchIntent); will launch the app which has the package name com.Ch.Example.pack
upvote count: 2
type: Answer

arraylist
tags question: http://stackoverflow.com/q/27205588
tags question: http://stackoverflow.com/q/27170657
tags question: http://stackoverflow.com/q/27220422
tags question: http://stackoverflow.com/q/27170188
tags question: http://stackoverflow.com/q/27222417
tags question: http://stackoverflow.com/q/27273853
tags question: http://stackoverflow.com/q/27302747
tags question: http://stackoverflow.com/q/27178145
tags question: http://stackoverflow.com/q/27223494
tags question: http://stackoverflow.com/q/27290226
tags question: http://stackoverflow.com/q/27202349
tags question: http://stackoverflow.com/q/27202685
tags question: http://stackoverflow.com/q/27303992
tags question: http://stackoverflow.com/q/27207791
tags question: http://stackoverflow.com/q/27256845
tags question: http://stackoverflow.com/q/27174917
tags question: http://stackoverflow.com/q/27246120
tags question: http://stackoverflow.com/q/27207870
tags question: http://stackoverflow.com/q/27215773
tags question: http://stackoverflow.com/q/27306151
tags question: http://stackoverflow.com/q/27233895
tags question: http://stackoverflow.com/q/27204985
tags question: http://stackoverflow.com/q/27164316
tags question: http://stackoverflow.com/q/27243472
tags question: http://stackoverflow.com/q/27209738
tags question: http://stackoverflow.com/q/27201541
tags question: http://stackoverflow.com/q/27180189
tags question: http://stackoverflow.com/q/27224316
tags question: http://stackoverflow.com/q/27306892
tags question: http://stackoverflow.com/q/27305840
tags question: http://stackoverflow.com/q/27158605
tags question: http://stackoverflow.com/q/27234672
tags question: http://stackoverflow.com/q/27266675
tags question: http://stackoverflow.com/q/27179466
tags question: http://stackoverflow.com/q/27259386
tags question: http://stackoverflow.com/q/27238637
tags question: http://stackoverflow.com/q/27299648
tags question: http://stackoverflow.com/q/27180711
tags question: http://stackoverflow.com/q/27240662
tags question: http://stackoverflow.com/q/27252159
tags question: http://stackoverflow.com/q/27308362
tags question: http://stackoverflow.com/q/27198846
tags question: http://stackoverflow.com/q/27256631
tags question: http://stackoverflow.com/q/27260588
tags question: http://stackoverflow.com/q/27183708
tags question: http://stackoverflow.com/q/27289245
tags question: http://stackoverflow.com/q/27160206
tags question: http://stackoverflow.com/q/27166008
tags question: http://stackoverflow.com/q/27174278
tags question: http://stackoverflow.com/q/27202719
tags question: http://stackoverflow.com/q/27301716
tags question: http://stackoverflow.com/q/27212423
tags question: http://stackoverflow.com/q/27204324
tags question: http://stackoverflow.com/q/27253377
tags question: http://stackoverflow.com/q/27253864
tags question: http://stackoverflow.com/q/27244875
tags question: http://stackoverflow.com/q/27305818
tags question: http://stackoverflow.com/q/27304516
tags question: http://stackoverflow.com/q/27158140
tags question: http://stackoverflow.com/q/27193239
tags question: http://stackoverflow.com/q/27301429
tags question: http://stackoverflow.com/q/27306022
tags question: http://stackoverflow.com/q/27194112
tags question: http://stackoverflow.com/q/27203279
tags question: http://stackoverflow.com/q/27208756
tags question: http://stackoverflow.com/q/27307388
tags question: http://stackoverflow.com/q/27172322
tags question: http://stackoverflow.com/q/27216979
tags question: http://stackoverflow.com/q/27193932
tags question: http://stackoverflow.com/q/27200761
tags question: http://stackoverflow.com/q/27236356
tags question: http://stackoverflow.com/q/27222645
tags question: http://stackoverflow.com/q/27313759
tags question: http://stackoverflow.com/q/27241713
tags question: http://stackoverflow.com/q/27231835
tags question: http://stackoverflow.com/q/27181332
tags question: http://stackoverflow.com/q/27218413
tags question: http://stackoverflow.com/q/27172195
tags question: http://stackoverflow.com/q/27220643
tags question: http://stackoverflow.com/q/27179618

http://stackoverflow.com/q/27208836
has comment: http://stackoverflow.com/comment/42899606
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/27209174
tagged with: java
has comment: http://stackoverflow.com/comment/42899946
score: -1
has comment: http://stackoverflow.com/comment/42899972
type: Question
has comment: http://stackoverflow.com/comment/42899726
upvote count: 0
has comment: http://stackoverflow.com/comment/42899563
has comment: http://stackoverflow.com/comment/42899624
answer count: 1
has comment: http://stackoverflow.com/comment/42899546
has title: JAVA upload string to server
has body: I would like to upload a string to a server in java. I would not like to just upload a file I would like to upload a string String toupload = "Cheese"; Upload(toupload); like this
favorite count: 0
tagged with: ftp
has comment: http://stackoverflow.com/comment/42899752

http://stackoverflow.com/q/27183146
has answer: http://stackoverflow.com/a/27183188
tagged with: trim
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42854249
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27183188
has title: How to implement the logic of string trim() method
has body: I have tried checking the internal implementation of String trim() , but could not get the complete idea.Can any one please explain the internal behaviour of trim() .I know that it removes the whitespaces.But while executing the below program, white spaces are not removed. public class test { public static void main(String [] args){ String s = " abd c "; String s3 = s.trim(); System.out.println(s3); } } How to implement the internal logic of trim method...?
has comment: http://stackoverflow.com/comment/42853877
has comment: http://stackoverflow.com/comment/42853845
has answer: http://stackoverflow.com/a/27183186
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/27183186
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/42853861
has answer: http://stackoverflow.com/a/27183170

http://stackoverflow.com/q/27206929
score: 0
has body: Since, during execution of the Ant JUnit task, the JUnit jar may be picked up from various places, is there any way to get Ant to report on the console the version of JUnit used for running the tests or even the exact jar used?
type: UnansweredQuestion
has title: Ant JUnit task report on the version of the JUnit jar used (e.g. Junit 3, 3.8, 4)
type: Question
has answer: http://stackoverflow.com/a/27206958
tagged with: ant
tagged with: java
answer count: 1
tagged with: junit

http://stackoverflow.com/a/27291289
has comment: http://stackoverflow.com/comment/43048361
downvote count: 1
has comment: http://stackoverflow.com/comment/43048445
has body: Have you set bounds of the frame? setBounds(positionX, positionY, width, height);
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/27291205
type: Answer

http://stackoverflow.com/comment/42902902
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27198820
has text: Possible duplicate of http://stackoverflow.com/questions/17760141/floyd-warshall-algorithm-using-adjacency-list
score: 0

http://stackoverflow.com/q/27214032
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/27214056
linked to: http://stackoverflow.com/q/3728062
has comment: http://stackoverflow.com/comment/42908253
has body: Given myClass below and the non-static method run(), the following line of code is valid: new myClass().move(); However, this is also valid: move(); I understand the first attempt (new myClass().move()) creates an instance of the class and then calls the method on it. Does the second attempt also do the same thing but implicitly? In other words, are the 2 attempts really the same? If not, what is the fundamental difference and which one is preferred? It seems OscarRyz's comment in the post here touched on this but he did not elaborate. class myClass { void move() { //...some code } void run() { new myClass().move(); } } Thanks.
has title: Calling non-static method from another non-static method
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27214050
has answer: http://stackoverflow.com/a/27214056
has answer: http://stackoverflow.com/a/27214050
type: Question
has comment: http://stackoverflow.com/comment/42908279
tagged with: non-static
linked to: http://stackoverflow.com/q/2042813
upvote count: 2

http://stackoverflow.com/comment/43030200
has text: Also sort the guess[1..4] value so you can use Binary search too.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27280632

http://stackoverflow.com/a/27229507
has body: Say, the generated code is in target/scala-2_10/src_managed/main/compiled_avro/org/... then I had to add the source folder for the generated code in Java Build Path -> Source -> Add Folder -> Select the folder compiled_avro.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27192089

http://stackoverflow.com/comment/43078876
has text: I am guessing you are having the "outOfMemory error" correct? if not, kindly post your Logcat.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27308409
score: 0

http://stackoverflow.com/comment/42920898
has text: If you load `A` and `Data` in a `ClassLoader`, then make sure that `Data` is not in the classpath of the Groovy script `ClassLoader` and that the first ClassLoader is the parent (or ancestor) ClassLoader of the Groovy one.
comment on: http://stackoverflow.com/q/27218177
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/27300412
has comment: http://stackoverflow.com/comment/43069948
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a JSONArray emitted by a servlet, like a REST API. I have followed a few links and tried to parse this URL. I am able to receive the URL and print it out from my client servlet, but how do I parse it? So far this is what I have PrintWriter out = response.getWriter(); response.setContentType("application/json"); response.setHeader("Cache-Control", "nocache"); response.setCharacterEncoding("utf-8"); String out1 = new Scanner(new URL("http://localhost:8080/myproject/servletone").openStream(), "UTF-8").useDelimiter("\\A").next(); out.print(out1); The output is a json array as follows, [{"name":"abc","age":"80","gender":"male"},{"name":"hello","age":"45","gender":"‌​female"}] I need to be able to access each of the individual elements name, age, gender in each of the arrays.
type: Question
linked to: http://stackoverflow.com/q/2591098
tagged with: arrays
answer count: 1
score: 0
has title: unable to parse jsonarray from URL in java
has answer: http://stackoverflow.com/a/27304159
has comment: http://stackoverflow.com/comment/43064857
type: UnansweredQuestion

http://stackoverflow.com/comment/42821307
score: 0
has text: @mKorbel:In one of below answer says `Use SwingWorker`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27164311

http://stackoverflow.com/q/27312454
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: I have several classes, the first one called "Account" are the objects that are added to the array, the "Account" class has a method called "printAccountDetails" that will print out the details of the account. The second class i'm using is called "AccountCollection" which is the array class, and i've been trying to make a method that will print out the details of all the account objects that have been added to the array. The closest i've gotten so far is this method: public void printAllAccounts() { if (accounts.length &gt; 0) { for (int index = 0 ; index &lt; accounts.length ; index++) { accounts[currentIndex -1].printAccountDetails(); } } else { System.out.println ("No entries"); } "accounts" is the name of the array, and "currentIndex" is the point in the array. This works for printing out the details however it prints out the account details lots of times which is probably because i've told it to continuously increment by one then go back by 1. But I can't really think of any other way to do it, as this example: public void printAllAccounts() { if (accounts.length &gt; 0) { for (int index = 0 ; index &lt; accounts.length ; index++) { accounts[currentIndex].printAccountDetails(); } } else { System.out.println ("No entries"); } Just leads to a null pointer exception because the current index is blank. Any help is appreciated!
has comment: http://stackoverflow.com/comment/43085640
type: Question
score: -1
answer count: 1
downvote count: 1
tagged with: arrays
favorite count: 0
has title: How to print out objects in an array (Java)
has answer: http://stackoverflow.com/a/27314143
accepted answer: http://stackoverflow.com/a/27314143
has comment: http://stackoverflow.com/comment/43085406

http://stackoverflow.com/comment/42882084
score: 0
has text: What is common field of all 3 table?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27198530

http://stackoverflow.com/comment/42888571
has text: Your question looks like [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Can you describe why don't you want to use import?
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/27202855

http://stackoverflow.com/a/27242726
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42961370
has body: check this it will give you way to how to use putextra and getextra How to use putExtra() and getExtra() for string data
accepted answer of: http://stackoverflow.com/q/27242049
answers question: http://stackoverflow.com/q/27242049
score: 0
has comment: http://stackoverflow.com/comment/42961381

http://stackoverflow.com/comment/43094003
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27313034
has text: @user3262990 The JavaDoc describes how a line is line limited. It does not say that empty lines are removed. The BufferedReader should not remove empty lines - see also [Buffered Reader readLine() with Empty lines](http://stackoverflow.com/questions/3527108/buffered-reader-readline-with-empty-lines)

http://stackoverflow.com/a/27248935
upvote count: 2
has comment: http://stackoverflow.com/comment/43035994
has comment: http://stackoverflow.com/comment/43031911
score: 2
has comment: http://stackoverflow.com/comment/43022982
accepted answer of: http://stackoverflow.com/q/27207797
has comment: http://stackoverflow.com/comment/43069685
has comment: http://stackoverflow.com/comment/43091491
answers question: http://stackoverflow.com/q/27207797
has comment: http://stackoverflow.com/comment/43013437
has comment: http://stackoverflow.com/comment/43023190
has comment: http://stackoverflow.com/comment/43021237
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43033203
has body: I made a custom modification in TimeoutThreadPoolExecutor and it's working fine. public static class TimeoutThreadPoolExecutor extends ThreadPoolExecutor { private final long timeout; private final TimeUnit timeoutUnit; private boolean isShutdown = false; private final ScheduledExecutorService timeoutExecutor = Executors.newSingleThreadScheduledExecutor(); private final ConcurrentMap&lt;Runnable, ScheduledFuture&gt; runningTasks = new ConcurrentHashMap&lt;Runnable, ScheduledFuture&gt;(); public TimeoutThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue&lt;Runnable&gt; workQueue, long timeout, TimeUnit timeoutUnit) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); this.timeout = timeout; this.timeoutUnit = timeoutUnit; } public TimeoutThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue&lt;Runnable&gt; workQueue, ThreadFactory threadFactory, long timeout, TimeUnit timeoutUnit) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); this.timeout = timeout; this.timeoutUnit = timeoutUnit; } public TimeoutThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue&lt;Runnable&gt; workQueue, RejectedExecutionHandler handler, long timeout, TimeUnit timeoutUnit) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler); this.timeout = timeout; this.timeoutUnit = timeoutUnit; } public TimeoutThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue&lt;Runnable&gt; workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler, long timeout, TimeUnit timeoutUnit) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); this.timeout = timeout; this.timeoutUnit = timeoutUnit; } @Override public void shutdown() { isShutdown = true; super.shutdown(); } @Ov…
has comment: http://stackoverflow.com/comment/43048666
has comment: http://stackoverflow.com/comment/43086692
has comment: http://stackoverflow.com/comment/43013305
has comment: http://stackoverflow.com/comment/43163682
type: Answer
has comment: http://stackoverflow.com/comment/43093393
has comment: http://stackoverflow.com/comment/43020966

http://stackoverflow.com/q/27226810
has answer: http://stackoverflow.com/a/27349589
score: 8
tagged with: java
tagged with: amazon-sns
has body: For the last few years we have used our own RM Application to process events related to our applications. This works by polling a database table every few minutes, looking for any rows that have a due date before now, and have not been processed yet. We are currently making the transition to SNS, with SQS Worker tiers processing them. The problem with this approach is that we can't future date our messages. Our applications sometimes have events that we don't want to process until a week later. Are there any design approaches, alternative services, clever tricks we could employ that would allow us to do achieve this? One solution would be to keep our existing application running, at a simplified level, so all it does is send the SNS notifications when they are due, but the aim of this project is to try and do away with our existing app.
type: Question
has answer: http://stackoverflow.com/a/63135651
tagged with: amazon-sqs
has answer: http://stackoverflow.com/a/27549556
answer count: 3
downvote count: 0
tagged with: event-handling
tagged with: amazon-web-services
favorite count: 0
has title: Creating Amazon SNS messages to be processed in the future
upvote count: 8
type: UnansweredQuestion

http://stackoverflow.com/comment/43092002
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27309082
has text: Point 1 - what if I want the method to run for the lifetime of the application? That is not an uncommon requirement.

http://stackoverflow.com/a/27269861
answers question: http://stackoverflow.com/q/27269598
score: 1
upvote count: 1
type: Answer
has body: It means compare the number with 20, 21, ... 231. As 231 is larger than Integer.MAX_VALUE, one might use a long. int noOfBits = 0; long pow2 = 1; while (numberOfValues &gt;= pow2) { ++noOfBits; //pow2 = 2 * pow2 //pow2 += pow2; //pow2 *= 2; pow2 &lt;&lt;= 1; // Shift left once. } See also Integer.numberOfLeadingZeros(int), which would reduce the code to a one-liner. int noOfBits = 32 - Integer.numberOfLeadingZeros(numberOfValues);
downvote count: 0

http://stackoverflow.com/q/27168421
has answer: http://stackoverflow.com/a/27168612
linked to: http://stackoverflow.com/q/14038649
tagged with: java
has body: Without using finally, how can we execute any compulsory statement even after exception is thrown ?? Furthermore, the variables used or the method has scope only inside the try block. This question was asked by me in a interview. please suggest the answer. try{ //........ statement 1 // ....... statement 2 might throw an Exception // ....... statement 3 - A compulsory statement needs to be executed even if exception is thrown. } catch { }
has comment: http://stackoverflow.com/comment/42828782
has comment: http://stackoverflow.com/comment/42828319
type: Question
has comment: http://stackoverflow.com/comment/42828691
has comment: http://stackoverflow.com/comment/42828611
has title: Without using finally, how can we execute any statement even after exception is thrown?
has comment: http://stackoverflow.com/comment/42828476
has comment: http://stackoverflow.com/comment/42829214
score: 0
has comment: http://stackoverflow.com/comment/42828523
has answer: http://stackoverflow.com/a/27168716
has comment: http://stackoverflow.com/comment/42829589
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42828505
answer count: 4
has answer: http://stackoverflow.com/a/27168577
has answer: http://stackoverflow.com/a/27168830
has comment: http://stackoverflow.com/comment/42828320

http://stackoverflow.com/q/27300014
has answer: http://stackoverflow.com/a/27300453
type: Question
has answer: http://stackoverflow.com/a/27300185
score: 0
has answer: http://stackoverflow.com/a/27303152
answer count: 3
has title: Comparing two Dates in Java
possible better answer: http://stackoverflow.com/a/27300185
has comment: http://stackoverflow.com/comment/43064154
accepted answer: http://stackoverflow.com/a/27303152
has body: I have an Identity class with necessary accessors and mutators. In a seperate program I am comparing the Identity's Date to todays date which always returns &lt;= 10. However when I go to print it I get the same result no matter what the date is. Is there a different way to access the correct date? I need to get the number of days between two dates and I'm having trouble on the formating: Date today = new Date(); DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date a = df.parse("06/18/2015"); Date b = df.parse("01/04/2015"); Date c = df.parse("02/04/2015"); Date d = df.parse("03/04/2015"); Date e = df.parse("07/04/2015"); if(a.compareTo(today) == 30{ //do stuff } I've tried multiple methods to no avail.
has comment: http://stackoverflow.com/comment/43063911
linked to: http://stackoverflow.com/q/3299972
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43063986
tagged with: java
tagged with: date

http://stackoverflow.com/q/27250666
type: Question
has comment: http://stackoverflow.com/comment/42975578
linked to: http://stackoverflow.com/q/22929237
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27250775
favorite count: 0
tagged with: java.util.date
accepted answer: http://stackoverflow.com/a/27250775
has comment: http://stackoverflow.com/comment/42975537
has title: java.time.LocalDate to java.util.Date
upvote count: 3
has body: What is the best way to convert from java.time.LocalDate to java.util.Date ? Date.from(dateToReturn.atStartOfDay(ZoneId.systemDefault()).toInstant() I have been trying this one but does not seem to work correct with the time although converts the date month and year correctly. Update : java.time.LocalDate does not save time informations Just used java.time.LocalDateTime instead and everything works fine.
has comment: http://stackoverflow.com/comment/42976667
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43021825
has comment: http://stackoverflow.com/comment/42997453
has comment: http://stackoverflow.com/comment/42975503
tagged with: java

http://stackoverflow.com/comment/43013395
has text: that did it. It's still surprising that I'm the only one with this problem though everyone in my team is using the pom.xml file without this tag.
comment on: http://stackoverflow.com/q/27269671
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27301688
type: Answer
has body: Found out what the problem was: There was a "actionResult" getter missing from the viewSuccessPage method for the controller that was used for the successPage.htm Thanks for all those who viewed it. Hope this helps others.
score: 0
answers question: http://stackoverflow.com/q/27297317

http://stackoverflow.com/a/27285299
has comment: http://stackoverflow.com/comment/43038357
downvote count: 0
score: 1
has body: The technique you're currently using allows you to get to a resource that's already packed inside your JAR file. But these resources are coherent only within the application, and not from outside it. When you execute your JAR file using java -jar ..., that's an external application being executed, and it won't understand how to retrieve a JAR from inside another JAR. You will need to write it temporarily to disk, and then run the temporary JAR file. You need to: Open the resource as a stream. Use Files.createTempFile() to create a temporary JAR file somewhere. Use Files.copy() to copy from the resource stream to the temporary file. Use File.deleteOnExit() to make sure that the temporary file will get cleaned up when the main (host) application terminates. Execute the temporary file with java -jar tempfile.jar or whatever you called it.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27285246
type: Answer
answers question: http://stackoverflow.com/q/27285246

http://stackoverflow.com/comment/43035518
comment on: http://stackoverflow.com/q/27283559
type: QuestionComment
has text: What does the `getData` method do? You do realise that Swing is not thread safe and that you should never modify the UI in any way from outside the context of the Event Dispatching Thread?
score: 3
type: Comment

http://stackoverflow.com/comment/43022466
comment on: http://stackoverflow.com/a/27276808
type: AnswerComment
has text: so just put it inside my for loop?
score: 0
type: Comment

http://stackoverflow.com/q/27204492
has body: I'm having difficulty getting a Servlet to create an Excel file using apache POI. When I use the following code in a separate Java class it works fine, but when I copy the code into the servlet, the servlet just doesn't create the excel file. This is essentially all that is in the servlet. I get parameters and just store those. I want to just get the servlet to create the file first, then start adding the user input in later. Workbook workbook = new HSSFWorkbook(); Sheet sheet = workbook.createSheet("Sheet 1"); Cell cell1 = sheet.createRow(0).createCell(3); cell1.setCellValue("100000"); Cell cell2 = sheet.createRow(1).createCell(3); cell2.setCellValue("Text text."); FileOutputStream output = new FileOutputStream("SampSamp.xls"); workbook.write(output); output.close();
has answer: http://stackoverflow.com/a/27204652
tagged with: apache-poi
score: 0
tagged with: excel
has title: Java Servlet: Unable to create Excel File
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27204652
tagged with: servlets
type: Question
answer count: 1

ssl
tags question: http://stackoverflow.com/q/27226448
tags question: http://stackoverflow.com/q/27300064
tags question: http://stackoverflow.com/q/27272725
tags question: http://stackoverflow.com/q/27206040
type: Tag
tags question: http://stackoverflow.com/q/27180969
tags question: http://stackoverflow.com/q/27189648
tags question: http://stackoverflow.com/q/27300461
tags question: http://stackoverflow.com/q/27170001
tags question: http://stackoverflow.com/q/27192790
tags question: http://stackoverflow.com/q/27266177
tags question: http://stackoverflow.com/q/27211606
tags question: http://stackoverflow.com/q/27289931
tags question: http://stackoverflow.com/q/27265630
tag name: ssl
tags question: http://stackoverflow.com/q/27255015
tags question: http://stackoverflow.com/q/27213687
tags question: http://stackoverflow.com/q/27312522
tags question: http://stackoverflow.com/q/27287041
tags question: http://stackoverflow.com/q/27203741
tags question: http://stackoverflow.com/q/27253053
tags question: http://stackoverflow.com/q/27249605
tags question: http://stackoverflow.com/q/27275250
tags question: http://stackoverflow.com/q/27247413
tags question: http://stackoverflow.com/q/27160189
tags question: http://stackoverflow.com/q/27206599
tags question: http://stackoverflow.com/q/27277328
tags question: http://stackoverflow.com/q/27191368
tags question: http://stackoverflow.com/q/27228569

http://stackoverflow.com/q/27159172
score: 4
favorite count: 0
answer count: 5
has body: I have a class as follows: package org.requiredinput.rpg1.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import org.requiredinput.rpg1.Rpg1; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Awesome rpg"; config.width = 800; config.height = 480; new LwjglApplication(new Rpg1(), config); } } My question is - on the last line, the new statement is used without being preceded by an =. What is being created? A new LwjglApplication object? Class? And why doesn't it need to be instantiated like app = new LwjglApplication() for example?
has answer: http://stackoverflow.com/a/27159450
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27159185
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27159343
has title: Use 'new' without 'xyz = new abc'
tagged with: libgdx
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/27159190
possible better answer: http://stackoverflow.com/a/27159304
has answer: http://stackoverflow.com/a/27159304
accepted answer: http://stackoverflow.com/a/27159190

http://stackoverflow.com/comment/42868711
has text: Yes, i have emailResponse.showRequestLogs() method, for example. and i want it to be called on AssertionError. I am not getting your way to make this happen...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27190793
type: AnswerComment

http://stackoverflow.com/q/27284154
tagged with: jdbc
favorite count: 0
tagged with: database-connection
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: instantiation
score: 1
tagged with: java
has body: I am trying to understand how I can pass a CLOB to a database using JDBC. I am using Oracle 11g and Oracle's JDBC Driver 12.1.0.1. I was looking through Oracle's Jdbc tutorial and I found this sample code. It reads the contents of a file and writes to a Clob instance , which it then writes to the database using INSERT . For sake of readability , I am posting only relevant portions of the code: Clob myClob = this.con.createClob(); Writer clobWriter = myClob.setCharacterStream(1); String str = this.readFile(fileName, clobWriter); System.out.println("Wrote the following: " + clobWriter.toString()); if (this.settings.dbms.equals("mysql")) { System.out.println("MySQL, setting String in Clob " + "object with setString method"); myClob.setString(1, str); } System.out.println("Length of Clob: " + myClob.length()); String sql = "INSERT INTO COFFEE_DESCRIPTIONS " + "VALUES(?,?)"; pstmt = this.con.prepareStatement(sql); pstmt.setString(1, coffeeName); pstmt.setClob(2, myClob); pstmt.executeUpdate(); Here is the code for the readFile method: private String readFile(String fileName, Writer writerArg) throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader(fileName)); String nextLine = ""; StringBuffer sb = new StringBuffer(); while ((nextLine = br.readLine()) != null) { System.out.println("Writing: " + nextLine); writerArg.write(nextLine); sb.append(nextLine); } // Convert the content into to a string String clobData = sb.toString(); // Return the data. return clobData; } I modified the above sample code to pass a CLOB to a PL/SQL procedure. public String handleEmployeeReview(int empId , String fileName) throws IOException { Connection conn = null; CallableStatement callStmt = null; String reviewContent = null; try { // Register the Oracle Jdbc driver // Class.forName(JDBC_DRIVER_ORACLE); // Create a database connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD); // Create a query string String callProc = " { call HR.EMP…
type: Question
has title: Oracle' s Jdbc tutorial example for binding CLOB
upvote count: 1

http://stackoverflow.com/a/27266242
has body: First note that in Big-O notation there is nothing such as O(n/2) as 1/2 is a constant factor which is ignored in this notation. The complexity would remain as O(n). So by modifying your code you haven't changed anything regarding complexity. In general estimating the number of times a loop is executed with respect to input size and the operation that actually is associated with a cost in time is the way to get to the complexity class of the algorithm. The operation that is producing cost in your method is String.equals, which by looking at it's implementation, is producing cost by comparing characters. In your example the input size is not strictly equal to the size of the list. It also depends on how large the strings contained in that list are and how large the inputName is. So let's say the largest string in the list is m1 characters and the inputName is m2 characters in length. So for your original checkName method the complexity would be O(n*min(m1,m2)) because of String.equals comparing at most all characters of a string. For most applications the term min(m1,m2) doesn't matter as either one of the compared strings is stored in a fixed size database column for example and therefore this expression is a constant, which is, as said above, ignored.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27265958
accepted answer of: http://stackoverflow.com/q/27265958
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/27277830
answers question: http://stackoverflow.com/q/27277791
has comment: http://stackoverflow.com/comment/43173924
has comment: http://stackoverflow.com/comment/43031433
has comment: http://stackoverflow.com/comment/43029054
downvote count: 0
has comment: http://stackoverflow.com/comment/43026778
has comment: http://stackoverflow.com/comment/43028074
type: Answer
has comment: http://stackoverflow.com/comment/43029733
score: 2
has comment: http://stackoverflow.com/comment/43028089
upvote count: 2
has comment: http://stackoverflow.com/comment/43025938
has body: gethSvanslängd(String HundRas) must take an argument of type String. You call it with no arguments, like this: gethSvanslängd(). Provide it a String argument. Say you have a String, String someString. Then you want to call gethSvanslängd(someString).
has comment: http://stackoverflow.com/comment/43029139

semaphore
type: Tag
tags question: http://stackoverflow.com/q/27281454
tag name: semaphore

http://stackoverflow.com/q/27199252
upvote count: 1
type: Question
tagged with: jsoup
has answer: http://stackoverflow.com/a/27201145
has body: If I had the following images inside of a div how would I be able to do a jsoup query that only returns the images that have the class that CONTAINS the text "absmiddle"? &lt;div&gt; &lt;img class="absmiddle-blah foo-bar" src="google.com/image.png" \&gt; &lt;img class="absmiddle-blah2 foo-bar2" src="google.com/image.png" \&gt; &lt;img class="ablehe-bla2h foo-bar3" src="google.com/image.png" \&gt; &lt;img class="absmiddle-bl2ah foo-bar4" src="google.com/image.png" \&gt; &lt;img class="blah-bl2ah foo-bar4" src="google.com/image.png" \&gt; &lt;img class="absmiddle-bl2ah foo-bar4" src="google.com/image.png" \&gt; &lt;img class="sdfdle-bl2ah foo-bar4" src="google.com/image.png" \&gt; &lt;/div&gt;
downvote count: 0
answer count: 1
score: 1
tagged with: parsing
favorite count: 0
accepted answer: http://stackoverflow.com/a/27201145
tagged with: android
has title: Search for Image class that contains specific text in jsoup
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43145422
type: AnswerComment
has text: if the solution is correct sign it and up -vote this solution
type: Comment
comment on: http://stackoverflow.com/a/27233168
score: 0

http://stackoverflow.com/comment/42918245
type: Comment
has text: If you don't want that message at the bottom, then why did you include it? It is always printed because you told it to.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27219527

http://stackoverflow.com/comment/42835439
has text: Suppose we don't know the key and the value is present for more than one key... we want to delete that value for all the keys which contains that value.
comment on: http://stackoverflow.com/a/27172354
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27199300
has answer: http://stackoverflow.com/a/27199376
answer count: 3
has answer: http://stackoverflow.com/a/27199346
has body: import java.util.Scanner; public class Hw7Pr2 { public static void main(String[] args) { int[] grades = { 40, 55, 70, 58 }; System.out.println("best: "); int best1 = best(grades); System.out.print(best1); // Print Grade System.out.println("Grade: "); char [] grade = (char[]) best(grades); for (char i = 0; i &lt; grade.length; i++) { String output= " "; output += "Student " + i + " score is " + grades[i] + " and grade is " + grade + "\n"; } } private static char gradeLetter(int[] grades) { char grade = 0; for (int i = 0; i &lt; grades.length; i++) { if (grades[i] &gt;= best(grades) - 10) grade = 'A'; else if (grades[i] &gt;= best(grades) - 20) grade = 'B'; else if (grades[i] &gt;= best(grades) - 30) grade = 'C'; else if (grades[i] &gt;= best(grades) - 40) grade = 'D'; else grade = 'F'; } return grade; } public static int best(int[] grades) { System.out.println("The best scores is: "); int best = grades[0]; for (int i = 0; i &lt; grades.length; i++) { if (grades[i] &gt; best) best = grades[i]; } return best; } } I am trying to show the output like this Student 1 score is 40 and grade is C Student 2 score is 55 and grade is B Student 3 score is 70 and grade is A Student 4 score is 58 and grade is B But I am having problems with printing the gradeLetter method.
possible better answer: http://stackoverflow.com/a/27199346
accepted answer: http://stackoverflow.com/a/27199376
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27200112
type: Question
has title: How to print my methods on the main method to display the output?

http://stackoverflow.com/comment/42867044
type: Comment
comment on: http://stackoverflow.com/q/27190502
score: 1
type: QuestionComment
has text: Use the `$exists` operator

http://stackoverflow.com/comment/103315706
comment on: http://stackoverflow.com/a/41516376
type: Comment
score: 2
has text: This _will_ cause N+1 problem, `@Many` is exactly for this. The `getConhots` will be cause once for each row from the `selectUsingAnnotations` query
type: AnswerComment

c++
tags question: http://stackoverflow.com/q/27273499
tags question: http://stackoverflow.com/q/27220671
tags question: http://stackoverflow.com/q/27273173
tags question: http://stackoverflow.com/q/27169493
tags question: http://stackoverflow.com/q/27225468
tags question: http://stackoverflow.com/q/27187879
tags question: http://stackoverflow.com/q/27216506
tags question: http://stackoverflow.com/q/27153549
type: Tag
tags question: http://stackoverflow.com/q/27308438
tags question: http://stackoverflow.com/q/27193614
tags question: http://stackoverflow.com/q/27292744
tags question: http://stackoverflow.com/q/27169699
tags question: http://stackoverflow.com/q/27220547
tags question: http://stackoverflow.com/q/27208123
tags question: http://stackoverflow.com/q/27183429
tags question: http://stackoverflow.com/q/27243962
tags question: http://stackoverflow.com/q/27244772
tags question: http://stackoverflow.com/q/27277766
tags question: http://stackoverflow.com/q/27303316
tags question: http://stackoverflow.com/q/27269598
tags question: http://stackoverflow.com/q/27171708
tag name: c++
tags question: http://stackoverflow.com/q/27157928

http://stackoverflow.com/q/27249793
score: 1
has body: I´m usign Spring BeanUtils with this class structure class B{ int b; } class A{ int a; B bClass; } Then receiving a instance A want to create a new one but without the value of B.b. So I´m doing this: A a = new A(); B b = new B(); b.setb(2); a.seta(1); a.setbClass(b); A a1 = new A(); BeanUtils.copyProperties(a, a1, new String[]{"bClass.b"}); But still the value of b attribute 2 is still coping on the a1 class. What I´m doing wrong
has answer: http://stackoverflow.com/a/27249941
favorite count: 0
possible better answer: http://stackoverflow.com/a/27250194
has answer: http://stackoverflow.com/a/27250194
tagged with: spring
tagged with: spring-mvc
has title: Ignore properties in subclass with BeanUtils
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27249941
upvote count: 1
type: Question
tagged with: java
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/43062419
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27299186
type: Comment
has text: @MrH happens to us all! :)

http://stackoverflow.com/comment/42991812
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27237907
type: AnswerComment
has text: @DailyFrankPeter: No real difference in speed setting MouseTransparent(true), it still is much slower if passing the invisible group.

http://stackoverflow.com/comment/42876876
comment on: http://stackoverflow.com/q/27195932
score: 0
type: QuestionComment
has text: Did you look at the `Character` class?
type: Comment

http://stackoverflow.com/comment/43066222
comment on: http://stackoverflow.com/a/27300544
type: AnswerComment
score: 0
type: Comment
has text: Thank you very much! It's working just as I intended it to be. Thank you again.

http://stackoverflow.com/comment/42937822
has text: If I understand things, when I compile my application JAR as long as it includes an import statement for each javax.mail.xxx class I need, right? What I am wondering is why I couldn't have the Mail.jar in my ext directory in Java1.7.0_07. The reason I am wondering is because I develop most code on desktop in home office, but will often travel to client's houses to update (recompile) application. I use a laptop for visits and it would just be easier if I had Mail.jar in same location on both machines. Thanks for assistance.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27214704

http://stackoverflow.com/comment/42866174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27189531
has text: @yaa110 not exactly factorial, but let me tell you something that happened with me, i wrote a code which needed to do many things and also increment a number by 1(yeah just 1) at around 20 places but the problem was that the range was more than 1000 digits of the number so i used BigInteger, the program needed to execute in under 9 secs on the server of the coding site, but i was getting TimeLimitExceeded,then i created a program to add 1 to a number using Strings(it was hardly 20 lines code) so i placed that string code in all of my main program and it got executed in <2.5 secs :)
score: 0

http://stackoverflow.com/comment/43101808
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27309750
type: QuestionComment
has text: yes, @NealEhardt you are right it can be written as iterative and it is also much easier. But i am required to do it recursively

youtube
tags question: http://stackoverflow.com/q/27202341
tags question: http://stackoverflow.com/q/27160711
type: Tag
tag name: youtube
tags question: http://stackoverflow.com/q/27187816

http://stackoverflow.com/comment/42895106
type: AnswerComment
score: 0
type: Comment
has text: That's pretty much what I said, no? There's nothing in the API, you need to write it yourself.
comment on: http://stackoverflow.com/a/27206382

http://stackoverflow.com/comment/43054554
comment on: http://stackoverflow.com/q/27294063
has text: You can try the http://java-sl.com/tip_columns_flow_layout.html layout with no gaps. It should solve rearrange columns on resizing.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/27203100
has body: I am a total newbie to java so excuse me if this doesn't make sense. I am trying to make a simple android application where the user can enter in a department name and then click a search button. It will then retrieve data from the mysql database and populate edit text boxes underneath with that information. So far I have the database connected to my app: db.java public class db { public static Connection con; public static void main(String[] argv) { try { connectionQuery(); PreparedStatement statement = con.prepareStatement("SELECT * from buildings");/*write query inside of prepared statement*/ ResultSet result = statement.executeQuery(); System.out.println("DataBase table accessed"); while(result.next()) { String retrievedid= result.getString("name"); System.out.println(retrievedid); } con.close(); } catch(Exception e) { e.printStackTrace(); System.out.println(e.getMessage().toString()); } } public static void connectionQuery() { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/fypdb","root",""); System.out.println("Remote DB connection established"); } catch (ClassNotFoundException e) { e.printStackTrace(); System.out.println("Remote server could not be connected"); } catch (NullPointerException e) { e.printStackTrace(); System.out.println("Remote server could not be connected"); } catch (SQLException e) { e.printStackTrace(); System.out.println("Remote db connection establishment error"); } catch (Exception e) { e.printStackTrace(); System.out.println("False query"); } } } this is working fine and is printing out the results. But now I don't know how to search the database from the application and populate the edit text views with the results. Any help would be much appreciated.
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42889400
tagged with: java
tagged with: database
tagged with: mysql
tagged with: search
type: Question
has title: Android - fill edit text views from mysql database search
answer count: 1
has answer: http://stackoverflow.com/a/27203483

http://stackoverflow.com/a/27193465
score: 0
answers question: http://stackoverflow.com/q/27192854
has body: what you could do is define your coins as emums, ie: enum Coin { twopounds(200), pounds(100), fifty(50), twenty(20), ten(10), five(5), two( 2), one(1); int value; Coin(int value) { this.value = value; } int getCoins(int amount){ return amount/value; } int getReminder(int amount){ return amount%value; } } then you could do int change = 321; for (Coin coin : Coin.values()){ int count = coin.getCoins(change ); if (count!=0){ System.out.println(coin.name()+" : " +count); } change = coin.getReminder(change ); } and that will prints you your change in coins, you could take this further, and define your wallet where you hold all your money ie class Wallet{ int money; int getAllCoins(Coin coin){ int coins = coin.getCoins(money); money=coin.getReminder(money); return coins; } } but this will be overkill for this simple scenario
type: Answer

http://stackoverflow.com/comment/42984407
type: Comment
has text: I tried that but didn't work. still coming up with errors when I click the button.
comment on: http://stackoverflow.com/a/27254936
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42883891
comment on: http://stackoverflow.com/a/27200026
has text: Actually its working perfectly except one of the computer.All are added same library.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42899416
type: QuestionComment
has text: Toss a coin to decide whether your line will go horizontal or vertical. If it ended up being horizontal, then draw your line by only changing the X coordinate. If it ended up being vertical, only change the Y coordinate. I might have understood you wrong though.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27208676

http://stackoverflow.com/comment/90298154
has text: I think this will cause N+1 problem.
comment on: http://stackoverflow.com/a/41516376
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/q/27226782
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/42931616
has comment: http://stackoverflow.com/comment/42932231
has comment: http://stackoverflow.com/comment/42993942
score: 0
tagged with: elasticsearch-jest
has body: Why does default initialisation of TransportClient() for elasticsearch takes much more time then initialisation of jest client? Code for TransportClient: private static Client client = new TransportClient() .addTransportAddress( new InetSocketTransportAddress("localhost", 9200) ); Code for jest client: JestClientFactory factory = new JestClientFactory(); factory.setHttpClientConfig(new HttpClientConfig.Builder("http://localhost:9200") .multiThreaded(true) .build()); client = factory.getObject(); Jest client is light. However I need some extended functionality that have elasticsearch java client, but doesn't have jest client. Is it possible to decrease time of initialisation for TransportClient by configuration? Why does it take too much time? P.S. Initialisation of TransportClient takes approximately 6+ sec for me on Mac 16 GB of RAM. Please, not that I initialise clients just once in code (using static and/or thread safe singleton)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43005090
tagged with: elasticsearch
has title: Elastic search java client. Initialisation of TransportClient takes long time
tagged with: elasticsearch-java-api
answer count: 0
tagged with: java

http://stackoverflow.com/q/27278215
upvote count: 0
has title: String writer not writing to the file
has comment: http://stackoverflow.com/comment/43025352
has answer: http://stackoverflow.com/a/27279052
favorite count: 0
has body: The aim of my code is to eventually ask the user for a file name and if it is already a file in the current directory then print an error message, if it is not however then it is supposed to create the file and write lines to the newly created file until the user enters end. One final thing the program is supposed to keep doing this until the user enters exit. So in simpler terms the user enters a file name (its not a file already) they are prompted to input a line then another line, the user enters end and then the user is prompted to input a file name again and they type exit and the program stops. My code however which i will post is creating the file but not actually writing to it, help ?? I'm in java eclipse by the way import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Scanner; public class PrintWriter { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); PrintWriter writer = null; // Initializes the printwriter as writer try { writer = new PrintWriter("printwriter3.txt", "UTF-8"); // will write in the UTF-8 language to a file named printwriter.txt boolean exit = false; while (exit == false) { String user = input.nextLine(); if (user.equals("end")) { exit = true; } else { writer.println(user); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("File not found"); // if the file is not found then this error message is printed } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("The encoding type is not supported"); // if the encoding type in this case UTF-8 is not supported an error message is printed }
score: -1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27278459
downvote count: 1
type: Question
tagged with: try-catch
tagged with: writer
answer count: 2
has comment: http://stackoverflow.com/comment/43025435
possible better answer: http://stackoverflow.com/a/27279052
accepted answer: http://stackoverflow.com/a/27278459

http://stackoverflow.com/comment/42960899
score: 0
comment on: http://stackoverflow.com/q/27242426
has text: try debugging your code and maybe you will find your problem
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42864120
type: Comment
type: AnswerComment
has text: Updated my answer. Also don't forget for implement correct hashCode() and equals() in entities.
comment on: http://stackoverflow.com/a/27184656
score: 0

http://stackoverflow.com/a/27198648
has body: As others have pointed out, you cannot really prevent someone who has the app (and therefore has the private key) from extracting the private key. You can obfuscate the key, which might be reasonable depending on what you're trying to accomplish. In that case, you can hide the key password in various spots in the code and use the KeyStore as you've mentioned. That's not really secure, but it might be "good enough" for your purposes. Any key that's distributed to the end user cannot be considered secret. More importantly, if your server is trusting any client code, signed or not, you probably have a security issue with your server. You have to find a different way to enforce your security properties than trusting the client.
type: Answer
answers question: http://stackoverflow.com/q/27197699
score: 0

http://stackoverflow.com/q/27297475
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/43059588
has title: How to display all scores at the end without a loop?
has comment: http://stackoverflow.com/comment/43059491
upvote count: 1
accepted answer: http://stackoverflow.com/a/27297926
has answer: http://stackoverflow.com/a/27299490
has comment: http://stackoverflow.com/comment/43059196
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/43059568
possible better answer: http://stackoverflow.com/a/27299490
has comment: http://stackoverflow.com/comment/43059534
has comment: http://stackoverflow.com/comment/43059335
has comment: http://stackoverflow.com/comment/43064005
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43059334
has body: I am trying to display my score at the end of a questionnaire however my way of doing it only displays the last score. It would work if I were to put it in a loop, the JOptionPane.showMessageDialog however I only want it to display this once, at the end. Here is my code. //Main method JOptionPane.showMessageDialog(null, printPlayerScore(playerName, playerAge, playerScore, playerCount)); //printPlayerScore method public static String printPlayerScore(String playerName[], int playerAge[], int playerScore[], int playerCount) { String displayResult = ""; for(int i = 0; i &lt; playerCount; i++) { displayResult += "\nName: " + playerName[i] + "\nAge: " + playerAge[i] + "\nScore: " + playerScore[i] + "\n"; } return displayResult; } Example run: Player1: 12 Player2: 12 When it should be Player1: 10 Player2: 12 I know I need to change the method to something else, but how else could I do it? Full code: http://pastebin.com/NME8Dh7N
has answer: http://stackoverflow.com/a/27297938
has answer: http://stackoverflow.com/a/27297926
type: Question
favorite count: 0
score: -1

http://stackoverflow.com/comment/42945662
comment on: http://stackoverflow.com/q/27234448
has text: I have arranged it excuse me as I was testing with several strings
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43013238
has text: Deprecated in Spring 3.0 and I could not find it in Spring 4 jars, may be removed. Also I think it is for struts 1.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27270232
type: AnswerComment

http://stackoverflow.com/a/27221658
has comment: http://stackoverflow.com/comment/42922083
has comment: http://stackoverflow.com/comment/42922117
type: Answer
has comment: http://stackoverflow.com/comment/42922229
has comment: http://stackoverflow.com/comment/42922174
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27221634
has body: You will want to understand that objects have no names -- none, zero, zip. Yes, variables can have names, but that is not the same, since two or more variables can refer to the same object, and when that happens, which name is the name for the object? Again, neither/none since objects don't have names. As for variable names, they're way less important than you believe and almost don't exist in compiled code. What is most important are object references. Here an object can be associated with a String by means of a Map such as a HashMap&lt;String, String&gt; which is similar to an array or ArrayList that uses a String as its index rather than a number. Now having said this, you can give your State class a String name field, and this may serve your purposes well. i.e., import java.util.ArrayList; import java.util.List; public class State { private String name; private List&lt;String&gt; cities = new ArrayList&lt;&gt;(); public State(String name) { this.name = name; } public String getName() { return name; } public void addCity(String city) { cities.add(city); } public List&lt;String&gt; getCities() { return cities; } @Override public String toString() { return "State of " + name + ", Cities: " + cities; } } Which can be run like: public class StateTest { public static void main(String[] args) { State illinois = new State("Illinois"); illinois.addCity("Chicago"); illinois.addCity("Peoria"); illinois.addCity("Springfield"); System.out.println(illinois); } }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27221634
downvote count: 0
has comment: http://stackoverflow.com/comment/42922252
score: 4
has comment: http://stackoverflow.com/comment/42922422

http://stackoverflow.com/q/27169450
has answer: http://stackoverflow.com/a/27171925
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42830034
favorite count: 0
answer count: 3
linked to: http://stackoverflow.com/q/18552005
has answer: http://stackoverflow.com/a/27170003
has comment: http://stackoverflow.com/comment/42833224
type: UnansweredQuestion
has title: Copying values of array at specific indices to another array
has comment: http://stackoverflow.com/comment/42831801
has answer: http://stackoverflow.com/a/27170994
tagged with: java
score: 4
has body: I came up to a situation where I have an array and I need to copy some specific attributes (i.e. values at specific indinces) not the whole array to another array. For example if the initial array is: double[] initArray = {1.0, 2.0, 1.5, 5.0, 4.5}; then if I wanted to copy only 2nd, 4th and 5th attribute (i.e. values at these indices) the desired output array would be: double[] reducedArray = {2.0, 5.0, 4.5}; I know that if the indices appear in a sequential form, e.g. 1-3 then I can use System.arraycopy() but my indices does not have that aspect. So, is there any official way to do this, besides the trivial loop through each value and copy the ones needed: double[] includedAttributes = {1, 4, 5}; double[] reducedArray = new double[includedAttributes.length]; for(int j = 0; j &lt; includedAttributes.length; j++) { reducedArray[j] = initArray[includedAttributes[j]]; }
linked to: http://stackoverflow.com/q/2371568
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42831841
has comment: http://stackoverflow.com/comment/42830151

http://stackoverflow.com/q/27166281
tagged with: java
upvote count: 1
tagged with: web-services
type: Question
has title: Is WSDL 2.0 supported in eclipse?
tagged with: eclipse
tagged with: wsdl
downvote count: 0
favorite count: 0
has body: I am trying to generate a web service client for WSDL 2.0 web service, but, eclipse (Version: Luna Service Release 1 (4.4.1) Build id: 20140925-1800) does not seems to recognize wsdl 2.0 and expects a wsdl 1.0 syntax. As per eclipse installation details , It also has web tools platform version 3.6.1 support in it. Is there any way to enable eclipse to handle wsdl 2.0 ? Does eclipse supports wsdl 2.0 ? Thanks &amp; Regards Mandeep
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/42951370
type: Comment
comment on: http://stackoverflow.com/a/27237331
type: AnswerComment
has text: oh damn yeahhh!! cheers dude i see that now, thanks XD been working on this app solidly, guess i let that slip through the net ;)
score: 0

http://stackoverflow.com/q/27258095
upvote count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43275145
has body: I'm generating a list of locales and printing out their local display languages (i.e. printing out ja_JP as 日本語) using java.util.Locale. I noticed that both zh_CN (chinese simplified) and zh_TW (chinese traditional) localize as 中文 rather than 简体中文 and 繁体中文. Is there a way to get these locales to include the prefix characters for simplified and traditional without hard-coding that zh_CN should be 简体中文 and zh_TW should be 繁体中文? I know I could print out language + country (i.e. 中文 (中国), but that's not quite the same. Here's a java snippet demonstrating that they're the same: import java.util.Locale; public final class test { public static void main(String[] args) { Locale locale1 = new Locale("zh", "cn"); System.out.println( locale1.getDisplayLanguage(locale1)); System.out.println( locale1.getDisplayLanguage(Locale.TRADITIONAL_CHINESE)); System.out.println( locale1.getDisplayLanguage(Locale.SIMPLIFIED_CHINESE)); System.out.println( locale1.getDisplayCountry(locale1)); System.out.println( ""); Locale locale2 = new Locale("zh", "tw"); System.out.println( locale2.getDisplayLanguage(locale2)); System.out.println( locale2.getDisplayLanguage(Locale.TRADITIONAL_CHINESE)); System.out.println( locale2.getDisplayLanguage(Locale.SIMPLIFIED_CHINESE)); System.out.println( locale2.getDisplayCountry(locale2)); } }
downvote count: 0
type: Question
score: 9
tagged with: java
tagged with: chinese-locale
has title: How to get Chinese locale to display in chinese as specifically simplified or traditional
tagged with: locale
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27158522
type: Answer
has body: You can retrieve the data using : SharedPreferences sharedPreferences = context.getSharedPreferences("MYPREFS", context.MODE_PRIVATE); String username = sharedPreferences.getString("username", ""); String photo = sharedPreferences.getString("photo", ""); Also prefer using editor.apply()
upvote count: 2
has comment: http://stackoverflow.com/comment/42811303
score: 2
has comment: http://stackoverflow.com/comment/42811082
has comment: http://stackoverflow.com/comment/42812048
has comment: http://stackoverflow.com/comment/42811253
accepted answer of: http://stackoverflow.com/q/27158234
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27158234
downvote count: 0
has comment: http://stackoverflow.com/comment/42811842
has comment: http://stackoverflow.com/comment/42812021
has comment: http://stackoverflow.com/comment/42811785

http://stackoverflow.com/comment/76601664
comment on: http://stackoverflow.com/a/27306662
type: Comment
score: 1
type: AnswerComment
has text: Why not resolve everything simply by using `@Embedded`?

http://stackoverflow.com/a/27197690
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27193614
downvote count: 0
has body: After failing to produce a probabilistic solution, I came up with this brute-force approach that seems to produce correct results. For some strings, the total state space is quite big, but the algorithm will converge eventually :) It is probably not the most efficient solution, but it does seem to do the trick. The code below can be optimized quite a bit, but as an example it should be sufficient. #include &lt;iostream&gt; #include &lt;set&gt; #include &lt;functional&gt; #include &lt;boost/random/mersenne_twister.hpp&gt; #include &lt;boost/random/uniform_int_distribution.hpp&gt; // the input string for the random generator static const std::string input("hello_world"); // an "empty" character (something not present in the input string) static const char empty = '?'; // a constant with the input length (the only known fact about the input in the algorithm) static const unsigned length = input.length(); // randomization algorithm returning triplets std::string randomTriplet() { static boost::random::mt19937 gen; static boost::random::uniform_int_distribution&lt;&gt; dist(0, input.length()-1); std::set&lt;unsigned&gt; indices; while(indices.size() &lt; 3) indices.insert(dist(gen)); std::string result; for(auto i : indices) result.push_back(input[i]); return result; } // runs a functor for all possible combinations of input triplet acc to the rules void allCombinations(const std::string&amp; triplet, const std::function&lt;void(const std::string&amp;)&gt;&amp; functor) { for(unsigned a=0;a&lt;length-2;++a) for(unsigned b=a+1;b&lt;length-1;++b) for(unsigned c=b+1;c&lt;length;++c) { std::string tmp(length, empty); tmp[a] = triplet[0]; tmp[b] = triplet[1]; tmp[c] = triplet[2]; functor(tmp); } } // tries to merge two strings, and returns an empty string if it is not possible std::string putTogether(const std::string&amp; first, const std::string&amp; second) { std::string result(length, empty); for(unsigned a=0;a&lt;length;++a) if((first[a] == empty) || (first[a] == second[…

http://stackoverflow.com/comment/42899241
type: Comment
score: 1
has text: The URL is okay. The test I'm running just does a SELECT VERSION(), I'm not hitting a user-defined DB, just the postgreSQL system db which doesn't need to be specified. You are right though in that normally you do need a DB after the host.
comment on: http://stackoverflow.com/q/27206902
type: QuestionComment

http://stackoverflow.com/comment/43012570
type: Comment
comment on: http://stackoverflow.com/a/27270885
type: AnswerComment
has text: The processing is called multiple times during object life and there are different types of it. Can I surround each processing method code with try-finally (will it be a good practice)?
score: 0

http://stackoverflow.com/a/27235048
type: Answer
score: 2
upvote count: 2
has body: Well, it's very simple... let's get started. Thread Pool executes tasks. Tasks that are submitted to it are stored in the queue. A task implements the runnable interface, thus it has a run method that does not take any arguments and return void. This method acts as an entry point or the method that is called by the "thread that would be executing you task" in the thread pool. Now, back to the thread pool: a. Thread pool compromises of a internal queue could be ArrayBlockingQueue/LinkedBlockingQueue, etc... The main point is: it is always a queue. b. A group of threads that continuously poll this queue. The thread that executes your task looks like this some what void run() { while (true) { //Get the task from the thread pool internal queue (1) //Call the run method of the task. //If the execution of the task throws a Runtime exception - catch it and display it. (2) } } So, as u can see, the worker will only be free if there are no task in the queue. The worker would either be polling the queue for task (1) or executing the task (2).
answers question: http://stackoverflow.com/q/27234504
downvote count: 0

http://stackoverflow.com/a/33044325
answers question: http://stackoverflow.com/q/27294838
type: Answer
upvote count: 1
has body: Couldn't you change your @RequestMapping(value="/create", method=RequestMethod.POST) to @RequestMapping(value="/create", method=RequestMethod.POST, consumes ={"multipart/form-data"})
score: 1
downvote count: 0

http://stackoverflow.com/q/27169947
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27170024
accepted answer: http://stackoverflow.com/a/27192811
linked to: http://stackoverflow.com/q/21156929
upvote count: 3
linked to: http://stackoverflow.com/q/17953886
type: Question
has answer: http://stackoverflow.com/a/27223138
has body: I'm writing integration tests for a Mule ESB application which connects to an external API via HTTPS. I'd like to mock the external API and run an end-to-end integration test during the Maven build. My question is about setting up an embedded HTTPS server. I've tried to use Jersey, but it only provides HTTP. I was looking at this example https://github.com/jersey/jersey/tree/master/examples/https-clientserver-grizzly and I was wondering if there is still some manual step involved, or if it works automatically setting everything up every time the build is kicked off. Any suggestions or ideas? Edit. My final goal is to deploy a JAX-RS service in an embedded server which is accessible via HTTPS. And that needs no client-side keys/certificate configuration. Edit 2. Now my problem concerns certificates. The point of integration tests is to mock external components and verify that my application works. Now, if I set up an embedded HTTPS server and use a cmd-line built certificate, I need to add SSL configuration in the client (as @Ryan Hoegg pointed out). This is not what I would ideally want: Is there a solution to get it working without having to modify my client application code? This should be a general Java question that goes beyond Mule.
tagged with: grizzly
has answer: http://stackoverflow.com/a/27195173
has title: Embedded Java HTTPS server for integration testing
tagged with: java
tagged with: mule
linked to: http://stackoverflow.com/q/14362245
possible better answer: http://stackoverflow.com/a/27195173
tagged with: jersey
has answer: http://stackoverflow.com/a/27192811
downvote count: 0
linked to: http://stackoverflow.com/q/27255015
favorite count: 0
score: 3

http://stackoverflow.com/q/27272276
has title: Doesn't working predicat of logical and (&&) in while
tagged with: java
tagged with: loops
downvote count: 1
type: Question
score: -1
has comment: http://stackoverflow.com/comment/43014568
answer count: 2
tagged with: while-loop
has answer: http://stackoverflow.com/a/27272737
has body: public void ReadPixels(String path, FormController form){ Image image = new Image(path); PixelReader reader = image.getPixelReader(); int x = 0; int y = 0; int stopX = 0; int stopY = 0; while(x != form.canvas.getWidth()-1 &amp;&amp; y != form.canvas.getHeight()-1){ while(x &lt; stopX+20-1 &amp;&amp; y &lt; stopY+25-1){ int argb = reader.getArgb(x, y); int r = (argb &gt;&gt; 24) &amp; 0xFF; int g = (argb &gt;&gt; 8) &amp; 0xFF; int b = argb &amp; 0xFF; Pixels pixel = new Pixels(r,g,b); Pixels[][] array = new Pixels[20][25]; Matrix matrix = new Matrix(); array[x][y] = pixel; matrix.setArray(array); if(x != stopX+20-1){ x++; } if(y != stopY+25-1){ y++; } } x++; y++; stopX=x; stopY=y; } } I have a problem. In the while loop, when x increments to 19, the while goes out of its block. WHY?? In while situated logical AND &amp;&amp;. It means that loop will be over when the first and the second part of the expression will be FALSE
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27272840
type: UnansweredQuestion

http://stackoverflow.com/q/27255994
has comment: http://stackoverflow.com/comment/42985804
accepted answer: http://stackoverflow.com/a/27256069
tagged with: java
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4885620
tagged with: android-orientation
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27256069
has body: I'm working on an android Amazon Fire TV app, and for debug purposes, I'd like to force a portrait view orientation inside of the permanent landscape 16:9 display. Is this possible? How would I go about doing this? Thanks, Thomas
has title: Android - Force portrait view in landscape orientation
score: 0
answer count: 1

http://stackoverflow.com/q/27277051
has title: How to compress any picture?
type: UnansweredQuestion
tagged with: io
tagged with: java
tagged with: compression
type: Question
has comment: http://stackoverflow.com/comment/43023086
has comment: http://stackoverflow.com/comment/43023243
has answer: http://stackoverflow.com/a/27277185
tagged with: image
score: 0
has comment: http://stackoverflow.com/comment/43023143
has comment: http://stackoverflow.com/comment/43045970
answer count: 1
has body: Our site have a posibility to load user pictures. User can load absolutely any file(we believe that it will a picture at the moment). On page we show a lot of pictures thus we have a huge internet traffic. we want to compress pictures on server. I have found following article about picture compressing. How to compress jpg file? But there are explained how to compress concrete format. Is there universal way for compressing any picture?

http://stackoverflow.com/comment/43045066
score: 0
type: Comment
has text: Can you give me some examples for FlowPanel.
comment on: http://stackoverflow.com/a/27289332
type: AnswerComment

http://stackoverflow.com/a/27201296
type: Answer
has body: Or simply make following changes int lungmax=1; and replace lungmax=lung with lungmax++; and remove last lungmax=lungmax++ plus what Tom suggested : k&lt;30-1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27201197
upvote count: 1

http://stackoverflow.com/comment/43000868
comment on: http://stackoverflow.com/a/27175622
has text: yeah I updated my servlet with your code .. neither it is showing any error ,nor It is updating property file .
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27210685
has comment: http://stackoverflow.com/comment/42902838
upvote count: 2
answers question: http://stackoverflow.com/q/27210560
type: Answer
has comment: http://stackoverflow.com/comment/93782596
score: 2
has comment: http://stackoverflow.com/comment/93782199
has body: As noted by @Elliot Frisch, they are all "deterministic" and will iterate in the same order if nothing has changed. That said, to paraphrase Animal House, some collections are more deterministic than others. :-) Hash... collections have a deterministic iteration order which the JVM can "predict", but is very challenging for a human to predict and not worth the effort. In practice, they are not "predictable". As @Mureinik points out, the order is officially "unspecified" and subject to change of you change JVMs. The API docs describe this as "generally chaotic ordering" and all sane programmers would agree. Linked... collections have "predictable iteration order" in that they iterate in the order elements were inserted, with the important caveat that if you insert the same element twice it retains the original order. i.e. add("Tom"); add("Fred"); add("Tom"); would iterate "Tom", "Fred", not "Fred", "Tom" This is clearly "more predictable" than Hash..., but still a bit challenging if elements get inserted multiple times and ordering is crucial. For stuff like properties files, XML, or JSON, Linked... collections are generally a good choice as they maintain the original order for nicer human viewing and comparison. Tree... collections iterate the "most predictably", using the ordering provided by a Comparator at construction time, or else the "natural ordering" if the elements are Comparable. Assuming you have a predicable comparison method, they are completely predictable. In the Tom/Fred example, it would always iterate as "Fred", "Tom", unless your Comparator is unusual.
downvote count: 0

http://stackoverflow.com/a/27179796
has comment: http://stackoverflow.com/comment/42868470
has comment: http://stackoverflow.com/comment/42920029
type: Answer
has comment: http://stackoverflow.com/comment/42861120
has body: You aren't checking a single readLine() result for null. As a result, you have no hope of detecting a peer disconnect in the normal way. Every time you call readLine(), the first thing you must do is check for null, and if so close the socket and bail out. Your exception handling is also poor. Code that depends on the success of code in a try block should be inside the same try block.
has comment: http://stackoverflow.com/comment/42860492
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27178923
downvote count: 0

http://stackoverflow.com/q/27283768
has body: Trying to do a proof of concept using a trial version of XFA Worker. When I attempt to convert a XFA document I constructed, I get a java.lang.ClassCastException: com.itextpdf.tool.xml.xtra.xfa.positioner.FieldPositioner cannot be cast to java.lang.String error occuring when the com.itextpdf.tool.xml.xtra.xfa.XFAFlattener.flatten method is called? Any ideas on what the issue(s) might be would be helpful.
answer count: 0
type: UnansweredQuestion
tagged with: itext
tagged with: xfa
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43042119
has comment: http://stackoverflow.com/comment/43041106
has comment: http://stackoverflow.com/comment/43059412
has title: Cast exception with FieldPosition in XFAFlattener
has comment: http://stackoverflow.com/comment/43036228

http://stackoverflow.com/comment/42902708
score: 0
type: Comment
has text: That would be false, right? The left operand creates a new integer object while the right's valueOf method creates a new integer object with a val of 1024, caches it, and returns a reference to the cached object.
type: AnswerComment
comment on: http://stackoverflow.com/a/27210292

button
tags question: http://stackoverflow.com/q/27266565
tags question: http://stackoverflow.com/q/27198796
tags question: http://stackoverflow.com/q/27292138
tags question: http://stackoverflow.com/q/27304344
type: Tag
tags question: http://stackoverflow.com/q/27295505
tags question: http://stackoverflow.com/q/27181119
tags question: http://stackoverflow.com/q/27156734
tags question: http://stackoverflow.com/q/27276084
tags question: http://stackoverflow.com/q/27173174
tags question: http://stackoverflow.com/q/27160543
tags question: http://stackoverflow.com/q/27235261
tag name: button

http://stackoverflow.com/comment/43077291
comment on: http://stackoverflow.com/a/27306372
score: 0
type: Comment
has text: Sorry, I'm not good at english. I should use more codes to read file in each fileReader methods and close file in current method, and should not just call all-in-one method "ByteArrayInputStream loadFile(String path)" to do that for each fileReader method. my english... --!
type: AnswerComment

http://stackoverflow.com/comment/42874311
type: QuestionComment
comment on: http://stackoverflow.com/q/27194445
has text: Is using an `ArrayList` the only way to do this? My professor recommended not to because he wants us to learn the actual concepts of arrays. I was hoping to make this into an Object and return it and print the array of words. Would that make sense?
score: 0
type: Comment

http://stackoverflow.com/a/27171987
answers question: http://stackoverflow.com/q/27171901
score: 1
downvote count: 0
has body: If it's currency and always to 2 dp, you could multiple it by 100. However as Davio comments, your code should make it clear why you're doing it. If you want to convert, for example a price in GB pounds sterling to GB pence (100 pence in a pound) then multiplying it by 100 is the right thing to do.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42936292
type: Comment
comment on: http://stackoverflow.com/a/27229658
type: AnswerComment
has text: @Rich s answer provides more flexible way of controlling desired parameters though.
score: 0

http://stackoverflow.com/a/27154458
downvote count: 0
score: 1
has body: Regarding Oracle: select * from V$RESERVED_WORDS where keyword = 'VERSION'; KEYWORD LENGTH RESERVED RES_TYPE RES_ATTR RES_SEMI DUPLICATE -------------------- ---------- -------- -------- -------- -------- --------- VERSION 7 N N N N N this query checks if the 'VERSION' is a keyword (you may need some special privileges to select from this view) Here is a description of this view: https://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2048.htm#REFRN30204 Column Datatype Description KEYWORD VARCHAR2(30) Name of the keyword LENGTH NUMBER Length of the keyword RESERVED VARCHAR2(1) A value of Y means that the keyword cannot be used as an identifier. A value of N means that it is not reserved. RES_TYPE VARCHAR2(1) A value of Y means that the keyword cannot be used as a type name. A value of N means that it is not reserved. RES_ATTR VARCHAR2(1) A value of Y means that the keyword cannot be used as an attribute name. A value of N means that it is not reserved. RES_SEMI VARCHAR2(1) A value of Y means that the keyword is not allowed as an identifier in certain situations, such as in DML. A value of N means that it is not reserved. DUPLICATE VARCHAR2(1) A value of Y means that the keyword is a duplicate of another keyword. A value of N means that it is not a duplicate. According to this information, 'VERSION' is a keyword, but you can use it as an identifier.
answers question: http://stackoverflow.com/q/27154071
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42992272
type: AnswerComment
comment on: http://stackoverflow.com/a/27259359
type: Comment
has text: I'm not sure that this will avoid the `ArrayIndexOutOfBoundsException`, because `i` will be increased until `i == randomTable.length`. Therefore, `i+3` is still out of bounds.
score: 0

http://stackoverflow.com/comment/42817715
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27162079
has text: Your direction is in some way right, you're miles away though. `.java` needs to be compiled into bytecode before the virtual machine can understand it, with desktop java you could be using something like http://stackoverflow.com/questions/2158429/compiling-and-running-user-code-with-javacompiler-and-classloader - for android you can't do just that you'll have to provide special `dex` bytecode for the DalvikVM (or now ART, which I guess can convert dex to it's own thing on the fly?). For that you'd need either a compiler from java to dex directly or like the dx tool convert desktop .class files
score: 0

http://stackoverflow.com/a/37272452
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27254302
has comment: http://stackoverflow.com/comment/62107108
downvote count: 0
has body: HashMap hm =new HashMap(); hm.put("01","one"); hm.put("02","two"); hm.put("03","one"); hm.put("04","one"); hm.put("05","two"); HashMap newHm = new HashMap(); Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry)it.next(); System.out.println(pair.getKey() + " = " + pair.getValue()); if(newHm.containsKey(pair.getValue())){ newHm.put(pair.getValue(), Integer.parseInt(newHm.get(pair.getValue()).toString())+1 ); }else{ newHm.put(pair.getValue(),1 ); } it.remove(); // avoids a ConcurrentModificationException }
has comment: http://stackoverflow.com/comment/62071247
type: Answer

http://stackoverflow.com/comment/42919855
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27220369
has text: I am trying to make a 4-in-arow game. I use the alphabeta pruning algorithm from the psuedocode on wikipedia. Assuming the alphabeta algorithm is correct, how do you actually use it to make a move?

http://stackoverflow.com/comment/42974253
score: 0
type: QuestionComment
type: Comment
has text: The purpose of the task is to get Hibernate's schema updates (not run them). Since everything is configured with Spring, I'd like to not repeat any configs, but use the project's natural configuration.
comment on: http://stackoverflow.com/q/27249157

http://stackoverflow.com/a/27257290
score: 0
answers question: http://stackoverflow.com/q/27255789
type: Answer
has body: Perhaps there might be some error in your trigger building. Check if this solves your purpose public static void main(String[] args) throws SchedulerException, ParseException { SchedulerFactory schedFact = new StdSchedulerFactory(); Scheduler sched = schedFact.getScheduler(); sched.start(); JobDetail sysJob = JobBuilder.newJob(HelloJob1.class) .withIdentity(new JobKey("sysJob")).build(); Trigger sysTrigger = TriggerBuilder .newTrigger() .withIdentity(new TriggerKey("sysTrigger")) .withSchedule(dailyAtHourAndMinute(0, 51)) .startNow() .build(); sched.scheduleJob(sysJob, sysTrigger); JobDetail histJob = JobBuilder.newJob(HelloJob2.class) .withIdentity(new JobKey("histJob ")).build(); Trigger sysTrigger2 = TriggerBuilder .newTrigger() .withIdentity(new TriggerKey("sysTrigger2")) .withSchedule(dailyAtHourAndMinute(0, 52)) .startNow() .build(); sched.scheduleJob(histJob, sysTrigger2); } private static CronScheduleBuilder dailyAtHourAndMinute(int hour,int minute){ return CronScheduleBuilder.dailyAtHourAndMinute(hour, minute); }

http://stackoverflow.com/comment/42803844
comment on: http://stackoverflow.com/q/27154160
type: QuestionComment
has text: You should have posted your actual (non-working) code so that you could have fixed it. https://stackoverflow.com/help/how-to-ask
score: 0
type: Comment

http://stackoverflow.com/comment/42912311
score: 0
comment on: http://stackoverflow.com/a/27215356
type: Comment
has text: Is that the main class I could just copy and paste and then change 256 to 128?
type: AnswerComment

http://stackoverflow.com/a/27242974
has comment: http://stackoverflow.com/comment/42962024
has body: I suggest that make the EditText field as a text android:inputType="text" then do the conversion. Try this: String sNumberByUser = numberbyUser.getText().toString(); Double number = 0.0; try{ if(!sNumberByUser.equals("")){ // This will accept decimal and non-decimal number number = Double.parseDouble(sNumberByUser); //do your process here }else{ throw new NumberFormatException(); } //Catch if not a number. }catch(NumberFormatException nfe){ message = "Please Enter a Number !!"; DialogFunction(); }
score: 0
has comment: http://stackoverflow.com/comment/42962335
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42963319
has comment: http://stackoverflow.com/comment/42962143
has comment: http://stackoverflow.com/comment/42962356
type: Answer
has comment: http://stackoverflow.com/comment/43425930
has comment: http://stackoverflow.com/comment/43425954
accepted answer of: http://stackoverflow.com/q/27242689
has comment: http://stackoverflow.com/comment/43003305
answers question: http://stackoverflow.com/q/27242689
has comment: http://stackoverflow.com/comment/43003207
has comment: http://stackoverflow.com/comment/42962792

http://stackoverflow.com/comment/42918609
comment on: http://stackoverflow.com/a/27219620
type: Comment
has text: Welcome, and you're welcome. :) See my edit for a more detailed example of how you might improve your MediaPlayer playback handling.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27268586
tagged with: model
tagged with: vbo
type: AnsweredQuestion
has body: I am making a 3D game that has a player with the follow cam. Before I started using real models I used the cube and I rendered it using displaylist and it everything moved fine. However, now that I am importing full 3D models with many more vertices, I looked into VBOs. I have a full structure setup for my VBOs and I can see the model drawn initially but it is drawn at the center of the game world. When I move the player, the model doesn't translate as it should. The model doesn't move its position. Here is the code that I used initially to draw the player as a rectangle (which works): public static void drawRectPrism(float centerx, float centery, float centerz, float length, float height, float width, float rx, float ry, float rz) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); { glTranslatef(centerx, centery, centerz); glRotatef(rx, 1, 0, 0); glRotatef(ry, 0, 1, 0); glRotatef(rz, 0, 0, 1); glTranslatef(-centerx, -centery, -centerz); glTranslatef(-length/2f, -height/2f, -width/2f); glBegin(GL_QUADS); { glColor3f(1.0f, 0, 0); glVertex3f(centerx, centery, centerz); glVertex3f(centerx + length, centery, centerz); glVertex3f(centerx + length, centery + height, centerz); glVertex3f(centerx, centery + height, centerz); glColor3f(0, 1.0f, 0); glVertex3f(centerx, centery, centerz + width); glVertex3f(centerx + length, centery, centerz + width); glVertex3f(centerx + length, centery + height, centerz + width); glVertex3f(centerx, centery + height, centerz + width); glColor3f(0, 0, 1.0f); glVertex3f(centerx, centery, centerz); glVertex3f(centerx, centery + height, centerz); glVertex3f(centerx, centery + height, centerz + width); glVertex3f(centerx, centery, centerz + width); glColor3f(0, 1.0f, 1.0f); glVertex3f(centerx + length, centery, centerz); glVertex3f(centerx + length, centery + height, centerz); glVertex3f(centerx + length, centery + height, centerz + width); glVertex3f(centerx + length, centery, centerz + width); glColor3f(1.0f, 1.0f, 0); glVertex3f(centerx, centery, c…
score: 1
tagged with: java
has title: Problems dynamically moving VBO
tagged with: lwjgl
upvote count: 1
has answer: http://stackoverflow.com/a/27279250
type: Question
tagged with: 3d
downvote count: 0
accepted answer: http://stackoverflow.com/a/27279250
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27208699
downvote count: 0
has body: Latest pocketsphinx demo includes phonetic recognition mode activated with "phones" search, see the source for details: https://github.com/cmusphinx/pocketsphinx-android-demo To use it with French you need to update it with French acoustic model: http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F0%20Broadcast%20News%20Acoustic%20Model/lium_french_f0.tar.gz/download And with french phonetic language model: http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20Language%20Model/fr-phone.lm.dmp/download Like this: recognizer = defaultSetup() .setAcousticModel(new File(modelsDir, "hmm/french"); .setBoolean("-allphone_ci", true) .getRecognizer(); // Phonetic search File phoneticModel = new File(modelsDir, "phone/fr-phone.lm.dmp"); recognizer.addAllphoneSearch(PHONE_SEARCH, phoneticModel); I doubt it will work well on Glass though, it doesn't seem to be very powerful device.
upvote count: 3
answers question: http://stackoverflow.com/q/27190486
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/42905147

http://stackoverflow.com/a/27215165
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42938451
accepted answer of: http://stackoverflow.com/q/27153549
answers question: http://stackoverflow.com/q/27153549
downvote count: 0
type: Answer
score: 3
has body: The Java code you use generates a "raw" signature as defined in PKCS#1 (using the PKCS#1 v1.5 signature scheme) and SHA-1. Your C++ code generates a PKCS#7 (CMS) signature. This is a signature that is wrapped in a container format together with the message, as you can see <a href="http://lapo.it/asn1js/#3082017706092A864886F70D010702A082016830820164020103310F300D06092A864886F70D0101050500300B06092A864886F70D0107013182013F3082013B02010380149FCEDC635753F7028B0E7F73759BB446B9B48F9E300D06092A864886F70D0101050500300D06092A864886F70D010101050004820100CA83D39F7DD9FDCD4FD3906863A08E5BE56B6C6E4C4ECA20D9884DAD791B572DCF7D742D1114388FD0572A73C089D62630F68EC724FF2E1F83DD9CA25E6B41C20578A0C308A783E7323E4C3BBED908673CE8DCD84DBCA4D05A8B24588C011FFEDA1F5F12C55DDCD425722DE0C451D23B6B650C3A6940178F8E5DFD9D73E592B7D4A91C6DAFB7060CB57A997EE22399EE2972CA81BCB09A4541E0D4F5E6F6D3A8B41A08C309AD1A4DA798E0DCD1B5EEED4BB617DE3B0AE4364E1213A7F17E8C99394EA643E0026D80889F79580B056D1CB0EFA0C0E19A35AF832050C1F48DAF94A53F1E6A88F499ACF83B00EDACBEA98D78489BBD6D583E97E294D83CDCC59E3A" rel="nofollow">here. If you hex encode the signature that is contained in the PKCS#7 signature you will see the same value as you generated in Java. They both generate the following signature (using hex as representation): CA83D39F7DD9FDCD4FD3906863A08E5BE56B6C6E4C4ECA20D9884DAD791B572DCF7D742D1114388FD0572A73C089D62630F68EC724FF2E1F83DD9CA25E6B41C20578A0C308A783E7323E4C3BBED908673CE8DCD84DBCA4D05A8B24588C011FFEDA1F5F12C55DDCD425722DE0C451D23B6B650C3A6940178F8E5DFD9D73E592B7D4A91C6DAFB7060CB57A997EE22399EE2972CA81BCB09A4541E0D4F5E6F6D3A8B41A08C309AD1A4DA798E0DCD1B5EEED4BB617DE3B0AE4364E1213A7F17E8C99394EA643E0026D80889F79580B056D1CB0EFA0C0E19A35AF832050C1F48DAF94A53F1E6A88F499ACF83B00EDACBEA98D78489BBD6D583E97E294D83CDCC59E3A You need a code that generates a PKCS#1 signature instead of a PKCS#7 (CMS) container, for instance try the sample code of CryptSignHash that also defaults to the PKCS#1 v1.5 signature scheme and SHA…

http://stackoverflow.com/a/27201334
answers question: http://stackoverflow.com/q/27200994
score: 0
has body: For parsing json to java there are simple step. Below code snippet may help you. // parse json to java Object obj = parser.parse(s); JSONObject json = (JSONObject) obj; JSONObject o = (JSONObject) json.get("config"); //get json array. JSONArray array = (JSONArray) o.get("valueColumns"); System.out.println(array.toJSONString()); //access element by index System.out.println(array.get(0));
type: Answer

program-entry-point
tags question: http://stackoverflow.com/q/27172448
tag name: program-entry-point
type: Tag
tags question: http://stackoverflow.com/q/27279594
tags question: http://stackoverflow.com/q/27204100

http://stackoverflow.com/q/27188076
type: UnansweredQuestion
upvote count: 4
downvote count: 0
tagged with: java
tagged with: orm
tagged with: garbage-collection
type: Question
has body: Building a Spring application that fetches data from web using an API I bumped multiple times into OutOfMemoryError: GC overhead limit exceeded. After some profiling sessions I started to question my model, which is something like this: @Entity class A { @Id private Integer id; private String name; @OneToMany private Set&lt;B&gt; b1; @OneToMany private Set&lt;B&gt; b2; } @Entity Class B { @Id private Integer id; @ManyToOne private A a1; @ManyToOne private A a2; } There is a CrudRepository assigned to manage these entities (JPA + EclipseLink). Entity loading is default, which in this case means eager AFAIK. The program attempts to do the following: // populates the set with 2500 A instances. Set&lt;A&gt; aCollection = fetchAFromWebAPI(); for (A a : aCollection) { // populates b1 and b2 of each A with a 100 of B instances fetchBFromWebAPI(a); aRepository.save(a); } By the end of this process there would be 500k B instances, except it never reaches the end because of OutOfMemoryError: GC overhead limit exceeded. Now I could add more memory, but I want to understand why all these instances aren't garbage collected? Save an A to the database and forget it. Is this because A instances have B instances in their b1 or b2 that in their turn reference A instances? Another observation I made is that the process runs significantly more smoothly for the first time, when there is no data in database. Is there something fundamentally wrong with this model or this process?
score: 4
tagged with: memory
has title: Are JPA entities that are not in use garbage collected and why?
answer count: 2
tagged with: profiling
favorite count: 0
has answer: http://stackoverflow.com/a/27188252
has answer: http://stackoverflow.com/a/27188224

http://stackoverflow.com/q/27249393
tagged with: average
type: Question
score: -1
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/42973153
has body: Beginning to get frustrated here. Self thought noob here. I'm following "java how to program" by John Deitel book, and some pretty random docs that a friend of mine (former CS student) sent me. I have written code to calculate averages of ints which worked fine. Then I wanted to test it in doubles, but keep getting error, even if the "Tool completed successfully" when I press ctrl+1.I have since found other people's codes that do the same task, which I kind of understand, but I want know what's wrong with my code. I have tried setting racecounter to double as well to remove average = (double) total / raceCounter;, which resulted in more errors. import java.util.Scanner; public class RaceAvgNoNamesDouble { public static void main( String[] args) { Scanner input = new Scanner( System.in ); double total; int raceCounter; double racetime; double average; total = 0; raceCounter = 0; System.out.print( "Enter race time or -1 calculate: "); racetime = input.nextDouble(); while (racetime != -1) { total = total + racetime; raceCounter = raceCounter + 1; System.out.print( "Enter race time or -1 calculate: "); racetime = input.nextDouble(); } if ( raceCounter != 0) { average = (double) total / raceCounter; System.out.printf( "\nTotal of the %d races entered %d\n", raceCounter, total ); System.out.printf( "Race average is %.2f\n", average); } else System.out.println( "No races were entered"); } }
answer count: 3
upvote count: 0
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/27249539
has title: average of array error (worked with int)
has answer: http://stackoverflow.com/a/27249532
possible better answer: http://stackoverflow.com/a/27249526
tagged with: time
has answer: http://stackoverflow.com/a/27249526
has comment: http://stackoverflow.com/comment/42973026
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42973048
tagged with: java
accepted answer: http://stackoverflow.com/a/27249539
downvote count: 1

http://stackoverflow.com/comment/42951294
comment on: http://stackoverflow.com/a/27236179
has text: Thank you for your answer. Actually, the app stops working correctly. For example I have a count of 12260161 Documents in the Database when the primary server fails: "rs0":SECONDARY> db.test_collection.find().count() 12260161 When the secondary switches to primary, the count stays the same and the app does not perform any insert Operations: "rs0":PRIMARY> db.test_collection.find().count() 12260161
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27275992
has answer: http://stackoverflow.com/a/28042204
type: Question
has body: I'd like to start using Aspects within my Java code and found a RetryOnFailure annotation that I decided would be my first one. At first my POM file showed an error, but through some research it seems that m2e in eclipse doesn't know when to run/build so I had to add a lifecycleMappingMetadata to my POM that got me past that. However I still get an error in the class file on the Annotation within Eclipse. Any idea how to get past that would be greatly appreciated. Relevant piece of class file: @RetryOnFailure(attempts = 2, delay = 10, verbose = false) private static LeadQualificationResponse callLeadQualificaiton(LeadQualificationRequest leadQualificationRequest, MidasStub midasStub) throws RemoteException { LeadQualificationResponse leadQualificationResponse = null; leadQualificationResponse = midasStub.leadQualification(leadQualificationRequest); return leadQualificationResponse; } Snippets of POM: org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> com.jcabi jcabi-maven-plugin [0.8,) ajc false </lifecycleMappingMetadata> maven-compiler-plugin 3.1 1.6 1.6 com.jcabi jcabi-maven-plugin 0.8 ajc I've also tried to set the runOnIncremental to true and get the following error in the POM file on the execution element Execution default of goal com.jcabi:jcabi-maven-plugin:0.8:ajc failed: A required class was missing while executing com.jcabi:jcabi-maven-plugin:0.8:ajc: Lorg/sonatype/aether/RepositorySystemSession; realm = plugin>com.jcabi:jcabi-maven-plugin:0.8 strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy urls[0] = file:/C:/Users/Jeffrey/.m2/repository/com/jcabi/jcabi-maven-plugin/0.8/jcabi-maven-plugin-0.8.jar urls[1] = file:/C:/Users/Jeffrey/.m2/repository/com/jcabi/jcabi-log/0.7.22/jcabi-log-0.7.22.jar urls[2] = file:/C:/Users/Jeffrey/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar urls[3] = file:/C:/Users/Jeffrey/.m2/repository/org/aspectj/aspectjrt/1.7.3/aspectjrt-1.7.3.jar urls[4] = file:/C:/Users/Jeffrey/.m2/repository/org…
tagged with: eclipse
tagged with: m2eclipse
tagged with: aspectj-maven-plugin
has title: Attempting to get aspect annotation recognized by eclipse luna while using m2e (maven) build
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java

http://stackoverflow.com/q/27282855
accepted answer: http://stackoverflow.com/a/27464206
type: Question
has answer: http://stackoverflow.com/a/27464206
score: 7
tagged with: java
tagged with: hibernate
has title: JPA Change Event on Entity Graph [EclipseLink]
upvote count: 7
tagged with: jpa
answer count: 1
favorite count: 0
has body: Can I by only using JPA somehow keep track of a whole Entity-Graphs state? Consider having a Hierarchy with two or three classes in them with at least one Collection. By using JPA @Post... Annotations I can only keep track of the actual entity and not its children and or Collections as it is pretty much just the Data-Base Event wrapped. I know Hibernate can do that, but I don't want to rely on the implementation of the JPA for doing this. I would be pretty happy if there was a way to do this with EclipseLink at least.
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/27174219
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27173053
has body: you can try it out this way... String WebelementforUIvalue = null; try{ WebelementforUIvalue = driver.findElement(By.id("ctl00_MainContent_AllowanceGridView_SRow"+cellRosterPerioddd+cellRosterPeriodmm+"_"+PayBucket)).getAttribute("value"); } catch(NoSuchElementException nsee) { WebelementforUIvalue = "0.0"; } System.out.println(WebelementforUIvalue);

http://stackoverflow.com/q/27217050
has answer: http://stackoverflow.com/a/27556242
favorite count: 0
has comment: http://stackoverflow.com/comment/80635931
has title: Calling an overridable method in constructor is bad. Are there exceptions?
tagged with: constructor
tagged with: convention
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27217092
linked to: http://stackoverflow.com/q/3404301
tagged with: java
type: Question
has body: I was wondering if there are cases where calling public or, in this case and particularly, protected methods in the constructor of an abstract class would be ok, or at least forgivable, given an adequate documentation of the intentions of the method. My actual question concerns an abstract class IdentifiedConnection that looks like this: public abstract class IdentifiedConnection extends Connection { private UUID uuid; public IdentifiedConnection(String serverAddress, int port) throws IOException { super(serverAddress, port); this.uuid = this.aquireIdentifier(); } public UUID getIdentifier() { return this.uuid; } protected abstract UUID aquireIdentifier() throws IOException; } My intention is to get a UUID identifier from the server. If the server responds with a valid UUID, we set that UUID in the field of this class (named uuid). If the server responds with a non-UUID message, we assume that the server is unreachable for some reason and throw an IOException. Generally I understand that calling an overridable method from the constructor is bad, since it leaves the class prone to various more or less hard-to-detect bugs. However, in this case I feel like doing this isn't actually too bad (as long as I javadoc the hell out of it). What's your thoughts? Is this still a really bad idea? What alternative way of doing this do you suggest if you think this is bad? I have left the code for the Connection class out of this question as I think it's irrelevant.
tagged with: overriding
score: 4
accepted answer: http://stackoverflow.com/a/27217092
upvote count: 4
tagged with: abstract-class
answer count: 2
possible better answer: http://stackoverflow.com/a/27556242
downvote count: 0

http://stackoverflow.com/comment/42856666
type: AnswerComment
has text: This is absolutely a viable solution and many people will live happy with this (but code should be changed: if lengths differ by 1 then they may be considered equal). That said future readers must be aware this isn't UNICODE aware. It may not be an issue (if strings contain only ASCII characters) but every programmer working with strings should be aware of other issues.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27174797

http://stackoverflow.com/a/27273392
downvote count: 0
score: 1
has body: It is a Conditional operator also known as Ternary operator. It is simply the compact form of if else statement wherein you don't have to use if and else separately. Here's how it works... "?"- anything written before the"?" is the condition ":"- anything written before the ":" is chosen as the result if the condition mentioned before "?" is true anything written after the ":" is chosen as the result if the condition mentioned before "?" is false This is how it works... So splitting the given code into if/else can be easily done as follows - if (row &lt;= -1 || row == rows || col &lt;= -1 || col == cols) { return false; } else { return lifeBoard[row][col]; }
upvote count: 1
answers question: http://stackoverflow.com/q/27153777
type: Answer

http://stackoverflow.com/a/27194203
score: 1
answers question: http://stackoverflow.com/q/27194138
downvote count: 0
type: Answer
has body: If you want this to work, then you have to go through the inputs twice, once to calculate the mean and once to work out which ones exceed it. When you read in the first value, you have no idea what the mean is, so you can't decide whether it's greater than it! The key point is that the mean is a property of the inputs as a whole, so until you've considered them all, you can't know the mean.
upvote count: 1

http://stackoverflow.com/comment/42892669
comment on: http://stackoverflow.com/q/27204977
has text: You are mixing a lot of concepts here; The characteristic of a COW list is that it is thread safe; the characteristic of a Collections.unmodifiableList() is that it disables modifications for that list.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43263700
comment on: http://stackoverflow.com/a/27409342
has text: Is there a way to change the top level name? I don't want to show the package.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42918711
has text: I just gave you an example of the code... you need to implement your condition, because I don't know what is your logic in this :)
type: Comment
comment on: http://stackoverflow.com/a/27219422
type: AnswerComment
score: 0

http://stackoverflow.com/a/27205075
type: Answer
score: 2
downvote count: 0
has body: The javadoc of CopyOnWriteArrayList states A thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array. While the javadoc of Collections#unmodifiableList(List) states Returns an unmodifiable view of the specified list. This method allows modules to provide users with "read-only" access to internal lists. Query operations on the returned list "read through" to the specified list, and attempts to modify the returned list, whether direct or via its iterator, result in an UnsupportedOperationException. So, no, you can't get the features provided by CopyOnWriteArrayList with a List returned by Collections#unmodifiableList(List).
answers question: http://stackoverflow.com/q/27204977
upvote count: 2

http://stackoverflow.com/comment/42919413
type: Comment
has text: never, ever use the default table model. Create your own derived from AbstractTableModel
comment on: http://stackoverflow.com/a/27217570
score: 0
type: AnswerComment

http://stackoverflow.com/comment/95547617
score: 0
type: AnswerComment
has text: I faced the same problem when trying to set break point at some hotspot function and it works perfectly. But setting catchpoint e.g. `catch syscall futex` and printing its `backtrace` still crashes with `frame.c:534: internal-error: frame_id get_frame_id(frame_info*): Assertion 'fi->level == 0' failed.`. Do you have any idea how to workaround this?
comment on: http://stackoverflow.com/a/27242060
type: Comment

android-graphview
tags question: http://stackoverflow.com/q/27273570
type: Tag
tag name: android-graphview

http://stackoverflow.com/comment/42966006
type: AnswerComment
comment on: http://stackoverflow.com/a/27245117
type: Comment
has text: Also found the official javadoc for [ServerInfo](http://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/util/ServerInfo.html).
score: 1

http://stackoverflow.com/a/27254652
downvote count: 0
has comment: http://stackoverflow.com/comment/42985840
type: Answer
has comment: http://stackoverflow.com/comment/42987217
has comment: http://stackoverflow.com/comment/42985912
has comment: http://stackoverflow.com/comment/42985423
has comment: http://stackoverflow.com/comment/109401922
score: 22
answers question: http://stackoverflow.com/q/27254152
upvote count: 22
has body: What you are saying is true. Marking a field as final forces the compiler to complete initialization of the field before the constructor completes. There is no such guarantee however for non-final fields. This might seem weird, however there are many things done by the compiler and JVM for optimization purposes such as reordering instructions, that cause such stuff to occur. The final keyword has many more benefits. From the Java Concurecncy in Practice: Final fields can't be modified (although the objects they refer to can be modified if they are mutable), but they also have special semantics under the Java Memory Model. It is the use of final fields that makes possible the guarantee of initialization safety (see Section 3.5.2) that lets immutable objects be freely accessed and shared without synchronization. The Books says then: To publish an object safely, both the reference to the object and the object's state must be made visible to other threads at the same time. A properly constructed object can be safely published by: Initializing an object reference from a static initializer; Storing a reference to it into a volatile field or AtomicReference; Storing a reference to it into a final field of a properly constructed object; or Storing a reference to it into a field that is properly guarded by a lock.
has comment: http://stackoverflow.com/comment/42983264

http://stackoverflow.com/comment/42818624
score: 0
comment on: http://stackoverflow.com/q/27162791
has text: Did you try another `else`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27300763
score: 1
has comment: http://stackoverflow.com/comment/43065328
has body: If you want to count the words of the line you should do this: public void counting() { int wordCount = 0; while (file.hasNextLine()) // to count lines { Clines++; Scanner line = new Scanner (file.nextLine()); wordCount += line.split(" ").length; } }
upvote count: 1
has comment: http://stackoverflow.com/comment/43065420
answers question: http://stackoverflow.com/q/27300623
type: Answer
has comment: http://stackoverflow.com/comment/43068392
downvote count: 0

http://stackoverflow.com/q/27243280
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42965074
type: Question
has title: Facebook Fetching friends in custom layout
upvote count: 2
has comment: http://stackoverflow.com/comment/42967128
downvote count: 1
tagged with: facebook-graph-api
favorite count: 0
has body: I am trying to fetch all the facebook friends in my custom layout. I have updates all the libraries and jar files as well as the new FB sdk version.. still i am facing this error.. can someone please help on this.. It will be very kind of you.. Here i am placing only the module of the fetching friends private void showFriendList() { if (Session.getActiveSession() != null) { Session.openActiveSession(InviteFriendsActivity.this, true, new StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { // TODO Auto-generated // method stub List&lt;String&gt; permissions = session.getPermissions(); permissions.add("user_friends"); Session.NewPermissionsRequest request = new Session.NewPermissionsRequest( getParent(), Arrays.asList("user_friends")); session.requestNewReadPermissions(request); Log.v("Invite Friends Request", "&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;Request send" + permissions.toString()); Log.v("Request's Session state", "&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + session.isOpened()); Request friendsRequest = createRequest(session); friendsRequest.setCallback(new Request.Callback() { @Override public void onCompleted(Response response) { List&lt;GraphUser&gt; friends = getResults(response); if (friends != null) { inviteBtn.setVisibility(View.VISIBLE); Log.v("fbbbbbb", "---------------------\n SIZE =" + friends.size()); for (int i = 0; i &lt; friends.size(); i++) { JSONObject data = null; String imgUrl = null; try { data = friends .get(i) .getInnerJSONObject() .getJSONObject( "picture"); Log.v("jsondata", "data =" + data); JSONObject arrayFriend = data .getJSONObject("data"); Log.v("imgUrl", "imgUrl =" + imgUrl); imgUrl = arrayFriend .optString("url"); Log.v("imgUrl", "imgUrl =" + imgUrl); } catch (JSONException e) { e.printStackTrace(); } final FriendDataBean fbList = new FriendDataBean(); fbList.setId(friends.get(i).getId()); fbList.setName(friends.get(i) .getName()); fbList.s…
tagged with: facebook-invite-friends
type: UnansweredQuestion
tagged with: android
tagged with: facebook

http://stackoverflow.com/comment/42913191
score: 1
has text: Here's a suggestion. Write a method called `size`, which prints out the three numbers. Then try this out, and see for yourself whether there's any difference between the two snippets. I think experimenting will help you understand this, better than reading answers on this page.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27216588

http://stackoverflow.com/a/27254041
has body: The command java has the following syntax: java [ options ] class [ arguments ] java [ options ] -jar file.jar [ arguments ] So in your case (class) it seems the class was not found. Probably due to missing class path. java -cp . ... com.temp.util.manual.serial.Assignment ... Maybe better not to rely on the CLASSPATH variable, use -jar and rely on a META-INF/MANIFEST.MF.
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42983156
answers question: http://stackoverflow.com/q/27253573
has comment: http://stackoverflow.com/comment/42982695
has comment: http://stackoverflow.com/comment/42982564
score: 0
has comment: http://stackoverflow.com/comment/42982255

http://stackoverflow.com/comment/42929767
type: Comment
comment on: http://stackoverflow.com/a/27225934
score: 1
has text: @ohtph it can happen sometimes.. :)
type: AnswerComment

http://stackoverflow.com/q/27183437
has answer: http://stackoverflow.com/a/27183675
linked to: http://stackoverflow.com/q/9173494
has title: Access classes of another project-java
tagged with: java
has answer: http://stackoverflow.com/a/27183848
has answer: http://stackoverflow.com/a/27184104
type: Question
has body: I am writing an application in Java and i have two projects say P1 and P2 . I want to access classes of P2 in P1 and access classes of P1 in P2. I have tried adding P1 in P2's build path and vice verse but it is not working,probably we cant add projects to build paths circularly.How do i solve this problem.I was thinking to make a third project and put the classes required in them,add P3 to P1 and P2. But can i do this without creating any additional projects.I am using eclipse Juno.
tagged with: eclipse
tagged with: class
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/1897537
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42854333
has comment: http://stackoverflow.com/comment/42854560

http://stackoverflow.com/comment/42895827
comment on: http://stackoverflow.com/q/27202805
score: 0
type: Comment
type: QuestionComment
has text: That grammar is full of bad practices and even errors. I don't think you're working with a parser generated from the SVN repo you linked to. My guess is that `"http"` does not get tokenized as a `Protocol` token. To be sure, simply print all the token types of the tokens of the lexer.

http://stackoverflow.com/q/27181244
has comment: http://stackoverflow.com/comment/42851235
has comment: http://stackoverflow.com/comment/42850821
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42851032
score: 0
has comment: http://stackoverflow.com/comment/42852737
has comment: http://stackoverflow.com/comment/42850902
answer count: 0
type: UnansweredQuestion
has title: Tomcat 404 error
tagged with: spring
has body: I'm trying to my deployed EE app with the given extension of '/jee' however I'm getting a 404 error when trying to access this. I have this line added to my server.xml: <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/> <Context docBase="C:\Users\user\workspace\EE\j2eeapplication\target\j2eeapplication-0.0.1-SNAPSHOT" path="/jee" reloadable="true" /> I am trying to get it to redirect to my main-flow which has a view 'welcome' and my welcome.xhtml is in the same folder as my main-flow.xml. I'm not sure if it's worth mentioning but my welcome file as specified in the web.xml: index.jsp and here is my index.jsp: <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> I'm new to EE and I'm stumped as to why I'm getting the 404 error, is there anything I can try?
tagged with: java
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/42877096
comment on: http://stackoverflow.com/a/27193553
type: AnswerComment
has text: Oh my God, you are around the 10th person doesn't even understood this question...
type: Comment
score: 1

m2e
type: Tag
tags question: http://stackoverflow.com/q/27218355
tag name: m2e

jquery
tags question: http://stackoverflow.com/q/27168618
tags question: http://stackoverflow.com/q/27257746
tags question: http://stackoverflow.com/q/27293302
tags question: http://stackoverflow.com/q/27183619
type: Tag
tags question: http://stackoverflow.com/q/27313730
tags question: http://stackoverflow.com/q/27228411
tags question: http://stackoverflow.com/q/27173606
tags question: http://stackoverflow.com/q/27172854
tags question: http://stackoverflow.com/q/27254424
tags question: http://stackoverflow.com/q/27174889
tags question: http://stackoverflow.com/q/27188834
tags question: http://stackoverflow.com/q/27292442
tags question: http://stackoverflow.com/q/27249674
tags question: http://stackoverflow.com/q/27273418
tag name: jquery
tags question: http://stackoverflow.com/q/27242553
tags question: http://stackoverflow.com/q/27312993
tags question: http://stackoverflow.com/q/27272228
tags question: http://stackoverflow.com/q/27176530
tags question: http://stackoverflow.com/q/27273220
tags question: http://stackoverflow.com/q/27271752
tags question: http://stackoverflow.com/q/27264532
tags question: http://stackoverflow.com/q/27171332
tags question: http://stackoverflow.com/q/27178062
tags question: http://stackoverflow.com/q/27226312
tags question: http://stackoverflow.com/q/27281760
tags question: http://stackoverflow.com/q/27221698

http://stackoverflow.com/a/27184556
has comment: http://stackoverflow.com/comment/42856487
has body: You could decompile your apk with the APK-Tool. Then you could just edit your manifest and compile it (&amp; create a new apk). You will however still have to sign your App. Here's the link for the APK-Tool
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/27184457
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42856548

http://stackoverflow.com/comment/42887492
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27192215
has text: Normalization is done such that I give high score to titles which match on any salient (non-common) word, and only slightly improve that score for further matching words. This is specific to my problem domain, you would probably want to do that aspect differently.

http://stackoverflow.com/q/27222417
tagged with: arraylist
score: 0
answer count: 3
tagged with: void
has answer: http://stackoverflow.com/a/31092028
has answer: http://stackoverflow.com/a/27222478
has answer: http://stackoverflow.com/a/27222602
tagged with: return
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has body: These are the methods I've been given, and they are all void. I want to access the results from the displaySearchResults using an appropriate loop, only reading data. Anyone know what I need to do to pull the results from the 3 prior search methods? /** * Searches inventory by model * @param model is the model you'd like to find */ public void searchByModel(String model){ ArrayList&lt;Vehicle&gt; results = new ArrayList(); for(int i = 0; i &lt; vehicles.size(); i++){ if(vehicles.get(i).getModel().equalsIgnoreCase(model)){ results.add(vehicles.get(i)); } } } /** * Searches inventory by year * @param year is the year you'd like to find */ public void searchByYear(int year){ ArrayList&lt;Vehicle&gt; results = new ArrayList(); for(int i = 0; i &lt; vehicles.size(); i++){ if(vehicles.get(i).getYear() == year){ results.add(vehicles.get(i)); } } } /** * Searches inventory by price * @param minPrice is the lowest price you'd like to search by * @param maxPrice is the highest price you'd like to search by */ public void searchByPrice(double minPrice, double maxPrice){ ArrayList&lt;Vehicle&gt; results = new ArrayList(); for(int i = 0; i &lt; vehicles.size(); i++){ if(vehicles.get(i).getSellingPrice() &lt; maxPrice &amp;&amp; vehicles.get(i).getSellingPrice() &gt; minPrice){ results.add(vehicles.get(i)); } } } /** * @return Displays search results, unsure of how to get this working still */ public void displaySearchResults(ArrayList&lt;Vehicle&gt; results){ for(Vehicle vehicle : results){ }
tagged with: java
tagged with: methods
type: Question
has title: Java arraylist, trying to search?
has comment: http://stackoverflow.com/comment/42923487
has comment: http://stackoverflow.com/comment/42924298
favorite count: 0

http://stackoverflow.com/a/27226396
type: Answer
answers question: http://stackoverflow.com/q/27226351
has body: put your custom font in : assets/CustomF/times.ttf and maybe then it will work assets folder is directly under your project folder, and whenever you create a fresh project it is empty.
score: 0

http://stackoverflow.com/comment/43005996
score: 0
type: QuestionComment
has text: Are you saying it works on other operating systems? if so which one(s)?
comment on: http://stackoverflow.com/q/27267544
type: Comment

http://stackoverflow.com/a/27176079
upvote count: 3
score: 3
downvote count: 0
has body: Through replaceAll function. string.replaceAll("(?&lt;=\\s.).*", ""); The above regex would match all the characters which are preceded by a space and a single character.
type: Answer
answers question: http://stackoverflow.com/q/27176061

http://stackoverflow.com/a/37449572
answers question: http://stackoverflow.com/q/27312522
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27312522
has body: The problem is that any fatal alert kills the session resumption. So reading past the end of one stream kills subsequent resuse. There is more here Java TLS Session Reuse after closed connection
type: AcceptedAnswer

http://stackoverflow.com/q/27223045
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42924588
tagged with: database
tagged with: mysql
tagged with: prepared-statement
type: Question
upvote count: 1
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27223110
has comment: http://stackoverflow.com/comment/42924991
has answer: http://stackoverflow.com/a/27223130
has comment: http://stackoverflow.com/comment/42924838
answer count: 4
has answer: http://stackoverflow.com/a/27223110
has answer: http://stackoverflow.com/a/27223650
has body: I am making a web service in which number of records are coming and they have to be inserted in database faster. I use PreparedStatement. Are there any ways to insert records faster? The data is coming dynamically so, how much data is coming to insert could not be hard-coded. I have a different class which is common for database queries and I am calling it through my 'Servlet'. Here is the database query code: public void insertUser_Details(String name,String address) throws Exception { ps=con.prepareStatement("insert into registration_table(name,address) values(?,?)"); ps.setString(1,name); ps.setString(2,address); ps.executeUpdate(); }
has answer: http://stackoverflow.com/a/27224204
accepted answer: http://stackoverflow.com/a/27224204
has comment: http://stackoverflow.com/comment/42926708
type: AnsweredQuestion
has title: How to insert many records to MySQL faster,Java?
has comment: http://stackoverflow.com/comment/42925049

http://stackoverflow.com/q/27278915
has comment: http://stackoverflow.com/comment/43060044
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion
tagged with: wpf
has title: WPF - Call a Javascript in a WebBrowser
tagged with: c#
tagged with: java
has body: I have a WebBrowser control in my WPF Descktop Aplication, i need to open this webbrowser in the form starts and make this code to do this: public LibrasPlayer() { InitializeComponent(); LibrasPlayerWeb.LoadCompleted += webb_LoadCompleted; } void webb_LoadCompleted(object sender, NavigationEventArgs e) { LibrasPlayerWeb.InvokeScript("stop"); } But when the code reach in "LibrasPlayerWeb.InvokeScript("stop");" have an error of (DISP_E_UNKNOWNNAME)), this web page use Javascript to comunicate with a java engine to make a player of libras language, but all of InvokeScripts (Stop, Start, and other methods) give me this error. Someone have any idea about how i can work with this?
has comment: http://stackoverflow.com/comment/43029731
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/43063690
has comment: http://stackoverflow.com/comment/43047876
score: 0

glassfish
tags question: http://stackoverflow.com/q/27296680
tags question: http://stackoverflow.com/q/27225876
tags question: http://stackoverflow.com/q/27167099
tags question: http://stackoverflow.com/q/27184097
tags question: http://stackoverflow.com/q/27275676
tags question: http://stackoverflow.com/q/27291641
tags question: http://stackoverflow.com/q/27194375
tags question: http://stackoverflow.com/q/27230881
tags question: http://stackoverflow.com/q/27182300
tag name: glassfish
tags question: http://stackoverflow.com/q/27216807
tags question: http://stackoverflow.com/q/27266657
type: Tag

http://stackoverflow.com/q/27169127
has comment: http://stackoverflow.com/comment/42829831
score: 1
tagged with: java
tagged with: log4j2
type: Question
has comment: http://stackoverflow.com/comment/42841065
has body: I'm using log4j2, and have my configuration in log4j2.xml (in classpath so it s automatically configured) In this particular case, I want to create separate log files per process. I have a framework with multiple packages and multiple classes. They all have statements like: Logger logger = LogManager.getLogger(getClass()); Lets say I now have three processes A, B and C. How should I configure log4j to get three output files A.log, B.log and C.log and include the logging calls made in the framework classes? I also want to be able to log individual packages/classes to other log appenders if I need to debug etc, so I would prefer to keep the getClass() argument mentioned above. All ideas are welcome!
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27182190
tagged with: log4j
favorite count: 0
linked to: http://stackoverflow.com/q/11984414
has comment: http://stackoverflow.com/comment/42845329
type: UnansweredQuestion
has title: Create log4j logfiles per process
tagged with: logging
has answer: http://stackoverflow.com/a/27180020
downvote count: 0
has comment: http://stackoverflow.com/comment/42830686

http://stackoverflow.com/comment/42928308
comment on: http://stackoverflow.com/q/27224882
has text: session.move(node.getPath(), "/app:company_home/app:user_homes/cm:admin/cm:tests"); We have absolute path and target path in this method. I am using jcr 1.0 version jar. I am getting Repository exception. If i given hard coded path that time also given repository Exception. Please provide solution ASAP. Thanks
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27159875
score: 1
tagged with: java
tagged with: hibernate
has body: I am working with spring, using hibernate, maven and mysql, i'm trying to make a simple site for movies and actors. What i'd like is a search method, where you type a word, or part of a word/name and you will get some results, this is my query: @Transactional public List&lt;Movie&gt; searchForMovie(String searchText) { FullTextSession fullTextSession = Search.getFullTextSession(getSession()); QueryBuilder qb = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Movie.class).get(); org.apache.lucene.search.Query query = qb.keyword().onFields("year", "title").matching(searchText) .createQuery(); org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query, Movie.class); List&lt;Movie&gt; results = hibQuery.list(); return results; } As you can see, I am using 'keyword', this means you would have to search for the whole word/name, not only part of it. For example, if I want to find the movie 'hunger games' I would have to type 'hunger' or 'games', what I want is it to be possible to only write 'hunge' and still get results. I cant seem to find a query that will do this, thoughts?
tagged with: mysql
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27161345
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27161764
accepted answer: http://stackoverflow.com/a/27161764
has answer: http://stackoverflow.com/a/27161345
favorite count: 0
has answer: http://stackoverflow.com/a/51983692
has title: spring mvc Hibernate Search query
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/27244466
has comment: http://stackoverflow.com/comment/43026432
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27231276
has comment: http://stackoverflow.com/comment/43026357
has comment: http://stackoverflow.com/comment/42985618
has body: Ok, thanks for the help, I finally found the answer. The hint by @Tom Hawtin gave me the right clue, I still need to wrap the call to webSocket.connectToClient() in AccessController.doPrivileged() to get full rights in the dependent code. However I still don't fully understand why signed code with Permissions: all-permissions is not trusted, maybe I should read up on the WebStart security model. Edit: Ok, after playing around much more and finding more weird bugs I found the real problem: When I integrated the WebSockets into the application I made heavy use of the CompleableFuture.xxxAsync() methods. And by default those are running on the common ForkJoinPool, which in turn run on special threads (InnocuousForkJoinWorkerThread) if a security manager is present (as is obvious the case using jnpl). And those don't have any permissions whatsoever, which correctly triggered all those errors. So the solution is to use a custom Executor for the xxxAsync(xxx, executor) calls.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27231276
downvote count: 0
has comment: http://stackoverflow.com/comment/42985113
type: Answer
has comment: http://stackoverflow.com/comment/43033069
score: 2

http://stackoverflow.com/a/27212552
type: Answer
downvote count: 0
score: 1
has body: I would suggest you store your array as your it's generic type T. I would pass in to the Class&lt;T&gt; to the Dinaminis constructor, then you can use Array.newInstance(). Also, I'd prefer to use System.arraycopy() and override toString() like public class Dinaminis&lt;T&gt; implements DArray&lt;T&gt; { private T[] array; private int kiek; private Class&lt;T&gt; cls; public Dinaminis(Class&lt;T&gt; cls) { this.cls = cls; array = (T[]) Array.newInstance(cls, 10); kiek = 0; } @Override public void ideti(T o) { if (kiek == array.length) { T[] temp = (T[]) Array.newInstance(cls, array.length * 2); System.arraycopy(array, 0, temp, 0, array.length); array = temp; } array[kiek++] = o; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(String.format("len = %d [", array.length)); for (int i = 0; i &lt; kiek; i++) { if (i != 0) { sb.append(", "); } sb.append(array[i]); } sb.append("]"); return sb.toString(); } } Then you could test it with something like public static void main(String[] args) { DArray&lt;Integer&gt; t = new Dinaminis&lt;Integer&gt;(Integer.class); for (int i = 0; i &lt; 11; i++) { t.ideti(i); } System.out.println(t); } Output is len = 20 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Obviously len was added to this output for pedagogical reasons, and in real code I probably wouldn't display it (except perhaps in a log message).
answers question: http://stackoverflow.com/q/27212421
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27212421

http://stackoverflow.com/q/27241405
has title: How to verify if search result has more than one result?
accepted answer: http://stackoverflow.com/a/27243417
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: testng
tagged with: selenium-webdriver
upvote count: 1
has answer: http://stackoverflow.com/a/27243417
type: AnsweredQuestion
has body: Can anyone please help how to find a search result has more than one results using selenium and TestNG. Scenario is as follows: Launch www.amazon.com Enter search string in search box and click search Now verify search result has more then 1 result(>1). Following is the line which I thought of Assert.assertEquals(actual, expected, delta);. Is this the right approach?
score: 1
tagged with: java

http://stackoverflow.com/comment/42934909
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27223731
type: Comment
has text: I don't understand, you can use the dynamic length of the result array and skip the first and last entry, what is the problem?

http://stackoverflow.com/q/27153913
downvote count: 1
has comment: http://stackoverflow.com/comment/42803140
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27154522
tagged with: java
score: -1
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/42805105
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42803224
has body: i'm developing a REST application. I use Websphere 8.5 and Java EE 6. I tried to create a REST Web Project with RAD and it defaulted my web.xml with this servlet Configuration: JAX-RS Servlet com.ibm.websphere.jaxrs.server.IBMRestServlet 1 true false JAX-RS Servlet /jaxrs/* I don't want to bind my application configuration with a server specific setting so i would like to use an 'out of the box' servlet of Java EE 6 over com.ibm.websphere.jaxrs.server.IBMRestServlet. Can you tell me what should i use?
has title: JAX-RS Default Servlet
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27154522
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/42802907
has comment: http://stackoverflow.com/comment/42802209
tagged with: web.xml

http://stackoverflow.com/a/75235926
has body: There is Java + JNI implementation: https://github.com/faljse/SDNotify The Notify protocol uses datagram unix sockets, which are not accessible via Java; Therefore SDNotify includes a JNA wrapper of the socket API.
answers question: http://stackoverflow.com/q/27176303
score: 0
type: Answer

http://stackoverflow.com/comment/42880830
type: Comment
type: QuestionComment
has text: @user3189142 how do you do a do-while loop?
comment on: http://stackoverflow.com/q/27198119
score: 0

http://stackoverflow.com/comment/43039651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27286123
has text: crap let me flip them, excuse me for the bad code its late at night and i barely understand the polymorphism thing
score: 0

http://stackoverflow.com/q/27171223
tagged with: spring
has answer: http://stackoverflow.com/a/27171339
type: AnsweredQuestion
has body: i am trying to create a connection pool for factory class ,which design pattern helps me to create connection pool .user want to specify no of connections and maximum connections externally.I have search for some time, some people proposed to use Singleton or put the initialization code inside some static block. But others said singleton is bad. So, what should be a right design pattern to use for connection pooling? Thanks.
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27171474
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42833363
downvote count: 0
has answer: http://stackoverflow.com/a/27173155
answer count: 3
has answer: http://stackoverflow.com/a/27171474
tagged with: jvm
favorite count: 0
has title: which design pattern helps me to implement connection pool
accepted answer: http://stackoverflow.com/a/27171339
has comment: http://stackoverflow.com/comment/42833287
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42833237

stack-frame
tags question: http://stackoverflow.com/q/27206390
type: Tag
tag name: stack-frame

http://stackoverflow.com/comment/42901536
comment on: http://stackoverflow.com/a/27208351
type: AnswerComment
has text: @HovercraftFullOfEels `not if the best solution does not involve the laying out of components.` - misread the suggestion. Agreed, if the suggestion is to do custom painting of all the planets, then a layout manager is not required.
type: Comment
score: 1

http://stackoverflow.com/q/27165245
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27166204
tagged with: java
tagged with: jpanel
type: Question
has title: Break line around JPanel section
has body: Hello I am trying to add a border or a line break separating the north section from the rest of the JPanel. Basically using set border I have a border around the whole window but then want a line from one section of the border straight across horizontally to the other side. when i add a border to a JPanel that is added to BorderLayout.NORTH it puts a whole border inside the section. not the outline of the section. hope you know what i mean. Attached I have a section of my code that is holding all my JPanel code in it so far. any help I would love, thanks. import javax.swing.*; import javax.swing.border.*; import java.awt.*; public class GamePanel extends JPanel { private JTextPane playertext; private JTextField wealthstring, currentwealth; public GamePanel() { super(); setLayout(new BorderLayout()); setBackground(Game.getBackgroundColor()); Border raised = BorderFactory.createRaisedBevelBorder(); Border lowered = BorderFactory.createLoweredBevelBorder(); setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(4, 4, 4, 4), (BorderFactory.createCompoundBorder(raised, lowered)))); add(northpanel(), BorderLayout.NORTH); add(eastpanel(), BorderLayout.EAST); } private JPanel northpanel() { Font northfont = new Font("Engravers MT", Font.BOLD, 12); playertext = new JTextPane(); playertext.setFont(northfont); playertext.setEditable(false); playertext.setText("Player: \n" + Game.getName()); playertext.setBackground(Game.getBackgroundColor()); playertext.setBorder(new EmptyBorder(10,10,10,10)); wealthstring = new JTextField("Money: "); wealthstring.setFont(northfont); wealthstring.setEditable(false); wealthstring.setHorizontalAlignment(wealthstring.RIGHT); wealthstring.setBorder(null); wealthstring.setBackground(Game.getBackgroundColor()); currentwealth = new JTextField(); currentwealth.setFont(northfont); currentwealth.setEditable(false); currentwealth.setHorizontalAlignment(wealthstring.RIGHT); currentwealth.setBackground(Game.getBackgroundColor()); currentwealth.setBor…
tagged with: border
accepted answer: http://stackoverflow.com/a/27166204
score: 0
answer count: 1

http://stackoverflow.com/comment/43027819
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27197006
has text: This solution also doesn't seem to work well when I'm reading into a Bean versus a list. What do you do if you have multiple columns that have NULL, but they are other data types than String (Double, Integer, etc.)?

http://stackoverflow.com/comment/42884290
has text: it wasnt a type. i copied it straight from the console output. ill try your loopbackaddress method
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27200252
type: Comment

http://stackoverflow.com/q/27168750
downvote count: 0
has answer: http://stackoverflow.com/a/27169398
has title: converting resultset to RDF/XML in Jena
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: http://stackoverflow.com/tag/rdf
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27169398
type: Question
has body: I'm trying to convert a resultset in XML/RDF format but with this code: ResultSet result = rmParliament.selectQuery(select); System.out.println(ResultSetFormatter.asText(result)); ResultSetFormatter.outputAsRDF(System.out, "RDF/XML", result); The second line of the code is to verify the correct behaviour of the query (it works!), but I get in the console the following output: &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rs="http://www.w3.org/2001/sw/DataAccess/tests/result-set#" &gt; &lt;rdf:Description rdf:nodeID="A0"&gt; &lt;rs:size rdf:datatype="http://www.w3.org/2001/XMLSchema#int"&gt;0&lt;/rs:size&gt; &lt;rs:resultVariable&gt;value&lt;/rs:resultVariable&gt; &lt;rs:resultVariable&gt;property&lt;/rs:resultVariable&gt; &lt;rs:resultVariable&gt;name&lt;/rs:resultVariable&gt; &lt;rdf:type rdf:resource="http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet"/&gt; &lt;/rdf:Description&gt; &lt;/rdf:RDF&gt; Is doesn't contain my data, what's wrong with my code?
tagged with: jena

http://stackoverflow.com/comment/42872322
type: QuestionComment
type: Comment
has text: Bundle of thanks @Gord Thompson. I have found the answer I was looking for. :)
comment on: http://stackoverflow.com/q/27178518
score: 0

http://stackoverflow.com/a/27174603
type: Answer
answers question: http://stackoverflow.com/q/27174232
has body: Im not sure do i fully understand the question however one potential problem is in your date format m = Minute in hour M = Month in year &lt;- maybe the one you want? See here for more examples. https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
score: 0

http://stackoverflow.com/comment/42931340
type: QuestionComment
has text: Sorry to disturb you again.I have edited the code again
comment on: http://stackoverflow.com/q/27223002
score: 0
type: Comment

http://stackoverflow.com/comment/42802162
type: Comment
type: QuestionComment
has text: Then post everything on pastebin or similar site and then post the link here.
score: 0
comment on: http://stackoverflow.com/q/27153032

http://stackoverflow.com/q/27174528
has body: I am encountering difficulties with this one: public class MisterySoda { public static void main(String[] args) { String soda = "coke"; String pop = "pepsi"; String coke = "pop"; String pepsi = "soda"; String say = pop; carbonated(soda, pop, pepsi); // say pepsi not soda or coke carbonated(coke, soda, pop); // carbonated(pop, pepsi, pepsi); // carbonated("pop", pop, "koolaid"); // carbonated(say, "say", pop); // } public static void carbonated(String coke, String soda, String pop) { System.out.println("say " + soda + " not " + pop + " or " + coke); } } When I compile I get the following output: say pepsi not soda or coke say coke not pepsi or pop say soda not soda or pepsi say pepsi not koolaid or pop say say not pepsi or pepsi Can someone explain how carbonated() uses the strings in question to deliver that output? Is there anyone who can clarify this?
downvote count: 1
has answer: http://stackoverflow.com/a/27174637
possible better answer: http://stackoverflow.com/a/27174585
has answer: http://stackoverflow.com/a/27174643
favorite count: 0
has answer: http://stackoverflow.com/a/27174585
has title: buildingjavaprograms Parameter Mystery
answer count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27174694
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/27174643

http://stackoverflow.com/a/73185306
has body: It was caused by the following in web.xml Compress com.jspbook.GZIPFilter Compress *.jsp Compress *.html
type: Answer
accepted answer of: http://stackoverflow.com/q/27271336
answers question: http://stackoverflow.com/q/27271336
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42897549
comment on: http://stackoverflow.com/a/27203982
type: AnswerComment
score: 0
type: Comment
has text: Problem is - I*m not allowed to comment on the original question due to reputation being to low. Now my reputation has decreased as a result. Kind of a catch-22...

http://stackoverflow.com/comment/42992089
has text: btw please be careful about indentation, code is hard to read otherwise...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27259284

http://stackoverflow.com/a/27224995
upvote count: 1
has body: You probably have multiple versions of spring-webmvc on your classpath as dependencies of other direct dependency. Call mvn dependency:tree -Dverbose -Dincludes=spring-webmvc to see how many versions of the library you have and exclude older versions. Or, if you are using Intellij, enable the maven plug-in, generate diagram, search with Ctrl-F for spring-webmvc and where you have older dependency right click on it and choose exclude. Probably eclipse has similar functionality too.
downvote count: 0
answers question: http://stackoverflow.com/q/27224936
type: Answer
score: 1

http://stackoverflow.com/comment/43082354
type: QuestionComment
has text: as iam just learning spring i want to know about the templates used in the spring only, what is diffrence and which one must be used
comment on: http://stackoverflow.com/q/27310606
score: 0
type: Comment

http://stackoverflow.com/q/27302826
type: Question
has body: I have created a Binary Search Tree class which I followed some youtube videos to make. The problem is that, from what I can tell, my code is exactly the same as is in the guide I followed. The issue is that when I run my main() method nothing happens. There is no compile or runtime errors, the program simply does nothing. What should happen is that it should use the toString() method to print out some keys and values of those keys if I use the traverse methods, or it should provide a value of a node if I use the findNode() method. I was hoping someone could check my code to see if they can spot any logic errors and such, as I have spent a long time checking and rechecking my code and I cant seem to spot it. Here is the code for my main method: public class BinarySearchTreeAss2 { /** * @param args the command line arguments */ public static void main(String[] args) { BinarySearchTree myTree = new BinarySearchTree(); myTree.addNode(50, 1); myTree.addNode(25, 2); myTree.addNode(15, 3); myTree.addNode(30, 4); myTree.addNode(75, 5); myTree.addNode(80, 6); myTree.inOrderTraversal(myTree.root); System.out.println("\n\n"); myTree.preOrderTraversal(myTree.root); System.out.println("\n\n"); myTree.postOrderTraversal(myTree.root); System.out.println(myTree.findNode(30)); } } And the code for the Binary Search Tree class: public class BinarySearchTree { Node root; public void addNode(int key, int value) { Node newNode = new Node(key, value); if(root == null) { root = newNode; } else { Node focusNode = root; Node parent; while(true) { parent = focusNode; if(key &lt; focusNode.key) { focusNode = focusNode.leftChild; if(focusNode == null) { parent.leftChild = newNode; return; } else { focusNode = focusNode.rightChild; if(focusNode == null) { parent.rightChild = newNode; return; } } } } } } public void inOrderTraversal(Node focusNode) { if(focusNode != null) { inOrderTraversal(focusNode.leftChild); System.out.println(focusNode); inOrderTraversal(focusNode.rightChild); } } public v…
accepted answer: http://stackoverflow.com/a/27302922
score: 0
answer count: 1
tagged with: binary-tree
tagged with: binary-search-tree
has title: Java Binary Search Tree Not Printing at run time
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27302922
tagged with: java

http://stackoverflow.com/comment/42914381
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27217287
has text: Currently reading about overriding onSaveInstanceState(Bundle savedInstanceState). It looks like if the timer is running and is at 19:30, and I save the instance state and come back in two minutes, it would still read as 19:30. I want to return to the activity while the timer has been running in the background to find it where it should be.
score: 0

http://stackoverflow.com/comment/42821350
score: 0
type: Comment
type: QuestionComment
has text: @mKorbel: There is no place I can point, the freeze happen only "sometimes", and it happens "whatever time" the DB is called. Which means, there are lot of forms to edit,update,view records from DB, using any such form can lead this to freeze "sometimes".
comment on: http://stackoverflow.com/q/27164311

http://stackoverflow.com/comment/42943451
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27233394
has text: One word: CLASSPATH.
score: 0

http://stackoverflow.com/q/27260985
has comment: http://stackoverflow.com/comment/42995589
tagged with: android
has comment: http://stackoverflow.com/comment/42995765
type: AnsweredQuestion
tagged with: java
tagged with: non-ascii-characters
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42995057
has title: Same strings are different
has body: I have 2 Strings that are frustating me a lot. They contain, aparently, the same text, but when comparing them Java don't say that. The text is "La Coruña". One string is returned via Google Geocoder, and the other is hardcoded by me. I've tried equals() which returns false, equalsIgnoreCase() which returns false, contains() which returns false, compareTo() which doesn't return 0 (being 0 that are equals). Then I dumped the strings into byte arrays with getBytes("UTF-8") method on each. Again, equals() with returns false, Arrays.compare(array1, array2) false too. Arrays.compare() returns false when the length of each arrays are different or when a value in same position are different. So I printed both arrays and... surprise!! The content was different. Like this: Array1 [76, 97, 32, 67, 111, 114, 117, -61, -79, 97] Array2 [76, 97, 32, 67, 111, 114, 117, -47, -127, 97] The question is WHY is this happening and how can make them equals so I can succesfully compare. My guess is that Google is using some kind of encoding ("La Coruña" contains ñ char) that differs from the other hardcoded String. Please, give me some help Thanks in advance.
tagged with: character-encoding
score: 0
answer count: 1
tagged with: string-comparison
has answer: http://stackoverflow.com/a/27266318
accepted answer: http://stackoverflow.com/a/27266318
has comment: http://stackoverflow.com/comment/42995226
favorite count: 0

http://stackoverflow.com/q/27254163
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/27257548
type: Question
tagged with: hibernate-search
answer count: 2
has title: Hibernate Search Order by Collection Count within Date Range
tagged with: lucene
score: 0
accepted answer: http://stackoverflow.com/a/28836939
has comment: http://stackoverflow.com/comment/43080096
linked to: http://stackoverflow.com/q/18827149
has answer: http://stackoverflow.com/a/28836939
has body: I have two objects - a Document object, and a Hit object: Document id description hits (Collection of type Hits) ... Hit documentId (Type Document) date ... I'm attempting to create a Hibernate Search query that searches the document description, then orders the results by the count of hits within a given date range. I'm having a bit of trouble wrapping my head around how to do this. I've taken a look at this, but it takes into account the total number of hits, and does not allow for dynamic date range queries, as the bridged field is updated independent of date. I currently have an index for my Document object with searching on description working fine. I'm thinking I may need to create an index for the Hit object, run a query against it for the date range, group by documentId, and then run a second query using the searched term against the Document index. Given this strategy, I'm still not sure how to: group the hits by documentId maintain the order of the results from the hits query handle pagination. My guess is that I would need to get all results from the Hits index (using some type of faceting logic for grouping/ordering maybe?), then match on documentId/term and handle pagination in the second query. I'm just not sure how all of this would look when it comes to building a query with the QueryBuilder interface, or if there's a completely different way to approach this that I haven't thought of. UPDATE public class DateRangeDownloadsFieldComparator extends FieldComparator&lt;Integer&gt; { class DownloadsParser implements FieldCache.IntParser { @Override public int parseInt(String string) { /* * What do I pass here and what do I do with it? * Ideally, I would pass the downloads collection and return the size of the * collection where the download appears within the provided date range, but * passing a collection here does nothing, as it's silently ignored. */ return 0; } } private Calendar startDate; private Calendar endDate; private final int[] fieldValues; pr…
has answer: http://stackoverflow.com/a/27257548
type: AnsweredQuestion

http://stackoverflow.com/comment/42809919
has text: Right. I have my Eclipse configured to give a compile warning when I duplicate names like this. I recommend doing the same, because it's nearly always a mistake.
comment on: http://stackoverflow.com/a/27157715
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27269844
tagged with: concurrency
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27418150
has title: How to read data on the main thread from a file being read on a worker thread
favorite count: 0
has body: I am processing a huge data file as "posted below", and I read it on a separate thread. And in the main thread i want to retrieve some data frm that file such as logFile.getFileHash.getTimeStamp to perform some operation on that timeStamp. The problem ia m facing is that, how to start reading some data from my file in the main thread only when my file is completely read in that other thread? note: i do not want to do my operations on the data retrieved ffrom the file on the same thread that reads the file, i want to do so on the main thread. example public static void main(String[] args) throws IOException { //fileThread.start(); will take 8 seconds. /* *here i want to read some data from my file to perform some processing but only *when the thread that handles reading the file finishes work. } file private static void processFile(File dataFile) throws IOException { // TODO Auto-generated method stub MeasurementFile logfile = new MeasurementFile(dataFile); System.out.println(logfile.getTotalLines()); System.out.println(logfile.getFileHash().get(logfile.getTotalLines()).getFullParameters().length); System.out.println(logfile.getFileHash().get(logfile.getTotalLines()).getEngineSpeed()); }
answer count: 5
has answer: http://stackoverflow.com/a/27271297
has answer: http://stackoverflow.com/a/27270068
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/27270013
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27269967

http://stackoverflow.com/comment/43001863
comment on: http://stackoverflow.com/q/27265147
has text: Did you try to add `import net.framework.net.tcp.TCPServer;`?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27248110
has comment: http://stackoverflow.com/comment/42991611
linked to: http://stackoverflow.com/q/163113
tagged with: java
has answer: http://stackoverflow.com/a/27259044
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42971706
has title: Database based ssl client authentication in Tomcat
tagged with: tomcat
tagged with: ssl-certificate
has comment: http://stackoverflow.com/comment/42970870
has answer: http://stackoverflow.com/a/27290295
score: 0
type: UnansweredQuestion
has body: I would like to know if it is possible to have a more dynamic way to handle with client certs than edit tomcat-users.xml ? and how to do it ? A database way would be much better in order add new certs or revoke since now i have to restart the server everytime I need to add a new one in tomcat-users.xml. best regards
tagged with: authentication
tagged with: tomcat7

http://stackoverflow.com/comment/42869213
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27191213
has text: Okay, I didn't want to critizise your stack. Maybe this answer helps you: http://stackoverflow.com/questions/23813369/spring-java-error-namespace-element-annotation-config-on-jdk-1-5-and-high
score: 0

http://stackoverflow.com/comment/42850244
has text: Are you sure there are no proxy preventing downloading the jar? I often get to issue while using office network with proxy required to open http connection.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27180878
type: Comment

http://stackoverflow.com/comment/42877030
has text: I see, thanks. I think that the wording of the iterator documentation should be changed then. From the part I quoted above, which is directly from the iterator doc, it's not clear that it's not guaranteed, i.e., it should say "may throw".
type: Comment
comment on: http://stackoverflow.com/a/27195897
type: AnswerComment
score: 0

http://stackoverflow.com/q/27230928
has comment: http://stackoverflow.com/comment/42940099
tagged with: java
score: 6
has title: Name clash when overriding method of generic class
type: Question
has comment: http://stackoverflow.com/comment/42939617
tagged with: overriding
has body: I'm trying to understand the name clash error I get with the following code: import java.util.*; import javax.swing.*; class Foo&lt;R extends Number&gt; { public void doSomething(Number n, Map&lt;String, JComponent&gt; comps) { } } class Bar extends Foo { public void doSomething(Number n, Map&lt;String, JComponent&gt; comps) { } } Error message: error: name clash: doSomething(Number,Map&lt;String,JComponent&gt;) in Bar and doSomething(Number,Map&lt;String,JComponent&gt;) in Foo have the same erasure, yet neither overrides the other I know I can fix it by either remove the generic type from Foo, or by changing the Bar declaration to class Bar extends Foo&lt;Integer&gt;; what I want to know is why this error occurs in the specific case, but goes away if I remove the comps parameter from each method. I've done some reading about type erasure, but it still appears to me that both methods should have the same erasure with or without generics, and therefore be a valid override in either case. (Note that I haven't even used the generic parameter anywhere yet, which is why I'm so surprised.) I know that I've added generic types to parent classes before but only got warnings about the subclasses, not errors. Can anyone explain this scenario?
tagged with: name-clash
linked to: http://stackoverflow.com/q/2770321
answer count: 1
has answer: http://stackoverflow.com/a/27231864
downvote count: 0
has comment: http://stackoverflow.com/comment/42939018
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/42939812
has comment: http://stackoverflow.com/comment/42938905
has comment: http://stackoverflow.com/comment/42939709
has comment: http://stackoverflow.com/comment/42938765
has comment: http://stackoverflow.com/comment/42938830
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27231864

http://stackoverflow.com/comment/42807097
score: 0
has text: This was a typo then, I assume? "I find that any configuration is valid"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27156106

http://stackoverflow.com/q/27193407
tagged with: java
has comment: http://stackoverflow.com/comment/42880041
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/27193437
type: Question
tagged with: awt
has body: I'm just playing around with Java 2D for a weekend-project. What I try to accomplish is simply to load and draw an image at position 50,50 away from the origin. Now when I try to do exactly that, with g2d.drawImage(imageLeft, 50, 50, 200, 200, null); then I get the following: Frankly, this confuses me a little bit. Why does the x-part of the translation get scaled differently than the y-part? What is going on here? Must be an obvious beginner's mistake, but I cannot figure it out the reason for this behavior for the life of me ;-) The complete code I use to draw the image is: final IsogenWindow window = new IsogenWindow(); final BufferedImage imageLeft = loadImage(new File(getClass().getResource("/texture/tile1.png").toURI())); final Graphics2D g2d = Graphics2D)window.getGraphics(); window.setSize(1000, 1000); window.setVisible(true); g2d.drawImage(imageLeft, 50, 50, 200, 200, null); EDIT 1: To try out DontRelaX' suggestion, I changed my code so a panel is added to the JFrame and its Graphic2D object is used for drawing: getContentPane().setLayout(null); this.renderPanel = new JPanel(); getContentPane().add(renderPanel); final Graphics2D g2d = (Graphics2D)renderPanel.getGraphics(); ... g2d.drawImage(imageLeft, 50, 50, 200, 200, null); Unfortunately, the result is still the same. But I think DontRelaX is on the right track. Any further suggestions? EDIT 2: Basically DontRelaX' answer was correct. I indeed used not the renderPanel's Graphics2D but instead still the JFrame's Graphics2D object. Cheers, nanoquack
tagged with: graphics2d
answer count: 1
downvote count: 0
has title: Java 2D, Translation with the same amount on X and Y axis leads to different results
favorite count: 0
has answer: http://stackoverflow.com/a/27193437
tagged with: java-2d
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42875058
score: 1

http://stackoverflow.com/q/27257345
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42988444
has body: I read Christian Gruber's post and I started wondering how to use Application-wide Singletons. In my application I have a class DBHelper, which main purpose is holding the keys to my database. I have also many (at least two) different DAOs. Now - I don't see a reason why would my several Activities/classes need more than just a single instance of DAO. What's more, why would a DAO need an instance of DBHelper just for itself? I'm pretty sure they can share, especially I don't predict a situation when both DAOs would want to perform some operation on my database at the same time. So let's see some classes: DBHelper @Singleton public class DBHelper extends SQLiteOpenHelper { //some not relevant configuration stuff private Context context; @Inject public DBHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.context = context; } @Override public void onCreate(SQLiteDatabase db) { //db.execSQL, creating tables and stuff } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { //dropping tables, creating a new one onCreate(db); } } example of DAO public interface SomeDataDAO { void hai(); } public class SomeDataDAOImpl implements SomeDataDAO { private DBHelper dbHelper; public SomeDataDAOImpl(DBHelper dbHelper){ this.dbHelper = dbHelper; } @Override public void hai() { SQLiteDatabase database = dbHelper.getWritableDatabase(); dbHelper.doSomeDatabaseStuff() } } SomeDataModule @Module( injects = { MainActivity.class, SomeServiceImpl.class } ) public class SomeDataModule { private Context appContext; @Provides @Singleton public SomeDataDAO provideSomeDataDao(DBHelper dbHelper){ return new SomeDataDAOImpl(dbHelper); } @Provides @Singleton public ISomeService provideSomeService(SomeServiceImpl impl){ return impl; } @Provides public Context getAppContext(){ return this.appContext; } public SomeDataModule(){ this.appContext = MainActivity.getAppContext(); } } Now let's see two examples of dependency consumers public …
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27259440
has comment: http://stackoverflow.com/comment/42990627
score: 1
tagged with: java
tagged with: dagger
linked to: http://stackoverflow.com/q/17447531
answer count: 1
downvote count: 0
has title: How do I use Singleton in Dagger 1.x?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27259440
tagged with: android

http://stackoverflow.com/a/27176459
has comment: http://stackoverflow.com/comment/42842812
has comment: http://stackoverflow.com/comment/42842873
type: Answer
has body: You can try this: Color myColor = Color.decode("#43B7BA"); This worked for me once. Hope it helped you. Regards. By the way, you can try also using the "RGB" approach, there are many pages which can get the RGB values from an hex: Color redColor = new Color(255,0,0)
has comment: http://stackoverflow.com/comment/42842022
accepted answer of: http://stackoverflow.com/q/27176436
answers question: http://stackoverflow.com/q/27176436
has comment: http://stackoverflow.com/comment/42842234
upvote count: 4
has comment: http://stackoverflow.com/comment/42844198
has comment: http://stackoverflow.com/comment/42842568
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/43038349
type: Comment
has text: I believe that passing List<String> using Model in RequestParam will be costly as use will be clicking on VIEW link many a time and every time a `select name from employee` will be hit a database.
score: 0
comment on: http://stackoverflow.com/a/27265734
type: AnswerComment

http://stackoverflow.com/comment/126659714
type: Comment
has text: @iwat0qs Your 404 example offers an interesting aspect. I have updated my answer to avoid any ambiguity.
comment on: http://stackoverflow.com/a/27294970
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42851032
comment on: http://stackoverflow.com/q/27181244
has text: From the information above, I would guess either your `docBase` in `server.xml` is not pointing to a right location, or there is a wrong configuration in your servlet context. My suggestion here would be opening a new default EE project which is accessible to the index.jsp, and then modify from it. Then you will know what is wrong with your current setting. This will save time for you to find out what is wrong here as in my opinion, there are many possible reasons.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43085881
type: Comment
score: 0
has text: No, I'm confused about the statements, I want to know which one is right.
type: QuestionComment
comment on: http://stackoverflow.com/q/27312693

http://stackoverflow.com/comment/43081332
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27309976
has text: I tried your code and I've attached the database code abouve, but it still doesn't work, still has the same error, arrayindexoutofbound execption.
type: Comment

http://stackoverflow.com/comment/42939563
has text: Sorry for not explaing my issue more clearly, I'm trying to flush the input stream, so readline will only get the new data
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27221248
score: 0

http://stackoverflow.com/a/27248066
has comment: http://stackoverflow.com/comment/42972782
has comment: http://stackoverflow.com/comment/42974802
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42973522
type: Answer
accepted answer of: http://stackoverflow.com/q/27247990
answers question: http://stackoverflow.com/q/27247990
downvote count: 0
has body: Getters and setters are called by Hibernate during entity lifecycle, so it isn't guaranteed that this setter won't be called with null value. To avoid this error simply check if the parameter is null public void setProteinData(ProteinData proteinData) { this.proteinData = proteinData; if (proteinData != null) { proteinData.setUser(this); } }
has comment: http://stackoverflow.com/comment/42974736
score: 1
has comment: http://stackoverflow.com/comment/42971680

http://stackoverflow.com/q/27265826
has title: 24 bit RGB image to 8 bit gray scale byte array
has comment: http://stackoverflow.com/comment/43003125
type: UnansweredQuestion
tagged with: java
tagged with: image-processing
has answer: http://stackoverflow.com/a/27265983
type: Question
has comment: http://stackoverflow.com/comment/43003112
linked to: http://stackoverflow.com/q/21899824
has body: I am looking for some code snippet to convert a 24 bit RGB image to 8 bit gray scale byte array in Java. I have explored on the net but not able to find any relevant material. Suppose we have a 24 bit RGB image ("C:\img\face.jpg") and we need to convert it into 8 bit gray scale byte array something like byte[] face in Java. Thanks in advance.
score: 0
has comment: http://stackoverflow.com/comment/43006850
linked to: http://stackoverflow.com/q/13282740
answer count: 1

http://stackoverflow.com/a/27327921
downvote count: 0
has body: You are looping through all the methods in your class. And casting the return value of each of these methods to int[][]. Method[] methodStorage = DataStoragePicsObj.getClass().getMethods(); //Loops through methodStorage[]. for(int x = 0; x &lt; method.length; x++) This is of course going to fail, because your DataStoragePicsObj class implicitly extends java.lang.Object which has methods like hashCode, toString and getClass that do not return int[][]. If you invoke a method through reflection, you should be prepared to pass it the right arguments and the process it's return value; if you cannot, you shouldn't invoke the method through reflection. What you could do - if my understanding of what you want to do is correct - is to check the return type and also the arguments to make sure that you are prepared to handle the reflective invocation: Method m = methodStorage[x]; if (m.getReturnType() != int[][].class || m.getParameterTypes().length != 0) { // Skip this method because it requires arguments or doesn't return int[][] continue; }
type: Answer
accepted answer of: http://stackoverflow.com/q/27251310
has comment: http://stackoverflow.com/comment/43116543
score: 1
has comment: http://stackoverflow.com/comment/43115118
upvote count: 1
answers question: http://stackoverflow.com/q/27251310
has comment: http://stackoverflow.com/comment/43117914
has comment: http://stackoverflow.com/comment/43116082
type: AcceptedAnswer

http://stackoverflow.com/a/27215985
has body: If the input Component is not a JTextField then formato.matcher will throw a NPE preventing the verify method from returning true. Move the statement inside the if block if (input instanceof JTextField) { .... return formato.matcher(texto).matches(); } else { ...// handle other component types }
answers question: http://stackoverflow.com/q/27215918
score: 0
type: Answer

http://stackoverflow.com/q/27241039
type: AnsweredQuestion
has body: Before I ask, I've already looked at this post and tried all suggestions to no avail. My problem is that I can easily set a String using getResources().getString(R.string.example) within the onCreate method, but I want to set a public static final String to a value in string.xml using the same getResources() method. But, when I do this, I get a "Cannot make a static reference to the non-static method getResources() from the type ContextThemeWrapper". So I tried instantiating ContextThemeWrapper and also this.getResources().getString(R.string.example) which both clear the error, but both crash with a NullPointerException. Any solution to simply set a String from a resource would be much appreciated. So far I have this: public class MainActivity extends Activity { ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(); public final String CYPHER = contextThemeWrapper.getResources().getString(R.string.cypher_txt); public static final int LAYERS = 7; public static final int FLIP = 3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String appName = getResources().getString(R.string.app_name); Toast.makeText(this, "Welcome to " + appName, Toast.LENGTH_SHORT).show(); }
tagged with: java
score: -1
type: Question
linked to: http://stackoverflow.com/q/2183962
has answer: http://stackoverflow.com/a/27241126
tagged with: string
favorite count: 0
tagged with: android
answer count: 1
has title: How do I get a string from string.xml in Java using Android SDK?
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/27241126
downvote count: 2
upvote count: 1

http://stackoverflow.com/a/27275763
has comment: http://stackoverflow.com/comment/43070165
has comment: http://stackoverflow.com/comment/43023696
has body: There is no need to create your own BufferStategy!!! If you want to do custom painting the override the paintComponent() method of a JPanel and then add the panel to the frame. Read the section from the Swing tutorial on Custom Painting for more information and examples. You can then still add components to this panel the same way you do for any other panel. The layout manager of the panel will position the components. panel.setOpaque(false); panel.setBackground(Color.yellow); The setBackground(...) does nothing because you said the panel is not opaque, which means the background of the parent component will be painted. panel.add("but1", but1); That is not how you add a component to the panel. The proper method to use is: panel.add(but1); since your panel is using a FlowLayout there is no need to specify a constraint.
accepted answer of: http://stackoverflow.com/q/27275323
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43027361
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43044828
has comment: http://stackoverflow.com/comment/43060394
answers question: http://stackoverflow.com/q/27275323

http://stackoverflow.com/q/27242160
type: Question
tagged with: string-matching
has comment: http://stackoverflow.com/comment/42960542
tagged with: java
has answer: http://stackoverflow.com/a/27242329
possible better answer: http://stackoverflow.com/a/27242468
has answer: http://stackoverflow.com/a/27242468
has answer: http://stackoverflow.com/a/27246833
has title: How to find all overlapping phrases between two strings, in Java?
has answer: http://stackoverflow.com/a/27243408
has comment: http://stackoverflow.com/comment/42960567
tagged with: string
has comment: http://stackoverflow.com/comment/42960533
has comment: http://stackoverflow.com/comment/42960467
score: 0
has body: Assume that I have two strings I like chicken salad, it's my favorite food. This book contains tons of recipes on making all sorts of food, including cakes, chicken salad, etc. Here the overlapping phrases between the two strings are - chicken, salad, chicken salad, food. What's the best way to find the overlapping phrases between two strings? Assume that both are syntax and semantics clean, and also the first one is always quite shorter than the second one.
accepted answer: http://stackoverflow.com/a/27246833
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42960453

http://stackoverflow.com/q/27191853
tagged with: aspectj-maven-plugin
tagged with: aspectj
has comment: http://stackoverflow.com/comment/42883161
downvote count: 0
has body: I'm using maven (plugin version-1.7) and Aspectj-1.8.3. My scenario is as follow: I have an installer jar that I want to test. The installer is using another jar, my-common.jar library that wraps Apache's utility commons-exec-1.3 and use it to execute commands, the method that I wrote looks like this: public static int execCommand(String command) throws ExecuteException, IOException, InterruptedException { logger.debug("About to execute command: ", command); CommandLine commandLine = CommandLine.parse(command); DefaultExecutor executor = new DefaultExecutor(); executor.setProcessDestroyer(new ShutdownHookProcessDestroyer()); ExecuteWatchdog watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); executor.setWatchdog(watchdog); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); executor.execute(commandLine, resultHandler); return 0; } The problem is that since my test executes another jar,I mean, the installer, and the installer jar executes another one(lets name it app.jar) and than, the installer terminates and the app.jar keeps running (first, the installer is doing the installment and preparing the environment, and than, he executes the app.jar), the app jar is not being terminated when the testing suite is done (this was my intention and how it suppose to be in production environment). The global target is to kill all of those processes being created under the integration tests suite. My solution: Since the process id's are exposed only to the java.lang.UNIXProcess I thought to collect all of the processes ids and then terminate them manually at the end of the tests suite. I thought to put an Aspect like this: static Collection&lt;Integer&gt; PidsToKill = new LinkedList&lt;Integer&gt;(); @After("!cflow(within(IntegrationTestsAspects)) &amp;&amp; call(* java.lang.UNIXProcess.destroyProcess(int))&amp;&amp;args(pid)") public void foo3(int pid) { PidsToKill.add(new Integer(pid)); } That was my idea to solve the problem without r…
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: apache-commons-exec
upvote count: 1
score: 1
tagged with: java
has title: How to kill all of the sub-processes being created under my test suite?
type: Question

http://stackoverflow.com/comment/43012901
type: Comment
comment on: http://stackoverflow.com/a/27270748
type: AnswerComment
score: 0
has text: sure, if you like it the hard & slow way :-) download the command line application, and use the PDFSplit command. https://pdfbox.apache.org/commandline/#pdfSplit But the solution I presented will be faster.

http://stackoverflow.com/q/27169723
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: command-line
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am developping a little Java jar application for storage data in file.xml using BaseX server. AT the beginning, before the main program starts, I need that Basex Server is correctly launched and activated. So here is what I do: Runtime runtime = Runtime.getRuntime(); if (isWindows(os)) { Process server = runtime.exec("cmd /C basexserver.bat"); System.out.println(server.waitFor()); } else { if (isLinux(os)) { runtime.exec("basexserver"); } } To check if BaseXServer is correctly running I have tried to check the value returned by waitFor method and if this value is equal to 0 then the command was successfully executed while if the returned value is greater than 0 then an error has occurred. The problem is that this method always returns 1 but the command "basexserver.bat" is correct. Why?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: command
has title: Java: how to check if a program has been correctly launched?
tagged with: windows
has answer: http://stackoverflow.com/a/27170268
accepted answer: http://stackoverflow.com/a/27170268

http://stackoverflow.com/comment/42987635
type: Comment
has text: but it isn't a jar, i just have the class in another project in Eclipse. I will try this for the jsonParser jar-file. But what about the others?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27253819

http://stackoverflow.com/a/27288997
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43051176
has comment: http://stackoverflow.com/comment/43050508
has comment: http://stackoverflow.com/comment/43052624
has comment: http://stackoverflow.com/comment/43052150
has body: There are several solutions with different pros and cons: Don't use static methods. If the method isn't static, you can add it to IRule and therefore enforce that the method exists. Check the qualifiers of factoryMethod and throw a descriptive exception when they aren't static For solution #1, you need a Map&lt;String,IRule&gt;. When getRuleInstance() is called, check the map for an instance. If there is none, use the method from the interface to create one and put it into the map. This way, you can make the instances singletons. At the same time, you can get all fields of the instance and make sure all of them are final to enforce the statelessness. If your application is multi-threaded, make sure you use a concurrent map and synchronize properly. Example code: private Map&lt;String, IRule&gt; rules = Maps.newHashMap(); public static &lt;T extends IRule&gt; T getRuleInstance(String clazz) { try { synchronized( rules ) { IRule result = rules.get(clazz); if(null == result) { result = clazz.newInstance(); rules.put(clazz, result); } @SuppressWarnings("unchecked") T tmp = (T) result; return tmp; } } catch (Exception e) { log( "Unable to create IRule for {}", clazz ); } }
accepted answer of: http://stackoverflow.com/q/27288579
answers question: http://stackoverflow.com/q/27288579
upvote count: 1
has comment: http://stackoverflow.com/comment/43052267
type: AcceptedAnswer
type: Answer

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/27210593
tags question: http://stackoverflow.com/q/27197222

http://stackoverflow.com/q/27271604
has comment: http://stackoverflow.com/comment/43013868
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/43014092
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/43013984
has title: Parsing number as string with Jackson 2 in Google HTTP Java Client
tagged with: jackson
favorite count: 0
tagged with: google-http-client
has body: I am using Jackson 2 as parser in google-http-java-client. When a number is mapped to a field of String class I get an IllegalArgumentException. In this case integer 1234 is about to be mapped to Model.b which is a String. However, the a string can be mapped to an integer field, it is "5678" to Model.c which is an int. Caused by: java.lang.IllegalArgumentException: expected numeric type but got class java.lang.String at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:843) ... 22 more The JSON is like this: { "a": "Something", "b": 1234, "c": "5678" } The POJO is like this: public class Model { @Key String a; @Key String b; @Key int c; } How to solve it? Or can Jackson do customized parsing to achieve this? UPDATE I use it in Android with RoboSpice library. This is the gradle configuration: ... compile 'com.octo.android.robospice:robospice-google-http-client:1.4.14' compile('com.google.http-client:google-http-client-jackson2:1.19.0') { exclude module: 'xpp3' exclude group: 'stax' } ... This the output of ./gradlew dependencies: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for de bug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for re lease as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING [Project: :app] variant.getProcessResources() is deprecated. Call it on one of variant.getOutputs() instead. WARNING [Project: :app] variant.getProcessResources() is deprecated. Call it on one of variant.getOutputs() instead. :dependencies ------------------------------------------------------------ Root project ------------------------------------------------------------ No configurations BUILD SUCCESSFUL Total time: 13.873 secs
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43014353
has comment: http://stackoverflow.com/comment/43013128
has comment: http://stackoverflow.com/comment/43015160

http://stackoverflow.com/comment/43074688
comment on: http://stackoverflow.com/q/27305590
score: 0
type: Comment
has text: You are mistaken about it only writing 65535 rows, and you could easily have determined that for yourself by inspection instead of jumping to conclusions. -1
type: QuestionComment

http://stackoverflow.com/a/27216624
downvote count: 0
has comment: http://stackoverflow.com/comment/42935688
upvote count: 2
has body: Go to project properties and correct the compiler version: You may need to upgrade your Java too.
answers question: http://stackoverflow.com/q/27216573
type: Answer
score: 2

http://stackoverflow.com/a/27303152
score: 0
has body: I made a method that takes in two dates, converts them and returns a long that works fine. 86400000 is the number of milliseconds in a day. I am using GregorianCalendar format public long compareDates(Date exp, Date today){ return (exp.getTime()-today.getTime())/86400000; }
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43262047
has comment: http://stackoverflow.com/comment/43074747
accepted answer of: http://stackoverflow.com/q/27300014
answers question: http://stackoverflow.com/q/27300014

image-compression
tags question: http://stackoverflow.com/q/27158610
tag name: image-compression
type: Tag
tags question: http://stackoverflow.com/q/27168535
tags question: http://stackoverflow.com/q/27208072

http://stackoverflow.com/a/27240582
has body: Yes, but you can pass parameters to jobs (and triggers), but in Quartz you must use the JobDataMap structure that works like so: job=new ConnectorScheduler(); job.getJobDataMap().put("param1", "123"); newJob(job); For numerical (and other non-string values) you can use: job.getJobDataMap().putAsString("param1", 123);
has comment: http://stackoverflow.com/comment/42974367
type: Answer
has comment: http://stackoverflow.com/comment/42974450
score: 0
has comment: http://stackoverflow.com/comment/42974546
has comment: http://stackoverflow.com/comment/42976503
answers question: http://stackoverflow.com/q/27238744
has comment: http://stackoverflow.com/comment/42974117
has comment: http://stackoverflow.com/comment/42973513

http://stackoverflow.com/q/27199135
tagged with: java
has comment: http://stackoverflow.com/comment/42882583
possible better answer: http://stackoverflow.com/a/27199230
has answer: http://stackoverflow.com/a/27199160
has answer: http://stackoverflow.com/a/27199230
has comment: http://stackoverflow.com/comment/42882514
has body: i want to replace character '@' and '.' to '_' from my string . I can replace char '.' to '_' but cant replace char '@' . public String getemailparsing(String email){ String result=""; char keong = 64; for(int i=0; i&lt;email.length();i++){ if(email.charAt(i) == '@' ){ result = email.replace('@', '_'); //this is NOT working }else if(email.charAt(i) == '.'){ result = email.replace('.', '_'); //this one is working } } return result; } any idea to replace char '@' ...
downvote count: 0
has comment: http://stackoverflow.com/comment/42882536
has comment: http://stackoverflow.com/comment/42882548
has title: replace character '@' in java android
tagged with: str-replace
linked to: http://stackoverflow.com/q/4283351
type: AnsweredQuestion
score: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/27199160
favorite count: 0
type: Question
answer count: 2
upvote count: 3

http://stackoverflow.com/a/27253082
score: 1
has body: This is not how you copy an array: public void copy(){ ttt=tt; // booo, hisss, etc. } After this method executes, ttt points at exactly the same array as tt. Changes made to that array are visible through both variables. You need to properly copy the array, e.g. using a technique from How do I copy a 2 Dimensional array in Java?.
has comment: http://stackoverflow.com/comment/42983301
downvote count: 0
has comment: http://stackoverflow.com/comment/42980649
has comment: http://stackoverflow.com/comment/42980431
type: Answer
answers question: http://stackoverflow.com/q/27253003
upvote count: 1
has comment: http://stackoverflow.com/comment/42980269
has comment: http://stackoverflow.com/comment/42980399

http://stackoverflow.com/q/27182818
has comment: http://stackoverflow.com/comment/42853436
has answer: http://stackoverflow.com/a/27182939
has comment: http://stackoverflow.com/comment/42854581
tagged with: eclipse
upvote count: 0
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42853547
tagged with: maven
tagged with: java
downvote count: 2
type: Question
has body: I am using maven 3.0.5, using that i have created a web app project and now trying to compile it. First time while running mvn clean install. I found some error, I have fixed them and now trying to compile again but it still showing me same errors. Initially i found error in my code. Error is required Map> found Map> But I have fixed this in my code
has title: Maven compile showing fixed error
score: -2

http://stackoverflow.com/a/27353543
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43226410
has body: You should also add a KeyListener to the button with a KeyAdapter as the argument, and when the event fires, you can get the key code of the event, and check it against the values: KeyEvent.VK_UP KeyEvent.VK_DOWN KeyEvent.VK_LEFT KeyEvent.VK_RIGHT And then take the necessary action. Regarding simulating movement, do you want the triangle to simply 'jump' from button to button, or something more fluid?
score: 1
has comment: http://stackoverflow.com/comment/43276420
answers question: http://stackoverflow.com/q/27191581
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27191581

http://stackoverflow.com/comment/42902321
has text: I have a list of containers that holds a list of objects which holds a list of objects. In this case: a Container object has a list of MyClass objects, and a MyClass object has a list of T objects. So it is a list within a list within a list of generically typed container. The container must be generic because I need the container to be able to hold any type of object. In the second layer - in MyClass, I need to manage the object differently depending on the type. For example, if it is MyClass<Person> I want to display a table with 10 columns. Or if it's MyClass<Tree> I may only display 5 cols
score: 0
comment on: http://stackoverflow.com/q/27210275
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42983713
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27252689
has text: In your real code do you happen to have a ';' behind the if that is not showing here?

http://stackoverflow.com/q/27172937
tagged with: jtable
tagged with: nullpointerexception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42836291
accepted answer: http://stackoverflow.com/a/27173152
type: Question
has title: How can I show a JTable in a dialog box in NetBeans?
has body: I have had a few problems trying to get this table to show in NetBeans. Here is the code that I am trying to use. I am aware that the loop is wrong and will fix that at a later date. I get a runtime error with the following code and I can't work it out. Object[][] data = null; String[] columnNames = {"Type", "Grade", "Height", "Width", "Length", "Reinforced Bottom", "Reinforced Corners", "Sealable", "Quantity"}; JTable table = new JTable(); public void showTotalOrder(){ for(int i=0; i&lt;boxes.size(); i++){ for(int j=0; j&lt;1; j++){ data[i][j] = boxes.get(i).getName(); data[i][j+1] = boxes.get(i).getGrade(); data[i][j+2] = boxes.get(i).getHeight(); data[i][j+3] = boxes.get(i).getWidth(); data[i][j+4] = boxes.get(i).getLength(); data[i][j+5] = boxes.get(i).getReinforcedBottom(); data[i][j+6] = boxes.get(i).getReinforcedCorners(); data[i][j+7] = boxes.get(i).getSealable(); data[i][j+8] = boxes.get(i).getQuantity(); } } JOptionPane.showMessageDialog(this, table); } I believe the problem is with the last line of this method. The error i receive is: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at coursework.FlexBox.showTotalOrder(FlexBox.java:116) at coursework.FlexBox.currentOrderButtonActionPerformed(FlexBox.java:530) at coursework.FlexBox.access$300(FlexBox.java:18) at coursework.FlexBox$4.actionPerformed(FlexBox.java:435) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6516) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6281) at java.awt.Container.processEvent(Container.…
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/42836233
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/42836425
answer count: 1
has comment: http://stackoverflow.com/comment/42836314
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27173152

http://stackoverflow.com/a/27175005
answers question: http://stackoverflow.com/q/27174157
has comment: http://stackoverflow.com/comment/42928829
has comment: http://stackoverflow.com/comment/42840037
has comment: http://stackoverflow.com/comment/42840622
has body: Okay, there a few things you need to do here. Let's assume you want to present a list of all available roles: the user checks those he wants allocated to the current user. Currently Role is a simple String so there is nothing to bind the checkbox to. You could then create a wrapper on the view tier: public class RoleWrapper{ private String roleName; private boolean selected; } On your controller you want to add a ModelAttribute that will load all available roles. Note that you cannot bind to a raw collection so this list needs to be wrapped. So create another class to wrap your list: public class RoleList{ private List<RoleWrapper> roles; } Construct an instance in your controller and set as a model attribute: @ModelAttribute("availableRoles") public RoleList getAvailableRoles(){ //load from db and construct list } In you JSP create a form backed by this list and with the checkboxes bound to the boolean field: <form:form modelAttribute="roleList" method="post"> Role Select <c:forEach items="${roleList.roles}" var="role" varStatus="status"> role.name <form:checkbox path="roles[${status.index}].selected" /> </c:forEach> Update your controller to be passed this List on submit. Iterate and set the User Roles accordingly: @RequestMapping(value= "/registeruser_action", method = RequestMethod.POST) public String addUser(@ModelAttribute("AppUser") @Valid AppUser appUser, @ModelAttribute("roleList") RoleList roleList, BindingResult result){ if(result.hasErrors()){ return "register"; } for(RoleWrapper role : roleList.getRoles()){ if(role.isSelected()){ //add to user } } appUserDetailsService.registerUser(appUser); return "redirect:/menu"; } Regarding the issue you have persisting you will need to do the following. Add cascade options to the relationship and, if persisting the non-owning side (AppUser in this case) ensure both sides of the relationship are set. You should encapsulate add/remove operations to ensure relationships between domain objects are consistent. Thus: @En…
has comment: http://stackoverflow.com/comment/42840985
has comment: http://stackoverflow.com/comment/42869459
has comment: http://stackoverflow.com/comment/42842092
has comment: http://stackoverflow.com/comment/42840321
has comment: http://stackoverflow.com/comment/42840374
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42840233
type: Answer
accepted answer of: http://stackoverflow.com/q/27174157

http://stackoverflow.com/comment/42956606
type: QuestionComment
comment on: http://stackoverflow.com/q/27240029
has text: idk why its like that mines like that too, but i use filter and make a tag in my logs
score: 0
type: Comment

http://stackoverflow.com/comment/43009015
comment on: http://stackoverflow.com/a/27269048
type: AnswerComment
score: 0
type: Comment
has text: If I do it like your exmaple so it get me error on the line: if(member instanceof Void) //Incovertible types; cannot cast T to java.lang.Void

http://stackoverflow.com/a/27170690
has comment: http://stackoverflow.com/comment/65500764
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42832409
answers question: http://stackoverflow.com/q/27170602
score: 1
downvote count: 0
has body: We show you two bit shifting and “0xff” masking examples to convert a decimal number back to IP address. The bit shifting is very hard to explain in words, it’s better review the binary flows below : //ip = 3232235778 public String longToIp(long ip) { StringBuilder result = new StringBuilder(15); for (int i = 0; i &lt; 4; i++) { result.insert(0,Long.toString(ip &amp; 0xff)); if (i &lt; 3) { sb.insert(0,'.'); } ip = ip &gt;&gt; 8; } return result.toString(); } for more details please check the Link Link 2

http://stackoverflow.com/a/27484017
type: Answer
has comment: http://stackoverflow.com/comment/43437602
has body: I've been experiencing the same problem and changed a bit the native plugin implementation to fix this. You can find the fork at: https://github.com/ebariaux/twilio_client_phonegap Plugin has not been tested extensively, just made that change that got me the functionality I wanted.
score: 0
answers question: http://stackoverflow.com/q/27248749

http://stackoverflow.com/comment/42966787
type: Comment
has text: @Emz - from [oracle jvm spec](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.3.4). *Although the Java Virtual Machine defines a boolean type, it only provides very limited support for it. There are no Java Virtual Machine instructions solely dedicated to operations on boolean values. Instead, expressions in the Java programming language that operate on boolean values are compiled to use values of the Java Virtual Machine int data type.*
type: AnswerComment
comment on: http://stackoverflow.com/a/27245719
score: 0

http://stackoverflow.com/comment/42941081
has text: It's a duplicate of [`int[]` and `Integer[]` arrays - What is the difference?](http://stackoverflow.com/q/18845289/2991525).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27232050

http://stackoverflow.com/q/27250386
score: 7
favorite count: 0
tagged with: serialization
type: Question
answer count: 2
has body: I've read this news about json with groovy http://www.infoq.com/news/2014/04/groovy-2.3-json. So I tried to native methods to (de)serialization of groovy bean containing dates. But I have issues whent using JsonOutput.toJson(object) with JsonObject.fromObject() with java.util.Date String jsonDat a= groovy.json.JsonOutput.toJson(contact) Contact reloadContact = new Contact(net.sf.json.JSONObject.fromObject(jsonData)) What is the right way to to this with native methods in groovy 2.3+ ? Otherwise, I could go for another library like gson (http://www.mkyong.com/java/how-do-convert-java-object-to-from-json-format-gson-api/) package test import groovy.json.JsonOutput import net.sf.json.JSONObject class JsonTest { public static void main(String[] args) { JsonTest test = new JsonTest() test.serialization() } public void serialization(){ Contact contact = new Contact() contact.name = 'John' contact.registration = Date.parse('dd/MM/yyyy', '20/10/2011') String jsonData = JsonOutput.toJson(contact) println(jsonData) Object object = JSONObject.fromObject(jsonData) Contact reloadContact = new Contact(object) println(jsonData) } public class Contact{ String name Date registration } } Edit: I also tried with JsonSlurper, but always get the GroovyCastException: Cannot cast object '2011-10-19T22:00:00+0000' with class 'java.lang.String' to class 'java.util.Date' package test import groovy.json.JsonOutput import groovy.json.JsonSlurper class JsonTest { public static void main(String[] args) { JsonTest test = new JsonTest() test.serialization() } public void serialization(){ Contact contact = new Contact() contact.name = 'John' contact.registration = Date.parse('dd/MM/yyyy', '20/10/2011') String jsonData = JsonOutput.toJson(contact) println(jsonData) JsonSlurper slurper = new JsonSlurper() def object = slurper.parseText(jsonData) Contact reloadContact = new Contact(object) println(jsonData) } public class Contact{ String name Date registration } }
has title: Serialize & Deserialize bean to json with Groovy
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 7
has answer: http://stackoverflow.com/a/27270719
has comment: http://stackoverflow.com/comment/43007799
accepted answer: http://stackoverflow.com/a/27270719
possible better answer: http://stackoverflow.com/a/35419797
has answer: http://stackoverflow.com/a/35419797
tagged with: groovy
type: AnsweredQuestion
downvote count: 0
tagged with: deserialization
has comment: http://stackoverflow.com/comment/42975759

http://stackoverflow.com/comment/43077852
comment on: http://stackoverflow.com/q/27307799
score: 0
has text: Now that you've added the trace it's pretty clear that it's the remove statement. Your logic in that method makes no sense - why are you removing an element when there's no guarantee the list has elements?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42860896
type: AnswerComment
has text: Where is calculating any "percent result"?
type: Comment
comment on: http://stackoverflow.com/a/27187118
score: 2

http-redirect
tags question: http://stackoverflow.com/q/27254895
type: Tag
tag name: http-redirect
tags question: http://stackoverflow.com/q/27183847
tags question: http://stackoverflow.com/q/27173658

http://stackoverflow.com/comment/42863286
type: Comment
has text: It depends on your use case requirements. Do you really want to rollback 2M insert records because of a failed insert? You can keep the ids of all the current batch entries and delete them on any failure, if that's the case.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27179511

http://stackoverflow.com/comment/43048042
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27290890
has text: please try to provide code and also which version of jdk are you using?
score: 0

http://stackoverflow.com/comment/42852075
comment on: http://stackoverflow.com/a/27176351
has text: My Cluster is Hadoop 2.4.1 5-node cluster with dual-core processors and 8 GB ram for each pc. I tried setting higher than 2 gigs using -Xmx* , but got the same error.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42970136
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27246662
has text: The accepted answer doesn't actually *explain* the difference though. I'll add an extra answer. Please read http://tinyurl.com/stack-hints - just because you got an answer you like without asking a decent question doesn't mean it's a good idea to keep doing so. In general, the better the question is, the better the answers will be.

http://stackoverflow.com/comment/42821976
comment on: http://stackoverflow.com/q/27164453
score: 0
type: Comment
type: QuestionComment
has text: Yes. After doing some research on the error that was the first thing I attempted. No problems are indicated in Eclipse's Problems tab so I'm just kind of at a lost on what might be happening.

http://stackoverflow.com/a/27177591
has comment: http://stackoverflow.com/comment/42848692
type: Answer
upvote count: 4
downvote count: 0
has body: This idiom almost always means 'E should be the type of the subclass'. For example, you might notice that Enum implements Comparable&lt;E&gt;. When the class is extended, you get to something like: // E extends Enum&lt;E&gt; ┐ class AnEnum extends Enum&lt;AnEnum&gt; {...} Now AnEnum is also a Comparable&lt;AnEnum&gt; and getDeclaringClass returns a Class&lt;AnEnum&gt;. I've seen this idiom related to the curiously recurring template pattern. The intent is that the superclass can refer to the subclass generically. (Due to the fact that the subclass of Enum is generated by the compiler, I don't think there is actually a reason Enum in particular needed to be declared this way. It could have just been Enum&lt;E&gt;.)
answers question: http://stackoverflow.com/q/27177106
score: 4

http://stackoverflow.com/a/27190205
has body: You have defined the class-variable client in SoClient as static: public static Socket client; and set it in the constructor. If you have multiple instances of SoClient, they all work on the same client-Socket. That could cause more weird errors. Remove the static keyword and it, hopefully, works.
accepted answer of: http://stackoverflow.com/q/27157090
answers question: http://stackoverflow.com/q/27157090
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

instantiation
type: Tag
tag name: instantiation
tags question: http://stackoverflow.com/q/27284154

http://stackoverflow.com/comment/42915779
type: Comment
has text: Ok, and how to paint a png on this BufferedImage, such that a specific color will be transparent?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27218056

http://stackoverflow.com/a/27239162
has comment: http://stackoverflow.com/comment/42958963
has body: TextView by itself can contain a Drawable on top, bottom, left (start) and/or right (end). &lt;TextView ... android:drawablePadding="4dp" android:drawableLeft="@drawable/my_drawable"/&gt; More on this topic here: http://antonioleiva.com/textview_power_drawables/
downvote count: 1
type: Answer
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/27239015

http://stackoverflow.com/q/27154756
answer count: 3
has answer: http://stackoverflow.com/a/27155601
tagged with: string
favorite count: 0
has body: I'm not sure how to explain this problem but please someone help me. I want to have a program to where if a word is typed into the keyboard, I have an if statement that makes it so that when that word is entered it prints out a sentence on the screen. Like, if I typed in "dog" and hit enter the screen would display information on dogs or something.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42804007
has title: Using an if statement with a system.in scanner
tagged with: java
has answer: http://stackoverflow.com/a/27155370
downvote count: 3
type: Question
tagged with: if-statement
upvote count: 0
tagged with: system.in
score: -3
has answer: http://stackoverflow.com/a/27155349

http://stackoverflow.com/q/27297308
has answer: http://stackoverflow.com/a/30810283
downvote count: 0
has body: Is it possible to use Spring Boots Maven plugin command spring-boot:run when the parent POM of the project is using packaging mode POM because of its children? I have multi module maven project with a "master" POM that is in it's turn a child of the Spring Boot Parent module. Looking something like this: 4.0.0 com.example project pom 0.1.0 org.springframework.boot spring-boot-starter-parent 1.2.0.BUILD-SNAPSHOT <relativePath/> module1 module2 module3 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.example.module1.Application <java.version>1.8</java.version> org.springframework.boot spring-boot-maven-plugin This is basically our "master" POM which every child uses as it's parent. Now we want to perform the spring-boot:run command from the working directory this "master" POM is in. Problem is, this generates a ClassNotFoundException which is odd since module1 (where this Application class is located) is included in the POM and mentioned as a module. Using a single module maven project and jar this compiles and runs the Application class so it is not Spring-Boot that is not working right here. What do I have to change to get this working or is it simply not possible to use the spring-boot-maven-plugin plugin when dealing with multi module Maven projects? Sidenote: My Application class / Module 1 has the other modules as dependencies so keep this in mind when answering the question. Any suggestions on how to improve this are very appreciated.
upvote count: 8
possible better answer: http://stackoverflow.com/a/30810283
has answer: http://stackoverflow.com/a/27298098
favorite count: 0
score: 8
tagged with: maven
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: spring-boot
linked to: http://stackoverflow.com/q/4856307
accepted answer: http://stackoverflow.com/a/27298098
tagged with: java
has title: Spring Boot with POM packaging Agregator
answer count: 2

http://stackoverflow.com/comment/42987693
score: 0
comment on: http://stackoverflow.com/q/27255487
type: Comment
type: QuestionComment
has text: The fact that it is used everywhere doesn't mean it is correct, imho it is a bad practice. Depending on what it does it might not even be a singleton and each time loading a new context eating up memory. Also class loading isn't a spring thing that is a fundamental part of how java works (and where classes stored depends on the java version and/or memory model used).

http://stackoverflow.com/comment/43059834
type: AnswerComment
score: 0
type: Comment
has text: It solves the issue to replace `getX()` and `getY()` with zeros! I did realize that these methods returned the child component origin relative to its parent component, however, I did not realize that painting had to be relative to the child itself, not the parent. Thank you!
comment on: http://stackoverflow.com/a/27297586

mongodb
tags question: http://stackoverflow.com/q/27250947
tags question: http://stackoverflow.com/q/27301307
tags question: http://stackoverflow.com/q/27187749
tags question: http://stackoverflow.com/q/27235072
tag name: mongodb
tags question: http://stackoverflow.com/q/27246274
tags question: http://stackoverflow.com/q/27211070
tags question: http://stackoverflow.com/q/27171591
type: Tag
tags question: http://stackoverflow.com/q/27299818
tags question: http://stackoverflow.com/q/27167794
tags question: http://stackoverflow.com/q/27190502
tags question: http://stackoverflow.com/q/27266490
tags question: http://stackoverflow.com/q/27162088
tags question: http://stackoverflow.com/q/27304142
tags question: http://stackoverflow.com/q/27206994
tags question: http://stackoverflow.com/q/27205293
tags question: http://stackoverflow.com/q/27288373

keylistener
tags question: http://stackoverflow.com/q/27208846
type: Tag
tags question: http://stackoverflow.com/q/27153726
tags question: http://stackoverflow.com/q/27175404
tags question: http://stackoverflow.com/q/27283289
tags question: http://stackoverflow.com/q/27211388
tags question: http://stackoverflow.com/q/27218263
tag name: keylistener
tags question: http://stackoverflow.com/q/27283908
tags question: http://stackoverflow.com/q/27243043
tags question: http://stackoverflow.com/q/27270284

http://stackoverflow.com/comment/42861758
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27187239
has text: Yeah that closes the tab, I want to have them both open.
type: AnswerComment

http://stackoverflow.com/comment/43021576
has text: Thanks. I have one last confusion though. I have the specific file upto `singleFile` channel after that channel there willnot be File Message in other subsequent channels. When there are multiple files in the remote location how would I know which file to move from the remote folder based on the response of `http:outbound-gateway`?
type: AnswerComment
comment on: http://stackoverflow.com/a/27273222
score: 0
type: Comment

http://stackoverflow.com/comment/42892639
comment on: http://stackoverflow.com/a/27205023
score: 0
type: AnswerComment
type: Comment
has text: As a note, I think that the questions that [Takendarkk](http://stackoverflow.com/users/3081206/takendarkk) mentioned on the original question are important considerations, even if not explicitly required in your situation. I intentionally do not answer them here. You should take it as an exercise upon yourself to understand how to expand a solution like this. What if there are more columns? What if it alternates between rows with 4, 5, and 6 stars? etc.

http://stackoverflow.com/comment/43010219
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27269889
score: 0
has text: Can you add FileClient.main to the codescnippets in the question, please? You should provide an executable example in such cases ... [ask]

http://stackoverflow.com/comment/42993993
comment on: http://stackoverflow.com/q/27259906
type: Comment
has text: Have you added `org.eclipse.e4.core.services` to the plug-in deps?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42943821
type: AnswerComment
has text: @hfontanez well it works for now, all i wanted is for the letters to work. so all good
comment on: http://stackoverflow.com/a/27233411
type: Comment
score: 0

http://stackoverflow.com/q/27267893
has comment: http://stackoverflow.com/comment/43008789
tagged with: java
has comment: http://stackoverflow.com/comment/43006903
has comment: http://stackoverflow.com/comment/43006815
has comment: http://stackoverflow.com/comment/43006790
has comment: http://stackoverflow.com/comment/43008804
type: Question
has comment: http://stackoverflow.com/comment/43006874
accepted answer: http://stackoverflow.com/a/27268224
has comment: http://stackoverflow.com/comment/43006819
has comment: http://stackoverflow.com/comment/43006917
has comment: http://stackoverflow.com/comment/43006978
has title: Java Object.class and x.getClass
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27268224
type: AnsweredQuestion
has body: I have a method like this: public Object load(Object type) { ... } Note that the parameter is an Object-type. I have several classes that are using the loadConfiguration method. Inside the method I need to know the class, so the value for MyObject.class is needed. Well, because I have an Object, this is not possible and type.getClass() also throws an exception, because is just gives me java.lang.Class and not the real one. One possibility would be to use instanceof functionality but I would like to keep it as general as possible. Any ideas for this? I also had look to this topic. Thank You!
has comment: http://stackoverflow.com/comment/43007190

http://stackoverflow.com/comment/42925857
has text: @CasimiretHippolyte: All the newlines and most of the other whitespace in the code samples were introduced when sundar used the snippet feature to format the code. I reverted that and formatted it the old-fashioned way.
type: Comment
comment on: http://stackoverflow.com/a/27215793
score: 0
type: AnswerComment

http://stackoverflow.com/a/27230960
type: Answer
has body: What about this: private static JPanel createPanel() { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); final JPanel firstRowPanel = new JPanel(); firstRowPanel.setLayout(new BoxLayout(firstRowPanel, BoxLayout.X_AXIS)); firstRowPanel.add(new JLabel("X")); firstRowPanel.add(new JLabel("X")); firstRowPanel.add(new JLabel("X")); firstRowPanel.add(new JLabel("X")); final JPanel secondRowPanel = new JPanel(); secondRowPanel.setLayout(new BoxLayout(secondRowPanel, BoxLayout.X_AXIS)); secondRowPanel.add(Box.createHorizontalGlue()); secondRowPanel.add(new JLabel("X")); secondRowPanel.add(Box.createHorizontalGlue()); panel.add(firstRowPanel); panel.add(secondRowPanel); return panel; }
answers question: http://stackoverflow.com/q/27227753
score: 0

http://stackoverflow.com/comment/43016240
comment on: http://stackoverflow.com/a/27273138
type: Comment
has text: I fear that you need to redesign your program. Usually it should not be necessary to access the type and switch on it. Maybe you can create specialized subclasses of TableColumn that do not need to be generic anymore. This is far beyond the scope of this question.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27243141
has answer: http://stackoverflow.com/a/27353302
score: 0
has body: I am using PMD maven plugin for my project and I am seeing very strange behavior in it. The following pom.xml configuration fails the build with violations in basic.xml - ${project.basedir}\ruleset\basic.xml <!-- ruleset>${project.basedir}\ruleset\braces.xml ${project.basedir}\ruleset\design.xml ${project.basedir}\ruleset\controversial.xml ${project.basedir}\ruleset\coupling.xml ${project.basedir}\ruleset\clone.xml ${project.basedir}\ruleset\comments.xml</ruleset--> But the below one passes the build smoothly - ${project.basedir}\ruleset\basic.xml ${project.basedir}\ruleset\braces.xml ${project.basedir}\ruleset\design.xml ${project.basedir}\ruleset\controversial.xml ${project.basedir}\ruleset\coupling.xml ${project.basedir}\ruleset\clone.xml ${project.basedir}\ruleset\comments.xml The build should have failed in the second scenario also. As per what I have noticed, if the last rule (in above example comments.xml) does not have any code violation then the build will not break even if any of the rulesets above it (basic.xml, braces.xml, etc.) have code violations. I am unable to understand the reason behind this behavior. Can someone help me out with this?
tagged with: maven
answer count: 1
tagged with: pmd
has comment: http://stackoverflow.com/comment/43156112
has title: PMD multiple rulesets pass build but single ruleset fails build
tagged with: java
accepted answer: http://stackoverflow.com/a/27353302
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42986777
type: Question
tagged with: maven-plugin

http://stackoverflow.com/comment/42993587
has text: Have you tried the createTrustedSession() method? That should cause you to be prompted for the password. It will be interesting to see if that works. Also since this is a fresh install, can we presume that you have fired up the Notes client, gone through the setup process, and that you can successfully connect with it to a Domino server?
score: 0
comment on: http://stackoverflow.com/q/27245021
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27306987
has comment: http://stackoverflow.com/comment/43112369
has comment: http://stackoverflow.com/comment/43076352
has comment: http://stackoverflow.com/comment/43076635
has comment: http://stackoverflow.com/comment/43076500
answers question: http://stackoverflow.com/q/27306777
type: Answer
has body: You need at least one alphabet before the digits. So the regex should be "[a-zA-Z]+\\d+".
has comment: http://stackoverflow.com/comment/43076393
score: 0

http://stackoverflow.com/a/27160110
has comment: http://stackoverflow.com/comment/42847425
score: 5
type: AcceptedAnswer
upvote count: 5
answers question: http://stackoverflow.com/q/27159116
has body: Do I understand correctly that you want to end up with a bunch of MenuNode objects that represent the menu? If that's the case, I think it would be easier to premake all the node objects and then populate their children list. // first we make all the nodes and map them to ID Map&lt;Long, MenuNode&gt; nodes = hierarchies.stream() .map(MenuHierarchy::getChildMenu) .collect(toMap(MenuItem::getId, MenuNode::new)); // and now we go over all hierarchies and add children to appropriate node hierarchies.stream() .filter(h -&gt; h.getParent() != null) .sorted(comparing(MenuHierarchy::getDisplayOrder)) .forEach(h -&gt; { long parentId = h.getParentMenu().getId(); long childId = h.getChildMenu().getId(); nodes.get(parentId).getChildren().add(nodes.get(childId)) }); Alternatively, the second part can be written by going over nodes first. The advantage of doing it this way is that you can make the child list in MenuNode immutable. The downside is that you might find the idea of repeatedly iterating over all hierarchies distasteful (even though it shouldn't matter for any realistic menu size): nodes.values().forEach( node -&gt; node.setChildren( hierarchies.stream() .filter(h -&gt; h.getParentMenu().getId() == node.getData().getId()) .sorted(comparing(MenuHierarchy::getDisplayOrder)) .map(MenuHierarchy::getChildMenu) .map(MenuItem::getId) .map(nodes::get) .collect(toList()) ) ); And, for completeness sake, you can group up the hierarchies for the same parent using streams and rewrite the second part like this: hierarchies.stream() .filter(h -&gt; null != h.getParent()) .collect( groupingBy(h-&gt;g.getParentMenu().getId(), toList()) ) // now we have a map of parent Ids to list of MenuHierarchy for that parent .forEach( (parentId, children) -&gt; nodes.get(parentId)).setChildren( children.stream() .sorted(comparing(MenuHierarchy::getDisplayOrder)) .map(h -&gt; nodes.get(h.getChildMenu().getId())) .collect(toList()) ) ); You decide what's clearer to you. Edit: I wasn't sure if hiera…
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27159116
type: Answer
has comment: http://stackoverflow.com/comment/42847446

http://stackoverflow.com/comment/42857037
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27172134
type: Comment
has text: Yeah that's exactly what I did. But somehow the alarm manager is not triggered by the time I set it. Do you have any ideas?

http://stackoverflow.com/comment/42881543
score: 0
type: Comment
has text: Have you verified your database has the correct data in it by looking at an SQL query? Do you see a entry in the Traveller table that links up to one in User table? Do they have the username that you expect? Have you checked to make sure that you're passing the right username into the findByUsername method? I would do a system.out.println() of the username right before the SQL runs for something quick and dirty.
type: AnswerComment
comment on: http://stackoverflow.com/a/27198538

http://stackoverflow.com/a/27265689
has comment: http://stackoverflow.com/comment/104947975
answers question: http://stackoverflow.com/q/27264802
has comment: http://stackoverflow.com/comment/43004826
type: AcceptedAnswer
downvote count: 0
has body: A RandomAccessFile "works" on a physical file, it reads from and writes to a file. You can't just insert bytes into a position. All the bytes after the position have to be moved, copied to allow space for the value you want to insert. The most efficient way would be to read the remaining data into an array, insert (write) the new value and write back the array. But you said this is not allowed. Alternatively you have to use a loop (e.g. for) to iterate over the bytes and write them back to a greater position (the amount you want to insert: +4 bytes). Assuming the file length and current position is a multiple of 4 bytes (which suits your needs), here is an example how to do it: public static void insert(RandomAccessFile raf, int dataToInsert) throws IOException { // First remember insertion position: long insPos = raf.getFilePointer(); // Next copy all data from this pos. For easier, go downward: raf.seek(raf.length() - 4); for (long pos = raf.getFilePointer(); pos &gt;= insPos; pos -= 4) { // readInt() and writeInt() implicitly moves the file pointer raf.writeInt(raf.readInt()); raf.seek(pos - 4); } // Copy done, insert new value: raf.seek(insPos); raf.writeInt(dataToInsert); } Example Usage RandomAccessFile raf = new RandomAccessFile("a.txt", "rw"); // Position file pointer where we want to insert: raf.seek(4); insert(raf, 0x41424344); // This is "ABCD" in text representation Input: 123456789012 Output: 1234ABCD56789012
score: 4
has comment: http://stackoverflow.com/comment/104981547
has comment: http://stackoverflow.com/comment/104947783
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27264802

http://stackoverflow.com/q/27256473
tagged with: data-structures
has body: I have the following simple tree: My goal is to find the path between the two manager nodes. The two nodes will be selected input in the cmd. So the user might type 'java BinaryTree manager1 manager2' and the output will display the path needed to reach the second manager. This example should output the following: 'Manager1 > Boss &lt; Manager2' The code I have so far defines the nodes however I need a findPath method to print the path. CODE: ` public class BinaryTree { public static void main(String[] args) { Node boss = new Node(1); Node manager1 = new Node(2); Node manager2 = new Node(3); boss.left = manager1; boss.right = manager2; String path = findPath(args[0], args[1]); System.out.println(path); } static class Node { Node left; Node right; int value; public Node(int value) { this.value = value; } } }` Thanks for any help :)
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/42986948
has answer: http://stackoverflow.com/a/28927385
has comment: http://stackoverflow.com/comment/42989320
favorite count: 0
has comment: http://stackoverflow.com/comment/42987033
tagged with: binary-tree
tagged with: args
has comment: http://stackoverflow.com/comment/42986733
has title: Finding Path Between Two Nodes in a Binary Tree
linked to: http://stackoverflow.com/q/22960057
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42986848
has answer: http://stackoverflow.com/a/27256718
score: 3
downvote count: 0
tagged with: java
tagged with: nodes
type: Question
has comment: http://stackoverflow.com/comment/42986926

http://stackoverflow.com/a/51538776
has comment: http://stackoverflow.com/comment/99800605
type: Answer
answers question: http://stackoverflow.com/q/27280928
has comment: http://stackoverflow.com/comment/99800189
has body: If Multiple throws are happening in a single catch() then to recognize which Exception , you could use instanceof operator. The java instanceof operator is used to test whether the object is an instance of the specified type (class or subclass or interface). Try this code :- catch (Exception e) { if(e instanceof NotAnInt){ // Your Logic. } else if if(e instanceof ParseError){ //Your Logic. } }
score: 29
has comment: http://stackoverflow.com/comment/100145445
has comment: http://stackoverflow.com/comment/118964151
downvote count: 2
upvote count: 31

http://stackoverflow.com/comment/42972955
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27248438
has text: I am using JUnit, yes.
score: 0

http://stackoverflow.com/a/52804521
type: Answer
has body: After much experimentation, I eventually came up with my own method of doing this. It even continues to flash after 5 times if the shell does not have focus! public static final void flashTaskBar(Runnable code) { TaskItem item = getTaskBarItem(); long startTime = System.currentTimeMillis(); int state = item.getProgressState(); int progress = item.getProgress(); item.setProgressState(SWT.PAUSED); item.setProgress(100); boolean flashOn = true; int flashes = 0; int maxFlashes = 5; while(true) { long now = System.currentTimeMillis(); if(now - startTime &gt;= 500L) { startTime = now; item.setProgressState(flashOn ? SWT.DEFAULT : SWT.PAUSED); flashOn = !flashOn; if(!flashOn) { flashes++; } if(flashes &gt;= maxFlashes) { item.setProgressState(state); item.setProgress(progress); return; } } if(code == null) { try { Thread.sleep(10L); } catch(InterruptedException ignored) { Thread.currentThread().interrupt(); } } else { try { code.run(); } catch(Throwable e) { e.printStackTrace(); item.setProgressState(state); item.setProgress(progress); return; } } } } And for getTaskBarItem(): public static TaskItem getTaskBarItem() { TaskBar bar = display.getSystemTaskBar(); if(bar == null) return null; TaskItem item = bar.getItem(shell); if(item == null) item = bar.getItem(null); return item; }
answers question: http://stackoverflow.com/q/27232523
score: 0

http://stackoverflow.com/q/27175945
has answer: http://stackoverflow.com/a/27176733
favorite count: 0
has comment: http://stackoverflow.com/comment/42841209
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: how to broadcast data to clients in java
has comment: http://stackoverflow.com/comment/42846916
tagged with: desktop-application
has answer: http://stackoverflow.com/a/27210237
has answer: http://stackoverflow.com/a/27176644
has body: I am writing a small desktop application which is about showing notifications to the client who is using this application.so my application should get notifications from a server where all the notifications are stored.so if there are 100 clients using this app and if I add some notifications to server how can I send these data to 100 clients...please give me some idea what APIs or which technology I can use to get this functionality implemented.this application is a desktop application
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42881987

http://stackoverflow.com/q/27217575
has comment: http://stackoverflow.com/comment/42915553
tagged with: sqlite
tagged with: applet
has title: Saving user progress/session activity?
has body: I am creating a local java programming tutorial applet and was hoping to have several local users on the same computer, I was wondering if there was any way that I can save multiple users progression/session activity on the applet? I am writing it in Java/Netbeans, If there are other solutions/ways this could be done, I would love to know. Is it possible to use SQLite? Maybe have the saves of each user within the applet (Load/Save/Delete User), not as a separate file that needs selecting. E.G. User 1 makes a local user save, John for example, so "John Save". John completes 10 out of 50 questions. Saves. User 2 makes a local user save, Bob for example, so "Bob Save". Bob completes 13 out of 50 questions. Saves. John selects and loads his save and continues on with the questions etc, etc. Any help would be greatly appreciated Thank You, Mark Lang
has comment: http://stackoverflow.com/comment/42915203
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/43099627
type: AnswerComment
has text: UseBoundThreads give 1x1 feature.. without it it can be MxN AdjustConcurrency is used in absence of 1x1 to make sufficient lpw available for JVM. Java thread priority also influences how thread scheduling happen.
type: Comment
comment on: http://stackoverflow.com/a/27316500
score: 0

http://stackoverflow.com/comment/42839015
score: 0
comment on: http://stackoverflow.com/q/27174588
type: Comment
type: QuestionComment
has text: @MarounMaroun: I don't remember seeing anything explicitly about it...

http://stackoverflow.com/comment/43046338
score: 0
type: Comment
type: QuestionComment
has text: Thanks. Any way to tell login_failed_template whether the authentication method is certificate, user/pass or any other?
comment on: http://stackoverflow.com/q/27276496

http://stackoverflow.com/comment/42838100
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27173871
type: Comment
has text: So then just put those headers and send a request?

interface
tags question: http://stackoverflow.com/q/27210653
tag name: interface
tags question: http://stackoverflow.com/q/27180174
tags question: http://stackoverflow.com/q/27222839
tags question: http://stackoverflow.com/q/27177003
tags question: http://stackoverflow.com/q/27264183
type: Tag
tags question: http://stackoverflow.com/q/27294442
tags question: http://stackoverflow.com/q/27304059
tags question: http://stackoverflow.com/q/27228173
tags question: http://stackoverflow.com/q/27259042
tags question: http://stackoverflow.com/q/27267583
tags question: http://stackoverflow.com/q/27296326
tags question: http://stackoverflow.com/q/27190691
tags question: http://stackoverflow.com/q/27236457
tags question: http://stackoverflow.com/q/27196552
tags question: http://stackoverflow.com/q/27295527
tags question: http://stackoverflow.com/q/27182708

http://stackoverflow.com/comment/42877551
has text: Yep, it's clear now. Thanks. I've accepted _striving_coder_'s answer since he has less reputation, hope you don't mind :)
comment on: http://stackoverflow.com/a/27196047
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42911613
type: QuestionComment
comment on: http://stackoverflow.com/q/27215707
type: Comment
has text: java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1540) at States.load(States.java:47) at States.main(States.java:21) I believe this is what you are talking about, if not let me know. I'm not sure what i'm doing wrong since i'm following exactly what i did in another program and just changing the variables and .txt file.
score: 0

http://stackoverflow.com/comment/42945849
type: QuestionComment
has text: Practically,it's not possible to parse each of the movie any of the possible way! The idea seems vague! You need to lay more emphasis for a stricter regex.
type: Comment
comment on: http://stackoverflow.com/q/27234588
score: 0

http://stackoverflow.com/comment/42923510
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27221772
has text: @MadProgrammer could you please help?

http://stackoverflow.com/a/33315328
type: Answer
has body: Since there's no OS-agnostic way to deal with mounting filesystems, there's definitely no JDK API for this. I'm guessing this problem is not dealt with much (not a lot of programs deal with mounting filesystems directly), so it's unlikely that there's any prebuilt library out there waiting for you. Of the approaches you mentioned, they all sound roughly equal in terms of how platform-specific they are (all Linux-only), so that just leaves performance and ease of coding as open questions. Regarding performance, running lsusb more than once a second is (a) a giant hack :-) and (b) fork+exec is slow compared to running something in-process, and tailing the event log will create a lot of (unpredictable) work for your program that is not related to USB mounts as well as making your implementation more fragile (what if the message strings change when you upgrade your OS?). Regarding ease of programming, either using jna or JNI to call into libudev or a WatcherService on /media sound about equal -- using libudev seems like the most portable option across Linux distros / user configurations (I'm guessing that's what Nautilus uses). However, for simplicity of implementation that will work for 99% of users, it's hard to do better than a WatcherService on /media. To help ensure that the filesystem is available before use, I would just use a loop with some kind of randomized exponential backoff in the amount of time to wait between attempts to read the directory -- that way you never wait way longer than necessary for the filesystem to mount, you aren't burning tons of CPU waking up and trying to read, and you don't have to pick a single timeout number that won't work everywhere. If you care enough to ensure you don't tie down a single thread sleeping forever, I'd use a ScheduledExecutorService to issue Runnables that try to access the filesystem, and if it's not available schedule themselves to run again in a bit, otherwise alert your main thread that a new filesystem is avail…
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27251726

http://stackoverflow.com/comment/42918148
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27219365
score: 0
has text: Could you provide some log prints?

http://stackoverflow.com/a/27186453
score: 1
has body: You are simply writing super(context, DB_NAME, null, 1); in DatabaseOpenHelper's constructor. Here istead of DB_NAME, you need to give the path + DB_NAME like below, super(context, EXTERNAL_PATH + "\" + DB_NAME, null, 1); Now it will point to the db you have in your external storage. Previously the code was searching DB in the local path of application.
has comment: http://stackoverflow.com/comment/42860005
has comment: http://stackoverflow.com/comment/42859769
has comment: http://stackoverflow.com/comment/42860053
has comment: http://stackoverflow.com/comment/42859862
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27186211
has comment: http://stackoverflow.com/comment/42860135
has comment: http://stackoverflow.com/comment/42860061
type: Answer
accepted answer of: http://stackoverflow.com/q/27186211
downvote count: 0

http://stackoverflow.com/q/27309099
has body: I've a linked list that has two links - next and another assume. Initially, all another hold null. Now, I'm trying to convert this to a binary tree with next holding the liftChild and another holding rightChild. However, I want to do this in O(n) and in constant space. I've tried a lot. Below is my code. I'm verifying the result by level-order traversing the resulting tree. Currently, I know what's the mistake but don't know how to solve it. The mistake here is that inside the while loop, I'm changing the links of the node properly, but this means I cannot do node = node.next at the end because node's next is already pointing somewhere ahead in the list. So, I don't know how to traverse every node. Any hint, help is appreciated. Not hw, not interview question or anything. Just trying to learn data structures. So, this tree and ll stuff! public class LlToBt { public SpecialNode llToBt(SpecialNode node) { SpecialNode temp = node; SpecialNode returnNode = node; if(node == null) return null; if(node.next == null) return node; node = returnNode; while(node != null) { SpecialNode currentNode = node; temp = temp.next; if(temp == null) { //node.next = null; //node.another = null; return returnNode; } node.next = temp; temp = temp.next; if(temp == null) { //node.next = null; //node.another = null; return returnNode; } node.another = temp; node = currentNode.next; } return returnNode; } }
has title: Converting a linkedlist to binary tree
answer count: 1
has answer: http://stackoverflow.com/a/27309137
tagged with: data-structures
tagged with: binary-tree
score: 0
type: UnansweredQuestion
tagged with: tree
tagged with: linked-list
tagged with: java
type: Question

http://stackoverflow.com/comment/42996640
comment on: http://stackoverflow.com/q/27261906
type: QuestionComment
has text: Thank you Alex for indentation and formatting.
type: Comment
score: 0

http://stackoverflow.com/comment/42821130
score: 1
type: AnswerComment
type: Comment
has text: @Zack There isn't enough information in your question to answer that. It depends whether or not you need sequencing, flow control, guaranteed arrival of every message, etc. If you don't, you can use UDP. If you do you must use TCP, or else implement an *uber*-protocol over UDP that does all that for you, which is pretty pointless when TCP already exists. But sending a message every .2 seconds to seven clients isn't really much of a performance concern, and not in itself sufficient grounds to make this decision on. If UDP is sufficient you might look into multicast too.
comment on: http://stackoverflow.com/a/27162610

http://stackoverflow.com/comment/42877398
score: 1
comment on: http://stackoverflow.com/q/27196142
has text: @IslamBouderbala be happy now you have an upvote too :)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27215771
has answer: http://stackoverflow.com/a/27215795
tagged with: java
has comment: http://stackoverflow.com/comment/42915675
type: Question
duplicate of: http://stackoverflow.com/q/26720759
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27215795
tagged with: android
tagged with: android-studio
linked to: http://stackoverflow.com/q/26720759
has title: Icon missing on Action Bar in Android Studio when I try to add using setIcon or SetLogo the app crashes
has body: Ok - this one is driving me a little nuts. I downloaded Android Studio 0.8.14. I created a test app with it and all worked ok. Since then I've obviously done something because every new App I create is missing the app icon from the action bar when I compile it and run it. If I change the theme on the activity view page I can see it in the preview but nothing shows up when I run it on my phone. The original app I created still has the icon present. My minimum SDK is 9 and my target is 21. Any ideas anyone? Thanks Just to add.. based on advice I have set the minimum SDK to 11 and tried the following but have not had success with either... ActionBar actionBar = getActionBar(); actionBar.setIcon(R.drawable.ic_launcher); Which causes my app to crash when run (on 4.4) ActionBar actionBar = getSupportActionBar(); actionBar.setIcon(R.drawable.ic_launcher); Which does nothing. I'm calling these from my activities on create method. Thanks in advance
type: AnsweredQuestion

http://stackoverflow.com/a/27307043
score: 0
has body: Clearly Pizza is in a different package from PizzaTest and you haven't added the appopriate import statement into PizzaTest.
type: Answer
answers question: http://stackoverflow.com/q/27306965

http://stackoverflow.com/a/27301026
type: Answer
answers question: http://stackoverflow.com/q/27300909
has body: An if statement, an else if stattement, and an else statement should cover different, non-overlapping conditions that are possible in your code. For example: class IfElseDemo { public static void main(String[] args) { int testscore = 76; char grade; if (testscore &gt;= 90) { grade = 'A'; } else if (testscore &gt;= 80) { grade = 'B'; } else if (testscore &gt;= 70) { grade = 'C'; } else if (testscore &gt;= 60) { grade = 'D'; } else { grade = 'F'; } System.out.println("Grade = " + grade); } } It's hard to tell without your full program, but it seems like your else statements overlap your if statement. Since the if statement is satisfied, the program does not need to consider the else if's. From https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43066198
has comment: http://stackoverflow.com/comment/43066226
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27300909

command-line
tags question: http://stackoverflow.com/q/27201659
tags question: http://stackoverflow.com/q/27202481
type: Tag
tags question: http://stackoverflow.com/q/27200106
tags question: http://stackoverflow.com/q/27276939
tags question: http://stackoverflow.com/q/27285896
tags question: http://stackoverflow.com/q/27215718
tags question: http://stackoverflow.com/q/27286895
tags question: http://stackoverflow.com/q/27234564
tags question: http://stackoverflow.com/q/27169723
tags question: http://stackoverflow.com/q/27251357
tags question: http://stackoverflow.com/q/27264506
tag name: command-line
tags question: http://stackoverflow.com/q/27165594

http://stackoverflow.com/a/27210237
has body: There are two (maybe more but I know those two. :) ) patterns to deal with those types of scenarios. Observer and publish-subscriber They are very similar with the difference that for the Observer pattern, the "standard" implementation might create memory leaks while in a publish-subscriber scenario, neither the publish or subscriber knows about each other. Have a look a the links below that might give you a better idea. http://en.wikipedia.org/wiki/Observer_pattern http://www.oodesign.com/observer-pattern.html http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern http://www.eaipatterns.com/PublishSubscribeChannel.html
type: Answer
answers question: http://stackoverflow.com/q/27175945
score: 0

http://stackoverflow.com/comment/43043186
type: Comment
has text: Well I just ran it about twice, with the values OP provided and `2` did not move from it's original position. This answer suggests doing it twice with random `seeds`: http://stackoverflow.com/questions/4228975/how-to-randomize-arraylistv
comment on: http://stackoverflow.com/a/27288106
type: AnswerComment
score: 0

http://stackoverflow.com/a/27312770
has comment: http://stackoverflow.com/comment/43109729
answers question: http://stackoverflow.com/q/27307973
has body: Spring AOP relies on the Spring framework and only works with Spring Beans. So you cannot use it without the Spring framework. What you want to use is AspectJ. It only needs one runtime library and works with POJOs, in application servers, with EJBs or even in combination wirth Spring. It does not need any dynamic proxies because it instruments your code directly during compilation or dynamically during class-loading. It is faster, leaner and much more powerful than Spring AOP.
has comment: http://stackoverflow.com/comment/43112944
score: 0
type: Answer

http://stackoverflow.com/q/27241550
has answer: http://stackoverflow.com/a/27248262
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
score: 2
has body: I have a POJO which contain a field need to be output to XML with tag name "class". Using Jersey 2.0, if the client request a JSON response, the JSON object output correctly with attribute name "class". However, if the client request an XML output, Jersey fail with a HTTP 500 internal error. Checked that the statement causing the error is @XmlElement(name = "class") private int vclass; Removing the XmlElement annotation and allow the XML to use vclass as tag name work fine. How could I instruct JAXB to use class as tag name ??
has answer: http://stackoverflow.com/a/27241725
upvote count: 2
has comment: http://stackoverflow.com/comment/42963737
tagged with: jaxb
type: Question
tagged with: jersey
has title: Why "class" cannot be use as tag name in JAXB
tagged with: java

http://stackoverflow.com/comment/42974135
has text: Note that Maven will not infect your computer with a virus, its a useful little tool to have around requiring no installation of any kind - just unpack and go. So I wouldn't know why you need a frowny face when Maven is needed.
type: Comment
comment on: http://stackoverflow.com/a/27248966
score: 1
type: AnswerComment

http://stackoverflow.com/a/27217925
answers question: http://stackoverflow.com/q/27217837
accepted answer of: http://stackoverflow.com/q/27217837
score: 0
type: AcceptedAnswer
has body: Try to call it in your main and print it out - public static void main(String[] args){ Scanner scanner = new Scanner(System.in); String filename = scanner.next(); CO2Data[] aDataArray = null aDataArray = readData(filename); if(aDataArray != null) { for(int i = 0; i &lt; aDataArray.length; i++) { System.out.println("Country:" + aDataArray[i].getCountry()); System.out.println("CO2 Level:" + aDataArray[i].getTotalCO2()); } } }
type: Answer

layout-inflater
tags question: http://stackoverflow.com/q/27258686
type: Tag
tag name: layout-inflater

http://stackoverflow.com/a/27292808
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27292478
has body: You defined return type as char[] which means char array (linear) and you are returning cache_1[cache_set][] //should give multiple error and one for not giving index inside the second [?] if you write this correctly then you are returning an char not char[] You have to change any one of it.

http://stackoverflow.com/comment/42940081
comment on: http://stackoverflow.com/q/27222860
score: 0
type: Comment
type: QuestionComment
has text: A screenshot would not really help here. What you see is "empty input". As long as I type I see no echo. As soon as I hit enter I see what I have typed. The console accepts all editing commands incl. backspace or cursor movements (I tested this). However I am basically blind. Right now I prepare the statements in an editor and paste them into the console. Not really convenient :(

http://stackoverflow.com/comment/42829669
score: 0
type: QuestionComment
type: Comment
has text: you should split the strings in two first; the other part being the integer part, and the other the string part. then first compare the integers - if the integers are not equal, the string that should appear first is the one with the smaller integer part. If they are equal, the string that should appear first is the one with *alphabetically smaller* string part.
comment on: http://stackoverflow.com/q/27169234

http://stackoverflow.com/comment/42964023
has text: @Oninez See [my answer](http://stackoverflow.com/a/27244343/474189). You need to store the result of `remove()` and add it again.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27244297
type: Comment

http://stackoverflow.com/q/27154479
linked to: http://stackoverflow.com/q/4131585
upvote count: 1
type: Question
has body: I have some floating bugs in my app, which unable to reproduce clearly. I suspect them from inproper work of my SaveInstanceState|restoreInstanceState mechanism, so I need to check case, when activity is being stopped when goes to background, and recreating after I press back button from spawned activity. Is there a way to force android stop and destroy activity which went to background? It should remain on activity stack, so I cannot just finish it.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27194174
answer count: 2
linked to: http://stackoverflow.com/q/1024803
downvote count: 0
favorite count: 0
has title: Is there a way to tell android force stop activity which going to background without removing it from activity stack?
accepted answer: http://stackoverflow.com/a/27194174
tagged with: android
possible better answer: http://stackoverflow.com/a/27154733
tagged with: android-activity
has answer: http://stackoverflow.com/a/27154733
type: AnsweredQuestion

http://stackoverflow.com/q/27165592
has answer: http://stackoverflow.com/a/27166316
tagged with: web
has answer: http://stackoverflow.com/a/27166731
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/3486458
type: Question
duplicate of: http://stackoverflow.com/q/3486458
has body: I am working on a struts2 based web application and want to stop web crawlers from visiting my application.
tagged with: web-crawler
score: 0
has title: How to stop different web crawlers from visiting java based web application?
answer count: 2

http://stackoverflow.com/a/27280378
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27280251
type: Answer
has body: You're probably going to want to use BufferedInputStream. Here is an example: import java.io.*; class TestBinaryFileReading { static public void main(String[] args) throws IOException { DataInputStream data_in = new DataInputStream( new BufferedInputStream( new FileInputStream(new File("binary_file.dat")))); while(true) { try { int t = data_in.readInt();//read 4 bytes System.out.printf("%08X ",t); // change endianness "manually": t = (0x000000ff &amp; (t&gt;&gt;24)) | (0x0000ff00 &amp; (t&gt;&gt; 8)) | (0x00ff0000 &amp; (t&lt;&lt; 8)) | (0xff000000 &amp; (t&lt;&lt;24)); System.out.printf("%08X",t); System.out.println(); } catch (java.io.EOFException eof) { break; } } data_in.close(); } } From How to read binary file created by C/Matlab using JAVA

http://stackoverflow.com/comment/43031302
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27279497
type: Comment
has text: Thanks for taking the time out to read a lengthy question. I think first I should spend some time trying Spring Batch out of the box feature to achieve multi-threading

http://stackoverflow.com/comment/42865418
type: AnswerComment
score: 0
type: Comment
has text: You just forgot this inside the for loop: integerNum=correctBase.charAt(i)-'0';
comment on: http://stackoverflow.com/a/27188249

http://stackoverflow.com/comment/81133961
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27226712
has text: @Marc thanks, not tested in the wild, but I agree. I have put the blame on you.
type: AnswerComment

http://stackoverflow.com/a/37351767
has comment: http://stackoverflow.com/comment/62615897
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/62550033
accepted answer of: http://stackoverflow.com/q/27231259
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/135090095
has comment: http://stackoverflow.com/comment/135101463
upvote count: 6
has body: Now there's a different workaround for that: just implement the RealmModel interface instead of extending from RealmObject: @RealmClass public class User implements RealmModel { } You can find more information in the Realm Documentation.
has comment: http://stackoverflow.com/comment/135085178
answers question: http://stackoverflow.com/q/27231259

http://stackoverflow.com/comment/43023970
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27277357
has text: It is concerning that you are passing two parameters to the method and only using one of them. Please post some test code and expected results.

http://stackoverflow.com/comment/43028656
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27278889
has text: okay I will try it and accept your answer, when it my don't work can I contact you then on stack exchange?
type: AnswerComment

http://stackoverflow.com/q/27222918
tagged with: jcheckbox
answer count: 1
tagged with: user-interface
favorite count: 0
has title: What does the public Gui() mean in my code? what is it?
has answer: http://stackoverflow.com/a/27222953
tagged with: constructor
type: UnansweredQuestion
tagged with: swing
has body: So I was making a Gui and I did the usual stuff, and I always do public Gui() {and have code in it}. what does it mean? Is it a constructor? What is it? package tacos; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Gui extends JFrame{ private JTextField tf; private JCheckBox boldbox; private JCheckBox italicbox; public Gui(){ //what does this public Gui thing mean? super("the title"); setLayout(new FlowLayout()); tf = new JTextField("this is a sentence", 20); tf.setFont(new Font("Serif",Font.PLAIN,14)); add(tf); boldbox = new JCheckBox("bold"); italicbox = new JCheckBox("italic"); add(boldbox); add(italicbox); HandlerClass handler = new HandlerClass(); boldbox.addItemListener(handler); italicbox.addItemListener(handler); } }
has comment: http://stackoverflow.com/comment/42924365
tagged with: java
has comment: http://stackoverflow.com/comment/42924386
type: Question
upvote count: 2
score: 0
downvote count: 2

http://stackoverflow.com/comment/42913261
comment on: http://stackoverflow.com/a/27216419
type: Comment
score: 0
type: AnswerComment
has text: @Malikov There are some random balls disappearing sometimes but the balls still go right through each other...

http://stackoverflow.com/comment/42920044
comment on: http://stackoverflow.com/q/27220363
score: 0
type: Comment
type: QuestionComment
has text: type of dates from Database is: java.sql.Timestamp

http://stackoverflow.com/q/27239837
type: Question
has answer: http://stackoverflow.com/a/27249549
tagged with: jackrabbit
tagged with: jcr
upvote count: 3
answer count: 2
tagged with: jcr-sql2
favorite count: 0
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/36722267
accepted answer: http://stackoverflow.com/a/27249549
downvote count: 0
has body: Let's pretend I have a JCR 2 query string that is made like this: String sql2Query = "SELECT * FROM [cq:PageContent] " + "WHERE [aProperty] &lt;&gt; \" + aValue + "\""; Are there helper methods using which I can escape aValue? By the way, I already know that in SQL2 we can use placeholders for queries and let the framework take care of escaping of values for us, but if I were to create this query dynamically, how can I escape aValue to prevent SQL injection as well as construction of broken queries?
has answer: http://stackoverflow.com/a/36722267
has title: How to escape dynamically generated String values in a JCR SQL2 query?
tagged with: java

http://stackoverflow.com/q/27298551
upvote count: 0
has comment: http://stackoverflow.com/comment/43061297
tagged with: java
tagged with: loops
tagged with: output
type: Question
has comment: http://stackoverflow.com/comment/43061472
has title: Why does this do-while loop not produce the right output?
linked to: http://stackoverflow.com/q/15273449
has body: public static void main(String[] args) throws IOException { System.out.println("Hello, come and play a game with me!"); int x = 5; int guess; do { System.out.println("Please input a number..."); guess = System.in.read(); guess = System.in.read(); if (guess &lt; 5) { System.out.println("You guessed the number!"); break; } } while (guess &gt; 5); } So here I wrote some code. It's supposed to be a guessing game, but no matter what I input, it always gives me in the output "Please input a number..." NO MATTER WHAT I PUT. Basically, if the "guess" is more than 5, then they guessed the number. If it's not, then they haven't guessed the number. That's the premise of the game. Can someone help me fix my code, so it doesn't just output the same thing regardless?
possible better answer: http://stackoverflow.com/a/27298598
has answer: http://stackoverflow.com/a/27298598
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/43061366
has answer: http://stackoverflow.com/a/27298639
accepted answer: http://stackoverflow.com/a/27298639
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/43061414
has answer: http://stackoverflow.com/a/27298728
has answer: http://stackoverflow.com/a/27300261
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/27312019
answers question: http://stackoverflow.com/q/27311909
upvote count: 1
type: Answer
has body: You try to add String line into Person array. You can't cast String to Person. Fix:Try to implement some kind of line parser eg. Your line looks like this "adam;bra;555888666;" you have to parse this string using line.split(";") it creates you array of Strings (String[]) now just use your constructors to create Person and add him into contactList eg. contactList.add(New Person(parsedString[0], parsedString[1], parsedString[2]));
downvote count: 0
score: 1

http://stackoverflow.com/q/27193614
score: 0
tagged with: c++
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42872742
has answer: http://stackoverflow.com/a/27197690
tagged with: algorithm
tagged with: java
type: Question
has title: Guessing a word from random triplet alphabets
answer count: 1
has comment: http://stackoverflow.com/comment/42872782
tagged with: string
tagged with: data-structures
favorite count: 0
has body: I came across this problem that I can't figure out its full solution yet. (source: http://www.careercup.com/question?id=5678056593162240) Given a function getRandomTripplet() which returns a random triplet of letters from a string. You don't know the string using calls to this function you have to correctly guess the string. the length of the string is also given. Lets say the string is helloworld the function getRandomTriplet will return things like hlo hew wld owo the function maintains the relative order of the letters. so it will never return ohl since h is before o in the string. owe since w is after e The string is not known you are only given length of the string. My approach so far is running the getRandomTripplet() 1000 times, then look up duplicate characters by getting the ones with highest occurrences (probability > 1/10). Am I on the right track? Thanks for your help. Cheers!

http://stackoverflow.com/q/27187461
tagged with: java
tagged with: rsa
has comment: http://stackoverflow.com/comment/42864240
has answer: http://stackoverflow.com/a/27202049
type: Question
downvote count: 0
has body: I have a java card applet which will generate a RSA private public key pair (512 bits each). And it will send the public key modulus and exponent (modulus is 64 bytes) In the host application (java) i need to re build the rsa public key using the same exponent and modulus, but when i try to reconstruct using the following code i am getting an error. Java card code: // this one to create the key pair rsa_KeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_512); rsa_KeyPair.genKeyPair(); rsa_PublicKey = (RSAPublicKey) rsa_KeyPair.getPublic(); rsa_PrivateCrtKey 0= (RSAPrivateCrtKey) rsa_KeyPair.getPrivate(); cipherRSA = Cipher.getInstance(Cipher.ALG_RSA_PKCS1, false); //this is to send the modulus byte[] buffer = apdu.getBuffer(); rsa_PublicKey.getModulus(buffer, ISO7816.OFFSET_CDATA); apdu.setOutgoing(); apdu.setOutgoingLength((short) 64); apdu.sendBytesLong(buffer, ISO7816.OFFSET_CDATA, (short) 64); This part of the code is working fine. i am able to send the modulus perfectly to the host side. Java code for host application below: //command for retrieving modulus resp = channel.transmit(new CommandAPDU(cmdMod)); BigInteger modulus = new BigInteger(resp.getData()); I am getting the 64 byte modulus as expected but when i make a big integer out of it its showing a large negative value. //command for retrieving exponent resp = channel.transmit(new CommandAPDU(cmdExp)); BigInteger modulus = new BigInteger(resp.getData()); byte[] input = { (byte) 0x92, (byte) 0x84, (byte) 0x3B, (byte) 0xD3, (byte) 0x5D, (byte) 0x8A, (byte) 0x6B, (byte) 0x56, (byte) 0xDA, (byte) 0xEA, (byte) 0xE0, (byte) 0x2F, (byte) 0x6D, (byte) 0xAA, (byte) 0x62, (byte) 0x4B, (byte) 0x38, (byte) 0xCE, (byte) 0xD4, (byte) 0x70, (byte) 0xA2, (byte) 0x16, (byte) 0x35, (byte) 0xCC, (byte) 0xEE, (byte) 0xB8, (byte) 0x31, (byte) 0x13, (byte) 0x37, (byte) 0x40, (byte) 0xBE, (byte) 0xA1, (byte) 0xCD, (byte) 0x84, (byte) 0xD9, (byte) 0xF3, (byte) 0xE6, (byte) 0xCE, (byte) 0x26, (byte) 0x0A, (byte) 0x…
accepted answer: http://stackoverflow.com/a/27202049
score: 3
tagged with: public-key-encryption
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/18819095
type: AnsweredQuestion
has title: how to build a rsa key with a modulus of 64 bytes in java
tagged with: javacard
upvote count: 3

http://stackoverflow.com/a/27231228
answers question: http://stackoverflow.com/q/27231066
has comment: http://stackoverflow.com/comment/42939863
type: Answer
has body: The JAR file format provides many benefits. You can make your Java application runnable via a double-click by packaging it into an executable jar. This answer will help you.
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42939601
accepted answer of: http://stackoverflow.com/q/27231066

http://stackoverflow.com/comment/43005218
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27264292
has text: Maybe my english is too bad, but I don't understand "which is secured one". However maybe you find some usefull information in the example section of cxf http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/
score: 1

http://stackoverflow.com/a/27305390
type: Answer
answers question: http://stackoverflow.com/q/27305164
score: 2
has body: Well server waits for if(tmp == 0) which is 0 is a nil, and the client never sends it. I think You are waiting about \n which it's not 0, it's 10(line feed). Just wondered why don't you use DataOutputStream#writeUTF() and DataInputStream#readUTF()?
downvote count: 0
has comment: http://stackoverflow.com/comment/43076167
has comment: http://stackoverflow.com/comment/43075894
upvote count: 2
has comment: http://stackoverflow.com/comment/43075905

http://stackoverflow.com/q/27153642
tagged with: gwtmockito
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: unit-testing
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/27165848
has title: Is it possible to test a method that uses uiBinder XML elements with JUnit?
tagged with: uibinder
answer count: 1
downvote count: 0
has body: Here is my problem : I have a method called desactiveNavLinks that desactive all widgets in my sideBarContainer (HTMLPanel), this method works perfecly. So here is the code of my uiBinder XML : MainSideBarImpl.ui.xml : <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> <ui:style> .centerDiv { text-align: center; } .logo { height: 15%; width: 15%; } .logoName { width: 65%; } </ui:style> <g:HTMLPanel> <b:Image url="GA/img/img1.png" styleName="{style.logoName}"></b:Image> <b:Image ui:field="userPic"></b:Image> <g:HTMLPanel ui:field="sideBarContainer"> <b:NavLink icon="HOME" ui:field="homeNavLink">Clients</b:NavLink> <b:AccordionGroup heading="Client" ui:field="accordionGrp"> </b:AccordionGroup> <b:base.IconAnchor icon="EDIT" ui:field="benchNavLink">Benchmark</b:base.IconAnchor> Favoris </g:HTMLPanel> </g:HTMLPanel> The method that I want to test in MainSideBarImpl.java : public void desactiveNavLinks() { //sideBarContainer is a HTMLPanel declared in the same Classe with @UiField annotation. for(int i = 0;i<sideBarContainer.getWidgetCount();i++){ if(sideBarContainer.getWidget(i).getStyleName().contains("active")){ sideBarContainer.getWidget(i).removeStyleName("active"); sideBarContainer.getWidget(i).getParent().removeStyleName("active"); } } for(SiteNavLinkEditor w : sitesEditor.getEditors()){ w.setActive(false); } } Here is my UnitTest Method : @RunWith(GwtMockitoTestRunner.class) public class MainSideBarTest{ @GwtMock private HTMLPanel sideBarContainer; private MainSideBarImpl widget; @Before public void setUp(){ widget = new MainSideBarImpl(); } @Test public void testDesactiveNavLinks(){ System.out.println("Widgets count = "+sideBarContainer.getWidgetCount()); //That is printing 0 and should print all the widgets inside of the HTMLPanel widget.desactiveNavLinks(); } } It's look like that the class is not instantiated with the UiBinder process, so my question…
favorite count: 0

http://stackoverflow.com/comment/42849622
type: Comment
has text: No, optimization is *not* the reason we have both. Polymorphism means the optimized implementation would automatically be used under the covers. @Avin, you correctly point out that we should not need both. As `String` is a `CharSequence`, we could simply pass a String instance to the method expecting a CharSequence instance. The reason we have both is because the early Java teams did not think this through thoroughly. The CharSequence interface was added much later, in Java 4 (1.4). So the signature expecting a String already existed.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27176221

http://stackoverflow.com/comment/42891351
score: 1
comment on: http://stackoverflow.com/q/27203486
has text: You will need to rewrite your app to use native Android APIs, or third-party libraries that work on Android.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27282718
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43180225
has comment: http://stackoverflow.com/comment/43119057
answers question: http://stackoverflow.com/q/27282495
score: 0
has body: You can change your list to this List&lt;Borrower&gt; borrowerList = new ArraySortedList&lt;Borrower&gt;(); and then add a method to your program that gets a borrower by name private Borrower getBorrowerByName( String borrowerName ){ for( Borrower borrower : borrowerList ){ if( borrower.getName().equalsIgnoreCase( borrowerName ) ){ return borrower; } } return null; } then when you create a new borrower, you add it to the list - when you get an existing borrower, you use the method and check for null before adding an item to it.
type: Answer

http://stackoverflow.com/q/27209872
type: UnansweredQuestion
downvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27209883
type: Question
upvote count: 0
has body: System.out.println(numArray[i] "which is" (100*numArray[i]/theSum) " % of the sum."); Everything in my program seems to be fine except this last line. I tried everything I could think of and it still displays an error. - The type of the expression must be an array type but it resolved to int - Syntax error on token ""which is"", [ expected - Syntax error on token "" % of the sum."", ] expected - Syntax error on token "" % of the sum"", ] expected - Syntax error on token "", which is"", [ expected That is what it displays. Any suggestions?
has title: What is wrong with this line in my program?
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/42901436
favorite count: 0
has comment: http://stackoverflow.com/comment/42901427
score: -2

http://stackoverflow.com/a/27166302
score: 2
upvote count: 2
has body: Try your function something like: private static ArrayList&lt;Integer&gt; extractIntegers(char[] characters) { ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); char lastValue = 49;//let it be int 1 for (int i = 0; i &lt; characters.length; i++) { if (characters[i] == ' ') { continue; } boolean isNumber = Character.isDigit(characters[i]);//is really a digit? boolean isSign = (lastValue == '-');//is last char value that we read really a '-' if (isNumber) { if (!isSign) numbers.add(((int) characters[i] - 48)); else numbers.add((int) -1 * ((int) characters[i] - 48));//if last token was "-" multiply by -1 } lastValue = characters[i]; } return numbers; }
has comment: http://stackoverflow.com/comment/42825406
has comment: http://stackoverflow.com/comment/42825361
has comment: http://stackoverflow.com/comment/42826766
has comment: http://stackoverflow.com/comment/42825600
has comment: http://stackoverflow.com/comment/42827601
has comment: http://stackoverflow.com/comment/42828076
has comment: http://stackoverflow.com/comment/42824734
answers question: http://stackoverflow.com/q/27166131
has comment: http://stackoverflow.com/comment/42826048
downvote count: 0
has comment: http://stackoverflow.com/comment/42825441
has comment: http://stackoverflow.com/comment/42825465
has comment: http://stackoverflow.com/comment/42829477
has comment: http://stackoverflow.com/comment/42828747
has comment: http://stackoverflow.com/comment/42825323
type: Answer
has comment: http://stackoverflow.com/comment/42825549

http://stackoverflow.com/q/27308032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43091130
score: 0
answer count: 2
has body: I am working on a robot maze where the robot finds the target without bumping into walls. As a "backtrack" method, I need the robot to go in the opposite direction as it did when it first came across a junction. This is my code: import uk.ac.warwick.dcs.maze.logic.IRobot; import java.util.ArrayList; import java.util.*; import java.util.Iterator; public class Explorer { private int pollRun = 0; // Incremented after each pass. private RobotData robotData; // Data store for junctions. private ArrayList&lt;Integer&gt; nonWallDirections; private ArrayList&lt;Integer&gt; passageDirections; private ArrayList&lt;Integer&gt; beenbeforeDirections; private Random random = new Random(); int [] directions = {IRobot.AHEAD, IRobot.LEFT, IRobot.RIGHT, IRobot.BEHIND}; public void controlRobot (IRobot robot) { // On the first move of the first run of a new maze. if ((robot.getRuns() == 0) &amp;&amp; (pollRun ==0)) robotData = new RobotData(); pollRun++; /* Increment poll run so that the data is not reset each time the robot moves. */ int exits = nonwallExits(robot); int direction; nonWallDirections = new ArrayList&lt;Integer&gt;(); passageDirections = new ArrayList&lt;Integer&gt;(); beenbeforeDirections = new ArrayList&lt;Integer&gt;(); // Adding each direction to the appropriate state ArrayList. for(int item : directions) { if(robot.look(item) != IRobot.WALL) { nonWallDirections.add(item); } } for(int item : directions) { if(robot.look(item) == IRobot.PASSAGE) { passageDirections.add(item); } } for(int item : directions) { if(robot.look(item) == IRobot.BEENBEFORE) { beenbeforeDirections.add(item); } } // Calling the appropriate method depending on the number of exits. if (exits &lt; 2) { direction = deadEnd(robot); } else if (exits == 2) { direction = corridor(robot); } else { direction = junction(robot); robotData.addJunction(robot); robotData.printJunction(robot); } robot.face(direction); } /* The specification advised to have to seperate controls: Explorer and Backtrack and a var…
possible better answer: http://stackoverflow.com/a/27308134
favorite count: 0
has title: java.lang.reflect.InvocationTargetException error
tagged with: java
has answer: http://stackoverflow.com/a/27308136
accepted answer: http://stackoverflow.com/a/27308136
upvote count: 1
has answer: http://stackoverflow.com/a/27308134
downvote count: 1
type: Question

http://stackoverflow.com/q/27284395
has body: I just started learning Java a couple weeks ago so i'm fairly new. I'm currently working on a TicTacToe game and I was just about finished but instead of having my board display itself as a System.out.print I would like it to be displayed on a JOptionPane message instead to improve it aesthetically. However my board is completely made with loops and i'm not sure how I can display that on a JOptionPane :( I've tried researching similar situations online but I everything I find is quite confusing or doesn't seem to apply to the kind of statements i'm printing. If anyone could help me out it would be much appreciated. public static void showBoard(char[][] brd) { int numRow = brd.length; int numCol = brd[0].length; System.out.println(); // This is the column System.out.print(" "); for (int i = 0; i &lt; numCol; i++) System.out.print(i + " "); System.out.print('\n'); System.out.println(); // blank line after the header // The write the table for (int i = 0; i &lt; numRow; i++) { System.out.print(i + " "); for (int j = 0; j &lt; numCol; j++) { if (j != 0) System.out.print("|"); System.out.print(" " + brd[i][j] + " "); } System.out.println(); if (i != (numRow - 1)) { // separator line System.out.print(" "); for (int j = 0; j &lt; numCol; j++) { if (j != 0) System.out.print("+"); System.out.print("---"); } System.out.println(); } } System.out.println(); }
has comment: http://stackoverflow.com/comment/43037081
answer count: 1
linked to: http://stackoverflow.com/q/14011492
has title: Displaying multiple System.out.print's in a single JOptionPane?
type: AnsweredQuestion
tagged with: joptionpane
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27284697
tagged with: loops
tagged with: swing
has comment: http://stackoverflow.com/comment/43037449
type: Question
accepted answer: http://stackoverflow.com/a/27284697

http://stackoverflow.com/comment/42815901
comment on: http://stackoverflow.com/q/27160943
score: 0
type: QuestionComment
type: Comment
has text: @Joeblade But, unless you case it, you can't use all the nice goodies in `Graphics2D`...which the OP isn't using...

http://stackoverflow.com/a/27214550
upvote count: 1
answers question: http://stackoverflow.com/q/27213688
has comment: http://stackoverflow.com/comment/42932736
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42931615
has comment: http://stackoverflow.com/comment/42978663
has comment: http://stackoverflow.com/comment/42979216
has comment: http://stackoverflow.com/comment/42977132
type: Answer
has body: You are not approaching this the right way. Your entities shouldn't be treated as Spring Beans. @Autowired private ArticoliOrdine articoliOrdine; ... em.persist(articoliOrdine); For long conversations you should either use: Extended persistence context detached objects saved in your Http Session And detached entities shouldn't be passed to persist. You should merge them instead. Persist is only meant for moving an entity state from TRANSIENT to PERSISTED. For DETACHED -&gt; PERSISTED transitions you should always use EntityManager#merge() or Hibernate specific saveOrUpdate.
has comment: http://stackoverflow.com/comment/42979995
has comment: http://stackoverflow.com/comment/42934273

http://stackoverflow.com/comment/42946667
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27235014
type: Comment
has text: Actually, that line works. This is the one that does not: `MenuOptionBuilder<O> builder = new MenuOptionBuilder<O>(new MenuOptionBean()){};`. When I declare the builder with a concrete type like `Link`, the type token in its underlying `abstract` base `class` _can_ resolve the runtime type to `Link`. I cannot, however, declare it with a generic type parameter like `O` and rely on type token to resolve the runtime type which is specified by the conrete menu `class` extending `AbstractMenu`.

http://stackoverflow.com/comment/43065236
has text: For instance we can write `finder.findByTemplate(Collections.singletonMap("name", "cucumber") )` and second variant `finder.findByTemplate(Collections.singletonMap(Links.PRODUCT.name(), "cucumber") )`
score: 0
comment on: http://stackoverflow.com/q/27300245
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42845527
comment on: http://stackoverflow.com/q/27178145
has text: I'm not expecting to solve the problem for me, i just asked for help. And Roberto showed me the right way. Maybe this is a standart problem, but i never faced it before.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43044484
score: 0
type: AnswerComment
has text: could you please explain with example
type: Comment
comment on: http://stackoverflow.com/a/27272739

http://stackoverflow.com/q/27218552
tagged with: user-interface
tagged with: serialization
type: Question
has body: So i am getting this exception, i have been toying around with the exception all day researching etc. ##Error java.io.NotSerializableException: javax.swing.GroupLayout at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) there is more after this but this is obviously most relevant, if need i can add more of the error or even more specific code, but i have got the point where i have given up on solving this myself. ##Code private void saveData() { //Create Dialog JFileChooser objFileDialogue = new JFileChooser(); //Create Dialogue result with default cancel action int intDialogResult = JFileChooser.CANCEL_OPTION; //Show Dialog intDialogResult = objFileDialogue.showSaveDialog(this); //Test dialog result if (intDialogResult == JFileChooser.APPROVE_OPTION) { //Get the file name to use from the dialog File objFile = objFileDialogue.getSelectedFile(); //Declare output stream //Create a Stream writer to the file try (ObjectOutputStream objOut = new ObjectOutputStream( new BufferedOutputStream( new FileOutputStream(objFile)))) { //Write the warehouse object (stockList) to the file objOut.writeObject(newCustomerList); JOptionPane.showMessageDialog(this, "Warehouse data saved.", "Save completed.", JOptionPane.INFORMATION_MESSAGE); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(this, "Error saving data model.", "File save error: " + ex.getMessage(), JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, "Save operation cancelled", "Operation aborted", JOptionPane.ERROR_MESSAGE); } } } Also here is CustomerList class that is being serialized public class CustomerList implements IObserver, ISubject, Serializable { private ArrayList&lt;Customer&gt; customerList; private ISubject subjectDelegate; /** * Default constructor builds an empty customer list object with no customers * yet registered to use the delivery services. Required for serialisation. */ public Custo…
has answer: http://stackoverflow.com/a/27218659
score: 0
tagged with: swing
answer count: 1
linked to: http://stackoverflow.com/q/13895867
tagged with: java
has title: Not Serializable Exception - Group Layout
accepted answer: http://stackoverflow.com/a/27218659
type: AnsweredQuestion

http://stackoverflow.com/q/27194806
has answer: http://stackoverflow.com/a/27194843
answer count: 2
has title: Relationship between the constant DATE and getTime() in the Calendar class
score: 0
has body: I created a program that prints out the time and date of a calendar. Here is my code: public class apples { public static void main(String[] args) { Calendar c = Calendar.getInstance(); System.out.println(c.getTime()); System.out.println(Calendar.DATE); c.set(c.DATE, 1); System.out.println(c.getTime()); System.out.println(Calendar.DATE); Output: Fri Nov 28 19:50:10 CET 2014 5 Sat Nov 01 19:50:10 CET 2014 5 Questions: Why is the initial value of DATE 5? After setting DATE to 1, it remained 5 because it's a constant but c.getTime() returned a different time than before. How does the method know that I set the DATE field to 1 if the variable itself didn't change?
tagged with: constants
possible better answer: http://stackoverflow.com/a/27194843
has answer: http://stackoverflow.com/a/27194847
accepted answer: http://stackoverflow.com/a/27194847
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/27217085
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: else if (this.getP1() == S.getP1() &amp;&amp; this.getP2() == S.getP2()) return true; else if(this.getP1() != S.getP1() &amp;&amp; this.getP2() != S.getP2()) return true; These tests basically returns true if both points of the two segments are equal or they are both different to each respective other. This is redundant and wrong since it would return true for, for example, (10,20) and (30,40). You just need to return the first condition as the result, eg: return this.getP1() == S.getP1() &amp;&amp; this.getP2() == S.getP2();
has comment: http://stackoverflow.com/comment/42914671
type: Answer
answers question: http://stackoverflow.com/q/27217028
has comment: http://stackoverflow.com/comment/42914267
accepted answer of: http://stackoverflow.com/q/27217028
score: 4

http://stackoverflow.com/a/27279862
has comment: http://stackoverflow.com/comment/43028536
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43028673
has comment: http://stackoverflow.com/comment/43028577
type: Answer
has body: Look at the image in your tab. You can clearly see that you have stepped into a file for which Eclipse does not have the source (the image has the small J with binary to indicate that AudioSystem is a class file). As such, the debugger does not have the information for local variables. If you would attach source, your debugger would be able to provide you with additional symbols.
has comment: http://stackoverflow.com/comment/43028764
score: 1
answers question: http://stackoverflow.com/q/27279816
has comment: http://stackoverflow.com/comment/43028479

http://stackoverflow.com/comment/42950094
has text: Hi. It is likely. Im at work at the moment but will update my question with code when I get home.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27229047
type: QuestionComment

http://stackoverflow.com/q/27160828
has answer: http://stackoverflow.com/a/27160899
tagged with: java
has body: im learning java right now in secondary school and having a problem with my code. When create a hand using a string all Card objects in the list have the same rank and suit (in this case; 32) this of course causes a problem because i then try to sort then by rank (regular compareTo of comparing rank then suit). And then try to output the list. I have absolutely no clue why the cards are all created with rank and suit of 32. Im sorry in advance if im posting far too much code or a really big description, first time asking online. Card class: public class Card implements Comparable&lt;Card&gt; // 1 - Ace, 2 to 9 , 10 - Ten, 11 - Jack, 12 - Queen, 13 - King private int rank; // 1 - Clubs, 2 - Diamonds, 3 - Hearts, 4 - Spades private int suit; private boolean isFaceUp; private static final String SUITS = " CDHS"; private static final String RANKS = " A23456789TJQK"; public static final Comparator&lt;Card&gt; SUIT_ORDER = new SuitOrder(); public Card(int rank, int suit) { this.rank = rank; this.suit = suit; if (Character.isUpperCase(suit)) this.isFaceUp = true; this.isFaceUp = false; } public Card(String givenCard) { // charAt(1) always a letter (suit) if (Character.isUpperCase(givenCard.charAt(1))) { this.isFaceUp = true; } this.isFaceUp = false; // Set both characters to uppercase to match static suits/ranks list if (Character.isLetter(givenCard.charAt(0))) Character.toUpperCase(givenCard.charAt(0)); Character.toUpperCase(givenCard.charAt(1)); // now set rank/suit of this card object // dont call other card constructor, use this one //this.rank = 22; //this.suit = 3; this.rank = RANKS.indexOf(givenCard.charAt(0)); this.suit = SUITS.indexOf(givenCard.charAt(1)); } public void flip() { this.isFaceUp = true; } public boolean isFaceUp() { return this.isFaceUp; } public int compareTo(Card otherCard) { if (this.rank != otherCard.rank) return this.rank - otherCard.rank; return otherCard.suit - this.suit; } public static class SuitOrder implements Comparator&lt;Card&gt; { publ…
type: Question
has title: All cards in Hand the same
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27160913
has comment: http://stackoverflow.com/comment/42815359
has comment: http://stackoverflow.com/comment/42815456
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27180330
has comment: http://stackoverflow.com/comment/42815308

http://stackoverflow.com/q/27187141
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I would like to reproduce the cURL proxytunnel option, in Java. I'm using the Apache HttpClient library, but am open to change. I have software for a client who is using a proxy; the only way we can get through that proxy is by using the proxytunnel option when testing with cURL. We'd love to get that behavior working with our current code. Their proxy is SQUID HTTP Proxy. Thanks!
has title: cURL ProxyTunnel option in Java
downvote count: 0
favorite count: 0
tagged with: proxy
tagged with: php
tagged with: curl

http://stackoverflow.com/comment/42956035
comment on: http://stackoverflow.com/a/27235014
type: AnswerComment
type: Comment
has text: @Selena But I will edit what I said to clarify, as I see my last sentence is not what I meant.
score: 0

log4j
tags question: http://stackoverflow.com/q/27306956
tags question: http://stackoverflow.com/q/27274467
tags question: http://stackoverflow.com/q/27178116
tags question: http://stackoverflow.com/q/27216824
tags question: http://stackoverflow.com/q/27217581
tags question: http://stackoverflow.com/q/27158917
tags question: http://stackoverflow.com/q/27252076
tag name: log4j
tags question: http://stackoverflow.com/q/27166164
tags question: http://stackoverflow.com/q/27306986
tags question: http://stackoverflow.com/q/27182234
tags question: http://stackoverflow.com/q/27250001
tags question: http://stackoverflow.com/q/27174875
tags question: http://stackoverflow.com/q/27169127
type: Tag
tags question: http://stackoverflow.com/q/27278892
tags question: http://stackoverflow.com/q/27186137

http://stackoverflow.com/comment/43044016
type: QuestionComment
has text: You will have to include the JAR where the class `com.ibm.jsse2.IBMJSSEProvider2` exists in your ant build.
comment on: http://stackoverflow.com/q/27288726
score: 0
type: Comment

http://stackoverflow.com/a/27236215
has comment: http://stackoverflow.com/comment/42949367
answers question: http://stackoverflow.com/q/27236173
type: Answer
score: 2
downvote count: 0
has body: The form reference inside ValidateUpdate method does not seem right. You have defined it as "update" but trying to refer to it by "add".
upvote count: 2

http://stackoverflow.com/a/27172618
score: 2
upvote count: 2
has body: I guess that you have NullPointerException in this line: if (!userItineraries.containsKey(userId)) { It happens because userItineraries is not initialized. As far as I understand you try to implement some kind of cache using map. In this case initialize it: private Map&lt;String, List&lt;Itinerary&gt;&gt; userItineraries = new HashMap&lt;String, List&lt;Itinerary&gt;&gt;();
has comment: http://stackoverflow.com/comment/42836295
downvote count: 0
answers question: http://stackoverflow.com/q/27172489
type: Answer
has comment: http://stackoverflow.com/comment/42836401

http://stackoverflow.com/comment/42878293
comment on: http://stackoverflow.com/q/27196689
score: 0
type: Comment
type: QuestionComment
has text: I guess you want to use map

http://stackoverflow.com/q/27247237
has title: How to retrieve redirect url from http server.?
has body: I am getting 200 as a response code instead of 3xx when I perform HTTP post request, even though web page gets redirected automatically. I tried this, but dosen't work. My code: HttpURLConnection con = getMultipartHttpURLConnection( formParameter.getServerUrl(), boundary); setRequestHeaders(con); String urlParameters = getParameter(formParameter.getForm()); // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); responseCode = con.getResponseCode(); String header = con.getHeaderField("Location"); Edit: By some research I find out that if server is configured to redirect to https:// enabled url, then I am getting 3xx as response code, otherwise not. Example given in the link above does the same.
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27247315
accepted answer: http://stackoverflow.com/a/27247315
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/27293034
score: 4
has comment: http://stackoverflow.com/comment/43051255
has comment: http://stackoverflow.com/comment/43051362
tagged with: restart
downvote count: 0
has answer: http://stackoverflow.com/a/27293127
has body: I want to handle the crashes smoothly ,for that i am restarting the app for every uncaught exceptions but there is always alert box is there "unfortunately ,xyz has stopped working" code that i am using to handle uncaught exceptions : intent = PendingIntent.getActivity(this.getApplication().getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread paramThread, Throwable paramThrowable) { Log.e("Alert", "Lets See if it Works !!!"); AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE); mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 2000, intent); System.exit(0); }
favorite count: 0
has answer: http://stackoverflow.com/a/27293169
linked to: http://stackoverflow.com/q/2681499
has answer: http://stackoverflow.com/a/27294621
has title: How disable alert box that appears ,while app crashes in Android
tagged with: android
has answer: http://stackoverflow.com/a/27400659
upvote count: 4
accepted answer: http://stackoverflow.com/a/27400659
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43051211
type: Question
possible better answer: http://stackoverflow.com/a/27293169

http://stackoverflow.com/comment/42884607
type: Comment
type: QuestionComment
has text: What about defining each complex structure in the javascript array into java objects? Then add them to a List<Object> = new ArrayList<Object>();. Iterate the list, checking what object instance the elements represent and then handling them accordingly.
score: 1
comment on: http://stackoverflow.com/q/27200481

http://stackoverflow.com/comment/42945491
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27233588
has text: See http://tips4java.wordpress.com/2009/03/12/table-from-database/

http://stackoverflow.com/comment/42960395
comment on: http://stackoverflow.com/q/27242083
score: 0
type: QuestionComment
type: Comment
has text: to be honest i have nothing. i thought about searching for indexOf ":" and then retrieve values from both ends. but im sure theres a better way

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/27236495
type: Tag

http://stackoverflow.com/a/27240725
type: Answer
has body: Not going to help you debug fully, just some hints for you: First, probably not very closely related to your problem but still worth looking at: Generating by rg.nextInt(y + 1) is going to give you random from 0 to 5001, I believe you want rg.nextInt(y) + 1 instead. And I have tried your code after fixing the previous minor issue. It worked for me. I don't see any problem. However, what I am suspecting is, because you are generating 1000 random numbers which is possible to duplicate, if you simply input any number to search, it may not fall into that 1000 numbers you generated. I have updated your code a bit so that you can take a look on what is generated, and use one of the result as your search input. It should work: Random rg = new Random(); for (int x=0;x&lt;values.length;x++) { int r = rg.nextInt(y) + 1; System.out.println("Random number: " + r); values[x]=r; } Arrays.sort(values); (Just for your interest, the probability that you input a number that is in the previously-generated 1000 random numbers is around 1 - (4999/5000) ^ 1000 which is only around 18%. That's why you may frequently get "value not found" message
answers question: http://stackoverflow.com/q/27239990
score: 0

http://stackoverflow.com/comment/42951539
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27237323
score: 0
has text: How about this: `Collections.replaceAll(new ArrayList(yourCollection), old, new);`. If you want to return it, just save the new list to a variable before doing the replacement.

akka
type: Tag
tags question: http://stackoverflow.com/q/27224313
tags question: http://stackoverflow.com/q/27191285
tag name: akka
tags question: http://stackoverflow.com/q/27271933

http://stackoverflow.com/a/72312649
answers question: http://stackoverflow.com/q/27200854
has body: Replace null with '\0' with the quotes
has comment: http://stackoverflow.com/comment/127770157
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/127787774
score: 1
upvote count: 1

http://stackoverflow.com/a/27309658
answers question: http://stackoverflow.com/q/27309232
type: Answer
has body: Can you try this? input.csv car,deer,"bear,cat" car,deer,"bear,cat" PigScript: output format1: A = LOAD 'input.csv' AS line; B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'(\\w+),(\\w+),(.*)$')) AS (col1:chararray,col2:chararray,col3:chararray); DUMP B; Output: (car,deer,"bear,cat") (car,deer,"bear,cat") PigScript Output format2: A = LOAD 'input.csv' AS line; B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'(\\w+),(\\w+),"(\\w+),(.*)"$')) AS (col1:chararray,col2:chararray,col3:chararray,col4:chararray); DUMP B; Output: (car,deer,bear,cat) (car,deer,bear,cat)
score: 0

http://stackoverflow.com/q/27205149
score: 0
tagged with: java
answer count: 1
tagged with: processing
has title: Where to find data folder (Processing)
accepted answer: http://stackoverflow.com/a/27206505
type: AnsweredQuestion
tagged with: directory
tagged with: macos
type: Question
has body: MAC I have this error: java.lang.RuntimeException: Could not load font CenturyGothic-72.vlw. Make sure that the font has been copied to the data folder of your sketch But I cannot find the data folder in my current sketch, I went to /Users/seb/Documents/Processing/sketchName and the only things in there are: s.pde sketch.properties sketchName.pde I added the file CenturyGothic-72.vlw to that /sketchName (as I had no data folder), didn't work. Then I created a data folder in /sketchName and in that data folder I put in CenturyGothic-72.vlw After all that, the program still cannot find that .vlw file... Could someone please direct me to where the data folder is, or could be?
has answer: http://stackoverflow.com/a/27206505

http://stackoverflow.com/q/27288373
has body: So I am upgrading the MongoDB java driver to 2.12.4 where the ensureIndex() method has been deprecated. I am instead using the createIndex() method which from the docs seems like to funciton similarly to ensureIndex(). However, when I use this method in production, I get the following error - { "serverUsed" : "X.X.X.X" , "ok" : 0.0 , "errmsg" : "Index with name: &lt;index_name&gt; already exists with different options" , "code" : 85} Why does this happen? Could anyone help me out with this? Thanks
tagged with: java
upvote count: 10
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/27288431
score: 10
has title: Index already exists with different options error while using createIndex() in latest MongoDB java driver
answer count: 2
tagged with: mongodb-java
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27288431
possible better answer: http://stackoverflow.com/a/32911309
has answer: http://stackoverflow.com/a/32911309
tagged with: indexing
type: AnsweredQuestion

http://stackoverflow.com/comment/42877733
comment on: http://stackoverflow.com/q/27196376
type: Comment
type: QuestionComment
has text: A disassembly of the class file would be my first stop.
score: 4

http://stackoverflow.com/comment/42955191
comment on: http://stackoverflow.com/q/27239265
has text: It is not clear what your problem is. Can you provide a sample output of your program ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27267024
has answer: http://stackoverflow.com/a/27267081
tagged with: java
downvote count: 1
has title: Error while storing looped checkbox's value - Android
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/27267081
upvote count: 0
answer count: 1
has body: I have a program that will shows AlertDialog with some looped checkbox (checkboxes values come from database), then user will choose the checkbox, after that I want to store all the chosen checkbox to a variable, then store the value to database. So the flow is : Read value From Database -> Print all the value (loop) to Alert Dialog checkbox -> User check the checkbox then click OK -> the value of chosen checkbox will be stored and pass to DBHelper I Have tried to code it, it runs good till when I want to store the value of the chosen checkbox, but I get error and the error is java.lang.NullPointerException.. Here I store the selected value to a string temp[i] (See the builder.setPositiveButton), then outside the loop, I pass the temp[i] to the groupToBePosted This is my Code, wish you could help me to store the value and pass it to the database,, Thank you.. @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.bBrowseSelectGroup: myDb.open(); final String[] groupName = myDb.fetchGroupName(username); myDb.close(); final boolean[] itemsChecked = new boolean[groupName.length]; AlertDialog.Builder builder = new AlertDialog.Builder( CreateAnnouncementActivity.this); builder.setTitle("Choose Your Group : "); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { myDb.open(); final String[] groupId = myDb.fetchGroupId(username); myDb.close(); String selectedGroup="Post To : "; String temp[] = null; for (int i = 0; i &lt; groupName.length; i++) { if (itemsChecked[i]) { temp[i]=groupId[i]; selectedGroup=selectedGroup+groupName[i]+", "; itemsChecked[i]=false; } } PostTo.setText(selectedGroup); //Set the TextView Value for(int i=0;i&lt;temp.length;i++){ groupToBePosted[i]=temp[i]; } } }); builder.setMultiChoiceItems(groupName, new boolean[] { false, false, false }, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onCl…
favorite count: 0
tagged with: android
tagged with: checkbox
type: AnsweredQuestion

http://stackoverflow.com/comment/43006847
has text: Your main() is static, meaning it doesn't have access to any instance variables. Maybe reading this would help to explain what static means: https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
comment on: http://stackoverflow.com/q/27267919
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43015095
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27272757
has text: Show us your code please.

http://stackoverflow.com/q/27251010
has answer: http://stackoverflow.com/a/34961544
has comment: http://stackoverflow.com/comment/42977120
tagged with: java
has answer: http://stackoverflow.com/a/34956248
type: Question
has comment: http://stackoverflow.com/comment/42976375
has answer: http://stackoverflow.com/a/27253077
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42976320
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42977861
has title: Selenium IEDriverServer not sending keys when using RemoteWebDriver
has body: So I have a test case set up which works perfectly fine using Testng and running the IEDriverServer locally. But when running the test case using Grid 2 the following command doesn't appear to work: driver.findElement(By.xpath("(//input[@type='text'])[3]")).sendKeys(logNum); There are no errors and the output from the node states that it had completed, but no text appears in the edit box. I checked running the test through a debugger and the "logNum" variable does have a value I can not fathom why its not working I am using selenium-server-standalone-2.44.0.jar running the Hub and Node on the same machine
tagged with: selenium
tagged with: grid

http://stackoverflow.com/comment/43230900
type: Comment
has text: Hi @Tobika, I tried this with "sessionID = storeUserInSession(accountName);" before the try statement and including "sessionID" in place of the last "null" (i.e., account = new Account(result.getString(1), result.getString(2), null, result.getString(3), result.getString(4), null, result.getInt(5), result.getDate(6), sessionID);). However, this just returns the account name to the client side which does not seem terribly secure to me. Is this how it is supposed to work? If it is then is there a better way to do this? Regards, Glyn
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27383388

http://stackoverflow.com/q/27278416
duplicate of: http://stackoverflow.com/q/19896870
score: 0
has comment: http://stackoverflow.com/comment/43026739
has comment: http://stackoverflow.com/comment/43026404
type: UnansweredQuestion
tagged with: spring
tagged with: autowired
has title: java spring bean annotation @Autowired is not working
has body: I wrote the following code but I cannot make it work. I don't know where is the problem. All classes are in the "hello" package. public static void main(String args[]) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext.scan("hello"); applicationContext.refresh(); ApplicationService app = new ApplicationService(); app.run(); applicationContext.close(); } @Component public class ApplicationService { @Autowired @Qualifier("main") private SimpleDriverDataSource dataSourcee; public void run(){ !!!!!!!! JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourcee); } } @Configuration public class Config { @Bean @Qualifier("main") public SimpleDriverDataSource getDataSource() { SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); dataSource.setDriverClass(org.h2.Driver.class); dataSource.setUsername("sa"); dataSource.setUrl("jdbc:h2:mem"); dataSource.setPassword(""); return dataSource; } } I tried in a lot of ways and combinations and I still get the following error. I tried without a qualifier, I changed the name of the method in Config, I tried to name the bean differently but I got no results. Where is the problem? Exception in thread "main" java.lang.IllegalArgumentException: Property 'dataSource' is required at org.springframework.jdbc.support.JdbcAccessor.afterPropertiesSet(JdbcAccessor.java:135) at org.springframework.jdbc.core.JdbcTemplate.&lt;init&gt;(JdbcTemplate.java:169) at hello.ApplicationService.run(ApplicationService.java:28) at hello.AppMain.main(AppMain.java:12)
has comment: http://stackoverflow.com/comment/43025782
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43026651
type: Question
has comment: http://stackoverflow.com/comment/43026257
linked to: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/43025716
tagged with: javabeans

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/27239337
tags question: http://stackoverflow.com/q/27211093
type: Tag
tags question: http://stackoverflow.com/q/27278153

http://stackoverflow.com/comment/43044330
type: QuestionComment
comment on: http://stackoverflow.com/q/27288928
score: 1
has text: Instead of sb.append(oriStr[index]+ " "); use sb.append(oriStr[index]).append(" ");
type: Comment

http://stackoverflow.com/comment/67976099
type: Comment
has text: In `JUnit` **4.11** it already uses `Matcher<? super T> matcher` version (http://junit.org/junit4/javadoc/4.11/org/junit/Assert.html#assertThat(T,%20org.hamcrest.Matcher)). The `Matcher<T> matcher)` version is used in `JUnit` **4.10** (http://junit.org/junit4/javadoc/4.10/org/junit/Assert.html#assertThat(T,%20org.hamcrest.Matcher))
type: AnswerComment
comment on: http://stackoverflow.com/a/27256498
score: 0

http://stackoverflow.com/a/27204624
score: 0
type: AcceptedAnswer
has body: // declares an array of integers int[] anArray; // allocates memory for 10 integers anArray = new int[10]; //declares an array of integers and allocates memory for 2 integers int array[]=new int[2]; And if you want to print that thing use --> this &lt;-- //print the content of the array System.out.println(Arrays.toString(array)); Because this : System.out.println(array); is not going to print the content of your array, it will print the memory address of the array.
type: Answer
accepted answer of: http://stackoverflow.com/q/27204459
answers question: http://stackoverflow.com/q/27204459

http://stackoverflow.com/a/27275916
answers question: http://stackoverflow.com/q/27275456
has body: I believe that the key to your problem is the "unresolved compilation error". Is your project generated in Eclipse? If so, According to this discussion, Eclipse can generate code that should no compile hence gives an error at run time. All open operations may generate exceptions. Check the documentation and correct your code, surrounding it with an apropriate try-catch clause. Try this: try { Scanner input = new Scanner(new File("/home/brian/workspace/Color Sampler/src/Data.txt")); } catch (Exception ex) { } If it works, then this is direction. Addendum: further information on this issue can be found at this discussion.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27275456
type: Answer

http://stackoverflow.com/q/27219957
has answer: http://stackoverflow.com/a/41695997
type: Question
has comment: http://stackoverflow.com/comment/42919105
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27220048
tagged with: exception
has body: I've made s simple program to let the user withdraw a certain amount out of a bank account, and if they withdraw too much it will cause an AssertionError, how do I get it to write out the error? import java.util.Scanner; public class Withdraw { public static void main(String[]args){ Scanner a = new Scanner(System.in); int t = 10000; System.out.println("Withdraw or Deposit"); String in = a.next(); System.out.println("Enter your value"); int wd = a.nextInt(); if(in.equals("withdraw")){ int b; b = t - wd; System.out.println(t); if (b &lt; 0){ throw new AssertionError(); } } } }
has comment: http://stackoverflow.com/comment/42919043
possible better answer: http://stackoverflow.com/a/41695997
tagged with: java
has comment: http://stackoverflow.com/comment/42919077
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42919094
has title: Java Assertion Exception
has comment: http://stackoverflow.com/comment/42919091
has comment: http://stackoverflow.com/comment/42919116
accepted answer: http://stackoverflow.com/a/27220048

http://stackoverflow.com/q/27180711
has comment: http://stackoverflow.com/comment/42849988
has comment: http://stackoverflow.com/comment/42850278
type: AnsweredQuestion
has body: I have a Global variable makeBitmap ArrayList in which I inserted values in a function/method called CreateArrayList. When I call the function SaveFs, I want to be able to print out the values in the makeBitmap arraylist. For some reason, it's not printing out anything. My main class, which is not included below, calls createArrayList method first then SaveFs to make sure there will be some values in there. For some reason it is not being printed when I call SaveFs method. The makeBitmap ArrayList is empty, I don't know why I made it global already, I printed it out in createArrayList, and the values are there, Idk why is it empty in SaveFs. NOTE: Deleted the code.
has comment: http://stackoverflow.com/comment/42850069
tagged with: java
has comment: http://stackoverflow.com/comment/42850002
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42849953
has comment: http://stackoverflow.com/comment/42849994
has answer: http://stackoverflow.com/a/27181076
accepted answer: http://stackoverflow.com/a/27181076
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42850007
has title: Global arrayList cannot be printed in one method but can be in another

http://stackoverflow.com/comment/42859474
has text: where you create user table ?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27186211

http://stackoverflow.com/a/27293467
has comment: http://stackoverflow.com/comment/43053162
score: 2
has body: You'll have to override equals method in Shelf in order to get the behavior you desire. Without overriding equals, ArrayList::contains, which calls ArrayList::indexOf, would use the default implementation of Object::equals, which compares object references. @Override public boolean equals (Object anObject) { if (this == anObject) return true; if (anObject instanceof Shelf) { Shelf anotherShelf = (Shelf) anObject; return this.getShelfNumber() == anotherShelf.getShelfNumber(); // assuming this // is a primitive // (if not, use equals) } return false; }
has comment: http://stackoverflow.com/comment/43051940
accepted answer of: http://stackoverflow.com/q/27293431
upvote count: 2
answers question: http://stackoverflow.com/q/27293431
has comment: http://stackoverflow.com/comment/43052471
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43052824
type: Answer
has comment: http://stackoverflow.com/comment/43052055

http://stackoverflow.com/comment/42973845
has text: the -T option is pretty important (and saves about 50% of the build time), I am looking for either a way to run this with the parallel option enabled, or proof that this is not possible.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27236076

http://stackoverflow.com/q/27247253
upvote count: 1
has body: I'm using Jersey 2.10.4 and EclipseLink 2.5.2 (both bundled with GlassFish 4.1). I use MOXy for JSON (un)marshalling. I'd like to have a REST web service that consumes either a single resource or an array of multiple resources of the same type. It is not possible to use two different JAX-RS methods with signatures like this (I replaced my actual resource/URL with a generic customer example - this class uses JAXB annotations) due to the ambiguity of the URL/media type combination (A resource model has ambiguous (sub-)resource method for HTTP method POST and input mime-types ...): 1) @POST @Path( "customers" ) @Consumes( { MediaType.APPLICATION_JSON } ) public void addCustomer( Customer newCustomer ) { [...] } 2) @POST @Path( "customers" ) @Consumes( { MediaType.APPLICATION_JSON } ) public void addCustomers( List&lt;Customer&gt; newCustomers ) { [...] } But if I use only one of the two signatures, I can't get the service to accept both a single resource element as well as an array of elements: If I use signature 1), I get a ClassCastException like this: Customer cannot be cast to java.util.Collection when the client sends an array instead of a single element. If I use signature 2), I get an IllegalArgumentException: argument type mismatch when the client sends a single element instead of an array. I've found this question that shows me that in Jackson, there's a feature ACCEPT_SINGLE_VALUE_AS_ARRAY that seems to deal with exactly this problem. I can't find an equivalent for that in MOXy, is there a way to achieve this?
score: 1
tagged with: java
type: Question
tagged with: jersey
downvote count: 0
has title: Equivalent to Jackson's ACCEPT_SINGLE_VALUE_AS_ARRAY in MOXy?
tagged with: moxy
favorite count: 0
tagged with: rest
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20230114

http://stackoverflow.com/q/27250980
tagged with: gwt
type: AnsweredQuestion
has title: Access HttpServletResponse from GWT Client
score: 1
tagged with: java
tagged with: servlets
type: Question
downvote count: 0
answer count: 1
tagged with: file-upload
tagged with: httpresponse
favorite count: 0
has answer: http://stackoverflow.com/a/27251128
upvote count: 1
accepted answer: http://stackoverflow.com/a/27251128
has body: I have an upload form to upload a file. The uploading is through form.submit() and a Servlet. I got a feedback from the server as sesponse and I would like to print the response on GWT-Client to the user. In a servlet I can not use any GUI-Widget so how can I access the http servlet response from gwt client, which invoked the servlet?

http://stackoverflow.com/a/27167400
has comment: http://stackoverflow.com/comment/42829347
has comment: http://stackoverflow.com/comment/42827968
has body: The code from Spring AMQP (BlockingQueueConsumer) looks like: for (String queueName : queues) { if (!this.missingQueues.contains(queueName)) { consumeFromQueue(queueName); } } Os, if your config is: container.setQueues(requestQueueHigh(), requestQueue()); You are really going to receive messages from requestQueueHigh() over requestQueue(). And it is independently of concurrency on ListenerContainer. You can test that with several messages, but with stopped listener from the start of application. And start() listener container eventually after sending for those messages.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27165019
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42828373
answers question: http://stackoverflow.com/q/27165019
has comment: http://stackoverflow.com/comment/42828682
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42828672
has comment: http://stackoverflow.com/comment/42829429

http://stackoverflow.com/comment/43066956
has text: Please add more information to help others to help you. e.g. how you signed it, any code, links to sites you tried to use.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27301569
score: 0

http://stackoverflow.com/q/27189057
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27190987
has title: Null Pointer Exception when calling web service from a thread
has comment: http://stackoverflow.com/comment/42864350
tagged with: java
tagged with: multithreading
tagged with: web-services
type: Question
has answer: http://stackoverflow.com/a/27190987
has body: I am trying to write a multi-threaded webservice that calls 4 webservices each from a thread. When I try to call a webservice directly it works. But when I try to call from a thread it throws a NullPointerException. Any Ideas on this? @WebService(serviceName = "Negotiator") public class Negotiator implements Runnable{ @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/Negotiate4/Negotiate4.wsdl") private Negotiate4_Service service_3; @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/Negotiate3/Negotiate3.wsdl") private Negotiate3_Service service_2; @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/Negotiate2/Negotiate2.wsdl") private Negotiate2_Service service_1; @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/Negotiate1/Negotiate1.wsdl") private Negotiate1_Service service; private String ret[] = new String[10]; private Thread t[] = new Thread[10]; /** * This is a sample web service operation */ @WebMethod(operationName = "hello") public String hello(@WebParam(name = "name") String txt) { try { Thread t1 = new Thread(new Negotiator(),"prov1"); Thread t2 = new Thread(new Negotiator(),"prov2"); Thread t3 = new Thread(new Negotiator(),"prov3"); Thread t4 = new Thread(new Negotiator(),"prov4"); t1.start(); t2.start(); t3.start(); t4.start(); t1.join(); t2.join(); t3.join(); t4.join(); } catch(java.lang.InterruptedException e) { System.out.println("Exception: "+e); } String retString = ""; for(int i=0;i&lt;4;i++) { retString = retString + ret[i]; } return "Hello " + retString + " !"; } @Override public void run() { Thread th = Thread.currentThread(); System.out.println("Inside run "+ th.getName()); switch (th.getName()) { case "prov1": ret[0] = negotiate("Hi1"); break; case "prov2": ret[1] = negotiate_1("Hi2"); break; case "prov3": ret[2] = negotiate_2("Hi3"); break; default: ret[3] = negotiate_3("Hi4"); break; } } private String negotiate(java.lang.String name) { org.prov1.Negotiate1 port1 = service.getNegotiate1Port(); return port1.…
score: 0
has comment: http://stackoverflow.com/comment/42881998
answer count: 1
has comment: http://stackoverflow.com/comment/42864473

http://stackoverflow.com/comment/42901356
has text: How does that code compile?? TextListeners cannot be used with JTextAreas.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27209814

http://stackoverflow.com/comment/42911935
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27215848
has text: The browser is saying "The connection to the server was reset while the page was loading." Maybe I need to somehow delay clientSocket closing? I am going to see if I can find some way to do that.

http://stackoverflow.com/q/27246406
tagged with: netbeans-7
tagged with: tomcat
has comment: http://stackoverflow.com/comment/52495968
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/26912930
has title: ${libs.hibernate-support.classpath} to copy
downvote count: 0
has body: I am using Netbeans - Java, I been given project which was initially missing some libraries and it seems fine however I am getting warning C:\Users\zahikhu\Desktop\My Work\My Project\University Main WebSite\XCRI implementation\XCRI\Workspace\XCRIBuilder\nbproject\build-impl.xml:1024: Warning: Could not find file C:\Users\zahikhu\Desktop\My Work\My Project\University Main WebSite\XCRI implementation\XCRI\Workspace\XCRIBuilder\${libs.hibernate-support.classpath} to copy. BUILD FAILED (total time: 0 seconds) how I solve hibernate issue ${libs.hibernate-support.classpath}

http://stackoverflow.com/q/27304902
tagged with: netbeans
answer count: 2
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/27306182
has title: NetBeans and Maven Project
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27306140
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: Hello i have a maven project build in netbeans. issue i having is i have some external dependencies jar libraries that i need to make my source file work. example: on my source code import org.cloudme.puppet ( which i have a jar for ) now in java project for net means i have "library" where you can right click and "add jar/folder" with the maven project i do not have that, i have a " Dependencies " folder ,, which will NOT let me right click and add JAR* so how can i bring them in ? how can i get my source code to find those dependencies ? i have tried .. i even created a new java class project, but that cannot be picked up my main project. please help, any direction will help

http://stackoverflow.com/a/27368517
type: Answer
answers question: http://stackoverflow.com/q/27297426
has body: The problem is solved. I never figured out where the memory leaks were, but I noticed that in the console, maven would fork for surefire but never included the arguments I passed via &lt;argLine&gt;. When I added the same arguments to the maven command as: mvn test -DargLine="-XX:MaxPermSize=1024m -Xmx768m" all the tests executed fine, with no OutOfMemory issues. So I think that the &lt;argLine&gt; element might not work correctly.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27297426
has comment: http://stackoverflow.com/comment/60699874
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27163692
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/27163740
linked to: http://stackoverflow.com/q/19807156
type: Question
has body: Hi I am trying to print the list of strings stored in ArrayList object using JSTL, here is my jsp page: &lt;%@page import="java.util.ArrayList"%&gt; &lt;%@page import="java.util.List"%&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; &lt;% List&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add("testing1"); al.add("testing2"); al.add("testing3"); al.add("testing4"); al.add("testing5"); System.out.println("hello"+ al); %&gt; &lt;c:forEach var="alla" items="${al}" &gt; &lt;c:out value="Hello text"&gt;&lt;/c:out&gt; &lt;c:out value="${alla}"&gt;&lt;/c:out&gt; &lt;/c:forEach&gt; when i see output it is not showing any thing on the browser, I have printed it using foreach it is showing the result where as in JSTL it is not printing ?
linked to: http://stackoverflow.com/q/25201995
upvote count: 1
accepted answer: http://stackoverflow.com/a/27163740
downvote count: 1
answer count: 1
score: 0
tagged with: java
has title: <c:forEach> not working for to print List of Strings
has comment: http://stackoverflow.com/comment/42820169
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42820176
tagged with: jstl
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1835061

http://stackoverflow.com/q/27234953
has body: I am kicking off a release-build in Jenkins and it is causing a delay. I am wanting the release-build to be kicked off immediately. Here is how I am kicking off the build: HttpClient client = new HttpClient(); JenkinsJob job = new JenkinsJob("job name"); job.setCredentials(client); PostMethod buildMethod = new PostMethod(job.getJobURL() + BUILD_WITH_PARAMETERS_URI); client.executeMethod(buildMethod); Any suggestions on how to remove this delay?
type: Question
answer count: 2
tagged with: eclipse-plugin
score: 0
has answer: http://stackoverflow.com/a/27237436
has title: Jenkins release-build delay
tagged with: jenkins
has answer: http://stackoverflow.com/a/27235138
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27235138
tagged with: java
accepted answer: http://stackoverflow.com/a/27237436

http://stackoverflow.com/comment/42854206
type: Comment
comment on: http://stackoverflow.com/a/27182731
score: 0
has text: Thanks jitesh,i followed what you said i have writen the code like map.put("newLine", "/n"); context.put("content",map);, then i have accessed in word document like «@before-cell#foreach($d in $dosData)»«before-cell#foreach($f in $d)»«$f»«@after-cell#end» «$content.newLine» «@after-cell#end»
type: AnswerComment

http://stackoverflow.com/comment/43072229
comment on: http://stackoverflow.com/a/27304674
has text: any chance you could post some short sample code of option 2
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27313695
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/27313622
type: Answer
has body: The ExecutorService.execute(Runnable) wraps them with new Thread instances. If you also print the thread id, @Override public void run() { System.out.printf("%d %d%n", counter.addAndGet(1), Thread.currentThread().getId()); } You will see two different Thread(s) are running. For example, 1 10 2 11
score: 5

http://stackoverflow.com/comment/43068483
has text: This is not a useful way to do benchmarking; your numbers are going to be way off from real performance. You need to worry about things like JIT warmup and the like, which in practice means using a well-designed benchmarking tool like Caliper or JMH. You can't get _any_ sort of useful numbers from the type of measurement you're doing.
type: QuestionComment
comment on: http://stackoverflow.com/q/27302697
score: 7
type: Comment

http://stackoverflow.com/a/27306773
score: 1
has body: I guess, the small variances in timing may add up to a greater amount and you can easily avoid it by making the sleep dependent on the total time. Something like long basetime = System.nanoTime(); for (int i=0; m_Running; ++i) { ... nextRedraw = baseTime + i * m_RedrawTimeout; } This should make a following sleep shorter if the current one was too short and vice versa, so you get an FPS varying only by at most a few ms per second (i.e., &lt; 1%). And maybe there's no problem, it's just that what you measure is how long a single frame takes. This number varies a bit and doesn't say much about the FPS rate. AFAIK the nanoseconds in Thread.sleep get completely ignored.
has comment: http://stackoverflow.com/comment/43100987
downvote count: 0
answers question: http://stackoverflow.com/q/27305587
has comment: http://stackoverflow.com/comment/43099023
type: Answer
upvote count: 1

http://stackoverflow.com/a/27211514
answers question: http://stackoverflow.com/q/27211364
downvote count: 0
score: 1
upvote count: 1
has body: Here's a quick example from which you should be able to answer your question: import java.util.Arrays; public class RemoveZeros { public static void main(String[] args) { int[] zeroArray = { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5 }; System.out.println("Original array: " + Arrays.toString(zeroArray)); int nonZeros = 0; for (int i = 0; i &lt; zeroArray.length; i++) { if (zeroArray[i] != 0) { nonZeros++; } } int[] tempArray = new int[nonZeros]; int tempIndex = 0; for (int j = 0; j &lt; zeroArray.length; j++) { if (zeroArray[j] != 0) { tempArray[tempIndex] = zeroArray[j]; tempIndex++; } } zeroArray = tempArray; System.out.println("Modified array: " + Arrays.toString(zeroArray)); } } Output: Original array: [0, 1, 0, 2, 0, 3, 0, 4, 0, 5] Modified array: [1, 2, 3, 4, 5]
type: Answer

http://stackoverflow.com/comment/42855227
type: QuestionComment
has text: It's unclear whether you're actually talking about the Gregorian calendar or the ISO textual format. I've just tried `Calendar.getInstance(Locale.JAPAN)` and it's still returned a Gregorian calendar - can you say exactly what you mean by "not supporting" Gregorian dates?
comment on: http://stackoverflow.com/q/27183759
type: Comment
score: 1

http://stackoverflow.com/q/27176313
accepted answer: http://stackoverflow.com/a/27206949
has comment: http://stackoverflow.com/comment/42871497
upvote count: 2
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42848505
has comment: http://stackoverflow.com/comment/42847779
has comment: http://stackoverflow.com/comment/42878817
tagged with: web-services
has comment: http://stackoverflow.com/comment/42844661
has answer: http://stackoverflow.com/a/27206949
has answer: http://stackoverflow.com/a/27198899
has comment: http://stackoverflow.com/comment/42879493
score: 2
type: AnsweredQuestion
has title: Tomcat 7 Jersey REST not working
downvote count: 0
tagged with: jax-rs
possible better answer: http://stackoverflow.com/a/27198899
tagged with: tomcat
has body: I have followed numerous examples and tutorials trying to get my REST web service running but without any success. I'm using IntelliJ 13, Maven3, Java 7 and Tomcat 7. My pom.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.jafwatt rest-service 1.0-SNAPSHOT war org.apache.maven.plugins maven-war-plugin 2.2 org.apache.maven.plugins maven-deploy-plugin 2.7 javax.ws.rs javax.ws.rs-api 2.0-m10 compile com.sun.jersey jersey-servlet 1.18 compile My web.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> rest restServlet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.jafwatt.rest 1 restServlet /* CustomerResource.java package com.jafwatt.rest; import com.jafwatt.rest.entity.Customer; import javax.ws.rs.*; import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; @Path("/customers") public class CustomerResource { private Map<Integer, Customer> customerDB = new ConcurrentHashMap<Integer, Customer>(); private AtomicInteger idCounter = new AtomicInteger(); @GET @Path("/hello") @Produces("text/plain") public String getCustomers() { return "Hello"; } @POST @Consumes("application/xml") public Response createCustomer(InputStream is) { Customer customer = readCustomer(is); customer.setId(idCounter.incrementAndGet()); customerDB.put(customer.getId(), customer); System.out.println("Created customer " + customer.getId()); return Response.created(URI.create("/customers/" + customer.getId())).build(); } @GET @Path("{id}") @Produces("application/xml") public StreamingOutput getCustomer(@PathParam("id") int id) { final Customer customer = customerDB.get(id); if (customer == null) { throw new WebApplicationException( Response.Status.NOT_FOUND); } return new StreamingOutput(…
favorite count: 0
has comment: http://stackoverflow.com/comment/42842910
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/42842031

http://stackoverflow.com/comment/42856064
has text: @Sravani: **I have made a change in the xpath. Please use the code now, and let me know how it goes.** In case it doesn't work, please tell if the delete button visible on the webpage directly, or do you have to click/hover on some element, and then it becomes visible? Furthermore, if you can add an image of the delete button that will be helpful too. Since your reputation is not enough, you can't upload an image directly. Please consider uploading in sites like **[imgur](http://imgur.com/)** and adding the link here.
type: AnswerComment
comment on: http://stackoverflow.com/a/27183109
score: 0
type: Comment

http://stackoverflow.com/a/27248836
has comment: http://stackoverflow.com/comment/42977016
score: 4
has comment: http://stackoverflow.com/comment/42975098
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27247860
type: Answer
has comment: http://stackoverflow.com/comment/42974221
accepted answer of: http://stackoverflow.com/q/27247860
has comment: http://stackoverflow.com/comment/42974909
has comment: http://stackoverflow.com/comment/42974358
upvote count: 4
has comment: http://stackoverflow.com/comment/42975136
has body: The mip-mapping modifies the texture, but the grass doesn't really do much work in the texture anyway as it is a small object. Most of the work to render the grass comes in processing all of the vertices, and most especially if the grass are lots of small objects then in processing these objects. You should combine the grass together into one mesh and then let that be rendered. Graphics cards are great at handling objects with huge numbers of vertices, not so great at huge numbers of objects. If you were using jMonkeyEngine I could recommend some classes that provides to do the batching for you (most obviously BatchNode although there are some other options too). It might still be worth looking at how jMonkeyEngine does it for ideas.
downvote count: 0

http://stackoverflow.com/comment/42839065
score: 0
type: Comment
has text: your answer is reasonable :)
comment on: http://stackoverflow.com/a/27174539
type: AnswerComment

http://stackoverflow.com/comment/43089513
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27314430
has text: its in a diffrent class. dont I need to do this (the test isnt in mainactivity)?

http://stackoverflow.com/a/27309959
downvote count: 0
answers question: http://stackoverflow.com/q/27309852
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/43081247
has comment: http://stackoverflow.com/comment/43081219
has body: considering Constants.variable is a static variable import static com.myname.appname.Constant.*; this will import all you static variables in you current namespace only the static variable import static com.myname.appname.Constant.variable; now you can use variable like a normal variable

http://stackoverflow.com/comment/42920790
comment on: http://stackoverflow.com/a/27217821
has text: Wonderful. Your answer made my day....!!!!!Many many thanks....!!!!!I was trying to get this literally through the thanksgiving weekend......
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42948412
type: Comment
score: 2
comment on: http://stackoverflow.com/a/27235831
type: AnswerComment
has text: `this.getName` will not work because there is no `getName` defined for `Kunderegister`. You probably got taken in by the sloppy indentation.

http://stackoverflow.com/q/27217529
has body: I've always understood MVC to mean the Model shouldn't know anything about the View and vice versa. However in my university course an example of a View using the MVC pattern is given like: class View implements Updatable { private final JButton button = new JButton("Press Me!"); private final JTextField textField = new JTextField(10); //some setup of the button and textfield public void update(Model model) { if (model.morePressesAllowed()) { textField.setText(String.valueOf(model.count())); } else { textField.setText("Too Many!"); button.setEnabled(false); } } } It seems odd to me that the view must know what methods the model has. It seems like it would be better in terms of the MVC pattern to expose the button and textfield to the controller, and have the update method on the controller? The model just increments a number and if it gets to 5 then the morePressesAllowed returns false. Also the model has a list of Updatable, and when the counter changes it loops through the updatables and calls update, while this is better than having a list Views, it still seems like the Controller should be responsible for telling the view when the model changes? EDIT: The model is: class Model { private final List&lt;Updatable&gt; views = new ArrayList&lt;Updatable&gt;(); private int count; private boolean morePressesAllowed = true; public void addObserver(Updatable observer) { views.add(observer); } public void increment() { count++; if (count &gt;= 5) { morePressesAllowed = false; } notifyObservers(); } private void notifyObservers() { for (Updatable view : views) { view.update(this); } } } The Controller/Main class: (also shouldn't the controller create the model and view and be normal public class?) public class GuiApp { private View view = new View(new Controller()); private Model pressCounter = new Model(); class Controller implements ActionListener { public void actionPerformed(ActionEvent actionEvent) { pressCounter.increment(); } } GuiApp() { pressCounter.addObserver(vi…
has comment: http://stackoverflow.com/comment/42914668
tagged with: model-view-controller
has title: Passing the Model to the View in MVC
tagged with: java
type: Question
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/27218076
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27217870
answers question: http://stackoverflow.com/q/27217815
has body: This parameter is not correct if you get this error: int w = gridSpecEntry[2]; //length of the word Or if it's not length of the wordsSpecEntry just add another validation: for (int i = 0; i &lt; w &amp;&amp; i &lt; wordsSpecEntry.length(); i++) {
type: Answer
score: 0

http://stackoverflow.com/q/27243117
linked to: http://stackoverflow.com/q/6686753
linked to: http://stackoverflow.com/q/7837576
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I have been trying to use JSTL to write my JSP pages .However I noticed something,whenever I make any changes to my page , try to save and run the page without restarting the page throws an error as below. java.lang.NoSuchFieldError: deferredExpression at org.apache.taglibs.standard.tag.common.core.ForEachSupport.release(ForEachSupport.java:178) at org.apache.jasper.runtime.TagHandlerPool.release(TagHandlerPool.java:165) at org.apache.jsp.WEB_002dINF.jsp.WatchEvent_jsp._jspDestroy(WatchEvent_jsp.java:42) at org.apache.jasper.runtime.HttpJspBase.destroy(HttpJspBase.java:60) at org.apache.jasper.servlet.JspServletWrapper.destroy(JspServletWrapper.java:478) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:166) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950) at org.springfram…
score: 2
has comment: http://stackoverflow.com/comment/42963834
tagged with: hotdeploy
answer count: 0
tagged with: java
has title: Is it necessary to restart the server each time before running , when using JSTL?
type: Question
has comment: http://stackoverflow.com/comment/42961968
has comment: http://stackoverflow.com/comment/42965329
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42962565
downvote count: 0
tagged with: jsp

http://stackoverflow.com/comment/43005797
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27246063
has text: @AlexandruMitu Only by running PostgreSQL directly on the Android device - which as previously established is not easy, requiring it to be ported. There is a reason most people use embedded databases like SQLite on Android! (Power and memory use are also factors).
score: 0

http://stackoverflow.com/q/27268161
has body: I have an Ternary Operator in my Code and I Don't want to return any value from that Ternary operator ... Can i write a Ternary operator with return value as void ... Example : int a = 10; int b = 20; Can i write as (a&lt;b ? a+=b : a-=b); It's Showing an error like The left-hand side of an assignment must be a variable Thank You ...
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/27268192
has title: Can we write an ternary operator without a return value
has answer: http://stackoverflow.com/a/27268242
tagged with: ternary-operator
has answer: http://stackoverflow.com/a/27268192
has comment: http://stackoverflow.com/comment/43007220
favorite count: 0
has comment: http://stackoverflow.com/comment/43007465
upvote count: 2
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/27268242
tagged with: java
type: Question

manifest
tags question: http://stackoverflow.com/q/27179599
tags question: http://stackoverflow.com/q/27221428
tag name: manifest
type: Tag
tags question: http://stackoverflow.com/q/27286074

http://stackoverflow.com/a/27196511
score: 0
answers question: http://stackoverflow.com/q/27196415
has body: Something like Set&lt;String&gt; stringSet = new HashSet&lt;&gt;(Arrays.asList(new String[]{"1","2","3"})); stringSet.addAll(Arrays.asList(new String[]{"1","2","3","4"})); List&lt;String&gt; finalList = new ArrayList&lt;&gt;(stringSet);
type: Answer

http://stackoverflow.com/a/27174983
type: Answer
answers question: http://stackoverflow.com/q/27174556
has body: Android UI Thread ever do not long operation.so you should start thread in your code.e.g. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { server = new ServerSocket(4444); } catch (IOException e) { e.printStackTrace(); } new thread(){ void run(){ server.accept(); } }.start(); }
score: 0

http://stackoverflow.com/comment/42804620
type: AnswerComment
type: Comment
has text: Somehow the result isn't boolean. I don't get it.
comment on: http://stackoverflow.com/a/27155059
score: 0

http://stackoverflow.com/q/27248644
tagged with: java
accepted answer: http://stackoverflow.com/a/27250179
type: Question
score: 12
possible better answer: http://stackoverflow.com/a/27260867
upvote count: 12
has answer: http://stackoverflow.com/a/27260867
downvote count: 0
answer count: 3
has body: I have the following cryptojs based javascript encryption/decryption functions which works perfectly fine. I use a random salt, random iv value and a specific password while encrypting the message using cryptpjs. I reuse the same salt, iv and the password to generate the key while decrypting the encrypted message. This part works well.. function encrypt(){ var salt = CryptoJS.lib.WordArray.random(128/8); var iv = CryptoJS.lib.WordArray.random(128/8); console.log('salt '+ salt ); console.log('iv '+ iv ); var key128Bits = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32 }); console.log( 'key128Bits '+ key128Bits); var key128Bits100Iterations = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32, iterations: 100 }); console.log( 'key128Bits100Iterations '+ key128Bits100Iterations); var encrypted = CryptoJS.AES.encrypt("Message", key128Bits100Iterations, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); console.log('encrypted '+ encrypted ); } function decrypt(){ var salt = CryptoJS.enc.Hex.parse("4acfedc7dc72a9003a0dd721d7642bde"); var iv = CryptoJS.enc.Hex.parse("69135769514102d0eded589ff874cacd"); var encrypted = "PU7jfTmkyvD71ZtISKFcUQ=="; console.log('salt '+ salt ); console.log('iv '+ iv ); var key = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32, iterations: 100 }); console.log( 'key '+ key); var decrypt = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); var ddd = decrypt.toString(CryptoJS.enc.Utf8); console.log('ddd '+ddd); } But the issue starts when I try to decrypt the same encrypted text at the java server side. I want the encrypted message to be decrypted by my java server code. Here is the Java code that I wrote: public static void main(String args[]) throws Exception{ String password = "Secret Passphrase"; String salt = "4acfedc7dc72a9003a0dd721d7642bde"; String iv = "69135769514102d0eded589ff874cacd"; String encrypted = "PU7jfTmkyvD71ZtISKFcUQ=="; b…
has title: How to decrypt a cryptojs AES encrypted message at the java server side?
tagged with: cryptojs
favorite count: 0
tagged with: aes
has answer: http://stackoverflow.com/a/74039750
tagged with: encryption
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27250179

http://stackoverflow.com/q/27219365
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/27219620
has comment: http://stackoverflow.com/comment/42918148
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27219620
has title: Can't get media player to play mp3
type: Question
has comment: http://stackoverflow.com/comment/42918002
score: 0
has body: Can anyone tell me why this code doesn't work? It compiles but when I click on the button nothing plays and then it crashes. I'm a noob =[ public class MainActivity extends ActionBarActivity { private MediaPlayer newTune; public void playB(View paramView) throws IOException { newTune = MediaPlayer.create(this, R.raw.b); if (newTune.isPlaying()) { // newTune.stop(); } else { newTune.prepare(); newTune.start(); } }

http://stackoverflow.com/q/27309062
has answer: http://stackoverflow.com/a/27309130
favorite count: 0
has body: I'd like to write a method that is executable from the console Say for instance I have a class "Plus" that adds 3 to an int "i". I'm supposed to be able to run the program from the console as follows: $ java Plus 7 10 basically I want to read the value after "Plus" as the int "i" a I can't find any documentation on the subject, but I wasn't really sure how to search. It should be possible with the standard java package, since it's homework. Any help would be appreciated Thanks!
tagged with: command
upvote count: 0
has answer: http://stackoverflow.com/a/27317688
accepted answer: http://stackoverflow.com/a/27317688
possible better answer: http://stackoverflow.com/a/27309130
tagged with: line
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43079843
type: Question
answer count: 2
has title: Running a java method from console, using and already inputted method
downvote count: 1

http://stackoverflow.com/comment/42876601
has text: OK, I see. Extend Fragment class with custom layout, and modify your getFragment method of MyGridViewPagerAdapter to return an instance of the extended Fragment class.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27181874

joptionpane
tags question: http://stackoverflow.com/q/27300779
tags question: http://stackoverflow.com/q/27285723
tags question: http://stackoverflow.com/q/27235402
tags question: http://stackoverflow.com/q/27284395
tags question: http://stackoverflow.com/q/27172937
tags question: http://stackoverflow.com/q/27312814
type: Tag
tags question: http://stackoverflow.com/q/27301817
tags question: http://stackoverflow.com/q/27169392
tags question: http://stackoverflow.com/q/27261929
tags question: http://stackoverflow.com/q/27249346
tags question: http://stackoverflow.com/q/27245678
tag name: joptionpane

hash
tags question: http://stackoverflow.com/q/27268795
tags question: http://stackoverflow.com/q/27305949
tags question: http://stackoverflow.com/q/27198846
tags question: http://stackoverflow.com/q/27221253
tags question: http://stackoverflow.com/q/27290732
type: Tag
tags question: http://stackoverflow.com/q/27158637
tags question: http://stackoverflow.com/q/27185869
tags question: http://stackoverflow.com/q/27230938
tags question: http://stackoverflow.com/q/27218981
tag name: hash

http://stackoverflow.com/a/27208750
answers question: http://stackoverflow.com/q/27208676
has body: I will just give you a few idea. I hope, i understand you clearly ; Square has X unit length on every edge. So you can give restriction with this criterion. And you can apply this idea with thinking circles radius R while creating random straight lines(not diagonally) in this step you can use vectors ,for square (1,1)(1,2)(1,3) first x vector point is must be same for not diagonally(just the opposite for y). If line is longer or equal than squares X or circle's R then you can terminate your step.
downvote count: 1
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/a/27272892
downvote count: 0
answers question: http://stackoverflow.com/q/27272757
type: Answer
score: 1
upvote count: 1
has body: If you use the overload of split that takes an int parameter and pass a negative value, trailing blank items would not be removed from the resultant array: String[] splitValues = splitString.split("#", -1); Demo. This produces {"2000", "", "1000", "", "", "", ""} array.

http://stackoverflow.com/comment/42916316
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27218470
has text: Do you prefer this question to be closed as duplicate of [null ref exception in Java](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) or [correct implementation of linked list in Java](http://stackoverflow.com/questions/10042/how-do-i-implement-a-linked-list-in-java)?

http://stackoverflow.com/comment/42909978
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27214988
has text: Maybe you can tell us in which programming language you want to achieve this?
score: 4

http://stackoverflow.com/q/27160769
has title: returns an ArrayList using a while loop and an iterator
tagged with: java
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/42815231
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42817378
has comment: http://stackoverflow.com/comment/42815161
answer count: 1
has answer: http://stackoverflow.com/a/27161227
has comment: http://stackoverflow.com/comment/42815180
tagged with: arraylist
favorite count: 0
has body: I have a big problem with the following method. public class PoliceDepartment{ private ArrayList&lt;PoliceOfficer&gt; policeOfficers; public PoliceDepartment() { policeOfficers = new ArrayList&lt;PoliceOfficer&gt;(); } public void addPoliceOfficers(PoliceOfficer newPoliceOfficers) { if(newPoliceOfficers != null) { policeOfficers.add(newPoliceOfficers); } } A method that accepts an officer name as a parameter, validates that the passed parameter is not null, searches the collection and returns an ArrayList of the parking tickets issued by that officer or returns null if there were no parking tickets issued by the specified officer. The officer name is case-insensitive. This method uses a while loop and an iterator to implement the required functionality. public ArrayList&lt;ParkingTicket&gt; getAllTicketByOfficer(String officerName) { ArrayList&lt;PoliceOfficer&gt; al = new ArrayList&lt;PoliceOfficer&gt;(); Iterator&lt;PoliceOfficer&gt; it = policeOfficers.iterator(); while(it.hasNext()){ PoliceOfficer officer = it.next(); if(officerName != null &amp;&amp; officerName.equalsIgnoreCase(officer.getOfficerName())){ al.add(officer); } else { return null; } } return al; } I have a problem with the line: return al; The error found says "Incompatible type") I don't understand how to do it. Could someone help me?
has comment: http://stackoverflow.com/comment/42815220
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42815373

http://stackoverflow.com/comment/42834036
comment on: http://stackoverflow.com/a/27171658
has text: how to write boolean value?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27256098
favorite count: 0
has comment: http://stackoverflow.com/comment/42986428
has answer: http://stackoverflow.com/a/27257750
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27256239
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/27256239
has comment: http://stackoverflow.com/comment/42986017
type: Question
has comment: http://stackoverflow.com/comment/42986205
has title: code not printing when trying to find numbers that are both star and triangular numbers
answer count: 2
accepted answer: http://stackoverflow.com/a/27257750
has comment: http://stackoverflow.com/comment/42986380
upvote count: 0
has body: Im trying to write the code for a program that prints values that are both star and triangle numbers. Although the code just doesnt seem to work and wont print out any values, the function for the starNumbers is working fine although i think that the function for the triangle number is a bit iffy, im not really sure where the problem is. All help would be greatly appreciated thanks public class TriangularNumbers { public static void main(String[] args) { int n = 1; int i = 1; int star = starNumbers(n); int triangle = triangleNumbers(i, n); while (star &gt; 0) { while (star &lt; triangle) { n++; star = starNumbers(n); } while (triangle &lt; star) { triangle = triangleNumbers(i, n); } if (star==triangle) { System.out.println(star); } } } private static int starNumbers (int n) { int s = ((6*n)*(n-1)+1); return s; } private static int triangleNumbers( int i, int n){ int star = starNumbers(n); int t = 0; while (t&lt;=star) { t = t + i; i++; } return t; } }
has comment: http://stackoverflow.com/comment/42986515

http://stackoverflow.com/a/27195659
has body: It might relieve your memory problems if you break your string up into an array of 8 X 1MB chunks. This way: 1) Your StringBuilder only needs to be 1MB so uses up less memory - you could reuse it by resetting it with the setLength() method which I think will mean worst case it will only take up 1MB 2) Your ByteBuffer only needs to be 1MB not 8MB You can just loop round your array when you write the String out to files. So you'll still need the 8MB for the string, but apart from that you should only need 2MB extra.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27194708

http://stackoverflow.com/a/27306925
type: AcceptedAnswer
has body: close, please view the forums.gradle.org question : https://discuss.gradle.org/t/gradle-make-multiple-war-with-different-resources-and-classes/6705
type: Answer
answers question: http://stackoverflow.com/q/27285296
accepted answer of: http://stackoverflow.com/q/27285296
score: 0

http://stackoverflow.com/a/27291146
has comment: http://stackoverflow.com/comment/43049312
has body: You can encode the colors the following way: Bits 0### 1### 2### 3### 4### 5### 6### 7### Alpha---- Red------ Green---- Blue----- Note that you'll lose a whole lot of information about the color (but I think that's the thing you want to get). Things you'll need to do in order to encode: Change the range of colors (0-255 to 0-3) Shift the colors properly and add them to get the 8bit value. Here's some example code: import java.awt.Color; abstract class EightBit { public static int fromColor(Color c) { return ((c.getAlpha() &gt;&gt; 6) &lt;&lt; 6) + ((c.getRed() &gt;&gt; 6) &lt;&lt; 4) + ((c.getGreen() &gt;&gt; 6) &lt;&lt; 2) + (c.getBlue() &gt;&gt; 6); } public static Color toColor(int i) { return new Color(((i &gt;&gt; 4) % 4) * 64, ((i &gt;&gt; 2) % 4) * 64, (i % 4) * 64, (i &gt;&gt; 6) * 64); } } Explanation Encoding Let's start with an example color: new Color(200, 59, 148, 72). Now we'll convert that into an integer. The binary representation of the color is: Alpha 200 -- 11001000 Red 59 -- 00111011 Green 148 -- 10010100 Blue 72 -- 01001000 Now, we shift them to the right by 6 bits (so we get the first 2 bits): Alpha 3 -- 11 Red 0 -- 00 Green 2 -- 10 Blue 1 -- 01 Now we put them together: Bits [ 1 ][ 1 ][ 0 ][ 0 ][ 1 ][ 0 ][ 0 ][ 1 ] -- 209 ALPHA--- RED----- GREEN--- BLUE---- It's 209. See? Decoding So we're back at our 8bit number: 209. We want to decode it. First, we need to get the 2-bit colors back by shifting them to the right, and modulo 4: Bits [ 1 ][ 1 ][ 0 ][ 0 ][ 1 ][ 0 ][ 0 ][ 1 ] \_shift_by_6_bits_____________[ 1 ][ 1 ] -- 3 (Alpha) \_by_4_bits_________[ 0 ][ 0 ] -- 0 (Red) \_by_2____[ 1 ][ 0 ] -- 2 (Green) shift by 0 bits: [ 0 ][ 1 ] -- 1 (Blue) Now we multiply them by 64: 3 * 64 = 192 (Alpha) 0 * 64 = 0 (Red) 2 * 64 = 128 (Green) 1 * 64 = 64 (Blue) And put them back into a Color object. As you can see, the colors are different: some information about the color was lost in the process. This is called lossy compression.
accepted answer of: http://stackoverflow.com/q/27290729
has comment: http://stackoverflow.com/comment/43048579
answers question: http://stackoverflow.com/q/27290729
type: AcceptedAnswer
type: Answer
score: 8
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/90439948
type: AnswerComment
score: 0
type: Comment
has text: I tried this code inside a function annotated with `@Transactional` and the `EntityManagerFactoryUtils.getTransactionalEntityManager(emf)` returned `null`. If I try it with `@PersistenceContext` annotation it isn't null, but I'm not sure if it is the correct EntityManager for the transaction.
comment on: http://stackoverflow.com/a/31437448

http://stackoverflow.com/q/27167076
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42825925
has answer: http://stackoverflow.com/a/27167129
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27167427
accepted answer: http://stackoverflow.com/a/27167427
tagged with: java
type: Question
has body: I need to download this java class: http://docs.spring.io/spring-framework/docs/2.0.8/api/org/springframework/jdbc/object/StoredProcedure.html But i can't find where to download, i really clicked everywhere upon that website. can someone help me to find this code? It's accepted any other website or link with code of this class.
possible better answer: http://stackoverflow.com/a/27167129
has comment: http://stackoverflow.com/comment/42825891
has answer: http://stackoverflow.com/a/27167854
tagged with: class
score: 0
answer count: 3
has title: download class from http://docs.spring.io/

http://stackoverflow.com/comment/43051230
score: 0
comment on: http://stackoverflow.com/a/27292523
type: AnswerComment
has text: @Angel: Both of those show an ID of "GMT"? That's very unusual - *particularly* for the latter one, as that's the specified way of constructing fixed-offset time zones. What JVM are you running, and under what OS? What does `TimeZone.getAvailableIDs` return?
type: Comment

http://stackoverflow.com/q/27189102
has comment: http://stackoverflow.com/comment/42865621
has comment: http://stackoverflow.com/comment/42865142
type: Question
has comment: http://stackoverflow.com/comment/42865453
linked to: http://stackoverflow.com/q/26998091
has comment: http://stackoverflow.com/comment/42905432
tagged with: struts2
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42902569
has comment: http://stackoverflow.com/comment/42865258
has comment: http://stackoverflow.com/comment/42864805
has title: struts 2 xml mapping is not working for different class?
tagged with: jsp
has answer: http://stackoverflow.com/a/27221990
possible better answer: http://stackoverflow.com/a/27195401
has answer: http://stackoverflow.com/a/27195401
has body: I am trying to map mysql mapping using hibernate. I have given an action in my jsp page which maps to tweetAction class's putMessage() method. My problem is the mapping is working for userAction class's methods. But when I have added tweetAction class, its not working at all. I just want this flow to enter putMessage() that's why I have entered a SysOut method just to display it on the console This is my struts.xml: /home.jsp /failure.jsp listUser /Login.jsp /display.jsp /Login.jsp This is my TweetAction.java: package com.vaannila.web; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.vaannila.dao.TweetDAO; import com.vaannila.dao.TweetDAOImpl; import com.vaannila.dao.UserDAO; import com.vaannila.dao.UserDAOImpl; import com.vaannila.domain.Tweet; import com.vaannila.domain.User; public class TweetAction extends ActionSupport implements ModelDriven<Tweet> { private static final long serialVersionUID = -6659925652584240539L; private Tweet tweet = new Tweet(); private User user = new User(); private List<Tweet> tweetList = new ArrayList<Tweet>(); private TweetDAO tweetDAO = new TweetDAOImpl(); private boolean isAuthentic = false; public Tweet getModel() { // TODO Auto-generated method stub return null; } public String putMessage() { System.out.println("inside putMessage"); return SUCCESS; } public String tweet() { return SUCCESS; } } This is my hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost/twitter root root 1 org.hibernate.dialect.MySQLDialect true update <mapping class="com.vaannila.domain.User" /> <mapping class="com.vaannila.domain.Tweet" /> </hibernate-configuration> This is my sample Home.jsp What's on your mind? <s:form action="message"> <s:textarea name="message" rows="4" cols="75" Placeholder="Enter here..." /> <s:submit /> </s:form> struts.xml: /temp.jsp /failure.jsp listUser /L…
has comment: http://stackoverflow.com/comment/42865580
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42865337
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42865880
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27221990

http://stackoverflow.com/q/27257862
has comment: http://stackoverflow.com/comment/42989575
has title: data with square brackets inside sqlite DB
has comment: http://stackoverflow.com/comment/42989364
tagged with: android
has comment: http://stackoverflow.com/comment/42989781
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27258335
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42989740
has comment: http://stackoverflow.com/comment/42989495
accepted answer: http://stackoverflow.com/a/27258335
score: 0
has body: i keep getting data with square brackets inside my sqlite DataBase [9999] [8888], what i need is simple data without [ ]. public class AddReminders extends Activity implements OnClickListener { private Button btn_addrecord; private EditText txtpname; String[] versionNames= new String[]{"8888"}; String[] versionNames1= new String[]{"9999"}; ProductModel pm; DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.add_reminder); db = new DatabaseHelper(getApplicationContext()); db.getWritableDatabase(); pm = new ProductModel(); pm.idno = (Arrays.toString(versionNames)); Log.i("reminderidno", "" + pm.idno ); db.addProduct(pm); db = new DatabaseHelper(getApplicationContext()); db.getWritableDatabase(); pm = new ProductModel(); pm.idno = (Arrays.toString(versionNames1)); Log.i("reminderidno", "" + pm.idno ); db.addProduct(pm); txtpname = (EditText) findViewById(R.id.myEditText); btn_addrecord = (Button) findViewById(R.id.button1); btn_addrecord.setOnClickListener(this); } @Override public void onClick(View v) { DatabaseHelper db; ProductModel pm; // TODO Auto-generated method stub switch (v.getId()) { case R.id.button1: if (txtpname.getText().toString().equals("") ) { Toast.makeText(AddReminders.this, "Please add values..", Toast.LENGTH_LONG).show(); } else { db = new DatabaseHelper(getApplicationContext()); db.getWritableDatabase(); pm = new ProductModel(); pm.idno = (txtpname.getText().toString()); Log.i("reminderidno", "" + pm.idno ); db.addProduct(pm); Toast.makeText(AddReminders.this, "Record Added successfully.", Toast.LENGTH_LONG).show(); finish(); } break; default: break; } } } here is my Log 12-02 19:28:39.398: I/reminderidno(7827): [8888] 12-02 19:28:39.448: I/reminderidno(7827): [9999] to be clear i need 8888 without square brackets Thank you in advance
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/42989991
tagged with: string
has comment: http://stackoverflow.com/comment/42990181

yajsw
tags question: http://stackoverflow.com/q/27243660
type: Tag
tag name: yajsw

http://stackoverflow.com/comment/42835562
score: 0
type: AnswerComment
has text: Adding to the answer- in your case there is html from facebook do not match the delimiter pattern. For extracting text, consider using Tika
type: Comment
comment on: http://stackoverflow.com/a/27172538

http://stackoverflow.com/q/27227994
tagged with: image
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/42933464
favorite count: 0
has title: How to extract image in jar file
has comment: http://stackoverflow.com/comment/42933380
has answer: http://stackoverflow.com/a/27228174
tagged with: extract
upvote count: 0
has body: I have some jar file mobile from Gameloft.I can't see where are images. I just see some class file and some 0, 1, 2, 3, ..., a, b, ..., x, y, z file. I think game's images in that files. So how can I extract it ?
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
score: -2

http://stackoverflow.com/q/27310770
downvote count: 0
has answer: http://stackoverflow.com/a/27310824
has body: I'm trying to get the decimal 8.6 to render to a left zero-padded string i.e. 08.6. Why doesn't the following seem to work? double number = 8.6; String.format("%03.1f", number); //expect "08.6", get "8.6" The formatting string seems to be correct. What am I doing wrong?
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/27310824
possible better answer: http://stackoverflow.com/a/27310905
has answer: http://stackoverflow.com/a/27310905
has title: Why won't String.format() give me a left zero-padded floating point output?
tagged with: string-formatting
has comment: http://stackoverflow.com/comment/43082870
has comment: http://stackoverflow.com/comment/43082812
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43082413
answer count: 2

http://stackoverflow.com/comment/42911920
has text: I think you need to show more of your code then, and explain what is happening
comment on: http://stackoverflow.com/a/27215860
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/42986905
type: QuestionComment
comment on: http://stackoverflow.com/q/27256492
has text: The logcat just ends with "Device disconnected" and ProGuard was never on. I can still post logcat if you think it could help.
score: 0
type: Comment

http://stackoverflow.com/comment/42983410
type: Comment
has text: I would say you need to switch to a monospace Font, but switching fonts is one of these things that are a real pain in Android.
type: QuestionComment
comment on: http://stackoverflow.com/q/27248396
score: 1

http://stackoverflow.com/a/27203844
answers question: http://stackoverflow.com/q/27186140
has body: Do you have B in the container? If you can't inject it in the constructor you can use http://picocontainer.codehaus.org/multi-injection.html to inject both field and constructor
score: 0
type: Answer

http://stackoverflow.com/a/27226132
has comment: http://stackoverflow.com/comment/42930107
type: Answer
has comment: http://stackoverflow.com/comment/42929966
upvote count: 1
has comment: http://stackoverflow.com/comment/42929994
has body: Something like below directory is created my-app |-- pom.xml `-- src |-- main | `-- java | `-- com | `-- mycompany | `-- app | `-- App.java `-- test `-- java `-- com `-- mycompany `-- app `-- AppTest.java The src/main/java directory contains the project source code, the src/test/java directory contains the test source, and the pom.xml file is the project's Project Object Model, or POM.
answers question: http://stackoverflow.com/q/27226036
score: 1
has comment: http://stackoverflow.com/comment/42930105
downvote count: 0
has comment: http://stackoverflow.com/comment/42930231

http://stackoverflow.com/q/27280625
answer count: 2
possible better answer: http://stackoverflow.com/a/42001172
downvote count: 0
has body: Does Cordova have any automatic way to pass onActivityResult to its CordovaPlugin classes? Here's my current file, doing it manually: package com.myapp; import android.os.Bundle; import org.apache.cordova.*; import android.content.Intent; import com.flyingsoftgames.googleplaytoken.GooglePlayToken; public class MyApp extends CordovaActivity { @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { GooglePlayToken.runOnActivityResult (requestCode, resultCode, data); } @Override public void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); super.init (); super.loadUrl(Config.getStartUrl()); } } I tried to use the same technique employed in https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java to get the data passed through "automatically" -- but it crashes. Here is a working (manual and no data pass-through) and non-working (automatic data pass-through) version of the target class. First working, then non-working. Working, no data pass-through: // Working, no data pass-through. package com.flyingsoftgames.googleplaytoken; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.Scopes; import com.google.android.gms.auth.GoogleAuthException; import com.google.android.gms.auth.GoogleAuthUtil; import com.google.android.gms.auth.UserRecoverableAuthException; import com.google.android.gms.common.AccountPicker; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult.Status; import org.json.JSONArray; import org.json.JSONException; import android.content.Context; import android.content.Intent; import android.app.Activity; import android.accounts.AccountManager; import android.os.AsyncTask; import android.os.Bundle; import java.io.IOException; import andro…
favorite count: 0
tagged with: onactivityresult
has answer: http://stackoverflow.com/a/27324808
tagged with: android
accepted answer: http://stackoverflow.com/a/27324808
score: 8
type: AnsweredQuestion
tagged with: cordova
has answer: http://stackoverflow.com/a/42001172
has title: Passing onActivityResult in Cordova
upvote count: 8
type: Question
tagged with: java

http://stackoverflow.com/q/27206878
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27207008
tagged with: http://stackoverflow.com/tag/c
type: Question
score: 0
has body: I have to send a long from my c program to be read in java code using a byte buffer . I am doing something wrong as i cant send 1234 and read it back in java as it gets corrupted to 564049465049088. In my C code I do int64_t resultl = 1234; Then to copy uint8_t * outBuffer &lt;== pointer to the buffer; memcpy(outBuffer,&amp;resultl,8); In java I read back the bytes as ByteBuffer buf = ByteBuffer.wrap(bytes); offset=0; long l = buf.getLong(offset); This is giving me wrong value 564049465049088 as i had sent 1234 from C; Can someone please suggest what I am doing wrong &amp; how can i correct the same.
answer count: 1
has title: reading long bytes from c in java
has answer: http://stackoverflow.com/a/27207008

http://stackoverflow.com/comment/42957451
has text: I just discovered that this problem occurs because I loaded separate images to my tileset. Joining them all together in a single .png, however, made it run properly. I still do not know why it works that way.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27239949

hql
tag name: hql
tags question: http://stackoverflow.com/q/27280818
tags question: http://stackoverflow.com/q/27229765
type: Tag
tags question: http://stackoverflow.com/q/27243303
tags question: http://stackoverflow.com/q/27179576
tags question: http://stackoverflow.com/q/27312821

http://stackoverflow.com/comment/42868802
type: Comment
type: QuestionComment
has text: @Buggabill I'm afraid so, too. But I think it has a legit point in it. And it is a concern to me right now, because I'm somewhat asked for advise...
comment on: http://stackoverflow.com/q/27191204
score: 0

http://stackoverflow.com/comment/42866795
comment on: http://stackoverflow.com/a/27189937
type: Comment
has text: alaster, this is what I wanted. can't wait to accept your answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42897806
comment on: http://stackoverflow.com/q/27207402
type: Comment
type: QuestionComment
has text: still doesn't work, i'm not very experienced though, i've made a few apps but i never worked with spinners
score: 0

http://stackoverflow.com/q/27233269
answer count: 2
has comment: http://stackoverflow.com/comment/42943424
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/27233360
favorite count: 0
has title: Redundant If statement warning
has comment: http://stackoverflow.com/comment/42944266
has comment: http://stackoverflow.com/comment/42943184
possible better answer: http://stackoverflow.com/a/27233360
tagged with: netbeans
has answer: http://stackoverflow.com/a/27233377
type: Question
type: AnsweredQuestion
tagged with: if-statement
upvote count: 5
tagged with: java
has body: if ( a &gt; b) { return true; } return false; With the above code Netbeans gives "Redundant if statement" warning and suggest changing it to : return a &gt; b; I think the first version is easier to read and prefer using it in my code. I want to know if there is any disadvantages of it compared to the suggested one.
accepted answer: http://stackoverflow.com/a/27233377

http://stackoverflow.com/comment/42970870
score: 0
has text: In case of a database also, you have to restart server.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27248110

http://stackoverflow.com/a/27221901
type: Answer
answers question: http://stackoverflow.com/q/27221227
has body: Check by this code if you get the response then u check it in your code if not then your service didn't hit. try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost request = new HttpPost(); URI website = new URI("Your Url"); request.setURI(website); HttpResponse response = httpclient.execute(request); in = new BufferedReader(new InputStreamReader( response.getEntity().getContent())); String line = in.readLine(); Log.d("response from website.... ",line) }catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); }
score: 0

http://stackoverflow.com/comment/42975324
score: 0
type: Comment
has text: Sir i know Toast message will be shown but how can i change the layout of "RequirementFragment" based on stored variable from "onResume method"....
type: AnswerComment
comment on: http://stackoverflow.com/a/27250483

http://stackoverflow.com/q/27280928
tagged with: exception
accepted answer: http://stackoverflow.com/a/27280953
answer count: 4
has title: How to check which exception type was thrown in Java?
upvote count: 56
has comment: http://stackoverflow.com/comment/84901473
has answer: http://stackoverflow.com/a/27280976
has comment: http://stackoverflow.com/comment/43030477
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/62966067
linked to: http://stackoverflow.com/q/12359175
tagged with: java
has answer: http://stackoverflow.com/a/51538776
has body: How can I determine which type of exception was caught, if an operation catches multiple exceptions? This example should make more sense: try { int x = doSomething(); } catch (NotAnInt | ParseError e) { if (/* thrown error is NotAnInt */) { // line 5 // printSomething } else { // print something else } } On line 5, how can I check which exception was caught? I tried if (e.equals(NotAnInt.class)) {..} but no luck. NOTE: NotAnInt and ParseError are classes in my project that extend Exception.
type: Question
has answer: http://stackoverflow.com/a/27280953
downvote count: 0
possible better answer: http://stackoverflow.com/a/51538776
score: 56
favorite count: 0

http://stackoverflow.com/comment/43064942
type: Comment
type: QuestionComment
has text: Stackoverflow is not here to do your homework for you
score: 0
comment on: http://stackoverflow.com/q/27300623

http://stackoverflow.com/comment/43017429
type: AnswerComment
type: Comment
score: 0
has text: @ItachiUchiha you can to painting an BufferedImage to AWT/Swing components with desired dimension in pixels, there is mutual relationship between pixel and DPI, problem is that you painting off_screen, to try, start with with printing already visible Object in screen (I'm sure thats similair questions with/about printing the visible image is a few times here)
comment on: http://stackoverflow.com/a/27273670

http://stackoverflow.com/a/27208704
has body: Thanks everybody for help. I have figured it out with your answers. It seems impossible to use Tcl as a server without any certificates. Not even another Tcl script can connect to the server without certificates. The client can leave out the validity checking, but the server must provide a certificate. This is not stated clearly in the documentation! Now I can establish a connection with a home-made certificate as stated on page http://wiki.tcl.tk/15244 Unfortunately, I don't (yet) know how to tell Android to not check the validity for now (like -require 0 in Tcl). Maybe I'll just import my own CA into the Android device. Otherwise, I would have to buy a certificate signed by an official CA. Some time in the future, I'll have to do this anyway.
downvote count: 0
answers question: http://stackoverflow.com/q/27192790
type: Answer
has comment: http://stackoverflow.com/comment/42919485
upvote count: 1
score: 1

http://stackoverflow.com/comment/42853545
type: Comment
comment on: http://stackoverflow.com/a/27182091
score: 1
has text: ... Doing that, Jersey will not ever try to create the `UserResource`, as we create it ourselves. If we let Jersey create it, we are implicitly saying that the class should _not_ be a singleton, in which case Jersey will create a new instance for each request. Where as with a singleton, the same instance will be used for each request, which may not be desired, depending on the application semantics
type: AnswerComment

http://stackoverflow.com/q/27162088
score: 2
has title: Sort doesn't work when user aggregation in Spring data Mongo
upvote count: 2
tagged with: java
tagged with: spring-data
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/38310789
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27166460
favorite count: 0
has body: I am trying run a mongo aggregation on Spring data here is the sample json { "id":***** "taskResultContent": [ { "executionUUID":"uuid_2", "sequency":"1", "returnContent":"SUCCESS", }, { "executionUUID":"uuid_2", "sequency":"2", "returnContent":"SUCCESS", } ] } here is my Mongo query [ { "$match" : { "_id" : ObjectId("54767c7cfda0da01d4843e93") } }, { "$unwind" : "$taskResultContent" }, { "$project" : { "executionUUID" : "$taskResultContent.executionUUID", "returnContent" : "$taskResultContent.returnContent", "sequency" : "$taskResultContent.sequency", "_id" : 0, "resultID" : "$_id" } }, { "$match" : { "executionUUID" : "uuid_3" } }, { "$sort" : { "sequency" : -1 } } ] here is my java implementation: Aggregation agg = newAggregation( match(Criteria.where("_id").is(objId)), unwind("taskResultContent"), project("taskResultContent.executionUUID","taskResultContent.returnContent","taskResultContent.sequency").and("resultID").previousOperation(), match(Criteria.where("executionUUID").is(executionUUID)), sort(DESC,"sequency") ); Then I found a problem, the SORT doesn't work. I print out the aggregation query from java. it looks like: { "$sort": { "taskResultContent.sequency": -1 } } it should be "sequerycy":-1 but not "taskResultContent.sequency": -1 Does anyone meet the same issue ?
type: UnansweredQuestion
tagged with: aggregation-framework

http://stackoverflow.com/q/27193997
downvote count: 0
accepted answer: http://stackoverflow.com/a/27194324
favorite count: 0
has title: Java - Comparing efficiency of two O(n) algorithms
has comment: http://stackoverflow.com/comment/42873630
tagged with: big-o
type: AnsweredQuestion
tagged with: linked-list
upvote count: 3
tagged with: java
has body: I'm studying Linked Lists and the question is - Write a function to print the middle term of a given linked list (assume that LL has odd number of nodes). Method 1 - Traverse the LL and count the number of nodes using a counter. Add 1 (to make it an even number) and divide the counter by 2 (ignore math for discrepancies). Traverse the LL again but this time only upto the counter-th term and return. void GetMiddleTermMethod1(){ //Count the number of nodes int counter = 0; Node n = FirstNode; while (n.next != null){ counter = counter + 1; n = n.next; } counter=counter+1/2; //now counter is equal to the half of the number of nodes //now a loop to return the nth term of a LL Node temp = FirstNode; for(int i=2; i&lt;=counter; i++){ temp = temp.next; } System.out.println(temp.data); } Method 2 - Initialize 2 references to nodes. One traverses 2 nodes at a time and the other only traverses 1. When the fast reference reaches null (the end of LL), the slow one would have reached the middle and return. void GetMiddleTermMethod2(){ Node n = FirstNode; Node mid = FirstNode; while(n.next != null){ n = n.next.next; mid = mid.next; } System.out.println(mid.next.data); } I have 3 questions - Q1 - How can I know which algorithm is more efficient in case I'm asked this question in a job interview? I mean both functions traverse the LL one and a half times (second one does it in one loop instead of 2 but still its traverses the LL one and a half times)... Q2 - Since both algorithms have the Big O of O(n), what parameters will decide which one is more efficient? Q3 - What is the general method of calculating the efficiency of such algorithms? I'd really appreciate If you could link me towards the suitable tutorial... Thanks
has answer: http://stackoverflow.com/a/27194324
type: Question
tagged with: performance
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42873914
possible better answer: http://stackoverflow.com/a/27194467
answer count: 2
has answer: http://stackoverflow.com/a/27194467
score: 3

http://stackoverflow.com/a/27267657
has comment: http://stackoverflow.com/comment/48255973
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/69955984
has body: No answers yet and had to make a decision so here it is: Marker class: package com.companyname.appname.projectname.package1name; /** * Empty marker class used to identify this package when using type-safe basePackageClasses in Spring @ComponentScan. */ public class PackageMarker { // Empty marker class } Usage: @ComponentScan(basePackageClasses = { com.companyname.appname.projectname.package1name.PackageMarker.class, com.companyname.appname.projectname.package2name.PackageMarker.class, /* ...etc... */ }) PackageMarker naming justification: Seems sensible for all such classes to have the same name so they can be easily identified. Seems sensible for it to start with "Package" (in the same way as package-info.java). Seems sensible for it to end with "Marker" since the documentation refers to a "marker class". Opted not to include the word "Base" so it isn't confused with base classes. Opted not to include the word "Info" as it doesn't contain any info like package-info.java does. Opted not to include any other words (e.g. "NoOp") to keep it snappy and flexible for other possible uses. Would still be interested if anyone can give examples of marker classes used in a more trail-blazing context...
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27254556
has comment: http://stackoverflow.com/comment/48345571
has comment: http://stackoverflow.com/comment/48241989
has comment: http://stackoverflow.com/comment/48278079
answers question: http://stackoverflow.com/q/27254556
type: Answer

http://stackoverflow.com/comment/42854426
score: 0
comment on: http://stackoverflow.com/a/27183109
type: Comment
has text: @Sravani: I have edited my code above, under the line **Just replace your code like this and try:**> Please check it out and let me know, if you have any concerns over it.
type: AnswerComment

http://stackoverflow.com/q/27193932
upvote count: 0
score: -2
has body: I have the following code that goes through an ArrayList of size 8. public Tile[] getTiles(){ Tile[] tiles = {}; for(int i = 0; i &lt; board.size(); i++){ try { tiles[i] = board.get(i); } catch(ArrayIndexOutOfBoundsException e){ System.out.println(i + " is out of bounds"); } } return tiles; } However it outputs 0 is out of bounds 1 is out of bounds 2 is out of bounds 3 is out of bounds 4 is out of bounds 5 is out of bounds 6 is out of bounds 7 is out of bounds 8 is out of bounds Why are all elements in the ArrayList out of bounds?
tagged with: arrays
has answer: http://stackoverflow.com/a/27193945
tagged with: arraylist
answer count: 2
has answer: http://stackoverflow.com/a/27193975
has title: Why is out of bounds error thrown?
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: java
tagged with: indexoutofboundsexception
type: Question

http://stackoverflow.com/a/27261697
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27261618
has body: If this is all happening inside a method of your class, then MessageData needs to call the method, and the method needs to return the array. That would look something like this: public class MyClass { public String[] getStrings() { String messageId = messageIdText.getText(); String subject = subjectText.getText(); String recipient = recipientText.getText(); String message = messageArea.getText(); String[] messageData = new String[]{messageId, subject, recipient, message}; return messageData; } } and in MessageData: MyClass thing = new MyClass(); String[] strings = thing.getStrings(); Or, if messageData is instead a field of your class, you could write a getter for it. That would look more like this: public class MyClass { private String[] messageData; public void setThingsUp() { String messageId = messageIdText.getText(); String subject = subjectText.getText(); String recipient = recipientText.getText(); String message = messageArea.getText(); messageData = new String[]{messageId, subject, recipient, message}; } public String[] getMessageData() { return messageData; } } called thus: MyClass thing = new MyClass(); thing.setThingsUp(); String[] strings = thing.getMessageData();

http://stackoverflow.com/comment/42814839
type: AnswerComment
score: 0
has text: Oh, Thanks for pointing that out I thought I put r++. Thanks for the help it worked.
type: Comment
comment on: http://stackoverflow.com/a/27159074

http://stackoverflow.com/q/27197282
answer count: 1
has body: String tempNum=""; public void actionPerformed(ActionEvent event) { JButton src = (JButton) event.getSource(); if(src.equals(one)) { if (pressed + 3000 &gt; System.currentTimeMillis()) // user press &gt; 3 seconds { tempNum = tempNum + "1"; //do a command } else //new { pressed = System.currentTimeMillis(); tempNum=""; tempNum = tempNum + "1"; //do a command } } } Hello. In this program, the user will be pressing a JButton one. Users who continuously press one within 3 seconds with append the string "1" to tempNum. When the user presses another one after 3 seconds, the tempNum will just have a value of "1". My question is: Initially, when the user presses a brand new "1", how do you detect if the user is inactive for 3 seconds? For example: Input: User input: 1 How do you detect if the user didn't press anything after 3 seconds?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27857137
tagged with: swing
has title: Inactive Button Presses (Java Swing)
tagged with: jbutton
tagged with: actionlistener
tagged with: java
type: Question
score: 0

http://stackoverflow.com/a/27155505
has comment: http://stackoverflow.com/comment/42807836
has comment: http://stackoverflow.com/comment/42813077
type: AcceptedAnswer
upvote count: 17
has body: I google how below code loads the resource Abc.class.getClassLoader().getResourceAsStream("abc.txt") and find that it searchs the resource in all jar file and zip file in class path. That's correct when you work only with a single ClassLoader (most non-OSGi/ non-modular environments). Then, all content of all JARs can be seen as one big tree, where classes and resources of JARs, which occur prior in the class path, win over those of JARS, which occur further behind. But when i tried it I am not able to loads it but if i give package path then I am able to loads it can someone tell me how getResourceAsStream search the class path Abc.class.getClassLoader().getResourceAsStream("abc.txt") searches at root of the tree while: Abc.class.getResourceAsStream("abc.txt") searches relative to the package of Abc. Abc.class.getResourceAsStream("/abc.txt") searches at the root of the tree again. All these methods will only search in the specified directory (or the root directory) and won't traverse and search the whole tree. Personally, I almost always use the latter two versions (Class.getResourceAsStream) and rarely use the ClassLoader.getResourceAsStream method directly.
type: Answer
has comment: http://stackoverflow.com/comment/42807858
downvote count: 0
score: 17
accepted answer of: http://stackoverflow.com/q/27155195
answers question: http://stackoverflow.com/q/27155195
has comment: http://stackoverflow.com/comment/42813138

http://stackoverflow.com/q/27193111
has body: I'm trying to change the color of the tabs viewpager but I've tried everything and do not change color. This is the activity I'm trying to customize the tabs: LocationsActivity.java: import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar.Tab; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import com.jad.pholoc.util.LocationsFragmentPagerAdapter; public class LocationsActivity extends ActionBarActivity { private ViewPager mPager; public static FragmentManager fragmentManager; private LocationsFragmentPagerAdapter fragmentPagerAdapter; private ActionBar mActionbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_locations); mActionbar = getSupportActionBar(); mActionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mPager = (ViewPager) findViewById(R.id.pager); fragmentManager = getSupportFragmentManager(); ViewPager.SimpleOnPageChangeListener pageChangeListener = new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { super.onPageSelected(position); mActionbar.setSelectedNavigationItem(position); } }; mPager.setOnPageChangeListener(pageChangeListener); fragmentPagerAdapter = new LocationsFragmentPagerAdapter( fragmentManager); mPager.setAdapter(fragmentPagerAdapter); mActionbar.setDisplayShowTitleEnabled(true); ActionBar.TabListener tabListener = new ActionBar.TabListener() { @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { mPager.setCurrentItem(tab.getPosition()); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } }; Tab tab = mActionbar.new…
has comment: http://stackoverflow.com/comment/42899446
type: Question
tagged with: android-viewpager
answer count: 1
score: 0
has title: Change background tabs in ViewPager v4
tagged with: android
tagged with: android-activity
type: UnansweredQuestion
tagged with: android-tabs
has comment: http://stackoverflow.com/comment/42899363
has answer: http://stackoverflow.com/a/27195319
tagged with: java

http://stackoverflow.com/q/27241922
linked to: http://stackoverflow.com/q/17293914
has answer: http://stackoverflow.com/a/27242460
has comment: http://stackoverflow.com/comment/42961722
accepted answer: http://stackoverflow.com/a/27242460
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27248426
favorite count: 0
has answer: http://stackoverflow.com/a/27248426
has body: How to add hover for element? Consider my below code: package AutomationFramework; import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; public class LoginPage { private static WebDriver driver = null; public static void main(String[] args) { // Create a new instance of the Firefox driver driver = new FirefoxDriver(); //Put a Implicit wait driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); //Launch the Website driver.get("URL"); // Find the element that's ID attribute is 'account'(My Account) // driver.findElement(By.xpath("/html/body/table/tbody/tr[5]/td/table/tbody/tr/td[2]/form/table/tbody/tr[3]/td[2]/input")).click(); // Enter Username on the element driver.findElement(By.name("userName")).sendKeys("remote"); // Find the element that's ID attribute is 'pwd' (Password) driver.findElement(By.name("password")).sendKeys("aaaaaa"); // Now submit the form. WebDriver will find the form for us from the element driver.findElement(By.name("submit")).click(); // Print a Log In message to the screen System.out.println(" Login Successfully"); driver.findElement(By.name("img2")).click(); // Find the element that's ID attribute is 'account_logout' (Log Out) //driver.findElement (By.name("img104")).click(); // Close the driver driver.quit(); } }
tagged with: hover
tagged with: selenium-webdriver
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: selenium
duplicate of: http://stackoverflow.com/q/17293914
has title: How to "hover over" the button in selenium?
type: Question

http://stackoverflow.com/q/27284980
has comment: http://stackoverflow.com/comment/43066288
has comment: http://stackoverflow.com/comment/43046041
tagged with: java
has title: WAMP Crossbar.io client and server
score: -1
has body: I have just been introduced to the WebSocket Application Messaging Protocol WAMP http://wamp.ws/ and on googling I found the Crossbar.io implementation of the protocol. I installed it by following http://crossbar.io/docs/Quick-Start/ and http://crossbar.io/docs/Getting-started-with-Java/ . My goal is to wire a Java server publishing real time messages to be displayed on a web browser. Could you point me in the right direction? Once I have that setup, I can proceed with structuring the data using Ext JS or similar JavaScript frameworks.
type: Question
tagged with: crossbar
has answer: http://stackoverflow.com/a/27311960
upvote count: 0
answer count: 1
tagged with: extjs
tagged with: wamp-protocol
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/43084519

http://stackoverflow.com/comment/43092833
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27308215
has text: Correcting an entire project is well beyond the scope of SO. Please edit your question to include a [minimal, complete example](http://stackoverflow.com/help/mcve) that focuses on a particular problem.
type: AnswerComment

http://stackoverflow.com/comment/42984958
score: 0
type: Comment
has text: Hello i use this.sendBroadcast(i); no mark a error but no work :/ mi class BeaconsBroacast dont execute :/
comment on: http://stackoverflow.com/a/27255378
type: AnswerComment

http://stackoverflow.com/comment/42972507
type: Comment
score: 0
type: AnswerComment
has text: added other spannable possibility above in the solution
comment on: http://stackoverflow.com/a/27248751

http://stackoverflow.com/comment/42873379
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27193938
has text: Can you post the crash log?

http://stackoverflow.com/q/27293579
has answer: http://stackoverflow.com/a/27295251
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43053788
has comment: http://stackoverflow.com/comment/43053048
has body: I use the Struts2 framework to create a webapp. I have an interceptor that should have different behaviour depending on which action is invoked. For example, a login interceptor that should always allow some actions to execute, but it should block other actions if the user is not yet logged in. The way I solve this now is by manually checking the name (and/or namespace) of the action in the interceptor, and determine my behaviour based on that. The downside of this "hardcocded" logic is that it is hard to maintain if I edit my struts.xml file, and it is also not obvious what is going on for other developers. I would like to know if these is some way to add 'metadata' INSIDE the struts.xml file (or other file?) to "mark" certain actions as being certain "type". For example, something like this: Struts.xml /login/jsp/Login.jsp And then in my interceptor class: @Override public String intercept(ActionInvocation invocation) throws Exception { Set<String> actionTypes = invocation.getInvocationContext().getTypes(); if(actionTypes.contains("login") { doSomething(); } else { doSomethingElse(); } } Is this possible, or is the hardcoded parsing of name(space) the only way?
tagged with: struts2
accepted answer: http://stackoverflow.com/a/27295251
score: 0
has title: Struts2 Is there a way to add metadata to action definition in struts.xml file?
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/27307617
has answer: http://stackoverflow.com/a/27308615
has answer: http://stackoverflow.com/a/27308126
answer count: 5
accepted answer: http://stackoverflow.com/a/27307810
has comment: http://stackoverflow.com/comment/43077946
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27307758
tagged with: java
has answer: http://stackoverflow.com/a/27307833
tagged with: loops
type: Question
possible better answer: http://stackoverflow.com/a/27307758
tagged with: arrays
has answer: http://stackoverflow.com/a/27307810
score: 0
has title: How do I find the letters of a certain word within a Character array in Java?
has body: I need to compare the characters from two different Character Arrays to find the Hidden word inputted by the user. The goal is to input 2 Strings and to find a word scrambled within the other. Ex. The word "tot" is scrambled in the word "tomato" With the help of some people of the forums, I have implemented character arrays to store the user Strings, but I do not know a way to check each array for the characters needed. I have tried the code below but it always results in the program not being able to find the word. If anyone could provide a better method or solution I'd highly appreciate it. public static void main(String[] args) { input = new Scanner(System.in); System.out.println("Please enter a word"); String word = input.next(); char[] charOfWrds = word.toCharArray(); System.out.println("Please enter a hidden word you would like to search for"); String search = input.next(); char[] charOfSrch = search.toCharArray(); if (isContains(charOfWrds, charOfSrch)) { System.out.print("The word " + search + " is found in the word " + word); } else { System.out.print("The word was not found in " + word); } } public static Boolean isContains(char[] charOfWrds, char[] charOfSrch) { int count = 0; for (char cha : charOfWrds) { for (char chaaa : charOfSrch) { if (cha == chaaa) count++; } } if (count == charOfSrch.length) { return true; } return false; }
tagged with: compare
tagged with: string

http://stackoverflow.com/a/27218816
answers question: http://stackoverflow.com/q/27218746
has body: You have a typo in this line System.out.printf("%5.1f%12.3f%6s%12,1f%12.3f\n", f, footToMeter(f), "|", m, meterToFoot(m)); Specifically, "%5.1f%12.3f%6s%12,1f%12.3f\n" needs to be changed to "%5.1f%12.3f%6s%12.1f%12.3f\n". Note the comma was changed to a period.
score: 0
has comment: http://stackoverflow.com/comment/42917033
upvote count: 1
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27218746

http://stackoverflow.com/comment/42933464
comment on: http://stackoverflow.com/q/27227994
score: 0
type: Comment
type: QuestionComment
has text: Those files that do not end in `.class` might be images. Without file extension you might inspect the magic cookie of jpeg, png, gif (those are the first bytes that are always the same for the same file type). Or add .png/.gif, and try it out.

http://stackoverflow.com/q/27312814
upvote count: 4
has title: how to change location of icon in JOptionpane?
favorite count: 0
tagged with: joptionpane
has answer: http://stackoverflow.com/a/37570755
accepted answer: http://stackoverflow.com/a/37570755
tagged with: swing
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/43086117
answer count: 1
score: 4
has body: I'm wondering if it is possible to change location of icon in JOptionPane from left side to the right side? public void popupMessage(){ JCheckBox checkbox = new JCheckBox("Do not show this message again."); String message = "Attempt to set icon to right side is successfully approached."; Object[] params = {message, checkbox}; int n = JOptionPane.showConfirmDialog(null, params, "Icon to right side",JOptionPane.YES_NO_CANCEL_OPTION); BasicOptionPaneUI.getIcon().paintIcon( ); }

http://stackoverflow.com/a/27155059
type: Answer
answers question: http://stackoverflow.com/q/27154613
has comment: http://stackoverflow.com/comment/42804620
upvote count: 1
downvote count: 0
score: 1
has body: Adding to @pjs, you need to do something like.. public boolean existsOrNot() { for (Person person : names){ if ("Tom".equals(person.getName().getFirstName()){ return true; } } return false }

http://stackoverflow.com/comment/43091965
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27313457
has text: @Eleanore As the comment under your question says, this sounds like a problem in Pattern Recognition. I don't have that background to help. Trying to look at some algorithms in that field. Sounds like a classic problem there.
type: AnswerComment

http://stackoverflow.com/comment/42899656
type: QuestionComment
has text: Thanks for the image, and I've posted it. It appears to be a fractal. Now regarding, `"I just want the lines to be straight in every possible direction and not be able to go diagonally"` -- this confuses me since diagonal **is** a possible direction and the first part of your statement states that you want the lines to go in all possible directions. Please clarify.
score: 0
comment on: http://stackoverflow.com/q/27208676
type: Comment

http://stackoverflow.com/q/27230509
accepted answer: http://stackoverflow.com/a/27231270
possible better answer: http://stackoverflow.com/a/27230604
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27231005
tagged with: php
linked to: http://stackoverflow.com/q/6802483
tagged with: dictionary
has comment: http://stackoverflow.com/comment/42937982
has answer: http://stackoverflow.com/a/27231270
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I am porting some PHP code over to Java. I have a class that defines the following map: class Something { protected $channels = array( 'a1' =&gt; array( 'path_key1' =&gt; 'provider_offices', 'path_key2' =&gt; 'provider_offices', ), 'a2' =&gt; array( 'path_key1' =&gt; 'provider_users', 'path_key2' =&gt; 'provider_users', ), 'a3' =&gt; array( 'path_key1' =&gt; 'provider_offices', 'path_key2' =&gt; 'provider_offices', ), 'a4' =&gt; array( 'path_key1' =&gt; 'attri1', 'path_key2' =&gt; 'attri1', ), 'a5' =&gt; array( 'path_key1' =&gt; 'attrib2', 'path_key2' =&gt; 'attrib2', ), 'a6' =&gt; array( 'path_key1' =&gt; 'diagnosis', 'path_key2' =&gt; 'diagnosis', ), 'a7' =&gt; array( 'path_key1' =&gt; 'meds', 'path_key2' =&gt; 'meds', ), 'a8' =&gt; array( 'path_key1' =&gt; 'risk1', 'path_key2' =&gt; 'risk1', ), 'a9' =&gt; array( 'path_key1' =&gt; 'risk2', 'path_key2' =&gt; 'risk2', ), 'a0' =&gt; array( 'path_key1' =&gt; 'visits', 'path_key2' =&gt; 'visits', ), ); } In PHP the data was being accessed by doing something like this: $key = 'a9'; $pathKey2Value = $this-&gt;channels[$key]['path_key2']; I started to implement a Map&lt;String, Map&lt;String, String&gt;&gt; member in Java but it seemed overly complicated, as well as defining A1, A2, etc classes. What would be the most elegant way to accomplish the same thing in Java?
type: Question
has comment: http://stackoverflow.com/comment/42938045
has answer: http://stackoverflow.com/a/27230604
has title: What would be the best way to define a Map<String, Map<String, String>> map in Java?

http://stackoverflow.com/comment/43050103
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27292117
score: 0
has text: What's exactly the problem, i.e. what do you mean by "can't get the buttons to work"? Can you show us a [MCVE](http://stackoverflow.com/help/mcve)?

http://stackoverflow.com/q/27156473
has comment: http://stackoverflow.com/comment/42807567
type: Question
tagged with: encoding
has comment: http://stackoverflow.com/comment/42807043
score: 0
has title: Encoding special characters to their hex codes
has comment: http://stackoverflow.com/comment/42807634
type: UnansweredQuestion
has body: I have a following input string: 1%2fPJJP I want to convert it to the following: 1&amp;#x25;2fPJJP The hexadecimal code for % can be found here: http://character-code.com/ How do I do it in Java? public class HelloWorld { public static void main(String[] args) { String test = null; try { test = URLEncoder.encode("1%2fPJJP", "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } System.out.println(test); } } But I got the following: 1%252fPJJP. How do I do it?
has comment: http://stackoverflow.com/comment/42807910
answer count: 0
tagged with: java

http://stackoverflow.com/q/27256770
has comment: http://stackoverflow.com/comment/42995760
tagged with: recursive-backtracking
has title: Recursive backtracking to create permutations of given string
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/47108093
has comment: http://stackoverflow.com/comment/42987517
tagged with: data-structures
tagged with: avl-tree
has body: I am currently working on a programming assignment where the user inputs a word i.e. "that" and the program should return all valid words that can be made from the given string i.e. [that, hat, at] The issue I am having is that the resulting words should be created using a recursive method that checks if the prefix is valid. i.e. if the given word is "kevin" once the program tries the combination "kv" it should know that no words start with kv and try the next combination in order to save time. Currently my code just creates ALL permutations which takes a relatively large amount of time when the input is larger than 8 letter. protected static String wordCreator(String prefix, String letters) { int length = letters.length(); //if each character has been used, return the current permutation of the letters if (length == 0) { return prefix; } //else recursively call on itself to permute possible combinations by incrementing the letters else { for (int i = 0; i &lt; length; i++) { words.add(wordCreator(prefix + letters.charAt(i), letters.substring(0, i) + letters.substring(i+1, length))); } } return prefix; } If anyone could help me figure this out I'd be much appreciated. I am also using an AVL tree to store the dictionary words for validation incase that is needed.
score: 0
has comment: http://stackoverflow.com/comment/42993954

http://stackoverflow.com/comment/88123501
score: 0
comment on: http://stackoverflow.com/a/28327312
type: AnswerComment
type: Comment
has text: `> I try to getItemCount() of my Adapter but this returns 0, I don't know why it is...` ... me too. Anyone know why?

http://stackoverflow.com/comment/42998670
comment on: http://stackoverflow.com/q/27262998
has text: i think i m goig to do it parsing information from the same websocket, like you are saying. thank you:)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43062884
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27225774
has text: Have you tried the sleep approach? if so, did it worked?
score: 0

http://stackoverflow.com/q/27260910
score: -1
has comment: http://stackoverflow.com/comment/42994955
type: Question
has body: I have code which is throwing an exception . In code below line container.setIsDefault(true) is throwing InvocationTargetException. I want to know actual cause of exception so I wrapped this code in try ..catch block. But using try catch block is giving me compile time error "Unreachable catch block for InvocationTargetException. This exception is never thrown from the try statement body" Any idea how can I figure out actual cause of exception. try{ EdmEntityContainer.Builder container= EdmEntityContainer.newBuilder(); container.setName(dataBase); container.setIsDefault(true); container.setLazyLoadingEnabled(true); container.addEntitySets(entitySets); }catch (InvocationTargetException e) { Throwable cause = e.getCause(); System.out.format("Invocation of failed because of: %s%n", cause.getMessage()); } UPDATE: I added RuntimeException and fake InvocationTargetException in code . But its not going into any of those catch blocks.Its directly going to below function where target is null public InvocationTargetException(Throwable target) { super((Throwable)null); // Disallow initCause this.target = target; } Here is stacktrace,now exception is coming at line container.addEntitySets(entitySets); InvocationTargetException.&lt;init&gt;(Throwable) line: 72 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 606 JavaMethodInvokerFactory$1.invoke(Method, Object, Object...) line: 60 AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(Object, HttpContext) line: 205 AbstractResourceMethodDispatchProvider$ResponseOutInvoker(ResourceJavaMethodDispatcher).dispatch(Object, HttpContext) line: 75 HttpMethodRule.accept(CharSequence, Object, UriRuleContext) line: 288 ResourceClassRule.accept(CharSequence, Object, UriRuleContext) line: 108 RightHandPathRule.accept(CharSequ…
has comment: http://stackoverflow.com/comment/42995197
tagged with: odata
upvote count: 2
has title: Unreachable catch block for InvocationTargetException
has answer: http://stackoverflow.com/a/27261001
has comment: http://stackoverflow.com/comment/42994993
downvote count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/42995275
answer count: 1
has comment: http://stackoverflow.com/comment/42995035
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43070922
tagged with: java

http://stackoverflow.com/q/27182395
has answer: http://stackoverflow.com/a/27326421
has title: Using JAX-WS 2.2.5 client with JDK/JRE 1.5
type: AnsweredQuestion
downvote count: 0
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/27218255
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27218255
accepted answer: http://stackoverflow.com/a/27326421
tagged with: web-services
tagged with: java
tagged with: jax-ws
has body: Java 6 shipped with JAX-WS 2.0. Java 5 didn't ship with JAX-WS as far as I know. I was able to use JAX-WS 2.2.5 with Java 1.6 for creating Webservice client stubs by using the Java Endorsed Override Mechansim which lists JAX-WS as one of the components which can be replaced in Java 6. All I had to do was create a lib\endorsed directory in my JDK &amp; JRE 6 paths &amp; then copy jaxb-api.jar &amp; jaxws-api.jar from JAX-WS 2.2.5 into the directory named endorsed. And both JDK &amp; JRE 6 picked up the 2.2.5 JAX-WS automatically. I could not find similar Java Endorsed Override Mechanism in the Java 5 documents. How I found one here. This doesn't explicty mention JAX-WS like the Java 6 documents, but it also mentions the endorsed dirs. I created a similar 'endorsed' directory in both the JDK &amp; JRE lib directory. I copied all the jars from JAX-WS 2.2.5 (a total of 23 jars) into the endorsed directory. However, unlike Java 6, neither javac.exe nor java.exe picked this up directly. I had to run both java.exe and javac.exe with this command line argument -Djava.endorsed.dirs=&lt;JDK/JRE1.5_DIR&gt;\lib\endorsed Everything seems to work fine, but I am wondering if this is guaranteed to work - any problems anyone has faced before? Does JAX-WS 2.2.5 support Java 5?
score: 8
tagged with: java-5

http://stackoverflow.com/comment/42873725
score: 7
comment on: http://stackoverflow.com/q/27194138
type: Comment
type: QuestionComment
has text: Doesn't `y/count` change with each loop?

http://stackoverflow.com/q/27262801
has answer: http://stackoverflow.com/a/27262816
linked to: http://stackoverflow.com/q/26297180
type: Question
has title: How do I get these values to display as the output instead of "0.0"?
upvote count: 0
answer count: 1
favorite count: 0
has body: So When I run this it gives me the grosspay but its just 0.0 when I do it... and I need to know how to get it to show the actual output. import javax.swing.JOptionPane; public class Payroll_demo { public static void main(String[] args) { String input; Payroll A = new Payroll(); input = JOptionPane.showInputDialog(null, "What is your name?"); A.setName(input); input = JOptionPane.showInputDialog(null, "What is your ID number?"); int input_b = Integer.parseInt(input); A.setID(input_b); input = JOptionPane.showInputDialog(null, "What is your hourly pay rate?"); A.setPayRate(input); input = JOptionPane.showInputDialog(null, "How many hours did you work?"); A.setHours(input); JOptionPane.showMessageDialog(null, A.Gross()); } } I think it may be a constructor problem but I honestly have no clue. I feel as if ive tried just about everything but there has to be something... public class Payroll { private String name; private int ID; private double payrate; private double hours; private double grosspay; public void setName(String nam) { String Name = nam; } public void setID(int id) { int ID = id; } public void setPayRate(String pay) { double PayRate = Double.parseDouble(pay); } public void setHours(String hou) { double Hours = Double.parseDouble(hou); } public String getName() { return name; } public int getID() { return ID; } public double getPayRate() { return payrate; } public double getHours() { return hours; } public double Gross() { double Gross = hours * payrate; grosspay = Gross; return grosspay; } }
duplicate of: http://stackoverflow.com/q/26297180
has comment: http://stackoverflow.com/comment/42998104
tagged with: constructor
has comment: http://stackoverflow.com/comment/42998100
type: UnansweredQuestion
downvote count: 1
tagged with: mutators
tagged with: java
score: -1

http://stackoverflow.com/a/27275474
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/27275272
upvote count: 1
has body: It is possible of course. But you need to know what encoding those files are in. Quick solution using the shell, provided this is a Unix system (if Windows, well, install cygwin): find thedir -type f -exec perl -pi -e 's,\t, ,g' {} \; Done. With Java, well, I do hope you are using Java 7+. If yes this is quite easy: use Files.walkFileTree(), collect all regular files into a List for instance, and when you have that, perform substitution on each file in the list. DO NOT do this in the FileVisitor itself, you might get a DirectoryIteratorException. Links which can help: SimpleFileVisitor; Files.walkFileTree(); Files.newBufferedReader(); Files.newBufferedWriter(). Also, and very importantly, DO NOT MODIFY THE FILES INLINE. This will not work. Create a temporary file, write the new contents in it, then rename to the original.

http://stackoverflow.com/comment/42967684
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27246062
has text: can i dont use executor service? I dont think i am allowed to. i know i am almost there but now the issue is my worker thread wont keep loop to take out from workqueue. Btw thanks for ur help
type: AnswerComment

http://stackoverflow.com/a/27260536
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27260401
has body: Use explicit paths to your class files and don't forget the pre-requisite within the rule (the class depends on the Java source): FOLDER=some/path jar: $(FOLDER)/bin/a/A.class $(FOLDER)/bin/b/B.class jar cf output.jar $(FOLDER)/bin/a/A.class $(FOLDER)/bin/b/B.class $(FOLDER)/bin/a/A.class: $(FOLDER)/a/A.java javac $(FOLDER)/a/A.java -d $(FOLDER)/bin -implicit:none $(FOLDER)/bin/b/B.class: $(FOLDER)/b/B.java javac $(FOLDER)/b/B.java -d $(FOLDER)/bin -implicit:none-implicit:none
has comment: http://stackoverflow.com/comment/42994385
answers question: http://stackoverflow.com/q/27260401
type: Answer
has comment: http://stackoverflow.com/comment/42994563
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/29844079
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27295431
type: AcceptedAnswer
downvote count: 0
has body: In my case this below code works. By applying the charset to the string you will get the desired output. request.setAttribute("subject", new String("Test Subject".getBytes(), "UTF-8"));
answers question: http://stackoverflow.com/q/27295431
type: Answer
score: 3

http://stackoverflow.com/q/27190849
has body: Here's my current setup... I have several tabs (Using CTabFolder and CTabItems) each with its own ScrolledComposite. I was able get the first tab working with the answer from https://stackoverflow.com/a/23882007/4288015 but this does not work when applied to the other ScrolledComposite on the second tab. The second tab doesn't recognize the mouse wheel even with the MouseWheel listeners removed from both ScrolledComposites. What might be the issue causing the first tabs ScrolledComposite to work but not the second one?
tagged with: scrolledcomposite
tagged with: mousewheel
has comment: http://stackoverflow.com/comment/42869756
tagged with: java
tagged with: ctabitem
has answer: http://stackoverflow.com/a/27193603
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42869525
score: 0
linked to: http://stackoverflow.com/q/23881144
type: UnansweredQuestion
tagged with: swt
has title: Why is only 1 of my ScrolledComposites scrolling with the mouse wheel?

http://stackoverflow.com/a/27197314
answers question: http://stackoverflow.com/q/27197156
score: 1
upvote count: 2
type: AcceptedAnswer
has body: If it's known that every input is a single digit (and there are no spaces), then parsing the file is pretty simple: while(has more lines){ nextLine = read line for each char c in nextLine parse character into digit or operation } In Java, you can do that with a Scanner or a BufferedReader. Scanner has a Scanner.hasNextLine() method. In the case of BufferedReader, you would do something like: final BufferedReader br = new BufferedReader(new FileReader(fileName)); while((nextLine = br.readLine()) != null){ ... } (see BufferedReader.readLine()) There are several ways to parse the characters into your symbols. For getting the digit, first test to make sure it is a digit: boolean isDigit(final char c){ return c &gt;= '0' &amp;&amp; c &lt;= '9'; } If it is a digit, then find its value: int getDigit(final char digit){ return digit - '0'; } Otherwise, if it's an operation, then you need to use a switch statement to figure out what operation it is: int getOp(final char c){ switch(c){ case OP1_CHAR : return OP1_CODE; case OP2_CHAR : return OP2_CODE; ... default: throw new RuntimeException(c + " is an unknown operation"); } } Since an operation causes you to pop from your stack, you don't really need to this intermediate step of assigning on OP_CODE rather you can just switch on your OP_CHAR and then do the required operation...something like: void doOp(final char op){ switch(c){ case OP1_CHAR : perform operation 1 which probably requires popping from the stack, doing some operation, and pushing back onto the stack break; // or return; case OP2_CHAR : perform operation 2 break; ... default: throw new RuntimeException(op + " is an unknown operation"); } }
has comment: http://stackoverflow.com/comment/42879559
has comment: http://stackoverflow.com/comment/42880184
downvote count: 1
has comment: http://stackoverflow.com/comment/42879920
type: Answer
accepted answer of: http://stackoverflow.com/q/27197156
has comment: http://stackoverflow.com/comment/42879880

finalize
type: Tag
tags question: http://stackoverflow.com/q/27270777
tag name: finalize

http://stackoverflow.com/q/27161133
score: 0
has comment: http://stackoverflow.com/comment/42815888
answer count: 1
has title: How do I validate erate to two decimal places?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27161225
has comment: http://stackoverflow.com/comment/42815968
tagged with: java
type: Question
has body: When I try to use the validation methods for erate it always comes up as invalid, how do I fix the validation method using the code I used inside the method. input = JOptionPane.showInputDialog("Enter employee hourly rate: "); while(checkEname(input) == false) { input = JOptionPane.showInputDialog("Invalid! Only rate of two decimal places allowed! Re-enter employee hourly rate "); }//end while erate = Double.parseDouble(input); This is the validation methods called boolean checkErate(String input) { int dotCount = 0; for(int i = 0; i &lt; input.length(); i++) if(input.charAt(i) == '.') dotCount++; else if(!Character.isDigit(input.charAt(i))) return false; if(dotCount !=1 ) return false; else if(input.charAt(input.length() - 3) == '.') return true; else return false; }//end checkErate

http://stackoverflow.com/comment/42849485
comment on: http://stackoverflow.com/q/27177772
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [get month from a date - java](http://stackoverflow.com/questions/19036033/get-month-from-a-date-java)

http://stackoverflow.com/a/27278484
score: 0
has comment: http://stackoverflow.com/comment/43025976
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27278394
type: Answer
accepted answer of: http://stackoverflow.com/q/27278394
has body: You would need to do something like dbAdapter = new DatabaseAdapter() before calling dbAdapter.open(); Null pointer exceptions usually occur when you try to use a reference(dbAdapter in this case) that points to nothing in the memory, i.e. you haven't yet create anything for the reference to point to.
has comment: http://stackoverflow.com/comment/43029362
has comment: http://stackoverflow.com/comment/43026120
has comment: http://stackoverflow.com/comment/43026458
has comment: http://stackoverflow.com/comment/43026199
has comment: http://stackoverflow.com/comment/43026491
has comment: http://stackoverflow.com/comment/43026895

http://stackoverflow.com/q/27307844
accepted answer: http://stackoverflow.com/a/27322093
downvote count: 0
score: 1
has title: Mule error --2 . Failed to invoke method. Message payload is of type string
type: Question
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/27322093
tagged with: mule-component
has body: I have a mule flow that invokes a method and sets the return value in the payload . Here's the part of my flow that does it &lt;flow name="PositiveFlow1" doc:name="PositiveFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="9293" doc:name="HTTP"/&gt; &lt;invoke object-ref="TestUtils1" method="getSignedClaimWrapper" doc:name="Invoke"/&gt; &lt;set-session-variable variableName="clientcontext" value="#[payload]" doc:name="Session Variable"/&gt; &lt;flow-ref name="_subflow1" doc:name="Flow Reference"/&gt; &lt;/flow&gt; getSignedClaimWrapper returns a Base64 encoded string . Here's my stack trace. Message : Failed to invoke com.test.TestUtils@2cfe109a. Message payload is of type: String Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString([B)Ljava/lang/String; (java.lang.NoSuchMethodError) com.nimbusds.jose.util.Base64URL:64 (null) 2. Failed to invoke com.test.TestUtils@2cfe109a. Message payload is of type: String (org.mule.api.MessagingException) org.mule.processor.InvokerMessageProcessor:178 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString([B)Ljava/lang/String; at com.nimbusds.jose.util.Base64URL.encode(Base64URL.java:64) at com.nimbusds.jose.util.Base64URL.encode(Base64URL.java:91) at com.nimbusds.jose.Header.toBase64URL(Header.java:238) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** I'm guessing this is because Mule has a limitation on handling Base64 Strings. As the test cases for the TestUtils class seem to work perfectly fine on …
upvote count: 1
has comment: http://stackoverflow.com/comment/43083437
answer count: 1
tagged with: mule-el
tagged with: java
tagged with: mule

http://stackoverflow.com/q/27271397
has title: ServiceBusConfiguration.configureWithConnectionString can't work, error "The key 'SharedAccessKeyName' is not valid for this connection string"
tagged with: azure
has answer: http://stackoverflow.com/a/27303221
favorite count: 0
possible better answer: http://stackoverflow.com/a/51566200
type: AnsweredQuestion
score: 2
tagged with: java
has body: I'm using newest Azure java sdk(version 0.6), but I found I have problems when I use service bus configuration "configureWithConnectionString" function. Here is my code below, //get config string connectionString = "Endpoint=sb://testservicebusnamespace.servicebus.windows.net/;SharedAccessKeyName=MySharedAccessKey;SharedAccessKey=&lt;this is secret not show&gt;"; config = new Configuration(); ServiceBusConfiguration.configureWithConnectionString(null, config, connectionString); //create service service = ServiceBusService.create(config); And I get connection String from my service bus namespace portal in Azure. But When I run this code, it throws an exception "The key 'SharedAccessKeyName' is not valid for this connection string". I don't know what's the problem, because I get the connection from Azure portal, and I've checked its content(the SharedAccessKeyName, SharedAccessKey), they are right. So could anyone help me? Is it my problem or this SDK needs update(because I've heard portal already uses SAS, but SDK still uses ACS to authenticate)? Thanks very much.
type: Question
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/27303221
downvote count: 0
tagged with: servicebus
has answer: http://stackoverflow.com/a/51566200
tagged with: sdk

http://stackoverflow.com/a/27156678
has body: totalDiscount =numberOfBags * pricePerBag *discount; totalCost = numberOfBags * pricePerBag; finalTotal =totalCost - discount; Unless it's a typo I believe you only need to change discount in the totalCost to totalDiscount.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27156589

http://stackoverflow.com/q/27237174
downvote count: 0
tagged with: restlet
has answer: http://stackoverflow.com/a/27266913
has comment: http://stackoverflow.com/comment/42986350
tagged with: wicket
favorite count: 0
score: 2
has body: I am developing a web application with two major division, one is the Wicket side of the application and the Restlet side of the application which are quite decoupled. Although the code resides in the same project, I want to decouple it, so the Wicket part calls on the REST services exposed by the Restlet backend. Now the issue is with the Session, in the Restlet part, there is a Shiro component which does the authentication et. al. when /login is accessed and the correct username &amp; password pair is supplied. The question is, what is the approach such that Wicket part of the app would know about the session user currently logged-in in the Restlet part with Shiro?
possible better answer: http://stackoverflow.com/a/27267330
upvote count: 2
has answer: http://stackoverflow.com/a/27267330
accepted answer: http://stackoverflow.com/a/27266913
has title: Accessing User session from backend
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42973479
tagged with: java
type: Question
answer count: 2
tagged with: shiro

http://stackoverflow.com/q/27221784
has title: Adding a filter to check if a session is valid or not
tagged with: servlets
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has body: Im adding a filter to check if a session is valid or not. Added the following but get the error public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException { if (request.getRequestedSessionId() != null &amp;&amp; !request.isRequestedSessionIdValid()) { Error:- The method getRequestedSessionId() is undefined for the type ServletRequest
tagged with: spring
score: 2
accepted answer: http://stackoverflow.com/a/27221809
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27221809
tagged with: java

http://stackoverflow.com/q/27278109
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: spring
has title: Spring Batch Multiple Threads
tagged with: java
type: Question
upvote count: 2
answer count: 1
has body: I am writing a Spring Batch with idea of scaling it when required. My ApplicationContext looks like this @Configuration @EnableBatchProcessing @EnableTransactionManagement @ComponentScan(basePackages = "in.springbatch") @PropertySource(value = {"classpath:springbatch.properties"}) public class ApplicationConfig { @Autowired Environment environment; @Autowired private JobBuilderFactory jobs; @Autowired private StepBuilderFactory stepBuilderFactory; @Bean public Job job() throws Exception { return jobs.get("spring_batch") .flow(step()).end() .build(); } @Bean(name = "dataSource", destroyMethod = "close") public DataSource dataSource() { BasicDataSource basicDataSource = new BasicDataSource(); return basicDataSource; } @Bean public JobRepository jobRepository() throws Exception { JobRepositoryFactoryBean jobRepositoryFactoryBean = new JobRepositoryFactoryBean(); jobRepositoryFactoryBean.setTransactionManager(transactionManager()); jobRepositoryFactoryBean.setDataSource(dataSource()); return jobRepositoryFactoryBean.getObject(); } @Bean(name = "batchstep") public Step step() throws Exception { return stepBuilderFactory.get("batchstep").allowStartIfComplete(true). transactionManager(transactionManager()). chunk(2).reader(batchReader()).processor(processor()).writer(writer()).build(); } @Bean ItemReader batchReader() throws Exception { System.out.println(Thread.currentThread().getName()+"reader"); HibernateCursorItemReader&lt;Source&gt; hibernateCursorItemReader = new HibernateCursorItemReader&lt;&gt;(); hibernateCursorItemReader.setQueryString("from Source"); hibernateCursorItemReader.setFetchSize(2); hibernateCursorItemReader.setSessionFactory(sessionFactory().getObject()); hibernateCursorItemReader.close(); return hibernateCursorItemReader; } @Bean public ItemProcessor processor() { return new BatchProcessor(); } @Bean public ItemWriter writer() { return new BatchWriter(); } public TaskExecutor taskExecutor(){ SimpleAsyncTaskExecutor asyncTaskExecutor=new SimpleAsyncTa…
tagged with: spring-batch
has answer: http://stackoverflow.com/a/27279497
favorite count: 0

http://stackoverflow.com/comment/42994671
type: QuestionComment
score: 0
has text: can you post reproducible code ?
comment on: http://stackoverflow.com/q/27259893
type: Comment

http://stackoverflow.com/a/27253414
type: Answer
accepted answer of: http://stackoverflow.com/q/27250541
score: 3
downvote count: 0
upvote count: 3
has body: It's a header field used for transport-layer control, so yes, the engine will set it accordingly. The behavior you're asking for is pretty non-standard. If you want to catch it and override it, your only options are to use toApp or hack the engine's source.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27250541

http://stackoverflow.com/comment/43058185
type: Comment
type: QuestionComment
has text: yes i need get from attachment always "photo_75 and "photo_604
score: 0
comment on: http://stackoverflow.com/q/27296050

http://stackoverflow.com/q/27157852
favorite count: 0
has body: I'm creating a game that will mainly run on browser thanks to GWT HTML5 deployment. I have quite a few MB of assets between images and sounds. Obviously I don't need them all at all times. I'd like to load them depending on the screen that's coming next and other parameters. That is specially critical because my main deployment will be on web (can't load all 50MB when starting just in case they will be used). I don't really know how asset loading works on LibGDX on HTML5 really. I'd like to use the AssetManager or something similar to load my TextureAtlases and Sounds but I think HTML5 deployment just loads everything in the beginning regardless if I later use the AssetManager in the core project. What would be a correct asset loading pipeline with libGDX and GWT. It would be awesome to load all from the core project because that way would be multiplatform for the future but it is not critical now so the important part is to load assets wisely on the web. Thanks in advance.
tagged with: assets
type: AnsweredQuestion
has title: Good practice loading assets LibGDX HTML (GWT)
score: 1
tagged with: java
type: Question
tagged with: gwt
tagged with: libgdx
has answer: http://stackoverflow.com/a/27331712
accepted answer: http://stackoverflow.com/a/27331712
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42858343
comment on: http://stackoverflow.com/q/27185322
type: Comment
type: QuestionComment
has text: Generally spoken that much data is not suitable for a human processable document (too big, slow). Condense the data: do statistical analysis, curve fitting, deviation ranges.
score: 0

http://stackoverflow.com/q/27278078
answer count: 1
has comment: http://stackoverflow.com/comment/43025855
has title: JSON Parsing Runtime Error - Different Classes
accepted answer: http://stackoverflow.com/a/27279648
tagged with: extends
has comment: http://stackoverflow.com/comment/43025382
tagged with: android
linked to: http://stackoverflow.com/q/18479366
has comment: http://stackoverflow.com/comment/43025692
has comment: http://stackoverflow.com/comment/43025282
has comment: http://stackoverflow.com/comment/43025579
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43025740
tagged with: java
has comment: http://stackoverflow.com/comment/43025873
tagged with: http://stackoverflow.com/tag/json
has body: I have two classes one is called Main1843 and the other is JsonParse. When i copy everything in same class as main1843 everything works just fine. but i prefer having split classes and being tidy. The problem is i cant run the code below. No errors displayed, just app stops running. (Manifest file has permissions) Since it is a short program maybe you can examine each line. Main1843 class: public class Main1843 extends Activity implements View.OnClickListener { private Button button; private TextView tv; private EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main1843); tv = (TextView) findViewById(R.id.panel); et = (EditText) findViewById(R.id.editText1); button = (Button) findViewById(R.id.button1); button.setOnClickListener(this); } public void onClick(View v) { String text; text = et.getText().toString(); tv.append(text); tv.append("\n"); new JsonParse().execute(); } protected void putScreen(String t) { tv.append(t); } } And the other class(JsonParse) which extends AsyncTask&lt;> ; public class JsonParse extends AsyncTask{ private String yazi; protected String yazi2; protected String id; private String TAG = "JWP"; @Override protected Object doInBackground(Object[] objects) { return POST("http://somewebsite/show.php"); } public String POST(String url) { String result = ""; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); Main1843 m = new Main1843(); try { HttpResponse response = client.execute(post); InputStream inputStream = response.getEntity().getContent(); if (inputStream != null) { String text = ""; result = convertInputStreamToString(inputStream); Log.d(TAG, result); JSONArray reader = new JSONArray(result); for (int i = 0; i &lt; reader.length(); i++) { JSONObject data = reader.getJSONObject(i); id = data.getString("id"); yazi = data.getString("yazi"); yazi2 = data.getString("yazi2"); text += yazi; text += " "; } m.putScreen(text…
has comment: http://stackoverflow.com/comment/43027065
type: Question
has comment: http://stackoverflow.com/comment/43025615
has comment: http://stackoverflow.com/comment/43025560
has comment: http://stackoverflow.com/comment/43025514
has comment: http://stackoverflow.com/comment/43025909
score: 0
tagged with: http-post
has answer: http://stackoverflow.com/a/27279648

http://stackoverflow.com/q/27162134
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/42817905
tagged with: heap-memory
has answer: http://stackoverflow.com/a/27190244
has comment: http://stackoverflow.com/comment/42817879
has answer: http://stackoverflow.com/a/27162316
has title: How to find out code creating garbage objects
has comment: http://stackoverflow.com/comment/42817731
downvote count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/42817680
type: Question
has comment: http://stackoverflow.com/comment/42821291
score: 1
tagged with: java
answer count: 2
upvote count: 1
has body: Application is creating 3GB of garbage objects and this gets garbage collected. This process of creating garbage and it's subsequent collection repeats every 30 mins. I took heap dump and could identify Unreachable Objects but there is no way to identify code creating these UnReachable objects. Please let me know if there is a way to find out code responsible for this without buying Jprofiler / YourKit.

http://stackoverflow.com/a/27192397
has body: If by launching you mean double clicking it, no - nothing you can see will happen; you have to 'tell' Java to run your application with an associated console. To do this, you may create a new .bat file: Simply open a text editor and insert the following line: java -jar NAME.jar where "NAME" is the name of your application. Save the text file in .bat format, not in .txt, and place it in the same directory as your application. You can launch your application by double-clicking that file. The reason it does not pop up in your task manager is because probably (I cannot know) your application only prints out a simple message and does nothing more. In non-console mode, it will just call your print (println or any other console) method without having any visual effect as there is no console to print the message to. In both cases however, if you only print something and do not perform other operations that 'last', such as listening for input, your programm will terminate as it has reached the end of the main method.
answers question: http://stackoverflow.com/q/27192240
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/43025360
score: 0
type: Comment
type: QuestionComment
has text: > Can you add more info about your EntitiyManager scope? What do you mean by EntityManager scope? How do you handle open and close of EM context? --- Right now we are using guice-persist's @Transactional annotation but as I learned that it is not maintained anymore we are probably going to switch to onami-persist.
comment on: http://stackoverflow.com/q/27271886

http://stackoverflow.com/a/27302059
has body: Apart from the resources problem (which certainly explains why you can't delete), the problem is that you won't know why the deletion fails -- in fact, with File you have no means to know at all. Here is the equivalent program written with java.nio.file, with resource management: public final class Duplicates { private Duplicates() { throw new Error("nice try!"); } private static boolean duplicate(final Path path1, final Path path2) throws IOException { if (Files.isSameFile(path1, path2)) return true; final BasicFileAttributeView view1 = Files.getFileAttributeView(path1, BasicFileAttributeView.class); final BasicFileAttributeView view2 = Files.getFileAttributeView(path2, BasicFileAttributeView.class); final long size1 = view1.readAttributes().size(); final long size2 = view2.readAttributes().size(); if (size1 != size2) return false; try ( final FileChannel channel1 = FileChannel.open(path1, StandardOpenOption.READ); final FileChannel channel2 = FileChannel.open(path2, StandardOpenOption.READ); ) { final ByteBuffer buf1 = channel1.map(FileChannel.MapMode.READ_ONLY, 0L, size1); final ByteBuffer buf2 = channel2.map(FileChannel.MapMode.READ_ONLY, 0L, size1); // Yes, this works; see javadoc for ByteBuffer.equals() return buf1.equals(buf2); } } public static void main(final String... args) throws IOException { final Path dir = Paths.get(System.getProperty("user.dir")); final List&lt;Path&gt; list = new ArrayList&lt;&gt;(); for (final Path entry: Files.newDirectoryStream(dir)) if (Files.isRegularFile(entry)) list.add(entry); final int size = list.size(); for (int i = 0; i &lt; size; i++) for (int j = i + 1; j &lt; size; j++) try { if (duplicate(list.get(i), list.get(j))) Files.deleteIfExists(list.get(j)); } catch (IOException e) { System.out.printf("Aiie... Failed to delete %s\nCause:\n%s\n", list.get(j), e); } } } Note: a better strategy would probably be to create a directory in which you will move all duplicates you detect; when done, just delete all files in this direc…
answers question: http://stackoverflow.com/q/27301611
type: Answer
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/27230948
type: Answer
accepted answer of: http://stackoverflow.com/q/27230878
has body: Just take out the square brackets then use the string split method, giving ',' as a delimiter. String str = "[111111,111111,111111,111111,111111,111111,111111]" //remove the brackets //as backslash mentioned, str.substring is a better approach than using str.replaceAll with regex str = str.substring(1, str.length()-1); //split the string into an array String[] strArray = str.split(",");
answers question: http://stackoverflow.com/q/27230878
upvote count: 4
has comment: http://stackoverflow.com/comment/42938806
has comment: http://stackoverflow.com/comment/42938950
has comment: http://stackoverflow.com/comment/42938737
has comment: http://stackoverflow.com/comment/42938914
downvote count: 0
has comment: http://stackoverflow.com/comment/42938784
score: 4
has comment: http://stackoverflow.com/comment/42938904
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42938863

http://stackoverflow.com/q/27226351
has answer: http://stackoverflow.com/a/27226395
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/42930346
tagged with: typeface
tagged with: fonts
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/23353173
has body: I tried to display "hello world !" by designing an app using a custom font stored in src/Main/CustomF/times.ttf in my laptop.....while execution it disappears very soon telling that "unfortunately your app stopped"....my coding is as below.....please help me.. package com.example.nambimanavalan.customfonts; import android.app.Activity; import android.graphics.Typeface; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class MainActivity extends Activity { TextView t; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); t=(TextView)findViewById(R.id.mine); Typeface custom=Typeface.createFromAsset(getAssets(),"CustomF/times.ttf"); t.setTypeface(custom); } }
downvote count: 3
has title: Unfortunately my app stopped working?
linked to: http://stackoverflow.com/q/23353173
has answer: http://stackoverflow.com/a/27226396
has comment: http://stackoverflow.com/comment/42930400
tagged with: java
has comment: http://stackoverflow.com/comment/42930382
type: Question
answer count: 2
upvote count: 0
tagged with: textview
favorite count: 0

http://stackoverflow.com/q/27197191
tagged with: python
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42879325
tagged with: return
has comment: http://stackoverflow.com/comment/42879235
tagged with: methods
tagged with: conventions
type: Question
possible better answer: http://stackoverflow.com/a/27197697
tagged with: java
score: 4
has body: I have been writing both Java and Python code for some time now. I have noticed, many times, that objects in both languages often have seemingly inconsistent ways to call their methods. Take these Python code snippets for example. (The syntax is not important, just note the way the methods work with the data) class Foo(object): def __init__(self, num = 0): self.num = num def __str__(self): return str(self.num) def addOne(self): self.num += 1 if __name__ == "__main__": foo = Foo() print(foo) # Outputs 0 foo.addOne() print(foo) # Outputs 1 Versus: class Bar(object): def __init__(self, num = 0): self.num = num def __str__(self): return str(num) def addOne(self): return Bar(num + 1) if __name__ == "__main__": bar = Bar() print(bar) # Outputs 0 bar.addOne() print(bar) # Still Outputs 0 bar = bar.addOne() print(bar) # Now Outputs 1 Both of these examples are very similar, but the Foo class, when you call Foo.addOne(), changes the num variable inside of the class. The Bar class, however, its addOne() method returns a new object with the num variable updated. Which situation is preferable at what times, what do people expect, and does this differ much in between languages?
has comment: http://stackoverflow.com/comment/42879366
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27197269
accepted answer: http://stackoverflow.com/a/27197269
favorite count: 0
has title: Convention: when writing methods, should I return values, or change data directly?
has answer: http://stackoverflow.com/a/27197697

http://stackoverflow.com/comment/42957574
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27240231
has text: What shell or terminal program are you running this from, and how are you producing the output? In the regular Windows command prompt, the backslash isn't special, and doesn't need escaping. Though using the quotes is good practice anyway, in case there are spaces or other special characters in the file name. Those backslashes may be disappearing at an unexpected point, like `printf` processing inside your program. Can you include your code?
score: 0

http://stackoverflow.com/comment/42855450
score: 0
type: AnswerComment
has text: Hello Alexandre, I tried using SolrJ to get the values from servlet which retrieves from JSP but when I try using SolrJ functionalities like HttpSolrServer or SolrInputDocument, I get some error during the execution. Can you help me with that? Also I ma testing my JSP and servlet code using Apache Tomcat which stops and gives some error during its execution while integrating with SolrJ.
type: Comment
comment on: http://stackoverflow.com/a/27162450

http://stackoverflow.com/comment/42859893
has text: Hope this helps,I should have just given you the setOpaque method but i thought you wanted some semi transparent thing which you can achieve with the class i gave you :)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27186412

http://stackoverflow.com/comment/42826681
has text: @No Idea For Name OP said the fields came form a DB. So each time you add (or remove btw) a field, you have to edit the code. Also, `params` is not Java, nor `foreach` :)
type: AnswerComment
comment on: http://stackoverflow.com/a/27167370
score: 0
type: Comment

http://stackoverflow.com/q/27260268
type: Question
has answer: http://stackoverflow.com/a/27260286
score: 0
has body: I am trying to get a percentage from an array value in a for-loop. System.out.println(playerName[i+1] + " got " + playerScore[i] + " questions right out of " + question.length + "!\n"); double playerScorePercentage = (playerScore[i] / question.length) * 100; System.out.println("Which is " + playerScorePercentage + "%!"); What am I doing wrong? The playerScoredisplays a value but when I am trying to do a calculation with it below, it displays 0.0 no matter what. An example run: John got 3 questions right out of 10! Which is 0.0%!
answer count: 1
accepted answer: http://stackoverflow.com/a/27260286
tagged with: java
type: AnsweredQuestion
tagged with: arrays
has title: How to get a percentage from an array value

http://stackoverflow.com/comment/42985748
comment on: http://stackoverflow.com/a/27255638
score: 0
type: AnswerComment
type: Comment
has text: @Xavier Delamotte I have no idea what your talking about, but in any case, your code elicits a change to the button only after a second click and not upon a first. My code elicits a change after the first click, but produces no toggling functionality.

http://stackoverflow.com/a/27167390
has body: You can try adding this at the top: &lt;%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%&gt; I think this will solve the problem. If not, could you give us more information? Are you using eclipse? If yes, are you developing under windows? In windows, eclipse by default works with WINDOWS CP1252 codification for jsp and other files. Probably the text written can be CP1252 charset. Where are running tomcat and glashfish? Windows? Linux?
score: 2
has comment: http://stackoverflow.com/comment/42826749
downvote count: 0
answers question: http://stackoverflow.com/q/27167099
upvote count: 2
type: Answer

http://stackoverflow.com/q/27243653
tagged with: java
downvote count: 1
type: Question
has title: Operand Missing Variable
score: -1
has answer: http://stackoverflow.com/a/27243665
answer count: 2
upvote count: 0
has body: int curFreeFrame = FrameTableEntry numFreeFrames(); The error states this "error ';' expected". Everything is initialized correctly in the methods.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27243778
tagged with: oop

http://stackoverflow.com/q/27222227
tagged with: java
has title: Get dynamic text from readonly textbox using Selenium
has body: I have a text box which contains hours represented from 1 to 24. Hours are incremented and decremented when we click on Up Arrow and Down Arrows(Hyperlinka) above and below the textboxes. Here is the code for my textbox. &lt;input type="text" ng-model="hours" ng-change="updateHours()" class="form-control text-center ng-pristine ng-valid" ng-mousewheel="incrementHours()" ng-readonly="readonlyInput" maxlength="2" readonly="readonly"&gt; I have tried the below code. But no luck. findElement(By.xpath(properties.getProperty("Hours"))).getAttribute("ng-change"); Can any one help on this.
answer count: 1
downvote count: 0
tagged with: textbox
favorite count: 0
tagged with: selenium-webdriver
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/27222252
accepted answer: http://stackoverflow.com/a/27222252
tagged with: selenium
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42986777
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27243141
has text: Can you post the failures or better yet a sample project with the failures in a gist.

http://stackoverflow.com/comment/43050676
type: QuestionComment
has text: How exactly are you trying to access this resource. I can't reproduce the behavior you are experiencing
comment on: http://stackoverflow.com/q/27291209
score: 0
type: Comment

http://stackoverflow.com/comment/43045445
comment on: http://stackoverflow.com/a/27288646
type: AnswerComment
score: 0
has text: Thank you very much. I seems to get it to work but somehow the effect doesn't seems very consistent. Sometimes it blinks too fast and I have to adjust the delay() and the animation frame duration. I'm not sure now if addAction should be the appropriate way to do this but still thanks alot.
type: Comment

http://stackoverflow.com/comment/42811461
score: 0
type: AnswerComment
has text: @PashaTurok You cast from `Min` to `Max`, and then you assign it to the variable `server` which is a `Min` so you are again where you started.
type: Comment
comment on: http://stackoverflow.com/a/27158538

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/27257359
tags question: http://stackoverflow.com/q/27184164
tags question: http://stackoverflow.com/q/27272385
tags question: http://stackoverflow.com/q/27301473
tags question: http://stackoverflow.com/q/27216098
tags question: http://stackoverflow.com/q/27207797
tags question: http://stackoverflow.com/q/27168330
tags question: http://stackoverflow.com/q/27208568
tags question: http://stackoverflow.com/q/27254073
tags question: http://stackoverflow.com/q/27179372
tags question: http://stackoverflow.com/q/27248372
tags question: http://stackoverflow.com/q/27254152
tags question: http://stackoverflow.com/q/27215226
tags question: http://stackoverflow.com/q/27179376
type: Tag
tags question: http://stackoverflow.com/q/27218688
tags question: http://stackoverflow.com/q/27292881
tags question: http://stackoverflow.com/q/27269844
tags question: http://stackoverflow.com/q/27289638
tags question: http://stackoverflow.com/q/27222646

http://stackoverflow.com/comment/42930945
has text: Exactly. Also if you change it to `<s:property value="%{name}"/>`.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27225968
type: Comment

http://stackoverflow.com/q/27257185
tagged with: diff
tagged with: cobertura
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
favorite count: 0
has body: I have a cobertura report for unit tests and another cobertura report for integration tests. I would like to get the difference between the 2 (more specifically, I would like to know what integration tests are not covered by my unit tests). Is there a way to get the diff between two cobertura reports?
type: UnansweredQuestion
has title: Get the difference between 2 cobertura reports

http://stackoverflow.com/a/27228679
score: 1
has comment: http://stackoverflow.com/comment/42948676
downvote count: 0
has body: There are several problems with Derby on Android including the absence of the naming support. See the 08/jan/2010 comment on https://issues.apache.org/jira/browse/DERBY-4458
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27225187

http://stackoverflow.com/comment/42832664
type: Comment
has text: Yes exactly. 9 gives a 3 * 3 array. In the second example [8, 6, 6] it gives a 3 * 2 array.
score: 0
comment on: http://stackoverflow.com/q/27170738
type: QuestionComment

http://stackoverflow.com/a/27210452
has comment: http://stackoverflow.com/comment/74130802
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27209596
type: Answer
accepted answer of: http://stackoverflow.com/q/27209596
has comment: http://stackoverflow.com/comment/59915375
has body: You no longer use MediaController.fromToken, but instead MediaSessin.getController. And you no longer use MediaSessionManager.createSession, but instead just create a new MediaSession object and MediaSession.getSessionToken to retrieve your MediaSession.Token. A very basic example implementation might be something like: private static final String ACTION_TOGGLE_PLAYBACK = "com.your.package.name.TOGGLE_PLAYBACK"; private static final String ACTION_PREV = "com.your.package.name.PREV"; private static final String ACTION_NEXT = "com.your.package.name.NEXT"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... final Bitmap artwork = ...; // Create a new MediaSession final MediaSession mediaSession = new MediaSession(this, "debug tag"); // Update the current metadata mediaSession.setMetadata(new MediaMetadata.Builder() .putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, artwork) .putString(MediaMetadata.METADATA_KEY_ARTIST, "Pink Floyd") .putString(MediaMetadata.METADATA_KEY_ALBUM, "Dark Side of the Moon") .putString(MediaMetadata.METADATA_KEY_TITLE, "The Great Gig in the Sky") .build()); // Indicate you're ready to receive media commands mediaSession.setActive(true); // Attach a new Callback to receive MediaSession updates mediaSession.setCallback(new MediaSession.Callback() { // Implement your callbacks }); // Indicate you want to receive transport controls via your Callback mediaSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS); // Create a new Notification final Notification noti = new Notification.Builder(this) // Hide the timestamp .setShowWhen(false) // Set the Notification style .setStyle(new Notification.MediaStyle() // Attach our MediaSession token .setMediaSession(mediaSession.getSessionToken()) // Show our playback controls in the compat view .setShowActionsInCompactView(0, 1, 2)) // Set the Notification color .setColor(0xFFDB4437) // Set the large and small icons .setLargeIcon(artwork) .setSmallIcon(…
score: 18
upvote count: 18
has comment: http://stackoverflow.com/comment/74128737

http://stackoverflow.com/comment/42866908
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27189815
has text: @JabirAlFatah no problem :) it is a better solution!
type: AnswerComment

http://stackoverflow.com/a/27259841
score: 1
upvote count: 1
has body: Can you make your parent spring-boot-starter-parent? org.springframework.boot spring-boot-starter-parent 1.1.9.RELEASE Also you should make spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-tomcat provided If you link your whole POM or effective POM that may help
has comment: http://stackoverflow.com/comment/42994212
has comment: http://stackoverflow.com/comment/42993374
answers question: http://stackoverflow.com/q/27256904
downvote count: 0
has comment: http://stackoverflow.com/comment/43007107
type: Answer
has comment: http://stackoverflow.com/comment/43011622

http://stackoverflow.com/comment/43026080
has text: show us the structure of table.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27277515

http://stackoverflow.com/comment/43046418
has text: intLists must return ArrayList, becouse it is Array of ArrayList objects
type: AnswerComment
comment on: http://stackoverflow.com/a/27289988
score: 0
type: Comment

http://stackoverflow.com/comment/43046173
has text: May be you are missing a class called 'R'?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27289927

http://stackoverflow.com/comment/43000120
comment on: http://stackoverflow.com/q/27227348
score: 0
type: Comment
has text: yes MatsLindh.exactly. Is it possible with solr query rather than writing any java codes??? I have didi this using java but it gets slow during indexing after adding that jar. am new to solr. plz help me out
type: QuestionComment

http://stackoverflow.com/comment/42992183
has text: please do. I thought that the other way around would be check_vertical.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27259359

http://stackoverflow.com/a/27279143
accepted answer of: http://stackoverflow.com/q/27279025
answers question: http://stackoverflow.com/q/27279025
has comment: http://stackoverflow.com/comment/43027413
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43027276
has comment: http://stackoverflow.com/comment/43061302
type: Answer
has comment: http://stackoverflow.com/comment/43028165
has body: Looks like you got a null pointer, before your test do List&lt;Entry&gt; entries = main.cSearchFirst("Ben");//check for null here, and size Entry e = entries.get(0); //again check null here, examine properties in debugger String s = e.getfName(); Slap a debugger on there and walk through seeing where null is being thrown. edit: I'd also recommend doing a checks for nulls around there if you are expecting null, else try/catch null exceptions and fail the test.
has comment: http://stackoverflow.com/comment/43027501
has comment: http://stackoverflow.com/comment/43028242
has comment: http://stackoverflow.com/comment/43027439
has comment: http://stackoverflow.com/comment/43027155

http://stackoverflow.com/a/27157267
score: 8
downvote count: 0
answers question: http://stackoverflow.com/q/27157206
has comment: http://stackoverflow.com/comment/42808815
upvote count: 8
has comment: http://stackoverflow.com/comment/42808767
has body: Failing fast is generally a good idea: if an index of -1 is passed to that method, it probably means that there is a bug in the code calling the method. If you silently use index = 0 instead, (a) the calling code may not receive the expected result and (b) you may not notice the bug until it has become quite a mess to fix. So I would simply use: public Attribute getAttribute (int index) { return attributes.get(index); } which will throw an exception if required. If the code calling this method is bug free, that exception should never be thrown.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42808714
type: Answer
has comment: http://stackoverflow.com/comment/42808915
accepted answer of: http://stackoverflow.com/q/27157206

http://stackoverflow.com/a/27353495
answers question: http://stackoverflow.com/q/27273775
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27273775
has body: I solved this problem, Actuallly there is a problem in my schema. I have given name to my complex type and refered element type with that name which incorrect. You should do this like below &lt;xsd:element name="myRequest"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="cardNumber" type="xsd:long" /&gt; &lt;xsd:element name="transactionNumber" type="xsd:long" /&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt;
type: Answer
score: 1

http://stackoverflow.com/comment/42921858
type: Comment
has text: I read the docs, thanks. I'm asking what it would be used for.
comment on: http://stackoverflow.com/a/27221543
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42814939
comment on: http://stackoverflow.com/a/27160588
type: Comment
has text: Thanks, its working perfectly, but i think you meant to do this: `frame1.getContentPane().add(zButton);` Sorry if the code doesnt shows has code, following the question, can i do this if i create, say zButton,xButton and so on ? I mean, dont they interfere with each other ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42822947
comment on: http://stackoverflow.com/q/27165360
score: 1
type: QuestionComment
has text: Your provided links are not hosted yet?
type: Comment

http://stackoverflow.com/a/27166412
score: 1
has body: You should start by working with doubles instead of integers. You can't expect to approximate a Real number using only integer calculations. For example, power(x,x) / factorial(x) would always return an integer, since both methods return an int.
answers question: http://stackoverflow.com/q/27166381
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42824108
score: 0
type: Comment
has text: @Liverpool what Elist said
type: AnswerComment
comment on: http://stackoverflow.com/a/27165645

http://stackoverflow.com/a/27277366
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27269848
has comment: http://stackoverflow.com/comment/43029097
has comment: http://stackoverflow.com/comment/43029397
has body: In the documentation https://developers.google.com/google-apps/contacts/v3/#retrieving_all_contacts there is a note saying "The feed may not contain all of the user's contacts, because there's a default limit on the number of results returned" You can use query parameter to manage the information https://developers.google.com/google-apps/contacts/v3/#retrieving_contacts_using_query_parameters. Here you can find the parameters for these requests https://developers.google.com/google-apps/contacts/v3/reference#Parameters. The parameter max-results is probably the one you need.
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/27197277
tagged with: substring
has answer: http://stackoverflow.com/a/27198213
downvote count: 0
tagged with: string
favorite count: 0
answer count: 3
has title: searching input with substrings
has comment: http://stackoverflow.com/comment/42881122
has answer: http://stackoverflow.com/a/27197406
has body: I am trying to use substrings to calculate what the Roman numerals equal in arabic numbers, and I keep getting an index out of range error. Or, another way I had it, it would just read the second numeral and completely ignore the first. System.out.println("What is the number you want converted?"); Scanner scan = new Scanner(System.in); String Roman = scan.next(); int sum = 0; for (int x = 0; x&lt;Roman.length(); x++) { if (Roman.substring(x,(x+2)).equals("XC")) { sum= sum+90; } else if (Roman.substring(x,(x+1)).equals("IX")) { sum= sum+9; } else if (Roman.substring(x).equals("X")) { sum= sum+10; } else if (Roman.substring(x,(x+2)).equals("IV ")) { sum= sum+4; } else if (Roman.substring(x).equals("V")) { sum= sum+5; } else if (Roman.substring(x).equals("I")) { sum= sum+1; } else if (Roman.substring(x).equals("L")) { sum= sum+50; } else if(Roman.substring(x).equals("C")) { sum= sum+100; } } System.out.println(sum);
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27197412
type: Question
linked to: http://stackoverflow.com/q/9073150
score: 1
has comment: http://stackoverflow.com/comment/42879399
tagged with: java

http://stackoverflow.com/q/27208676
has comment: http://stackoverflow.com/comment/42899388
has comment: http://stackoverflow.com/comment/42899587
has comment: http://stackoverflow.com/comment/42899874
tagged with: java
linked to: http://stackoverflow.com/q/13536978
downvote count: 3
has body: As of right now I have a program that randomly generates a line that goes in all possible directions and terminates when it hits the edge of the circle or square. Is it possible for me to have random lines that do NOT go diagonally? So it would essentially look like a game of snake and not random scribbles? I'll paste the entire code so you understand whats going on. import java.util.Scanner; import java.util.Random; import java.awt.*; public class ABP { private static final Scanner CONSOLE = new Scanner(System.in); public static void main(String args[]) { System.out.println("Lab 7 written by Devin Tuchsen"); int rad = promptIntWithRange("Please enter the circle's radius (50-400 pixels): ", 50, 400); boolean cont = true; Color color = null; while(cont) { String colorStr = promptString("Please enter the color of the circle (green [g] or blue [b]): "); if(matchesChoice(colorStr, "green")) { color = Color.GREEN; cont = false; } else if(matchesChoice(colorStr, "blue")) { color = Color.BLUE; cont = false; } else { System.err.println("ERROR: \"" + colorStr + "\" is an invalid choice. Please enter \"green\", \"blue\", \"g\", or \"b\" (Not case-sensitive)."); } } DrawingPanel panel = new DrawingPanel(rad * 2 + 32, rad * 2 + 32); Graphics g = panel.getGraphics(); g.setColor(color); g.drawRect(16,16,rad * 2,rad * 2); g.setColor(Color.BLUE); int x = 16 + rad; int y = 16 + rad; g.drawLine(x,y,x,y); Random rand = new Random(); int dir = 0; int cycles = 0; while(pointInsideCircle(x,y,rad+16,rad+16,rad)) { dir = rand.nextInt(4); switch(dir) { case 0: g.drawLine(x,--y,x,y); break; case 1: g.drawLine(++x,y,x,y); break; case 2: g.drawLine(x,++y,x,y); break; case 3: g.drawLine(--x,y,x,y); break; } cycles++; panel.sleep(1); } System.out.println("After " + cycles + " steps, the walk is finished."); } private static String promptString(String prompt) { System.out.print(prompt); String str = CONSOLE.nextLine(); if(str.length() == 0) str = CONSOLE.nextLine(); return str; } private static i…
has comment: http://stackoverflow.com/comment/42899352
type: Question
has comment: http://stackoverflow.com/comment/42899329
duplicate of: http://stackoverflow.com/q/13536978
has comment: http://stackoverflow.com/comment/42899378
has comment: http://stackoverflow.com/comment/42899416
has comment: http://stackoverflow.com/comment/42899656
tagged with: random
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42899374
has title: Is it possible to have random straight lines
favorite count: 0
has comment: http://stackoverflow.com/comment/42899420
tagged with: jframe
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/27208750

http://stackoverflow.com/comment/42840148
comment on: http://stackoverflow.com/a/27174315
type: Comment
score: 0
type: AnswerComment
has text: Validation can be performed successfully in Lifecycle.onSave method, which must throw a CallbackException if validation fails

http://stackoverflow.com/q/27292779
has comment: http://stackoverflow.com/comment/43051048
has comment: http://stackoverflow.com/comment/43051142
type: Question
has comment: http://stackoverflow.com/comment/43051155
has comment: http://stackoverflow.com/comment/43050799
has comment: http://stackoverflow.com/comment/43050786
has body: Every time I called this method it always return null even if the value of userProfile.get("facebookId") is not null. public String updateProfilePicture() { String facebookId = null; if (currentUser.get("profile") != null) { JSONObject userProfile = currentUser.getJSONObject("profile"); try { if (userProfile.getString("facebookId") != null) { facebookId = userProfile.get("facebookId").toString(); } else { facebookId = null; } } catch (JSONException e) { // handle error facebookId = null; } } return facebookId; }
score: 0
tagged with: parsing
has title: How to properly return a string from a method with try and catch
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43050807
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/43051166
answer count: 0
tagged with: java

http://stackoverflow.com/comment/42823346
type: QuestionComment
comment on: http://stackoverflow.com/q/27165615
has text: You don't seem to be calling the method. Once you _get_ the method, you still have to _call_ it.
score: 1
type: Comment

http://stackoverflow.com/a/27214149
has body: If you don't want two for loops. Then you can use hashtable. Iterate the first array and insert to the hastable. When iterating the 2nd array to the hash table, check for the key, if present then it is duplicated else no. With this approach, the time complexity will be getting reduced to O(kn) where k is a constant which is the number of arrays you have, but auxiliary space complexity will be increased.
answers question: http://stackoverflow.com/q/27212845
score: 0
type: Answer

http://stackoverflow.com/comment/42938327
has text: Have you tried the latest Maven? I think it's up to 3.2.3 now. Also - what happens if you run Maven alone, without Jenkins? Is the Jenkins project a Freestyle project or Maven?
comment on: http://stackoverflow.com/q/27225140
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42880344
has text: If you run out of stack space (through, say, infinite recursion) than any call that you make, library or no, will cause another error to be thrown. In your particular case, the stack still has enough space to admit the overhead of the `println()` call, but gets filled up during the `println()` call itself.
type: AnswerComment
comment on: http://stackoverflow.com/a/27197278
score: 0
type: Comment

http://stackoverflow.com/a/46316290
type: Answer
answers question: http://stackoverflow.com/q/27257459
upvote count: 1
has body: I had the same issue and it was related with groovy. I added groovy to the classpath (external libraries) using my IDE from sdk sources instead of using maven or gradle dependencies. It seems HttpServletResponse which comes with a dependency of groovy doesn't have the getStatus() methods. So finally, I removed from the classpath and add it in maven and it works.
downvote count: 0
score: 1

http://stackoverflow.com/comment/42959995
has text: yes logtime is of datetime type.
comment on: http://stackoverflow.com/q/27241848
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27304065
has body: Why is insertion order not preserved in MultiMap? In fact, your problem is not with MultiMap but with the selected implementation. ArrayListMultimap uses a HashMap&lt;K, Collection&lt;V&gt;&gt; as implementation of the backing Map&lt;K, Collection&lt;V&gt;&gt;: public static &lt;K, V&gt; ArrayListMultimap&lt;K, V&gt; create() { return new ArrayListMultimap&lt;K, V&gt;(); } //... private ArrayListMultimap() { super(new HashMap&lt;K, Collection&lt;V&gt;&gt;()); expectedValuesPerKey = DEFAULT_VALUES_PER_KEY; } And HashMap doesn't preserve the order of the insertion of the elements.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27303883
downvote count: 0

http://stackoverflow.com/q/27271286
tagged with: insert
has answer: http://stackoverflow.com/a/27271507
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27272001
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/6343166
type: Question
has comment: http://stackoverflow.com/comment/43012404
score: -1
has title: Insert data from android app into mySql database
answer count: 3
has answer: http://stackoverflow.com/a/27272019
has body: I've been following a youtube video which explain how to insert data from an android app to mySQL. It doesn't work for me and I don't know what am I doing wrong. It just breaks as soon as I execute it. Not even loading the textViews and Buttons This is my MainActivity: package com.example.insertbbdd; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.app.Activity; import android.os.Bundle; import android.os.StrictMode; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { EditText eName, eAge, eMail; Button bSumbit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); eName = (EditText) findViewById(R.id.editName); eAge = (EditText) findViewById(R.id.editAge); eMail = (EditText) findViewById(R.id.editMail); bSumbit = (Button) findViewById(R.id.submitButton); bSumbit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub InputStream is = null; String name = "" + eName.getText().toString(); String age = "" + eAge.getText().toString(); String email = "" + eMail.getText().toStr…
downvote count: 1

http://stackoverflow.com/comment/42814239
has text: http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
comment on: http://stackoverflow.com/q/27160193
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42817680
type: QuestionComment
has text: What seems to be a problem? What's wrong with garbage being collected?
score: 0
comment on: http://stackoverflow.com/q/27162134
type: Comment

http://stackoverflow.com/q/27234175
answer count: 2
tagged with: bonecp
has body: I am using BoneCP with MySQL in Java. I have several threads, and overtime they will be requesting a connection from the pool to perform some query. The queries are repetitive so I'd like to use prepared statements. I've used prepared statements before, when I only worked with one connection (and no pooling). But now that I have pooling, I'm not sure how's it done: As far as I am concerned, a prepared statement is linked to a particular Connection instance. If you return the connection to the pool, then the prepared statement is (or should be) destroyed. My threads only request a connection when they need to do a query - they return it after it is done so they don't retain any connection for a long time. How do I use prepared statements along with connection pooling?
has answer: http://stackoverflow.com/a/27234222
score: 0
type: UnansweredQuestion
has title: Using prepared statements with BoneCP
tagged with: java
has answer: http://stackoverflow.com/a/27309447
type: Question

http://stackoverflow.com/comment/42889533
comment on: http://stackoverflow.com/a/27178718
type: AnswerComment
has text: Using only validate and repaint made both procedures have the same behavior. I'll check the others fields.
score: 0
type: Comment

http://stackoverflow.com/comment/43047551
has text: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'pointcut name' at character position 1 @com.proj.server.aspect.log.Loggable * *(..)
comment on: http://stackoverflow.com/a/27290662
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42945814
type: Comment
type: QuestionComment
has text: Alright, I have this so far but now I'm confused I hope this is on track with what you were saying. JFrame frame = new JFrame("GridLayout"); frame.setLayout(new GridLayout(1,2)); frame.add(panel1); frame.add(panel3); frame.add(panel2, BorderLayout.CENTER);
comment on: http://stackoverflow.com/q/27231808
score: 0

http://stackoverflow.com/comment/42818936
has text: Thank you for the suggestion. I have removed the link mentioned above. This information has helped a lot. So in your opinion, do you believe that TCP would be a better solution for this scenario? Even with the possibility of latency from packet retransmission? And would 5-7 different threads demonstrate any loss in performance?
type: AnswerComment
comment on: http://stackoverflow.com/a/27162610
score: 0
type: Comment

http://stackoverflow.com/a/27233697
has comment: http://stackoverflow.com/comment/42945349
score: 1
has comment: http://stackoverflow.com/comment/42944962
downvote count: 0
has body: From my understanding of you problem. 'A' (Single instance) gets data from some where , does some processing on data post that data into some "Data Structure". Multiple instances of B read from this data structure and does the processing. This is a pattern --> Its know as "Pipe and Filter" Pattern and it is most often used where there is a step wise processing of data. output of one process acts as input of another. In this case --> A , B acts as a filter and the data structure is the pipe. you need to use a queue data structure in this case : 1. The queue should be thread safe 2. It should be of fixed size because if Producer is faster than consumer you might run out of all memory and get an exception. 3. if the queue is full and A tries to put data into it , it should not throw exception but in form A accordingly. Considering all the above cases you should use "LinkedBlockingQueue"
type: Answer
answers question: http://stackoverflow.com/q/27232860
upvote count: 1

where-clause
tags question: http://stackoverflow.com/q/27175845
type: Tag
tag name: where-clause

http://stackoverflow.com/comment/42998730
comment on: http://stackoverflow.com/q/27262977
score: 0
type: Comment
type: QuestionComment
has text: @Takendarkk please refer to the code, I have insert the output of the program.

http://stackoverflow.com/q/27248017
tagged with: java
has body: I'm using MySQL and Hibernate Envers to log audity info, it saves a timestamp in a numeric format, how can i convert this timestamp to date in MySQL, not in Java? Thanks!
tagged with: mysql
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/72612568
has title: Hibernate Envers Timestamp from revision date
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27248133
tagged with: hibernate-envers
score: 1

http://stackoverflow.com/q/27300328
type: Question
possible better answer: http://stackoverflow.com/a/27300476
tagged with: android-layout
has title: Fragment TextView ID Causing Crash
has answer: http://stackoverflow.com/a/27300476
score: -2
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/43064862
linked to: http://stackoverflow.com/q/218384
favorite count: 0
tagged with: android-studio
accepted answer: http://stackoverflow.com/a/27300481
has body: I am mainly looking for clarification and advice on this. In the app I am working on I setup a fragment for handling some basic controls and text, and moved the necessary XML from the activities layout file into the fragments layout file, without making any changes. However now when I run the app I get a NULLPOINTEREXCEPTION and it seems to be caused at line 19 in my GameStart activty when I try to set the textView by its ID. I have not changed the ID, only moved it to the fragment layout file, so I have two questions: 1) What exactly is the reason this is happening, because something similar happened before that I resolved but I don't see the reason it was happening in the reference docs on Android Developers 2) Any advice on how to fix this Below is the GameStart activity, LogCat with the error, and the XML files in question. Thanks in advance, I've spent 2 hours now trying to find this answer. EDITED FILES/LOGCAT BELOW LogCat: 12-04 13:48:06.322 826-826/com.saphiric.simproject E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.saphiric.simproject/com.saphiric.simproject.GameStart}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at …
tagged with: android
has answer: http://stackoverflow.com/a/27300486
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/27300481
tagged with: android-fragments
tagged with: java

http://stackoverflow.com/a/27232993
has comment: http://stackoverflow.com/comment/42943477
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42943017
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27232860
answers question: http://stackoverflow.com/q/27232860
has body: BlockingQueue is the go-to tool for implementing the producer-consumer pattern. See Java Concurrency in Practice, chapter 5, for more detail. Starting non-thread-safe data structures like LinkedList and TreeSet is definitely the wrong track here. I don't know why your colleague suggested avoiding blocking, but if you try to do so, you will almost certainly end up reinventing blocking data structures along the way, and probably badly. Until you are an expert, stick to the standard path...
has comment: http://stackoverflow.com/comment/42943180

http://stackoverflow.com/a/27174068
score: 2
downvote count: 0
has body: Simple. When you create a new project, instead of picking "Blank Activity", you pick "Empty Activity". That's all.
type: Answer
answers question: http://stackoverflow.com/q/27173974
upvote count: 2

http://stackoverflow.com/comment/123796949
comment on: http://stackoverflow.com/a/27187663
type: Comment
score: 1
has text: In Java 11 (OpenJDK 11.0.12 2021-07-20) there occurs an `Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')`. This one works in Java 11 / OpenJDK 11: https://stackoverflow.com/a/48323948/10318272
type: AnswerComment

http://stackoverflow.com/q/27247531
has comment: http://stackoverflow.com/comment/42971302
type: Question
tagged with: exception
has body: Consider this code: public class CheckException { public static void main(String [] args) { int a = 10; try{ int c = a/0; } catch(Exception e){ } catch(ArithmeticException e1){ \\ compilation error } } } My doubt is compilation error is generated at the second catch because it's already handled by the super type Exception. But why compilation error does not come when the second catch block comes to the first's position and and first comes to the second's position(Like below)? public class CheckException { public static void main(String [] args){ int a = 10; try{ int c = a/0; } catch(ArithmeticException e){ // System.out.println("1"); } catch(Exception e1){ // System.out.println("2"); } } } Then also the first block(i.e. ArithmeticException) will handle the exception before it reaches to catch(Exception e). Modified Now I am adding all the unchecked exceptions before catch(Exception e). public class CheckException { public static void main(String [] args){ int a = 10; try{ int c = a/0; } catch(ArithmeticException e){ System.out.println("1"); } catch(ArrayIndexOutOfBoundsException e1){ System.out.println("2"); } catch(ClassCastException e1){ System.out.println("2"); } catch(IllegalArgumentException e1){ System.out.println("2"); } catch(IllegalStateException e1){ System.out.println("2"); } catch(NullPointerException e1){ System.out.println("2"); } catch(AssertionError e1){ System.out.println("2"); } catch(ExceptionInInitializerError e1){ System.out.println("2"); } catch(StackOverflowError e1){ System.out.println("2"); } catch(NoClassDefFoundError e1){ System.out.println("2"); } catch(ArrayStoreException e1){ System.out.println("2"); } catch(IllegalMonitorStateException e1){ System.out.println("2"); } catch(IndexOutOfBoundsException e1){ System.out.println("2"); } catch(NegativeArraySizeException e1){ System.out.println("2"); } catch(SecurityException e1){ System.out.println("2"); } catch(UnsupportedOperationException e1){ System.out.println("2"); } catch(Exception e1){…
has comment: http://stackoverflow.com/comment/42971397
has title: Supertype and subtype exception handling
has comment: http://stackoverflow.com/comment/42969797
answer count: 2
has answer: http://stackoverflow.com/a/27247565
upvote count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42971351
has comment: http://stackoverflow.com/comment/42970077
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27247652
favorite count: 0

http://stackoverflow.com/comment/42982218
type: Comment
has text: As per my knowledge by default background of any View is transparent. As you are drawing image , check the transparency level of image background. This type of issues comes when images are not having transparency. Please check
comment on: http://stackoverflow.com/q/27253792
score: 0
type: QuestionComment

http://stackoverflow.com/q/27202729
has body: I am developing one web application using Spring and Core Java. Every time request comes from client and handled by Spring controller. @Controller("action") public class RequestHandler{ @Autowired private IndialHandler indial; @Request("/indialCall") public void processWork(HttpServletRequest request){ String did = request.getParameter("did"); String resp = indial.dialCall(did); } } public class IndialHandler{ public String dialCall(String did){ return checkVoiceCall(did); } public String checkVoiceCall(String did){ //here i have a db call, which returns either 1 or 2. return service.dbCall(did); } } My understanding towards this program is, because every new request create a new Thread in JVM and every thread has its on memory context. That means every thread has its own did and resp variable and no two thread can share the resp variable. That means if i have 1,2,...n different threads and lets assume every thread is generating 1,2,....n response. Now my question, is it possible in the program thread can come in race condition, and exchange the response message to each other.
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27203127
favorite count: 0
has title: How multithread works in web environment
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/27203127
upvote count: 1
tagged with: spring
type: Question
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/42921315
comment on: http://stackoverflow.com/a/27215793
type: Comment
score: 0
type: AnswerComment
has text: @sundar: yes, don't forget that the dot doesn't match newlines by default. To change this behavior you need to use the dotall mode.

http://stackoverflow.com/comment/43068036
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27288857
score: 0
has text: If you're making a small Java EE application, I'd say anything over 5-7 custom exceptions means that you don't really understand what you're doing. As for packages for the exceptions, maybe 2, even one would suffice for a small app. You don't want to map an exception directly to an error message either, since an exception can correspond to several different messages. Anyway I'd recommend that you don't try to be too clever here, your initial design was already so crazy that you clearly aren't experienced with designing an application wide exception scheme.

http://stackoverflow.com/comment/42825264
type: Comment
has text: Yes this is strange, if you have 8GB of ram then how task manager can show you 11GB! Do you know if you are using a 32bit JVM? a 32bit os?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27166267

http://stackoverflow.com/q/27234505
answer count: 1
tagged with: websocket
tagged with: tomcat
has title: Tomcat websocket client frame
has body: I have the following code that is executed in java as the clientendpoint of a websocket protected void dequeue() throws InterruptedException, IOException { ByteBuffer bbuf; System.out.println("start"); while((bbuf = messageQueue.take()).get(0) != 0) { bbuf.position(bbuf.limit()); if(bbuf.get(0)== 0) System.out.println("here"); bbuf.flip(); for(Session session : sessionList) { //Thread.sleep(10000); if(!session.isOpen()) break; session.getBasicRemote().sendBinary(bbuf); } } System.out.println("end"); } The code works fine when the Thread.sleep() that is commented out is put back into the code. However when the Thread.sleep() is not included in the code the writes to the websocket sometimes work and other times the @onClose is called after the first message is written and the following reason is given, CloseReason: code [1002], reason [The client frame set the reserved bits to [7] which was not supported by this endpoint] In which the [7] will sometimes be a 1,2,etc. I have not been able to find anything really to why this would be happening, does anyone happen to have any insight into what is happening? As of note, I am using tomcat 7.0.53 to host the ServerSide of the websocket and uses HTTPS instead of HTTP.
has answer: http://stackoverflow.com/a/27323495
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/27323495
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/a/27266326
type: Answer
has comment: http://stackoverflow.com/comment/43004088
score: 3
upvote count: 3
has body: This is mentioned in the Oracle Java tutorials : The .class Syntax If the type is available but there is no instance then it is possible to obtain a Class by appending ".class" to the name of the type. This is also the easiest way to obtain the Class for a primitive type. boolean b; Class c = b.getClass(); // compile-time error Class c = boolean.class; // correct Note that the statement boolean.getClass() would produce a compile-time error because a boolean is a primitive type and cannot be dereferenced. The .class syntax returns the Class corresponding to the type boolean. You need to be able to represent the type of primitives somehow, since it is required when, for example, you use reflection to search for methods or constructors that have primitive argument types.
downvote count: 0
has comment: http://stackoverflow.com/comment/43003923
answers question: http://stackoverflow.com/q/27266247

http://stackoverflow.com/q/27307875
upvote count: 2
has comment: http://stackoverflow.com/comment/43081089
has comment: http://stackoverflow.com/comment/43077954
favorite count: 0
has comment: http://stackoverflow.com/comment/43080518
has body: I'm trying to write a recursive method for an extra credit homework assignment, that finds the least common multiple of two positive integers. However the method needs to follow these rules... The method must be static with only two int parameters The method must be recursive, and cannot use any loops The method can not call any other methods, nor can it call any overloaded methods The method returns the least common multiple of the arguments passed to it My question is, is this even possible without a third parameter? Let's say the parameters (a, b) have (6, 8) passed as arguments. public static int findLCM (int a, int b) { if (a % b == 0) return a; else return findLCM(a + a, b); } What I wanted to do was increase 6 to 12, and make a recursive call with findLCM(12, 8), then 12 would be 18, then finally 24. Since (24 % 8 == 0) then 24 would be the LCM. However as you can clearly see, this code does not do that, because the statement return findLCM(a + a, b); would only work with a thrid parameter, then rewritten as return findLCM(a + originalA, b); I can't seem to find any way it would be possible without adding a 3rd parameter. I've tried other approaches such as getting the greatest common denominator first, and then using it to find the least common multiple, but it seems this is just not possible without other methods, or at least loops. // Doesn't work. Attempts to get greatest common denominator first, then apply the formula to find the LCM at the first instance of the method being called // but there seems to be no way to really detect when to apply this final formula public static int findLCM (int a, int b) { int result; if (b == 0) return a; else { result = findLCM(b, a % b); // When to return gcd, or return lcm??? if (result == b) return result; else return (a * b) / result; // formula for lcm } } I've thought of trying prime factorization, and then using that to find the lcm, but I'm sure that will have the same problem as getting the gcd and then finding…
has comment: http://stackoverflow.com/comment/43080977
downvote count: 5
score: -3
answer count: 4
possible better answer: http://stackoverflow.com/a/48555053
has answer: http://stackoverflow.com/a/67710409
tagged with: recursion
has answer: http://stackoverflow.com/a/27325205
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27325205
has answer: http://stackoverflow.com/a/48555053
tagged with: java
has comment: http://stackoverflow.com/comment/43078145
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/43080544
has answer: http://stackoverflow.com/a/57552266
has title: Java: Finding the least common multiple of two positive integers, within a recursive method, with 2 parameters, and with no other loops or methods
has comment: http://stackoverflow.com/comment/43080320

http://stackoverflow.com/comment/42954541
score: 0
has text: I am unsure what you mean with the first point. How do you mean reference? This is the only way i plan to do it since i have to have it complete for tomorrow and changing it now would be a nightmare?! And also what is MVC? haha. Still pretty new to Java.
type: Comment
comment on: http://stackoverflow.com/a/27238856
type: AnswerComment

http://stackoverflow.com/comment/43086830
comment on: http://stackoverflow.com/a/27313148
score: 0
type: AnswerComment
type: Comment
has text: So long as `currentLine` isn't incremented anywhere else, you could ensure no race condition by adding the increment into the call. `.get(++currentLine).` That said, you're probably just better off synchronizing. Less likely to break in future that way.

http://stackoverflow.com/comment/42999280
type: QuestionComment
score: 1
has text: You may be looking for `javax.swing.Timer`.
comment on: http://stackoverflow.com/q/27263496
type: Comment

http://stackoverflow.com/comment/42861945
comment on: http://stackoverflow.com/a/27187239
type: AnswerComment
score: 0
type: Comment
has text: @Subh But that doesn't actually change which tab is visible in my window for some reason. It doesnt seem to do anything.

http://stackoverflow.com/q/27247788
score: 0
has answer: http://stackoverflow.com/a/27274220
answer count: 1
has title: play 2.3.6, java 1.8 how to pass session to scala templates
tagged with: scala
has comment: http://stackoverflow.com/comment/42972676
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27274220
has comment: http://stackoverflow.com/comment/42972508
tagged with: session
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42970971
tagged with: playframework
has comment: http://stackoverflow.com/comment/42971368
has body: I know there are a lot of SO links with this in discussion but either they are related to old framework version or they don't work for me, what I want to do is pass session to scala templates without having to pass them explicitly form controllers, I didn't find examples(working) of implicit parameters in play 2.3.x version, my view is rendered as ok(welcome.render(msg)) and in my template I'm doing @(notice: String)(implicit session: play.api.mvc.Session) but it gives me method render in class welcome cannot be applied to given types; error, I also tried with @(notice: String)(implicit request: play.api.mvc.Request[Any]) @(notice: String)(implicit request: RequestHeader) but none seem to work, I know I can pass required session values from the controller but I'm trying to send some user data that'd be required in the navbar which would be required in each view so I don't want to send it from the controllers. Any help would be greatly appreciated

http://stackoverflow.com/q/27289931
type: Question
answer count: 2
has title: Exception in sending email from java via gmail
tagged with: ssl
linked to: http://stackoverflow.com/q/3649014
tagged with: smtp
score: 0
tagged with: email
has answer: http://stackoverflow.com/a/27290028
type: UnansweredQuestion
tagged with: java
has body: I am getting the following exception while trying send an email from java via gmail. javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; nested exception is: java.net.ConnectException: Connection refused: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) at javax.mail.Service.connect(Service.java:288) at javax.mail.Service.connect(Service.java:169) at Mail.Send(Mail.java:75) at Mail.main(Mail.java:85) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.security.ssl.SSLSocketImpl.connect(Unknown Source) at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359) ... 5 more I referred http://www.tutorialspoint.com/javamail_api/javamail_api_gmail_smtp_server.htm and Send email using java but same exception is coming both for SSL and TLS. Any fix for this? Thanks in advance.
has answer: http://stackoverflow.com/a/27290121

http://stackoverflow.com/comment/43044038
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27286565
has text: I am sending the values dynamically from an input box.There is no static values.And when I gave the alternate smtp port as 123,which is invalid,the mails are still being sent.The mails are also being sent if I am leaving the port value as blank.learningloop.

http://stackoverflow.com/q/27280570
has body: I have created an android app that does basic voice recordings (stored as .mp4). I want to add a feature where I can send a recording (just one at a time, no batches needed) to Google App Engine cloud storage. Then, I want to be able to listen to these recordings on my (very basic) cloud app. I do not want to use the blobstore but the datastore. I have used the datastore before but always just with a cloud app and python, never with an android app (and my java is shaky at best). Previously, I just got other data from my appspot website form and sent it to the datastore using html and python. In short, my question is, how do I get my recordings from my android app to the datastore. Code snippets and/or links to documentation would be very helpful. Also a short explanation of how these things will communicate/work together would help my brain connect the dots. Note, this is a personal app just for my own learning and use so I am not extremely concerned about security, user accounts, scalability etc. Thanks for your help!
tagged with: python-2.7
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27294911
has title: Upload a recording to Google App Engine from Android app
type: Question
tagged with: google-app-engine
tagged with: android
tagged with: python
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/27294911

http://stackoverflow.com/a/27493075
score: 1
answers question: http://stackoverflow.com/q/27272971
upvote count: 1
type: Answer
has body: PL/SQL Function create or replace function get_pattern(p_string in varchar2) return varchar2 is v_translated_string varchar2(4000) := p_string; v_pattern varchar2(4000); v_same_character_counter number := 1; begin --Convert characters. v_translated_string := regexp_replace(v_translated_string, '[a-zA-Z]', 'a'); v_translated_string := regexp_replace(v_translated_string, '[0-9]', 'd'); v_translated_string := replace(v_translated_string, ' ', '_'); v_translated_string := regexp_replace(v_translated_string, '[^da\_]', 'p'); --Count and convert to pattern. for i in 1 .. length(v_translated_string) loop if i = length(v_translated_string) then v_pattern := v_pattern || substr(v_translated_string, i, 1)||v_same_character_counter; elsif substr(v_translated_string, i, 1) = substr(v_translated_string, i+1, 1) then v_same_character_counter := v_same_character_counter+1; else v_pattern := v_pattern || substr(v_translated_string, i, 1)||v_same_character_counter; v_same_character_counter := 1; end if; end loop; return replace(v_pattern, '1', null); end; / Test Query select string, expected_pattern, get_pattern(string) actual_pattern from ( select '???' string, 'p3' expected_pattern from dual union all select '51213' string, 'd5' expected_pattern from dual union all select 'F680' string, 'ad3' expected_pattern from dual union all select '7D' string, 'da' expected_pattern from dual union all select '%%' string, 'p2' expected_pattern from dual union all select '.85' string, 'pd2' expected_pattern from dual union all select '1.25' string, 'dpd2' expected_pattern from dual union all select 'SATZ A123' string, 'a4_ad3' expected_pattern from dual union all select 'SAT1 1A23B' string, 'a3d_dad2a' expected_pattern from dual ); Results STRING EXPECTED_PATTERN ACTUAL_PATTERN ??? p3 p3 51213 d5 d5 F680 ad3 ad3 7D da da %% p2 p2 .85 pd2 pd2 1.25 dpd2 dpd2 SATZ A123 a4_ad3 a4_ad3 SAT1 1A23B a3d_dad2a a3d_dad2a
downvote count: 0

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/27290972

http://stackoverflow.com/comment/43073966
score: 0
has text: Why not convert the other groups into non-capturing (`(?:xxxx)` as opposed to `(xxxx)`)? Then you only have one thing to replace anyways?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27305558

http://stackoverflow.com/comment/42891482
type: Comment
type: QuestionComment
has text: I would not do this on focusList but rather using an [InputVerifier](http://docs.oracle.com/javase/8/docs/api/javax/swing/InputVerifier.html). This class was created explicitly for this purpose.
score: 0
comment on: http://stackoverflow.com/q/27204452

http://stackoverflow.com/a/27194042
has body: I've just rearranged some of your logic, and added a couple continue statements. You were very close, you just needed to rearrange some things. public static void main(String[] args) { Scanner scan = new Scanner(System.in); boolean yesno = true; while (yens == true) { System.out.println("Enter a 5 digit number..."); try { int number = scan.nextInt(); int length = String.valueOf(number).length(); if (length == 5) { String digits = String.valueOf(number); char number1 = digits.charAt(0); char number2 = digits.charAt(1); char number3 = digits.charAt(2); char number4 = digits.charAt(3); char number5 = digits.charAt(4); if (number1 % 2 != 0 && number2 % 2 != 0 && number3 % 2 != 0 && number4 % 2 != 0 && number5 % 2 != 0) { System.out.println("All of the numbers are odd..."); } else { System.out.println("Not all of the numbers are odd..."); } } else { System.out.println("You did not enter a 5 digit number! Try again..."); continue; } } catch (Exception e) { System.out.println("That was not a number! Try again..."); //A newline might still be stuck in the scanner, so clear it scan.nextLine(); continue; } try { System.out.println("Would you like to enter another number? (Y/N)"); char letter = scan.next().charAt(0); if (letter == 'Y' || letter == 'y') { continue; } else if (letter == 'N' || letter == 'n') { yesno = false; } else { System.out.println("I will take that as a no!"); yesno = false; } } catch (Exception e) { System.out.println("You did not enter a letter..."); scan.nextLine(); } } System.out.println("Goodbye!"); } By the way, you have a lot of other issues in the code that should be addressed, but I simply answered the question that you asked, making the execution return the to top of the loop after an exception is thrown.
has comment: http://stackoverflow.com/comment/42874026
type: Answer
has comment: http://stackoverflow.com/comment/42874179
has comment: http://stackoverflow.com/comment/42873821
has comment: http://stackoverflow.com/comment/42874275
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27193955
has comment: http://stackoverflow.com/comment/42874236
has comment: http://stackoverflow.com/comment/42873970
answers question: http://stackoverflow.com/q/27193955
has comment: http://stackoverflow.com/comment/42874271
has comment: http://stackoverflow.com/comment/42873731
score: 2
has comment: http://stackoverflow.com/comment/42874308
has comment: http://stackoverflow.com/comment/42874132
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27245912
has comment: http://stackoverflow.com/comment/42967038
answers question: http://stackoverflow.com/q/27245799
downvote count: 1
score: -1
upvote count: 0
type: Answer
has body: You can use a handler to introduce delays in your code. final Handler handler=new Handler(); handler.postdelayed(new Runnable(){ @override public void run(){ //Do something after 5 seconds....your code here } },5000); write your code within the run method

http://stackoverflow.com/comment/43059008
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27295638
type: AnswerComment
has text: Only the part after your `json=` must go into the URLEncoder. If you send in all the encoder will escape the `=`

data-integration
tags question: http://stackoverflow.com/q/27312869
tag name: data-integration
type: Tag

http://stackoverflow.com/comment/42946375
type: Comment
type: QuestionComment
score: 1
has text: Do you have <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in your app manifest?
comment on: http://stackoverflow.com/q/27234851

http://stackoverflow.com/a/27224035
answers question: http://stackoverflow.com/q/27201791
has comment: http://stackoverflow.com/comment/42927874
has comment: http://stackoverflow.com/comment/42929684
has comment: http://stackoverflow.com/comment/42929130
type: Answer
has comment: http://stackoverflow.com/comment/42956549
has comment: http://stackoverflow.com/comment/42928766
has comment: http://stackoverflow.com/comment/42927487
has comment: http://stackoverflow.com/comment/42926439
has comment: http://stackoverflow.com/comment/42929400
score: 0
has comment: http://stackoverflow.com/comment/42929640
has comment: http://stackoverflow.com/comment/42929468
has comment: http://stackoverflow.com/comment/42927640
has comment: http://stackoverflow.com/comment/42929416
has body: Update : About Infinite Recursion. You have Bidirectional Relationship right ? imagine json converts your Content entity class then it has field of userContent and in UserContent Entity class it has a content field also then it will result infinite Recursion thats why you put @JsonIgnore in your UserContent Field to ignore that field to avoid infinite recursion. - Secondo I bet you have private List&lt;TerminalUser&gt; companys; inside of your Content entity class. I lost on my bet. XD :)) Based in this line. HTTP Status 500 - Could not write JSON: failed to lazily initialize a collection of role: com.terminal.domain.TerminalUser.companys, just set the fetchType to Eager in private List&lt;TerminalUser&gt; companys; or just initialized it using Hibernate.initialized(); for more explanation refer to this link. lazyinitializationexception when session is not closed

http://stackoverflow.com/a/27275461
has comment: http://stackoverflow.com/comment/43020858
answers question: http://stackoverflow.com/q/27275147
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43021148
score: 2
has body: Since you have an array of Strings with entries that need to be treated differently (i.e. case sensitive and case insensitive), I recommend to create an own class for search terms with a case setting: public class SearchTerm { private final String term; private final boolean caseSensitive; public SearchTerm(final String term, final boolean caseSensitive) { this.term = term; this.caseSensitive = caseSensitive; } public String getTerm() { return term; } public boolean isCaseSensitive() { return caseSensitive; } } Then you can use that class to replace the current array: count(SearchTerm[] searchFor, String fileName) And use it in your search method: for (int i = 0; i &lt; searchFor.length; i++) { if (searchFor[i].isCaseSensitive()) { if (strLine.contains(searchFor[i].getTerm())) { counts[i]++; } } else { // this line was "borrowed" from Maroun Marouns answer (you can also use different methods to search case insensitive) if (Pattern.compile(strLine, Pattern.CASE_INSENSITIVE).matcher(searchFor[i].getTerm()).find()) { counts[i]++; } } } That way you avoid a "global" case sensitive or case insensitive search and you can treat each search term differently.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27275147

http://stackoverflow.com/q/27159933
has body: Please note: although this question deals specifically with Hystrix, its really more about Java generics and can be answered as such. I am trying to subclass HystrixCommand with a BaseCommand that can then be subclassed by the rest of my app. This BaseCommand will include all sorts of goodies that the other command subclasses can inherit for free. My best attempt so far: public class BaseCommand&lt;T&gt; extends HystrixCommand&lt;T&gt; { // Stuff } public class FunnyCommand&lt;Widget&gt; extends BaseCommand&lt;Widget&gt; { // Stuff } But this produces the following compiler error: The class com.netflix.hystrix.HystrixCircuitBreaker$UnitTest$BaseCommand refers to the class com.netflix.hystrix.HystrixCircuitBreaker$UnitTest$BaseCommand and uses 1 parameters, but the referred class takes no parameters It also produces the following compiler warning: The type parameter String is hiding the type String How can I rewrite this so: BaseCommand and HystrixCommand are generic for any type (T, ?, etc.); and BaseCommand subclasses are generic for any concrete type (String, Long, Widget, etc.); and No compiler errors or warnings exist On Java 7 here.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27160015
tagged with: java
accepted answer: http://stackoverflow.com/a/27160015
type: Question
has comment: http://stackoverflow.com/comment/42813827
tagged with: inheritance
score: 0
answer count: 1
has title: Subclassing and generics
tagged with: generics
has comment: http://stackoverflow.com/comment/42813810
tagged with: subclass

http://stackoverflow.com/comment/43086122
score: 0
comment on: http://stackoverflow.com/q/27309095
type: Comment
type: QuestionComment
has text: Firsi i install nodejs secondly i install cordova then create new project then add android platform then build the project and it successfully build then i open project in eclipse from android existing code

http://stackoverflow.com/comment/42989332
type: QuestionComment
score: 0
has text: HTTP params are strings. You can't redirect with a file in any meaningful way.
comment on: http://stackoverflow.com/q/27254895
type: Comment

http://stackoverflow.com/q/27245305
has answer: http://stackoverflow.com/a/40124973
upvote count: 5
answer count: 3
has title: Android method annotation for preventing call from being made on GUI thread
downvote count: 0
favorite count: 0
has body: In the project I'm currently working on there are plenty of caching which is done on the main thread which makes the app laggy. My plan is to make asynchronous variants of these, but still keeping the synchronous calls for easier chaining when combined in asyncTasks. The problem I have it that I want to prevent the usage of the caching functions in GUI thread in some intuitive way. Any ideas? Is it possible? Is it possible to mark a method with an annotation which prevents it from being called on the GUI thread?
has answer: http://stackoverflow.com/a/27245476
has answer: http://stackoverflow.com/a/29066106
type: UnansweredQuestion
tagged with: multithreading
score: 5
tagged with: android
tagged with: annotations
tagged with: java
type: Question

http://stackoverflow.com/comment/111381020
type: QuestionComment
comment on: http://stackoverflow.com/q/27290285
score: 0
has text: @loki did you find anything?
type: Comment

http://stackoverflow.com/comment/42980595
comment on: http://stackoverflow.com/q/27243966
type: QuestionComment
has text: You could create these paths (perhaps by installing cygwin or msys), or you could run a linux VM using something like virtualbox. But honestly you would be better off asking the makers of this specific application (or checking its configuration files to see if you can change the paths).
type: Comment
score: 1

http://stackoverflow.com/a/27284084
upvote count: 1
type: Answer
has body: You can bind it to 127.0.0.1,[1] which prevents any process outside the localhost from even seeing it. But any process in the localhost can connect to it. That being what it's for. If you want to restrict that to certain processes you will have to implement an authentication step in your protocol. Hard to see why. If you can't trust other processes in the localhost you have a rather large problemm in general, not just here. [1] Or indeed 127.0.0.x where 1 &lt;= x &lt;= 254. Using an obscure number like 200 might help by obscurity but it still isn't really secure.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27283663

http://stackoverflow.com/q/27191132
has comment: http://stackoverflow.com/comment/42868726
tagged with: string
has comment: http://stackoverflow.com/comment/42868341
favorite count: 0
has body: I'm getting from JSON string like this: { "name":"Google" "items": "item1,item2,item3,item4" } So I want to create array String[] items and populate it with items from this string. I need somehow to cut this string in parts. Also I'm getting different number of items, not only 4, like in example. How can I do this....?
has answer: http://stackoverflow.com/a/27191168
accepted answer: http://stackoverflow.com/a/27191164
has title: Cut String in parts
score: -3
downvote count: 3
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42868370
has answer: http://stackoverflow.com/a/27191161
linked to: http://stackoverflow.com/q/3481828
tagged with: java
has answer: http://stackoverflow.com/a/27191164
possible better answer: http://stackoverflow.com/a/27191161
answer count: 3
upvote count: 0

http://stackoverflow.com/comment/42898808
type: Comment
type: QuestionComment
has text: What is your question?
comment on: http://stackoverflow.com/q/27208423
score: 1

http://stackoverflow.com/q/27216181
tagged with: netty
has body: If I send two packets immediately, the second packet is usually ignored by the client. There's some cases in which it will pick it up, but it's usually just like it was never sent to begin with. I've done all the debugging and it seems like the server is definitely sending it, but the client never has a clue. I'm using a ByteBuf which is the new version of a ChannelBuffer in Netty 4. Here's how I'm sending the information over the network: getChannel().writeAndFlush(buffer.retain()); Now the strange part is, nothing is getting mixed up if I send these together. The original packet data is all together like it should be, no problems. The second packet just doesn't come through at all. So, for example. ByteBuf bufferA = Unpooled.buffer(); ByteBuf bufferB = Unpooled.buffer(); bufferA.writeInt(1); bufferB.writeInt(2); send(bufferA); send(bufferB); The client will only read bufferA, and completely ignore bufferB, won't even register a single byte of it. If i space these out using Thread.sleep, the client loads them fine. Not sure what to do? Server and Client are both using netty. EDIT: I'm currently using a "Cheat" fix that runs a scheduled executor for this case (Where I need to send two packets one after another) but this doesn't at all fix the issue at hand.
upvote count: 1
has answer: http://stackoverflow.com/a/27217055
score: 1
tagged with: java
has title: Netty - Second packet is ignored
type: Question
tagged with: network-programming
downvote count: 0
answer count: 1
tagged with: nio
favorite count: 0
type: UnansweredQuestion
tagged with: sockets

http://stackoverflow.com/q/27164693
has answer: http://stackoverflow.com/a/27164871
has answer: http://stackoverflow.com/a/27164887
type: AnsweredQuestion
tagged with: java
type: Question
score: 20
upvote count: 20
has body: I am using java-libpst.0.7.jar for reading PST messages. I am using the following code to open the PST file to read messages. PSTFile pstFile = new PSTFile("Path of the pst file"); I have to close the PST file once after getting the message details. But there is no option to close the PST file. How can I do this?
accepted answer: http://stackoverflow.com/a/27164871
downvote count: 0
has comment: http://stackoverflow.com/comment/42822066
answer count: 3
has answer: http://stackoverflow.com/a/27164870
has title: How to close a PST file in Java?
favorite count: 0
tagged with: pst
possible better answer: http://stackoverflow.com/a/27164870

http://stackoverflow.com/comment/42948177
has text: You don't need to pass `Person` object to the getter, the information you need is already there. Simply `return this.navn;`.
comment on: http://stackoverflow.com/q/27235811
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42979290
type: Comment
has text: I think Tiny is right. 1) Keep java.utils.Date; 2) add @Temporal(TemporalType.DATE); 3) enable SQL trace to see the actual SQL statement.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27250720

file
type: Tag
tags question: http://stackoverflow.com/q/27222771
tags question: http://stackoverflow.com/q/27217574
tags question: http://stackoverflow.com/q/27251571
tags question: http://stackoverflow.com/q/27193372
tags question: http://stackoverflow.com/q/27307817
tags question: http://stackoverflow.com/q/27217565
tags question: http://stackoverflow.com/q/27281057
tags question: http://stackoverflow.com/q/27305812
tags question: http://stackoverflow.com/q/27265017
tags question: http://stackoverflow.com/q/27169120
tags question: http://stackoverflow.com/q/27194048
tags question: http://stackoverflow.com/q/27209746
tags question: http://stackoverflow.com/q/27252959
tags question: http://stackoverflow.com/q/27283474
tag name: file
tags question: http://stackoverflow.com/q/27172223
tags question: http://stackoverflow.com/q/27169648
tags question: http://stackoverflow.com/q/27252591
tags question: http://stackoverflow.com/q/27193812
tags question: http://stackoverflow.com/q/27287066
tags question: http://stackoverflow.com/q/27288261
tags question: http://stackoverflow.com/q/27309495
tags question: http://stackoverflow.com/q/27198956
tags question: http://stackoverflow.com/q/27273121
tags question: http://stackoverflow.com/q/27211420
tags question: http://stackoverflow.com/q/27177631
tags question: http://stackoverflow.com/q/27303285
tags question: http://stackoverflow.com/q/27291999
tags question: http://stackoverflow.com/q/27195887
tags question: http://stackoverflow.com/q/27221591
tags question: http://stackoverflow.com/q/27177908
tags question: http://stackoverflow.com/q/27225632
tags question: http://stackoverflow.com/q/27222645
tags question: http://stackoverflow.com/q/27162079
tags question: http://stackoverflow.com/q/27195604
tags question: http://stackoverflow.com/q/27301247
tags question: http://stackoverflow.com/q/27169703
tags question: http://stackoverflow.com/q/27312132
tags question: http://stackoverflow.com/q/27168077

http://stackoverflow.com/comment/42962139
type: AnswerComment
score: 0
has text: well you mostly can't, unless you test each element of the line before. usually in these cases, you know the structure of the table and the structure of the file, they have to match beforehand. the alternative is to test each element of the line with eigther Integer.parseInt(), toString() , Date conversion etc before.
comment on: http://stackoverflow.com/a/27189320
type: Comment

http://stackoverflow.com/comment/42838093
comment on: http://stackoverflow.com/a/27173762
score: 0
type: Comment
has text: i am getting in 2 lines Boolean b = testString.matches(email_regex); System.out.println("Email address is "+testString);--one is (b is a duplicate local varaible and the other is teststring canot be resolved as a varaibe...kindly help
type: AnswerComment

http://stackoverflow.com/a/64230623
has body: There are 2 ways to do this. Write your own class by implementing IResourceChangeListener. This will provide fine control. Use below code workspace.addResourceChangeListener(listener,IResourceChangeEvent.POST_CHANGE|IResourceChangeEvent.PRE_BUILD);
type: Answer
answers question: http://stackoverflow.com/q/27244316
score: 0

http://stackoverflow.com/q/27210653
has title: How can I check arguments in a method from an interface without breaking the DRY principle
tagged with: defensive-programming
tagged with: dry
type: Question
possible better answer: http://stackoverflow.com/a/27210951
tagged with: interface
has answer: http://stackoverflow.com/a/27210951
score: 0
tagged with: java
has body: I have the following code: public interface Person { /*** *@Throws Exception x must be greater than 0 ****/ setAge(int x); } public class Man implements Person { setAge(int x) { if(x &lt;= 0) thrown new Exception("x &lt;= "); } } I broke the DRY principle because I repeat the check in every single implementation and the documentation repeats it too. What's the best way to check the arguments in this situation?
has answer: http://stackoverflow.com/a/27210735
has answer: http://stackoverflow.com/a/27210968
linked to: http://stackoverflow.com/q/242177
answer count: 3
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27210735

http://stackoverflow.com/comment/42945295
type: AnswerComment
comment on: http://stackoverflow.com/a/27234252
type: Comment
has text: Ah, I see. Typically when I have been in situations with multidimensional arrays I have check the bounds by hand. Checking if you are outside your array.size() should work, and this way you don't have to have any unwanted exceptions.
score: 0

http://stackoverflow.com/comment/42968753
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27244155
has text: For me, with cURL on Windows, I'll get 500 status and "longitude not know as command" from Windows. I had to wrap the URL in quotes for it work correctly. Works fine on browser though. Not a big cURL user, so I couldn't say why this happens
score: 0

http://stackoverflow.com/q/27273329
type: AnsweredQuestion
has body: i cannot fix this null pointer exception, nor could my prof. i have commented out and worked on it for a while but it isnt working for some reason! the error is: null pointer exception, i can post the actual error if that helps public static void main(String[] args) { // initialize character and world Player player = new Player(); map = new Map(); Jf = new JFrameManager(); Jf.addToOutput("Mage or Knight?"); do { player.setPlayerType(Jf.getCommand()); Jf.setClass(player.getPlayerHeader()); } while (!("Mage".equalsIgnoreCase(player.getPlayerType()) || "Knight" .equalsIgnoreCase(player.getPlayerType()))); Jf.addToOutput("You Have Selected " + player.getPlayerType() + ", " + player.getPlayerName()); Jf.clearCommand(); while (true) { nextCommand(Jf.getCommand()); } } public static void nextCommand(String commandInput) { String command = null; String constructor = null; String[] str_array; if (!commandInput.equals("")) { str_array = commandInput.split(" "); command = str_array[0]; constructor = str_array[1]; } else { command = ""; } switch (command.toLowerCase()) { case "move": if (isValidMove(constructor)) { player.move(constructor); } break; case "equipmain": player.setWeapon(1, player.getItemNumber(constructor)); break; case "equipoff": player.setWeapon(2, player.getItemNumber(constructor)); break; case "equiparmor": player.setArmor(player.getItemNumber(constructor)); break; case "trash": player.deleteFromInv(constructor); break; } } public static void initiateEventMove(String direction) { if (isValidMove(direction)) { Jf.addToOutput("You have Moved " + direction); player.move(direction); switch (map.getEvent(player.getPosition())) { case 2: intiateAIFight(); break; } } } public static boolean isValidMove(String direction) { boolean r = false; switch (direction.toLowerCase()) { case "up": if ((((player.getPosition() - 20) / 20) &gt;= 1) &amp;&amp; (map.getEvent(player.getPosition()) != 0)) { r = true; } ; break; case "down": if ((((player.getPosition() + 20) / 20) &gt;…
has comment: http://stackoverflow.com/comment/43016271
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27273852
type: Question
linked to: http://stackoverflow.com/q/218384
score: -2
has comment: http://stackoverflow.com/comment/43016459
possible better answer: http://stackoverflow.com/a/27273852
has answer: http://stackoverflow.com/a/27273611
has title: null pointer exception that i cant fix
answer count: 2
tagged with: nullpointerexception
favorite count: 0
has comment: http://stackoverflow.com/comment/43016115
has comment: http://stackoverflow.com/comment/43016188
accepted answer: http://stackoverflow.com/a/27273611

http://stackoverflow.com/comment/42822810
type: Comment
type: QuestionComment
has text: Actually we can't give you the code since this is not a code dump site. We are here to help you if you face any issue. So the best thing is to show some effort
comment on: http://stackoverflow.com/q/27165275
score: 0

http://stackoverflow.com/comment/43044621
type: AnswerComment
type: Comment
has text: I couldn't really find any documentation apart from the link in my answer. Perhaps you could take a look at the source code if that is possible to see the possible difference?
comment on: http://stackoverflow.com/a/27288770
score: 0

http://stackoverflow.com/a/27275427
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27275179
has body: No, it means that you should import which Timer class you will use. When you import javax.swing.Timer you specifies Timer class in javax.swing package. You can use it in your java file. Anyway, have you tried not using static keyword with your timeStampListener?

http://stackoverflow.com/comment/42915913
type: Comment
has text: Thank you! Just to add, does it matter if I do just the if (n <7) shouldn't I have to add if(n > 7) ?
comment on: http://stackoverflow.com/a/27218262
type: AnswerComment
score: 0

http://stackoverflow.com/q/27252471
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42983816
tagged with: export-to-csv
score: 0
has title: Cannot Export sharedpreferences to CSV Android
has body: Okay So this is an activity class where I am trying to export my sharedPreferences that are saved to a CSV file. This does not work. What am I doing wrong? How do I correctly write the sharedPreferences items to a CSV file? import java.io.FileWriter; import java.io.IOException; import java.util.Iterator; import java.util.Map; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class Admin extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin); Button btViewContacts = (Button)findViewById(R.id.btnViewContacts); Button btDeleteContacts = (Button)findViewById(R.id.btnDeleteContacts); Button btExportCSV = (Button)findViewById(R.id.btnExportCSV); final Context context = this; final SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(this); btViewContacts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(Admin.this, Contacts.class)); } }); btDeleteContacts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //DISPLAY ALERT DIALOG AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); //show an alertDialog when user selects delete radio button and clicks process, prompt to confirm //set title alertDialogBuilder.setTitle("DELETE ALL CONTACTS?"); //set dialog message alertDialogBuilder .setMessage("Ar…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42981113
has comment: http://stackoverflow.com/comment/42980219
answer count: 0
has comment: http://stackoverflow.com/comment/42981957
tagged with: sharedpreferences
tagged with: internal-storage

http://stackoverflow.com/comment/42998184
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27254329
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66079/discussion-between-christian-tucker-and-scott-mitchell).
score: 0

http://stackoverflow.com/comment/42905688
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27212462
has text: Done. The following is the result. time taken to add elements 13 time taken to print elements 208 LIST: time taken to add elements 8 LIST: time taken to print elements 145. What i am not clear is though ArrayList is backed-up by array, I see, arrayList is faster, i thought it should be otherway!!. just for FYI, compiler version is 1.6.
type: Comment

bluej
tags question: http://stackoverflow.com/q/27249038
tag name: bluej
tags question: http://stackoverflow.com/q/27300075
tags question: http://stackoverflow.com/q/27240957
tags question: http://stackoverflow.com/q/27252385
tags question: http://stackoverflow.com/q/27179678
tags question: http://stackoverflow.com/q/27304510
type: Tag
tags question: http://stackoverflow.com/q/27238663

http://stackoverflow.com/comment/43013310
type: QuestionComment
comment on: http://stackoverflow.com/q/27271688
score: 0
has text: Have you considered problems with `nextInt`(http://stackoverflow.com/questions/11643222/scanner-and-nextint-discard-integer)?
type: Comment

http://stackoverflow.com/comment/43036228
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27283768
has text: Can you post your code and details about the exception you're getting?

http://stackoverflow.com/a/27306646
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43075694
score: 1
has body: Your for loop makes only one itaration because you return true or false in first step. So delete the else statement. if ((zonaDeInternamento[i][j][h].equals(numeroProcesso))) { System.out.println("O paciente com número de processo " + numeroProcesso + " está internado!"); return true; }
downvote count: 0
answers question: http://stackoverflow.com/q/27306488
has comment: http://stackoverflow.com/comment/43076161

http://stackoverflow.com/comment/42905969
type: Comment
comment on: http://stackoverflow.com/a/27212364
score: 0
type: AnswerComment
has text: Ah okay, well that seems to be the problem. I thought maybe there was away to tell the browser to target through the url. Thanks

http://stackoverflow.com/comment/43048375
type: Comment
has text: Can you post your service code, that creates and persists objects?
type: QuestionComment
comment on: http://stackoverflow.com/q/27290978
score: 0

http://stackoverflow.com/a/27770841
upvote count: 1
type: Answer
downvote count: 0
has body: The Problem was that i was using the wrong CHARSET to Encode the signature into the Storage. I had to encode into convert it to Base64 and encode it in UTF-8 before storing it, like this: String signTostring = DatatypeConverter.printBase64Binary(signature); signTostring = URLEncoder.encode(signTostring, "UTF-8"); Whan i want to use it, i do the revrse actions to get the original signature String st = URLDecoder.decode(code.getSignature(), "UTF-8"); byte[] sign_byte = DatatypeConverter.parseBase64Binary(st);
answers question: http://stackoverflow.com/q/27201847
score: 1

http://stackoverflow.com/q/27189182
favorite count: 0
has answer: http://stackoverflow.com/a/44140849
has answer: http://stackoverflow.com/a/70518651
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43043225
has answer: http://stackoverflow.com/a/32094566
has title: How to scroll a specific DIV using Selenium WebDriver with Java?
tagged with: selenium-webdriver
downvote count: 0
tagged with: selenium
type: Question
has body: Some of WebElements are not recognized by WebDriver, WebDriver fails to find the element which is not visible in browser's visible area. In order to make the WebElement viewable by WebDriver, We need to make that element to visible in browser's view to do scroll down on particular div! How can I perform my action(scroll down and click) on particular area of my webpage. I tried lot, doesn't helped me. Please help me resolve my issue.
has comment: http://stackoverflow.com/comment/42926124
tagged with: java
has answer: http://stackoverflow.com/a/27189307
score: 44
answer count: 11
has answer: http://stackoverflow.com/a/27189297
has answer: http://stackoverflow.com/a/44540150
has answer: http://stackoverflow.com/a/39333243
linked to: http://stackoverflow.com/q/12035023
has comment: http://stackoverflow.com/comment/69835340
linked to: http://stackoverflow.com/q/635706
has answer: http://stackoverflow.com/a/60596136
upvote count: 44
has answer: http://stackoverflow.com/a/47227850
has answer: http://stackoverflow.com/a/44156294

http://stackoverflow.com/q/27232386
has comment: http://stackoverflow.com/comment/42941669
has body: I try to launch my play project in debug mode with the play debug command, and it display me an error I can't resolve, despite of Google research... I found many topics about it, but no solution worked for me. Tried to change debug port, run as administrator, disable firewall.. Error message : ERROR: transport error 202: bind failed: Permission denied ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) NOTE : On my computer, Windows Kernel is using port 9999 Have you got the same error and found a fix for it ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42942108
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: debugging
linked to: http://stackoverflow.com/q/7341449
has comment: http://stackoverflow.com/comment/42965722
has answer: http://stackoverflow.com/a/27274827
tagged with: playframework
answer count: 1
downvote count: 0
has title: Error using Play Framework debug command
has comment: http://stackoverflow.com/comment/42952694
favorite count: 0

http://stackoverflow.com/q/27233078
has answer: http://stackoverflow.com/a/27233584
has title: InvocationTargetException when using JavaFX set and get methods
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has body: //Max Maier, Milan Radovanovic package application; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class Control { private static int anz = 1; int generierteZahl = (int) Math.ceil(Math.random()*100); Label anzversuche; Label zahlenbereich; Button ratenb; TextField eingabe; @FXML void raten(){ if (generierteZahl == Integer.parseInt(eingabe.getText())){ anzversuche.setText(anz + ". Versuche"); ratenb.setDisable(true); zahlenbereich.setText("Richtig geraten!!!"); } else if (generierteZahl &gt; Integer.parseInt(eingabe.getText())){ anz++; anzversuche.setText(anz + ". Versuche"); zahlenbereich.setText(Integer.parseInt(eingabe.getText()) + " ist zu klein"); } else{ anzversuche.setText(anz + ". Versuche"); zahlenbereich.setText(Integer.parseInt(eingabe.getText()) + " ist zu groß"); } anz++; } @FXML void neuerVersuch(){ anz = 1; generierteZahl = (int) Math.ceil(Math.random()*100); zahlenbereich.setText("Noch keine Zahl eingegeben"); anzversuche.setText(anz + ". Versuche"); ratenb.setDisable(false); eingabe.setText(""); } } This thows a bunch if Exceptions: Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at com.sun.javafx…
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27233584
score: 0
tagged with: invocationtargetexception

http://stackoverflow.com/comment/43018512
has text: @user3417644 this should be 1) edit for question 2) formatted as I did here: http://pastebin.com/bRsMA5H2
comment on: http://stackoverflow.com/q/27274474
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43009362
type: Comment
has text: I finally figured it out. Still had to incorperate the Collections.reverse statement to get the order needed and added a line in there to add the date where I needed it to be. I don't think my instructor cares how we do it. He's pretty laid back and encourages us to look up ways to complete the program if we need to. But anywho, I REALLY appreciate your help and going back to the step by step thing did help, so THANK YOU!!! ^ ^
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27258497

rest
tags question: http://stackoverflow.com/q/27233978
tags question: http://stackoverflow.com/q/27301869
tags question: http://stackoverflow.com/q/27248294
tags question: http://stackoverflow.com/q/27284046
tags question: http://stackoverflow.com/q/27176313
tags question: http://stackoverflow.com/q/27282681
tags question: http://stackoverflow.com/q/27153913
tags question: http://stackoverflow.com/q/27273777
tags question: http://stackoverflow.com/q/27159242
tags question: http://stackoverflow.com/q/27181507
tags question: http://stackoverflow.com/q/27153613
tags question: http://stackoverflow.com/q/27213825
tags question: http://stackoverflow.com/q/27164498
tags question: http://stackoverflow.com/q/27264970
tags question: http://stackoverflow.com/q/27292246
tags question: http://stackoverflow.com/q/27247253
tags question: http://stackoverflow.com/q/27188753
tags question: http://stackoverflow.com/q/27183355
tags question: http://stackoverflow.com/q/27274474
tags question: http://stackoverflow.com/q/27246399
tags question: http://stackoverflow.com/q/27169382
tags question: http://stackoverflow.com/q/27228091
tags question: http://stackoverflow.com/q/27294838
tags question: http://stackoverflow.com/q/27187177
tags question: http://stackoverflow.com/q/27186393
tags question: http://stackoverflow.com/q/27310053
tags question: http://stackoverflow.com/q/27156935
tags question: http://stackoverflow.com/q/27256768
tags question: http://stackoverflow.com/q/27160440
tags question: http://stackoverflow.com/q/27261622
tags question: http://stackoverflow.com/q/27304504
tags question: http://stackoverflow.com/q/27224870
tags question: http://stackoverflow.com/q/27154884
tags question: http://stackoverflow.com/q/27292868
tags question: http://stackoverflow.com/q/27216692
tags question: http://stackoverflow.com/q/27172489
tags question: http://stackoverflow.com/q/27184097
tags question: http://stackoverflow.com/q/27260624
tags question: http://stackoverflow.com/q/27313171
tags question: http://stackoverflow.com/q/27312491
tags question: http://stackoverflow.com/q/27192287
tags question: http://stackoverflow.com/q/27307165
type: Tag
tags question: http://stackoverflow.com/q/27250286
tags question: http://stackoverflow.com/q/27297039
tags question: http://stackoverflow.com/q/27251677
tags question: http://stackoverflow.com/q/27295720
tags question: http://stackoverflow.com/q/27310997
tags question: http://stackoverflow.com/q/27244780
tags question: http://stackoverflow.com/q/27211012
tags question: http://stackoverflow.com/q/27291272
tags question: http://stackoverflow.com/q/27213291
tags question: http://stackoverflow.com/q/27155970
tags question: http://stackoverflow.com/q/27164945
tag name: rest
tags question: http://stackoverflow.com/q/27179875
tags question: http://stackoverflow.com/q/27310303
tags question: http://stackoverflow.com/q/27284463
tags question: http://stackoverflow.com/q/27171809
tags question: http://stackoverflow.com/q/27165134
tags question: http://stackoverflow.com/q/27174373
tags question: http://stackoverflow.com/q/27303480
tags question: http://stackoverflow.com/q/27286257
tags question: http://stackoverflow.com/q/27257331

http://stackoverflow.com/comment/51795594
comment on: http://stackoverflow.com/a/27266965
score: 0
type: AnswerComment
has text: @nont you'll be better off asking a new question which includes your code so I can try to build and run it
type: Comment

http://stackoverflow.com/comment/42902955
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27210689
type: AnswerComment
has text: Sir, my project still is not recognizing my API. Please help sir.. :(

http://stackoverflow.com/comment/42832397
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27160977
has text: btw. I came across Meyers "Effective C++" Item 23 "Prefer non-member non-friend functions to members functions". This would (at least for C++) advocate number 2 or 3. Any thoughts on that. In the book Meyers cites compilation unit decoupling as a potential advantage.
score: 0

http://stackoverflow.com/q/27301567
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27301602
tagged with: regex
has comment: http://stackoverflow.com/comment/43066846
has title: IllegalStateException with Pattern/Matcher
type: AnsweredQuestion
has body: I'm using Matcher to capture groups using a regular expression in Java and it keeps throwing an IllegalStateException even though I know that the expression matches. This is my code: String safeName = Pattern.compile("(\\.\\w+)$").matcher("google.ca").group(); I'm expecting safeName to be .ca as captured with the capturing group in the regular expression but instead I get: IllegalStateException: No match found I also tried with .group(0) and .group(1) but the same error occurs. According to the documentation for group() and group(int group): Capturing groups are indexed from left to right, starting at one. Group zero denotes the entire pattern, so the expression m.group(0) is equivalent to m.group(). What am I doing wrong?
has answer: http://stackoverflow.com/a/27301602
tagged with: java
type: Question

http://stackoverflow.com/comment/42856871
comment on: http://stackoverflow.com/a/27184081
has text: yes I have seen many questions on stackoverflow they used jersey with google endpoints don't know why?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42962775
comment on: http://stackoverflow.com/a/27243298
type: AnswerComment
has text: If you have read question clearly, Sugan has said that "String a=driver.findElement(By.cssSelector(".form-group>span:nth-child(1)")).getText(); It results in NoSuchElementFound.". I exactly answer that.
score: 0
type: Comment

http://stackoverflow.com/q/27204818
type: Question
has answer: http://stackoverflow.com/a/32820619
has body: I'm trying to use spring websocket for my application but when running the application on jetty i'm having an IllegalStateException. I found similar questions (e.g. 1, 2) but adding a dependency to tomcat-embed-websocket didn't work for me!! Any work around? Here is pom.xml org.springframework spring-webmvc 4.1.2.RELEASE org.springframework spring-websocket 4.1.2.RELEASE org.springframework spring-messaging 4.1.2.RELEASE org.thymeleaf thymeleaf ${thymeleaf.version} org.thymeleaf thymeleaf-spring4 ${thymeleaf.version} junit junit 3.8.1 test visualization org.mortbay.jetty jetty-maven-plugin org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http://localhost:8080/manager tomcat /visualization Here is the full stacktrace, Caused by: java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found at org.springframework.web.socket.server.support.DefaultHandshakeHandler.initRequestUpgradeStrategy(DefaultHandshakeHandler.java:127) at org.springframework.web.socket.server.support.DefaultHandshakeHandler.<init>(DefaultHandshakeHandler.java:96) 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(Constructor.java:526) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1088) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:100) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowire…
linked to: http://stackoverflow.com/q/21727286
tagged with: maven-jetty-plugin
answer count: 1
tagged with: websocket
downvote count: 0
has title: No suitable default RequestUpgradeStrategy found
favorite count: 0
has comment: http://stackoverflow.com/comment/42901396
type: UnansweredQuestion
tagged with: spring
linked to: http://stackoverflow.com/q/21565598
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42906170
score: 2
has comment: http://stackoverflow.com/comment/42901443
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/42865865
type: QuestionComment
comment on: http://stackoverflow.com/q/27189514
has text: @Springrbua Because everytime I want to test the project I have to make run as in the desktop package...It's a lazy thing but I want to know if it's possible.
score: 0
type: Comment

http://stackoverflow.com/q/27308613
score: -1
has body: I have this enum type method, right now it returns one color as an int for each option but I want each option to return one color as an int and one string. Here is what I have, I would really appreciate some help so that it will also return a string value: enum Direction { NORHT(Color.RED), SOUTH(Color.YELLOW); Direction(int c) { color = c; } private int color; public int getColor() { return color; } } So how could I edit this to also return a sting let say "getting colder" for north and "getting warmer" for south? Its this line Im having tourble with, not sure where to add the string. Thanks for the help in advance.
answer count: 1
has answer: http://stackoverflow.com/a/27308662
favorite count: 0
has title: Android - Enum method set two data types for each option
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43079148
tagged with: java
downvote count: 1
type: Question
tagged with: enums
upvote count: 0

http://stackoverflow.com/comment/43040800
has text: Yes, it shows nothing
comment on: http://stackoverflow.com/q/27286348
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27246420
answers question: http://stackoverflow.com/q/27245669
upvote count: 2
type: Answer
score: 2
has body: Split your content string as: String[] tokens = content.split(" "); Loop through tokens and use regex to identify the token is valid url. for (int i = 0; i &lt; tokens.length; i++){ String regex = "^(https?:\/\/)?(www.)?([a-zA-Z0-9]+).[a-zA-Z0-9]*.[a-z]{3}.?([a-z]+)?$"; // if valid match replace this token with desired string. as in your case: if(Pattern.matches(regex, tokens[i])){ tokens[i] = "&lt;a href='"+tokens[i]+"'&gt;"+tokens[i]+"&lt;/a&gt;"; } } Then join the tokens StringBuilder sbStr = new StringBuilder(); for (int i = 0, i = tokens.length; i++) { if (i &gt; 0) sbStr.append(" "); sbStr.append(aArr[i]); } System.out.println(sbStr.toString()); // your expected result.
has comment: http://stackoverflow.com/comment/42970030
downvote count: 0

http://stackoverflow.com/comment/42829414
type: QuestionComment
has text: @humblerookie The thing is I'm new to android/java development and this is my first project that has been worked on by a few devs before me so most of the code isn't even mine im afraid :/
comment on: http://stackoverflow.com/q/27168575
score: 0
type: Comment

http://stackoverflow.com/q/27211213
has comment: http://stackoverflow.com/comment/42903518
favorite count: 0
accepted answer: http://stackoverflow.com/a/27211274
upvote count: 1
tagged with: regex
has answer: http://stackoverflow.com/a/27211241
type: AnsweredQuestion
has body: Maybe someone could help me. I'm trying to include within a java code a regex to match all strings except the ZZ78. I'd like to know what it's missing in the regex I have. The input string is str = "ab57cdZZ78efghZZ7ij@klmZZ78noCODpqrZZ78stuvw27z@xyzZZ78" and I'm trying with this regex (?:(?![ZZF8]).)* but if you test in http://regexpal.com/ this regex against the string, you'll see that is not working completely. str = new String ("ab57cdZZ78efghZZ7ij@klmZZ78noCODpqrZZ78stuvw27z@xyzZZ78"); Pattern pattern = Pattern.compile("(?:(?![ZZ78]).)*"); the matched strings should be ab57cd efghZZ7ij@klm noCODpqr stuvw27z@xyz Update: Hello Avinash Raj and Chthonic Project. Thanks so much for your help and solutions provided. I originally thougth in split method, but I was trying to avoid get empty strings as result when for example the delimiter string is at the beginning or at the end of the main string. Then, I thought that a regex could help me to extract all except "ZZ78", avoiding in this way empty results in the output. Below I show the code using split method (Chthonic´s) and regex (Avinash´s) both produce empty string if the commented "if()" conditions are not used. Does the use of those "if()" are the only way to not print empty strings? or could be the regex tweaked a little bit to match not empty strings? This is the code I have tested so far: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTest { public static void main(String[] args) { System.out.println("########### Matches with Split ###########"); String str = "ZZ78ab57cdZZ78efghZZ7ij@klmZZ78noCODpqrZZ78stuvw27z@xyzZZ78"; for (String s : str.split("ZZ78")) { //if ( !s.isEmpty() ) { System.out.println("This is a match &lt;&lt;" + s + "&gt;&gt;"); //} } System.out.println("##########################################"); System.out.println("########### Matches with Regex ###########"); String s = "ZZ78ab57cdZZ78efghZZ7ij@klmZZ78noCODpqrZZ78stuvw27z@xyzZZ78"; Pattern regex = Pattern…
tagged with: java
possible better answer: http://stackoverflow.com/a/27211241
downvote count: 1
has title: Regex to exclude word from matches java code
type: Question
has comment: http://stackoverflow.com/comment/42903572
answer count: 2
has comment: http://stackoverflow.com/comment/42903508
has answer: http://stackoverflow.com/a/27211274
score: 0

http://stackoverflow.com/q/27234976
tagged with: jsp
tagged with: java-web-start
tagged with: arguments
has comment: http://stackoverflow.com/comment/42971573
score: 1
has title: JNLP arguments in IIS
favorite count: 0
has body: I have a Java web start application that receives one argument. So using a apache tomcat server and all i need to do is to create a JSP file, get the request parameter and send it to the Java application just like the code bellow: <%@ page contentType="application/x-java-jnlp-file" %> <%@ page session="true" %> <% response.setDateHeader ("Expires", 0); //prevents caching at the proxy server // Getting the URL parameters from the request final String PARAM = "docId"; String paramDocId = request.getParameter(PARAM); %> <?xml version="1.0" encoding="utf-8"?> <jnlp spec="1.0+" codebase="http://localhost:8080/" href="printerwebdoc.jsp?<%=PARAM + "=" + paramDocId%>"> Web Doc Printer Ambisig Web Doc Printer <all-permissions/> <j2se version="1.6+" /> <jar href="webdocprinter.jar" /> <%=paramDocId%> </jnlp> The problem is that now i need to run this application on a IIS server and the JSP doesn't work in this condition. What can i do to pass the argument to my Java web start application using IIS?
has comment: http://stackoverflow.com/comment/42955981
type: UnansweredQuestion
tagged with: iis
upvote count: 1
has answer: http://stackoverflow.com/a/27249018
has comment: http://stackoverflow.com/comment/42966769
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42971437
answer count: 1
downvote count: 0

http://stackoverflow.com/a/27211241
type: Answer
answers question: http://stackoverflow.com/q/27211213
has comment: http://stackoverflow.com/comment/42922539
has comment: http://stackoverflow.com/comment/42923216
has comment: http://stackoverflow.com/comment/42922866
upvote count: 4
score: 4
has body: The easiest way to do this is as follows: public static void main(String[] args) { String str = "ab57cdZZ78efghZZ7ij@klmZZ78noCODpqrZZ78stuvw27z@xyzZZ78"; for (String s : str.split("ZZ78")) System.out.println(s); } The output, as expected, is: ab57cd efghZZ7ij@klm noCODpqr stuvw27z@xyz If the pattern used to split the string is at the beginning (i.e. "ZZ78" in your example code), the first element returned will be an empty string, as you have already noted. To avoid that, all you need to do is filter the array. This is essentially the same as putting an if, but you can avoid the extra condition line this way. I would do this as follows (in Java 8): String test_str = ...; // whatever string you want to test it with Arrays.stream(str.split("ZZ78")).filter(s -&gt; !s.isEmpty()).foreach(System.out::println);
downvote count: 0

http://stackoverflow.com/q/27266223
upvote count: 1
has title: Dynamic naming of excel sheets using pentaho kettle
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27270893
type: Question
has body: I have a transformation with sequential steps of writing data from a table input step to Excel sheets using Excel writer step. The sheet names are basically provided in the sheet name box in content tab which was reflecting in the spreadsheet. Instead of per-defining the sheet name, is there any possibility that the sheet names can be dynamically taken from column value of the table. Ex: say there is a table section and columns section_name , stud_name so i need to show section names as excel sheet name and student names in that section for that particular sheet. so each sheet represents different section names with student data of that class. Can anyone help me how to do this in kettle? Thanks in advance
tagged with: pentaho
answer count: 1
downvote count: 0
tagged with: kettle
tagged with: pentaho-cde
favorite count: 0
tagged with: pentaho-design-studio
type: UnansweredQuestion

http://stackoverflow.com/comment/43057126
type: Comment
type: QuestionComment
has text: There's a method (if I remember correctly) for `World` that sets a preference for saving chunks. It's been a while since I've messed with Bukkit, though.
comment on: http://stackoverflow.com/q/27278153
score: 0

http://stackoverflow.com/q/27172323
has body: I have a component which autowires some other beans: @Component public class MyComponent { @Autowired private Environment env; // null @Autowired public MyComponent(ConfigurationUtils configUtils /* not null */) { } } When adding the Environment env as a constructor parameter it isn't null as well. But why? UPDATE @Component public class MyComponent implements InitializingBean { private final Logger log = LoggerFactory.getLogger(getClass()); @Autowired private Environment env; // TODO: null @Autowired public MyComponent(ConfigurationUtils configUtils) { log.debug("configUtils == null: " + (configUtils == null)); log.debug("env == null: " + (env == null)); log.debug(env.getProperty("foo")); // to trigger NPE } @Override public void afterPropertiesSet() throws Exception { log.debug("Initialized environment: " + env); } } console output: DEBUG c.e.MyComponent - configUtils == null: false DEBUG c.e.MyComponent - env == null: true WARN o.s.w.c.s.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myComponent' defined in URL [jar:file:/var/lib/tomcat7/webapps/site/WEB-INF/lib/site-0.0.1-SNAPSHOT.jar!/com/example/MyComponent.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.example.MyComponent]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1133) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance…
upvote count: 3
answer count: 1
favorite count: 0
has title: Autowired fields are null, but not when autowiring by constructor
has comment: http://stackoverflow.com/comment/42836867
has answer: http://stackoverflow.com/a/27172865
accepted answer: http://stackoverflow.com/a/27172865
has comment: http://stackoverflow.com/comment/42838910
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42835295
downvote count: 0
tagged with: java
tagged with: autowired
type: Question
score: 3
tagged with: dependency-injection

http://stackoverflow.com/comment/42815760
has text: just a side note: Graphics g2d = (Graphics2D) g; that case does nothing (as you cast Graphics -> Graphics2D -> Graphics)
score: 0
comment on: http://stackoverflow.com/q/27160943
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42835666
type: Comment
has text: Yes all you do is something like getElement(By.id("id"));
comment on: http://stackoverflow.com/a/27168443
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42809582
type: Comment
type: QuestionComment
score: 1
has text: Here's a helpful hint: you're not doing anything with the `Diver` instance you create in your loop; it's just getting left behind. Each `Diver` has a(n untyped) `Vector` in it, which may help you get the overall total score for that specific diver.
comment on: http://stackoverflow.com/q/27157742

http://stackoverflow.com/a/27192241
type: Answer
has body: On collision, you are setting the delta y as ya=0 which means no change in the vertical movement(up or down) when a collision occurs. You probably want to rethink what you want here.
answers question: http://stackoverflow.com/q/27191706
score: 0

http://stackoverflow.com/a/27183197
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27182562
has body: Why dont you use a MapView inside a fragment and do all the necessary google map functionalities with it . Something like &lt;com.google.android.gms.maps.MapView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/map" /&gt; Put this inside your xml file. Then do the necessary things with it inside the fragment .
downvote count: 0

http://stackoverflow.com/q/27285446
linked to: http://stackoverflow.com/q/5490789
has comment: http://stackoverflow.com/comment/43038845
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/27286102
linked to: http://stackoverflow.com/q/27261958
tagged with: parsing
has body: How to parse following json string in java. I would like to retrieve one by one. {"IN1005*1001302*CWH":[{"qtyreceived":"5","itemcode":"1618306"},{"qtyreceived":"0","itemcode":"1618305"},{"qtyreceived":"0","itemcode":"288242"]} Output can be head=IN1005*1001302*CWH qtyreceived=5 itemcode:1618306 and so on Please any one help me . I saw many examples but none of them are matching with my requirement. If you found solution for my question in another old post please let me know the post details and url
has comment: http://stackoverflow.com/comment/43038552
has title: How to parse json format String in java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2591098
downvote count: 1
linked to: http://stackoverflow.com/q/2591098
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43038649
score: -1
has answer: http://stackoverflow.com/a/27285693
type: Question
has answer: http://stackoverflow.com/a/27286148
upvote count: 0

http://stackoverflow.com/q/27281262
tagged with: arrays
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/1978933
favorite count: 0
has answer: http://stackoverflow.com/a/27282079
accepted answer: http://stackoverflow.com/a/27282079
score: 2
has title: Convert day of week list to hyphenated String
has body: Is there any existing library that I use to convert a list of days of weeks into a hyphenated/concatenated String? For example: ["Monday", "Tuesday", "Wednesday", "Friday"] would become "Monday - Wednesday, Friday" The list will always contain unique days. So you'll never see ["Monday", "Monday", "Tuesday", ...]. Thanks! SOLUTION Thanks to kamoor1982's solution below I had to make a few changes to his code to handle edge cases: enum DayEnum { Monday(1), Tuesday(2), Wednesday(3), Thursday(4), Friday(5), Saturday(6), Sunday(7); private int value; DayEnum(int x) { this.value = x; } public int getValue() { return value; } } ... public static String concatenateDays(List&lt;String&gt; days) { // Null check if (days == null || days.isEmpty()) { return ""; } // Sort list according to order it appears in calendar with Monday as starting day Collections.sort(days, new Comparator&lt;String&gt;() { @Override public int compare(String lhs, String rhs) { DayEnum lhsEnum = DayEnum.valueOf(lhs); DayEnum rhsEnum = DayEnum.valueOf(rhs); return lhsEnum.compareTo(rhsEnum); } }); StringBuffer result = new StringBuffer(days.get(0)); DayEnum valueOf = DayEnum.valueOf(result.toString()); int previousIndex = valueOf.getValue(); int length = days.size(); for (int i = 1; i &lt; days.size(); i++) { String day = days.get(i); if (previousIndex + 1 == DayEnum.valueOf(day).getValue()) { if (i == length - 1 || DayEnum.valueOf(day).getValue() + 1 != DayEnum.valueOf(days.get(i + 1)).getValue()) { result.append(" - "); result.append(day); } } else { result.append(", "); result.append(day); } previousIndex = DayEnum.valueOf(day).getValue(); } return result.toString(); }
upvote count: 2
has comment: http://stackoverflow.com/comment/43031258
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43031223
type: Question

http://stackoverflow.com/a/27287230
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27280516
answers question: http://stackoverflow.com/q/27280516
score: 1
has comment: http://stackoverflow.com/comment/43096528
has comment: http://stackoverflow.com/comment/43081159
has comment: http://stackoverflow.com/comment/43097895
has comment: http://stackoverflow.com/comment/43057575
type: AcceptedAnswer
downvote count: 0
has body: Spring batch have the capability of reading complex files. only thing is we have to write our own readers to process complex files.any file having particular pattern we can read it through spring Batch. this is file format like your file CUST,Warren,Q,Darrow,8272 4th Street,New York,IL,76091 TRANS,1165965,2011-01-22 00:13:29,51.43 CUST,Ann,V,Gates,9247 Infinite Loop Drive,Hollywood,NE,37612 CUST,Erica,I,Jobs,8875 Farnam Street,Aurora,IL,36314 TRANS,8116369,2011-01-21 20:40:52,-14.83 TRANS,8116369,2011-01-21 15:50:17,-45.45 TRANS,8116369,2011-01-21 16:52:46,-74.6 TRANS,8116369,2011-01-22 13:51:05,48.55 TRANS,8116369,2011-01-21 16:51:59,98.53 Custom FileReader import Java.util.ArrayList; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemStreamReader; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; public class CustomerFileReader implements ItemStreamReader&lt;Object&gt; { private Object curItem = null; private ItemStreamReader&lt;Object&gt; delegate; public Object read() throws Exception { if(curItem == null) { curItem = (Customer) delegate.read(); } Customer item = (Customer) curItem; curItem = null; if(item != null) { item.setTransactions(new ArrayList&lt;Transaction&gt;()); while(peek() instanceof Transaction) { curItem = null; } } return item; } public Object peek() throws Exception, UnexpectedInputException, ParseException { if (curItem == null) { curItem = delegate.read(); } return curItem; } public void setDelegate(ItemStreamReader&lt;Object&gt; delegate) { this.delegate = delegate; } public void close() throws ItemStreamException { delegate.close(); } public void open(ExecutionContext arg0) throws ItemStreamException { delegate.open(arg0); } public void update(ExecutionContext arg0) throws ItemStreamException { delegate.update(arg0); } } Configuration &lt;beans:bean id="customerFile" cl…

regex
tags question: http://stackoverflow.com/q/27169447
tags question: http://stackoverflow.com/q/27209914
tags question: http://stackoverflow.com/q/27254854
tags question: http://stackoverflow.com/q/27161773
tags question: http://stackoverflow.com/q/27215466
tags question: http://stackoverflow.com/q/27238368
tags question: http://stackoverflow.com/q/27213079
tags question: http://stackoverflow.com/q/27248815
tags question: http://stackoverflow.com/q/27171904
tags question: http://stackoverflow.com/q/27234588
tag name: regex
tags question: http://stackoverflow.com/q/27167516
tags question: http://stackoverflow.com/q/27301186
tags question: http://stackoverflow.com/q/27184718
tags question: http://stackoverflow.com/q/27153758
tags question: http://stackoverflow.com/q/27302133
tags question: http://stackoverflow.com/q/27226847
tags question: http://stackoverflow.com/q/27173837
tags question: http://stackoverflow.com/q/27250786
tags question: http://stackoverflow.com/q/27310041
tags question: http://stackoverflow.com/q/27306777
tags question: http://stackoverflow.com/q/27274074
tags question: http://stackoverflow.com/q/27271065
tags question: http://stackoverflow.com/q/27300288
tags question: http://stackoverflow.com/q/27215918
tags question: http://stackoverflow.com/q/27176061
tags question: http://stackoverflow.com/q/27197870
tags question: http://stackoverflow.com/q/27309004
tags question: http://stackoverflow.com/q/27172823
tags question: http://stackoverflow.com/q/27264502
tags question: http://stackoverflow.com/q/27286030
tags question: http://stackoverflow.com/q/27265012
tags question: http://stackoverflow.com/q/27282753
tags question: http://stackoverflow.com/q/27266542
tags question: http://stackoverflow.com/q/27303960
tags question: http://stackoverflow.com/q/27208040
tags question: http://stackoverflow.com/q/27216018
tags question: http://stackoverflow.com/q/27309553
tags question: http://stackoverflow.com/q/27155324
tags question: http://stackoverflow.com/q/27197634
tags question: http://stackoverflow.com/q/27157292
tags question: http://stackoverflow.com/q/27228780
tags question: http://stackoverflow.com/q/27305558
tags question: http://stackoverflow.com/q/27279187
tags question: http://stackoverflow.com/q/27242083
tags question: http://stackoverflow.com/q/27301567
tags question: http://stackoverflow.com/q/27305114
tags question: http://stackoverflow.com/q/27231944
tags question: http://stackoverflow.com/q/27245845
tags question: http://stackoverflow.com/q/27249016
tags question: http://stackoverflow.com/q/27234440
tags question: http://stackoverflow.com/q/27272758
tags question: http://stackoverflow.com/q/27251346
tags question: http://stackoverflow.com/q/27157909
tags question: http://stackoverflow.com/q/27216192
tags question: http://stackoverflow.com/q/27194236
tags question: http://stackoverflow.com/q/27211213
type: Tag
tags question: http://stackoverflow.com/q/27265397
tags question: http://stackoverflow.com/q/27274197
tags question: http://stackoverflow.com/q/27275272

http://stackoverflow.com/q/27231700
tagged with: service
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/48216624
has title: Websocket Server as Service on Android Tablet
type: Question
tagged with: server
tagged with: java
has comment: http://stackoverflow.com/comment/47774928
score: 0
has body: I have the following scenario. A Websocket server, that runs on an android tablet as a service in the background. This Service also starts Websocket client, after the Server is started to handle in-app communication. I also have a java web-socket client in a seperate project to connect and communicate with the server. This all works fine, as long as i don't try to implement the WebSocket Server as a service. I can connect and send data like there's no tomorrow. But as soon as i run the Websocket server as a service i cannot connect to it any longer. Neither with my "inAppClient" nor with my seperate java client. I set the permissions for internet in the manifest and also tried different ports. I also do portforwarding using adb forward tcp:38301 tcp:38301 The error i get when i try to connect to the server with my in-app-client is the following: E/WSCLient﹕ Error failed to connect to /127.0.0.1 (port 38301): connect failed: ECONNREFUSED (Connection refused) I also tried to use localhost instead of 127.0.0.1. This is the sourcecode for my server: private class WSServer extends WebSocketServer{ private static final String TAG = "WSServer"; // private static final int TIMEOUT = 60; private int port = 38301; private int testLevel = Constants.BOUNCE_MESSAGES; public WSServer( InetSocketAddress address ) { super( address ); Log.d(TAG, "creating instance of local WSServer"); wsClient = new WSClient(port); } public WSServer(int port) { super( new InetSocketAddress( port ) ); Log.d(TAG, "creating instance of local WSServer on port " + port); wsClient = new WSClient(port); } @Override public void onOpen(WebSocket conn, ClientHandshake handshake) { Log.d(TAG, "connection Details: " + conn.getLocalSocketAddress() + "; " + conn.getRemoteSocketAddress()); Log.d(TAG, "Connection successfully opened on port: " + this.getPort()); } @Override public void onClose(WebSocket conn, int code, String reason, boolean remote) { Log.d(TAG, "Connection closed"); } @Override public void onMessa…
answer count: 1
tagged with: websocket
accepted answer: http://stackoverflow.com/a/27544586
tagged with: android
has answer: http://stackoverflow.com/a/27544586

http://stackoverflow.com/q/27266561
answer count: 5
has comment: http://stackoverflow.com/comment/43004265
has comment: http://stackoverflow.com/comment/43004480
has answer: http://stackoverflow.com/a/27266892
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43004328
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27266850
linked to: http://stackoverflow.com/q/2353141
tagged with: mysql
has answer: http://stackoverflow.com/a/27266995
type: Question
duplicate of: http://stackoverflow.com/q/2353141
has answer: http://stackoverflow.com/a/27266894
possible better answer: http://stackoverflow.com/a/27266850
has comment: http://stackoverflow.com/comment/43004432
has body: Below is the code that works perfectly fine when it is executed from main (ie in eclipse RunAs java application). However if I call Statement getStatement from outside ( meaning a servlet calling it via a put ) in the same package I get java.lang.ClassNotFoundException: com.mysql.jdbc.Driver. Any pointers to why ? public class DBConnectivity { private static Statement getStatement(String username, String password) throws SQLException, ClassNotFoundException { Properties prop = new Properties(); prop.put("user", "root"); prop.put("password", "password"); Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/keeptrack", prop); Statement stmt = conn.createStatement(); return stmt; } public void put(String username, String password, String table, String name, String exercise, String wsj, String food) throws SQLException, ClassNotFoundException { Statement stmt = getStatement(username, password); // checkIfTableExists(stmt, table); stmt.executeUpdate( "insert into " + table + " " + "values(\'" + name + "\', \'" + exercise + "\', \'" + wsj + "\', \'" + food + "\')"); } public List&lt;String&gt; get(String username, String password, String table) throws SQLException, ClassNotFoundException { Statement stmt = getStatement(username, password); //checkIfTableExists(stmt, table); ResultSet rs = stmt.executeQuery("select FOOD from " + table); List&lt;String&gt; foodData = new ArrayList&lt;String&gt;(); while(rs.next()) { String output = rs.getString("FOOD"); foodData.add(output); // System.out.println("wohoo: " + output); } return foodData; } public static void main(String[] args) throws SQLException, ClassNotFoundException { DBConnectivity conn = new DBConnectivity(); conn.put("root", "password", "trackTable", "D", "B", "C", "D"); conn.get("root", "password", "trackTable"); } } Here is the servlet which calls the database: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletE…
tagged with: servlets
has answer: http://stackoverflow.com/a/27266908
has comment: http://stackoverflow.com/comment/43004383
has title: Why do I get ClassNotFoundException when I call it from outside class?
has comment: http://stackoverflow.com/comment/43004368
downvote count: 0
has comment: http://stackoverflow.com/comment/43004284
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/27266894

http://stackoverflow.com/a/27274971
score: 0
answers question: http://stackoverflow.com/q/27274908
type: Answer
has comment: http://stackoverflow.com/comment/43019283
has comment: http://stackoverflow.com/comment/43019503
has body: When you use a method that has higher API than your minSDK, eclipse will put a red line under it, and show you a warning there.

http://stackoverflow.com/q/27166721
score: -1
has comment: http://stackoverflow.com/comment/42826604
has title: How to handle Connection pool size established by EntityManger through a Spring Application
type: Question
has comment: http://stackoverflow.com/comment/42825777
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/42831196
has comment: http://stackoverflow.com/comment/42831211
downvote count: 1
has comment: http://stackoverflow.com/comment/42831488
has comment: http://stackoverflow.com/comment/42827071
has body: We have a web application implementing Spring MVC 3.2 using JPA as a framework for ORM. Now the problem is that EntityManager is creating a lot of open connections with the database. We want to handle it in such a way that for every query a connection should be established and closed after completion. As per the spring implementation EntityManager is created once. But the problem here is we in some way want to handle the client connections that EntityManager is creating for querying the database. Whenever the query is completed in the database, that connection goes into sleep, instead we want to close it once the query returns the result. DB type: MySQL My configuration for JPA is : <tx:annotation-driven transaction-manager="transactionManager" /> We are using hibernate-jpa-api-2.0 jar as a dependency to the project. And my JAVA Base DAO implementation for injecting EntityManager looks like: protected EntityManager entityManager; @PersistenceContext public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } Please suggest us an optimum solution for the same.
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/27167353
has comment: http://stackoverflow.com/comment/111460004
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42834373
linked to: http://stackoverflow.com/q/5117191
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42825977
has comment: http://stackoverflow.com/comment/42825589
tagged with: java

http://stackoverflow.com/a/32728314
has comment: http://stackoverflow.com/comment/102380450
has body: I would recommend using CopyManager for this. Connection connection = DriverManager.getConnection(url); CopyManager copyManager = new CopyManager((BaseConnection) connection); File file = new File("/tmp/output.csv"); FileOutputStream fileOutputStream = new FileOutputStream(file); //and finally execute the COPY command to the file with this method: copyManager.copyOut("COPY (" + query + ") TO STDOUT WITH (FORMAT CSV, HEADER)", fileOutputStream); This method does not require you to be superuser and will correctly format the output text as CSV
score: 18
upvote count: 18
has comment: http://stackoverflow.com/comment/70355408
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/70359131
answers question: http://stackoverflow.com/q/27154579
has comment: http://stackoverflow.com/comment/102380443

http://stackoverflow.com/a/27169193
has comment: http://stackoverflow.com/comment/42831395
has body: It seems like an unnecessary effort to pass it as a parameter, since you can inject it much easier through @PersistenceContext. Or if you don't have a dependency injection container, you might want to turn the responsibility other way around anyways. Instead of passing the EntityManager as a parameter, have the implementation fetch it from somewhere (e.g. JNDI).
answers question: http://stackoverflow.com/q/27169162
has comment: http://stackoverflow.com/comment/42831651
downvote count: 0
has comment: http://stackoverflow.com/comment/42831776
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42831555

http://stackoverflow.com/comment/42990752
type: Comment
comment on: http://stackoverflow.com/a/27256546
score: 0
has text: Thanks. That was theoretical question. And I meant that particular situation: one object is created before GUI class instance, but then, during the run-time there's a need to create more objects. Like this: p1 = new P1Class( /*arguments*/ ); gui = new MyGuiClass( p1, /*other arguments*/ ); p2 = new P1Class( /*arguments*/ ); gui.set(p2); However I imagine that once the GUI instance is created in main class, there will be no further operations in main as all handling goes to the GUI and user, so the mentioned example has no use. Is that assumption right?
type: AnswerComment

http://stackoverflow.com/a/27231527
has comment: http://stackoverflow.com/comment/42941668
score: 0
has comment: http://stackoverflow.com/comment/42940146
has comment: http://stackoverflow.com/comment/42940275
has body: As you didnt really tell for what system / programming language you need this and you did not provide any code example either, I can only give you some theory what you could do: Its impossible to insert data into two different MySQL tables with one queries but you can reduce your script atleast by the SELECT query: 1.) There is a function in most mysql apis (Depending on what programming language and MySQL Library you are using) that says "getLastInsertId()", "lastInsertId()" or similar. This will return the ID that was inserted by the auto-increment of the table after the insert is completed. Just check the docs of your MySQL-api it will have such a function. 2.) The second possibility is using a UUID - a very large (commonly 128-bit) long string which is generated totally random. There are more so many possible combinations it will happen more probably that you win in the lottery 10 times in a row then you generate two times the same UUID that is already in your table. So you just generate the UUID and insert it as a key in both tables and you are done. Just use google to find out-of-the-box libraries to generate UUID's you dont need to build the alogrithm on your own. An UUID could looks like this: 4a34fe87-f577-4ea9-9557-1bc8f779a68c
type: Answer
has comment: http://stackoverflow.com/comment/42940215
answers question: http://stackoverflow.com/q/27231281

http://stackoverflow.com/comment/42962002
comment on: http://stackoverflow.com/q/27242689
score: 0
has text: to put inputType="numberDecimal|numberSigned"
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42863876
has text: @HareshChhelana thanks for you answer! But I'm already using ViewHolder pattern, according the link: https://developer.android.com/training/material/lists-cards.html
score: 0
comment on: http://stackoverflow.com/q/27188536
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42944226
type: Comment
type: QuestionComment
score: 2
has text: Learn Java's arithmetic operator working and then ask specifically what portion of code you didn't understand!
comment on: http://stackoverflow.com/q/27233770

http://stackoverflow.com/q/27236990
has comment: http://stackoverflow.com/comment/42950616
has body: Hello Im using Gson library and i have a class named Estudiante.class and i have a Json file that looks like this. Im using Eclipse (Java) MAC OS X. {"nombre":"Alex","apellido":"S","cedula":"1234","mes":2,"ano":2,"dia":2,"zona":"LSM","telefono":"0000","semestre":5,"promedio":5.0} {"nombre":"Alfred","apellido":"S","cedula":"523412","mes":6,"ano":6,"dia":6,"zona":"LSM","telefono":"0001","semestre":6,"promedio":6.0} Now i want to read that and put it into a Estudiante Array with position 1 Alex and position 2 Alfred (and so on if i have more Objects). Can any1 help me on this implementation. I've read thousands of topics and can't figure out what im doing wrong. Thanks. Estudiante estudiantes[] = new Estudiante[20]; public void leerJson(){ int i=0; int contador=0; try { JsonReader reader = new JsonReader(new FileReader("estudiantes.json")); while (reader.hasNext()) { String name = reader.nextName(); estudiantes[i]=new Estudiante(); if (name.equals("nombre")) { estudiantes[i].setNombre(reader.nextString()); } else if (name.equals("apellido")) { estudiantes[i].setApellido(reader.nextString()); } else if (name.equals("cedula")) { estudiantes[i].setCedula(reader.nextString()); } else if (name.equals("mes")) { estudiantes[i].setMes(Integer.parseInt(reader.nextString())); } else if (name.equals("ano")) { estudiantes[i].setAno(Integer.parseInt(reader.nextString())); }else if (name.equals("dia")) { estudiantes[i].setDia(Integer.parseInt(reader.nextString())); } else if (name.equals("telefono")) { estudiantes[i].setTelefono(reader.nextString()); } else if (name.equals("semestre")) { estudiantes[i].setSemestre(Integer.parseInt(reader.nextString())); } else if (name.equals("promedio")) { estudiantes[i].setPromedio(Double.parseDouble(reader.nextString())); i++; } else { reader.skipValue(); //avoid some unhandle events } } reader.endObject(); reader.close(); } catch (FileNotFoundException e) { System.out.println("asdsa"); e.printStackTrace(); } catch (IOException e) { System.out.pr…
accepted answer: http://stackoverflow.com/a/27237711
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/42950660
type: Question
has comment: http://stackoverflow.com/comment/42952725
has title: How to Read more than 1 JsonObject in a Json file
has answer: http://stackoverflow.com/a/27237711
has comment: http://stackoverflow.com/comment/42951177
has comment: http://stackoverflow.com/comment/42950742
has comment: http://stackoverflow.com/comment/42951409
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27285222
upvote count: 3
has comment: http://stackoverflow.com/comment/43040619
accepted answer of: http://stackoverflow.com/q/27284619
answers question: http://stackoverflow.com/q/27284619
score: 3
type: AcceptedAnswer
downvote count: 0
has body: First thing I would like to add is a shuffle operation before the first call in quicksort. Other than that if you want to take the median of first three elements that would be fine in the case you first shuffle the elements (in other case - especially if the array is sorted you would get not so good performance on quicksort). Below is part of the code which is modified: public static void sort(int[] array) { // Use collections shuffle // (by converting to a List(extra memory) or any other shuffle method) shuffle(array); quickSort(array, 0, array.length - 1); } public static void quickSort(int[] array, int low, int high) { if (low &gt;= high) return; // Selecting the pivot int first = low; int second = low &lt; high ? low + 1 : high; int third = low + 1 &lt; high ? low + 2 : high; // median for first three int pivot = Math.max(Math.min(array[first],array[second]), Math.min(Math.max(array[first],array[second]),array[third])); while (low &lt;= high) { while (array[low] &lt; pivot) { low++; } while (array[high] &gt; pivot) { high--; } if (low &lt;= high) { int temp = array[low]; array[low] = array[high]; array[high] = temp; low++; high--; } } //Sorting recursively if (low &lt; high) quickSort(array, low, high); if (high &gt; low) quickSort(array, low, high); }
type: Answer
has comment: http://stackoverflow.com/comment/43038610

http://stackoverflow.com/comment/43128746
score: 0
type: Comment
type: QuestionComment
has text: Your difficulty appears to come from sending string representations of values with the arduino println(), but expecting to receive binary doubles on the android. Instead, make your android code treat the received data as textual bytes or a string, log it for debug verification, and then parse a double out of it. The alternative of sending binary doubles is likely to be much more challenging to get working, and there's no performance advantage here.
comment on: http://stackoverflow.com/q/27256147

http://stackoverflow.com/q/27217280
has answer: http://stackoverflow.com/a/27217317
tagged with: java
tagged with: date
type: Question
upvote count: 4
has body: I am packing an intent and one of the Extras I add is a date object, like this: intent.putExtra(DATE_EXTRA, t.getDate()); Later, when I reading the extras, I try to get the Date like this: this.date = new Date(intent.getExtras().getString(DATE_EXTRA)); However, this returns an error about the String being empty. I don't think the above is the right way to do it, because I am not looking for a string, but I have not been able to find an intent.getDateExtra() method anywhere. What do I do? I know that the date was passed properly, because I can see it while debugging:
downvote count: 0
score: 4
accepted answer: http://stackoverflow.com/a/27217317
possible better answer: http://stackoverflow.com/a/27217356
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/27217356
favorite count: 0
has answer: http://stackoverflow.com/a/62911104
tagged with: android-intent
type: AnsweredQuestion
has title: How to get Date extra from an intent?

http://stackoverflow.com/a/27258335
downvote count: 0
has body: As you are using only one element in array replace the array with the sting as String versionNames= "8888"; and replace pm.idno = (Arrays.toString(versionNames)); to pm.idno=versionNames; similar for versionNames1
answers question: http://stackoverflow.com/q/27257862
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27257862
type: AcceptedAnswer

http://stackoverflow.com/comment/43036628
score: 2
comment on: http://stackoverflow.com/a/27284168
type: AnswerComment
has text: lets not forget do is keyword and can't be used as a method name :)
type: Comment

http://stackoverflow.com/a/27166580
has body: should have googled a bit anyways: String s = "1234"; int sum = 0; for (int i = 0; i &lt; s.length(); i++) { sum = sum + Character.getNumericValue(s.charAt(i)); } return sum;
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27166298
downvote count: 0

http://stackoverflow.com/q/27183020
upvote count: 1
type: Question
has title: How to synchronize values updated in java events
has body: I have following code : class A extends javax.swing.JFrame { int tabbedPaneID=0; javax.swing.JTabbedPane tbbdPane; //1 private void tabbedPaneClick(java.awt.event.MouseEvent evt) { tabbedPaneID=tbbdPane.getUI().tabForCoordinate(tbbdPane, evt.getX(), evt.getY()); if(domainTabbedPaneID&gt;=0) jTbbdPnApp.setSelectedIndex(domainTabbedPaneID); else return; System.out.println(domainTabbedPaneID); } //2 private void buttonActionPerformed(java.awt.event.ActionEvent evt) { System.out.println(tabbedPaneID); }} and buttonActionPerformed is called after tabbedPaneClick. The tabbedPaneID within tabbedPaneClick varies from 1 to 5 but within buttonActionPerformed the value retains -1 (sometimes it shows 3,4 etc, ). i.e. On clicking tab 2(tabbedPaneClick) i find value 2 but on clicking a button(buttonActionPerformed) the value shown is -1 ? The following modification fixes the issue: //2 private void buttonActionPerformed(java.awt.event.ActionEvent evt) { tabbedPaneID=tbbdPane.getSelectedIndex(); System.out.println(tabbedPaneID); } But Is there a better way of synchronizing tabbedPaneID across these two functions (so that i can do away with multiple assignments) ? An simple explanation on the problem will be very useful.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jtabbedpane
tagged with: actionevent
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27183181
accepted answer: http://stackoverflow.com/a/27183181
score: 1
tagged with: mouselistener
tagged with: java

http://stackoverflow.com/q/27224546
has body: I have an Android application that I'm writing, and it uses a module that runs on the JNI layer. I have no control or knowledge on how the NDK module works, and it sometimes throws an un-handled exception, and my app crashes. Is there any way to catch those JNI propagating exceptions in the Java layer? Or at least detect when the DNK is going to crash due to an exception?
has comment: http://stackoverflow.com/comment/42928356
has comment: http://stackoverflow.com/comment/42929927
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42928089
has comment: http://stackoverflow.com/comment/42927347
has comment: http://stackoverflow.com/comment/42929000
type: Question
accepted answer: http://stackoverflow.com/a/27225114
has title: Catch JNI exceptions in Java layer
answer count: 1
has comment: http://stackoverflow.com/comment/42928751
has comment: http://stackoverflow.com/comment/42927895
tagged with: android
has answer: http://stackoverflow.com/a/27225114

http://stackoverflow.com/q/27221675
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27286318
has comment: http://stackoverflow.com/comment/43039440
has comment: http://stackoverflow.com/comment/43003402
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43040200
upvote count: 1
has comment: http://stackoverflow.com/comment/42922859
has comment: http://stackoverflow.com/comment/43038553
type: Question
has title: d3.js code in not working on JPS
has comment: http://stackoverflow.com/comment/42995740
tagged with: javascript
accepted answer: http://stackoverflow.com/a/27286318
has body: I am new in d3.js and i am trying to make a d3.js program in JSP. I have a two files 1) HTML 2) javascript now when i linked javascript in HTML file then it shows pie chart. Problem: when i am trying to run this code in jsp and its not working? I dont understand that just by changing the extension from html to jsp, why the program was stop showing pie chart? your suggestions would be helpful... this is the code- This is the JSP file and this is temp.js file- //Width and height var w = 300; var h = 300; var outerRadius = w / 2; var innerRadius = 0; var arc = d3.svg.arc() .innerRadius(innerRadius) .outerRadius(outerRadius); var pie = d3.layout.pie(); //Easy colors accessible via a 10-step ordinal scale var color = d3.scale.category10(); //Create SVG element var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); //Set up groups var arcs = svg.selectAll("g.arc") .data(pie(dataset)) .enter() .append("g") .attr("class", "arc") .attr("transform", "translate(" + outerRadius + "," + outerRadius + ")"); //Draw arc paths arcs.append("path") .attr("fill", function(d, i) { return color(i); }) .attr("d", arc); //Labels arcs.append("text") .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) .attr("text-anchor", "middle") .text(function(d) { return d.value; });
possible better answer: http://stackoverflow.com/a/27222450
has comment: http://stackoverflow.com/comment/43037958
has answer: http://stackoverflow.com/a/27222450
answer count: 2
linked to: http://stackoverflow.com/q/436411
tagged with: jsp
has comment: http://stackoverflow.com/comment/43033470
favorite count: 0
has comment: http://stackoverflow.com/comment/43039568
has comment: http://stackoverflow.com/comment/42923506
tagged with: d3.js
has comment: http://stackoverflow.com/comment/42922353
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42933890
linked to: http://stackoverflow.com/q/6395367
has comment: http://stackoverflow.com/comment/42959462
has comment: http://stackoverflow.com/comment/43040192
score: -1

http://stackoverflow.com/a/27243749
type: AcceptedAnswer
has body: Ok, I figured it out I believe. Statement stmt = conn.createStatement(); sql = "INSERT INTO nameBook(name3, name2, name1) " + "VALUES( "; for(String name : nameSet){ sql = sql.concat(" '" + name + "' , "); } sql = sql.concat(")"); stmt.executeUpdate(sql);
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27223868
answers question: http://stackoverflow.com/q/27223868

http://stackoverflow.com/q/27223022
tagged with: google-calendar-api
tagged with: java
has answer: http://stackoverflow.com/a/27223125
has comment: http://stackoverflow.com/comment/42924716
type: Question
score: 0
has body: I am trying to develop calendar app using Google Calendar API But the app crash on: HttpTransport transport = AndroidHttp.newCompatibleTransport(); and this is snapshot of LogCat: 12-01 08:38:42.077: E/AndroidRuntime(24242): FATAL EXCEPTION: main 12-01 08:38:42.077: E/AndroidRuntime(24242): java.lang.NoClassDefFoundError: com.google.api.client.extensions.android.http.AndroidHttp 12-01 08:38:42.077: E/AndroidRuntime(24242): at com.google.api.services.samples.calendar.android.CalendarSampleActivity.&lt;init&gt;(CalendarSampleActivity.java:100) 12-01 08:38:42.077: E/AndroidRuntime(24242): at java.lang.Class.newInstanceImpl(Native Method) 12-01 08:38:42.077: E/AndroidRuntime(24242): at java.lang.Class.newInstance(Class.java:1319) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.Instrumentation.newActivity(Instrumentation.java:1071) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.ActivityThread.access$700(ActivityThread.java:157) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.os.Handler.dispatchMessage(Handler.java:99) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.os.Looper.loop(Looper.java:176) 12-01 08:38:42.077: E/AndroidRuntime(24242): at android.app.ActivityThread.main(ActivityThread.java:5317) 12-01 08:38:42.077: E/AndroidRuntime(24242): at java.lang.reflect.Method.invokeNative(Native Method) 12-01 08:38:42.077: E/AndroidRuntime(24242): at java.lang.reflect.Method.invoke(Method.java:511) 12-01 08:38:42.077: E/AndroidRuntime(24242): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 12-01 08:38:42.077: E/AndroidRuntime(24242): at com.and…
answer count: 1
has title: Google Calendar java.lang.NoClassDefFoundError
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/43094367
type: QuestionComment
has text: Wide is the width of the screen(1200), and I change cx between about 0 and 600, it adjusts the volume like I'd expect, but doesn't have any effect on the pitch.
comment on: http://stackoverflow.com/q/27305657
score: 0
type: Comment

http://stackoverflow.com/q/27209935
has comment: http://stackoverflow.com/comment/42901595
has body: For WebCat (an automated grader) for my class I have been working with TreeNodes and it checked my work but it highlighted the return line red and said "Not all possibilities for this line were tested" for the following code: public boolean isEmpty() { return root.val == null &amp;&amp; root.rkid == null &amp;&amp; root.lkid == null; } Does this mean that I must test true and false combinations (eight different tests) for this one line of code? Is there a simpler return statement? (given a value, a left child, and a right child) I have been working hard on this assignment for hours and hours, please help!
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42901523
has comment: http://stackoverflow.com/comment/42901607
has comment: http://stackoverflow.com/comment/42901794
tagged with: java
has comment: http://stackoverflow.com/comment/42901537
type: Question
has title: TreeNode Method isEmpty

http://stackoverflow.com/q/27166442
answer count: 2
tagged with: spring-data-couchbase
favorite count: 0
has title: Custom method in spring data couchbase
type: UnansweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27181905
tagged with: spring-data
tagged with: couchbase
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/33512375
upvote count: 2
has body: I need to write a custom method for spring data couchbase repository. Here is my code. CBsampleRepositoryCustom.java public interface CBsampleRepositoryCustom { public void addIndex() ; } CBsampleRepositoryImpl.java public class CBsampleRepositoryImpl implements CBsampleRepositoryCustom { @Override public void addIndex() { System.out.println("CBsampleRepositoryCustomImpl createIndex"); } } CBsampleRepository.java @Repository public interface CBsampleRepository extends CouchbaseRepository&lt;Content,String&gt; , CBsampleRepositoryCustom{ } CouchBaseBeansConfiguration.java @Configuration public class CouchBaseBeansConfiguration { @Bean public CouchbaseClient couchbaseClient() throws IOException { return new CouchbaseClient(Arrays.asList(URI .create("http://localhost:8091/pools")), "test", ""); } @Bean public CouchbaseTemplate couchbaseTemplate() throws IOException { return new CouchbaseTemplate(couchbaseClient()); } } Main.java public static void main(String[] args) { ApplicationContext context = new AnnotationConfigApplicationContext( CouchBaseBeansConfiguration.class); CouchbaseTemplate template = context.getBean("couchbaseTemplate", CouchbaseTemplate.class); RepositoryFactorySupport factory = new CouchbaseRepositoryFactory( template); CBsampleRepository repository = factory.getRepository(CBsampleRepository.class); repository.addIndex(); } But while running its showing an error. Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: Could not load view "addIndex" for design doc "content"; nested exception is com.couchbase.client.protocol.views.InvalidViewException: Could not load view "addIndex" for design doc "content"

http://stackoverflow.com/q/27251385
upvote count: 0
tagged with: arrays
favorite count: 0
has body: Write a method public static ArrayList merge(ArrayList a, ArrayList b) that merges two array lists, alternating elements from both array lists. If one array list is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer array list. For example, if a is 1 4 9 16 and b is 9 7 4 9 11 then merge returns the array list 1 9 4 7 9 4 16 9 11 What I tried doing was writing a for loop with if statements such that a number is added to the merge array list from array list a when i is an even number (i%2==0) and from array list b when i is an odd number. I am however not sure how to deal with the fact that one array list can be longer than the other. Could anyone please help me out?here is my code so far package test; import java.util.Scanner; public class Arraybig { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int m = scan.nextInt(); int n = scan.nextInt(); int[] A = new int[m]; for (int k = 0; k &lt; m; k++) { A[k] = scan.nextInt(); } int[] B = new int[n]; for (int k = 0; k &lt; n; k++) { B[k] = scan.nextInt(); } int[] C = new int[m + n]; int max = Math.max(m, n); int a = 0, b = 0; for (int i = 0; i &lt; m+n; i++) { if (i % 2 == 0 &amp;&amp; a &lt; A.length) { C[i] = A[a]; a++; } else if (i % 2 != 0 &amp;&amp; b &lt; B.length) { C[i] = B[b]; b++; } else if (a &lt; A.length) { C[i] = A[a]; a++; } else { C[i] = B[b]; b++; } } for (int j = 0; j &lt; C.length; j++) { System.out.println(C[j] + " "); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42976904
downvote count: 2
has answer: http://stackoverflow.com/a/27251626
type: Question
score: -2
has answer: http://stackoverflow.com/a/27251724
tagged with: java
has comment: http://stackoverflow.com/comment/42977118
has comment: http://stackoverflow.com/comment/42977162
has comment: http://stackoverflow.com/comment/42977099
has title: Merging two arrays in Java
answer count: 2

http://stackoverflow.com/comment/42895481
has text: @JoelA.Christophel how can i fix this?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27205325

http://stackoverflow.com/q/27283442
score: 5
upvote count: 5
downvote count: 0
has title: Java 8 streams - incremental collection/partial reduce/intermittent map/...what is this even called?
has answer: http://stackoverflow.com/a/40445450
has comment: http://stackoverflow.com/comment/43035766
answer count: 3
has answer: http://stackoverflow.com/a/31979715
favorite count: 0
type: UnansweredQuestion
tagged with: dictionary
tagged with: java-8
tagged with: reduce
has body: I'm processing a potentially infinite stream of data elements that follow the pattern: E1 &lt;start mark&gt; E2 foo E3 bah ... En-1 bar En &lt;end mark&gt; That is, a stream of &lt;String&gt;s, which must be accumulated in a buffer before I can map them to object model. Goal: aggregate a Stream&lt;String&gt; into a Stream&lt;ObjectDefinedByStrings&gt; without the overhead of collecting on an infinite stream. In english, the code would be something like "Once you see a start marker, start buffering. Buffer until you see an end marker, then get ready to return the old buffer, and prepare a fresh buffer. Return the old buffer." My current implementation has the form: Data&lt;String&gt;.stream() .map(functionReturningAnOptionalPresentOnlyIfObjectIsComplete) .filter(Optional::isPresent) I have several questions: What is this operation properly called? (i.e. what can I Google for more examples? Every discussion I find of .map() talks about 1:1 mapping. Every discussion of .reduce) talks about n:1 reduction. Every discussion of .collect() talks about accumulating as a terminal operation...) This seems bad in many different ways. Is there a better way of implementing this? (A candidate of the form .collectUntilConditionThenApplyFinisher(Collector,Condition,Finisher)...?) Thanks!
tagged with: java-stream
has comment: http://stackoverflow.com/comment/43035663
tagged with: java
has answer: http://stackoverflow.com/a/27283928
linked to: http://stackoverflow.com/q/30641383
has comment: http://stackoverflow.com/comment/43038902
type: Question

http://stackoverflow.com/a/27154717
type: Answer
has comment: http://stackoverflow.com/comment/53298794
accepted answer of: http://stackoverflow.com/q/27154579
score: 2
answers question: http://stackoverflow.com/q/27154579
has body: The error shows ERROR: must be superuser to COPY to or from a file It seems that the current user is not having enough permissions to write the file. Provide permissions to the write location for the user or execute the program from a user account which has sufficient privileges to write to the file.
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42805470

http://stackoverflow.com/comment/42873374
has text: No, I have only tried the precompiled version. You compiled it on the ARM machine?
comment on: http://stackoverflow.com/a/27190354
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27183439
has comment: http://stackoverflow.com/comment/42855132
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27224423
has title: Remote Login to Amazon
has body: Questions how to login to Amazon have been discussed for various environments on stackoverflow: PHP Curl - Cookies problem Remote login Amazon (KDP) Amazon Login with Webrequest Programatically login to Amazon with C# Cannot Login to Amazon with Ruby Mechanize ... The mileage seems to vary depending on the approach taken. E.g. as of 2013 one comment was: Amazon have since changed their login process, adding some sort of CSFR protection which makes it difficult to log in using cURL Using Java I also had no luck trying the direct curl-like approach and fiddling with the OpenId parameters: // https://www.amazon.com/ap/signin? // _encoding=UTF8&amp; // openid.assoc_handle=usflex&amp; // openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp; // openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp; // openid.mode=checkid_setup&amp; // openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&amp; // openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&amp; // openid.pape.max_auth_age=0&amp; // openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fsign-in.html%3Fie%3DUTF8%26*Version*%3D1%26*entries*%3D0 Question: Would using a ruby mechanize - like style work here and which would be a working mechanize equivalent on Java?
linked to: http://stackoverflow.com/q/24553505
linked to: http://stackoverflow.com/q/7522149
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42854491
tagged with: java
tagged with: authentication
tagged with: web-scraping
linked to: http://stackoverflow.com/q/9615844
type: Question
linked to: http://stackoverflow.com/q/6888549
accepted answer: http://stackoverflow.com/a/27224423
linked to: http://stackoverflow.com/q/6783179

http://stackoverflow.com/comment/42892109
has text: it is a good answer. and among all answers to same type of questions, it is the only one that answers detect and modify the digit in a string
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27204607
type: Comment

http://stackoverflow.com/comment/43040366
comment on: http://stackoverflow.com/q/27286265
score: 0
type: Comment
type: QuestionComment
has text: Have you initialised parse stuffs in your application class?, I think it might be session problem.

http://stackoverflow.com/a/27178718
has body: I suggest to use c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.BOTH; // make the component fill its display area entirely c.ipady = 150; //height c.anchor = GridBagConstraints.FIRST_LINE_START; // component start from the left top corner this.getContentPane().add(this.scrollPane, c); for definition of JScrollPane constraints. In additition, add validate() and repaint() after modifying elements this.scrollPane.setViewportView(mainPanel); // Replacing previous JPanel this.validate(); this.repaint();
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27175921
has comment: http://stackoverflow.com/comment/42889533
answers question: http://stackoverflow.com/q/27175921
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27524467
type: Answer
has body: The IAIK Provider for the Java™ Cryptography Extension (IAIK-JCE) is a set of APIs and implementations of cryptographic functionality. It supports symmetric key cipher suites including this one - TLS_PSK_WITH_AES_128_GCM_SHA256. Ref: https://jce.iaik.tugraz.at/sic/Products/Public-Key-Infrastructure/JCA_JCE
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27291791

http://stackoverflow.com/comment/42913264
type: AnswerComment
type: Comment
has text: Yes, that sure seems to be a good option - altered answer. One important thing to note: no integrity or authentication (e.g. a HMAC) is added by the wrapper classes, and you should not use the CBC mode of operation within a transport protocol (i.e. where padding oracles apply). Adding a HMAC over the ciphertext *and* IV would significantly heighten the security.
comment on: http://stackoverflow.com/a/27215356
score: 0

http://stackoverflow.com/q/27190502
has title: How to select document which does not consict some field in Mongo use Java?
has comment: http://stackoverflow.com/comment/42867044
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27190644
type: AnsweredQuestion
score: 2
downvote count: 0
has body: I have data: "_id" : 1, "employee_id_list" : [ { "employee_id" : 2 "date_end" : 2014-11-13 }, { "employee_id" : 3 } ] And I want select document with '_id':1 where employee_id_list does not consit object with field date_end. For example, I want to select only: "_id" : 1, "employee_id_list" : [ { "employee_id" : 3 } ] I use this Java-code: DB database = mongoClient.getDB("employee_service"); DBCollection collectionProject = database.getCollection("project"); DBObject projectMongoObject = new BasicDBObject(); projectMongoObject.put("company_id", 1); DBCuresor cursorProject = collectionProject.find(projectMongoObject); But I select document with all records in employee_id_list.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27190644
upvote count: 2
tagged with: mongodb

http://stackoverflow.com/comment/43085162
score: 0
type: QuestionComment
type: Comment
has text: You don't need `keywordDao.merge(persistedKeyword);` because `persistedKeyword` already in session cache. But it can't be cause of the problem.
comment on: http://stackoverflow.com/q/27298842

http://stackoverflow.com/q/27152866
downvote count: 0
has answer: http://stackoverflow.com/a/27152999
has title: How to tell Eclipse not include project reference, instead get JAR for custom dependency in local repo
favorite count: 0
has answer: http://stackoverflow.com/a/27153067
possible better answer: http://stackoverflow.com/a/27153067
upvote count: 2
accepted answer: http://stackoverflow.com/a/27152999
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has body: I have two libraries which are built with Maven, and then installed into the local repo. In my application, I'm using these two libraries and so I reference them in my pom in standard way: ... simple-google-drive-manager <version>1.0-SNAPSHOT</version ... PdfBoxUtils <version>1.0-SNAPSHOT</version Two libs are PdfBoxUtils and simple-google-drive-manager In Eclipse, under Maven Dependencies, most things are listed as artifactId-version.jar as expected. But for the custom libraries I made, Eclipse recognizes they are in same workspace and instead of including jar, includes the project itself. I don't want this! It's confusing, and I want to be able to force this project to use the locally installed library, not just whatever is currently in the library project's source. How do I get eclipse to actually use the JAR from local repo rather than referencing local proejct?

http://stackoverflow.com/comment/42982528
type: QuestionComment
comment on: http://stackoverflow.com/q/27253757
has text: Not sure what you're asking...are you asking if you need to include a mock endpoint at the end of all your routes in order to test them?
score: 0
type: Comment

http://stackoverflow.com/a/27183188
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27183146
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27183146
has body: Trim does not remove spaces among the characters. It only removes from the beginning/end.
type: Answer
score: 1

http://stackoverflow.com/comment/43081914
comment on: http://stackoverflow.com/q/27266825
type: Comment
score: 0
type: QuestionComment
has text: I've tried STREAM_MUSIC and STREAM_NOTIFICATION.

http://stackoverflow.com/q/27303316
has comment: http://stackoverflow.com/comment/43070500
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43112424
tagged with: java-native-interface
tagged with: java
has title: C++ std::string to jstring with a fixed length
has comment: http://stackoverflow.com/comment/43070597
score: 12
type: Question
upvote count: 12
has comment: http://stackoverflow.com/comment/43070718
downvote count: 0
answer count: 1
tagged with: string
favorite count: 0
has body: I'm trying to turn a C++ std::string into a jstring and return it. This would be easy enough with JNIEnv*-&gt;NewStringUTF(stdString.c_str()) but the problem is that the string I'm converting has almost randomly interspersed null characters in it. This is a problem for the c_str(), but not the std::string. NewStringUTF will only catch a portion of the full std::string. There is some hope in that the std::string has a length() function, which gets the full length, ignoring the problematic char* \0 characters. There's a separate function NewString that takes in a jchar* and a jsize*, so that looks promising, but I can't get the std::string converted properly to the jchar*. I tried making it a byte array, but I probably wasn't doing it right. I had further problems converting the int given by the length() into a jsize, which was required by the NewString call. I have done a bit of work with vector&lt;char&gt; byteArray(stdString.begin(), stdString.end()), but that didn't get me very far, probably because that is messing up what the original string is. Here is the basic starter function I have, which worked with strings without null chars: jstring StringToJString(JNIEnv * env, const std::string &amp; nativeString) { return env-&gt;NewStringUTF(nativeString.c_str()); } As a side note, this function is being used inside a JNI wrapper file for returning an object's std::string. Thanks for any help or information sources!
has answer: http://stackoverflow.com/a/27305886
tagged with: c++

http://stackoverflow.com/comment/43055403
type: Comment
type: QuestionComment
has text: sure, Thanks for looking at it. I have added the stack trace.
comment on: http://stackoverflow.com/q/27286287
score: 0

http://stackoverflow.com/q/27169703
score: 24
type: Question
answer count: 1
upvote count: 24
favorite count: 0
has answer: http://stackoverflow.com/a/27170383
has body: File.mkdirs JavaDocs: public boolean mkdirs() Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories. Returns: true if and only if the directory was created, along with all necessary parent directories; false otherwise My question is: Does mkdirs() return false if some of the directories it wanted to create already existed? Or does it just return true if it was successful in creating the entire path for the File, whether or not some directories already existed?
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42830826
tagged with: file
tagged with: mkdirs
has title: mkdirs() return value for already existing directories
tagged with: java

http://stackoverflow.com/comment/42910829
comment on: http://stackoverflow.com/q/27215433
score: 0
type: Comment
type: QuestionComment
has text: Did you init your **array**?

http://stackoverflow.com/comment/43005728
comment on: http://stackoverflow.com/a/27267358
type: AnswerComment
score: 0
type: Comment
has text: parameter is a name value pair where in <value> you will send your json.

http://stackoverflow.com/a/27249323
score: 0
has body: If I understand you correctly, a Map would suit your needs better than a LinkedList. You can have a Map&lt;String,String&gt; where the key is name and the value is times. Or you can have a Map&lt;String,SomeObject&gt; where the key is the name and the value some object that contains the data you read from the line. Then, instead of q1.add(names), you can have : Map&lt;String,String&gt; map = new HashMap&lt;&gt;(); ... while (input.hasNextLine()) { ... map.put (name,times); ... } or Map&lt;String,SomeObject&gt; map = new HashMap&lt;&gt;(); ... while (input.hasNextLine()) { ... map.put (name,new SomeObject(name,times); ... } Later you can search the map for a specific name (map.containsKey(name) or map.get(name)), or iterate over all the names (using map.keySet()).
has comment: http://stackoverflow.com/comment/42973178
type: Answer
answers question: http://stackoverflow.com/q/27249209
has comment: http://stackoverflow.com/comment/42973023

http://stackoverflow.com/comment/42883834
type: Comment
has text: isn't it said that SWT is much faster than Swing? How did they managed to do that?
comment on: http://stackoverflow.com/a/27199495
score: 0
type: AnswerComment

http://stackoverflow.com/a/63135651
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: I found this approach: https://github.com/alestic/aws-sns-delayed. Basically, you can use a step function with a wait step in there
answers question: http://stackoverflow.com/q/27226810

http://stackoverflow.com/a/31655540
downvote count: 0
has body: I agree with Jens-Peter but I would add that you can use GridPane's getColumnIndex and getRowIndex to obtain a particular node's location. For example ( this is in a component which extends GridPane ): // set the appropriate label for (Node node : getChildren()) { if (node instanceof Label &amp;&amp; getColumnIndex(node) == column &amp;&amp; getRowIndex(node) == row) { ((Label)node).setTooltip(new Tooltip(tooltip)); } } in other words, go through all the nodes in the GridPane and check for a match of the conditions you want, in this case row and column.
type: Answer
answers question: http://stackoverflow.com/q/27154996
upvote count: 2
score: 2

http://stackoverflow.com/comment/43062825
comment on: http://stackoverflow.com/a/27297429
has text: I removed the parameter still I am getting the same error, I have updated my question please have a look.
type: AnswerComment
score: 0
type: Comment

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/27161576
tags question: http://stackoverflow.com/q/27240194
tags question: http://stackoverflow.com/q/27193150
type: Tag
tags question: http://stackoverflow.com/q/27241575
tags question: http://stackoverflow.com/q/27190393
tags question: http://stackoverflow.com/q/27272697

http://stackoverflow.com/q/27290127
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43049925
tagged with: spring
has comment: http://stackoverflow.com/comment/43047204
has comment: http://stackoverflow.com/comment/43049309
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43048075
has comment: http://stackoverflow.com/comment/43047102
has title: java.lang.IllegalArgumentException: Cannot find a factory to create the request context
type: AnsweredQuestion
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/43047405
has body: I am tiring to use spring boot,thymeleaf and tiles in my project ,but i just keep getting the titled error. stacktrace error is java.lang.IllegalArgumentException: Cannot find a factory to create the request context at org.apache.tiles.context.ChainedTilesRequestContextFactory.createRequestContext(ChainedTilesRequestContextFactory.java:137) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:317) at org.thymeleaf.extras.tiles2.spring4.web.view.ThymeleafTilesView.render(ThymeleafTilesView.java:125) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) 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.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 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.cor…
has answer: http://stackoverflow.com/a/27294342
tagged with: java
has comment: http://stackoverflow.com/comment/43047721
type: Question
accepted answer: http://stackoverflow.com/a/27294342
tagged with: thymeleaf
tagged with: tiles
has comment: http://stackoverflow.com/comment/43049718

http://stackoverflow.com/q/27230237
has comment: http://stackoverflow.com/comment/42939277
has body: I have java webstart application and I need to use application API for testing purposes. For this I need jars which are located on webserver (e.g. http://webserver/webstart/core.jar) and this jars should be always up to date (building performed 4 times a day) Is it possible, using Maven, to add this jars to the project and update them automatically before running tests? I was googling for solution but didn't find exact answer. I find that I can add external jar from local computer, also find that I can add some repositories but in fact I'm not strong in Maven:( some.api some API http://webserver/webstart/ true ignore always true ignore always
tagged with: jar
has comment: http://stackoverflow.com/comment/42939182
type: UnansweredQuestion
tagged with: maven
answer count: 0
tagged with: java
type: Question
score: 0
has title: Add jars to maven from external server and regularly update them

http://stackoverflow.com/q/27259906
tagged with: java
tagged with: rcp
tagged with: eclipse
type: Question
tagged with: code-injection
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43004821
has body: As far as I have understood reading online articles, the embedded data-logger in Eclipse should be best deal especially if you're implementing an RCP app. (Confirm?) Anyway I'm struggling using it. The first issue I have faced is a problem with Injection: import org.eclipse.e4.core.services.Logger; @Inject private Logger logger; In an MPart it produces a null variable.
tagged with: e4
upvote count: 3
has title: Eclipse e4 - Logger Injection
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43008665
has comment: http://stackoverflow.com/comment/43007846
has comment: http://stackoverflow.com/comment/42993993
has answer: http://stackoverflow.com/a/77976513
has comment: http://stackoverflow.com/comment/43052037
score: 3

http://stackoverflow.com/comment/42804052
type: Comment
type: QuestionComment
has text: My experience with Selenium for Java is not so big. (Only have experience with FF-Addon or the suitable PHPUnit-Extension) Did you try to call `driver.findElements(By.className("addBtn"))` (consider the "s")? Maybe it clicks only the first "p.addBtn"-Element which isn't your expected one...
score: 0
comment on: http://stackoverflow.com/q/27154697

http://stackoverflow.com/a/50669754
upvote count: 6
downvote count: 0
has body: String command = "cmd /c python &lt;command to execute or script to run&gt;"; Process p = Runtime.getRuntime().exec(command); p.waitFor(); BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line; while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); p.waitFor(); System.out.println("Done."); p.destroy();
answers question: http://stackoverflow.com/q/27267391
type: Answer
score: 6

http://stackoverflow.com/comment/42841327
comment on: http://stackoverflow.com/a/27175285
score: 0
type: AnswerComment
has text: For your question Gnijuohz, there is a tool from Jboss Tattletale. Its a 1.5MB standalone program which gives the dependencies, unused jars etc. and its FREE
type: Comment

http://stackoverflow.com/q/27237323
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: collections
has body: I want to change the values of a collection of unknown type. I found java.util.Collections.replaceAll, but that works only for Lists. I helped myself creating a new new Collection and adding the changed elements. if (o instanceof Collection) { Collection&lt;Object&gt; newCollection = (Collection&lt;Object&gt;) o.getClass().newInstance(); for (Iterator&lt;Object&gt; it = ((Collection&lt;Object&gt;)o).iterator(); it.hasNext(); ) { newCollection.add(doSomethingWith(it.next())); } return newCollection; } But I liked to return the same List as result. Any ideas?
has answer: http://stackoverflow.com/a/27237458
has comment: http://stackoverflow.com/comment/42951539
tagged with: java
type: Question
has title: Replace values in a java collection

http://stackoverflow.com/q/27274302
accepted answer: http://stackoverflow.com/a/27274473
tagged with: sql-server-2008
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43017949
type: Question
has title: [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type
has answer: http://stackoverflow.com/a/27274473
has body: In my project i have used Microsoft SQLServer 2008 for creating database schema.My project is working fine in Microsoft SQLServer 2008.But when i put the same schema to Microsoft SQLServer 2000 i get the below exception and my hibernate queries are not executed.Below is the list of exceptions. could not read column value from result set: actualSt3_9_0_; [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type. SQL Error: 0, SQLState: HY000 [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type. [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to TimeSheet_Test [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'TimeSheet_Test'. [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english. Messagecould not execute query Below is the driver i am used in [Microsoft][SQLServer 2008 database.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver hibernate.dialect=org.hibernate.dialect.SQLServerDialect How to fix this issue? Any help will be greatly appreciated!!!!
tagged with: sql-server
score: 0
answer count: 1

http://stackoverflow.com/q/27312473
linked to: http://stackoverflow.com/q/10088465
tagged with: pixel
tagged with: java
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/43086181
upvote count: 0
score: -2
has body: I am a no IT person. But I am working on converting the image pixel to R,G,B code. I would like to ask you if there is any software can help. I don't know nothing about coding, so when I read some articles here, I got lost . Do you have any tool that help me? Please give me some instruction. Thanks
tagged with: rgb
has answer: http://stackoverflow.com/a/27312660
has title: convert image to rgb code
answer count: 2
has answer: http://stackoverflow.com/a/27312520
has comment: http://stackoverflow.com/comment/43085751
favorite count: 0
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/q/27242076
type: Question
tagged with: indexing
tagged with: database
has body: I am newbie to hibernate framework.To increase the performance of searching in my project i want to do index for some tables columns.As per my research,hibernate automatically indexes when performing crud operations via criteria.so is their any way to tune my search faster in hibernate and also creating index externally increase the performance of my search? Any Idea will be greatly appreciated!!!
accepted answer: http://stackoverflow.com/a/27242294
score: 0
answer count: 1
has title: How to do indexing in hibernate3
has answer: http://stackoverflow.com/a/27242294
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27322483
answers question: http://stackoverflow.com/q/27304580
type: Answer
accepted answer of: http://stackoverflow.com/q/27304580
has comment: http://stackoverflow.com/comment/52377819
has comment: http://stackoverflow.com/comment/52399472
score: 4
upvote count: 4
has body: This worked for me: Thread.currentThread().setContextClassLoader(DynamicallyLoadedClass.getClassLoader()); example: URL file = ConsultaBase.class.getProtectionDomain().getCodeSource().getLocation() .toURI().resolve("hibernate.cfg.xml").toURL(); Configuration configuration = new Configuration() .addAnnotatedClass(Registro.class).configure(file); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySettings(configuration.getProperties()) .build(); Thread.currentThread().setContextClassLoader(Registro.class.getClassLoader()); sessionFactory = configuration.buildSessionFactory(serviceRegistry);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/52380800
has comment: http://stackoverflow.com/comment/52454568

http://stackoverflow.com/q/27211388
accepted answer: http://stackoverflow.com/a/27219031
has title: How to make a KeyListener trigger for all components of a JFrame?
type: Question
possible better answer: http://stackoverflow.com/a/27211889
has comment: http://stackoverflow.com/comment/42904060
has body: I have a class, like so: public class MyFrame extends javax.swing.JFrame implements KeyListener { ... } In the constructor: addKeyListener(this); setFocusable(true); This works as long as the window itself is in focus. If I focus on a component within that window, the key listener no longer listens. I want it so that whenever the window is the active window, but regardless on which specific sub-component the focus is on, the key listener will be triggered. I wish to keep focus traversal keys, for quality of life, but they're not critical. How do I do this?
has comment: http://stackoverflow.com/comment/42908781
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/6495769
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/27219031
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27211889
tagged with: keylistener

http://stackoverflow.com/comment/42940519
has text: I'd make that with 3 grid layouts and a border layout. Is the area for buttons 1 through 6 the same as that for buttons 7 to 18?
score: 1
comment on: http://stackoverflow.com/q/27231808
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27229568
answers question: http://stackoverflow.com/q/27170089
upvote count: 1
score: 0
downvote count: 1
type: Answer
has body: No need to use frameworks, the CancelPolicy object is the main object and it should has hibernate feature (cascade) Check the Link (Cascading life cycle) So you fill the CancelPolicy object with all required relations, and say save, it will save all the graph of the related objects.

http://stackoverflow.com/comment/42806907
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27154949
type: Comment
has text: @Insane If you add width/height through css, that should be sufficient to allow clicking of the element. I'm not clear on what the failing scenario is. Are you getting a selenium exception (e.g., org.openqa.selenium.ElementNotVisibleException: element not visible) or do you have a js event listener on the element that isn't getting executed?

http://stackoverflow.com/q/27276423
has body: I am writing a message queue, but it is functioning slow, the method processFile taking too much time, and files get stuck in queue for long time. How to avoid it. System.out.println("Message Reader Started...."); do { String directoryPath = "C:\\Queue"; int fileCount = new File(directoryPath).list().length; if (fileCount &lt; 1) { System.out.println("Files Not Present"); } else { File[] file = new File(directoryPath).listFiles(); String firstFile = file[0].getAbsolutePath(); processFile(firstFile); } } while (true);
has title: Message Queue slow performance
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43221503
downvote count: 0
score: 1
type: Question
tagged with: performance
accepted answer: http://stackoverflow.com/a/27276585
tagged with: java
possible better answer: http://stackoverflow.com/a/27276935
tagged with: message-queue
answer count: 3
has answer: http://stackoverflow.com/a/27276585
upvote count: 1
has answer: http://stackoverflow.com/a/27278810
favorite count: 0
has answer: http://stackoverflow.com/a/27276935

http://stackoverflow.com/a/27163052
has comment: http://stackoverflow.com/comment/42819268
has comment: http://stackoverflow.com/comment/42819363
downvote count: 1
has body: equalsIgnoreCase is a Java String method that must be invoked on a String object. You are trying to invoke this method on a Name object, which won't work. You must invoke the helper methods within the Name class to retrieve the correct String, then invoke the equalsIgnoreCase method. Here are a couple methods for comparing the entire Name string, and the 3 parts of a Name individually. public boolean equals(Name otherName) { return (otherName.getFirst().equalsIgnoreCase(Name.getFirst()) &amp;&amp; otherName.getMiddle().equalsIgnoreCase(Name.getMiddle()) &amp;&amp; otherName.getLast().equalsIgnoreCase(Name.getLast())); } Furthermore, you could have cleaner code by using the string methods you have provided. public boolean equals(Name otherName) { return (otherName.toString().equalsIgnoreCase(Name.toString())); }
has comment: http://stackoverflow.com/comment/42819259
has comment: http://stackoverflow.com/comment/42820667
accepted answer of: http://stackoverflow.com/q/27162996
answers question: http://stackoverflow.com/q/27162996
score: 0
has comment: http://stackoverflow.com/comment/42819067
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42905587
type: Comment
has text: But the rows and columns are going to be dynamic according to the database column count . So can I customize the table accordingly if I drag and drop the table..?
comment on: http://stackoverflow.com/a/27211815
type: AnswerComment
score: 0

http://stackoverflow.com/q/27313433
favorite count: 0
tagged with: groovy
possible better answer: http://stackoverflow.com/a/27314109
has answer: http://stackoverflow.com/a/27346469
has answer: http://stackoverflow.com/a/27314109
has body: I have this code: // Write metadate.json def jsonBuilder = new groovy.json.JsonBuilder() List myTemplateFilesList = new ArrayList(); def myTemplate = new MyTemplate(module: ''+module, version: ''+version, unit: ''+unit, defaultPropertiesTargetPath: ''+targetPath) myTemplateFilesList.add(myTemplate); for (String key : keys) { def myTemplateFiles = new MyTemplateFiles(templateName: key, templateFileName: key+'.ht', targetFileName: key+'{{env}}{{client}}') myTemplateFilesList.add(myTemplateFiles); } jsonBuilder('templateFiles': myTemplateFilesList); println(jsonBuilder.toPrettyString()) class MyTemplate{ def module def version def unit def defaultPropertiesTargetPath } class MyTemplateFiles{ def templateName def templateFileName def targetFileName } My Output: { "templateFiles": [ { "unit": "WAS-WDI", "version": "20_2", "defaultPropertiesTargetPath": "defaultPropertiesTargetPath:{{user.home}}/{{component}}/deployments/{{module}}/properties", "module": "wdiCore" }, { "templateFileName": "EnvWDI.ht", "templateName": "EnvWDI", "targetFileName": "EnvWDI{{env}}{{client}}" }, { "templateFileName": "WDIHealthCheck.ht", "templateName": "WDIHealthCheck", "targetFileName": "WDIHealthCheck{{env}}{{client}}" }, { "templateFileName": "CachesWDI.ht", "templateName": "CachesWDI", "targetFileName": "CachesWDI{{env}}{{client}}" }, { "templateFileName": ".ht", "templateName": "", "targetFileName": "{{env}}{{client}}" } ] } But i want this Output: { "module": "wdiCore", "version": "20.1.1.0", "unit": "WAS-WDI", "defaultPropertiesTargetPath":"{{user.home}}/{{component}}/deployments/{{module}}/properties", "templateFiles" : [ { "templateName": "EnvWDI" , "templateFileName": "EnvWDI.ht" , "targetFileName": "EnvWDI{{env}}{{client}}" }, { "templateName": "WDIHealthCheck{env}{client}" , "templateFileName": "WDIHealthCheck.ht" , "targetFileName": "WDIHealthCheck{{env}}{{client}}" }, { "templateName": "CachesWDI" , "templateFileName": "CachesWDI.ht" , "targetFileName": "CachesWDI{{env}}{{client}…
score: 1
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Use JSON Builder with collection
accepted answer: http://stackoverflow.com/a/27346469
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/42828747
has text: @Shehlina you should be very clear when raising the issue. This i consider as follow up question. Anyways, i have edited the post for you. Please check.
type: AnswerComment
comment on: http://stackoverflow.com/a/27166302
score: 0
type: Comment

http://stackoverflow.com/a/27159190
accepted answer of: http://stackoverflow.com/q/27159172
has comment: http://stackoverflow.com/comment/42960190
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42960169
has comment: http://stackoverflow.com/comment/42936318
answers question: http://stackoverflow.com/q/27159172
type: Answer
has comment: http://stackoverflow.com/comment/42812400
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/88505422
has comment: http://stackoverflow.com/comment/42957845
has comment: http://stackoverflow.com/comment/88544508
has body: Your code creates a new object and doesn't give it a name, which means that it can't be used by main() afterwards. The code in the constructor will still run, and an object of type LwjglApplication will still be created. main() won't hold a reference to it, though. This is just like when you call a function that returns a value without assigning it to a variable: int foo() { System.out.println("Ron Paul 2016!"); return 42; } public static void main(String... args) { foo(); // will print out "Ron Paul 2016!" (w/o quotes) } Here, nothing is being done with the return value from foo() but the println() call will still run. This is commonly used when the constructor (in this case, that of LwjglApplication) has a beneficial side-effect. In your specific case, a window is being popped up as a result of the constructor. (As RafazZ said, you don't need to access the object that's being constructed because there are other ways to access it, provided through the third-party vendor's API.) As Drew Kennedy mentioned in a comment, this pattern is also used for single-use objects. Let's say you have a class that looks like this: class Foo { void bar() { // stuff that requires being in an instance, such as... System.out.println(this.getClass()); } public static void main(String... args) { (new Foo()).bar(); } } Note that the program doesn't bother assigning a name to the newly created Foo object, since it's only being used for the benefit of calling its bar() method.
has comment: http://stackoverflow.com/comment/43015174

http://stackoverflow.com/comment/42929007
type: Comment
type: QuestionComment
has text: @coreJavare The answer is not straightforward. See here: http://www.infoq.com/articles/Java-Thread-Pool-Performance-Tuning
score: 0
comment on: http://stackoverflow.com/q/27225265

http://stackoverflow.com/comment/42831457
comment on: http://stackoverflow.com/q/27153613
has text: @phtrivier Yes I am sending the items as a JSON Array. My question is what is a good way to handler changes of order on the client side? Should the client poll every x minutes to the get actual order or refresh the list by clearing and loading again. How would you do that?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43059727
type: QuestionComment
comment on: http://stackoverflow.com/q/27297654
type: Comment
has text: possible duplicate of [Runtime exception not terminating the programm](http://stackoverflow.com/questions/7635501/runtime-exception-not-terminating-the-programm)
score: 1

http://stackoverflow.com/comment/42892817
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27204883
type: Comment
has text: Thanks Jon. It wasn't HW. I wish it was.

http://stackoverflow.com/comment/42939876
type: QuestionComment
has text: @LuiggiMendoza what kind of tasks in activiti can I achieve this?
comment on: http://stackoverflow.com/q/27230792
score: 0
type: Comment

http://stackoverflow.com/comment/42915958
type: Comment
has text: Thanks! My code tends to be terribly unclear, and this helped a ton!
type: AnswerComment
comment on: http://stackoverflow.com/a/27218175
score: 0

http://stackoverflow.com/a/27264082
accepted answer of: http://stackoverflow.com/q/27263975
type: Answer
upvote count: 1
has body: No need to confuse. Your code seems correct to me. In java Wrapper classes are provided for premitive types. Java manages boxing/unboxing for those premitive type variable to their respective wrapper classes. e.g. Integer for int Long for long etc. Usually Wrapper classes (Integer) turns to useful when considered for comparing object or to perform some class level operation such as equals() and hashCode() method, and also Collection framework require Object type not premitive type.
answers question: http://stackoverflow.com/q/27263975
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42921998
score: 0
comment on: http://stackoverflow.com/q/27219860
type: Comment
type: QuestionComment
has text: @rand'Chris SElinux is disabled and nothing in the webserver log as well

http://stackoverflow.com/q/27248952
has comment: http://stackoverflow.com/comment/58705677
type: UnansweredQuestion
has body: I have a setup as follows: Machine 1 - Ubuntu - selenium hub Machine 2 - Ubuntu - selenium node Machine 3 - Windows 8.1 - selenium node To execute tests i am using RemoteWebDriver and configured Jenkins CI on hub. Issue: URL i am testing has a button that copies data to clipboard on clicking it. The data is not visible to end user unless pasted. My concern is when running locally, i am able to get system clipboard data using: strScript = (String) Toolkit.getDefaultToolkit().getSystemClipboard() .getData(DataFlavor.stringFlavor); But when triggering code from jenkins on remote machines I am unable to fetch the contents and receiving below error: java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. Its clear that it is trying to fetch data on jenkins server, but certain display issue. But my requirement is to get the data that got stored on the remote machine after clicking the button. Any solutions? Thanks.
tagged with: selenium-webdriver
tagged with: remotewebdriver
has title: Accessing data on remote machine's clipboard when running tests using selenium-webdriver
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/59361523
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/27214544
score: 1
has comment: http://stackoverflow.com/comment/42922057
has comment: http://stackoverflow.com/comment/42976967
has answer: http://stackoverflow.com/a/28090228
accepted answer: http://stackoverflow.com/a/28090228
tagged with: lotus-domino
type: Question
has comment: http://stackoverflow.com/comment/42918507
tagged with: java
has comment: http://stackoverflow.com/comment/43021734
has comment: http://stackoverflow.com/comment/43073845
has comment: http://stackoverflow.com/comment/42939453
upvote count: 1
has comment: http://stackoverflow.com/comment/42942340
answer count: 1
has title: Making local calls from Tomcat 7 to Domino 9
linked to: http://stackoverflow.com/q/26529625
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42925938
has comment: http://stackoverflow.com/comment/42942958
has comment: http://stackoverflow.com/comment/42942043
type: AnsweredQuestion
has body: I already tried to solve this problem the whole day, but haven't found a solution. I want to run an web application on Tomcat 7 that does local calls to a Domino 9 Server on the same machine. My starting point was: http://www-10.lotus.com/ldd/dominowiki.nsf/dx/DIIOP_Usage_and_Troubleshooting_Guide and other articles it links to. The Server has Ubuntu 14.04 as OS. I already solved, all the binding errors by changing /etc/default/tomcat7 JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.library.path=/opt/ibm/lotus/notes/latest/linux" #NOTES_DATA_DIR=/srvmuc202_data PATH=$PATH:/opt/ibm/lotus/notes/latest/linux:/srvmuc202_data LD_LIBRARY_PATH=/opt/ibm/lotus/notes/latest/linux #CLASSPATH=$CLASSPATH:/opt/ibm/lotus/notes/latest/linux/jvm/lib/ext/Notes.jar The notes.ini is located in the data directory. The only way I found to access it, was adding it to path. I was not able to change the CLASSPATH properly. That's why it's commented. Tomcat ignores this setting if active. Edit: I solved it, by adding the Notes.jar to my WAR file. I use the installed Notes.jar now. It works because I created a symlink to Notes.jar wihtin the Tomcat lib directory /usr/share/tomcat7/lib Here is my test code: NotesThread.sinitThread(); Session session = null; Database db = null; try { session = NotesFactory.createSession(); if (session != null) { log.debug("Session available"); log.debug("Servername: {}", session.getServerName()); log.debug("Effective user name: {}", session.getEffectiveUserName()); log.debug("User name: {}", session.getUserName()); log.debug("Common user name: {}", session.getCommonUserName()); log.debug("Notes version: {}", session.getNotesVersion()); db = session.getDatabase("", "mbur/mburchard.nsf", false); if (db != null &amp;&amp; db.isOpen()) { log.debug("Got database: {}", db.getTitle()); } } } catch (NotesException e) { log.error("", e); } finally { recycle(db); recycle(session); } NotesThread.stermThread(); Without adding data directory to t…
downvote count: 0

http://stackoverflow.com/comment/42815598
type: Comment
comment on: http://stackoverflow.com/a/27160899
type: AnswerComment
has text: edited code, the commented out code below it is now uncommented and should have been the code used for the constructor, the static values were test values.
score: 0

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/27301077
tags question: http://stackoverflow.com/q/27206599
tags question: http://stackoverflow.com/q/27252733

http://stackoverflow.com/q/27313352
accepted answer: http://stackoverflow.com/a/27313408
has title: Implementing forgot password functionality in Java
downvote count: 0
has answer: http://stackoverflow.com/a/44744557
favorite count: 0
tagged with: forgot-password
has answer: http://stackoverflow.com/a/27313422
type: AnsweredQuestion
tagged with: password-recovery
has answer: http://stackoverflow.com/a/27868504
tagged with: java
upvote count: 21
linked to: http://stackoverflow.com/q/522967
has answer: http://stackoverflow.com/a/50111552
type: Question
has body: I am currently implementing a forgot password function in a Java project. my methodology is, User clicks the forgot password link. In the forgot password page, system prompts the user to enter the email address he/she has registered in to the system. An email which contains a link to reset the password is sent to the given email address in step above. User clicks the link and he/she get redirected to a page(reset password) where user can enter his new password. In Reset Password page, the field "email address" is filled automatically and it cannot be changed. Then user enter his new password and the field related to the email address in the database is updated. Although I have restricted the email address field in the reset password page from editing (a read only field) any one can alter the url in the address bar of the browser and change the email address field. How Do I restrict every user from altering the email address in the reset password page?
possible better answer: http://stackoverflow.com/a/27868504
has answer: http://stackoverflow.com/a/27313408
linked to: http://stackoverflow.com/q/13681895
tagged with: change-password
score: 21
answer count: 6
has answer: http://stackoverflow.com/a/48630444
has comment: http://stackoverflow.com/comment/84257206

http://stackoverflow.com/a/27227405
downvote count: 0
type: AcceptedAnswer
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/27226219
has body: HTML textarea won't provide value attribute. Instead if we want to access value inside HTML area then we need to place values in between start and end tag i.e. ${event.description} Refer this textarea Documentation
accepted answer of: http://stackoverflow.com/q/27226219
has comment: http://stackoverflow.com/comment/42972881
score: 3

http://stackoverflow.com/q/27192139
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42870590
has answer: http://stackoverflow.com/a/27257394
score: 1
tagged with: java
tagged with: authentication
upvote count: 1
type: Question
has title: open a web page through java that need Authentication
has answer: http://stackoverflow.com/a/43757353
answer count: 2
has body: I am trying to open a web page that need user name and password through JAVA: page I am trying to acces this is my code copied referenced from this site : public static void main(String[] args) { try { String webPage = "https://reports.tradenetworks.com/ReportServer_DISTRIBUTORRS?%2fDealing&amp;rs:Command=ListChildren"; String name = "Tradenetworks\\USER"; String password = "PASS"; String authString = name + ":" + password; System.out.println("auth string: " + authString); byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); System.out.println("Base64 encoded auth string:" + authStringEnc); URL url = new URL(webPage); URLConnection urlConnection = url.openConnection(); urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc); InputStream is = urlConnection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); int numCharsRead; char[] charArray = new char[1024]; StringBuffer sb = new StringBuffer(); while ((numCharsRead = isr.read(charArray)) &gt; 0) { sb.append(charArray, 0, numCharsRead); } String result = sb.toString(); System.out.println("*** BEGIN ***"); System.out.println(result); System.out.println("*** END ***"); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } but I get this error from eclipse: java.io.IOException: Authentication failure at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at ConnectToUrlUsingBasicAuthentication.main(ConnectToUrlUsingBasicAuthentication.java:27)
downvote count: 0
tagged with: web
has comment: http://stackoverflow.com/comment/42871322
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42846504
has text: does this go in main?
type: AnswerComment
comment on: http://stackoverflow.com/a/27178845
type: Comment
score: 0

http://stackoverflow.com/a/27272019
has body: try this.. try{ new Thread(new Runnable() { public void run() { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://accessibility.es/prueba/script.php"); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); is = entity.getContent(); String msg = "Data entered succesfully"; Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show(); } catch(ClientProtocolException e){ Log.e("Client Protocol", "Log_tag"); e.printStackTrace(); } catch(IOException e){ Log.e("Log tag", "IOException"); e.printStackTrace(); } } }).start();
score: 0
answers question: http://stackoverflow.com/q/27271286
type: Answer
has comment: http://stackoverflow.com/comment/43013761

http://stackoverflow.com/q/27287802
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/27288951
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/27290447
tagged with: java
downvote count: 1
type: Question
tagged with: split
has body: I'm trying to regenerate the English web page into Sinhala content.Currently i did part of it. When user enter the url it will load the html page of particular webpage and it will appear as line by line with html tags. but now i want to split html tags and content separately and store them in a array list separately.My full code is given below. Can anyone give an answer to split html tags and content separately and store them into array list. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Scanner; import java.lang.String; public class Utils { public static void main(String[] args) { String url; Scanner sc = new Scanner(System.in); System.out.println("Enter the url:"); url = sc.nextLine(); try { System.setProperty("http.proxyHost", "cache.mrt.ac.lk"); System.setProperty("http.proxyPort", "3128"); //Document doc = Jsoup.connect(url).timeout(10000).get(); URL link = new URL("http://www.nlpu.com/NewDesign/NLPU_WhatIsNLP.html"); BufferedReader in = new BufferedReader(newht InputStreamReader(link.openStream())); String inputLine; String []arr; int count=0; while ((inputLine = in.readLine()) != null) { // Process each line. System.out.println("Line no :"+count++); //for(int i=0;i&lt;inputLine.length();i++){ ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add(inputLine); System.out.println(); //} for(int i=0;i&lt;list.size();i++){ System.out.println("got: "+list.get(i)); } // inputLine = inputLine.replaceAll("\\&lt;.*?\\&gt;", ""); arr = inputLine.split("&lt;.*?.&gt;"); for(String ss:arr){ System.out.print("splitted : "+ss+" "); } System.out.println(); // System.out.println(arr[]); //System.out.println(arr[2]); //String s1=("මම බත් කමි"); //list.set(0,s1); // System.out.println(""+list); } in.close(); }catch (MalformedURLException me) { System.out.println(me); } catch (IOException ioe) { System.out.println(…
has title: split and store HTML tags into Arraylist
tagged with: tags
score: -1

http://stackoverflow.com/q/27194112
has title: Methods in Java API for Lotus Notes returns Vector and not ArrayList
type: Question
has answer: http://stackoverflow.com/a/27194455
tagged with: vector
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42874145
tagged with: arraylist
answer count: 3
tagged with: lotus-notes
linked to: http://stackoverflow.com/q/1386275
accepted answer: http://stackoverflow.com/a/27194455
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/27194254
has comment: http://stackoverflow.com/comment/42874421
has answer: http://stackoverflow.com/a/27194181
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27194254
has body: If I need to retrieve the value of a field, I will need to use this function public java.util.Vector getItemValue(String name) throws NotesException Well, this method like any others in the Lotus Notes Java API returns Vector objects. In this answer is explained that Vector is obsolete. But this answer on the same question make me think that the using of Vector maybe was necessary. Although Enumerations are faster, they don't check if the collection was modified during iteration, which can cause issues, and given that Vector might be chosen for its syncronization - with the attendant access from multiple threads, this makes it a particularly pernicious problem. When we use the Lotus Notes Java API, is there any problem if we convert the resulting Vector objects to ArrayList objects? Vector&lt;String&gt; vector = (Vector&lt;String&gt;) doc.getItemValue("somefield"); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(vector); Or, in general, isn't this conversion recommended? EDIT: Just in case, I don't want/need to use Vector objects, but the methods from the Lotus Notes Java API always return that. So, I have two options: (1) always convert the Vector objects to ArrayList or any other better option, or (2) just use Vector objects. In short, my doubt is: is it safe to convert Vector objects to ArrayList in situations like this?
tagged with: java

http://stackoverflow.com/q/27219895
tagged with: java
type: Question
score: 0
has body: I a trying to create a method called singleParent() which counts the number of nodes in a BST that only have 1 child. For some reason, my singleParent() method is returning 0. My code: BinaryTree public abstract class BinaryTree { private TreeNode root; public BinaryTree() { this.root = null; } public void setRoot(TreeNode node) { this.root = node; } public TreeNode getRoot() { return this.root; } public boolean isEmpty() { return (this.root == null); } public int singleParent() { return getSingleParents(this.root, 0); } private int getSingleParents(TreeNode t, int count) { if(t != null) { if(t.getLeft() == null &amp;&amp; t.getRight() != null) count++; else if(t.getLeft() != null &amp; t.getRight() == null) count++; getSingleParents(t.getLeft(), count); getSingleParents(t.getRight(), count); } return count; } public void swapSubtrees() { doSwap(this.root); } private void doSwap(TreeNode p) { if(p != null) { TreeNode temp = p.getLeft(); p.setLeft(p.getRight()); p.setRight(temp); doSwap(p.getLeft()); doSwap(p.getRight()); } } public void inorder() { doInorderTraversal(this.root); } private void doInorderTraversal(TreeNode t) { if(t != null) { doInorderTraversal(t.getLeft()); System.out.print(t.getValue() + " "); doInorderTraversal(t.getRight()); } } public abstract void insert(Comparable item); public abstract TreeNode find(Comparable key); } // end of class And my main method: public static void main(String[] args) { BinaryTree bst = new BinarySearchTree(); bst.insert(14); bst.insert(4); bst.insert(15); bst.insert(3); bst.insert(9); bst.insert(18); bst.insert(7); bst.insert(16); bst.insert(20); bst.insert(5); bst.insert(17); int count = bst.singleParent(); System.out.println(count); } This creates a tree that looks like: 14 / \ 4 15 / \ \ 3 9 18 / / \ 7 16 20 / \ 5 17 And so count should equal 4 because there are 4 nodes that only have 1 child. Any help would be very much appreciated.
has title: Java Counting single parents in a Binary Search Tree?
answer count: 1
tagged with: binary-tree
has answer: http://stackoverflow.com/a/27219918
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/27219918
type: AnsweredQuestion

http://stackoverflow.com/a/27218461
answers question: http://stackoverflow.com/q/27217171
has comment: http://stackoverflow.com/comment/43066578
has body: From your log it looks like this is the problem: Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10050 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES. Either you need to provide the permission in the manifest or if you did it may be a bug in google play servies. If you do a google search on READ_GSERVICES you will see several items that seem to indicate this is a bug in google play services.
score: 0
type: Answer

http://stackoverflow.com/comment/81681821
type: AnswerComment
score: 0
type: Comment
has text: Excellent answer!
comment on: http://stackoverflow.com/a/40147626

http://stackoverflow.com/q/27172970
tagged with: tyrus
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42858169
answer count: 0
has comment: http://stackoverflow.com/comment/42840977
type: Question
tagged with: grizzly
has body: I'm connecting to a web socket server via my Java application using Grizzly web socket implementation. @OnError public void error(Session session, Throwable t) { Log4Me.getLogger().debug("WebSocket Error {} on session {} ", session, t); Log4Me.getLogger().error("Error on session {}, Exception:{}", session.getId(), t.getMessage()); } @OnClose public void closedConnection(Session session, CloseReason reason) { Log4Me.getLogger().info("Session closed. session: {}, Reason {}", session, reason); } @OnMessage public void onMessage(Session session, ByteBuffer message) { } @OnOpen public void onOpen(Session session) { } Most of the time it works as expected but sometimes the onError callback is caled. When I run the application after removing the @OnError annotation, I get an exception: at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:477) at org.glassfish.tyrus.core.AnnotatedEndpoint.access$100(AnnotatedEndpoint.java:87) at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:573) at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:562) at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:758) at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:187) at org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:93) at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:635) at org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:664) at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:472) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:114) at org.glassfi…
tagged with: java
score: 0
has title: Error on Java web socket implementation
tagged with: websocket

http://stackoverflow.com/q/27185588
accepted answer: http://stackoverflow.com/a/27214029
score: 0
answer count: 1
tagged with: jsp
tagged with: dojo
type: AnsweredQuestion
tagged with: java
has body: As I am trying to upload my profile pic using dojox Uploader,I am unable to upload a file using form with methods post or put(as I can update my pic).Below I have added my part of the function, request.post(url, { data: { data:domForm.toObject("profileForm"), //complete form attachment:dijit.byId("attachment")._files[0].name // attachment }, handleAs : "json", timeout: 2000, headers: { 'userId' : userId, 'companyId' : companyId, 'token' : token, "Content-Type" : "multipart/form-data", 'Accept': 'application/json' } my HTML part, &lt;form id="profileForm" enctype="multipart/form-data" action="" method="post"&gt; &lt;input name="attachment" multiple="false" type="file" data-dojo-type="dojox/form/Uploader" label="Select Some Files" id="attachment" /&gt; &lt;input type="button" class="submit" value="submit" id="profilebtnId" onclick="changeProfilePic();" /&gt; &lt;/form&gt; the Java code: @Path(UserRESTOperations.PROFILE_PIC) @POST //@PUT @Consumes({ MediaType.MULTIPART_FORM_DATA}) public Response setUserProfilePic(@PathParam(RestPathConstants.ID_PARAM) Integer userId, @Context HttpServletRequest request) {} I am able hit the API but not able pass the content(request) to the backend (java).Sorry for my grammer.
type: Question
has title: Unable to Upload a file using dojo 1.9
tagged with: javascript
has answer: http://stackoverflow.com/a/27214029

http://stackoverflow.com/comment/42814180
type: Comment
comment on: http://stackoverflow.com/a/27159456
score: 0
type: AnswerComment
has text: Added at bottom of post. Initially, the digit1...digit5 variables were local to main(), I made them global due to your method referencing them.

http://stackoverflow.com/q/27219296
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/28306933
has answer: http://stackoverflow.com/a/43378560
has title: Cannot resolve method openFileInput (Android Development)
tagged with: java
has body: I'm getting a 'cannot resolve method' error with the line of code: FileInputStream fis = openFileInput(fileName); I'm not in an acitivty I'm in a seperate class so I'm assuming that's why it won't work. I've tried doing things like this but they still give me the 'cannot resolve method error: FileInputStream fis = getApplicationContext.openFileInput(fileName); Thanks for any help, I'm new to android development
type: Question
score: 5
upvote count: 5

http://stackoverflow.com/comment/119802647
has text: You can iterate through the `ArrayList` to convert each `LinkedTreeMap` item to a `Product` item. You can use `Gson` a second time to do the conversion. See example code here: https://randomgyan.com/mapping-linkedtreemap-response-to-class-using-gson-utility/
score: 0
comment on: http://stackoverflow.com/q/27253555
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42916380
type: QuestionComment
comment on: http://stackoverflow.com/q/27218370
score: 1
has text: @necromancer I closed this question as a duplicate of the question with three answers, because the second paragraph of [the accepted answer](http://stackoverflow.com/a/8353371/1247781) addresses exactly when to use protected and what to keep in mind when doing so. That question itself asks when to use private and when to use protected, making this one a duplicate.
type: Comment

http://stackoverflow.com/a/27214829
has comment: http://stackoverflow.com/comment/42910200
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27214795
downvote count: 0
has comment: http://stackoverflow.com/comment/42910268
has body: Your login URL should be http://localhost/BCASStudentInfo/login.php rather than localhost/BCASStudentInfo/login.php

http://stackoverflow.com/comment/43075168
score: 3
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27306327
has text: This is a decision only you, the programmer, can make.

http://stackoverflow.com/a/27295251
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43058412
has comment: http://stackoverflow.com/comment/43067166
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43058213
has comment: http://stackoverflow.com/comment/43057860
has body: Obviously you can't do that because the DTD won't allow you. Another good example of the XY problem: The XY problem is asking about your attempted solution rather than your actual problem. That is, you are trying to solve problem X, and you think solution Y would work, but instead of asking about X when you run into trouble, you ask about Y. What you really need is to define a group of actions running free, and other groups running under login control. For this, you can manually include the Interceptor in each single action (useful when using the Convention plugin, a waste of time otherwise), or configuring the actions logically in the struts.xml. The is your friend here: define two (or more) packages, one running with the default settings, the other running your custom Interceptor for each action of the package: ... ... <interceptor name="authInterceptor" class="org.foo.bar.interceptor.AuthInterceptor"/> <interceptor-ref name="authInterceptor"/> <interceptor-ref name="defaultStack"/> <default-interceptor-ref name="securedStack"/> ... ... This way every time you or somebody else will add an Action in struts.xml, it will just need to drop it in the right package, and it will work automatically. It's better to keep the Interceptor action-agnostic whenever possible ;)
score: 1
accepted answer of: http://stackoverflow.com/q/27293579
has comment: http://stackoverflow.com/comment/43058133
has comment: http://stackoverflow.com/comment/43069624
answers question: http://stackoverflow.com/q/27293579

while-loop
tags question: http://stackoverflow.com/q/27202171
tags question: http://stackoverflow.com/q/27272276
tags question: http://stackoverflow.com/q/27298551
type: Tag
tags question: http://stackoverflow.com/q/27200512
tags question: http://stackoverflow.com/q/27195039
tags question: http://stackoverflow.com/q/27281057
tags question: http://stackoverflow.com/q/27195693
tags question: http://stackoverflow.com/q/27297518
tags question: http://stackoverflow.com/q/27196955
tags question: http://stackoverflow.com/q/27194445
tags question: http://stackoverflow.com/q/27218942
tags question: http://stackoverflow.com/q/27219354
tags question: http://stackoverflow.com/q/27189545
tags question: http://stackoverflow.com/q/27306377
tags question: http://stackoverflow.com/q/27242283
tags question: http://stackoverflow.com/q/27194586
tags question: http://stackoverflow.com/q/27257495
tags question: http://stackoverflow.com/q/27282703
tags question: http://stackoverflow.com/q/27292459
tags question: http://stackoverflow.com/q/27198826
tags question: http://stackoverflow.com/q/27215248
tags question: http://stackoverflow.com/q/27173246
tags question: http://stackoverflow.com/q/27205368
tag name: while-loop
tags question: http://stackoverflow.com/q/27181038
tags question: http://stackoverflow.com/q/27303285

http://stackoverflow.com/comment/42971924
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27247974
has text: I did but it doesn't work. For example if i do extraction by id I get an error that abstract object cannot be directly instantiated. It seems that repository configured in a way you suggest doesn't know what class to use to map returned value. If it works for you, can you explain your configuration in more detail, please?

http://stackoverflow.com/a/27270885
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27270777
score: 0
type: Answer
has body: finalize() is called when the jvm going to gc. so maybe the resource is not released as you wish. use try finally instead.
has comment: http://stackoverflow.com/comment/43012570

http://stackoverflow.com/comment/43046830
type: QuestionComment
comment on: http://stackoverflow.com/q/27290285
score: 0
has text: exactly ...if you have any codes procedures to do that?
type: Comment

http://stackoverflow.com/comment/42881617
has text: Is there a better way to do this?
type: Comment
comment on: http://stackoverflow.com/a/27198581
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42894520
has text: what container do you use? what is your persistence provider?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27205894

http://stackoverflow.com/a/27199302
has comment: http://stackoverflow.com/comment/42884920
score: 1
has body: You are probably using version 2.5.1 or lesser of the Maven Compiler Plugin. If you use version 3.0, you actually get more detailed error messages: [ERROR] required: java.lang.String,java.lang.String [ERROR] found: int,int [ERROR] reason: actual argument int cannot be converted to java.lang.String by method invocation conversion
accepted answer of: http://stackoverflow.com/q/27197818
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27197818
type: Answer
downvote count: 0

http://stackoverflow.com/q/27238085
type: UnansweredQuestion
has body: What I want to accomplish is a sane way of storing a list of the pages visited during each anonymous user session on my website. It is important that the sequence is correct and that one users navigation is not mixed up with another ones. It is similar to this C# question: "track visitor info on every request", where they proposed to use a logfile for short-term storage. My site will only host ~2K users/day so I think I would be fine with having the cache in memory (atleast that seems easier). I cant seem to figure out a solution that will work with the stateless Play framework since the solution requires saving data(to DB) only when an user has timed out and is not active anymore. My idea would rely on storing each request in memory and then call the database if a new request hasnt arrived in a certain time (user timeout). How would it be possible to do that? Is there any other way you think might be better, perhaps storing all the requests from all users and then making a big write to db instead of one for each session? EDIT: I have now taken the easy way out, it would have been great to do what Salem mentioned but I cant figure out how to save a list to memory. My first plan was actually to use the Akka scheduler that would be altered (timer reset and a new post added) each time the user gets a new page but I simply dont know how to get in touch with a instance ion memory from a previous request so if someone could tell me that I would be very grateful. For now I have solved my problem the "bad way" with requests to database for each page view. Code below in case someone also wanna be bad: In the Action: String uuid=session("uuid"); Logger.info("Old uuid:"+uuid); String generatedId = UserTracker.updateTracker(uuid,id.toString()).toString(); if(uuid==null || !generatedId.equals(uuid)){ Logger.info("new UUID for user:"+generatedId); session("uuid", generatedId); } UserTracker class: @Entity public class UserTracker extends Model { @Id @SequenceGenerator(name="ut_ge…
linked to: http://stackoverflow.com/q/5778412
tagged with: logging
tagged with: playframework-2.0
score: 3
downvote count: 0
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/42954301
type: Question
tagged with: playframework
has comment: http://stackoverflow.com/comment/42969390
upvote count: 3
has comment: http://stackoverflow.com/comment/43019209
favorite count: 0
has title: Track visitors in play framework 2 application,caching and saving to DB
answer count: 0

http://stackoverflow.com/comment/43059429
score: 0
type: Comment
has text: Are we talking about a new project or an existing one that you want to import? In case it's a new project: Why still using Eclispe for Android development, instead of Android Studio? Don't get me wrong, I don't wanna start a Pepsi/Coke discussion, but you'll save yourself A LOT of hassle if you switch to AS and gradle.
type: QuestionComment
comment on: http://stackoverflow.com/q/27297511

http://stackoverflow.com/comment/43043015
type: Comment
has text: In that case you'll need to change the jetty.xml to use your custom manager. Make sure to enable ssl through configuration and jetty.xml. Because of this you can alter the default config. Details can also be found at pax web documentation or samples and integration tests.
type: AnswerComment
comment on: http://stackoverflow.com/a/27280538
score: 0

http://stackoverflow.com/q/27274417
score: 0
answer count: 1
has body: I use ConcurrentRadixTree and put > 1 million words into it. The creation of this tree takes much time, so I thought about creating my tree only once and save it as a file -> so I can load my tree from file for next use instead of create it again (which should be much faster). File file = new File(myPath); FileOutputStream f = new FileOutputStream(file); ObjectOutputStream s = new ObjectOutputStream(f); s.writeObject(myTree); s.close(); But when I try to store, I get "NotSerializableException": Exception in thread "main" java.io.NotSerializableException: com.googlecode.concurrenttrees.radix.ConcurrentRadixTree at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at ForTests.main(Test.java:29) Any idea how to store a RadixTree?
has answer: http://stackoverflow.com/a/27274688
type: UnansweredQuestion
has title: save RadixTree as file
type: Question
tagged with: tree
tagged with: java

http://stackoverflow.com/comment/42811858
type: AnswerComment
has text: Additional: As OP is asking about getting these values during initialization it's worth pointing out that they're only available during request handling - the way you're documenting here. Naturally, a single host can have many different names, and there's no limit for the appserver on the number of ports that it makes available (though it's typically only one).
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27157418

http://stackoverflow.com/comment/42946956
score: 0
has text: @brso05 - Nowhere did I mention Javascript. It was only mentioned once in this thread, until you brought it up again.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27234519

http://stackoverflow.com/a/27224365
downvote count: 0
has body: It is possible that the current eclipse process keep an handle on the pack file, preventing its deletion. As Rüdiger Herrmann suggests in the comments: If the open file handle is what prevents the file from being deleted, make sure to close the repository that is returned by init: clone.getRepository().close() Another approach would be to download an archive of the GitHub repo through its archive link. Or using JGit to create an archive from your current local repo (see ArchiveTest.java), and unzip that archive for you to use.
accepted answer of: http://stackoverflow.com/q/27224283
type: Answer
has comment: http://stackoverflow.com/comment/42928033
answers question: http://stackoverflow.com/q/27224283
upvote count: 5
has comment: http://stackoverflow.com/comment/42928604
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/43083461
comment on: http://stackoverflow.com/q/27311179
type: QuestionComment
type: Comment
has text: You can use maven central's search by class name to find the artifacts that contain a particular class: http://search.maven.org/#advancedsearch|gav
score: 0

http://stackoverflow.com/a/27213681
has body: You can build a collection of your json object elements by calling the getElementsAnnotatedWith(JsonField.class) method and filering the result based on the annotation of the enclosing element. Here is a complete example (using runtime annotation processing for simplicity): @SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedAnnotationTypes("*") public class ElementFilterProcessor extends AbstractProcessor { @Retention(RetentionPolicy.RUNTIME) public static @interface JsonObject {} @Retention(RetentionPolicy.RUNTIME) public static @interface JsonField { String value(); } @JsonObject public class Name { @JsonField("last") public String last; @JsonField("first") public String first; } @JsonObject public class User { @JsonField("age") public int age; @JsonField("name") public String name; @JsonField("sex") public boolean sex; } public static void main(String[] args) { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); final JavaCompiler.CompilationTask task = compiler.getTask( null, null, null, null, Collections.singleton(ElementFilterProcessor.class.getName()), Collections.EMPTY_SET); task.setProcessors(Collections.singleton(new ElementFilterProcessor())); task.call(); } @Override public boolean process( final Set&lt;? extends TypeElement&gt; annotations, final RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return true; } final Set&lt;? extends Element&gt; jsonFields = roundEnv.getElementsAnnotatedWith(JsonField.class); final Map&lt;Element, List&lt;Element&gt;&gt; jsonObjects = new HashMap&lt;&gt;(); for (final Element element : jsonFields) { final Element classElement = element.getEnclosingElement(); if (classElement.getAnnotation(JsonObject.class) != null) { List&lt;Element&gt; list = jsonObjects.get(classElement); if (list == null) { list = new ArrayList&lt;&gt;(); jsonObjects.put(classElement, list); } list.add(element); } } System.out.println(jsonObjects); return false; } } Output: {stackoverflow.annotation.ElementFilterProcessor…
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27210759
answers question: http://stackoverflow.com/q/27210759
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42922873
upvote count: 1

http://stackoverflow.com/comment/43051947
has text: in the place of System.out.println(item), its coming as Dog and Rat.I need Dog Cat Rat
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27293168

http://stackoverflow.com/q/27280015
has comment: http://stackoverflow.com/comment/43028825
upvote count: 2
has title: IPv6 only socket in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43028970
has answer: http://stackoverflow.com/a/27280111
has body: Is it possible to create a socket in java that binds only to ipv6 addresses? I want to know if I can have 2 sockets on a machine such that one binds to ipv4 addresses and the other binds to ipv6 addresses only. Networking IPv6 User Guide for JDK/JRE 5.0 explains how ipv6 works on a Java platform but doesn't say anything about ipv6 only sockets. Are they even possible? I can't set the global IPV6_V6ONLY property.
has comment: http://stackoverflow.com/comment/43029799
tagged with: java
has comment: http://stackoverflow.com/comment/43028860
type: Question
has comment: http://stackoverflow.com/comment/43028803
answer count: 2
tagged with: ipv6
score: 2
linked to: http://stackoverflow.com/q/494465
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43035419
tagged with: sockets
tagged with: ip-address
linked to: http://stackoverflow.com/q/19314241
has answer: http://stackoverflow.com/a/46266258

http://stackoverflow.com/comment/42891580
type: QuestionComment
comment on: http://stackoverflow.com/q/27198826
score: 1
has text: See: [Loop doesn't see changed value without a print statement](https://stackoverflow.com/questions/25425130/loop-doesnt-see-changed-value-without-a-print-statement)
type: Comment

http://stackoverflow.com/a/27182320
answers question: http://stackoverflow.com/q/27182122
has body: To do this manually, come up with a scope of what you want to achieve/learn so that you can find out which libraries you want to use. Otherwise, there are too many jars to deal with. Download the specific jar files and make sure they are available in the classpath of your project. That's all you need to create a project by manually importing jar files. As far as maven goes, it will make your life easier as it handles all dependencies for you. When you use one component of spring, it can use 5 other jar files (which you will have to import manually if you don't use maven). In such case, you can tell maven which spring component you want to use and it will sort out the dependencies for you.
score: 0
type: Answer

http://stackoverflow.com/q/27202043
accepted answer: http://stackoverflow.com/a/27202083
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/48756843
has comment: http://stackoverflow.com/comment/42887347
has answer: http://stackoverflow.com/a/27704498
has answer: http://stackoverflow.com/a/27202083
tagged with: date-format
possible better answer: http://stackoverflow.com/a/27202142
answer count: 4
type: AnsweredQuestion
has body: I have a String in format "YYYY-MM-dd" and i want convert this into "MMM dd, yyyy" format. I used bellow code to do this; But when i convert "2014-11-18" the output is this "Sun Dec 29 00:00:00 IST 2013" How can I solve this? DateFormat target=new SimpleDateFormat("MMM dd, yyyy"); String P_date="2014-11-18" Date test1 = new SimpleDateFormat("YYYY-MM-dd").parse(P_date); String converted_date=target.format(test1); Date test=target.parse(converted_date);
has title: Error when converting date format to another
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/17225948
has comment: http://stackoverflow.com/comment/42892712
tagged with: jdatechooser
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/27202142
score: 0

http://stackoverflow.com/comment/42817905
type: QuestionComment
has text: I understand this and not worried about objects for which i am holding references as these are architectural decisions. Finding out reference of garbage in code and then deducting is herculean task
comment on: http://stackoverflow.com/q/27162134
score: 0
type: Comment

http://stackoverflow.com/comment/42998369
type: AnswerComment
comment on: http://stackoverflow.com/a/27247315
score: 0
has text: I tried using both true/false but that too dosen't make the difference.
type: Comment

http://stackoverflow.com/comment/102224506
type: Comment
has text: This is what easy and acceptable answer of this question. thanks @russelhoff
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/37137209

http://stackoverflow.com/comment/42855067
has text: I've never worked with this, but maybe you should use something other than the `DefaultGroupSequenceProvider<?>`? Basically you mean you don't want the error to be returned in sequences, so use something else?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27173960

http://stackoverflow.com/comment/43085733
comment on: http://stackoverflow.com/q/27311049
score: 0
type: Comment
has text: Thanks I change Jcommon and restart my server now its worked.
type: QuestionComment

http://stackoverflow.com/a/27211791
score: 1
has comment: http://stackoverflow.com/comment/42906269
type: Answer
has body: The is no default line separator system like line.separator, however you can create one yourself (say sql.line.separator) and populate it in the command line java -Dsql.line.separator=... When have you noticed the need? most databases accept ; as command separator and ususally this is what you need.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27211762
answers question: http://stackoverflow.com/q/27211762
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42989891
score: 0
type: Comment
type: QuestionComment
has text: No, I don't think so. The Notes client was installed freshly.
comment on: http://stackoverflow.com/q/27245021

http://stackoverflow.com/comment/42953774
type: Comment
has text: I have a linha.xml as the xml for the lines in the ListView. Did i load it correctly?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27238544

set
tags question: http://stackoverflow.com/q/27282401
tags question: http://stackoverflow.com/q/27161160
tags question: http://stackoverflow.com/q/27190363
type: Tag
tags question: http://stackoverflow.com/q/27175963
tag name: set
tags question: http://stackoverflow.com/q/27203594
tags question: http://stackoverflow.com/q/27274612
tags question: http://stackoverflow.com/q/27200761

http://stackoverflow.com/comment/42903563
type: QuestionComment
comment on: http://stackoverflow.com/q/27210280
has text: Nothing fundamental has changed with regard to string interning in Java 7 and 8 compared to older versions.
score: 1
type: Comment

http://stackoverflow.com/comment/42943793
comment on: http://stackoverflow.com/a/27233494
type: AnswerComment
type: Comment
has text: Another way is to use bytecode injection with a library like [ASM](http://asm.ow2.org) or [Javassist](http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist)
score: 2

http://stackoverflow.com/comment/43165463
score: 0
type: Comment
type: QuestionComment
has text: The servlet will get called several times, even parallel. So a servlet should best use only local variables, fields are probably bugs. Maybe you mean using a common counter (AtomicInteger?) for adaptive throttling and such. Needs to be error prone, like a counter for a car park deck / parking lot. There are many optimizations, like applying the ALOHA sat system: time slots for reading the same file only once, and then delivering them to several requests. In your case I would wait; maybe check out a load test tool.
comment on: http://stackoverflow.com/q/27269850

http://stackoverflow.com/q/27215321
downvote count: 1
type: Question
upvote count: 0
answer count: 1
tagged with: minecraft
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/27215403
type: UnansweredQuestion
has title: Minecraft Modpack error on join
has comment: http://stackoverflow.com/comment/42910848
has comment: http://stackoverflow.com/comment/42910613
has body: I have been trying to create my first modpack using the technic launcher and have run into an issue I can not seem to fix. My server boots up and gets to the point where you can type commands in it without crashing, and the modpack launches with no issues. However when I try to connect to the server I get the error The following multiparts are not installed on this client: ConduitEnergy0, ConduitEnergy1, ConduitEnergy2, ConduitFluid0, ConduitFluid1, ConduitItem0, ConduitItem1, ConduitItem3, XU:MagnumTorch, extrautils:fence, extrautils:pipe:Jacket............ clientside. Any help would be much appreciated
tagged with: java

http://stackoverflow.com/q/27202673
score: 1
favorite count: 0
has title: JAVA: Using select in the client side
tagged with: sockets
upvote count: 1
has body: I want to connect a client to many servers and receive the first answer from one of them. So I decided to use select. I created a socket with each server and I registered those sockets in a selector. But it didn't work. Here's where there is a problem in my code: Selector selector = Selector.open();// int i; for(i=0;i&lt;serveurs.size();i++)//I have an arraylist of servers { Socket s=new Socket(serveurs.get(i).getIP(),port);//creating a socket with the server number i sc=s.getChannel();//here's the problem: sc is null sc.configureBlocking(false);//exception here because sc=null sc.register(selector, SelectionKey.OP_READ);//register the socket channel to recieve data form the server } selector.select(); // reading data in the socket registered in the selector So what can I do to solve this problem ?
answer count: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/34518225
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/42990725
has text: You write "we have created a restful web service" to accept test results. At some point please consider whether an off-the-shelf solution like Jenkins meets your requirements. http://jenkins-ci.org
type: QuestionComment
comment on: http://stackoverflow.com/q/27256768
type: Comment
score: 1

http://stackoverflow.com/comment/43034838
comment on: http://stackoverflow.com/q/27283084
type: QuestionComment
type: Comment
has text: @AlexWien Hi, thanks for pointing out that it is replaceAll, any ideas why replaceAll isn't replacingAll
score: 0

http://stackoverflow.com/q/27212614
tagged with: user-interface
answer count: 1
has body: I have an application say two major GUIs (College-JFrame and Department-JFrame). There is JButton - ManageDepartmentButton - that opens the Department-JFrame. I want College-JFrame GUI to freeze or non-clickable when ever Department-JFrame is open. And after Department-JFrame is closed I want to restore / un-freeze the College-JFrame. Is there a way to do this? How? Or any work around?
has answer: http://stackoverflow.com/a/27212622
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: Freeze on JFrame while other is Open
accepted answer: http://stackoverflow.com/a/27212622
type: Question
linked to: http://stackoverflow.com/q/9554636
score: 0

http://stackoverflow.com/comment/42955981
has text: *"..need to run this application on a IIS server and the JSP doesn't work in this condition."* IIS supports ASP doesn't it?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27234976

http://stackoverflow.com/a/27198755
has body: You can repaint by calling repaint(). You can do this in a loop by creating a timer to repaint it, or just call it when it needs to be updated (probably better if your code is simple enough) EDIT: About when to use a timer: The timer is not necessary. I used it in a game once because I was custom painting the entire window and there were dozens of always-changing things to paint, and calling render() every time would not make my CPU happy. For something simple, though, it is better to call repaint() only when something changes, because if nothing changed, you are wasting that much time repainting it.
type: Answer
accepted answer of: http://stackoverflow.com/q/27198733
has comment: http://stackoverflow.com/comment/42881891
has comment: http://stackoverflow.com/comment/42881943
upvote count: 3
answers question: http://stackoverflow.com/q/27198733
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42881882

http://stackoverflow.com/q/27177818
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/27177840
score: 2
has body: I have updated my Java recently and since then i can not press "run" (the green arrow) anymore. I tried to reinstall Intellij but it did not work.
type: AnsweredQuestion
has title: Can not press "run" in Intellij idea
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42844544
tagged with: intellij-idea
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27177840

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/27208040

http://stackoverflow.com/comment/43024388
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27257983
has text: No problem, my feeling is that your issue (which is common btw and solved from the client startup params in say jenkins) will not be solved without some file insertion/jvm parameter control from maven. The server in this instance is fine.

http://stackoverflow.com/comment/42819160
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27163081
type: AnswerComment
has text: You've got two helper methods which can provide you all of the fields that you care about in one go. Why not use them instead? Also, why `return true` with a `return false` outside of it? Just return the boolean comparison.

http://stackoverflow.com/q/27303639
has comment: http://stackoverflow.com/comment/43070264
has comment: http://stackoverflow.com/comment/43070299
answer count: 1
has comment: http://stackoverflow.com/comment/43070757
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43070423
has answer: http://stackoverflow.com/a/27303704
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27303704
has title: How to make a jButton do one thing at first click and another at second?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43070269
has body: When I press the button the first time it's supposed to display a message, but the next time I am to press it it should do it's normal use. private void jButton1ActionPerformed (java.awt.event.ActionEven evt) { jTextArea1.setText(jTextArea1.getText()+"Let the battle begin!\n"); Basically that is what I want it to do at first click, as well as: if (jProgressBar1.getValue() &gt; 0) { if (publicInt.rndNum() &gt; 90) } etc, etc.. EDIT: This is what I did to make it work, thanks to a commenter. if (publicInt.startPhrase() == true) { jTextArea1.setText("The battle has begun!\n"); publicInt.sp = false; }

http://stackoverflow.com/a/27219284
has comment: http://stackoverflow.com/comment/42917979
has comment: http://stackoverflow.com/comment/42917920
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42917846
accepted answer of: http://stackoverflow.com/q/27218981
score: 0
answers question: http://stackoverflow.com/q/27218981
type: Answer
has comment: http://stackoverflow.com/comment/42917868
has body: You have to think about how you are going to tell which elements are "similar" to the user's input. Coming to my mind : Elements containing 1 or all words from input. Elements containing whole chain. Elements containing all letters, no care about order. When you know what algorithm you want, implementing it should then be easy, but you first need to ask yourself those questions before writting any code.

http://stackoverflow.com/q/27302504
tagged with: network-programming
has body: TCP socket in java can be used to connect to a server without binding it manually. final Socket socket = SocketChannel.open().socket(); socket.connect(StaticData.vmAddress); //can send receive data But when using a DataGramSocket, there seems to be no auto-bind facility. I tried this : DatagramSocket socketTest1 = DatagramChannel.open().socket(); socketTest1.connect(InetAddress.getByName(stunServer), stunServerPort); socketTest1.setSoTimeout(timeout); byte[] data = sendMH.getBytes(); DatagramPacket send = new DatagramPacket(data, data.length); socketTest1.send(send); //got error at this point The stacktrace : java.net.BindException: bind failed: EINVAL (Invalid argument) W/System.err﹕ at libcore.io.IoBridge.bind(IoBridge.java:89) W/System.err﹕ at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:68) W/System.err﹕ at java.net.DatagramSocket.ensureBound(DatagramSocket.java:422) W/System.err﹕ at java.net.DatagramSocket.send(DatagramSocket.java:263) W/System.err﹕ at java.nio.DatagramChannelImpl$DatagramSocketAdapter.send(DatagramChannelImpl.java:559) W/System.err﹕ at reach.project.stun.test.DiscoveryTest.test1(DiscoveryTest.java:103) //(socketTest1.send(send) line) It would be really helpful if I can rely on auto-bind in DatagramSocket as well. Is there anyway to do this ?
has answer: http://stackoverflow.com/a/27303570
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27303570
tagged with: sockets
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has title: AutoBind DatagramSocket like TCP Socket in java
type: Question
tagged with: datagram

http://stackoverflow.com/comment/42834940
has text: I think it's more that it's less practical for many deployment models as you have to modify the JRE itself.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27168951
score: 2

http://stackoverflow.com/a/27214559
has body: I'm going to make this quick and dirty. Unfortunately, in Java you'll have to write more code to produce the same results. I've split the code into 3 sections: an interface which kind of resembles the delegate declaration class A which contains the event declaration, subscription logic and raise logic class B which is the "event consumer" and which declares the event handler Good luck! // this is what you used to have as a delegate declaration { public interface IWorkCompletedListener { public void someMethodName(Object sender, Object args); } // } // class A will be the event provider public class A { // this is what you used to have for an event declaration { // used for the storage of listeners private static Vector&lt;IWorkCompletedListener&gt; workComplete = new Vector&lt;IWorkCompletedListener&gt;(); // used for += public static void addWorkCompleteListener(IWorkCompleteListener listener) { A.workComplete.add(listener); } // used for -= public static void removeWorkCompleteListener(IWorkCompleteListener listener) { A.workComplete.remove(listener); } // } // this is what you would use to raise the event { private static void raiseWorkCompletedListener(Object sender, Object args) { for (IWorkCompletedListener listener : A.workComplete) listener.someMethodName(sender, args); } // } // and the test code public static void doWork() { // Stuff goes here A.raiseWorkCompletedListener(null, null); } } // class B will be the event consumer public class B { public static void subscribeAndCallDoWork() { // this is what += used to be A.addWorkCompleteListener(new IWorkCompletedListener { public void someMethodName(Object sender, Object args) { // I didn't want to force class B to implement the interface // hence I used an anonymous interface implementation // from which I'm calling the "event handler" B.onWorkCompleted(sender, args); } }); A.doWork(); } private static onWorkCompleted(Object sender, Object args) { // expect to be called here } }
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27214390
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27214390

return
tags question: http://stackoverflow.com/q/27168571
type: Tag
tags question: http://stackoverflow.com/q/27197191
tags question: http://stackoverflow.com/q/27222417
tags question: http://stackoverflow.com/q/27238689
tags question: http://stackoverflow.com/q/27293080
tag name: return
tags question: http://stackoverflow.com/q/27159485
tags question: http://stackoverflow.com/q/27283591
tags question: http://stackoverflow.com/q/27156447
tags question: http://stackoverflow.com/q/27183708
tags question: http://stackoverflow.com/q/27246190

http://stackoverflow.com/a/27238935
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27237936
answers question: http://stackoverflow.com/q/27237936
upvote count: 3
type: AcceptedAnswer
has body: One thing I can see so far: You didn't initialise listaDados with a value, Can be done here: @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Cinema.this); pDialog.setMessage("Carregando..."); pDialog.setCancelable(false); pDialog.show(); listaDados = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); }
type: Answer

http://stackoverflow.com/comment/42996522
has text: Your `StickFigureComponent` has no preferred size, so the layout manager is likely not applying a size to it...
type: Comment
comment on: http://stackoverflow.com/q/27261822
score: 1
type: QuestionComment

http://stackoverflow.com/a/27287709
answers question: http://stackoverflow.com/q/27284261
accepted answer of: http://stackoverflow.com/q/27284261
has comment: http://stackoverflow.com/comment/43066078
type: AcceptedAnswer
score: 0
type: Answer
has body: Chances are you need some proxy settings in your ~/.m2/settings.xml file. Have a look at Configuring a proxy. However, a much better solution would be to use an internal Maven repository manager, such as Artifactory or Nexus which has been setup to mirror maven central with centralised proxy settings in it.

http://stackoverflow.com/comment/42910871
comment on: http://stackoverflow.com/q/27215433
score: 0
type: QuestionComment
type: Comment
has text: yes, let me just add that..

http://stackoverflow.com/comment/43033438
type: Comment
type: QuestionComment
score: 0
has text: http://msdn.microsoft.com/en-us/library/system.threading.thread.isbackground(v=vs.110).aspx
comment on: http://stackoverflow.com/q/27282515

http://stackoverflow.com/comment/43078768
comment on: http://stackoverflow.com/q/27308362
has text: If you could describe the problem you're seeing - that is, what result you're getting, compared with the result you expected - that would make it a lot easier for us to help you.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/27309028
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43081604
has comment: http://stackoverflow.com/comment/43080872
has comment: http://stackoverflow.com/comment/43079781
answers question: http://stackoverflow.com/q/27308966
upvote count: 3
has comment: http://stackoverflow.com/comment/43080323
has comment: http://stackoverflow.com/comment/43080229
has body: If the above document is relatively small, you could load the entire document and then apply the below xpath to extract the keys in the document: //record/key_data/key[name='userid']/value Edit I think you have a bug - use getTextContent() to obtain text(), not getNodeValue(): for (int i = 0; i &lt; nodes.getLength(); i++) { usrlist.add( nodes.item(i).getTextContent()); } Debug Code: Set&lt;String&gt; usrlist = new HashSet&lt;String&gt;(); String myXml = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n" + "&lt;response&gt;\n" + ... "&lt;/response&gt;"; InputStream is = new ByteArrayInputStream( myXml.getBytes( ) ); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new InputSource(rd)); XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); XPathExpression expr = xpath.compile("//record/key_data/key[name='userid']/value"); NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); for (int i = 0; i &lt; nodes.getLength(); i++) { usrlist.add( nodes.item(i).getTextContent()); } return usrlist;
type: Answer

http://stackoverflow.com/q/27214836
has answer: http://stackoverflow.com/a/27214916
has body: I have an assignment to calculate the amount of carbon dioxide produced in a year from a household and compare how recycling can reduce its CO2 Footprint. There are two classes in the program, CO2FromWaste, and CO2FromWasteTester. The first class, CO2FromWaste is: public class CO2FromWaste { //declaration of private instance variables private int numPeople; private boolean Paper, Plastic, Glass, Cans; private double grossWasteEmission, wasteReduction, netWasteReduction; //constructor CO2FromWaste(int people, boolean paper, boolean plastic, boolean glass, boolean cans){ numPeople = people; Paper = paper; Plastic = plastic; Glass = glass; Cans = cans; grossWasteEmission = 0.0; wasteReduction = 0.0; netWasteReduction = 0.0; } public void calcGrossWasteEmission(){ grossWasteEmission = numPeople * 1018; } public double getGrossWasteEmission(){ return grossWasteEmission; } public void calcWasteReduction(){ if (Paper == true){ wasteReduction = numPeople * 184; } if (Plastic == true){ wasteReduction += (numPeople * 25.6); } if (Glass == true){ wasteReduction+= (numPeople*46.6); } if (Cans == true){ wasteReduction+=(numPeople*165.8); } } public double getWasteReduction() { return wasteReduction; } public void calcNetWasteReduction(){ netWasteReduction = grossWasteEmission = wasteReduction; } public double getNetWasteReduction(){ return netWasteReduction; } public int getNumPeople(){ return numPeople; } public boolean getPaper(){ return Paper; } public boolean getPlastic(){ return Plastic; } public boolean getGlass(){ return Glass; } public boolean getCans(){ return Cans; } } The second class, CO2FromWasteTester is: import java.util.ArrayList; public class CO2FromWasteTester { public static void main(String[]args){ ArrayList&lt;CO2FromWaste&gt; waste = new ArrayList&lt;CO2FromWaste&gt;(); waste.add(new CO2FromWaste(1, true, true, true, true)); waste.add(new CO2FromWaste(3, true, false, true, true)); waste.add(new CO2FromWaste(4, false, false, false, false)); waste.add(new CO2…
accepted answer: http://stackoverflow.com/a/27214916
tagged with: java
type: Question
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/27214897
favorite count: 0
has comment: http://stackoverflow.com/comment/42909763
has title: JAVA Wrong output in object array program (beginner)
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27214897
has answer: http://stackoverflow.com/a/27215009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42909797

http://stackoverflow.com/q/27306309
accepted answer: http://stackoverflow.com/a/27306335
answer count: 1
downvote count: 0
favorite count: 0
tagged with: parsing
tagged with: android
has title: Unparseable date exception, can't find pattern for 2014-11-28T13:46:23-08:00
has body: I'm trying to parse 2014-11-28T13:46:23-08:00 to a java.util.Date For the simpledateformat so far I've tried: yyyy-MM-dd'T'HH:mm:ss yyyy-MM-dd HH:mm:ss yyyy-MM-dd works but I need at-least precision to the minute. What pattern should I be using to parse this date?
linked to: http://stackoverflow.com/q/10614771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27306335
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java.util.date

http://stackoverflow.com/q/27217914
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27217988
upvote count: 1
type: Question
score: 1
has body: Imagine that I have 4,81 (double), how can i get the figures after the comma? I want to receive 8 as a Integer and 1 as another. Thanks
tagged with: java
has comment: http://stackoverflow.com/comment/42915453
answer count: 2
has title: Retrieve numbers after comma (from double numbers)
has answer: http://stackoverflow.com/a/27217988
downvote count: 0
has comment: http://stackoverflow.com/comment/42915371
has answer: http://stackoverflow.com/a/27217951
has comment: http://stackoverflow.com/comment/42915420
favorite count: 0
tagged with: double
possible better answer: http://stackoverflow.com/a/27217951

http://stackoverflow.com/comment/43067797
has text: davmac, yes i had it private, then i change it to public to see if it would work, is there a problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27301942

http://stackoverflow.com/q/27226795
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42931450
has comment: http://stackoverflow.com/comment/42931351
has title: Adding a list of years inside a jcombobox
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42931669
downvote count: 0
has answer: http://stackoverflow.com/a/27227540
possible better answer: http://stackoverflow.com/a/54110096
has answer: http://stackoverflow.com/a/54110096
has body: I'm a begginer programmer and my problem is I have no idea on how to put a list of years in a JComboBox from the current date to 80 years in the past. I could do a string like this, String Y_tmp[]={"1934","1935","1936","1937"}; //-all the way to current year JComboBox Y = new JComboBox(Y_tmp); However that looks very messy and does not automatically change to the next year upon the new year. It also does not remove the last year from the beggining of the list. Does anyone know how to do what I am wanting to do?
has comment: http://stackoverflow.com/comment/42931667
tagged with: jcombobox
favorite count: 0
accepted answer: http://stackoverflow.com/a/27227540
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/42931502
type: AnsweredQuestion

http://stackoverflow.com/comment/42969859
type: Comment
has text: Yes, I found the filter in: \WEB-INF\classes\my\packagename\filter\
comment on: http://stackoverflow.com/q/27247467
score: 0
type: QuestionComment

http://stackoverflow.com/q/27165044
has body: The String dexVersion returns null I tried many things like taking a string and appending a readData[] char to it and it worked fine and i also tried to see if it was a char vs. Character but the results were inconclusive import java.io.*; import java.net.*; import java.lang.*; import java.util.*; class main { public static void main(String args[]) { String version = new String("1.0 (Alpha)"); main main = new main(); dataHandling data = new dataHandling(); boolean doneProcessing = false; int x = 0,y = 0; String dexVersion = new String("v:"); String pokemon[][] = new String[700][10]; System.out.println(":"); System.out.println("POKeUTILITY:MAIN_THREAD_STARTED_IN_STATIC_METHOD_MAIN"); System.out.println("POKeUTILITY:STARTING_VERSION=" + version); System.out.println("POKeUTILITY:DOWNLOADING_POKeDEX_DATA"); data.download(); System.out.println("POKeUTILITY:READING_POKeDEX_DATA"); char readData[] = data.read(); System.out.println("POKeUTILITY:PROCESSING_POKeDEX_DATA"); while (doneProcessing = false) { if ((readData[x]) == '{') { x++; while ((readData[x]) != '}') { dexVersion += readData[x]; x++; } } // if ((readData[x]) == '[') { // x++; // while ((readData[x]) != ']') { // dexVersion += readData[x]; // x++; // } // } if ((readData[x]) == '%') doneProcessing = true; x++; } System.out.println(dexVersion + "."); } } class dataHandling { public void download() { BufferedInputStream dFile; FileOutputStream wFile; try { dFile = new BufferedInputStream(new URL("http://www.harry.technology/pokedex").openStream()); wFile = new FileOutputStream("pokedex"); int x = 0,y = 0; while ((x = dFile.read()) != -1) { wFile.write(x); } wFile.close(); dFile.close(); } catch (IOException e) { System.out.println("POKeUTILITY:ERROR_" + e); System.exit(0); } } public char[] read() { int x = 0,y = 0; char input[] = new char[2000]; String output = new String(""); try { FileReader file = new FileReader("pokedex"); while ((x = file.read()) != -1) { input[y] = convert(x); y++; } file.close(); } catch …
has title: Returning NULL from string with appened chars
tagged with: char
tagged with: arrays
has comment: http://stackoverflow.com/comment/42822455
tagged with: string
score: 0
tagged with: character
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42842198
has comment: http://stackoverflow.com/comment/42822405
tagged with: java
type: Question

http://stackoverflow.com/q/27240431
favorite count: 0
has comment: http://stackoverflow.com/comment/42957651
has title: Restful Web Service Error
downvote count: 0
score: 1
tagged with: web-services
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42957456
type: Question
has body: I use Javax Restfull web service. I can return String from mobile app. but I cant return Model class. I want to return Employee model. I give a error; Full Error: SEVERE: Servlet.service() for servlet [Jersey REST Service] in context with path [/CafeSiparis] threw exception [Servlet execution threw an exception] with root cause java.lang.AbstractMethodError at org.codehaus.jackson.map.AnnotationIntrospector$Pair.findSerializer(AnnotationIntrospector.java:1148) at org.codehaus.jackson.map.ser.BasicSerializerFactory.findSerializerFromAnnotation(BasicSerializerFactory.java:362) at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:252) at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:782) at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:735) at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344) at org.codehaus.jackson.map.ser.StdSerializerProvider.findTypedValueSerializer(StdSerializerProvider.java:420) at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:601) at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256) at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1604) at org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:527) at com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.writeTo(JacksonProviderProxy.java:160) at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:133…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27240795
accepted answer: http://stackoverflow.com/a/27240795

http://stackoverflow.com/comment/43054807
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27290028
has text: Which ports did you try? 25, 465, 587? Are you in a company network? How about firewalls? Please give more information. Otherwise I am wasting my time here.
type: AnswerComment

http://stackoverflow.com/a/27304752
answers question: http://stackoverflow.com/q/27304594
accepted answer of: http://stackoverflow.com/q/27304594
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43072525
has body: public enum Direction { NORTH(Color.RED), WEST(Color.BLUE), EAST(Color.BLACK), SOUTH( Color.GREEN); Direction(int c) { color = c; } private int color; public int get() { return color; } } and to get color in int format use : Direction.SOUTH.get(); which will return int value for color "Green"
score: 3
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43072480

http://stackoverflow.com/q/27265709
has comment: http://stackoverflow.com/comment/43002862
favorite count: 0
linked to: http://stackoverflow.com/q/3244400
tagged with: jlist
has body: As the title says, when i try to dynamically add an element to a JList, which is inside a JScrollPane, it becomes empty. I think it has something to do with multithreading. The GUI is a simple monitoring interface for a server I am working on. I'll post parts of the code I think is responsable for this: But first, this is the frame: public class EventMonitor extends JFrame{ private JList eventList; private DefaultListModel&lt;String&gt; dlm ; JScrollPane jPane; public EventMonitor() { super("Server Monitor"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); dlm = new DefaultListModel&lt;String&gt; (); eventList = new JList(); jPane = new JScrollPane(eventList); jPane.setPreferredSize(new Dimension(950, 600)); add(jPane); } public void addEvent(String event) { dlm.addElement(event); eventList.setModel(dlm); jPane.revalidate(); jPane.repaint(); } } In main() from Server class: //some code eventMonitor = new EventMonitor(); eventMonitor.setBounds(250, 250, 1000, 650); eventMonitor.setVisible(true); //some other code eventMonitor.addEvent("Server is waiting for new connections..."); // this is shown in the list while(true) { ClientHandler clientHandler = new ClientHandler(listener.accept());// listener is ServerSocket clientList.add(clientHandler); clientHandler.start(); } This is what makes the list go empty: inClientHandler constructor: public ClientHandler(Socket socket){ //some code Server.addEvent("The client is: " + user.GetName() + ", with the ip:" + user.GetIPv4() + ", and using the port: " + user.GetPORT()); //some more code } // where Server.addEvent(String event) just calls eventMonitor.addEvent(event) After this, 'run' from 'ClientHandler' listens for messages and they are posted via Server.addEvent(), and it works without a problem, but when another client connects it goes empty again. The first event shown after the one in ClientHandler constructor makes the list whole (showing the event that made it empty too)
has comment: http://stackoverflow.com/comment/43003039
has comment: http://stackoverflow.com/comment/43002826
tagged with: multithreading
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/27265791
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has title: Why adding element to JList makes it empty in this particular case?
tagged with: jscrollpane
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27265791

http://stackoverflow.com/comment/42979489
comment on: http://stackoverflow.com/a/27246671
has text: Yes to all of the above questions, except the first. I created new blank files in my project folder and then copied and pasted the .java files in your src directory, and then changed all of the package names appropriately.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27164373
has comment: http://stackoverflow.com/comment/42940599
type: Question
tagged with: configuration
score: 0
has body: I am working on Spring-mvc application. I have a requirement of scheduling batch job at runtime For now I am concentrating on creating batch job at runtime. I am taking example from this. In the example, following entry is in xml file &lt;!-- Failed Step Tasklet Declaration --&gt; &lt;bean id="failedStepTasklet" class="com.onlinetechvision.tasklet.FailedStepTasklet"&gt; &lt;property name="taskResult" value="Error occurred!" /&gt; &lt;/bean&gt; &lt;batch:job id="secondJob"&gt; &lt;batch:step id="firstFailedStep"&gt; &lt;batch:tasklet ref="failedStepTasklet" /&gt; &lt;/batch:step&gt; &lt;/batch:job&gt; My requirement is to create batch job and batch step at runtime. There can be multiple batch job as well as multiple batch steps in each job. Can any one please help me, how to configure at runtime. Thanks.
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/42960267
tagged with: spring-mvc
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: Spring define batch job at runtime

http://stackoverflow.com/comment/42823406
type: Comment
has text: Actually, there is a `getDeclaredMethod` method in `Class`. It just needs the right arguments.
comment on: http://stackoverflow.com/a/27165669
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42998280
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27262867
score: 2
has text: Please post the full stack trace and tell us which lines are causing the error. Don't just give the line number but tell us which line are those line numbers. Also, please tell us the size of the array and what values are being passed in during the error. Finally, I'd recommend using a debugger for code like this

http://stackoverflow.com/q/27218894
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/64941678
linked to: http://stackoverflow.com/q/21740300
tagged with: gray-code
has answer: http://stackoverflow.com/a/29664828
type: Question
has answer: http://stackoverflow.com/a/29266939
has answer: http://stackoverflow.com/a/27219118
has answer: http://stackoverflow.com/a/27672428
favorite count: 0
has answer: http://stackoverflow.com/a/28802064
accepted answer: http://stackoverflow.com/a/27219118
has body: I am trying to come up with a solution to the problem that given two numbers, find if they are the consecutive numbers in the gray code sequence i.e., if they are gray code neighbors assuming that the gray code sequence is not mentioned. I searched on various forums but couldn't get the right answer. It would be great if you can provide a solution for this. My attempt to the problem - Convert two integers to binary and add the digits in both the numbers separately and find the difference between the sum of the digits in two numbers. If the difference is one then they are gray code neighbors. But I feel this wont work for all cases. Any help is highly appreciated. Thanks a lot in advance!!!
has answer: http://stackoverflow.com/a/27672068
answer count: 9
possible better answer: http://stackoverflow.com/a/27332721
has answer: http://stackoverflow.com/a/32443234
has title: How to find if two numbers are consecutive numbers in gray code sequence
score: 6
has answer: http://stackoverflow.com/a/27332721
tagged with: python
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/42917053
has comment: http://stackoverflow.com/comment/42917159
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42917066
tagged with: algorithm
tagged with: java

http://stackoverflow.com/comment/43076075
type: QuestionComment
comment on: http://stackoverflow.com/q/27306795
score: 0
has text: @MadProgrammer some thing like this? public void setName(String name) { this.name = name; } and if so, do i have to have an import statement on the class. sorry total newbie at this.
type: Comment

http://stackoverflow.com/a/27263064
score: 0
type: Answer
has body: There are basically two ways you can solve your problem : - 1) Going Object Oriented Way - Creating a class with a String field as name and an array of double. Creating an object per line and then process each object. 2) You can also use Hashmap&lt;String,Double[]&gt; (Assuming names are unique) and put each line into an entry. As far as parsing the line is concerned, again there are two ways - i) One is split method - line.split(" ") which would return an array of numbers. ii) StringTokenizer API in java - See here http://www.java-samples.com/showtutorial.php?tutorialid=236
answers question: http://stackoverflow.com/q/27262754

http://stackoverflow.com/comment/42848168
score: 0
has text: Clean out all your target directories, bin directories and so on, then rebuild your war from scratch. You may have had some artefact lying around from an earlier build.
comment on: http://stackoverflow.com/q/27179144
type: Comment
type: QuestionComment

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/27295356
tags question: http://stackoverflow.com/q/27207918
tags question: http://stackoverflow.com/q/27305590
tags question: http://stackoverflow.com/q/27229266
tags question: http://stackoverflow.com/q/27167026
tags question: http://stackoverflow.com/q/27251891
tags question: http://stackoverflow.com/q/27223432
tags question: http://stackoverflow.com/q/27265120
tags question: http://stackoverflow.com/q/27248689
tags question: http://stackoverflow.com/q/27169120

http://stackoverflow.com/comment/42846670
comment on: http://stackoverflow.com/q/27178923
type: Comment
type: QuestionComment
has text: We would first need the stacktrace and the piece of the code where this issue is happening!
score: 1

http://stackoverflow.com/q/27193239
accepted answer: http://stackoverflow.com/a/27193369
downvote count: 0
tagged with: arraylist
has body: this code from ArrayList source: public ArrayList() { super(); this.elementData = EMPTY_ELEMENTDATA; } this code from AbstractList source: protected AbstractList() { } What does super() do?
possible better answer: http://stackoverflow.com/a/27193292
has comment: http://stackoverflow.com/comment/42872001
favorite count: 0
has answer: http://stackoverflow.com/a/27193292
linked to: http://stackoverflow.com/q/6318628
upvote count: 2
has answer: http://stackoverflow.com/a/27193369
tagged with: collections
type: AnsweredQuestion
tagged with: java
type: Question
has title: What for we need super() in ArrayList constructor?
answer count: 2
score: 2

http://stackoverflow.com/comment/42882477
score: 0
comment on: http://stackoverflow.com/q/27199035
type: Comment
type: QuestionComment
has text: It is an interface. Which is implemented in MainActivity.java

http://stackoverflow.com/a/27268390
score: 0
has body: This should do the trick: <pathelement location="${basedir}/spark-de.jar"/> <pathelement location="${basedir}/lib1.jar"/> <pathelement location="${basedir}/lib2.jar"/>
type: Answer
accepted answer of: http://stackoverflow.com/q/27259512
answers question: http://stackoverflow.com/q/27259512
type: AcceptedAnswer

http://stackoverflow.com/comment/42985228
has text: So I googled it, and indeed that newline thing was the issue. Thank you @BeyelerStudios
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27255454
score: 0

http://stackoverflow.com/comment/42837694
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27173920
has text: @Rogue ↑ Good one ;)

http://stackoverflow.com/comment/43078523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27308166
score: 0
has text: use an IDE, This type of errors wont bother you.

http://stackoverflow.com/a/27172793
answers question: http://stackoverflow.com/q/27172566
has body: You seem to be caching your views outside of getView() instead of using the convertView passed to you. Romain Guy explains it here https://www.youtube.com/watch?v=wDBM6wVEO70
has comment: http://stackoverflow.com/comment/42835879
score: 0
type: Answer

http://stackoverflow.com/a/27303914
downvote count: 1
has body: Fixed with one additional line in configurations. Don't know if it's the best and a proper solution but works as intended. configurations { provided testCompile.extendsFrom(provided) }
score: 2
answers question: http://stackoverflow.com/q/27275402
type: Answer
upvote count: 3

http://stackoverflow.com/comment/43011842
type: AnswerComment
comment on: http://stackoverflow.com/a/27216071
type: Comment
has text: I tried your xml but it doesnt solve my problem I got this bugs 12-03 13:39:15.009: E/AndroidRuntime(3544): Caused by: android.view.InflateException: Binary XML file line #20: Class is not a View com.google.android.gms.maps.MapFragment 12-03 13:39:15.009: E/AndroidRuntime(3544): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.view.View
score: 0

http://stackoverflow.com/comment/42889244
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27203236
has text: @fge That's what I'm asking. Maybe in the past something else was used to define annotations? So you mean "no, the `@interface` has always been used for defining annotations"?

http://stackoverflow.com/q/27239613
tagged with: client-server
type: AnsweredQuestion
has title: Error when calling remote method
favorite count: 0
has comment: http://stackoverflow.com/comment/67186683
type: Question
has answer: http://stackoverflow.com/a/27239980
has comment: http://stackoverflow.com/comment/42957856
score: 0
upvote count: 1
answer count: 1
downvote count: 1
tagged with: rmi
accepted answer: http://stackoverflow.com/a/27239980
tagged with: java
has body: I'm trying to call a fibonacci method on a remote server using RMI but when I try to invoke the method on the client side by giving the method an integer value, I get these errors: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source) at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) at com.sun.proxy.$Proxy0.fibonacciArrayTest(Unknown Source) at ie.gmit.FibonacciClient.main(FibonacciClient.java:37) Does anyone have any idea where I have gone wrong with this implementation? This is the client side of the RMI application: //get user input Scanner user_input = new Scanner(System.in); String fibMaxNum; System.out.println("Enter the max fibonacci number: "); fibMaxNum = user_input.next(); int fibMax = Integer.parseInt(fibMaxNum); //Get Fibonacci array. int[] sequence = power_proxy.fibonacciArrayTest(fibMax); for (int value : sequence) { System.out.println(value); } And …

http://stackoverflow.com/a/27235030
has body: this should work. File myFile = new File("data.txt"); BufferedReader readBuffer = new BufferedReader(new FileReader(myFile)); ArrayList&lt;String&gt; myArrayList = new ArrayList&lt;String&gt;(); String line = null; while ((line = readBuffer.readLine()) != null) { while (line.length() &gt; 0) { myArrayList.add(line.substring(0,6); line = line.substring(7); } } readBuffer.close();
answers question: http://stackoverflow.com/q/27234672
score: 0
type: Answer

http://stackoverflow.com/q/27232366
has body: I wanted to append data to a file containing the data:- A B C D E I wrote the following code :- import java.io.*; public class AddtoFile { public void main() { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try { FileWriter fw=new FileWriter("Student.txt",true); BufferedWriter bw=new BufferedWriter(fw); for(int i=0;i&lt;5;i++) { System.out.println("Enter Phone numbers"); String phone=br.readLine(); bw.write(phone); bw.newLine(); } bw.close(); fw.close(); }catch(Exception e){System.out.println(e);} } } But even after giving the required input, when I open the file I find that nothing has been appended to the previous data.Please do point out if there is any mistake in my logic because my compiler has reported no syntactical error in the code. For a little more information if (there is some mistake in the code of writing to a file as well) import java.io.*; class WritetoFile { void main()throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try { FileWriter fw=new FileWriter("Student.txt"); BufferedWriter bw=new BufferedWriter(fw); for(int i=0;i&lt;5;i++) { System.out.println("Enter your name"); String name=br.readLine(); bw.write(name); bw.newLine(); } bw.close(); fw.close(); }catch(Exception e){System.out.println(e);} } } (Please do tell me because I have got no such help from JavaDocs as well)
has comment: http://stackoverflow.com/comment/42941713
has comment: http://stackoverflow.com/comment/42941988
has answer: http://stackoverflow.com/a/27232451
has comment: http://stackoverflow.com/comment/42941621
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/27232505
tagged with: java
has comment: http://stackoverflow.com/comment/42942252
possible better answer: http://stackoverflow.com/a/27232451
has answer: http://stackoverflow.com/a/27233829
type: Question
has answer: http://stackoverflow.com/a/27232505
answer count: 3
tagged with: file-io
upvote count: 1
favorite count: 0
has title: What is the correct method for appending to a text file in java?

http://stackoverflow.com/q/27251392
favorite count: 0
possible better answer: http://stackoverflow.com/a/27251510
has answer: http://stackoverflow.com/a/27251510
answer count: 5
accepted answer: http://stackoverflow.com/a/27251530
tagged with: porting
has title: Ways to avoid passing-by-reference in Java
has comment: http://stackoverflow.com/comment/42977175
upvote count: 4
has body: This question is probably as old as the hills. Nevertheless, after reading lots of articles and forums I still don't see a good solution to my problem. I have to transfer some Monte Carlo simulation programs from C++ to Java. The problem is that it heavily relies on passing variables by reference in functions, like: void make_step(int &amp;a, int &amp;b, double &amp;c) { a++; b += a; c *= 1.1; } There is no passing by reference in Java, as well as possible analogs, like multiple return values or nested functions. Solutions, which I have read on this site, usually involve encapsulation of primitive types into objects. Alternatively - break functions to single-return ones. However, in my case it results in too long and complicated code (few lines of C++ code grow to almost pages in Java). Also, since these algorithms are hard to debug, I want to avoid dramatical changes in code while porting. What I do now is substituting of all primitive type variables with arrays of length 1 (which are objects and can be modified inside functions). But it doesn't look like very elegant solutions. Does anyone have better ideas?
tagged with: reference
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27251530
has comment: http://stackoverflow.com/comment/42976805
type: Question
has answer: http://stackoverflow.com/a/27251466
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/27251532
has answer: http://stackoverflow.com/a/27251448

http://stackoverflow.com/q/27175539
tagged with: java
has title: Creating a sqlite-file within appengine
type: Question
has body: Im struggeling with the gae filesystem restrictions. I am creating a tool that can export a datastructur into a lot of different output-files (json, xml...) One of them is a sqlite-database-file. Do you have any ideas how this can be done in this restricted environment? I tried creating an inmemory database without success: DriverManager.getConnection("jdbc:sqlite::memory:"); I also tried to use the file-storage bucket: DriverManager.getConnection("jdbc:sqlite:gs://"+bucketnameü+"/sqllite"); Neither of them worked. I'm afraid this is not possible at all :( I dont want to start a compute engine instance in order to create a sqllite file. Are there any other frameworks out there that could possible create that database file on the fly. Here the whole code: Connection c = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:gs://"+bucketnameü+"/sqllite"); Statement statement = c.createStatement(); statement.setQueryTimeout(30); // set timeout to 30 sec. statement.executeUpdate("create table person (id integer, name string)"); c.close(); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); e.printStackTrace(System.out); } I already found an interesting approach in Google AppEngine: Use SQLite file uploaded by user I tried SQLJet with an inmemory database without success. gaevfs does not look like a good idea either.
has answer: http://stackoverflow.com/a/29246332
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/6871897
type: UnansweredQuestion
tagged with: google-app-engine
score: 2
upvote count: 2

http://stackoverflow.com/q/27278641
tagged with: java
tagged with: thread-safety
type: Question
has comment: http://stackoverflow.com/comment/43028517
has comment: http://stackoverflow.com/comment/43032458
has comment: http://stackoverflow.com/comment/43031562
has body: I'm working on an open source projet and i have issues with my application. When multiple users use the app, one users can get another one's data ( the server response). my beans are request and session scoped and my controller request scoped. When starting tomcat, beans are created 3x times. I've read lot of documentations and try playing with scopes and nothing. I must be missing something. Thanks for your help. My controller:. @Controller @Scope("request") public class SpinalToolboxWebController { @Autowired private FileOperationsService fileOperationsService; @Autowired private ServerResponse serverResponse; @Autowired private SoftwareCommunicationService softwareCommunicationService; @Autowired private StringBuffer stringBuffer; @Autowired private UserEnvironmentService userEnvironmentService; @RequestMapping(value = "/") public ModelAndView home(){ System.out.println("Passing throught home controller"); return new ModelAndView(SpinalToolBoxWebConstants.VIEW_HOME, "result", "command submitted : "); } @RequestMapping(value="/upload", method = RequestMethod.POST, produces="application/json") public @ResponseBody ServerResponse handleUploadedFiles(@RequestParam(value = "file") MultipartFile file, @RequestParam(value="token") String token)throws IOException { System.out.println("Passing throught upload controller"); if(!fileOperationsService.isUploadedFileExtensionAllowed(file.getOriginalFilename())) { serverResponse.setUndefinedResponse(); return serverResponse; } if(fileOperationsService.uploadFile(file, token)){ serverResponse.setResponse(file, softwareCommunicationService.generateRawAndHeader(file)); } else{ serverResponse.setUndefinedResponse(); } return serverResponse; } } Here is my java config file: @Configuration public class SpinalToolBoxWebConfig { @Value("${uploadPath}") private String uploadPathFromPropertyFile; //Resolve view name to jsp @Bean ViewResolver viewResolver(){ InternalResourceViewResolver resolver = new InternalResourceViewResolver(); reso…
tagged with: servlets
has comment: http://stackoverflow.com/comment/43029641
score: 0
has comment: http://stackoverflow.com/comment/43028260
has comment: http://stackoverflow.com/comment/43027000
has comment: http://stackoverflow.com/comment/43028613
has comment: http://stackoverflow.com/comment/43032476
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43027718
has comment: http://stackoverflow.com/comment/43032347
has comment: http://stackoverflow.com/comment/43033063
tagged with: spring
has comment: http://stackoverflow.com/comment/43027279
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/43027146
answer count: 0
has title: Spring mvc::why my web app is not thead safe

http://stackoverflow.com/comment/42809202
type: Comment
has text: A each element to some kind of List/array and use a bubble sort to sort it...
score: 0
comment on: http://stackoverflow.com/q/27157496
type: QuestionComment

http://stackoverflow.com/comment/43016330
type: AnswerComment
comment on: http://stackoverflow.com/a/27273336
type: Comment
has text: Yeah, but he's spinning off all of the threads before going back to join them.
score: 0

http://stackoverflow.com/comment/43341460
type: QuestionComment
type: Comment
has text: Ok, I updated the question. Have a look!
score: 0
comment on: http://stackoverflow.com/q/27205375

http://stackoverflow.com/comment/42898735
has text: So I've posted what I tried
score: 0
comment on: http://stackoverflow.com/q/27207918
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43015145
score: 0
comment on: http://stackoverflow.com/q/27272611
type: Comment
type: QuestionComment
has text: just from copying ... sry

http://stackoverflow.com/a/27212878
upvote count: 4
answers question: http://stackoverflow.com/q/27212845
downvote count: 0
type: Answer
has body: The code with two loops is O(m*n), where m and n are array sizes. You can do better than that if you put the content of one array into a hash-based container, say, HashSet&lt;T&gt;, and then go through the items of the second array, checking if they are in the hash set or not. This has the complexity of O(m+n), i.e. linear in the total number of elements in both arrays.
score: 4

http://stackoverflow.com/comment/42901513
has text: Alright thanks a lot. Haha this is what I get for taking everything off forums. (I am trying to make a wearable app, just in full screen and without cards, by the way.)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27209467
type: Comment

http://stackoverflow.com/q/27301867
favorite count: 0
has answer: http://stackoverflow.com/a/27302807
accepted answer: http://stackoverflow.com/a/27303747
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27301907
has title: What is compileSdkVersion?
tagged with: java
upvote count: 7
tagged with: eclipse
downvote count: 1
possible better answer: http://stackoverflow.com/a/27302602
has body: Just moved from Eclipse to Android studio yesterday and I'm trying to figure everything out. In my build grade, I now see a "compileSdkVersion" and I can't seem to figure out what it is. I know that minSdk tells GooglePlay how old of a device the app can handle. And that targetSdk tells the device weather or not it should switch to forward compatibility. But I don't know what compileSdk is and what I should do with it. Also, as a side question, if I set targetSdk as 21, devices running on sdk 16 run in compatibility mode? Thanks for your help! I really appreciate it! EDIT: I kindly ask not to link me to the android developer website. I've read it and I don't understand why compiling in a different sdk makes a difference if there is already min, max and target sdk versions. Again, thanks alot for the help! Here's the gradle code. apply plugin: 'com.android.application' android { compileSdkVersion 17 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.devname.myapp" minSdkVersion 10 targetSdkVersion 21 } buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' } } } dependencies { compile 'com.android.support:support-v4:21.0.0' compile files('libs/libGoogleAnalyticsServices.jar') }
has answer: http://stackoverflow.com/a/27303747
has answer: http://stackoverflow.com/a/27302602
answer count: 5
score: 6
has answer: http://stackoverflow.com/a/27301938
type: AnsweredQuestion

http://stackoverflow.com/q/27191610
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42871101
has comment: http://stackoverflow.com/comment/42875448
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42872130
has body: I'm new to android coding. I simply want to display data row by row from my database table. Here is the part where I have created database/table and added data. SQLiteDatabase glucoDB = openOrCreateDatabase("glucoDB",MODE_PRIVATE,null); glucoDB.execSQL("CREATE TABLE IF NOT EXISTS Results(Timestamp VARCHAR, Level_using_hsv_range VARCHAR,Level_using_hsv_gradient VARCHAR,Level_using_lab_range VARCHAR,Level_using_lab_gradient VARCHAR);"); String query=new String("INSERT INTO Results VALUES ('" + currentDateTimeString + "', '" + str + "mg/dL', '" + glucose[1] + "mg/dL', '" + gvalue + "-" + largeg + "mg/dL', '" + LabRes2 + "mg/dL');"); glucoDB.execSQL(query); Below is the activity code (ViewResults.java) for displaying database values.I can't figure out what I'm doing wrong. On exporting and running the app, the rest of the app works fine but the part where data is displayed shows a black screen and app exits instantly. Although if I display data using simple TextView and not TableLayout, it is displayed normally. So database part is working fine, there's something wrong with my TableLayout code. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.result_page); int i=0,j=0; SQLiteDatabase Glucodb = openOrCreateDatabase("glucoDB",MODE_PRIVATE,null); Cursor resultSet = Glucodb.rawQuery("Select * from Results",null); resultSet.moveToFirst(); TableLayout l1 = (TableLayout) findViewById(R.id.table2); l1.setStretchAllColumns(true); l1.bringToFront(); do { TableRow tr = new TableRow(getBaseContext()); TextView t1 = new TextView(getBaseContext()); TextView t2 = new TextView(getBaseContext()); TextView t3 = new TextView(getBaseContext()); TextView t4 = new TextView(getBaseContext()); TextView t5 = new TextView(getBaseContext()); t1.setBackgroundResource(R.drawable.border); t1.setText(resultSet.getString(0)); t2.setText(resultSet.getString(1)); t3.setText(resultSet.getString(2)); t4.setText(resultSet.getString(3)); t5.setTex…
has comment: http://stackoverflow.com/comment/42875082
type: Question
tagged with: tablelayout
downvote count: 0
has title: Display SQLite table data row by row in Android using TableLayout dynamically
tagged with: android
has comment: http://stackoverflow.com/comment/42874998
tagged with: sqlite
has comment: http://stackoverflow.com/comment/42869668
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42862972
type: Comment
has text: here the fractional seconds are not being discarded instead an extra second is being added and the time is changing from 23.59.59.000 to 00.00.00.000 wondering what might be the reason behind this.
comment on: http://stackoverflow.com/a/27167242
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42863316
type: QuestionComment
has text: Could you please offer me some way to solve this task?
comment on: http://stackoverflow.com/q/27188446
score: 0
type: Comment

http://stackoverflow.com/q/27205858
answer count: 1
accepted answer: http://stackoverflow.com/a/27206009
tagged with: fxml
type: AnsweredQuestion
has body: I'm new in Java developpement (Android excepted) and I use JavaFX with FXML to create interfaces. I have a Button with an image. I want to remove the border, I tried this way: &lt;Button border="0" background="transparent"&gt; &lt;graphic&gt; &lt;ImageView&gt; &lt;Image url="/resources/images/btn_home.png"/&gt; &lt;/ImageView&gt; &lt;/graphic&gt; &lt;/Button&gt; But I have an exception Unable to coerce 0 to class javafx.scene.layout.Border and I'm not able to understand how border attribute works. Can you help me? Last, do you think that use JavaFX for UI application is a good idea? Because I don't found any useful documentation about this library. What's your opinion? Thanks for help.
has answer: http://stackoverflow.com/a/27206009
score: 0
tagged with: java
tagged with: javafx
type: Question
has title: FXML how to remove borders

split
tags question: http://stackoverflow.com/q/27254016
tags question: http://stackoverflow.com/q/27264436
tag name: split
tags question: http://stackoverflow.com/q/27201378
tags question: http://stackoverflow.com/q/27193812
tags question: http://stackoverflow.com/q/27161155
tags question: http://stackoverflow.com/q/27169842
tags question: http://stackoverflow.com/q/27211420
tags question: http://stackoverflow.com/q/27305114
tags question: http://stackoverflow.com/q/27287802
tags question: http://stackoverflow.com/q/27303960
tags question: http://stackoverflow.com/q/27216018
tags question: http://stackoverflow.com/q/27157292
tags question: http://stackoverflow.com/q/27254000
tags question: http://stackoverflow.com/q/27183422
type: Tag
tags question: http://stackoverflow.com/q/27211974

http://stackoverflow.com/a/27238012
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/27237646
type: Answer
answers question: http://stackoverflow.com/q/27237646
has body: This is a rough class implementation based on interpretations of your question. Your original definition of having an interface and then an implementation and then the individual types feels complex. Instead, we want to work with individual Fighters and not representations of them. class Fighter { int hp; void attack() { } void move() { } void regen() { hp++; } } class MagicFighter extends Fighter { int mana; @Override void regen() { mana++; //we don't regen hp because we're magic-type. } } class StrengthFighter extends Fighter { int rage; @Override void attack() { super.attack(); specialRegen(); } void specialRegen() { rage++; } @Override void regen() { // does nothing } void berserk() { rage--; } } In this case, we could store a list of Fighter List&lt;Fighter&gt; fighters = new List&lt;&gt;(); When we want to create a new fighter, we would determine what the user wanted and add that to the list of fighters. if (selection.equals("StrengthFighter")) { Fighter fighter = new StrengthFighter(); fighters.add(fighter); } Then, we'd call all the methods as normal. Anything shared between the two classes would not be overridden, such as Fighter.move. Anything that doesn't work for only one type would be overridden, like StrengthFighter.regen. Anything that has special additional functionality for a specific type would implement the additional functionality and make a super call, like StrengthFighter.attack. Basically, you have the right idea already, but basically, you want Fighter to do as much of the shared work as possible, and then implement individual actions based on the type behind the scenes. If something needs to be checked for type, it needs to be something unique to that type of Fighter, such as StrengthFighter.berserk. This reduces the need to check types except when they really matter.
has comment: http://stackoverflow.com/comment/42952833
has comment: http://stackoverflow.com/comment/42953529

http://stackoverflow.com/q/27171708
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27206255
tagged with: c++
type: AnsweredQuestion
tagged with: java
has body: I've tried building the CSEmptyTemplate project in eclipse for android but have run into a host of issues with it. Looking at the documentation, it doesn't appear as if it should be this difficult. Firstly, I've installed cygwin and installed the devel package to get make.exe and gcc compilers. I'm also using cygwin as part of the tool chain. However, the error I keep getting is 'make: *** No rule to make target `all'. Stop.'. Any advice on fixing these issues would be appreciated. edit: Found the make files. I was just an idiot last night when working on this.
upvote count: 1
type: Question
tagged with: ant
accepted answer: http://stackoverflow.com/a/27206255
has title: Chilli Source Android build on windows
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/27299929
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43064294
accepted answer: http://stackoverflow.com/a/27300440
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43064247
tagged with: java
has body: Assume I have the following class public class Account { private Long id; private String username; private String password; // getters + constructor } The following action class public MyAction extends ActionSupport { private CoreService service; private long id; private String username; private String password; private Account account; public String loadAccount() { account = service.getAccountById(id); return SUCCESS; } public String updateAccount() { service.updateAccount(account); return SUCCESS; } // getters + setters } I use the loadAccount() method to populate the form's fields. And my form: New username New password Now, assume the user will write down a new username but the validation fails. The value inside 'username' textfield will be reset to account's username. I want to change my program and make it initially load account's username but then if validation fails it will load the last input.
tagged with: forms
type: Question
has comment: http://stackoverflow.com/comment/43064657
tagged with: jstl
tagged with: struts
has title: Re-assign value tag after first form submission?
has comment: http://stackoverflow.com/comment/43064079
tagged with: struts2
has answer: http://stackoverflow.com/a/27300440
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43064449

http://stackoverflow.com/a/27209833
has comment: http://stackoverflow.com/comment/42901453
upvote count: 2
type: AcceptedAnswer
has body: How does your this even compile notepad = new JTextArea(); notepad.addTextListener(new TextListener() { // .... } since TextListeners are not defined to work with JTextAreas but rather with TextAreas, a completely different beast. You should add a DocumentListener to your JTextArea's Document. notepad.getDocument().addDocumentListener(new DocumentListener() { void insertUpdate(DocumentEvent e) { documentChanged = true; } void removeUpdate(DocumentEvent e) { documentChanged = true; } void changedUpdate(DocumentEvent e) { documentChanged = true; } }); Regarding My question is, is there any way to use both TextListeners and ActionListeners (or any other listener) simultaneously in the same class? Use of a DocumentListener has nothing to do with ActionListeners used elsewhere in your program since their domains are orthogonal to each other, i.e., the one has absolutely nothing to do with the other.
accepted answer of: http://stackoverflow.com/q/27209814
type: Answer
answers question: http://stackoverflow.com/q/27209814
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42901477
has comment: http://stackoverflow.com/comment/42901626

http://stackoverflow.com/comment/43080975
has text: @Jeff I immediately return the connection to pool once the process is completed . Actually in every function's finally block. Even in the long i can see connection's close method is called either immediately after it is acquired OR a few lines after the call.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27308172
score: 0

http://stackoverflow.com/comment/43066427
comment on: http://stackoverflow.com/a/27291512
has text: thanks but didn't work. It give me error on subCategories, Vehicles, and return pProductArrayList. i've been edit my question, my arraylist is inside string doInBackground
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42891492
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27203729
has text: Yes I think so as you have set property="type" in JsonTypeInfo. You might also want to read jacksons documentation about those annotations as I am not 100% sure of the meaning.
type: Comment

http://stackoverflow.com/comment/42845154
score: 1
comment on: http://stackoverflow.com/a/27177882
type: AnswerComment
has text: you need to design the db first for not to get redundant data. However answer update. If this is not working, Mention your database(oracle or mysql or others) and paste sample rows of your table
type: Comment

http://stackoverflow.com/comment/42974370
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27250001
score: 0
has text: This seems to be duplicate of http://stackoverflow.com/questions/12532339/no-appenders-could-be-found-for-loggerlog4j

shoes
tags question: http://stackoverflow.com/q/27288264
tag name: shoes
type: Tag

http://stackoverflow.com/comment/43088235
type: QuestionComment
comment on: http://stackoverflow.com/q/27313793
type: Comment
has text: Again: provide an example. Your question is not clear.
score: 0

http://stackoverflow.com/a/27261728
has body: Your RestClient seems to be null most likely because @Autowired didn't work. I suspect that your component is not an actual Spring Bean, because if it was and then your context creation would fail during app startup. Make sure that you have the package included into package scanning.
type: Answer
has comment: http://stackoverflow.com/comment/42996368
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42996341
has comment: http://stackoverflow.com/comment/42997586
answers question: http://stackoverflow.com/q/27261622

http://stackoverflow.com/comment/42935209
score: 0
has text: Stop thinking about Java Threads and start using pooled Executors or Java 8 streams.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27228072

http://stackoverflow.com/comment/42861401
comment on: http://stackoverflow.com/a/27169867
type: Comment
has text: the whole class AtmRun is there,Atm has declarations and a constructor that defines the variables. the path is /Users/user/Dropbox/onlineWorkspace/Case study: ATM/src/come/example/atm
score: 0
type: AnswerComment

http://stackoverflow.com/a/27234371
upvote count: 3
downvote count: 0
has body: If you are type-checking a at runtime, then you are defeating the point of generics. But generics don't work with mathematical operators anyway, because those operators work with primitives and type parameters work with reference types. Your workaround doesn't work with the compiler because T could be any Number type at compile time, so the compiler can't allow you to return an Integer when it thinks it could be any Number type. Instead, I would overload two non-generic foo methods -- one with int and one with double. Neither of these methods would be generic, and each would just perform its own operation.
answers question: http://stackoverflow.com/q/27234302
type: Answer
score: 3

http://stackoverflow.com/q/27159646
accepted answer: http://stackoverflow.com/a/27159681
answer count: 5
has answer: http://stackoverflow.com/a/27159712
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/27159718
score: 1
tagged with: simpledateformat
tagged with: java
tagged with: date
type: Question
has body: I am trying to change the format of a date but cannot get it to work from Nov 18, 2014 to 2014-11-18 String s="Nov 18, 2014" s= new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("LLL dd, yyyy").parse(s)); something is wrong with this part new SimpleDateFormat("LLL dd, yyyy").parse(s)
has answer: http://stackoverflow.com/a/27159668
has answer: http://stackoverflow.com/a/27159718
upvote count: 1
tagged with: datetime
favorite count: 0
has title: Change date format Nov 18, 2014 to 2014-11-18
has answer: http://stackoverflow.com/a/27159706
has answer: http://stackoverflow.com/a/27159681

http://stackoverflow.com/comment/42959897
has text: As I said, it looks fine from what I can see. Install genymotion and/or use Crashlytics, bugsense, or some other logging software. You need to see the stacktrace to see what is causing the crash
comment on: http://stackoverflow.com/q/27241207
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27295606
score: 1
upvote count: 1
has body: You declare some variable called "tokens" yet pass in a parameter (presumably what you intended to be the tokens variable). A variable is not a parameter, they are different. Either use an explicit parameter, or an implicit parameter (with : prefix) as any decent JDO docs would tell you
downvote count: 0
answers question: http://stackoverflow.com/q/27291044
type: Answer

http://stackoverflow.com/comment/42945618
comment on: http://stackoverflow.com/a/27234252
type: Comment
has text: For 2 dimensions wouldn't i need to use the conditions: if i == 0 and j == 0, if i == 0 and j == size-1, if i == size-1 and j == 0, if i == size-1 and j == size-1
score: 0
type: AnswerComment

http://stackoverflow.com/q/27277667
tagged with: http://stackoverflow.com/tag/json
tagged with: post
score: 0
has title: How to pass a JSON string as a POST param avoiding character encoding in Java?
has comment: http://stackoverflow.com/comment/43024192
has body: I'm trying to send a POST param to a REST endpoint I have. This param is a JSON String, that contains special chars like double quotes ("). On the endpoint I keep on getting the String encoded. THis is the request part: HttpClient client = HttpClientBuilder.create().build(); StringBuilder query = new StringBuilder(); query.append(callBackURL); ArrayList&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;NameValuePair&gt;(); urlParameters.add(new BasicNameValuePair("update", "{\"object\":\"page\",\"entry\":[{\"id\":\"316492991876763\",\"time\":1417436403,\"changes\":[{\"field\":\"feed\",\"value\":{\"item\":\"comment\",\"verb\":\"add\",\"comment_id\":\"321528008039928_323256911200371\",\"parent_id\":\"316492991876763_321528008039928\",\"sender_id\":100006737955082,\"created_time\":1417436403}}]}]}")); try { HttpPost post = new HttpPost(query.toString()); post.setEntity(new UrlEncodedFormEntity(urlParameters)); post.addHeader("content-type", "application/json"); HttpResponse response = null; try { response = client.execute(post); } catch (IOException e) { System.out.println(e.getMessage()); } } catch (UnsupportedEncodingException e2) { System.out.println(e2.getMessage()); } Now in the endpoint part: /** * Callback method that receives FB updates * @return 200 OK if everything goes OK, 401 ERROR otherwise */ @POST @Path("/callback") @Consumes(MediaType.APPLICATION_JSON) public Response facebookUpdate(String update, @Context HttpServletRequest request, @Context HttpServletResponse response) throws ServletException, IOException{ JsonParser jsonParser = new JsonParser(); //parse it JsonElement json = jsonParser.parse(update); ... } What I'm getting is a String encoded like this: %7B%22object%22%3A%22page%22%2C%22entry%22%3A%5B%7B%22id%22%3A%22316492991876763%22%2C%22time%22%3A1417436403%2C%22changes%22%3A%5B%7B%22field%22%3A%22feed%22%2C%22value%22%3A%7B%22item%22%3A%22comment%22%2C%22verb%22%3A%22add%22%2C%22comment_id%22%3A%22321528008039928_323256911200371%22%2C%22pa…
answer count: 1
has comment: http://stackoverflow.com/comment/43024212
has answer: http://stackoverflow.com/a/27278862
has comment: http://stackoverflow.com/comment/43027469
has comment: http://stackoverflow.com/comment/43027250
has comment: http://stackoverflow.com/comment/43027560
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43027234
type: Question

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/27204765
tags question: http://stackoverflow.com/q/27161106
type: Tag

http://stackoverflow.com/q/27300064
tagged with: ajax
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27300881
type: Question
has comment: http://stackoverflow.com/comment/43064066
tagged with: java
tagged with: ssl
tagged with: eclipse
score: 0
has body: I've asked a similar question not too long ago, but I feel like I didn't ask it correctly. I've been tasked with creating a project that consumes a web service. This web service requires a certificate to send ajax calls to. My team member sent me a jks file that contains the relevant cert, but I'm unsure on how to actually add it to my eclipse project, and I can't find any information through searches. How do I add the keystore to my project so that I have the necessary PKC and AC to make AJAX calls?
answer count: 1
has title: How to add a keystore to an Eclipse project
has comment: http://stackoverflow.com/comment/43064089

http://stackoverflow.com/comment/43068672
type: Comment
has text: ...only if the class has a public default (no-args) constructor.
comment on: http://stackoverflow.com/a/27302703
type: AnswerComment
score: 0

http://stackoverflow.com/q/27189545
tagged with: loops
type: Question
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/27189937
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27189815
has answer: http://stackoverflow.com/a/27189815
tagged with: while-loop
has body: I have to write a program that asks the user for his name, address and phone number. When the data is entered the program shall print the data and ask the user to verify the data by entering yes or no. This process shall be repeated until the user is satisfied and answers yes to the question. Now, at this moment I am able to pop-up a single prompt (in my case asking only the user's name). But what if I want to add multiple question (i.e. asking address and telephone number) and happen the same thing? How could I do that? My code: package userinfo; import java.util.Scanner; import sun.security.krb5.SCDynamicStoreConfig; public class UserInfo { public static void main(String[] args) { String varify; String yes = "yes"; String no = "no"; Scanner input = new Scanner(System.in); System.out.println("Enter your name: "); String name = input.next(); System.out.println("Your input was: "+name); System.out.println("Varify by yes or no: "); while (true) { varify = input.next(); if (varify.equalsIgnoreCase(yes)) { System.out.println("Varified! Your name is: " + name); } else if (varify.equalsIgnoreCase(no)) { System.out.println("Type your name again: "); } } } }
has title: How to add multiple user-prompts in while loop?
tagged with: user-input
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27189937
tagged with: java

http://stackoverflow.com/comment/123073516
score: 1
comment on: http://stackoverflow.com/a/27549556
type: AnswerComment
has text: It works, however it does feel like a hacky solution to get around the AWS imposed limits of 15 mins on the delayseconds and 12 hours on the visibility timeout.
type: Comment

private-network
tags question: http://stackoverflow.com/q/27294040
tag name: private-network
type: Tag

http://stackoverflow.com/a/27702944
score: 4
has comment: http://stackoverflow.com/comment/81338581
has body: I assume what you really want to do is HTTP BASIC Authentication. There are defined APIs in CXF to set username/password for BASIC authentication. This will do what you want: HTTPConduit httpConduit = (HTTPConduit) ClientProxy.getClient(stub).getConduit(); httpConduit.getAuthorization().setUserName("username"); httpConduit.getAuthorization().setPassword("password"); There are also other alternatives, like putting username/password directly into the request context: AuthorizationPolicy authzPolicy = new AuthorizationPolicy(); authzPolicy.setUserName("username"); authzPolicy.setPassword("password"); ((BindingProvider) stub).getRequestContext().put(AuthorizationPolicy.class.getName(), authzPolicy);
has comment: http://stackoverflow.com/comment/44077234
has comment: http://stackoverflow.com/comment/81350151
type: Answer
has comment: http://stackoverflow.com/comment/44054025
answers question: http://stackoverflow.com/q/27252195
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/27213649
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27200500
has body: I changed the "displayName" to "name" in the @RequestParam it works, thanks for chrome developer tools, it helps me. @RequestMapping(value = "/candidates/updateDisplayName", method = RequestMethod.POST) public @ResponseBody String updateDisplayName(@RequestParam(value = "name") String displayName, HttpServletRequest request) { System.out.println("Update display name"); System.out.println(displayName); return ""; }
answers question: http://stackoverflow.com/q/27200500
score: 1

http://stackoverflow.com/comment/42950413
type: AnswerComment
type: Comment
has text: @Arian you could copy it to an `int[]`
score: 3
comment on: http://stackoverflow.com/a/27236910

http://stackoverflow.com/q/27294772
has comment: http://stackoverflow.com/comment/43054350
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27295213
tagged with: java
has comment: http://stackoverflow.com/comment/43054298
tagged with: rows
type: Question
answer count: 2
score: 0
tagged with: sql
tagged with: sqlite
has title: SQL - How to ReOrganise a set of Rows
has answer: http://stackoverflow.com/a/27294910
accepted answer: http://stackoverflow.com/a/27294910
possible better answer: http://stackoverflow.com/a/27295213
has body: I have a table with the columns Name, QueuePosition Name QueuePosition John 1 Paul 1 Mike 2 Sarah 3 Kevin 4 George 4 How do i reorder them quickly to be like this? Name QueuePosition John 1 Paul 2 Mike 3 Sarah 4 Kevin 5 George 6 Thanks Edit -Should have been more specific i need it to be permanent if possible. Not just a select statement. There will be no more than 10 names in list. Possibly have to just save them in an array and overwrite the whole list. I was wondering is there a quick way of doing this.
has comment: http://stackoverflow.com/comment/43054470

http://stackoverflow.com/a/27294278
type: Answer
upvote count: 4
downvote count: 0
has body: String#replace() returns a new string, doesn't change the one it is invoked on, since strings are immutable. Use this in your code: base = base.replace(remove, "")
score: 4
answers question: http://stackoverflow.com/q/27294243

http://stackoverflow.com/q/27199128
type: AnsweredQuestion
has body: I'm developing my own RSA implementation in java. and while encrypting the data I'm encrypting each letter one by one and after calculating m^e mod n I'm getting values greater than 1000 and if i try to convert that value with (char) 1034 I'm getting ? this symbol for each character and I'm not able to decrypt the cipher text back to plain text what can i do please suggest some idea ???
has answer: http://stackoverflow.com/a/27199156
tagged with: java
tagged with: rsa
type: Question
score: 0
tagged with: char
has title: How to convert value greater than 1000 to char in java
answer count: 1
tagged with: integer
accepted answer: http://stackoverflow.com/a/27199156
tagged with: encryption

http://stackoverflow.com/q/27189531
type: Question
accepted answer: http://stackoverflow.com/a/27190098
has comment: http://stackoverflow.com/comment/42865208
has comment: http://stackoverflow.com/comment/42865269
has comment: http://stackoverflow.com/comment/42865531
upvote count: 5
has comment: http://stackoverflow.com/comment/42865927
has comment: http://stackoverflow.com/comment/42865649
has body: How could I calculate and display all digits of large numbers like 9999! (factorial of 9999) in java? Take a look at this url which calculates 9999! and dislays all digits.
score: 5
has comment: http://stackoverflow.com/comment/42867340
downvote count: 0
has answer: http://stackoverflow.com/a/27189700
has comment: http://stackoverflow.com/comment/42866174
possible better answer: http://stackoverflow.com/a/27189597
favorite count: 0
has title: How to calculate and display large numbers in java
has answer: http://stackoverflow.com/a/27189597
has answer: http://stackoverflow.com/a/27190098
answer count: 5
has comment: http://stackoverflow.com/comment/42867488
has answer: http://stackoverflow.com/a/27191417
has comment: http://stackoverflow.com/comment/42866332
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27189627
tagged with: java

http://stackoverflow.com/comment/42967876
has text: Does your assignment say what the "group" of teachers should be? I see you define a `Set` as a private variable. Are you supposed to get a `Set` of teachers? a `List`? Any kind of `Collection`? Array?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27246277

http://stackoverflow.com/a/27294910
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43068181
score: 1
answers question: http://stackoverflow.com/q/27294772
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27294772
has body: First, SQL tables represent unordered sets. So, there is no way to ensure that "John" comes before "Paul", unless you have another column. The canonical approach to what you want is the row_number() function. This is an ANSI standard function supported by most databases. The query is: select name, row_number() over (order by QueuePosition) as QueuePosition from table t; This can also be folded into an update, but the syntax would vary by database. EDIT: In SQLite you can do: with toupdate as ( select name, row_number() over (order by QueuePosition) as QueuePosition from tablename ) update tablename set QueuePosition = (select QueuePosition from toupdate where toupdate.name = tablename.name); EDIT II; In SQLite you can do: with toupdate as ( select name, (select count(*) from tablename t2 where t2.QueuePosition &lt;= t.QueuePosition) as QueuePosition from tablename t ) update tablename set QueuePosition = (select QueuePosition from toupdate where toupdate.name = tablename.name);
downvote count: 1

http://stackoverflow.com/q/27268298
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27486271
has answer: http://stackoverflow.com/a/27486271
tagged with: spring
tagged with: liferay-6
type: AnsweredQuestion
has title: Unable to make Spring MVC portlet with annotations make work
has body: This is my controller @Controller @RequestMapping("VIEW") public class SearchController { private static final Log LOGGER = LogFactoryUtil.getLog(SearchController.class); @RenderMapping public String render() { return "view"; } @ActionMapping(params = "action = getResults") public void getResults(@ModelAttribute("search") Search search, ActionRequest actionRequest, ActionResponse actionResponse) { String keyword = search.getKeyword(); LOGGER.info("Keyword: " + keyword); } } and my bean, public class Search { private String keyword; public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } } and my view.jsp &lt;%@page import="org.springframework.web.bind.annotation.RequestMethod"%&gt; &lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt; &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; &lt;portlet:defineObjects /&gt; &lt;portlet:actionURL var = "getResultsURL"&gt; &lt;portlet:param name="action" value="getResults"/&gt; &lt;/portlet:actionURL&gt; &lt;form:form action="${getResultsURL}" commandName="search" method="POST"&gt; &lt;form:input path="keyword"/&gt; &lt;input type="submit" value="Search"&gt; &lt;/form:form&gt; and I am getting the following exception java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'search' available as request attribute It is working fine if I place @ModelAttribute("search") as a parameter in render method, but I know it was absolutely wrong(correct me) Any suggestions?
type: Question
tagged with: spring-portlet-mvc
tagged with: java

http://stackoverflow.com/comment/43008240
has text: InvocationTargetException is just an abstraction layer over the real error. Please find the real error down the stacktrace (caused by... ) and post it here
comment on: http://stackoverflow.com/q/27268598
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42903849
type: Comment
type: QuestionComment
has text: Your code worked perfectly for me. Maybe you are reading the wrong file?
comment on: http://stackoverflow.com/q/27211294
score: 0

http://stackoverflow.com/comment/42906842
type: QuestionComment
comment on: http://stackoverflow.com/q/27212788
has text: I close every update , yes, I didn't understand the second thing u said
score: 0
type: Comment

http://stackoverflow.com/a/27233279
type: Answer
has comment: http://stackoverflow.com/comment/42943580
answers question: http://stackoverflow.com/q/27233116
has comment: http://stackoverflow.com/comment/42944319
score: 0
has comment: http://stackoverflow.com/comment/42943823
has comment: http://stackoverflow.com/comment/42944240
has comment: http://stackoverflow.com/comment/42943401
has body: output.write(buffer, 0, bytesRead) always uses the same offset. You are never really advancing in your resulting stream. You'd have to increment your offset by bytesRead EDIT: Explanation You are using https://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html#write%28byte[],%20int,%20int%29 This method writes the bytes in your buffer to the outputstream, starting at position 0. Now, in the next iteration, you read the next 4k bytes and again write it to the outputstream. But your offset hasn't changed, so you are not appending the new buffer-content but overwriting the previsously written bytes, because you said to write from position 0 again. Therefor, you need to advance the offset by the same amount of bytes you have previously written. EDIT: Spoiler So here's the spoiler: int bytesRead = -1; int offset = 0; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, offset, bytesRead); offset += bytesRead; } Not tested. Additionally, why do you want to write in 4k chunks? Why not just byte[] buffer = new byte[1]; while (input.read(buffer) &gt; 0) { output.write(buffer); }
has comment: http://stackoverflow.com/comment/42944585
has comment: http://stackoverflow.com/comment/42944007
has comment: http://stackoverflow.com/comment/42944062
has comment: http://stackoverflow.com/comment/42944370

http://stackoverflow.com/q/27301186
has body: I have a java program, and in one part of my code I have to read a string like this, ^s(group1) ^s(group2) and then return the strings "group1" and "group2" so I used this regexp \^s\(.*\) but it returns the whole string. What's wrong?
has title: How to I do this in regular expressions?
score: -1
possible better answer: http://stackoverflow.com/a/27301793
answer count: 2
has comment: http://stackoverflow.com/comment/43066082
upvote count: 0
has answer: http://stackoverflow.com/a/27301262
favorite count: 0
has comment: http://stackoverflow.com/comment/43066129
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43066027
tagged with: java
accepted answer: http://stackoverflow.com/a/27301262
has comment: http://stackoverflow.com/comment/43066454
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27301793

http://stackoverflow.com/comment/42968515
type: Comment
type: QuestionComment
score: 2
has text: Any reason why you still use raw collections/don't use foreach loops? Don't tell me you _still_ use Java 1.4?
comment on: http://stackoverflow.com/q/27246748

http://stackoverflow.com/comment/42991597
type: QuestionComment
has text: Please do not link to external resources, the code relevant to this problem specifically should be posted directly here.
comment on: http://stackoverflow.com/q/27258865
score: 0
type: Comment

http://stackoverflow.com/q/27268698
has body: I want to add a listener on java method and I saw the annotation @Interceptors and @AroundInvoke. I want to use it in a classic java project but all tutorials show me Java EE projects. Is it possible ?
answer count: 3
has answer: http://stackoverflow.com/a/27268844
downvote count: 0
favorite count: 0
tagged with: interceptor
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27268849
has answer: http://stackoverflow.com/a/27269119
has title: Interceptor API : in a classic java project
linked to: http://stackoverflow.com/q/14777865
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ejb

http://stackoverflow.com/a/27235722
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27215191
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27215191
has comment: http://stackoverflow.com/comment/42949446
type: AcceptedAnswer
has body: You mentioned that "word" is your has key and "cou" is you "attribute key". I assume by attribute key you mean range key. If you have both a hash and range key in your schema, you need to specify both in the key hashmap ("items"), you can't update with the hash key alone.

http://stackoverflow.com/q/27265351
tagged with: testng
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43002369
tagged with: excel
type: Question
has body: I need help folks, i'm stuck at a point. This is my code for after method @AfterMethod public void writeResult(ITestResult result) throws IOException, Exception { Workbook workbk = Workbook.getWorkbook(new File("D:\\Selenium Automation\\Selenium\\Framework\\Prototype\\Output\\eLogistics_Result_Latest.xls")); WritableWorkbook bookk = Workbook.createWorkbook(new File("D:\\Selenium Automation\\Selenium\\Framework\\Prototype\\Output\\eLogistics_Result_Latest_Written.xls"),workbk); int methodCellColumn =findCellLocationColumn("D:\\Selenium Automation\\Selenium\\Framework\\Prototype\\Output\\eLogistics_Result_Latest.xls", methodName); int methodCellRow =findCellLocationRow("D:\\Selenium Automation\\Selenium\\Framework\\Prototype\\Output\\eLogistics_Result_Latest.xls", methodName); if(result.getStatus() == ITestResult.SUCCESS) { System.out.println("Method-"+methodName+"- has Passed"); writeDataInCell(methodCellColumn+3, methodCellRow,"Pass",bookk); System.out.println("Method Column number is-&gt; "+(methodCellColumn+3)); System.out.println("Method row number is-&gt; "+methodCellRow); } else if(result.getStatus() == ITestResult.FAILURE) { System.out.println("Method-"+methodName+"- has Failed"); writeDataInCell(methodCellColumn+3, methodCellRow,"Fail",bookk); System.out.println("Method Column number is-&gt; "+(methodCellColumn+3)); System.out.println("Method row number is-&gt; "+methodCellRow+"\n"); } else if(result.getStatus() == ITestResult.SKIP) { System.out.println("Method-"+methodName+"- has Skipped"); writeDataInCell(methodCellColumn+3, methodCellRow,"Skip",bookk); System.out.println("Method Column number is-&gt; "+(methodCellColumn+3)); System.out.println("Method row number is-&gt; "+methodCellRow); } bookk.write(); bookk.close(); workbk.close(); } Methods used for getting column number &amp; cell number are returning correct results. its methods are- public int findCellLocationColumn(String xlPath,String runningMethod) throws Exception, IOException { Workbook workbk …
tagged with: java
tagged with: jxl
has answer: http://stackoverflow.com/a/27265700
accepted answer: http://stackoverflow.com/a/27265700
score: 0
has comment: http://stackoverflow.com/comment/43002534
answer count: 1
has title: Code executes successfully but the data is added in excel only at final iteration
has comment: http://stackoverflow.com/comment/43002732

http://stackoverflow.com/a/27313788
upvote count: 2
has body: The start() method of your Thread object isn't invoked twice, not even once actually: only the Runnable interface of your object is used. Actual Threads are created with each execute(), each delegating to your run() method.
answers question: http://stackoverflow.com/q/27313622
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/27243545
score: 0
type: Answer
has body: Let's start with a small example (note this uses raw types; and they are evil), public static void main(String[] args) { List&lt;String&gt; strings = Arrays.asList("Hello"); List&lt;Integer&gt; al = new ArrayList(strings); for (Integer v : al) { System.out.println(v); } } It compiles. If we run it we get Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at com.stackoverflow.Example.main(Example.java:11) Because String is not Integer. We can examine the bytecode with javap -v 35: invokeinterface #37, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 40: checkcast #43 // class java/lang/Integer 43: astore_3 44: getstatic #45 // Field java/lang/System.out:Ljava/io/PrintStream; And see that the cast fails on the line numbered 40. Generic types are for compile time type checking, at run-time (almost) everything is an Object.
answers question: http://stackoverflow.com/q/27243472

http://stackoverflow.com/comment/42905899
score: 1
type: Comment
type: QuestionComment
has text: Related reading: http://stackoverflow.com/questions/541487
comment on: http://stackoverflow.com/q/27212460

http://stackoverflow.com/comment/42832420
comment on: http://stackoverflow.com/q/27168901
type: Comment
type: QuestionComment
has text: I just expect to use `S[x][y]` method.
score: 0

http://stackoverflow.com/comment/42923604
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27222519
type: Comment
has text: Good way to think like this. If you don't mind, can you put some code here, so that i can get some idea.

http://stackoverflow.com/comment/42859374
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27186080
has text: Can you clarify exactly what you are trying to do?

http://stackoverflow.com/a/27226410
has comment: http://stackoverflow.com/comment/42936845
has comment: http://stackoverflow.com/comment/42937287
score: 0
type: Answer
has body: So basically you want to call other method in another JSP and takes id as the parameter, if yes, then you can do it this way : Sections List <c:if test="${!empty listSections}"> Section ID Section name Section size Section position Edit Delete <c:forEach items="${listSections}" var="section"> ${section.sectionid} ${section.sectionname} ${section.sectionsize} ${section.sectionposition} <a href="<c:url value='/editsection/${section.sectionid}' />" >Edit <a href="<c:url value='/removesection/${section.sectionid}' />" >Delete </c:forEach> </c:if> The method editSetion and RemoveSection can be in different JSP files as well, depends how you have mapped it. Is this what you are looking for? I cannot understand exactly what you want, as you have not provided much information, no code too.. Please add more code and properly explain if this is not what you expected.
answers question: http://stackoverflow.com/q/27226285

http://stackoverflow.com/q/27309750
has answer: http://stackoverflow.com/a/27310212
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43080882
has comment: http://stackoverflow.com/comment/43081214
has body: I am trying to un compress the string using recursive technic. I have a code that works for some and gives me an error for some like this Exception in thread "main" java.lang.NumberFormatException: For input string: "" for example, when i send in a string like 4a4b4c or 40A5B10c it works perfectly fine. The error comes when use string are like "a9T3b5R6t3h2g4v5b4n" here is my code public static void main(String[] args){ System.out.println(uncompress("a9T3b5R6t3h2g4v5b4n")); } public static String uncompress(String Text){ return uncompress(Text, "", ""); } public static String count(char ch, int n){ if(n == 0){return "";} return "" + ch + count(ch, n-1); } public static String uncompress(String Text, String count, String output){ if(Text.equals("")){ return output; } if(Character.isLetter(Text.charAt(0))){ output += count(Text.charAt(0), Integer.parseInt(count)); count = ""; } else if(Character.isDigit(Text.charAt(0))){ count += ("" + Text.charAt(0)); } return uncompress(Text.substring(1), count, output); }
score: 0
has comment: http://stackoverflow.com/comment/43101771
has title: uncompress string recursively
tagged with: string
possible better answer: http://stackoverflow.com/a/27310032
has answer: http://stackoverflow.com/a/27310032
has comment: http://stackoverflow.com/comment/43080942
has comment: http://stackoverflow.com/comment/43101808
has comment: http://stackoverflow.com/comment/43080875
accepted answer: http://stackoverflow.com/a/27310212
tagged with: recursion
has comment: http://stackoverflow.com/comment/43081057
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43080933

http://stackoverflow.com/a/27170209
type: Answer
downvote count: 0
has body: Most likely cause is that second system is missing some dlls that jahspotify.dll requires. You can check which dlls are required with Dependency Walker (http://www.dependencywalker.com/) and try manually putting these alongside jahspotify.dll. Commonly missing DLLs are from c++ redistributable packages and such.
score: 1
has comment: http://stackoverflow.com/comment/42833637
accepted answer of: http://stackoverflow.com/q/27169824
answers question: http://stackoverflow.com/q/27169824
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/27286997
downvote count: 0
has answer: http://stackoverflow.com/a/27287051
has body: Im creating a reminder program in java, this program will call another 3 JFrame according user input i success running 3 JFrame, but when i want to disable/ close the timer, only the first timer(SHORT BREAK) closed, the other two still run() 1.this is the code which handle each JFrame, as you can see i put 3 different method to call 3 different JFrame, but only the first method closed when i type timer.close(); private void callShortBreak(){ System.out.println("Start SHORT BREAK..."); timer = new Timer(systemTime.getShortBreakTime(), new ActionListener() { public void actionPerformed(ActionEvent e) { /*if(chckbxTakeAShort.isSelected()){*/ /*Notification_Short_Break notif_short = new Notification_Short_Break(); notif_short.runNotification();*/ System.out.println("SHORT BREAK-"+loopShortBreak+" : "+ systemTime.getShortBreakTime() +" milisecond"); loopShortBreak++; /*} */ } }); timer.setRepeats(true); timer.start(); } private void callLongBreak(){ System.out.println("Start LONG BREAK..."); timer = new Timer(systemTime.getLongBreakTime(), new ActionListener() { public void actionPerformed(ActionEvent e) { /*if(chckbxTakeALong.isSelected()){*/ /* Notification_Long_Break notif_long = new Notification_Long_Break(); notif_long.runNotification(systemTime.getLongBreakDuration());*/ System.out.println("LONG BREAK-"+loopLongBreak+" : "+ systemTime.getLongBreakTime() +" milisecond"); loopLongBreak++; /*} */ } }); timer.setRepeats(true); timer.start(); } private void callLongBreakNotify(){ System.out.println("Start Notification LONG BREAK"); timer = new Timer(systemTime.getLongBreakTime()-systemTime.getLongBreakNotifyTime(), new ActionListener() { public void actionPerformed(ActionEvent e) { /*if(chckbxNotifiyLongBreak.isSelected()){*/ /*Notification_Before_Long_Break notif_before_long = new Notification_Before_Long_Break(); notif_before_long.runNotification();*/ System.out.println("NOTIFICATION LONG BREAK-"+loopLongBreakNotification+" : "+ (systemTime.getLongBreakTime()-systemTi…
answer count: 1
favorite count: 0
tagged with: timer
upvote count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/27287051
type: AnsweredQuestion
has title: how to stop 2 javax.swing.Timer
tagged with: java
type: Question
score: 2

http://stackoverflow.com/a/27160873
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27153957
answers question: http://stackoverflow.com/q/27153957
has body: For a full / better explanation, please refer to: http://www.geeksforgeeks.org/dynamic-programming-set-4-longest-common-subsequence/ http://www.geeksforgeeks.org/printing-longest-common-subsequence/ I think that you are constructing the array correctly. However, I am not sure about the way the table is being read in order to construct the LCS. The idea is to start at the end of the 2D array solution[str1.length()][str2.length()] and if: The last characters of str1 and str2 are equal then the last character is part of the LCS and decrement both indexes If they are not equal, compare solution[i-1][j] and solution[i][j-1] and go in direction of greater value. Repeat until either of the indexes are 0.

http://stackoverflow.com/a/27300440
score: 1
has body: Change the code for displaying a field &lt;input type="text" name="username" value="${username}" id="username" placeholder="Enter name" required&gt; then a method to set it after loading public String loadAccount() { account = service.getAccountById(id); setUsername(account.getUserName()); return SUCCESS; }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27299929
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27299929

http://stackoverflow.com/comment/42942835
type: QuestionComment
comment on: http://stackoverflow.com/q/27232860
score: 0
has text: Do you mind explaining to me how does the BlockingQueue works when it comes to multiple thread taking objects out from A? Oh btw it is not a class assignment and it is not aim to build my own version of BlockQueue. It is needed in one of the functions in my internship work.
type: Comment

http://stackoverflow.com/comment/42812851
has text: I am unsure how to parse the JSON file into Eclipse - what is the array equivalent of parsing an object (Object obj = parser.parse(new FileReader("insert file location"));)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27158787

http://stackoverflow.com/comment/42850420
type: QuestionComment
score: 1
has text: this looks like an awful solution, are you sure they didn't want to trick you?!
comment on: http://stackoverflow.com/q/27180954
type: Comment

http://stackoverflow.com/comment/42937199
score: 0
type: AnswerComment
has text: I tried this:- String query = "DELETE FROM ANDYSHORT.DVDS WHERE ID = "+ idInt; PreparedStatement preparedStatement = con.prepareCall(query); preparedStatement.setInt(1, idInt); preparedStatement.executeUpdate(); But go the following exception message - "The column position '1' is out of range. The number of columns for this ResultSet is '0'."
type: Comment
comment on: http://stackoverflow.com/a/27228835

http://stackoverflow.com/comment/42879787
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example). 2) Always copy/paste error and exception output! 3) What is the point of setting a file filter after the file chooser has been sown (and dismissed)?
score: 0
comment on: http://stackoverflow.com/q/27194787
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27177775
downvote count: 0
accepted answer: http://stackoverflow.com/a/27177795
favorite count: 0
has title: Does a Java ByteArrayInputStream built off of bytes from a local String variable need to be closed?
has body: Let's say that I am constructing a Java ByteArrayInputStream off of a local String variable. For example, let's say that I have a large String named csv representing the contents of a CSV file and I need to put it into an input stream in order to have a component of my program read from that string, as opposed to from a file. For example, InputStream inputStream = new ByteArrayInputStream(csv.​getBytes(StandardCharsets.UTF_8)); Does this inputStream need to be closed once I am done processing with it? I am aware that it is usually a good practice to close unused input streams, often via the try-resources construct. What I am specifically interested in right now is what would be the consequences of choosing not to close this input stream before this variable goes out of scope when its method returns. Would there be a memory leak because I left a stream open? Or would it not matter because the stream was open on a local variable instead of on a File resource?
upvote count: 3
tagged with: bytearrayinputstream
has answer: http://stackoverflow.com/a/27177795
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: inputstream
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27177929
has answer: http://stackoverflow.com/a/27177929

http://stackoverflow.com/comment/42928033
type: Comment
comment on: http://stackoverflow.com/a/27224365
score: 0
type: AnswerComment
has text: If the open file handle is what prevents the file from being deleted, make sure to close the repository that is returned by init: `clone.getRepository().close()`.

http://stackoverflow.com/q/27302863
tagged with: http://stackoverflow.com/tag/xml
tagged with: stax
type: UnansweredQuestion
tagged with: java
type: Question
has title: Use StAX to read DTD from one XML doc and write to another
tagged with: dtd
score: 0
has answer: http://stackoverflow.com/a/27362191
has body: So I am doing some data cleaning, on a series of XML documents using StAX. I want to essentially read in the document and spit out the exact same document with a few of tags missing. The problem I'm having is that I'm not outputting valid XML. You can see my output on the left, and original doc on the right [here] (https://i.sstatic.net/aOptO.jpg). The image on the bottom is also the output from xmllint -valid. As you can see it says, that there is no DTD found, and that there's extra content at the end of the document. My code to implement the writer is this public XMLEventWriter setUpWriter(File blah) throws FileNotFoundException, XMLStreamException { newFileName = thef.getName().substring(0, thef.getName().indexOf("_") + 1); try { writer = outputFactory .createXMLEventWriter(new FileOutputStream(newFileName + "mush.xml"), "UTF-8"); } catch (XMLStreamException ex) { ex.printStackTrace(); System.out.println("There was an XML Stream Exception, whatever that means for writer"); } //outputFactory.setProperty("escapeCharacters", false); eventFactory = XMLEventFactory.newInstance(); StartDocument startDocument = eventFactory.createStartDocument(); writer.add(startDocument); //writer.add("&lt;!DOCTYPE DjVuXML&gt;"); return writer; } This is my code that handles the actual writing. if (event.isStartElement()) { //first it looks for start elements StartElement se = event.asStartElement(); if ("OBJECT".equals(se.getName().getLocalPart())) { writer.add(se); } else if ("MAP".equals(se.getName().getLocalPart())) { writer.add(se); } else if ("PARAM".equals(se.getName().getLocalPart())) { writer.add(se); } else if ("LINE".equals(se.getName().getLocalPart())) { writer.add(se); } else if ("DjVuXML".equals(se.getName().getLocalPart())) { writer.add(se); }else if ("WORD".equals(se.getName().getLocalPart())) { word.text = reader.getElementText(); EndElement wordEnd = eventFactory.createEndElement("", "", "WORD"); writer.add(se); Characters characters = eventFactory.createCharacters(w…
answer count: 1
tagged with: dtd-parsing

http://stackoverflow.com/comment/42909566
comment on: http://stackoverflow.com/q/27214741
score: 1
has text: Please show the Segment class, please show how you try to test equality.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43053805
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27294093
has text: final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)).getChildAt(0); viewGroup.addView(v); try this to add View then set CLICK listner for each view

http://stackoverflow.com/comment/43142325
comment on: http://stackoverflow.com/a/27331570
type: AnswerComment
has text: Thanks, it's looks better, but doesn't solve a problem: Caused by: java.time.DateTimeException: Unable to obtain ZoneId from TemporalAccessor: {},ISO resolved to 2014-04-23T04:30:45.123 of type java.time.format.Parsed So, it fails again because I can't set Default timezone for parser. Same thing for other parts, for examle date. For example, how can parse a string like '23:45' to ZonedDateTime with current date and system time zone?
type: Comment
score: 0

http://stackoverflow.com/comment/42912337
type: QuestionComment
comment on: http://stackoverflow.com/q/27216232
has text: It has nothing to do with `PreparedStatement`. You're using that variable in an anonymous class, that is why it has to be final. Read [this answer](http://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen/1299889#1299889) for more information.
score: 0
type: Comment

http://stackoverflow.com/q/27207759
answer count: 1
favorite count: 0
tagged with: encryption
accepted answer: http://stackoverflow.com/a/27215356
tagged with: spring
has title: Is it possible to lower the encryption level to avoid the error: Unable to initialize due to invalid secret key
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27215356
has comment: http://stackoverflow.com/comment/42909201
type: Question
has body: import org.junit.Test; import org.springframework.security.crypto.encrypt.Encryptors; import org.springframework.security.crypto.encrypt.TextEncryptor; public class EncryptorTest { @Test public void testEncryption() { TextEncryptor te = Encryptors.text("password", "abcdef"); te.encrypt("Hello World!"); } } I get this error: java.lang.IllegalArgumentException: Unable to initialize due to invalid secret key It seems that I have to download some policy file JCE extension to get this to work: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html I want to avoid this added dependency during deployment, and honestly I don't need 256 bit encryption for this. Is it possible to lower the level to something that works w/o having to download this JCE extension?
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/a/27310156
has comment: http://stackoverflow.com/comment/43108827
type: Answer
has comment: http://stackoverflow.com/comment/43163222
answers question: http://stackoverflow.com/q/27307266
has body: Post the full stack trace and your stack/JVM properties. It must have to do with the binding address. This is most likely an OS or JVM problem. Try repeating the ipv6 connection from an independent test tool like netcat to verify. There are many settings in the OS that will block ipv6 connection attempts.
score: 0

http://stackoverflow.com/comment/43003114
type: Comment
has text: What type is tempObject and tempBullet? Where did you declare these variables?
score: 0
comment on: http://stackoverflow.com/q/27261610
type: QuestionComment

http://stackoverflow.com/q/27204488
accepted answer: http://stackoverflow.com/a/27204528
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27205441
type: Question
has body: I have the standard version of the Eclipse IDE. That has a number of important projects on it. However, I need to use "Eclipse IDE for Java EE Developers". There are a few related questions that I have: Is there a way to upgrade my Eclipse IDE to "Java EE Developers" without actually have to reinstall the entire Eclipse IDE (I tried simply searching Eclipse marketplace and there was nothing there as far as upgrades to Java EE Developers is concerned) If an upgrade is made (assuming the answer to #1 is "yes") to "Java EE Developers" will the current applications on the Eclipse IDE be deleted and will they still work on the "Java EE Developers". As I have no experience with "Eclipse IDE for Java EE Developers" it makes sense to ask these questions to people who have had experience with it.
answer count: 2
tagged with: ide
has answer: http://stackoverflow.com/a/27204528
has comment: http://stackoverflow.com/comment/42891539
score: 0
has title: Eclipse IDE for Java EE Developers
has answer: http://stackoverflow.com/a/27205441
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42898262
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27208062
has text: I edited the question. I am basically trying to automate the assignment of declared variables. I could obviously copy and past some code for each, but if this is possible it would simplify the class. @MatthewC FooTwo and FooThree have no code and are just representative of different types.

http://stackoverflow.com/q/27213958
type: Question
tagged with: arrays
has title: What happens, if you overwrite an array
has comment: http://stackoverflow.com/comment/42908144
has answer: http://stackoverflow.com/a/27214071
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/27213971
favorite count: 0
type: UnansweredQuestion
score: -3
has body: I have for example two arrays: float a[][] = new float[3][3]; float b[][] = new float[7][7]; I am wondering what happens, if you now write a = b; What happens to all the values in a? What length does array a have now? Which values does it have?
has comment: http://stackoverflow.com/comment/42908192
has comment: http://stackoverflow.com/comment/42908136
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42941735
type: Comment
type: QuestionComment
has text: Ok thanks, but how to use it?
score: 0
comment on: http://stackoverflow.com/q/27230625

http://stackoverflow.com/comment/42956165
type: AnswerComment
has text: Why not go from `i = 1` to `i <= 10`? Then you can just use `k < i` instead of `k < (i + 1)`, and the value of `i` would better reflect what it is being used for IMO.
comment on: http://stackoverflow.com/a/27239748
type: Comment
score: 1

http://stackoverflow.com/comment/42943561
has text: Dear ToYonos, no, it did not work under any conditions. The app would crash at runtime, because (I think) the ExifInterface was being instantiated wrongly.
score: 0
comment on: http://stackoverflow.com/q/27232917
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27196074
score: 0
has title: Android Eclipse - App crashing on startup, attempting to implement leaderboard
tagged with: android
has comment: http://stackoverflow.com/comment/42877198
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42877259
tagged with: java
has body: Basically I have a game app which I'm attempting to implement a leaderboard into, I'm following this tutorial http://code.tutsplus.com/tutorials/google-play-game-services-leaderboards--cms-20700 and so far I am trying to allow the app to sign into google play but when I run my app it currently crashes on startup, I get this in my logcat: Here is my code: public class Mainmenu extends BaseGameActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_menu); findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); final Button click=(Button)findViewById(R.id.button1); // Button to game click.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent launchactivity= new Intent(Mainmenu.this,Game.class); startActivity(launchactivity); } }); String file = "highscore"; try{ FileInputStream fin = openFileInput(file); int c; String temp=""; while( (c = fin.read()) != -1){ temp = temp + Character.toString((char)c); } TextView textview = (TextView)findViewById(R.id.textView1); textview.setText("Highscore: " + temp); }catch(Exception e){ } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.mainmenu, 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); } @Override public void onSignInFailed() { // TODO Auto-generated method stub findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE); findViewById(R.id.sign_out_button).setVisi…
type: Question
has comment: http://stackoverflow.com/comment/42877443
has comment: http://stackoverflow.com/comment/42877114

http://stackoverflow.com/a/27289552
has body: synchronization mechanism make methods a little bit slower so try to not synchronize method if you have only one thread
has comment: http://stackoverflow.com/comment/43045453
type: Answer
has comment: http://stackoverflow.com/comment/43045884
downvote count: 1
score: 3
upvote count: 4
answers question: http://stackoverflow.com/q/27289473

http://stackoverflow.com/comment/43010637
has text: will someone be able to get the address of the off-heap location and then use a process dump to get the value?
type: AnswerComment
comment on: http://stackoverflow.com/a/27256978
score: 0
type: Comment

http://stackoverflow.com/comment/42852749
score: 0
has text: can you post screenshot plz?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27182430

http://stackoverflow.com/q/27232940
upvote count: 2
has body: I'm brand new to server concept in java. I've set up a very simple server (most of it was copied from he net) and I would like it to send at what "status" it is, but I would like it to send it only once. Here is my code it might be more clear. Server: package components; import java.io.DataInputStream; import java.io.PrintStream; import java.io.IOException; import java.net.Socket; import java.net.ServerSocket; public class mainServer { // The server socket. private static ServerSocket serverSocket = null; // The client socket. private static Socket clientSocket = null; // This chat server can accept up to maxClientsCount clients' connections. private static final int maxClientsCount = 3; private static final clientThread[] threads = new clientThread[maxClientsCount]; public static void main(String args[]) { // The default port number. int portNumber = 3333; if (args.length &lt; 1) { System.out .println("Usage: java MultiThreadChatServer &lt;portNumber&gt;\n" + "Now using port number=" + portNumber); } else { portNumber = Integer.valueOf(args[0]).intValue(); } /* * Open a server socket on the portNumber (default 2222). Note that we can * not choose a port less than 1023 if we are not privileged users (root). */ try { serverSocket = new ServerSocket(portNumber); } catch (IOException e) { System.out.println(e); } /* * Create a client socket for each connection and pass it to a new client * thread. */ while (true) { try { clientSocket = serverSocket.accept(); int i = 0; for (i = 0; i &lt; maxClientsCount; i++) { if (threads[i] == null) { (threads[i] = new clientThread(clientSocket, threads)).start(); break; } } if (i == maxClientsCount) { PrintStream os = new PrintStream(clientSocket.getOutputStream()); os.println("Server too busy. Try later."); os.close(); clientSocket.close(); } } catch (IOException e) { System.out.println(e); } } } } /* * The chat client thread. This client thread opens the input and the output * streams for a particular client, ask the client's name…
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42942784
favorite count: 0
has comment: http://stackoverflow.com/comment/42942861
has comment: http://stackoverflow.com/comment/42942986
type: UnansweredQuestion
type: Question
has title: Communication between Java server and Client
has comment: http://stackoverflow.com/comment/42942947
tagged with: server
has comment: http://stackoverflow.com/comment/42942850
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27233631
has comment: http://stackoverflow.com/comment/42942950

http://stackoverflow.com/q/27307505
answer count: 1
has title: How to modify subsequent points in an array
tagged with: java
has answer: http://stackoverflow.com/a/31884477
upvote count: 1
has comment: http://stackoverflow.com/comment/43077298
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43077454
has body: So for this pset I'm doing (for a Candy Crush clone), I have to write a method that checks for any possible matches in the row of a board that the chosen point is on. The method found would check to the right of the chosen point, and return an array of matching points to the chosen point. Within the given code, the getRowBools function is supposed to generate a boolean array with true or false depending on whether the points are the same as the chosen one. Then, the method would find the length of trues after the chosen one, then this length should determine the length of a new point array. Following that, the method is supposed to place all of the relevant points to the new array. However, I don't quite understand how to modify the point values in a way that works. public static Point[] buildPossibleMatchRow(Point p, Board b) { int x = p.x; int y = p.y; boolean[] matches = b.getRowBools(new Point(x,y)); int amtcorrectx = 0; for (int i=0; i &lt; matches.length; i++) { if (matches[i]) { amtcorrectx++; } } Point[] returnVals = new Point[amtcorrectx]; returnVals[0] = p; for (int i=0; i &lt; returnVals.length; i++) { x++; } return returnVals; } Here's the code I have so far, but I'm sure that there's something wrong with the for loop at the end. Is there anything that I'm missing?
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/43082291
has text: Check the versions of JRE and JRK it should match with each other.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27310689

http://stackoverflow.com/comment/43018998
comment on: http://stackoverflow.com/q/27274299
score: 0
type: Comment
type: QuestionComment
has text: I'd put it in system properties and do @Value(value="#{systemProperties['session-timeout']}")

http://stackoverflow.com/q/27171145
has title: Open external console from Netbeans using Java
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: Is it possible to open an external console window when executing your Java program from Netbeans, instead of the standard inner console/output window inside of Netbeans? I have searched through the project configuration and Netbeans preferences without finding any useful option. I know that while using C/C++ it is possible to choose from the config what console to use (inner/outer), but I'm affraid it's not possible with Java. Does anyone have some insight into the Java matter? Thanks!
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43074382
tagged with: console
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42921397
type: Comment
comment on: http://stackoverflow.com/q/27177641
type: QuestionComment
has text: Yes, I want the user to set the actual operating system time zone from java application.
score: 0

http://stackoverflow.com/comment/89630847
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27169497
has text: This doesn't do what the question asks for. See https://ideone.com/mWhPIT. The question asks for the order `1some, 2some, 3some, 20some, 21some, some`.

http://stackoverflow.com/a/27287000
downvote count: 1
score: 1
has body: I have solution using not only jackson API but with the use of org.json API also. String str = "{\"randomName\":{\"id\":22600348,\"name\":\"Ateuzz\",\"profileIconId\":546,\"summonerLevel\":30,\"revisionDate\":1378316614000}}"; JSONObject json = new JSONObject(str); Iterator&lt;?&gt; keys = json.keys(); while(keys.hasNext()) { String key = (String)keys.next(); Details test = new ObjectMapper().readValue(json.getJSONObject(key).toString(), Details.class); } Here i have use another JAVA Json API to convert your string into jsonObject and than iterate it to get your first key value and map that to your class Details. I assume that your json format is same as you have mention in your question. May this will help you.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27286528
answers question: http://stackoverflow.com/q/27286528
type: Answer
upvote count: 2

http://stackoverflow.com/q/27283265
answer count: 1
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43038549
has answer: http://stackoverflow.com/a/27283397
type: UnansweredQuestion
tagged with: java
has body: The application was working just great and all of a sudden it gave me this error stating the onOptionsItemSelected(MenuItem) method is undefined. I couldn't understand what they exactly mean and what solution I should refer to. This is the code: package com.noura.luba; import java.util.List; import java.util.Stack; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.ActionBar.TabListener; import android.app.Dialog; import android.content.Intent; import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class Degree_Programs extends FragmentActivity implements TabListener{ AppSectionsPagerAdapter mAppSectionsPagerAdapter; ViewPager mViewPager; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.degree_programs); mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); for (int i = 0; i &lt; mAppSectionsPagerAdapter.getCount(); i++) { if (i==0){ actionBar.addTab( actionBar.newTab() .setText("Study Cycle") .setTab…
has title: The method onOptionsItemSelected(MenuItem) is undefined for the type FragmentPagerAdapter
type: Question
has comment: http://stackoverflow.com/comment/43126902

http://stackoverflow.com/q/27170657
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27170987
has comment: http://stackoverflow.com/comment/42832150
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27171275
has answer: http://stackoverflow.com/a/27171275
has comment: http://stackoverflow.com/comment/42831991
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42834226
answer count: 2
has comment: http://stackoverflow.com/comment/42832110
has answer: http://stackoverflow.com/a/27170987
has comment: http://stackoverflow.com/comment/42848899
has title: Sending ArrayList<Object> through socket. Java
tagged with: serialization
has body: What i'm trying to do is to send and ArrayList through a socket from Android client to Java server. Here is the code of client which sends the ArrayList : private void sendContacts(){ AppHelper helperClass = new AppHelper(getApplicationContext()); final ArrayList&lt;Person&gt; list = helperClass.getContacts(); System.out.println("Lenght of an contacts array : " +list.size()); // for (Person person : list) { // System.out.println("Name "+person.getName()+"\nNumber "+ person.getNr()); // } handler.post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub try { //**151 line** os.writeObject(list); os.flush(); } catch (IOException e) { // TODO Auto-generated catch block Log.e(TAG, "Sending Contact list has failed"); e.printStackTrace(); } } }); } public ArrayList&lt;Person&gt; getContacts() { ArrayList&lt;Person&gt; alContacts = null; ContentResolver cr = mContext.getContentResolver(); //Activity/Application android.content.Context Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if(cursor.moveToFirst()) { alContacts = new ArrayList&lt;Person&gt;(); do { String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); if(Integer.parseInt(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",new String[]{ id }, null); while (pCur.moveToNext()) { String contactNumber = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); String contactName = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); Person temp = new Person(contactName, contactNumber); alContacts.add(temp); break; } pCur.close(); } } while (cursor.moveToNext()) ; } return alContacts; } Here is the server code: private void whileChatting() throws IOException { ableToType(true); String…
tagged with: sockets
tagged with: android

http://stackoverflow.com/comment/42895729
score: 1
has text: possible duplicate: http://stackoverflow.com/q/18928295/2777098
comment on: http://stackoverflow.com/q/27206639
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27267984
answers question: http://stackoverflow.com/q/27267919
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43008743
upvote count: 2
has body: main is a static method, therefor it is not associated with any instance of the class. As a result it can not call an instance method(as it needs to be associated with an instance) unless it first creates an instance. Maybe you need to read more about the meaning of static?
type: Answer

http://stackoverflow.com/comment/42932823
type: Comment
comment on: http://stackoverflow.com/a/27179484
score: 0
type: AnswerComment
has text: Thank you @teovald !! I am reading about Dagger 2 and seems pretty awesome!

http://stackoverflow.com/q/27187550
type: UnansweredQuestion
has title: android google map API problems
has comment: http://stackoverflow.com/comment/42861728
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27187983
tagged with: google-maps-api-3
score: 0
answer count: 3
tagged with: google-maps
has answer: http://stackoverflow.com/a/27188171
has body: Right, I understand this question has been answered on many places, And yet I don't get what problem I have, I have recently moved to android application and trying to use map on my app. I exactly followed these links: https://www.youtube.com/watch?v=wNlleczyPjs https://developers.google.com/maps/documentation/android/start#install_and_configure_the_google_play_services_sdk So my question is, what else could I have done wrong. I just don't get it... My feeling is that my key is not registered properly but when I created new key I provided following information: Android apps: 9D:7C:&lt;THIS BIT IS SECRET&gt;84:0F;com.example.myapp EXTRA INFORMATION here is the error log: 11-28 11:09:59.471: E/AndroidRuntime(31683): FATAL EXCEPTION: main 11-28 11:09:59.471: E/AndroidRuntime(31683): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.app.ActivityThread.access$600(ActivityThread.java:140) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.os.Handler.dispatchMessage(Handler.java:99) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.os.Looper.loop(Looper.java:137) 11-28 11:09:59.471: E/AndroidRuntime(31683): at android.app.ActivityThread.main(ActivityThread.java:4898) 11-28 11:09:59.471: E/AndroidRuntime(31683): at java.lang.reflect.Method.invokeNative(Native Method) 11-28 11:09:59.471: E/AndroidRuntime(31683): at java.lang.reflect.Method.invoke(Method.java:511) 11-28 11:09:59.471: E/AndroidRuntime(31…
has answer: http://stackoverflow.com/a/27187790
tagged with: android
has comment: http://stackoverflow.com/comment/42861784

http://stackoverflow.com/comment/42976168
type: Comment
comment on: http://stackoverflow.com/a/27250898
has text: Before adding 3rd party library dependencies to your project, it’s always worth checking out [Java’s built-in capabilities](http://docs.oracle.com/javase/7/docs/api/java/text/BreakIterator.html#getSentenceInstance())…
score: 2
type: AnswerComment

http://stackoverflow.com/comment/43057435
type: Comment
comment on: http://stackoverflow.com/a/27296407
has text: @user2580086 No, an abstract class with no abstract methods is not a concrete class.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42937162
type: QuestionComment
has text: What you could try, is to rewrite the process using standard arrays and manual standard loops. At least then you have direct control of the looping logic and you wont have concurrency issues. It might also reveal some logical issues with your code flow.
comment on: http://stackoverflow.com/q/27229382
score: 0
type: Comment

http://stackoverflow.com/q/27163552
has body: Issue : I am working with Selenium Java Web Browser Automation. The problem is when the Java code goes to the particular button for click, the button already remains in off status as a result of which that button is never clicked and thus throws an exception at every clickable link present on the web. Here is the code I have written for the link click event. Also I have enabled element.click(). It's not working too. public String click_On_Link(String locatorType, String value) throws InterruptedException { String status = "Pass"; try { final By locator; locator = locatorValue(locatorType, value); WebElement element = driver.findElement(locator); element.sendKeys(Keys.ENTER); //element.click(); /* * element.sendKeys(Keys.chord(Keys.ENTER, "a")); element.click(); */ } catch (NoSuchElementException e) { System.err.format("No Element Found to Click" + e); status = "Fail" + "::" + e.getCause(); } return status; } Here is the status of the button event whenever Selenium tries to reach this button : &lt;a class="t3_button_off" onmouseover="window.status='Address Information'; return true;"
answer count: 0
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/42821635
has title: How to handle button off status while working with selenium
score: 0
has comment: http://stackoverflow.com/comment/42821748
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42821214

http://stackoverflow.com/a/27273015
type: Answer
has comment: http://stackoverflow.com/comment/43015887
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43016923
has comment: http://stackoverflow.com/comment/43020280
has body: Use just: public static void executeAsync(AsyncTask&lt;?, ?, ?&gt; task, Object[] params) { instead of: public static void executeAsync(Class&lt;? extends AsyncTask&lt;?, ?, ?&gt;&gt; task, // ... as you do not need to pass the class but the actual instance. EDIT As you mentioned in comment there was also a parametrized type mismatch, so you also need to adjust the parameter type. So the signature should look like: public static void executeAsync(AsyncTask&lt;Object, ?, ?&gt; task, Object[] params) Or (in order to make it more "flexible") public static &lt;T&gt; void executeAsync(AsyncTask&lt;T, ?, ?&gt; task, T... params) { A supress lint annotation @SuppressLint({ "InlinedApi", "NewApi" }) can also be expected if you have lint enabled.
answers question: http://stackoverflow.com/q/27272754
accepted answer of: http://stackoverflow.com/q/27272754
has comment: http://stackoverflow.com/comment/43015682
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42903966
type: QuestionComment
has text: @Prateek How would I do that? `return passageExits(robot).passageDirections.get(0);`?
comment on: http://stackoverflow.com/q/27211428
score: 0
type: Comment

http://stackoverflow.com/comment/42917028
type: Comment
has text: So are you trying to hide the password? As in asterisks replacing the letters?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27218724

http://stackoverflow.com/q/27218736
answer count: 3
upvote count: 10
favorite count: 0
possible better answer: http://stackoverflow.com/a/27218767
has answer: http://stackoverflow.com/a/27218761
accepted answer: http://stackoverflow.com/a/27218761
type: AnsweredQuestion
has body: I know what an Infinite Loop error is. Is a stack overflow error the same thing. If not, what is the difference? Can you give example code as well?
score: 7
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/76835816
tagged with: infinite-loop
has comment: http://stackoverflow.com/comment/42916751
has answer: http://stackoverflow.com/a/27218767
tagged with: stack-overflow
has title: Stack Overflow error vs. Infinite loop

http://stackoverflow.com/q/27213742
has answer: http://stackoverflow.com/a/44355789
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27217784
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/27217784
has title: Checking for equality of RDDs
possible better answer: http://stackoverflow.com/a/44355789
answer count: 2
tagged with: apache-spark
tagged with: junit
downvote count: 0
favorite count: 0
tagged with: equals
has body: I making some tests in JUnit and I need to check the equality of two Spark RDDs. A way I thought of doing it is this: JavaRDD&lt;SomeClass&gt; expResult = ...; JavaRDD&lt;SomeClass&gt; result = ...; assertEquals(expResult.collect(), result.collect()); Is there a better way than this?

http://stackoverflow.com/a/27294079
has comment: http://stackoverflow.com/comment/43053480
has comment: http://stackoverflow.com/comment/43056664
has comment: http://stackoverflow.com/comment/43055868
has comment: http://stackoverflow.com/comment/43053727
has comment: http://stackoverflow.com/comment/43053505
has body: Is it simply a typo? intergratedsecurity=true should be integratedSecurity=true Windows auth means that SQL Server uses the Windows login token. Because of this typo, it expects a username and password whcih you don't have. Hence the error message Login failed for user ''.
has comment: http://stackoverflow.com/comment/43053671
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27293833

http://stackoverflow.com/a/27300773
score: 1
has body: You should always try to make your code as readable as possible. And generally, your code is more readable the better formatted it is. Placing two statements on the same line is usually seen as harder to read then having each statement get it's own line.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27300725
downvote count: 0

http://stackoverflow.com/comment/42855486
has text: Or maybe you just focus on unit testing: Throw from the default case, and write a test that iterates over the enum values such that control enters the switch with each of them.
comment on: http://stackoverflow.com/q/27183917
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42906787
score: 0
type: Comment
has text: @Anurag, by less verbose I mean less code (since you leave out the `new Runnable()` part). @MarkoTopolnik has a good point regarding composition though. Reformulating my answer slightly.
type: AnswerComment
comment on: http://stackoverflow.com/a/27212480

http://stackoverflow.com/a/27179146
answers question: http://stackoverflow.com/q/27178431
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27178431
has body: Although the manual page for journalctl tells you that adding a user to systemd-journal should allow them to access all journals, that doesn't work on CentOS 7. I have initially worked around this by doing: chmod +s /usr/bin/journalctl But that gives everyone access to the journals and that might not be what you want. As @RealSkeptic pointed out the man page for systemd-journald.service indicates that additional access rights can be given to groups to read the journal (and states as well that adding a user to systemd-journal should be enough). Combining that information you can do sudo setfacl -Rnm g:systemd-journal:rx,d:g:systemd-journal:rx /run/log/journal/ and after that adding the user to the systemd-journal group, as per the man pages, is enough to allow access to the journals: sudo usermod -a -G systemd-journal your_user_name

http://stackoverflow.com/comment/43022151
comment on: http://stackoverflow.com/a/27276118
type: AnswerComment
score: 0
type: Comment
has text: Yes, so you need to add in the action_strings. I updated the answer with an example.

http://stackoverflow.com/a/27259632
has body: There is no no-arg add method in ArrayList to call. If there were, then you would write super.add();. But overriding a method just to call super.add() and nothing else is the same as not overriding the method at all and letting your subclass inherit the method. I suspect you want something like this: @Override public void add(E e) { // Write code here to find the index where it belongs, in an "index" variable. // Then call super.add with the proper index so it remains sorted. super.add(index, e); }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27259383
downvote count: 0

http://stackoverflow.com/comment/43038459
type: QuestionComment
has text: Thank you MadProgrammer. I should name myself NoobProgrammer. Cheers!
score: 0
comment on: http://stackoverflow.com/q/27285233
type: Comment

http://stackoverflow.com/a/27165812
downvote count: 0
has comment: http://stackoverflow.com/comment/42854630
has comment: http://stackoverflow.com/comment/42854562
has comment: http://stackoverflow.com/comment/42854826
has comment: http://stackoverflow.com/comment/42854261
has comment: http://stackoverflow.com/comment/42852845
score: 1
has comment: http://stackoverflow.com/comment/42854114
has comment: http://stackoverflow.com/comment/42852697
upvote count: 1
has body: You should pass Hashtable from servlet to JSP. Servlet HashMap latsMap = new HashMap(); HashMap lonMap = new HashMap(); for(int i=0;i&lt;json.length();i++) { String lat=json.getJSONObject(i).get("lat").toString(); String lon=json.getJSONObject(i).get("lon").toString(); lats[i]=lat; lons[i]=lon; latsMap.put("lats"+i,lats[i])); lonMap.put("lons"+i,lons[i])); System.out.println(lats[i]+","+lons[i]); } //You can put these as Session attribute also request.setAttribute("lats", latsMap); request.setAttribute("lons", lonMap); JSP &lt;% HashMap latsMap==(HashMap)request.getAttribute("lats"); HashMap lonMap=(HashMap)request.getAttribute("lons"); int len = latsMap.size(); for(int i=0;i&lt;len;i++) { String lats = latsMap.get("lats"+i); String lon= lonMap.get("lons"+i); String locations ="'"+request.getAttribute("cid")+"',"+lats+","+lon+""; //If request.setAttribute("cid",&lt;SomeValue&gt;); is not present in servlet then //remove request.getAttribute("cid") from JSP , Change it to //String locations ="[,"+lats+","+lon+"]]"; out.println(locations); } %&gt;
has comment: http://stackoverflow.com/comment/42853918
type: Answer
answers question: http://stackoverflow.com/q/27164881
has comment: http://stackoverflow.com/comment/42851897
has comment: http://stackoverflow.com/comment/42854526

http://stackoverflow.com/a/27160143
type: Answer
has body: It probably has something to do with the height being derived from getHeight() because it it doesn't bounce, then Y * -1 would probably be equal to 0 * -1, which would mean nothing.
has comment: http://stackoverflow.com/comment/43155069
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42814336
has comment: http://stackoverflow.com/comment/42958635
accepted answer of: http://stackoverflow.com/q/27160067
answers question: http://stackoverflow.com/q/27160067

http://stackoverflow.com/a/27204889
score: 2
answers question: http://stackoverflow.com/q/27204527
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27204527
upvote count: 2
has body: You can end up sharing the same hash map in several places: when one of the maps does not have an entry for "H", you make t the value for that key. Therefore, when you next time add items to that map, the added items appear in all the maps where t was inserted before. In other words, the error happens because the map was added to more than one position in some previous iteration. The safest is to create a new HashMap when one does not exist for the "H" key, instead of using t.
type: Answer

http://stackoverflow.com/q/27230742
has body: I'm trying to read the data in excel using apache poi and make some hqls and then execute them to insert to database. I want if there's any hql failed when executing then the transaction will roll back all the hqls. Is there any way to execute multiple hqls in 1 transaction ? Any help would be great
tagged with: struts
has title: how to execute multiple hql in 1 transaction
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42940388
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42938887
type: Question
has comment: http://stackoverflow.com/comment/42938374

http://stackoverflow.com/comment/43032248
has text: I updated my post accordingly, using the same main and test class names as you did.
comment on: http://stackoverflow.com/a/27281603
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43054106
type: QuestionComment
has text: show us the line 261 of GuiAsApplet.java
comment on: http://stackoverflow.com/q/27294023
score: 0
type: Comment

http://stackoverflow.com/q/27180640
type: Question
answer count: 1
score: 0
tagged with: javac
has answer: http://stackoverflow.com/a/27180841
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42849758
tagged with: java
has title: Java Symbol not found through javac weird error (Runs through Eclipse)
has body: My project runs smoothly in Eclipse, no errors at all. I ran it through local tests (that are equal to the ones in an online mooshak contest) and all checks out. But when I sumbit it online, I get a CompileTimeError. To try to locate the problem, I attempted to use javac in Main.java, and this happened: javac -encoding US-ASCII Main.java Main.java:8: error: package code does not exist import code.*; ^ Main.java:129: error: cannot find symbol public static void addWords(Scanner in, LibSystem system, int wordCount) { ^ symbol: class LibSystem location: class Main Main.java:153: error: cannot find symbol public static void searchWord(LibSystem system, String word) { ^ Other symbol errors follow for every reference to classes from my only package, which I fully import and the header of Main, for a total of 29 errors. Project src Main.java code (package with all my other java files)
tagged with: eclipse

http://stackoverflow.com/comment/42908098
has text: Thanks for your efforts. +1
comment on: http://stackoverflow.com/a/27212164
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27208234
has title: Java text not formatting properly
has answer: http://stackoverflow.com/a/27208265
score: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27208390
has body: I just can't seem to figure out how to get java to format my output properly. The code snipet for output is: System.out.format("\n %1s%20s%25s", intDf.format(i), df.format(monthlyPayment), df.format(totalPayment)); the output appears like this: Interest Rate Monthly Payment Total Payment 5 188.71 11322.74 5.125 189.29 11357.13 5.25 189.86 11391.59 5.375 190.44 11426.11 5.5 191.01 11460.7 5.625 191.59 11495.35 5.75 192.17 11530.06 5.875 192.75 11564.84 6 193.33 11599.68 6.125 193.91 11634.59 6.25 194.49 11669.56 6.375 195.08 11704.59 6.5 195.66 11739.69 6.625 196.25 11774.85 6.75 196.83 11810.08 6.875 197.42 11845.37 7 198.01 11880.72 7.125 198.6 11916.14 7.25 199.19 11951.62 7.375 199.79 11987.16 7.5 200.38 12022.77 7.625 200.97 12058.44 7.75 201.57 12094.18 7.875 202.17 12129.97 8 202.76 12165.84 I want all the values to line up at the first letter in their corresponding line. Any help is appreciated, thanks!
type: UnansweredQuestion

currency
tag name: currency
tags question: http://stackoverflow.com/q/27171901
tags question: http://stackoverflow.com/q/27228514
type: Tag
tags question: http://stackoverflow.com/q/27299372
tags question: http://stackoverflow.com/q/27168823

http://stackoverflow.com/a/27295888
downvote count: 0
has comment: http://stackoverflow.com/comment/43635908
has comment: http://stackoverflow.com/comment/43056216
type: Answer
has body: Just had a look in the source for AbstractEntityPersister. Seems like this is filled like this: propertyUniqueness[i] = prop.getValue().isAlternateUniqueKey(); which seems to indicate the "getPropertyUniqueness" would be more appropriately named "getAlternateUniqueKey". Likely, getPropertyUniqueness will return true only for unique-key="true" and not for unique="true" in your hbm.xml.
score: 1
has comment: http://stackoverflow.com/comment/43057990
upvote count: 1
answers question: http://stackoverflow.com/q/27295474

http://stackoverflow.com/comment/42822202
has text: Probably because the file is still not closed. Ending your application closes the filehandle. As Mureinik and Adrian B. have pointed out, I would not use the library in the current state. Maybe PSTFile could implement AutoCloseable.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27164870
type: Comment

http://stackoverflow.com/comment/42816829
score: 0
type: QuestionComment
has text: First of all, Am I right to feed in the posterior probability gotten from Naive Bayes for my documents to my SVM as feature vectors, If Yes, how do I feed it into javaml or libsvm to be able to train and classify my test legal cases?
comment on: http://stackoverflow.com/q/27160371
type: Comment

http://stackoverflow.com/a/27299413
has body: There are subtle difference between synchronized blocks, Lock.lock(), Lock.tryLock() and Lock.tryLock(timeout). The tryLock method acquires the lock only if it is not held by another thread at the time of invocation. So when it can not acquire the lock it returns immediately. The lock method will wait until the lock is available, while waiting that thread is dormant. The same goes for synchronizing code with the synchronized statement. The thread will wait until it can acquire the lock on that block of code. The tryLock(timeout) method will wait until the lock is available or until the timeout expires. More or less described in the javadoc: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html For the behavior that you expect you change the tryLock statement with lock and you'll notice that the threads will get into a deadlock eventually.
has comment: http://stackoverflow.com/comment/43067045
accepted answer of: http://stackoverflow.com/q/27299163
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43062945
answers question: http://stackoverflow.com/q/27299163
type: AcceptedAnswer

http://stackoverflow.com/comment/43495601
has text: Thanks for the answer. I already chose Shiro, so I hope it will be good enough. Also shiro has one coll feature - which is distributed session. SS doesn't have it (from what I know), so this was the main argument for me after Shiro.
comment on: http://stackoverflow.com/a/27429825
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/42949210
has text: @Makoto, I see how these two questions are similar, but I don't think that it is a duplicate. It is like asking about JFrame usage versus asking about what is inside of the javax.swing package.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27236082

http://stackoverflow.com/q/27253573
has comment: http://stackoverflow.com/comment/42982417
has comment: http://stackoverflow.com/comment/42981084
has answer: http://stackoverflow.com/a/27254656
accepted answer: http://stackoverflow.com/a/27254656
has comment: http://stackoverflow.com/comment/42981643
has comment: http://stackoverflow.com/comment/42982548
has title: How do I stop Java program arguments being mistaken for VM arguments?
tagged with: batch-file
answer count: 2
has comment: http://stackoverflow.com/comment/42981331
upvote count: 7
downvote count: 0
has body: Inside a bat file I have the following: java -Ddatabase.host=127.0.0.1 -Xms128M -Xmx1024M com.temp.util.manual.serial.Assignment -folder C:\temp\ -destination C:\temp\out.csv The -folder and -destination params are supposed to be passed to the main method of the Assignment class being called, but instead they are being interpreted as VM Args. I tried putting quotes around the params to no avail, and searching does not reveal an answer. I get the following error: Unrecognized option: -'destination' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Press any key to continue . . . @echo off setlocal EnableDelayedExpansion EnableExtensions set FILETYPE=%~n0 set CLASSPATH=jar1.jar set CLASSPATH=%CLASSPATH%;anotherjar.jar echo %CLASSPATH% java -DjobName=%FILETYPE% -Ddatabase.host=127.0.0.1 -Ddatabase.name=db1 -Ddatabase.username=user1 -Ddatabase.password=password1 -Xms128M -Xmx1024M com.temp.util.manual.serial.Assignment -folder C:\\temp\\ -destination C:\\temp\\out.csv call Cleanup.bat endlocal
possible better answer: http://stackoverflow.com/a/27254041
favorite count: 0
has comment: http://stackoverflow.com/comment/42981451
has comment: http://stackoverflow.com/comment/42981504
has comment: http://stackoverflow.com/comment/42981853
has comment: http://stackoverflow.com/comment/42981798
has comment: http://stackoverflow.com/comment/42982153
has comment: http://stackoverflow.com/comment/42981905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42982329
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/27254041
type: Question

http://stackoverflow.com/comment/43058870
has text: I tried, but this results in all the records that have id=1 and also all that have creationDate above last Month. It will also return records that may have creationDate above lastMonth but id <> 1. I am looking for both searches in the same row of child record.
comment on: http://stackoverflow.com/a/27291844
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42934265
comment on: http://stackoverflow.com/q/27228173
score: 0
type: Comment
type: QuestionComment
has text: @pskink, I think you missed the link in your comment.

http://stackoverflow.com/comment/42920346
comment on: http://stackoverflow.com/a/27220664
type: Comment
has text: This is what I had, but it never displays the currentMessage
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42892882
comment on: http://stackoverflow.com/q/27204997
has text: Run your code after putting some logs in register button click
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42998464
type: Comment
type: QuestionComment
has text: Close the file, open with an entirely new FileReader and Scanner. There are other ways, but that's guaranteed to work.
comment on: http://stackoverflow.com/q/27262483
score: 0

http://stackoverflow.com/q/27285115
possible better answer: http://stackoverflow.com/a/27285327
type: Question
has answer: http://stackoverflow.com/a/27285327
accepted answer: http://stackoverflow.com/a/27287038
tagged with: jsp
has title: Spring can't compile jsp with javax.servlet
tagged with: servlets
score: 0
answer count: 2
has body: I have a spring project and everything worked fine. My gradle dependencies compile has the following compile 'org.springframework:spring-core:4.1.2.RELEASE', 'org.springframework:spring-web:4.1.2.RELEASE', 'org.springframework:spring-webmvc:4.1.2.RELEASE', 'org.springframework:spring-orm:4.1.2.RELEASE', 'org.springframework:spring-context:4.1.2.RELEASE', 'org.springframework:spring-tx:4.1.2.RELEASE', 'commons-dbcp:commons-dbcp:1.4', 'mysql:mysql-connector-java:5.1.6', 'org.hibernate:hibernate-core:4.3.7.Final' And my web.xml is Test Restful Application test-servlet org.springframework.web.servlet.DispatcherServlet 1 test-servlet / contextConfigLocation /WEB-INF/test-servlet.xml org.springframework.web.context.ContextLoaderListener /WEB-INF/view/default.jsp 404 /WEB-INF/view/default.jsp And the beans are <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" 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 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.example" /> <property name="prefix" value="/WEB-INF/pages/" /> <property name="suffix" value=".jsp" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/test" /> <property name="username" value="root" /> <property name="password" value="password" /> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:hibernate.cfg.xml" /> <tx:annotation-driven /> <property name="sessionFactory" ref="sessionFactory" /> <constructor-arg ref="sessionFactory" /> </beans> And ev…
has comment: http://stackoverflow.com/comment/43038119
has comment: http://stackoverflow.com/comment/43038113
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27287038
tagged with: gradle

http://stackoverflow.com/comment/44879844
comment on: http://stackoverflow.com/a/27260867
score: 0
type: AnswerComment
type: Comment
has text: It's "Given Final block not properly padded" error in java

http://stackoverflow.com/comment/43084728
comment on: http://stackoverflow.com/q/27311963
score: 0
type: Comment
has text: Your test is a little strange. The work any runnable does (without appending a String) is so small, I can imagine the first thread being done before the next Thread's start method is even called. I bet if you have them print 10000 numbers instead, the numbers will be random even without appending a String.
type: QuestionComment

http://stackoverflow.com/comment/42868370
type: QuestionComment
type: Comment
has text: Shows us the whole JSON string !
comment on: http://stackoverflow.com/q/27191132
score: 0

http://stackoverflow.com/comment/42819078
score: 0
has text: add the full path name. java.lang.Integer.parseInt(numStr);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27163008

http://stackoverflow.com/comment/42998611
has text: ArrayOutOfBounds meens you're trying to access a spot outside of the array, so if you have a 4 by 4 square at some point you're trying to access a spot in your square with x >= 4 or y >= 4 or x<0 or y<0
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27263027
type: Comment

http://stackoverflow.com/comment/42813936
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27159998
has text: Can you post your logcat output?
score: 0

http://stackoverflow.com/q/27295527
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27295566
has comment: http://stackoverflow.com/comment/43055703
tagged with: static-methods
linked to: http://stackoverflow.com/q/2806039
tagged with: interface
has answer: http://stackoverflow.com/a/27295577
has body: I have several Java classes which contain static methods. I want to ensure that these static methods are implemented by each of the classes. How can I enforce that, since declaring static methods is not allowed in interfaces in Java?
has title: Ensure that a static method is implemented
duplicate of: http://stackoverflow.com/q/2806039
linked to: http://stackoverflow.com/q/512877
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27295547

http://stackoverflow.com/q/27245160
accepted answer: http://stackoverflow.com/a/27352139
type: Question
has title: Embedded Id is set to null
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27352139
has body: I have the following entities: @Entity @Table(name = "B_Message") public class Message implements java.io.Serializable { @Id @GeneratedValue(generator = "app-uuid") @Column(name = "MessageID", unique = true, nullable = false, length = 36, columnDefinition = "uniqueIdentifier") private String id; @OneToMany(cascade= {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY, mappedBy = "message") private Set&lt;MessageReceiver&gt; messageReceivers; } AND @Entity @Table(name="B_MessageReceiver") public class MessageReceiver implements java.io.Serializable { @EmbeddedId @AttributeOverrides( { @AttributeOverride(name="messageId", column=@Column(name="MessageID", nullable=false, length=36, columnDefinition = "uniqueIdentifier") ), @AttributeOverride(name="accountabilityId", column=@Column(name="AccID", nullable=false, length=36, columnDefinition = "uniqueIdentifier") ) } ) private MessageReceiverId id; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="MessageID", nullable=false, insertable=false, updatable=false) private Message message; } AND @Embeddable public class MessageReceiverId implements java.io.Serializable { @Column(name = "MessageID", nullable = false, length = 36) private String messageId; @Column(name = "AccID", nullable = false, length = 36) private String accountabilityId; } And I use them in the following code Message message = new Message(); Set&lt;MessageReceiver&gt; messageReceivers = new HashSet&lt;MessageReceiver&gt;(); MessageReceiver messageReceiver = new MessageReceiver(); MessageReceiverId messageReceiverId = new MessageReceiverId(); messageReceiverId.setAccountabilityId(this.accountabilityModel.getId()); messageReceiver.setMessage(message); messageReceiver.setId(messageReceiverId); messageReceivers.add(messageReceiver); messageManager.saveMessage(message); But when I want to merge the Message entity, the messageId of MessageReceiverId is not being set and sending null to the database.
possible better answer: http://stackoverflow.com/a/27246050
tagged with: java
has answer: http://stackoverflow.com/a/27246050
type: AnsweredQuestion
tagged with: jpa

http://stackoverflow.com/comment/42911116
comment on: http://stackoverflow.com/q/27215600
type: QuestionComment
type: Comment
score: 1
has text: I get true for both snippet (not surprising). So the error is somewhere else.

opencv
type: Tag
tags question: http://stackoverflow.com/q/27167026
tags question: http://stackoverflow.com/q/27174094
tags question: http://stackoverflow.com/q/27274419
tags question: http://stackoverflow.com/q/27279510
tag name: opencv
tags question: http://stackoverflow.com/q/27184092
tags question: http://stackoverflow.com/q/27236094
tags question: http://stackoverflow.com/q/27212167

http://stackoverflow.com/q/27169447
has comment: http://stackoverflow.com/comment/42831691
accepted answer: http://stackoverflow.com/a/27170465
tagged with: java
tagged with: gregorian-calendar
has comment: http://stackoverflow.com/comment/42831598
has comment: http://stackoverflow.com/comment/42830683
has comment: http://stackoverflow.com/comment/42831624
has body: I'm trying to parse an input string date to GregorianCalendar: Scanner scan = new Scanner(System.in); String next = scan.next("[0-9]{2}.[0-9]{2}.[0-9]{4} [0-9]{2}:[0-9]{2}"); scan.nextLine(); DateFormat df = new SimpleDateFormat("dd.MM.yyyy hh:mm"); Date date = null; try { date = df.parse(next); } catch (ParseException e1) { e1.printStackTrace(); } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); System.out.println(cal.getTime()); But it keeps giving this error: java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.next(Unknown Source) Can anybody help me? This works if i don't specify the hours and minutes but not like this...
answer count: 1
has comment: http://stackoverflow.com/comment/42830241
score: 0
has answer: http://stackoverflow.com/a/27170465
tagged with: regex
has title: Parse date in String format to Gregorian Calendar, with hour and minute
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42830928
type: Question

http://stackoverflow.com/comment/43019440
comment on: http://stackoverflow.com/a/27274447
has text: The sample code in the link I posted shows that the setPostFilter() function is applied before the execute() function. From this I understand that the filters are applied before the query is executed. Can you give me an example in Java that shows the different? Thanks in advance
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/62981958
type: Answer
upvote count: 0
has body: i Solve this issue by using the only one line in with Picasso library .fit() Picasso.get().load(currentItem.getArtist_image()) .fit()//this wil auto get the size of image and reduce it .placeholder(R.drawable.ic_doctor) .into(holder.img_uploaderProfile, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Toast.makeText(context, "Something Happend Wrong Uploader Image", Toast.LENGTH_LONG).show(); } });
answers question: http://stackoverflow.com/q/27188536
score: -1
downvote count: 1

http://stackoverflow.com/comment/42961470
score: 0
comment on: http://stackoverflow.com/a/27242672
type: AnswerComment
type: Comment
has text: You probably need to replace the jar file with a patched version. Hard to tell without more details.

http://stackoverflow.com/comment/42884086
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27199281
has text: @M.Deinum You should make this as an answer.

http://stackoverflow.com/comment/42878888
has text: Ant has nothing to do with it. Ant is a build tool. Debugging is at run time.
type: Comment
score: 3
comment on: http://stackoverflow.com/q/27197005
type: QuestionComment

http://stackoverflow.com/q/27216743
upvote count: 1
has body: I have looked at every post with this problem, every guide, every algorithm, and I still cannot find an answer for my problem. The weird thing is that it doesn't cause any errors, but for every maze it says that it's unsolvable and marks the beginning as a dead end. I am staring at my code for hours and I cannot figure out what I did wrong! My code: (Other non-important classes - MazeSymbol = enum with symbol names and their string, Position = a row/column class, Coordinate = class that contains a MazeSymbol and a Position)) Maze.java: private Coordinate[][] map; private Position start; private Position goal; private ArrayList&lt;Coordinate&gt; solutionPath; boolean solveable; public Maze(Coordinate[][] map, Position start, Position goal){ this.start=start; this.map=map; this.goal=goal; this.solutionPath=new ArrayList&lt;&gt;(); this.solveable = solveMaze(Coordinate.fromMaze(start, this)); //fromMaze takes a position and finds it's symbol. } public boolean isSolveable(){ return solveable; } private boolean solveMaze(Coordinate c){ System.out.println("Solving - "+c.getPosition().row+","+c.getPosition().column); if(!c.getPosition().isOnMaze(this)){//Checks if it is between the bounds of the maze (larger than 0 and smaller than length both for X and Y) System.out.println(c.getPosition().row+","+c.getPosition().column+"Isnt on maze! "); return false; } if(c.getPosition().equals(goal)){ System.out.println(c.getPosition().row+","+c.getPosition().column+"Is goal!"); return true; } if(!c.getSymbol().equals(MazeSymbol.OPEN)){//If it isnt an open path - walked/dead end/wall System.out.println(+c.getPosition().row+","+c.getPosition().column+" isn't open!(it's "+c.getSymbol()+")"); return false; } map[c.getPosition().getRow()][c.getPosition().getColumn()] = new Coordinate(c.getPosition(), MazeSymbol.PATH);//Replace the open path sign with a walked path sign solutionPath.add(c);//Add the coordinate to the solution path if(solveMaze(c.setPosition(c.getPosition().positionAbove()))…
tagged with: recursion
has title: java - Recursive maze solver not working
tagged with: java
has comment: http://stackoverflow.com/comment/42913356
has answer: http://stackoverflow.com/a/27219120
has comment: http://stackoverflow.com/comment/42914710
tagged with: algorithm
type: UnansweredQuestion
tagged with: maze
has answer: http://stackoverflow.com/a/27217173
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/42913775
has comment: http://stackoverflow.com/comment/42913320
has comment: http://stackoverflow.com/comment/42913366
has comment: http://stackoverflow.com/comment/42913239
type: Question
downvote count: 2
answer count: 2

http://stackoverflow.com/comment/42834757
type: Comment
comment on: http://stackoverflow.com/a/27172076
score: 0
has text: I've read this already. But as I checked out the code of awaitDone it's checking Thread.interrupted() that means current thread and not the runner thread which result.cancel() will interrupt.
type: AnswerComment

http://stackoverflow.com/comment/42988364
has text: How did you validate this? I don't think there is something like auto rounding in rest service.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27257331

http://stackoverflow.com/comment/43068497
comment on: http://stackoverflow.com/q/27302697
has text: are you sure you didn't accidentally throw an extra F in there for the long?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/97513169
type: AnswerComment
has text: @Alien01 works with Throwable! RuntimeException will not work, is a subclass of Exception.
type: Comment
comment on: http://stackoverflow.com/a/27261001
score: 0

http://stackoverflow.com/a/27281691
has comment: http://stackoverflow.com/comment/43061453
answers question: http://stackoverflow.com/q/27281454
has body: Think of a semaphore as a lock that can allow multiple threads to access a shared resource. Whatever number you initialize the semaphore to will allow that many threads to access the resource simultaneously. In Producer-Consumer, the resource is a shared buffer between the two threads. You want to make sure that the consumer cannot access the buffer unless it is full, and the producer cannot access the buffer unless it is empty. You should start with a count of 0 in the consumer's semaphore and 1 in the producer's semaphore.That way the Producer has to make the first move. When the Producer begins to write to the buffer, you want to down the Producer semaphore. When the Producer is done, you want to up the Consumer's semaphore which will allow the Consumer to access the resource. When the consumer has accessed the resource, it then ups the producer's semaphore notifying the producer that the buffer is now empty. Use this as a starting point: http://cs.gmu.edu/cne/modules/ipc/aqua/producer.html
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/43065518
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27281454

http://stackoverflow.com/comment/43047817
score: 2
comment on: http://stackoverflow.com/q/27290951
has text: I think you asked the same question yesterday and again today. I asked the same question and will ask again paste the csvFile content.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42979322
comment on: http://stackoverflow.com/q/27227647
has text: @haraldK: That's sadly useless, because I have never gotten it to work in the JAR, it throws a FileNotFoundException with a text closely like "(Access denied)". The approach above, however, at least gives me a working Image.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42912933
score: 0
comment on: http://stackoverflow.com/q/27215999
type: QuestionComment
has text: I see no problems in this code (except it's better to use an ArrayList instead of List for data sent over RPC calls). The problem is somewhere else. How do you declare lst_auteurs? Is this the only list of this kind?
type: Comment

http://stackoverflow.com/a/27240211
accepted answer of: http://stackoverflow.com/q/27240082
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27240082
has body: The local variable Function&lt;T,R&gt; memoized = new Function&lt;T,R&gt;() will be created each time callMemoizer is invoked. The important point however, is that the expensive calculation and association with key will only happen once (assuming your Map is not weak/soft) via computeIfAbsent

http://stackoverflow.com/q/27255541
has answer: http://stackoverflow.com/a/27255682
has title: java execute hook code before method return
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42984984
upvote count: 1
tagged with: observer-pattern
has body: I would like to have a post hook that is run before a method return. It should be possible add a hook to any method without modifying existing code. Is there a tool or technology that helps realise this? Is javassist a candidate here? If yes, how to pass parameters to the hook? Ideally whatever the method returns should be passed as parameter to the hook.
type: Question
accepted answer: http://stackoverflow.com/a/27255682
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42831181
comment on: http://stackoverflow.com/q/27169842
type: Comment
type: QuestionComment
has text: What is the problem? your program seems to be fine.
score: 0

http://stackoverflow.com/comment/42934791
type: Comment
has text: Under Window -> Show View -> Error Log you can find more information. Please post that as well here.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27227961

http://stackoverflow.com/comment/43067657
has text: So using Jetty Client is acceptable in your case ? Can you please share your code here of Jetty Client ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27277294
type: AnswerComment

http://stackoverflow.com/a/27170860
has comment: http://stackoverflow.com/comment/42833302
has comment: http://stackoverflow.com/comment/42832945
has comment: http://stackoverflow.com/comment/42833621
has comment: http://stackoverflow.com/comment/42832584
has comment: http://stackoverflow.com/comment/42833842
has comment: http://stackoverflow.com/comment/42834484
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27170602
has body: There are two standards, IP v4 using 4 bytes, and the newer still not too wide spread IP v6 with more bytes. Now in your IP v4 case, the 4 bytes may comprise a Java integer or simply every byte listed. By the way URLs may use the IP number both as 4 byte values, or as one single integer: http://3232235778/ http://210.43.98.51/ (I did not convert or check the numbers.) The code uses a trick, converting the int to long, as java integers are signed; the left-most bit being 1 does not mean a very high number, but negative. To take out the 4 bytes, every byte 8 bits, they are masked and shifted to the right. Where 0xFF is FF in base 16, 255 in base 10, 0b11111111 or 11111111 in base 2. There is a bit operation &amp; ("and") which is in fact is multiplication (modulo 2). x y x&amp;y x|y 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 Now having some bits abcdefgh and you want to inspect only bits def you would do: abcdefgh &amp; 00011100 = 000def00 = def00 (00011100 is called a mask) (abcdefgh &amp; 00011100) &gt;&gt; 2 = def (shift right 2)
answers question: http://stackoverflow.com/q/27170602
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/27167802
type: Answer
answers question: http://stackoverflow.com/q/27167661
score: 0
has body: In addition to Eriks answer from the Java Language Specification: A class C inherits from its direct superclass all concrete methods m (both static and instance) of the superclass for which all of the following are true: m is a member of the direct superclass of C. m is public, protected, or declared with package access in the same package as C. No method declared in C has a signature that is a subsignature (§8.4.2) of the signature of m. and An instance method mC declared in or inherited by class C, overrides from C another method mA declared in class A, iff all of the following are true: [...] One of the following is true: mA is public. mA is protected. So your subclass doesn't inherit the private methods, hence there is nothing to override.

http://stackoverflow.com/a/27221192
has body: Can jars be requested via http RMI? Yes. I specify a single jar containing the complete application in the the codebase URL passed to the client. That's normal. Even though the jar is requested and "served" by the http server, the server continues to receive requests for classes that are contained in libraries included in the jar. Aha. 'libraries included in the jar' may not work. You should provided them separately via further codebase URLs. The java.rmi.server.codebase property is a list of URLs, not just one. Any ideas what's going on here? I would expect the server to add the jar to its classpath but this does not seem to be the case. It ultimately adds a URLClassLoader to its classloader set. I didn't notice any methods in RMIClassLoader that handle anything other than classes. You need to note that RMIClassLoader isn't really a ClassLoader. It's a strange beast but its class loading is ultimately delegated to a URLClassLoader. 2) Can RMI request objects other than classes? The codebase feature is for anything you can retrieve via a classloader, including resources, if they are obtained via getResource() and friends. I finally figured out how to serve classes from jars (to solve the above problem) but the remote job fails trying to load a ".txt" resource. It is contained in the application jar, but the http server never sees the request. There wouldn't be such a request to see. It should be loaded straight from the .jar file, which has already been downloaded. Check that you are referring to the resource correctly.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27221092

http://stackoverflow.com/comment/42897959
has text: Thanks a lot ! It's simple, it's working great, and it's seems to be the best solution in my case. Thank you for the related reading too !
score: 0
comment on: http://stackoverflow.com/a/27207833
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27309657
upvote count: 2
has comment: http://stackoverflow.com/comment/43080736
has body: final ListView listview = (ListView) findViewById(R.id.listview); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Android", "iPhone", "WindowsMobile" }; final ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; values.length; ++i) { list.add(values[i]); } final StableArrayAdapter adapter = new StableArrayAdapter(this, android.R.layout.simple_list_item_1, list); listview.setAdapter(adapter); private class StableArrayAdapter extends ArrayAdapter&lt;String&gt; { HashMap&lt;String, Integer&gt; mIdMap = new HashMap&lt;String, Integer&gt;(); public StableArrayAdapter(Context context, int textViewResourceId, List&lt;String&gt; objects) { super(context, textViewResourceId, objects); for (int i = 0; i &lt; objects.size(); ++i) { mIdMap.put(objects.get(i), i); } } @Override public long getItemId(int position) { String item = getItem(position); return mIdMap.get(item); } @Override public boolean hasStableIds() { return true; } } For item to be clickable in listview listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, final View view, int position, long id) { final String item = (String) parent.getItemAtPosition(position); view.animate().setDuration(2000).alpha(0) .withEndAction(new Runnable() { @Override public void run() { list.remove(item); adapter.notifyDataSetChanged(); view.setAlpha(1); } }); } }); } Code taken From Vogella
answers question: http://stackoverflow.com/q/27309640
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/27281712
answer count: 1
has comment: http://stackoverflow.com/comment/43032146
has comment: http://stackoverflow.com/comment/43032445
has body: Iam new to Android development, I have created an android sliding menu using Navigation Drawer by following this tutorial: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ I have placed a button in the main page (HomeFragment) of the app, I would like to link the button to another activity/page (NewActivity). Currently I am getting a lot of errors. MainActivity: package info.androidhive.slidingmenu; import info.androidhive.slidingmenu.adapter.NavDrawerListAdapter; import info.androidhive.slidingmenu.model.NavDrawerItem; import java.util.ArrayList; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.content.res.Configuration; import android.content.res.TypedArray; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList<NavDrawerItem> navDrawerItems; private NavDrawerListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); // load slide menu items navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // nav drawer icons from resources navMenuIcons = getResources() .obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_sli…
tagged with: android-intent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27281802
has title: Android Activity – From one screen to another screen
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/43032265
accepted answer: http://stackoverflow.com/a/27281802
score: 0
tagged with: android

http://stackoverflow.com/a/27247869
has body: I does not found any direct way within the SDK to index document from S3 to Cloud Search. So i use like this.
accepted answer of: http://stackoverflow.com/q/27246592
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27246592
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42973471

http://stackoverflow.com/q/27210815
tagged with: java
tagged with: httprequest
type: Question
score: 0
answer count: 1
has body: I've written a server socket code that receives http request and print it on console. Given below is the server code. clientSocket = echoServer.accept(); is = new DataInputStream(clientSocket.getInputStream()); while (true) { line = is.readLine(); System.out.println(line); } The output is: POST / HTTP/1.1 User-Agent: Java/1.6.0_20 Host: 127.0.0.1:4000 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive Content-type: application/x-www-form-urlencoded Content-Length: 7 Hello I don't want header in my output, How can I get only Body part in my output that is "Hello"?
has answer: http://stackoverflow.com/a/27210858
has title: Want to print only body part in my output not the http headers.. Http Request is handled using socket programming
tagged with: serversocket
type: UnansweredQuestion

http://stackoverflow.com/comment/42851722
type: QuestionComment
has text: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'. some error like these
comment on: http://stackoverflow.com/q/27181662
score: 0
type: Comment

http://stackoverflow.com/a/27273222
has comment: http://stackoverflow.com/comment/43020917
has comment: http://stackoverflow.com/comment/43024210
has comment: http://stackoverflow.com/comment/43021576
type: Answer
answers question: http://stackoverflow.com/q/27271331
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27271331
has body: See the retry-and-more sample, specifically the Expression Evaluating Advice Demo - it shows how to take different actions based on the success/failure of an upload. EDIT: In response to your comments on Artem's answer; Since you have delete-remote-files="true" there's no remote file to move; you must first set that to false. Then, use the advice as I suggested to process success or failure - use an ftp:outbound-gateway and mv the remote file. See the gateway documentation for the mv command.
has comment: http://stackoverflow.com/comment/43020973
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27263934
score: 0
answers question: http://stackoverflow.com/q/27263790
type: Answer
has body: I know this doesn't answer the question asked, but using a list in such a way, expecting the index to reflect the bed number while also expecting the list to define if a bed is taken is a bit broken, or at least highly troublesome. The examples below show how it is easier to manipulate sets and maps and they provide extra information such as total occupied beds without having to code that up yourself. I suggest you use a Map of Patients rather than a list. Map&lt;Integer,Patient&gt; patientBeds = new HashMap&lt;Integer,Patient&gt;(); patientBeds.add(bedNumber, patient); patientBeds.remove(bedNumber); patientBeds.contains(bedNumber); // is this bed taken? patientBeds.size(); // total occupied beds, regardless of their numbers If you don't need the Patient objects, but simply to know which beds are occupied, use a simple Set of Integers Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); set.add(bedNumber); // help me nurse set.remove(bedNumber); // I'm going home! set.contains(bedNumber); // is this bed taken? set.size(); // total occupied beds, regardless of their numbers With either of these solutions, your class which holds the Map or Set might have a member which specifies the total number of available beds in the ward. I wouldn't try to build this concept into the Map such as populating the Map with "null" patients. int totalBeds = 10; if (bedNumber &gt; totalBeds) { // send them to the next ward }

ssh
tags question: http://stackoverflow.com/q/27168654
tags question: http://stackoverflow.com/q/27210000
tags question: http://stackoverflow.com/q/27238713
type: Tag
tag name: ssh

http://stackoverflow.com/a/27205495
answers question: http://stackoverflow.com/q/27205294
score: 0
has body: You don't have a call to the superclass method. Put super.paint(g); before anything else. If you want to display a message on the applet at the same time as on the console, you need to have a method that calls repaint();. The way I would set this up is to have an Arraylist of Strings. When you want something written to the applet output, you add the new String to the ArrayList, then call repaint(). Then, in paint(), ArrayList&lt;String&gt; ar = new ArrayList(); public void paint(Graphics g) { super.paint(); //Draw a rectangle width=250, height=100 g.drawRect(0,0,250,100); //Set the color to blue g.setColor(Color.blue); //Write the message to the web page for(int i = 0; i&lt;ar.size(); i++) g.drawString(ar.get(i), 10, 50); } If you want a function that does this, you might write it like so public void appletOut.println(String str){ ar.add(str); repaint(); } Finally, I question whether this route is really best for what you are trying to accomplish. I would suggest researching text fields and scrollbars and seeing if that might fit your parameters better.
type: Answer

web-services
type: Tag
tags question: http://stackoverflow.com/q/27310053
tags question: http://stackoverflow.com/q/27264484
tags question: http://stackoverflow.com/q/27293852
tags question: http://stackoverflow.com/q/27253467
tags question: http://stackoverflow.com/q/27266597
tags question: http://stackoverflow.com/q/27300997
tags question: http://stackoverflow.com/q/27226967
tags question: http://stackoverflow.com/q/27224870
tags question: http://stackoverflow.com/q/27266985
tags question: http://stackoverflow.com/q/27240431
tags question: http://stackoverflow.com/q/27294871
tags question: http://stackoverflow.com/q/27273105
tags question: http://stackoverflow.com/q/27230881
tags question: http://stackoverflow.com/q/27273775
tags question: http://stackoverflow.com/q/27169247
tags question: http://stackoverflow.com/q/27227512
tags question: http://stackoverflow.com/q/27255826
tags question: http://stackoverflow.com/q/27182395
tags question: http://stackoverflow.com/q/27291650
tags question: http://stackoverflow.com/q/27189057
tags question: http://stackoverflow.com/q/27279121
tags question: http://stackoverflow.com/q/27179875
tags question: http://stackoverflow.com/q/27310303
tags question: http://stackoverflow.com/q/27276222
tags question: http://stackoverflow.com/q/27166281
tags question: http://stackoverflow.com/q/27259341
tags question: http://stackoverflow.com/q/27285847
tags question: http://stackoverflow.com/q/27294525
tags question: http://stackoverflow.com/q/27171395
tags question: http://stackoverflow.com/q/27264970
tags question: http://stackoverflow.com/q/27165585
tags question: http://stackoverflow.com/q/27219995
tags question: http://stackoverflow.com/q/27271344
tags question: http://stackoverflow.com/q/27253341
tags question: http://stackoverflow.com/q/27176313
tags question: http://stackoverflow.com/q/27167338
tags question: http://stackoverflow.com/q/27229243
tag name: web-services
tags question: http://stackoverflow.com/q/27277305
tags question: http://stackoverflow.com/q/27198987
tags question: http://stackoverflow.com/q/27225876
tags question: http://stackoverflow.com/q/27253885
tags question: http://stackoverflow.com/q/27246024
tags question: http://stackoverflow.com/q/27292246
tags question: http://stackoverflow.com/q/27166992
tags question: http://stackoverflow.com/q/27252195
tags question: http://stackoverflow.com/q/27306157
tags question: http://stackoverflow.com/q/27275676

http://stackoverflow.com/q/27186456
has answer: http://stackoverflow.com/a/27186548
answer count: 5
has comment: http://stackoverflow.com/comment/42860009
has title: Get Type Argument Of A Variable
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/27186484
downvote count: 1
accepted answer: http://stackoverflow.com/a/27186548
type: Question
has answer: http://stackoverflow.com/a/27186478
has answer: http://stackoverflow.com/a/27186479
score: -1
linked to: http://stackoverflow.com/q/1942644
possible better answer: http://stackoverflow.com/a/27186476
has answer: http://stackoverflow.com/a/27186476
has comment: http://stackoverflow.com/comment/42859814
upvote count: 0
has body: public void X(ArrayList list) { //reflection code will be here. } Let's say list variable is a type of ArrayList&lt;String&gt;. How can I get String (or whatever passed) information with java runtime reflection?
tagged with: generics
favorite count: 0

http://stackoverflow.com/comment/43095016
score: 0
has text: In that case,the root username and password is selected by the user who instals the DB. Then rather than hard coding those details,u can instruct the admin to start the software after installation is completed,give option to set root access details of the db in your software and make sure its a one time thing. This way whoever is the admin can set up the db and software settings initially.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27254794

http://stackoverflow.com/a/27196429
type: Answer
upvote count: 1
has body: fill a set with the two lists, then convert the set back into a list (list2). Set&lt;String&gt; set = new HashSet&lt;String&gt;(list2); set.addAll(list1); list2 = new ArrayList(set);
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27196415
has comment: http://stackoverflow.com/comment/42877930

http://stackoverflow.com/comment/42931857
comment on: http://stackoverflow.com/q/27220671
score: 0
type: QuestionComment
type: Comment
has text: do one convolution _left to right_, then redo it _right to left_ on the result, that's your `filtfilt`

http://stackoverflow.com/q/27286613
has answer: http://stackoverflow.com/a/42109594
tagged with: java
tagged with: liferay-service-builder
type: Question
answer count: 2
downvote count: 0
has body: I have worked on implementation of the Entity remote service. I have created one custom service method in EntityServiceImpl,Created custom service method providing service through InstitutionServiceUtil. After deploy the portlet, while sending request to service method through from browser window,I am getting below Exception exception":"java.lang.ClassCastException: com.institutions.model.impl.InstitutionImpl cannot be cast to com.institutions.model.Institution Note: If I send the request after restart the server, I didn't get above exception. How to resolve the above Exception?
has answer: http://stackoverflow.com/a/27289358
score: 2
has title: exception":"java.lang.ClassCastException in liferay service builder
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/58151374
tagged with: liferay-6

http://stackoverflow.com/q/27223966
score: 0
answer count: 3
type: UnansweredQuestion
has body: What should I do to execute this code? I have tried to create a new class and use as a driver but it didn't work and the error message was cannot find count. I feel confused. Could anyone help me please? import java.util.Arrays; import java.util.Scanner; public class Lab7Part1 { Scanner kb = new Scanner(System.in); private static int[] a = {7, 8, 8, 3, 4, 9, 8, 7}; int sum=0; int n=0; double avg = sum/a.length; int last=-1; int max=0; int min=Integer.MAX_VALUE; int indexOfMax=-1; public int count() { for(int n:a){ System.out.println(n); System.out.println(","); }//use a for-each statement to compute the number of values System.out.println("The number of elements in int[] a is: " + n); return n; } public int sum() { for(int n=0; n&lt;a.length; n++){ sum += a[n]; } System.out.println("The sum of elements in int[] a is: " + sum); return sum; } public double average() { System.out.println("The avg of elements in int[] a is: " + avg); return avg; } public int findLast(int key) { System.out.println("Enter an integer."); int input = kb.nextInt(); for (int i=0; i&lt;a.length; i++){ if(a[i]==input){ key = i; System.out.println("The last index of " + input + " is: " + key); } else System.out.println("The last index of " + input + " is: -1"); } return key; }
has answer: http://stackoverflow.com/a/27224216
has answer: http://stackoverflow.com/a/27224005
has comment: http://stackoverflow.com/comment/42926227
tagged with: java
has title: What to do in order to execute this?
has answer: http://stackoverflow.com/a/27224264
type: Question

http://stackoverflow.com/comment/42931396
type: AnswerComment
comment on: http://stackoverflow.com/a/27226904
type: Comment
score: 1
has text: That's true, though I suspect the question is rather "how do I avoid splitting on commas that are wrapped in quotes", rather than commas that are followed by whitespace. It's a poor question, though.

http://stackoverflow.com/comment/42915547
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27170132
has text: Well that's impossible. If you change `SomeEntityInfo`, it will be persisted. There might be hacks to prevent it (like detaching it from the session or whatever), but the main point still is: If you don't want to persist changes, don't make changes. It's your code that's doing the changes, so that's where your problem is.
type: Comment

http://stackoverflow.com/q/27208568
score: 3
accepted answer: http://stackoverflow.com/a/27213859
has answer: http://stackoverflow.com/a/27212102
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/16295942
answer count: 5
linked to: http://stackoverflow.com/q/21211090
tagged with: audio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27222326
upvote count: 3
tagged with: java
has title: How to terminate anonymous threads in java
tagged with: multithreading
has answer: http://stackoverflow.com/a/27213859
has body: This battleship game is the first multi-threaded application I've tried to write and it worked perfectly up until I added the multi-threading,which is only used for sound effects. It is all in one single class, the AudioManager. I'm pretty sure I just lack experience and or/understanding regarding concurrency, even though I've read the java tutorials etc. I think I just need a little help to get it to click. Anyway the game runs fine until enough sounds have been played that it runs out of memory and gives me this error: Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: unable to create new native thread I was creating a new thread for each sound effect to play on because I didn't want the gui to wait for the sound to finish, and because sounds are often played very close to each other and I didn't want them conflicting on the same thread if they overlapped. The problem, I think, is that I'm not sure how to close each thread after the sound is played without stalling the main thread. Here is the class with all the sound code. The sounds are played using the setSound() method, which sets the sound to be played and then starts a new thread with the SoundPlayer inner class for the Runnable. Thanks in advance: import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.UnsupportedAudioFileException; public class AudioManager { private static Thread backgroundThread = new Thread(); private static int loopCounter = 2; private static Clip clip; private static String[] backgroundFiles = { "/40_Avalon.wav","/13_Glatisant.wav", "/31_Lying_In_Deceit.wav","/43_Return_to_Base.wav"}; private static String[] files = { "/bigboom.wav","/Robot_blip.wav", "/battleStations.WAV","/beep1.wa…
possible better answer: http://stackoverflow.com/a/27222326
type: Question
has answer: http://stackoverflow.com/a/27209198
linked to: http://stackoverflow.com/q/557903
has comment: http://stackoverflow.com/comment/42899214
has answer: http://stackoverflow.com/a/27210388
tagged with: concurrency

http://stackoverflow.com/a/27213815
score: 2
has comment: http://stackoverflow.com/comment/42907908
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27213803
upvote count: 2
has body: change @strings/button_name to @string/button_name and it'll solve your problem!
answers question: http://stackoverflow.com/q/27213803
type: Answer

http://stackoverflow.com/a/27194522
has body: userArray init with zero length before your constuctor set _size. Create userArray in constructor. there next steps performed when you create class: _size init with 0 userArray init with zero length array _size init with size value.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27194486

header
type: Tag
tags question: http://stackoverflow.com/q/27293982
tag name: header
tags question: http://stackoverflow.com/q/27166258

http://stackoverflow.com/q/27201137
has answer: http://stackoverflow.com/a/27201436
has comment: http://stackoverflow.com/comment/42885923
favorite count: 0
has comment: http://stackoverflow.com/comment/42891138
has comment: http://stackoverflow.com/comment/42885997
has answer: http://stackoverflow.com/a/27204306
downvote count: 1
has comment: http://stackoverflow.com/comment/42885982
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42885810
has comment: http://stackoverflow.com/comment/42886111
possible better answer: http://stackoverflow.com/a/27204306
has title: Get absolute path of "web content" folder in Java
tagged with: java
accepted answer: http://stackoverflow.com/a/27201436
score: -1
tagged with: absolute-path
linked to: http://stackoverflow.com/q/7517401
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/42886069
answer count: 2
has comment: http://stackoverflow.com/comment/42885835
upvote count: 0
has comment: http://stackoverflow.com/comment/42885732
tagged with: jsp
has body: I want to get the absolute path of Web content folder in source code so I can retrieve another folder to upload file. I tried ServletActionContext.getServletContext().getRealPath("images") to get the folder image in source code. Expected result should be: "C:\Learning\Workspace\Eclipse\boxingsaigon\WebContent\images". But it returns me where the web was deployed: Actual result is: "C:\Learning\Workspace\Eclipse.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\boxingsaigon\images". Is there any way to do this?
has comment: http://stackoverflow.com/comment/42885838

http://stackoverflow.com/comment/42873762
comment on: http://stackoverflow.com/a/27176179
has text: Yeah, I tried hard to prove length can be < 0 (may be -1) but it is impossible.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42876985
type: Comment
type: QuestionComment
has text: Given a word by a user, in this case `random`, I'm trying to search a text file which has a large amount of words and see if any of the words in this text file differ by only one character of `random`. For instance; day is similiar to words : say, ray, dam, dab etc...
comment on: http://stackoverflow.com/q/27195890
score: 0

http://stackoverflow.com/a/27217094
has comment: http://stackoverflow.com/comment/42913941
has comment: http://stackoverflow.com/comment/42914048
answers question: http://stackoverflow.com/q/27216979
has body: Assuming arrayer is an array of String objects, which are the names of subjects, just use out.print("\nWrite your average grade of " + arrayer[f] + ": ");, i.e. without the length() method. Additionally, z doesn't seem to be defined, so you'd need to either define it or use one of the outer loop's variables u or f, as I already did in the line above.
score: 0
type: Answer

http://stackoverflow.com/comment/43019411
comment on: http://stackoverflow.com/q/27169382
has text: [@Observes](http://docs.oracle.com/javaee/6/tutorial/doc/gkhic.html) is the one which i am searching for :) I hope this can fix this Issue. I will try this and Update back Soon :)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42967749
type: QuestionComment
comment on: http://stackoverflow.com/q/27246047
score: 0
type: Comment
has text: According the [W3 Validator](http://validator.w3.org/check) it is valid XML. Maybe the ?xfa prolog is not accepted by the implementation.

awt
tags question: http://stackoverflow.com/q/27247414
tags question: http://stackoverflow.com/q/27273402
tags question: http://stackoverflow.com/q/27174110
tags question: http://stackoverflow.com/q/27217697
tags question: http://stackoverflow.com/q/27198733
tags question: http://stackoverflow.com/q/27175921
tag name: awt
tags question: http://stackoverflow.com/q/27218443
tags question: http://stackoverflow.com/q/27270284
tags question: http://stackoverflow.com/q/27193407
tags question: http://stackoverflow.com/q/27297145
tags question: http://stackoverflow.com/q/27311239
tags question: http://stackoverflow.com/q/27293517
tags question: http://stackoverflow.com/q/27153618
tags question: http://stackoverflow.com/q/27241517
tags question: http://stackoverflow.com/q/27221413
tags question: http://stackoverflow.com/q/27219914
type: Tag
tags question: http://stackoverflow.com/q/27304089

http://stackoverflow.com/a/27274107
has body: if (id == R.id.myswitch) { View view = item.getActionView(); if (view != null) { Switch onOff = (Switch) view .findViewById(R.id.switchForActionBar); if (onOff!=null) { if (onOff.isChecked()) { Toast.makeText(context, "Switch is ON", Toast.LENGTH_LONG).show(); } else { Toast.makeText(context, "Switch is OFF", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(context, "Switch is null", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(context, "view is null", Toast.LENGTH_LONG).show(); } } try this code if it works but i'm not sure if it works. its just a guess. or you can try below code. @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } boolean bSwitch=false; @Override public boolean onPrepareOptionsMenu(Menu menu) { // TODO Auto-generated method stub int id = menu.getItem(0).getItemId(); if (id == R.id.myswitch) { if (bSwitch) { menu.getItem(0).setTitle("smthng is ON"); } else { menu.getItem(0).setTitle("smthng is OFF"); } } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.myswitch) { if (bSwitch) { bSwitch=false; } else { bSwitch=true; } } return super.onOptionsItemSelected(item); } &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.newshunt.news.MainActivity" &gt; &lt;item android:id="@+id/myswitch" android:orderInCategory="100" android:showAsAction="always" android:title="smthng is OFF"/&gt; &lt;/menu&gt;
upvote count: 1
answers question: http://stackoverflow.com/q/27273773
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/27215468
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27214985
has body: When you're writing a networked app, you have to first decide what data is shared between by users of the game. For Blackjack, the data to share (AKA the "game state") is pretty simple: Player whose turn it is Cards that are still in the deck Cards that are on the table for each player How much money each player has Once you have all this planned out, you can create objects to represent the game state. For example: public class GameState { public enum Suit { HEARTS, DIAMONDS, CLUBS, SPADES } public enum Rank { ONE, TWO, THREE, FOUR, FIVE, SIX ... ACE } public static class Card { Suit suit; Rank rank; } public static class Deck { List&lt;Card&gt; cards; // Cards remaining in the deck } public static class Player { // Cards on the table for a player List&lt;Card&gt; cards; Integer id; Double money; } HashMap&lt;Integer, Player&gt; players; Integer activePlayerId; } Next, we need a mechanism to sync this state between all the players. One way to do this for a game like Blackjack is to sync the whole state after each player's turn. That is, at the end of each turn, send the whole game state over the network to all the players. To send game state, it's easiest to have a central server process that keeps a copy of the most recent state. The central server sends the game state to the players periodically, to keep them in sync. Now, we need a protocol that the clients can use to communicate with the server. At the beginning of the game, clients connect, then wait for the server to start the game. After that, the clients and server communicate in lockstep, almost as if they're having a conversation. Here's an example: Client 1: Connect Server: OK Client 2: Connect Server: OK Server: Start game Server: Sync &lt;send the initial game state&gt; Server: Place bids Client 1: Bid 50 Client 2: Bid 100 Server: Client 1's turn Client 1: Stay Server: Sync &lt;send new game state&gt; Server: Client 2's turn Client 2: Hit Server: Sync &lt;send new game state&gt; ... etc. until the game …

http://stackoverflow.com/a/57739476
type: Answer
answers question: http://stackoverflow.com/q/27180954
score: 0
has body: There is no return statement in the function, as it is set as void. However, if the head of the list is kept outside of the function in some variable, it is enough to return the correct result. That's because the first node is not going to be removed, as there will not be any duplicate at this time. After all, you don't have any problem with changing the n value.

http://stackoverflow.com/comment/42883562
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27199423
has text: voting to close - unclear what you are asking
type: Comment

http://stackoverflow.com/q/27165594
favorite count: 0
tagged with: command-line
linked to: http://stackoverflow.com/q/20511182
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/27166719
tagged with: exit
has answer: http://stackoverflow.com/a/27165776
tagged with: java
type: Question
has title: How to gracefully shutdown a Java application that is terminated as a result of closing the command line from which it was executed?
has answer: http://stackoverflow.com/a/27165841
downvote count: 0
answer count: 3
tagged with: windows
linked to: http://stackoverflow.com/q/1028687
has comment: http://stackoverflow.com/comment/72457929
has body: There is a an answered question on Best Way to Gracefully Shutdown a Java Command Line Program. A shutdown hook does the job in case when a program was terminated by Ctrl+C. My question is how to gracefully exit if the command line itself is closed during the execution of a Java program? I tested with shutdown hook but it didn't work in this case. I cannot find out what happens to the virtual machine in this scenario. Is the process and all its threads killed instantly? What kind of signal does closing command line produce? So, how this particular problem can be solved? EDIT: The problem concerns Windows environment.

http://stackoverflow.com/comment/43011526
has text: Try it yourself and post some code. If you get struck, then we will help
score: 0
comment on: http://stackoverflow.com/q/27270747
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43018221
has text: after your question is edited, with, maybe important details 1. for better help sooner post an SSCCE/MCVE, short, runnable, compilable, with hardcoded value for JTextPane called as textArea 2. maybe to use JTextArea (is designated for simple and undecorated JTextComponent), 3 otherwise (without an SSCCE/MCVE) look at, search for events from DocumentListener (API, Oracle tutorial for working code example)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27271816

http://stackoverflow.com/q/27271446
has comment: http://stackoverflow.com/comment/43013631
tagged with: jdbc
has answer: http://stackoverflow.com/a/27273227
has comment: http://stackoverflow.com/comment/43013226
favorite count: 0
has comment: http://stackoverflow.com/comment/43013719
has comment: http://stackoverflow.com/comment/43014184
has comment: http://stackoverflow.com/comment/43014295
has comment: http://stackoverflow.com/comment/43015246
upvote count: 1
has comment: http://stackoverflow.com/comment/43013597
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43014069
has comment: http://stackoverflow.com/comment/43013166
has comment: http://stackoverflow.com/comment/43012919
accepted answer: http://stackoverflow.com/a/27273227
score: 1
tagged with: java
has title: Images take a lot of time to load in JSP
possible better answer: http://stackoverflow.com/a/27272322
has comment: http://stackoverflow.com/comment/43013075
has answer: http://stackoverflow.com/a/27272322
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43015128
has comment: http://stackoverflow.com/comment/43013325
tagged with: batch-processing
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/43013842
has comment: http://stackoverflow.com/comment/43013481
tagged with: struts2
has comment: http://stackoverflow.com/comment/43014651
has body: I have a scenario where I am fetching multiple images from the Oracle database through the loop. But it's taking a lot of time to fetch the images and display it on the browser. Through, this code I am calling my method with some parameters. for(Object[] obj: memberDetails) { System.out.println("String.valueOf(obj[0])"+String.valueOf(obj[0])); try{ memberImage=dtSrvc.getQueImageForQC(Id,String.valueOf(obj[0])); } catch(Exception e) {} map.put("memImage"+count, memberImage); key.add("memImage"+count); hmap.put("memImage"+count, memberImage); count++; } and here is my query through which I am fetching images ps = conn.prepareStatement("select photo from member_photo where ID='" + Id + "' and que_id=" + QueId); Please, let me know how can I speed up this process. I am unable to fetch all images if the network is slow. My application is currently used by many peoples.

http://stackoverflow.com/comment/42894367
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27189766
score: 0
has text: Then, please ask your question on the official JogAmp forum in the Java3D subsection. You can use java.awt.Robot.createScreenCapture(Rectangle) to do it.

http://stackoverflow.com/comment/61969359
type: Comment
has text: @nicolas Based on the fact that it is not often you ever want to implement an interface inline.. F# has structural typing so it makes sense there
comment on: http://stackoverflow.com/a/27273494
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42968869
type: QuestionComment
has text: Is there some invisible character at the beginning of the file?
comment on: http://stackoverflow.com/q/27247005
score: 0
type: Comment

http://stackoverflow.com/q/27158634
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42811891
tagged with: java
has answer: http://stackoverflow.com/a/27158957
tagged with: eclipse
type: Question
has title: How to make default indentation for parenthesis the same as for braces in Eclipse in Java?
answer count: 2
has body: I would like to have the same indentation for parenthesis as for brace of multilined, like this Currently it tries to "fix" me if autoformat into single line.
has answer: http://stackoverflow.com/a/27159207
score: 0
tagged with: indentation

http://stackoverflow.com/q/27208040
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27208362
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27208362
has title: Parsing data from EVA format
tagged with: java
has comment: http://stackoverflow.com/comment/42903770
score: 0
answer count: 1
tagged with: awk
favorite count: 0
has comment: http://stackoverflow.com/comment/42905018
has body: I'm trying to fetch data from EVA binary database, where fields were separated by some special symbols. So far I've managed to convert date into a XML-like text file of a following format. Notice how the order of the fields varies and that not all of them are obligatory. &lt;251&gt;id1&lt;230&gt;&lt;223&gt;author1&lt;228&gt;&lt;215&gt;title1&lt;223&gt;&lt;230&gt;year1&lt;225&gt;&lt;232&gt;location1&lt;226&gt; &lt;251&gt;id2&lt;230&gt;&lt;223&gt;author2&lt;228&gt;&lt;230&gt;year2&lt;225&gt;&lt;232&gt;location2&lt;226&gt;&lt;215&gt;title2&lt;223&gt; &lt;251&gt;id3&lt;230&gt;&lt;230&gt;year2&lt;225&gt;&lt;232&gt;location2&lt;226&gt;&lt;215&gt;title2&lt;223&gt; Each line is separate entry, and for each of them I would like to get something like 251=id1 223=author1 etc. Now I am struggling to parse data from it. I usually used the explode function and define delimiters, but I cant do that here because then I would lose information to which field a certain substring belongs. Maybe I should mention that in the end I want to generate a CSV file, so maybe there is a way to parse it directly from my text file skipping redundant process of parsing each datum separately jut to merge it then again in another format.

http://stackoverflow.com/comment/42902660
score: 0
type: Comment
type: QuestionComment
has text: java.lang.IndexOutOfBoundsException: Invalid index 4, size is 4 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at com.example.thetrial.QuizActivity$1.onClick(QuizActivity.java:46) at android.view.View.performClick(View.java:4091) at android.view.View$PerformClick.run
comment on: http://stackoverflow.com/q/27210501

http://stackoverflow.com/comment/43023434
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27277008
has text: Where is SomeException declared?
score: 0

http://stackoverflow.com/q/27183050
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27184598
upvote count: 1
type: Question
tagged with: session
tagged with: struts2
downvote count: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/27184598
favorite count: 0
has body: Given this following code: index.jsp <s:form action="login"> <s:textfield name="userID" label="User ID"></s:textfield> <s:textfield name="password" label="Password" type="password"></s:textfield> <s:submit value="Login"></s:submit> </s:form> web.xml Struts 2 index.jsp struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* 30 struts.xml <constant name="struts.devMode" value="false" /> <interceptor name="session" class="com.eaylportal.session.SessionInterceptor"/> <interceptor-ref name="session"/> <interceptor-ref name="sessionExpireStack"/> /error.jsp /session.jsp /welcome.jsp /error.jsp /disabled.jsp i don't have any idea with this SessionInterceptor. SessionInterceptor.java public class SessionInterceptor extends AbstractInterceptor { private static final long serialVersionUID = 1L; @Override public String intercept(ActionInvocation invocation) throws Exception { Map<String,Object> session = invocation.getInvocationContext().getSession(); if(session.isEmpty()){ System.out.println(session.containsKey("logged-in")); return "success"; // session is empty/expired } return invocation.invoke(); } } lastly, my ActionClass. LoginAction.java public class LoginAction extends ActionSupport implements SessionAware{ private static final long serialVersionUID = 1L; private String password; private String username; Map<String, Object> session; public String login(){ try { String sql = "SELECT UAFUSERID, UAFUSERTYPE, UAFACCNTSTATUS from USERACCOUNTFILE WHERE UAFUSERID='"+getUsername()+"' AND UAFPASSWORD='"+getPassword()+"'"; Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ibmeaylportaldb", "root", "passw0rd"); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(sql); System.out.println((rs!=null)); while(rs.next()){ if(rs.getString("UAFACCNTSTATUS").equals("DIS")){ return "disabled"; } sql = "SELECT * from USERDETAILFILE WHERE UAFUSERID='…
has title: Session Tracking using Stuts2
type: AnsweredQuestion

http://stackoverflow.com/comment/42918449
comment on: http://stackoverflow.com/q/27219244
score: 0
has text: For [example](http://stackoverflow.com/a/14011536/230513).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27224052
tagged with: java
type: Question
has title: Numerical keyboard in GWT
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27224412
tagged with: textbox
has body: I want to trigger numeric keyboard in some TextBox elements in GWT, someone have any exapmle for this Thanks.
type: UnansweredQuestion
tagged with: gwt

http://stackoverflow.com/comment/42902711
has text: @ElliottFrisch I think they may've been trying to trick the OP…? Either way, I think this is a bad interview question. It can be googled and solved in a matter of minutes.
comment on: http://stackoverflow.com/q/27210560
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/43408532
comment on: http://stackoverflow.com/a/27488029
has text: @Rudi: What counts is what is written in the contract of the interface (i.e., the javadoc of the class). Right now, there is not enough info in it. If Oracle wants to mandate this, they need to patch the javadoc. But then it will be too late and a lot of non-conforming implementations will already exist.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27167073
answer count: 2
accepted answer: http://stackoverflow.com/a/27167107
has body: I'm working on an App in which an Activity is shown for 3 seconds, after which the next Activity is started. I succeeded with the following code: // shows the picture for 3 seconds, then takes the user to GamePlay final Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { Intent intent = new Intent(ShowImage.this, GamePlay.class); ShowImage.this.startActivity(intent); ShowImage.this.finish(); } }, 3000); This Activity also shows a picture and I want to pass the ID of the picture to the next activity. I know it can be done (from experience, in another Activity) by using the following code (I tried inserting it in the blank line above): this.putExtra("id", selected_image); However, I get the error "the Method putExtra(String, int) is undefined for the type new Runnable(){}" My question then is, how do I pass the image-id to the next activity, while containing my 3-seconds delay? Here is the rest of the Activity's code: import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.GridView; import android.widget.Toast; public class ShowImage extends ActionBarActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.show_image, 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); } @Override protected void onCreate(Bundle savedInstanceState) { // shows the activity super.onCreate(savedInstanceState); setContentView(…
score: 0
tagged with: android
has title: Pass integer to activity from within handler
has answer: http://stackoverflow.com/a/27167107
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27167115
tagged with: java
has answer: http://stackoverflow.com/a/27167115
type: Question

http://stackoverflow.com/a/37134882
type: Answer
score: 4
upvote count: 4
downvote count: 0
has body: steps to be followed change the port number in catalina.properties file under server folder e.g. bio.http.port=18080 bio.https.port=18844 kill the java.exe running on port 8080(or any other port which poses the issue)- Use TcpView to kill the process on specfic port Right click on the server and then click on "clean tc server work directory" Right click on the server and then click on "Clean" and there u go "baaaam"
answers question: http://stackoverflow.com/q/27174981

http://stackoverflow.com/comment/43012264
type: QuestionComment
comment on: http://stackoverflow.com/q/27271234
has text: do you want to show a panel ? use setVisible
score: 0
type: Comment

http://stackoverflow.com/q/27200247
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27200293
answer count: 2
has answer: http://stackoverflow.com/a/27200292
score: 0
has body: I my app I have many of jTextFields. How can I validate all of JtextField? I try something like this: if((jTextField1.getText.length()&lt;3) || (jTextField2.getText.length()&lt;3) ||(jTextField1.getText.length()&lt;3) ......){ ........ } What is a best way to validate text fields ?
has title: jTextField validation in java
accepted answer: http://stackoverflow.com/a/27200292
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27200293

http://stackoverflow.com/a/27266279
has body: Even without multiple thread access, your implementation fails because the outer for-loop does not take into account that you might remove objects while iterating. So the counter s is always incremented, even when an object is removed due to collisions. For that reason, every successor of an object that gets removed, is skipped in your implementation. (Explanation: If object at position s is removed, all successive objects move one position to front, hence object at position s + 1 moves to position s. But as your for loop increases s afterwards, the new object at that position is skipped). You should always favour iterators over for loops with counters. They offer safe removal of objects and are more flexible in case you want to change the implementations of your collections. (In your case, an iterator offers far better performance than a counter as index based operations on a LinkedList require sequential traversal of the list). This is an example implementation that has some more improvements and should work in your case: private void checkForCollision() { // use iterator instead of index based for loop while (Iterator&lt;GameObject&gt; iter = objects.iterator(); iter.hasNext();) { GameObject object = iter.next(); // in case the object is the player, we can skip all collision tests if (object == getPlayer()) continue; // use implicit iterator instead of index based for loop for (Bullet bullet : bullets) { if (object.getCol().getBounds2D().intersects(bullet.getCol().getBounds2D())) { iter.remove(); // remove object via iterator break; // no need to check the rest =&gt; leave inner loop } } } } Note: This implementation is not thread safe, so in case your objects (either the collections objects or bullets or any object inside them) are accessed by multiple threads, either synchronization or thread-safe collections are required!
type: Answer
has comment: http://stackoverflow.com/comment/43008311
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27261610

http://stackoverflow.com/comment/42813458
comment on: http://stackoverflow.com/q/27156395
has text: Does this help? http://stackoverflow.com/a/14465114
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/58539991
type: AnswerComment
comment on: http://stackoverflow.com/a/31944919
type: Comment
score: 0
has text: Hey, Any chance you guys, @nont @Abhishek-Dey-Das, solved this issue in a different way? The [Official geojson specification](http://geojson.org/geojson-spec.html) suggests that _Feature_ and _FeatureCollection_ types are perfectly valid as `GeoJson` types. My problem is I read a json that contains geojson. I don't know which type it will hold, and I don't want to "guess" it using try-catch mechanism

http://stackoverflow.com/a/27208391
has body: It looks like the Media needs some time to get fully initialized. Add a Thread sleep beforebthe getDuration line and try again!
score: 0
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27208201

http://stackoverflow.com/a/27166327
type: Answer
has body: You would have to first sort your entries by key length, with the longest ones being first and the shortest ones last. Because you first want to check whether your Code starts with 101DG, and only then check whether it starts with 101DG and finally 1. Then to check for matches you could use something like this: if (comp.substring(0,key.length()).equals(key)) { // it's a match — use this Value }
has comment: http://stackoverflow.com/comment/42824885
accepted answer of: http://stackoverflow.com/q/27166197
score: 0
answers question: http://stackoverflow.com/q/27166197
type: AcceptedAnswer

http://stackoverflow.com/a/78873109
type: Answer
has body: I created an implementation which does not use either systemd-notify as a subprocess nor require JNA/JNI. However, as Java does not support AF_UNIX Datagram sockets natively I had to pull in junixsocket as a depenency (though this can likely be replaced with a smaller library, it was just the first one which I found). import java.io.IOException; import java.nio.ByteBuffer; import org.newsclub.net.unix.AFUNIXDatagramSocket; import org.newsclub.net.unix.AFUNIXSocketAddress; public class SdNotify { public static void main(String[] args) { ready(); } public static void ready() { notify("READY=1"); } public static void status(String status) { notify("STATUS=" + status); } /// ...implement other well-known sd_notify(3) messages as needed... private static void notify(String arg) { var socketPath = System.getenv("NOTIFY_SOCKET"); if (socketPath == null) return; if (!(socketPath.startsWith("/") || socketPath.startsWith("@"))) { throw new UnsupportedOperationException("Unsupported socket type"); } if (socketPath.startsWith("@")) { socketPath = "\0" + socketPath.substring(1); } try (var socket = AFUNIXDatagramSocket.newInstance()) { socket.connect(AFUNIXSocketAddress.of(socketPath.getBytes())); try (var out = socket.getChannel()) { out.write(ByteBuffer.wrap(arg.getBytes())); } } catch (IOException e) { System.err.printf("Failed to notify systemd of service readiness: %s", e.toString()); } } } https://gist.github.com/septatrix/dcb1d7763c941be399da5dc97397e6c3
answers question: http://stackoverflow.com/q/27176303
score: 0

http://stackoverflow.com/a/27310252
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27310097
type: Answer
answers question: http://stackoverflow.com/q/27310097
has body: Eclipse juno doesn't magically gain Java 1.8 compiler support because you install Java 8. Juno was released in June 2012 while Java 8 was released March 2014. The first version of eclipse with Java 8 support was Kepler (through an after-release JDT update); Luna supports Java 8 out of the box.
upvote count: 5
score: 5

http://stackoverflow.com/q/27159372
has answer: http://stackoverflow.com/a/31011183
possible better answer: http://stackoverflow.com/a/27159417
has answer: http://stackoverflow.com/a/27159417
answer count: 4
type: AnsweredQuestion
score: 22
accepted answer: http://stackoverflow.com/a/27159419
tagged with: java
type: Question
tagged with: intellij-idea
has body: In Eclipse, the "Open Type" dialog (Ctrl + Shift + T) allows you to open any type, including those that are in jar dependencies. What's the equivalent for Intellij IDEA?
tagged with: eclipse
upvote count: 22
has title: How to navigate to a Type in IntelliJ? or what is the equivalent to Eclipse's Ctrl + Shift + T?
has answer: http://stackoverflow.com/a/27159419
has answer: http://stackoverflow.com/a/58728947
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43061651
score: 0
type: AnswerComment
type: Comment
has text: @Fabio Try adding [solr.NGramFilterFactory](http://www.wunderkraut.com/blog/apache-solr-configuring-partial-word-search-functionality/2012-12-12) or [solr.EdgeNGramFilterFactory](http://stackoverflow.com/questions/13472565/partial-word-search-in-solr-example-sarvesh-i-want-search-like-rves) in your shcmea.xml to perform search for partial words. Example: `<filter class="solr.NGramFilterFactory" mingramsize="3" maxgramsize="25"/>` for fieldtype `solr.TextField`
comment on: http://stackoverflow.com/a/27258377

http://stackoverflow.com/a/27196051
type: Answer
answers question: http://stackoverflow.com/q/27195951
score: 2
accepted answer of: http://stackoverflow.com/q/27195951
has body: You can read whole input line and then create a new Scanner for reading integers from this line: Scanner cin = new Scanner(System.in); int test = Integer.parseInt(cin.nextLine()); for (int k = 0; k &lt; test; k++) { String line = cin.nextLine(); Scanner lineScan = new Scanner(line); while (lineScan.hasNextInt()) { // print number System.out.println(lineScan.nextInt()); } //print output }
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27179144
accepted answer: http://stackoverflow.com/a/27180066
has comment: http://stackoverflow.com/comment/42847393
type: Question
has comment: http://stackoverflow.com/comment/42848168
has comment: http://stackoverflow.com/comment/42847740
has comment: http://stackoverflow.com/comment/42847448
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/42847148
has title: java.sql.SQLException when creating or updating a row
tagged with: sql-server
has comment: http://stackoverflow.com/comment/42848413
tagged with: sql
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27180066
has body: I have a panel where the user can create and edit a product entry. It was running fine, until the last database schema update. After refactoring the entity to reflect the changes made in database, my program can't create nor edit a product row. The server is returning this exception: [#|2014-11-27T21:33:40.583+0000|INFO|oracle-glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=139;_ThreadName=Thread-9;|27/11/2014 - 21:33:40 [http-thread-pool-8181(2)] ERROR com.lutum.web.cadastro.controladores.painel.ControladorPainelCadastroProduto org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: Column name 'ALIQUOTAL_ICMS_COMPRA_FP' is invalid.; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Column name 'ALIQUOTAL_ICMS_COMPRA_FP' is invalid. at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:321) at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:120) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:471) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocat…
has comment: http://stackoverflow.com/comment/42848310
has comment: http://stackoverflow.com/comment/42847652
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42848726
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/28234567
has body: Looks like it was a simple case of the data I was posting being too large for the allocated timeouts. Old Unirest.setTimeouts(10000, 10000); New Unirest.setTimeouts(10000, 30000);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27272369
upvote count: 3
score: 3

http://stackoverflow.com/a/27290402
type: AcceptedAnswer
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27289951
accepted answer of: http://stackoverflow.com/q/27289951
has body: You missed the layout orientation.Also you need to set the layoutparams width LayoutParams.MATCH_PARENT layout[i].setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout[i].setOrientation(LinearLayout.HORIZONTAL);

http://stackoverflow.com/comment/42936559
has text: No, it doesn't have to be. [this project](https://github.com/fge/largetext) implements `CharSequence`, for instance, and is not backed by an array
comment on: http://stackoverflow.com/a/27229721
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42878697
type: QuestionComment
comment on: http://stackoverflow.com/q/27196689
score: 0
type: Comment
has text: This is unclear. What you've written doesn't make sense. "str.add" : add method doesn't exist on "String". Can you explain more accurately what you're trying to do?

http://stackoverflow.com/a/27248536
has body: Using the concurrent collections stuff will only do the locking at a fine grained level so you are not getting much benefit anyway. I would design the search a bit different. The idea here should be to design your search method in a way that makes two calls of it mutually exclusive. One way that come sin my mind is to use a produces consumer pattern here. Search method creates a worker for each call that is made to it and that worker is executed by a boundless executor service. Another way is to keep a queue of workers. search method creates workers and add them to the queue and another executor service keeps picking workers form queue to execute and return the results. In all cases the idea is to make the instances of search operations mutually exclusive to each other. Also cache the stuff if you can.
score: 0
answers question: http://stackoverflow.com/q/27248372
type: Answer

http://stackoverflow.com/a/27260340
has comment: http://stackoverflow.com/comment/42994125
has comment: http://stackoverflow.com/comment/42994354
has body: Use this to qualify your instance variables as you have done for marque, indentifiant, and codeCarte. Also use else on your ifs to assign the variable the normal value if not outside the validation range. E.g. for codeForme: if(codeForme &lt; 0 || codeForme &gt; 9) { this.codeForme = 0; } else { this.codeForme = codeForme; } And similarly for capaciteMaxMemoire and memoireInstalle.
has comment: http://stackoverflow.com/comment/42994484
downvote count: 0
has comment: http://stackoverflow.com/comment/42994224
has comment: http://stackoverflow.com/comment/42994787
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27260290
score: 1

http://stackoverflow.com/comment/125976324
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/59907330
has text: Thank your for your post and welcome to Stack Overflow (SO). I have updated your post for grammar and formatting. Please read it over and let me know if I changed your meaning. That was not my goal if I did, and I want to fix it. Thank you!
score: 0

http://stackoverflow.com/q/27159829
has title: How to check whether a record exists before inserting
favorite count: 0
type: UnansweredQuestion
has body: I am using Hibernate 4.3.6 Final and MySQL 5.5.37. Suppose I have two tables Book and Words and some code that parses the words in the book and adds them to the Words table. There will certainly be words that appear in more than one book. However, I don't want a new entry for a word if it is already in the database. The only question is if Hibernate is smart enough to have some sort of functionality for this? There are a couple of solutions, but none of them is pretty: Check before creating the any Word object if there is already one like it in the database. Horrible for performance. Catch the exception that is thrown when trying to insert a duplicate and handle that. Horrible practice. Have some sort of static index of the words in the database, which is updated periodically, and search for the word in the list. Maybe slightly faster, but still horrible in terms of performance and memory. Is there a better approach?
has comment: http://stackoverflow.com/comment/42813584
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27160104
has comment: http://stackoverflow.com/comment/42813855
answer count: 1
downvote count: 0

http://stackoverflow.com/a/27257548
type: Answer
has comment: http://stackoverflow.com/comment/43046097
has comment: http://stackoverflow.com/comment/43019212
has comment: http://stackoverflow.com/comment/43010929
answers question: http://stackoverflow.com/q/27254163
has body: I probably would index the hits as part of the document index using @IndexedEmbedded. Then you run your query against the description field, providing a custom Sort implementation. The custom sort will need the data range as parameter and then count the hits in this date range and order accordingly.
has comment: http://stackoverflow.com/comment/42991927
score: 0
has comment: http://stackoverflow.com/comment/43040299
has comment: http://stackoverflow.com/comment/43057387

http://stackoverflow.com/comment/42900481
has text: Thanks for the informative post, friend! Unfortunately, we have not yet learned how to utilize arrays in my CompSci class. :(
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27209312
type: Comment

http://stackoverflow.com/q/27253341
has comment: http://stackoverflow.com/comment/48008850
downvote count: 0
has body: I'm trying to upgrade a legacy webservice from Axis1 to JaxWS. I've been trying out various tutorials to see if I can add a JaxWS Webservice to the existing WebSphere server we use. I'd like to use the WebService Wizard since that seems like the most likely way to get everything running smoothly, however I've encountered the following problem. When I change the Web Service Runtime from AXIS to WebSphere JAX-WS I get the message The IBM WebSphere JAX-WS Web service runtime in WebSphere Application Server V8.5 Liberty Profile does not support the service project &lt; jax-ws project name > So far google has failed to find a solution or even an explanation of this error for me. Does anyone here understand what my error is? Thanks,
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43045057
has comment: http://stackoverflow.com/comment/42984744
has comment: http://stackoverflow.com/comment/43199719
has comment: http://stackoverflow.com/comment/43048272
score: 2
has comment: http://stackoverflow.com/comment/47996138
answer count: 0
upvote count: 2
tagged with: java
tagged with: jax-ws
tagged with: web-services
type: Question
tagged with: eclipse
has title: The IBM WebSphere JAX-WS Web service runtime in WebSphere Application Server V8.5 Liberty Profile does not support the service project
tagged with: websphere

http://stackoverflow.com/a/27271152
has body: Try this: TimeZone MyTimezone = TimeZone.getDefault(); Calendar calendar = new GregorianCalendar(MyTimezone); calendar.set(year, month, day, hour, minute, second); String month_name=calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());//Locale.US); String day_name=calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.getDefault());//Locale.US);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27270998

http://stackoverflow.com/q/27171332
answer count: 1
has comment: http://stackoverflow.com/comment/42835903
tagged with: jquery
accepted answer: http://stackoverflow.com/a/27171774
has comment: http://stackoverflow.com/comment/42869780
has title: jQuery inside SpriingMVC Form
has comment: http://stackoverflow.com/comment/42833930
has comment: http://stackoverflow.com/comment/42836649
has comment: http://stackoverflow.com/comment/42836589
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/42835962
has comment: http://stackoverflow.com/comment/42833986
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27171774
has comment: http://stackoverflow.com/comment/42833476
has body: I've got trouble with creating the form using SpringMVC with jQuery; Here is my index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> <%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%> Title Page <sec:authorize access="hasRole('ROLE_USER')"> </sec:authorize> Login Section Login <form:form id = "form" method="POST" commandName="object" action="process"> </form:form> Info Section This is a demo Voting application Here I'm trying to populate the form with radiobuttons. If i insert tag inside html it is ok. But if I use jQuery like above I'm getting the error: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsps/index.jsp at line 38 35: success: function(jsondata){ 36: $.each(jsondata, function(key,value){ 37: 38: $('.loggedInForm #form').append("<form:radiobutton path='name' value=" + value.name + "></form:radiobutton>" + value.name); 39: }); 40: $('.loggedInForm #form').append("<input type='submit' value='Vote!' " ); 41: } Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992) org.springframework.web.servlet.Dispatcher…
has comment: http://stackoverflow.com/comment/42869841
type: Question
has comment: http://stackoverflow.com/comment/42834055
score: 0
has comment: http://stackoverflow.com/comment/42837402
has comment: http://stackoverflow.com/comment/42837667

http://stackoverflow.com/q/27161463
has title: java 8 stream groupBy and new object creation
favorite count: 0
has body: Let's say I have two classes C1 and C2 where C2 is used by the constructor of C1: public class C1 { public C1( C2 o2 ){ ... } public String getProperty() { String result; ... return result; } } Now, I have a list of C2 objects (List list) that I would like to stream and filter using a condition on the getProperty() of C1 created from the C2 objects that are streamed. Is there a way to do this with a stream? List&lt;C2&gt; list = ... List&lt;C2&gt; result = list.stream().filter( XXXX ) where I guess I should have XXXX that creates a C1 object using a C2 object from the stream and compares its getProperty() (e.g., "value".equals (o2.getProperty()) Is this possible at all?
has answer: http://stackoverflow.com/a/27161503
upvote count: 1
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27161503
answer count: 1
downvote count: 0

http://stackoverflow.com/a/32443234
answers question: http://stackoverflow.com/q/27218894
type: Answer
score: 0
has body: An obvious answer, but it works. Convert each gray code into its respective Binary form, subtract the two. If you answer is a binary equivalent of +1 or -1 then the two gray codes are adjacent. This seems like an over kill, but when you're siting in an interview and don't know the correct method, this works. Also to optimize, one can check the single bit difference filter, so we don't waste time converting and subtracting numbers that we know for sure aren't adjacent.

http://stackoverflow.com/comment/42925807
comment on: http://stackoverflow.com/q/27200226
score: 0
has text: Please Anybody Check it once.
type: Comment
type: QuestionComment

guava
tags question: http://stackoverflow.com/q/27260370
tags question: http://stackoverflow.com/q/27263604
tags question: http://stackoverflow.com/q/27296223
tags question: http://stackoverflow.com/q/27278750
tags question: http://stackoverflow.com/q/27234928
tags question: http://stackoverflow.com/q/27166610
tags question: http://stackoverflow.com/q/27284164
tags question: http://stackoverflow.com/q/27306244
tag name: guava
type: Tag
tags question: http://stackoverflow.com/q/27212338
tags question: http://stackoverflow.com/q/27196513

http://stackoverflow.com/comment/42938637
comment on: http://stackoverflow.com/q/27230419
has text: @MarkoTopolnik I just doubled-checked with IBM JDK 6 and `@Override` is supported there for interfaces. I'm pretty sure this is also the case for Oracle JDK 6, though I don't have the documentaton at hand. Sadly, the Javadoc of JDK 6 still mentions "superclass" not "supertype".
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27266517
type: Answer
has body: Reading the Java source code at the link you provided, it appears that the "dragon front" parser expects to read its input from standard input ... not from a file whose name you supply on standard input. Try this: java main.Main &lt; your_input_file
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27266372
downvote count: 0

http://stackoverflow.com/q/27167026
linked to: http://stackoverflow.com/q/11624676
has body: Assume that i have a following CSV file of Action log of an application. This csv may contain 3 - 4 million rows. Company, ActionsType, Action ABC, Downloaded, Tutorial 1 ABC, Watched, Tutorial 2 PQR, Subscribed, Tutorial 1 ABC, Watched, Tutorial 2 PQR, Subscribed, Tutorial 3 XYZ, Subscribed, Tutorial 1 XYZ, Watched, Tutorial 3 PQR, Downloaded, Tutorial 1 Is there anyway way to aggregate those data by grouping by Company name and show actionType counters as column like shown below using Java? Company, Downloaded, Watched, Subscribed ABC, 1, 2, 0 PQR, 1, 0, 2 XYZ, 0, 1, 1 I thought of loading CSV file to a List using OpenCSV, but is it efficient for a csv file of millions of data?
has comment: http://stackoverflow.com/comment/42826201
has comment: http://stackoverflow.com/comment/42826523
has comment: http://stackoverflow.com/comment/42826140
answer count: 5
has answer: http://stackoverflow.com/a/27168825
has answer: http://stackoverflow.com/a/27167873
type: Question
tagged with: opencv
has comment: http://stackoverflow.com/comment/42826392
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27168723
has comment: http://stackoverflow.com/comment/42826447
has comment: http://stackoverflow.com/comment/42826412
has title: How to aggregate CSV data with group by in Java?
has answer: http://stackoverflow.com/a/27168151
has comment: http://stackoverflow.com/comment/42826113
has answer: http://stackoverflow.com/a/27168723
has answer: http://stackoverflow.com/a/67881130
has comment: http://stackoverflow.com/comment/42827155
possible better answer: http://stackoverflow.com/a/27167873
score: 0
tagged with: http://stackoverflow.com/tag/csv

web
tags question: http://stackoverflow.com/q/27228091
tags question: http://stackoverflow.com/q/27173606
type: Tag
tags question: http://stackoverflow.com/q/27288653
tags question: http://stackoverflow.com/q/27181731
tags question: http://stackoverflow.com/q/27273173
tag name: web
tags question: http://stackoverflow.com/q/27264532
tags question: http://stackoverflow.com/q/27212134
tags question: http://stackoverflow.com/q/27192139
tags question: http://stackoverflow.com/q/27312954
tags question: http://stackoverflow.com/q/27216454
tags question: http://stackoverflow.com/q/27165592

http://stackoverflow.com/a/27198131
has comment: http://stackoverflow.com/comment/42881003
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/27198119
has comment: http://stackoverflow.com/comment/42880956
has body: Just use a while loop. Until you say "no" at the end, stop will be false, so !stop will be true, and you'll keep looping. Scanner scan = new Scanner(System.in); boolean stop = false; while(!stop) { //do whatever System.out.println("Would you like to continue? (yes or no)"); String s = scan.nextLine(); if(s.equals("no")) { stop = true; } }
upvote count: 4

http://stackoverflow.com/comment/43024341
score: 0
has text: What is the result you get when you run this SQL on the database?
comment on: http://stackoverflow.com/q/27277515
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27204452
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42891771
favorite count: 0
has comment: http://stackoverflow.com/comment/42891482
has title: problems with focuslost in java
linked to: http://stackoverflow.com/q/11818080
linked to: http://stackoverflow.com/q/26423468
accepted answer: http://stackoverflow.com/a/27204855
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42891554
linked to: http://stackoverflow.com/q/11042361
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42891728
tagged with: jtextfield
type: Question
has body: I have the following code that works correctly in my opinion but when I try to enter a new record starts blinking between charter field and the field name, this happens when the validation performed to see if the jtexfiedl is empty. Here the code. public void validarCedula(JTextField txt, JLabel lblMensaje) { texto = txt.getText().trim(); tamanio = texto.length(); lblMensaje.setText(""); try{ if (texto.isEmpty()) { lblMensaje.setText("Cedula Vacio"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } else if (tamanio &gt; 0 &amp;&amp; tamanio &lt; 9) { lblMensaje.setText("Cedula Incorrecta"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } else if (tamanio == 10) { lblMensaje.setText("Cedula Correcta"); lblMensaje.setForeground(Color.white); } else if (tamanio &gt; 11 &amp;&amp; tamanio &lt; 13) { lblMensaje.setText("RUC Incorrecto"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } else if (tamanio == 13) { lblMensaje.setText("R.U.C Correcto"); lblMensaje.setForeground(Color.WHITE); } }catch(Exception ex) { JOptionPane.showMessageDialog(null, ex); } } public void validarNombre(JTextField txt, JLabel lblMensaje) { texto = txt.getText().trim(); tamanio = texto.length(); try{ if (texto.isEmpty()) { lblMensaje.setText("Nombre Vacio"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } else if (tamanio &gt; 0 &amp;&amp; tamanio &lt; 7) { lblMensaje.setText("Debe Ingresar 2 Nombres"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } else if (tamanio &gt; 7 &amp;&amp; tamanio &lt; 24) { lblMensaje.setText("Nombre Correcto"); lblMensaje.setForeground(Color.WHITE); } else if (tamanio &gt; 25) { lblMensaje.setText("Nombre Incorrecto"); lblMensaje.setForeground(Color.red); txt.requestFocus(); } }catch(Exception ex) { JOptionPane.showMessageDialog(null, ex); } } These methods are called in the main class in each jtexfield focusLost event. Someone could help me find the solution?
linked to: http://stackoverflow.com/q/12058212
has answer: http://stackoverflow.com/a/27204855
linked to: http://stackoverflow.com/q/11091457

http://stackoverflow.com/comment/42961202
has text: should be 'same' package.
type: AnswerComment
comment on: http://stackoverflow.com/a/27242672
score: 0
type: Comment

http://stackoverflow.com/a/27297398
has comment: http://stackoverflow.com/comment/43059060
has comment: http://stackoverflow.com/comment/43059034
has body: You need to escape { as it is used to quantify a repetition, try: public static void main(String[] args) { String pptValue = "foo{bar"; String[] parts = pptValue.split("\\{"); System.out.println(parts.length); for (int i = 0; i &lt; parts.length; i++){ System.out.println(parts[i]); } }
downvote count: 0
answers question: http://stackoverflow.com/q/27297370
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/27173833
has body: I am trying to debug a few slow responses served by an app deployed on Tomcat. Right now I am focussing on SecureRandom and /dev/random (some of the other probable causes have been investigated and ruled out). The pattern is as follows: The first call takes exactly 30.0xy seconds after Tomcat restart (even if the request arrives 4 minutes after the Startup) Later, some calls take exactly 15.0pq seconds (there was no specific pattern that I could establish, pq being the time approximate time taken in TP99) The service call involves encryption and decryption (AES/ECB/PKCS5Padding). Is it possible that SecureRandom init/repopulating is leading to this? (Although, there is a log written in catalina.log that says "Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [28,760] milliseconds.") Also, in order to check whether /dev/random or /dev/urandom is being used, I used the test from this question. To my surprise, I didn't see reads from either of them unlike the way it happens in the linked question. These are the last few lines from the strace log: 3561 lstat("/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/jsse.jar", {st_mode=S_IFREG|0644, st_size=258525, ...}) = 0 3561 open("/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/jsse.jar", O_RDONLY) = 6 3561 stat("/dev/random", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 8), ...}) = 0 3561 stat("/dev/urandom", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0 3561 open("/dev/random", O_RDONLY) = 7 3561 open("/dev/urandom", O_RDONLY) = 8 3561 unlink("/tmp/hsperfdata_xxxx/3560") = 0 What is then being used for seeding SecureRandom? fyi, java -version java version "1.6.0_32" OpenJDK Runtime Environment (IcedTea6 1.13.4) (rhel-7.1.13.4.el6_5-x86_64) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
tagged with: java
has comment: http://stackoverflow.com/comment/42842923
linked to: http://stackoverflow.com/q/137212
tagged with: random
answer count: 2
has comment: http://stackoverflow.com/comment/42839425
duplicate of: http://stackoverflow.com/q/137212
downvote count: 0
has comment: http://stackoverflow.com/comment/42838216
tagged with: tomcat
score: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/42850950
has answer: http://stackoverflow.com/a/27178322
upvote count: 6
tagged with: aes
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30359232
has comment: http://stackoverflow.com/comment/42858360
has answer: http://stackoverflow.com/a/30359232
tagged with: strace
type: Question
has title: Slow service response Times : Java SecureRandom & /dev/random
accepted answer: http://stackoverflow.com/a/27178322

http://stackoverflow.com/q/27256140
has comment: http://stackoverflow.com/comment/42986106
has comment: http://stackoverflow.com/comment/43007010
downvote count: 4
has title: Finishing Keno Java code?
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: This is what I am having trouble with. I am making a Keno game out of a Crystals code I was given. So far, I have been able to choose 20 of the 80 and turn them red. However, I have the button set to when I press it it says "Game is a draw" and the window closes. I am trying to put in a code where it will randomly draw 20 numbers without repeating, and then they turn yellow, however, if the CPU and the human match a number, it will turn green. I have no idea how to start this code or how to go about doing it. Here is what I have: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.lang.String; public class Kenogame { // constants public static final int WIDTH = 4; public static final int HEIGHT = 20; public static final int INITIAL = 0; public static final int RED = 1; public static final int YELLOW = 3; public static final int CHECKED = 4; private int turn = RED; // to track which player should play next private int[][] playerGrid; // to record each player's move private int[][] shadowGrid; // to keep track of which atoms have been FOUND private int[][] crystalGrid; // to extract a single crystal from playerGrid private int row, column; // position of most recently added atom private int lowX, lowY, highX, highY; // corner coordinates of current crystal private int player1Score = 0; private int player2Score = 0; // GUI related fields private JButton[] buttonArray; // private JTextField scoreField1; // private JTextField scoreField2; // private JLabel labelRED; // Label "Red" on GUI // private JLabel labelYELLOW; // Label "Yellow" on GUI private JLabel labelTurn; // Label displays whose turn is next private int numberToSelect = 20; Kenogame() { createGUIAndPlay(); } private void createGUIAndPlay() { final JFrame f = new JFrame(); // create the panels JPanel topPanel = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(new GridLayout(WIDTH, HEIGHT)); JPanel labelPanel = new JPanel(); // represents the 2D grid…
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/27256405
type: Question

http://stackoverflow.com/comment/42847461
type: Comment
comment on: http://stackoverflow.com/q/27179037
score: 0
has text: I have added the error am getting to the post. thanks for yr help
type: QuestionComment

http://stackoverflow.com/comment/43055632
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27295474
has text: Just to be sure, you're getting propertyUniqueness false for `<property name="foo" unique="true" />` ?
type: Comment

http://stackoverflow.com/comment/42853326
type: Comment
type: QuestionComment
has text: What do you mean by "available to the public"? Can't you just make the .jar file available?
score: 0
comment on: http://stackoverflow.com/q/27181979

http://stackoverflow.com/comment/43021190
has text: i tried now with no effect: `WebElement element_t = (new WebDriverWait(_driver, 10)) .until(ExpectedConditions.presenceOfElementLocated( By.xpath(".//*[@myattribute='mytest']")));`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27272611

http://stackoverflow.com/comment/43075059
has text: 'I am having an issue' which exact issue do you have? Does your code work? Please, share more details description.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27306142

http://stackoverflow.com/q/27211744
type: Question
tagged with: try-catch
has title: EAFP. Ask for forgiveness not permission in Java
has answer: http://stackoverflow.com/a/27211759
accepted answer: http://stackoverflow.com/a/27211759
possible better answer: http://stackoverflow.com/a/27211763
score: 4
linked to: http://stackoverflow.com/q/404795
has comment: http://stackoverflow.com/comment/67057038
answer count: 3
has body: Is it a good practice in Java to ask for forgiveness not permission in general and in the next example? The example is: try { Cell value = array2D[rowIndex][columnIndex]; } catch (ArrayIndexOutOfBoundsException e) {} As you can see in the above piece of code we get value out of the array2D. If the value is out of bounds we do nothing. I ask this question because it is much easier to implement EAFP than LBYL (look before you leap) in some cases (for example finding all neighbors of given Cell in array2D).
downvote count: 1
favorite count: 0
upvote count: 5
tagged with: exception
has comment: http://stackoverflow.com/comment/136151073
has answer: http://stackoverflow.com/a/27211763
has answer: http://stackoverflow.com/a/27211761
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27261200
has body: I'm assuming Panel is the class of panel objects, than a more efficient way to write this is: f.set("panels", ii.panels.values().stream().collect(Collectors.toMap( Panel::getSerializedName, Function.identity() ))); The identity function always returns its input argument, java doc.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27261039
type: Answer
accepted answer of: http://stackoverflow.com/q/27261039
has comment: http://stackoverflow.com/comment/42995377
upvote count: 1
score: 1

http://stackoverflow.com/q/27231624
tagged with: android
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42940066
has comment: http://stackoverflow.com/comment/42940016
type: Question
has title: Android: SQLite no such table?
has comment: http://stackoverflow.com/comment/42941044
score: 0
tagged with: sqlite
linked to: http://stackoverflow.com/q/21881992
has body: Hello I am getting a "no such table" error when I want to fill in data in my sqlite db I am asking myself if the syntax is wrong private static final String KEY_ID= "blabla"; private static final String KEY_VALUE1 = "blabla"; private static final String KEY_VALUE2 = "blabla"; private static final String KEY_VALUE3= "blabla"; private static final String KEY_VALUE4= "blabla"; .... @Override public void onCreate(SQLiteDatabase db) { String CREATE_TABLE = "CREATE TABLE " + TABLE_EXAMPLETABLE + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_VALUE1 + " TEXT," + KEY_VALUE2 + " TEXT," + KEY_VALUE3 + " TEXT, " + KEY_VALUE4 + " TEXT " + ")"; db.execSQL(CREATE_TABLE); } do you see any mistake?
duplicate of: http://stackoverflow.com/q/21881992

http://stackoverflow.com/q/27237257
has body: When I run this I'm getting this number format error. It only seems to happen when I comment out the lines in the OnLocationChanged method to test if the views will display and calculate the right speed or not, any help would be much appreciated :) package com.nathan.trackrun; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.location.LocationClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import android.content.pm.ActivityInfo; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Chronometer; import android.widget.CompoundButton; import android.widget.TextView; import android.widget.ToggleButton; /** * A simple {@link android.support.v4.app.Fragment} subclass. * */ public class FragmentStats extends Fragment implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener, LocationListener { public FragmentStats() { // Required empty public constructor } LocationManager statsManager; TextView speedView; TextView speedUnit; TextView unitView; TextView timerView; TextView distanceView; TextView distanceUnit; ToggleButton buttonStart; Button buttonSave; Button buttonReset; ToggleButton buttonSpeedUnit; String mySpeedString; String kmhString = "Km/h"; boolean checkSpeedUnit; private LocationRequest statsLocationRequest; private LocationClient statsLocationClient; FragmentMap fMap; Chronometer stopwatch; String chronoText; boolean reset; public static boolean startStop; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout …
tagged with: java
tagged with: eclipse
type: Question
has title: Stopwatch error, help!! - java.lang.NumberFormatException: Invalid int: "0:00"
answer count: 1
accepted answer: http://stackoverflow.com/a/27237331
score: 0
tagged with: android
favorite count: 0
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/27237331
type: AnsweredQuestion

http://stackoverflow.com/comment/43090559
has text: @andih, take a look — https://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#readLine()
comment on: http://stackoverflow.com/a/27313034
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43107762
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27308215
has text: Well, a `GridLayout` of components works pretty well, but you should also look at `JList` and `JTable`.
score: 0

http://stackoverflow.com/q/27208872
has body: Im trying to automate the Google Images page: https://www.google.com/search?q=pluralsight&amp;biw=1416&amp;bih=685&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ei=qGd6VN6bEZTooAT7q4C4BQ&amp;sqi=2&amp;ved=0CAgQ_AUoAw All the images have the same class but no id and the results are constantly changing. So I would like to be able to click on the images based on their index. I know how to do it in C#...but I cant figure out how to specify in the index in Java. When I try to select an index beyond 0, I get and IndexOutOfBounds error, but i cant figure out why WebElement image = chromeDriver.findElement(By.className("rg_di")); WebElement imageLink = image.findElements(By.tagName("a")).get(1); imageLink.click(); Here is the entire code im using...any help would be appreciated: System.setProperty("webdriver.chrome.driver", "/Users/user/chromedriver"); WebDriver chromeDriver = new ChromeDriver(); chromeDriver.get("http://www.google.com"); WebElement searchBox = chromeDriver.findElement(By.id("gbqfq")); searchBox.sendKeys("pluralsight"); searchBox.sendKeys(Keys.RETURN); chromeDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); WebElement imagesLink = chromeDriver.findElement(By.linkText("Images")); imagesLink.click(); WebElement image = chromeDriver.findElement(By.className("rg_di")); WebElement imageLink = image.findElements(By.tagName("a")).get(1); imageLink.click(); Any help would be greatly appreciated
has title: How to find an Element by index in selenium webdriver for java
accepted answer: http://stackoverflow.com/a/27210107
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/36075184
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/27209287
has answer: http://stackoverflow.com/a/27210107
has answer: http://stackoverflow.com/a/27209287
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/55345192
tagged with: selenium
type: Question
upvote count: 4

http://stackoverflow.com/q/27212460
upvote count: 4
type: AnsweredQuestion
score: 3
has title: Dirty ways to create Threads in Java
tagged with: java
has comment: http://stackoverflow.com/comment/42905697
type: Question
has comment: http://stackoverflow.com/comment/42905721
has comment: http://stackoverflow.com/comment/42905899
has comment: http://stackoverflow.com/comment/42905657
linked to: http://stackoverflow.com/q/541487
has body: I have recently started digging into Multi-Threading in Java. While exploring things, I discovered there are 2 quick and dirty ways to create Threads "on the go" in Java. Here is the example: public static void main(String[] args) { System.out.println("Thread: " + Thread.currentThread().getName()); new Thread() { public void run() { System.out.println("Thread: " + Thread.currentThread().getName()); System.out.println("hello"); } }.start(); new Thread(new Runnable() { @Override public void run() { System.out.println("Thread: " + Thread.currentThread().getName()); System.out.println("hello"); } }).start(); } First one is the one which starts with new Thread() { Second one comes after that which starts with new Thread(new Runnable() { I just wanted to ask if both of the ways are correct? Any difference other than difference of Implementing Runnable Interface v/s Extending Thread class?
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27212480
accepted answer: http://stackoverflow.com/a/27212480
favorite count: 0
linked to: http://stackoverflow.com/q/49002
tagged with: multithreading

http://stackoverflow.com/q/27278428
has answer: http://stackoverflow.com/a/27292056
type: AnsweredQuestion
has body: we need to get the last post message group by a transmitter. Query query = em.createQuery("SELECT m FROM Message m " + "JOIN m.transmitter " + "JOIN m.recipient " + "WHERE m.transmitter = :u1 " + "OR m.recipient = :u1 " + "GROUP BY m.recipient,m.transmitter " + "ORDER BY m.sendDate DESC"); query.setParameter("u1", actualUser); but we need something like this where we get the oldest message: Query query = em.createQuery("SELECT m FROM Message m " + "JOIN m.transmitter " + "JOIN m.recipient " + "WHERE m.transmitter = :u1 " + "OR m.recipient = :u1 " + "ORDER BY m.sendDate DESC" "GROUP BY m.recipient,m.transmitter "); query.setParameter("u1", actualUser); Thanks for help sorry for my English.
tagged with: java
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/27319811
tagged with: persistence
tagged with: jpql
score: 0
answer count: 2
has title: JAVA Persistance OrderBy before a GroupBy
possible better answer: http://stackoverflow.com/a/27292056
has answer: http://stackoverflow.com/a/27319811

http://stackoverflow.com/comment/43007687
type: AnswerComment
type: Comment
has text: @supercat, I can't say I have a clear intuition about this myself, but I suspect that what you're suggesting would work, as long as you access the object through the objects final field. (There has to be a *dereferences* step for the guarantee to hold.)
comment on: http://stackoverflow.com/a/27260075
score: 0

http://stackoverflow.com/comment/42998245
comment on: http://stackoverflow.com/q/27262867
type: Comment
has text: There are many cases where you are not using the modulus. There is not enough here to fully diagnose your problem. What line is the exception being thrown on?
type: QuestionComment
score: 2

http://stackoverflow.com/q/27290158
favorite count: 0
tagged with: fxml
tagged with: fxmlloader
upvote count: 1
accepted answer: http://stackoverflow.com/a/27305702
has title: Busy popup in JavaFX when FXML parsing is too slow
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/27305702
tagged with: javafx-8
downvote count: 0
answer count: 1
has body: FXML performance is an issue with JavaFX, if you have complex screens and have divided them into small components (for maintainability / reuse) that use FXML, then it can get really slow. As FXML parsing is made in UI Thread (not sure of this, still it blocks the JavaFX Application Thread), you cannot show a glasspane / popup / etc in JavaFX when FXML is being processed. The only workaround I found is to use a Swing popup (as it is in Swing UI Thread, you can still show something) to provide a feedback to the user (it is working / not a bug / wait a little more) when FXML is being loaded and to close it when no more FXML files are parsed. I have built a facade above FXMLLoader to do so. Also this also works with OpenGL libraries as well (LWJGL for instance, instead of Swing, anything that is UI and is not in JavaFX Application Thread works). I was wondering if a better solution exists (JavaFX only, not mixing UI frameworks) as this artificially adds complexity to the project and won't be ported well with OpenJFX ports.

http://stackoverflow.com/a/27276585
answers question: http://stackoverflow.com/q/27276423
has comment: http://stackoverflow.com/comment/43022164
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43022263
type: Answer
accepted answer of: http://stackoverflow.com/q/27276423
score: 1
has body: have you tried using concurrency for this? its an apt problem for concurrent processing. Assuming that file processing is a mutually exclusive action: the do while loop in main Thread finds the file to read process file is delegated to an executor thread for processing and after processing (I am assuming reading the file) the processing of the contents can again be done in parallel. Its like read first 1000 lines and delegate to a thread to process. You need to design it in a better way to run fast. A single threaded read and process list of files is bound to run slow.
upvote count: 1

http://stackoverflow.com/comment/42963758
type: QuestionComment
has text: Whoa. I didn't know.
score: 0
comment on: http://stackoverflow.com/q/27216384
type: Comment

http://stackoverflow.com/comment/42866955
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27190281
has text: Aside: You have a lot going on in the constructor of your table model. I would do all that stuff outside, ad just pass the model's constructor some data structure
score: 0

http://stackoverflow.com/comment/42872244
has text: When do you think that `for` loop, in the middle of the class body, should be executed? Why do you think so?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27193390
score: 0

http://stackoverflow.com/q/27300502
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: android-layout
answer count: 1
downvote count: 1
tagged with: nullpointerexception
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/43064962
favorite count: 0
upvote count: 0
has body: I am creating an extremely simple Android application to serve as a proof of concept and a reference for an application I will create in the future. My goal is to create a ListView, each item containing a TextView and a Button that, when pressed, makes a Toast pop up displaying the content of the TextView. Here is my code and xml: main.xml: <?xml version="1.0" encoding="utf-8"?> <ListView android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/mainListView1"/> entry.XML: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/entryTextView1" android:padding="10dp" android:textSize="25sp"/> <ImageButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@android:drawable/ic_menu_close_clear_cancel" android:id="@+id/entryImageButton" /> MainActivity.Class public class MainActivity extends Activity{ /* Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set main.xml as user interface layout setContentView(R.layout.main); String[] companies = new String[] { "Test1", "Test2", "Test3", "Test4", "Test4", "Test6", "Test7", "Test8", "Test9", "Test10"}; ArrayList views = new ArrayList (); for(int x=0; x!= companies.length-1; x++){ LinearLayout layout = (LinearLayout) findViewById(R.id.entryLayout); TextView text = (TextView) layout.getChildAt(0); text.setText(companies[x]); ImageButton button = (ImageButton) layout.getChildAt(1); button.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ LinearLayout layout = (LinearLayout) v.getParent(); TextView view = (TextView) layout.getChildAt(0); Toast.makeText(MainActivity.this,view.getText(), Toast.LENGTH_SHORT).show(); } }); views.add(layout); } ListView listView = (ListView) findViewById(R.id.mainListView1); for(LinearLayout layout: views){ listView.addView(layou…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27300662
has title: NullPointerException getting a TextView
accepted answer: http://stackoverflow.com/a/27300662
score: -1

http://stackoverflow.com/a/27227877
has comment: http://stackoverflow.com/comment/69725193
downvote count: 0
answers question: http://stackoverflow.com/q/27227233
type: Answer
has body: The Problem is that the session scope is only available in Spring Contexts that run in a Web Context. -- But in a normal web application you have two Spring Contexts!! One that is started by contextConfigLocation classpath*:META-INF/spring/applicationContext*.xml org.springframework.web.context.ContextLoaderListener and a second that is started by: SpringProject-DispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/webmvc-config.xml 1 In the first context (loaded by the ContextLoaderListener) it does not run in a "WebContext", therefore do not have a session scope! Easyest solution When possible: Move that sesson scoped been to the web context (webmvc-config.xml in the example above) Maybe this helps a bit: ContextLoaderListener or not?
upvote count: 7
score: 7

http://stackoverflow.com/a/27270096
has comment: http://stackoverflow.com/comment/43010449
answers question: http://stackoverflow.com/q/27268795
score: 1
upvote count: 1
has body: Stick with whatever Eclipse produces, or 0. If testing or profiling shows that changing the hash code for null would improve performance, go for it. Change it to any arbritrary constant.
downvote count: 0
has comment: http://stackoverflow.com/comment/43010685
type: Answer

http://stackoverflow.com/q/27240312
type: Question
has body: have no experience in Java.Get this error in "R." everywhere in Main_activity.java, when make a new Android project in Eclipse setContentView(R.layout.activity_main); if (id == R.id.action_settings) Help appreciated.Thanks
has answer: http://stackoverflow.com/a/27240440
score: -1
linked to: http://stackoverflow.com/q/4932282
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/27240482
has comment: http://stackoverflow.com/comment/42957146
favorite count: 0
has comment: http://stackoverflow.com/comment/42957128
type: UnansweredQuestion
tagged with: java
has title: Newbie- Errors in main_activity.java in Eclipse
downvote count: 1

http://stackoverflow.com/q/27257927
has comment: http://stackoverflow.com/comment/42989912
type: AnsweredQuestion
has body: I'm little confused about closing connection by jdbc. package Login; public class LoginFrame { private JFrame loginFrame; Connection conn = null; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LoginFrame window = new LoginFrame(); window.loginFrame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public LoginFrame() { initialize(); conn = DBConnect.connectDB(); } /** * Initialize the contents of the frame. */ private void initialize() { loginFrame = new JFrame(); loginFrame.setResizable(false); loginFrame.setTitle("XXX"); loginFrame.setBounds(100, 100, 350, 300); loginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loginFrame.getContentPane().setLayout(null); panel = new JPanel(); panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Login", TitledBorder.LEADING, TitledBorder.TOP, null, SystemColor.inactiveCaptionText)); panel.setBounds(96, 140, 139, 99); loginFrame.getContentPane().add(panel); panel.setLayout(null); loginField = new JTextField(); loginField.setBounds(47, 16, 86, 20); panel.add(loginField); loginField.setColumns(10); passwordField = new JPasswordField(); passwordField.setBounds(47, 37, 86, 20); panel.add(passwordField); JButton loginButton = new JButton("Login"); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String sql = "select * from employees where login=? and password=?"; try{ PreparedStatement pst = conn.prepareStatement(sql); pst.setString(1, loginField.getText()); pst.setString(2, passwordField.getText()); ResultSet rs = pst.executeQuery(); int countUsr = 0; while(rs.next()){ countUsr++; } if(countUsr == 1){ loginFrame.dispose(); AdminFrame adminFrame = new AdminFrame(); adminFrame.setVisible(true); }else if(countUsr &gt; 1){ JOptionPane.showMessageDialog(null, "ERR"); }else{ JOptionPane.showMessageDialog(null, …
has comment: http://stackoverflow.com/comment/42989633
has answer: http://stackoverflow.com/a/27259075
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/42989873
type: Question
has comment: http://stackoverflow.com/comment/42989823
has answer: http://stackoverflow.com/a/27258257
linked to: http://stackoverflow.com/q/4872830
has comment: http://stackoverflow.com/comment/42989564
has answer: http://stackoverflow.com/a/27258036
has comment: http://stackoverflow.com/comment/42989723
answer count: 6
has comment: http://stackoverflow.com/comment/42989721
has answer: http://stackoverflow.com/a/27258092
accepted answer: http://stackoverflow.com/a/27258092
score: 0
has comment: http://stackoverflow.com/comment/42989693
has answer: http://stackoverflow.com/a/27258613
possible better answer: http://stackoverflow.com/a/27259075
has title: Closing Database Connections in Java Swing
has answer: http://stackoverflow.com/a/27258279
tagged with: jdbc

dialog
tag name: dialog
type: Tag
tags question: http://stackoverflow.com/q/27270993
tags question: http://stackoverflow.com/q/27215433
tags question: http://stackoverflow.com/q/27214036
tags question: http://stackoverflow.com/q/27263563
tags question: http://stackoverflow.com/q/27212825

http://stackoverflow.com/a/27280268
upvote count: 3
has body: You have Zmanim Project http://www.kosherjava.com/zmanim-project/ And here it is an example of use. http://www.kosherjava.com/tag/jewish-calendar/
answers question: http://stackoverflow.com/q/27278667
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27278667
type: Answer
score: 3

http://stackoverflow.com/comment/43075905
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27305390
has text: readUTF can not be resolved by lua program, that will connect to server too

string
tags question: http://stackoverflow.com/q/27260565
tags question: http://stackoverflow.com/q/27241039
tags question: http://stackoverflow.com/q/27254000
tags question: http://stackoverflow.com/q/27230151
tags question: http://stackoverflow.com/q/27188574
tags question: http://stackoverflow.com/q/27211420
tags question: http://stackoverflow.com/q/27305114
tags question: http://stackoverflow.com/q/27165044
tags question: http://stackoverflow.com/q/27255454
tags question: http://stackoverflow.com/q/27241185
tags question: http://stackoverflow.com/q/27309817
tags question: http://stackoverflow.com/q/27210280
tags question: http://stackoverflow.com/q/27297370
tags question: http://stackoverflow.com/q/27272542
tags question: http://stackoverflow.com/q/27231579
tags question: http://stackoverflow.com/q/27242160
tags question: http://stackoverflow.com/q/27307567
tags question: http://stackoverflow.com/q/27166892
tags question: http://stackoverflow.com/q/27289694
tags question: http://stackoverflow.com/q/27253864
tags question: http://stackoverflow.com/q/27191132
tags question: http://stackoverflow.com/q/27236082
tags question: http://stackoverflow.com/q/27286030
tags question: http://stackoverflow.com/q/27303252
tags question: http://stackoverflow.com/q/27265012
tags question: http://stackoverflow.com/q/27201395
tags question: http://stackoverflow.com/q/27309750
tags question: http://stackoverflow.com/q/27160038
tags question: http://stackoverflow.com/q/27221292
tags question: http://stackoverflow.com/q/27257862
tags question: http://stackoverflow.com/q/27303960
tags question: http://stackoverflow.com/q/27204532
tags question: http://stackoverflow.com/q/27223868
tags question: http://stackoverflow.com/q/27159119
tags question: http://stackoverflow.com/q/27172580
tags question: http://stackoverflow.com/q/27308362
tags question: http://stackoverflow.com/q/27161439
tags question: http://stackoverflow.com/q/27294243
tags question: http://stackoverflow.com/q/27246542
tags question: http://stackoverflow.com/q/27313730
tags question: http://stackoverflow.com/q/27242049
tag name: string
tags question: http://stackoverflow.com/q/27222992
tags question: http://stackoverflow.com/q/27251346
tags question: http://stackoverflow.com/q/27257847
tags question: http://stackoverflow.com/q/27217815
tags question: http://stackoverflow.com/q/27309937
tags question: http://stackoverflow.com/q/27214995
tags question: http://stackoverflow.com/q/27235703
tags question: http://stackoverflow.com/q/27174676
type: Tag
tags question: http://stackoverflow.com/q/27259893
tags question: http://stackoverflow.com/q/27247976
tags question: http://stackoverflow.com/q/27156885
tags question: http://stackoverflow.com/q/27237325
tags question: http://stackoverflow.com/q/27263301
tags question: http://stackoverflow.com/q/27262453
tags question: http://stackoverflow.com/q/27271099
tags question: http://stackoverflow.com/q/27195039
tags question: http://stackoverflow.com/q/27177772
tags question: http://stackoverflow.com/q/27218832
tags question: http://stackoverflow.com/q/27197277
tags question: http://stackoverflow.com/q/27193614
tags question: http://stackoverflow.com/q/27205544
tags question: http://stackoverflow.com/q/27207132
tags question: http://stackoverflow.com/q/27197831
tags question: http://stackoverflow.com/q/27181744
tags question: http://stackoverflow.com/q/27307716
tags question: http://stackoverflow.com/q/27213135
tags question: http://stackoverflow.com/q/27253932
tags question: http://stackoverflow.com/q/27193766
tags question: http://stackoverflow.com/q/27310547
tags question: http://stackoverflow.com/q/27283455
tags question: http://stackoverflow.com/q/27188446
tags question: http://stackoverflow.com/q/27183146
tags question: http://stackoverflow.com/q/27214783
tags question: http://stackoverflow.com/q/27219812
tags question: http://stackoverflow.com/q/27196376
tags question: http://stackoverflow.com/q/27294864
tags question: http://stackoverflow.com/q/27237945

http://stackoverflow.com/comment/42947186
has text: @ShirgillAnsari how is this related to programming, then? Or should it be a superuser issue instead?
comment on: http://stackoverflow.com/q/27234426
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42966467
comment on: http://stackoverflow.com/q/27245668
score: 0
has text: Welcome to SO. Please format your question and your code properly.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42851363
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27181384
has text: @Glenn I agree - I think that the tutorial took simplification of the material a little too far. To their defense, use cases for situations when static class should access private instance variables of their enclosing class are hard to explain in the context of a tutorial that introduces its readers to the concept of nested classes.

http://stackoverflow.com/comment/43075532
has text: @Bass you need to set `PATH` variable for windows environment... so that system knows where to find `ant`
comment on: http://stackoverflow.com/q/27286846
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42920522
comment on: http://stackoverflow.com/q/27220369
score: 0
type: Comment
type: QuestionComment
has text: I can't post a comment this long, I'll submit some pseudo code as an answer

http://stackoverflow.com/q/27234399
tagged with: oop
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27234491
has answer: http://stackoverflow.com/a/27234458
type: Question
has body: I am new to Java and OOPs and here is my issue. When I run the below code, I get the Exception in thread "main" java.lang.StackOverflowError. The problem is in the code were I create an object of JavaApplication1.The problem is not occurring for class App2. The code works fine if the object ja is created inside the run method. Can you explain me why? package javaapplication1; public class JavaApplication1 { int i, k, j; class App2 { int i = 23; int j = 12; } App2 a2 = new App2(); JavaApplication1 ja = new JavaApplication1(); public void run() { ja.i = 10; a2.i = 26; a2.j = 18; System.out.println(i + "," + j + "'" + ja.i + "'" + a2.i + "'" + a2.j + "'" + k); } public static void main(String[] args) { int k = 24; JavaApplication1 ja1 = new JavaApplication1(); ja1.run(); ja1.i = 18; System.out.println(ja1.i + "'" + "'" + k); } }
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/27234471
accepted answer: http://stackoverflow.com/a/27234471
upvote count: 1
possible better answer: http://stackoverflow.com/a/27234458
answer count: 4
has title: Getting exception in thread "main" java.lang.StackOverflowError
favorite count: 0
has comment: http://stackoverflow.com/comment/42945468
downvote count: 0
has answer: http://stackoverflow.com/a/27234497
type: AnsweredQuestion

http://stackoverflow.com/comment/42913452
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27216829
score: 3
has text: You have many mistakes in code. For example `Point3D location = new Point3D();`. But you haven't constructor with empty arguments, like `public Point3D () {} ` Other `return getDistance = ((5 - int x); (7 - int y); (9-int z));`

http://stackoverflow.com/a/27174461
upvote count: 1
has body: It's not necessary to do any math on the BigDecimal; you can just call myBigDecimal.unscaledValue() to get the underlying unscaled BigInteger directly.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27171901
type: Answer

http://stackoverflow.com/q/27286935
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27297965
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27297965
has body: I am trying to add the class object of a children class to a set of parent class object : public class Main { public static void main(String[] args) { Set&lt;Class&lt;? extends A&lt;?&gt;&gt;&gt; set = new HashSet&lt;&gt;(); set.add(C.class); //this does not work } public abstract class A&lt;T&gt; { } public abstract class B&lt;T, V&gt; extends A&lt;T&gt; { } // Set&lt;T&gt; could be any other class, it is for demonstration purpose. public class C&lt;T&gt; extends B&lt;Set&lt;T&gt;, Set&lt;T&gt;&gt; { } } I get the following error : The method add(Class&lt;? extends Main.A&lt;?&gt;&gt;) in the type Set&lt;Class&lt;? extends Main.A&lt;?&gt;&gt;&gt; is not applicable for the arguments (Class&lt;Main.C&gt;) If I remove the '?' from the A, the code compiles, but I don't understand why. Can someone explain me why the "add" is not working ?
tagged with: type-erasure
has title: Can't add children.class to set of parent.class
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/27225596
has title: How to make JFreeChart to keep aspect ratio?
has comment: http://stackoverflow.com/comment/42935059
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42934333
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42938513
tagged with: jfreechart
type: Question
linked to: http://stackoverflow.com/q/14587999
tagged with: aspect-ratio
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/51280667
has body: Is it possible to keep some aspect ratio of units? For example, is it possible to make them square? In the following example a rectangle draw. Unfortunately, it is possible to make it square by resizing window. Is it possible to tell JFreeChart to keep ratio while resizing? package tests.org.jfree.chart; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.data.xy.DefaultXYDataset; public class Runner_JFreeChart_01 { public static class MyChartPanel extends ChartPanel { private static final long serialVersionUID = 8474384653351996554L; DefaultXYDataset dataset = new DefaultXYDataset(); { dataset.addSeries("key", new double[][]{{10, 300, 300, 10, 10},{10, 10, 50, 50, 10}}); } JFreeChart chart = ChartFactory.createXYLineChart("", "", "", dataset); public MyChartPanel() { super(null); setChart(chart); } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame("Runner_JFreeChart_01"); frame.add(new MyChartPanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } result:
favorite count: 0

http://stackoverflow.com/q/27309066
tagged with: sql
tagged with: android
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/27309190
answer count: 4
has answer: http://stackoverflow.com/a/27309341
has comment: http://stackoverflow.com/comment/43079937
has answer: http://stackoverflow.com/a/27309190
has title: Android SQLite issue - table __ has no column named ___
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am a new developer and I am having an SQLite issue. Some reason I am not able to add two columns (table_row_three, and table_row_four) to my SQLite data table. When I read the database file currently, it has a table with "id", "table_row_one", and "table_row_two", but is missing "table_row_three" and "table_row_four". The error message in my logcat reads: "(1) table database_table has no column named table_row_three". I am really confused to why the columns "table_row_three" and "table_row_four" are not showing up on my table, and why only "id", "table_row_one", and "table_row_two" appear in my data table. Here is my Database class: DatabaseHandler.java import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DatabaseHandler { Context context; private SQLiteDatabase db; private final String DB_NAME = "database_name"; private final int DB_VERSION = 2; private final String TABLE_NAME = "database_table"; private final String TABLE_ROW_ID = "id"; private final String TABLE_ROW_ONE = "table_row_one"; private final String TABLE_ROW_TWO = "table_row_two"; private final String TABLE_ROW_THREE = "table_row_three"; private final String TABLE_ROW_FOUR = "table_row_four"; public DatabaseHandler(Context context) { this.context = context; // create or open the database CustomSQLiteOpenHelper helper = new CustomSQLiteOpenHelper(context); this.db = helper.getWritableDatabase(); } public void addRow(String rowStringOne, String rowStringTwo, String rowStringThree, String rowStringFour) { // this is a key value pair holder used by android's SQLite functions ContentValues values = new ContentValues(); //TABLE_ROW_ONE = Title //TABLE_ROW_TWO = Location //TABLE_ROW_THREE = Notes //TABLE_ROW_FOUR = Picture values.put(TABLE_ROW_ONE, rowStringOne);…
has answer: http://stackoverflow.com/a/27309117
type: Question
possible better answer: http://stackoverflow.com/a/27309341
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27309201

http://stackoverflow.com/a/27300530
answers question: http://stackoverflow.com/q/27299033
type: AcceptedAnswer
score: 0
type: Answer
has body: TextField inherits both the getText() and setText() methods from TextInputControl. You could try something like: textFieldToSet.setText(textFieldContainingString.getText()); In this case, you would be setting the text of textFieldToSet to whatever String is currently contained within textFieldContainingString.
accepted answer of: http://stackoverflow.com/q/27299033

http://stackoverflow.com/comment/42850946
type: AnswerComment
has text: Then you have to use `Arrays.sort (lista);` instead of: `Arrays.sort (lista, Collections.reverseOrder ());`
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27179068

http://stackoverflow.com/q/27306734
downvote count: 5
type: UnansweredQuestion
has body: I have two problems with this code. I need to display _ _ _ _ _ for the word "boats" as the user guesses letters. The underspaces need to be replaced with the guessed letters as the user inputs them. Also I have a counter to keep track of the good guesses, which should end the game after 5 guesses, but that doesn't happen when I run the code. Any suggestions on either problem? private static String [] word = {"b","o", "a","t","s"}; // array to hold the secret word private static boolean finished = false; // boolean flag to control the main loop private static int badGuesses = 0; // int variable to hold the number of incorrect guesses private static ArrayList&lt;String&gt; guessedLetters = new ArrayList&lt;String&gt;(); // String array to mark which letters have been guessed private static String entryWord = " "; // string variable for the user's guesses private static int goodGuesses = 0; // int variable to hold the number of correct guesses private static String guess; public static void main (String[] args) { playGame (); } public static void playGame () { displayRules(); // print the instructions to the user while (!finished) { String guess = getGuess(); // allow user to input a guess checkGuess(word, guess); // identify user's guess as correct or incorrect showWord (); // print the underscores representing the word showMan(); // print the appropriate hanging man } while (goodGuesses == 5) winGame(); } public static void displayRules() // display the rules to the user { String userName; Scanner keyboard = new Scanner (System.in); System.out.println ("Please enter your name."); userName = keyboard.next(); System.out.println ("Hello " + userName + "!"); System.out.println ("Welcome to Dan's Hangman game!"); System.out.println ("The objective of the game is to guess all of the letters of the secret word"); System.out.println ("The user will guess a letter and if it is correct, the user has won that round."); System.out.println ("If the user guesses an incorrect lett…
has comment: http://stackoverflow.com/comment/43076108
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/43075927
tagged with: java
has title: Hangman java coding
type: Question
has answer: http://stackoverflow.com/a/27307067
has comment: http://stackoverflow.com/comment/43075956
has comment: http://stackoverflow.com/comment/43075869
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27241097
answer count: 3
upvote count: 1
has title: Taking integers as input from console and storing them in an array
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27241171
downvote count: 0
score: 1
tagged with: java
has body: When I am trying to write the following code, the computer takes several inputs. But what I want is it should take only one line as an input and save all the integers in that line in an array. Can you help me with this please? import java.util.*; class InputInteger{ public static void main(String args[]){ Scanner input=new Scanner(System.in); int[] array=new int[20]; int i=0; while(input.hasNext()){ array[i]=input.nextInt(); i++; } input.close(); } }
has answer: http://stackoverflow.com/a/27241223
has answer: http://stackoverflow.com/a/27241147
type: Question
tagged with: arrays

http://stackoverflow.com/comment/42852693
type: Comment
comment on: http://stackoverflow.com/a/27182292
has text: @Makoto Sure, but what's the benefit (of `<? super CursorContainer>` over `<CursorContainer>`)? I'm assuming the OP wants to read it later...
score: 0
type: AnswerComment

http://stackoverflow.com/q/27291806
has comment: http://stackoverflow.com/comment/43067463
tagged with: java
has comment: http://stackoverflow.com/comment/43447084
accepted answer: http://stackoverflow.com/a/27299999
score: 5
answer count: 1
has answer: http://stackoverflow.com/a/27299999
favorite count: 0
tagged with: jooq
upvote count: 5
has comment: http://stackoverflow.com/comment/43081817
has comment: http://stackoverflow.com/comment/43072304
type: AnsweredQuestion
downvote count: 0
has body: I'd like to get JOOQ to render column names with quotes. This is what I tried, reading the docs and StackOverflow: DSLContext sql = DSL.using( SQLDialect.SQL99, new Settings() .withRenderNameStyle(RenderNameStyle.QUOTED) .withRenderFormatted(true) .withRenderKeywordStyle(RenderKeywordStyle.UPPER) ); System.out.println( "Quoted: " + (sql.settings().getRenderNameStyle()==RenderNameStyle.QUOTED) ); Table&lt;Record&gt; table = table("MyTable"); Field&lt;Long&gt; lid = field("id",Long.class); String sqlStr = sql.renderInlined( sql.select( lid, field("type"), field("request.id"), field("UPPERCASE"), field("lowercase") ) .from(table) .limit(1000) ); System.out.println(sqlStr); The generated statement is: SELECT id, type, request.id, UPPERCASE, lowercase FROM MyTable LIMIT 1000 It outputs Quoted: true, so the flag seems to be set. While renderFormatted and renderKeywordStyle seem to be respected, `renderNameStyle`` appears to be ignored. I'm experimenting with an unsupported database, therefore the SQL99. Side question: Why is SQL99 deprecated in JOOQ?
has title: Cannot set quote stye in JOOQ (RenderNameStyle.QUOTED)
type: Question

http://stackoverflow.com/a/27237907
upvote count: 3
has body: Ok... I spent some time in checking the performance of mouse-drags with many objects.... I did it on a Mac Pro (4 core, 8GB RAM). A mouse drag using setTranslateX() and setTranslateY() in the setOnMouseDragged() handler is called at an interval of 17ms (60Hz). If I add small circles to the drag-group, the drag keeps its pace up to 25.000 circle dragged along. At 100.000 circles the drag interval is about 50ms (and shows some stops during drag) At 1.000.000 circles the drag interval is about 500ms If I implement the drag as image drag using the snapshot() function, the snapshot of 1.000.000 circles takes 600ms. Then the drag is smooth and fast. Here the full code with and without using an image during drag: public class DragMany extends Application { Point2D lastXY = null; Scene myScene; long lastDrag; ImageView dragImage; void fill(Group box) { Color colors[] = new Color[]{Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW, Color.PINK, Color.MAGENTA }; for (int i = 0; i &lt; 100000; i++) { Circle c = new Circle(2); box.getChildren().add(c); c.setFill(colors[(i/17) % colors.length]); c.setLayoutX(i % 30 * 3); c.setLayoutY((i/20) % 30*3); } box.setLayoutX(40); box.setLayoutY(40); } void drag1(Pane pane, Group box) { box.setOnMousePressed(event -&gt; { lastXY = new Point2D(event.getSceneX(), event.getSceneY()); lastDrag = System.currentTimeMillis(); }); box.setOnMouseDragged(event -&gt; { event.setDragDetect(false); Node on = box; double dx = event.getSceneX() - lastXY.getX(); double dy = event.getSceneY() - lastXY.getY(); on.setLayoutX(on.getLayoutX()+dx); on.setLayoutY(on.getLayoutY()+dy); lastXY = new Point2D(event.getSceneX(), event.getSceneY()); event.consume(); }); box.setOnMouseReleased(d -&gt; lastXY = null); } void drag3(Pane pane, Group box) { box.setOnMousePressed(event -&gt; { long now = System.currentTimeMillis(); lastXY = new Point2D(event.getSceneX(), event.getSceneY()); SnapshotParameters params = new SnapshotParameters(); params.setFill(Color.TRANSPARENT…
score: 3
has comment: http://stackoverflow.com/comment/42991812
has comment: http://stackoverflow.com/comment/42962709
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42969831
has comment: http://stackoverflow.com/comment/42962678
accepted answer of: http://stackoverflow.com/q/27210819
type: Answer
answers question: http://stackoverflow.com/q/27210819
has comment: http://stackoverflow.com/comment/42962957

http://stackoverflow.com/q/27219639
type: AnsweredQuestion
has body: I have a JPanel (imagePanel) that shows an image on it. I have imagePanel inside another JPanel (scrollPanel) with GridBagLayout default constraints to center it. scrollPanel is the viewport for a JScrollPane. I need to change the size of the imagePanel after the fact and still keep it centered. (The image class is one I made myself) public class ImageView extends View { private static final long serialVersionUID = -1745026846891845769L; private JScrollPane scrollPane; private JPanel scrollPanel; public JPanel imagePanel; public int zoom = 1; public Image image; public ImageView(Image image) { setLayout(new BorderLayout()); setDoubleBuffered(true); this.image = image; imagePanel = new JPanel() { private static final long serialVersionUID = 2127374649591395224L; @Override public void paint(Graphics g) { super.paint(g); ImageView.this.image.paintImage(g, 0, 0, zoom); } }; imagePanel.setDoubleBuffered(true); scrollPanel = new JPanel(new GridBagLayout()); scrollPanel.add(imagePanel); scrollPane = new JScrollPane(scrollPanel); add(scrollPane, BorderLayout.CENTER); } public void zoom(int zoom) { if(zoom &lt; 1) this.zoom = 1; else this.zoom = zoom; int imageWidth = image.WIDTH * this.zoom; int imageHeight = image.HEIGHT * this.zoom; imagePanel.setPreferredSize(new Dimension(imageWidth, imageHeight)); //What do I do here??? } EDIT: Here is my updated code for anyone else with the same question public class ImageView extends View { private static final long serialVersionUID = -1745026846891845769L; public class ImagePanel extends JPanel { private static final long serialVersionUID = 2127374649591395224L; public int zoom = 1; public void setZoom(int zoom) { if(zoom &lt; 1) this.zoom = 1; else this.zoom = zoom; } @Override public Dimension getPreferredSize() { int imageWidth = ImageView.this.image.WIDTH * this.zoom; int imageHeight = ImageView.this.image.HEIGHT * this.zoom; return new Dimension(imageWidth, imageHeight); } @Override public void paintComponent(Graphics g) { sup…
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27219750
type: Question
tagged with: gridbaglayout
linked to: http://stackoverflow.com/q/7229226
answer count: 2
tagged with: layout-manager
tagged with: resize
has comment: http://stackoverflow.com/comment/42918730
has answer: http://stackoverflow.com/a/27219750
has answer: http://stackoverflow.com/a/27219699
has title: setPreferredSize changed after the fact but GridBagLayout not updating
tagged with: swing
possible better answer: http://stackoverflow.com/a/27219699

http://stackoverflow.com/comment/42867527
type: Comment
type: QuestionComment
score: 2
has text: Also I don't see anything in your model implementation that would cause you not to use `DefaultTableModel`, besides the file reading stuff, which I already proposed to take out of the model.
comment on: http://stackoverflow.com/q/27190281

http://stackoverflow.com/a/27219323
answers question: http://stackoverflow.com/q/27218888
score: 1
accepted answer of: http://stackoverflow.com/q/27218888
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Your queue does not behave like a stack. It behaves like a buggy queue. public static void main(String[] args) { Queue q = new Queue(); q.enqueue(7); q.enqueue(8); q.enqueue(9); System.out.println(q.dequeue()); // 7 (ok) System.out.println(q.dequeue()); // 8 (ok) System.out.println(q.dequeue()); // 9 (ok) System.out.println(q.dequeue()); // 1 (bug) System.out.println(q.dequeue()); // 1 (bug) System.out.println(q.dequeue()); // 1 (bug) } Where is your code that made you conclude it was removing the 3 on the first call to dequeue?
downvote count: 0

http://stackoverflow.com/a/44810856
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/27305950
downvote count: 0
has body: Why don't you use an @Embedded object? When using an embedded object, you get the logical separation you desire in your code and keep your database compliant with Entity-Relational Normalization rules. It's weird to think on a One-to-One relationship, because even though JPA/Hibernate allows it, all data should be stored in the same table, making you model simpler, while also simplifying queries and increasing database performance by removing the need for a Join operation. When using Embedded objects you don't have to worry about mapping IDs and bizarre relations, since your ORM is capable of understanding that your just making a code separation, instead of demanding an actual relation of One-to-One between tables. class Vehicle { @Id @Column(name = "ID") private long vehicleId; @Column(name = "BRAND") private String brand; @Column(name = "MODEL") private String model; @Column(name = "DEV_YEAR") private int devYear; @Column(name = "REG_NUMBER") private int regNumber; @Embedded private TravelExtra extras; // Constructor, getters and setters... } . @Embeddable class TravelExtras { @Column(name = "ALLOW_SMOKE") private boolean allowSmoke; @Column(name = "ALLOW_FOOD") private boolean allowFood; @Column(name = "ALLOW_DRINKS") private boolean allowDrinks; @Column(name = "AIR_CONDITIONER") private boolean airConditioner; // Default Constructor, getters and setters... }

http://stackoverflow.com/comment/42847045
type: Comment
comment on: http://stackoverflow.com/q/27179037
type: QuestionComment
has text: What is your actual problem?
score: 1

http://stackoverflow.com/q/27202914
tagged with: jframe
has comment: http://stackoverflow.com/comment/42889009
tagged with: swing
has comment: http://stackoverflow.com/comment/42888648
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27203180
tagged with: java
has title: JFrame Console Scanner
type: Question
has comment: http://stackoverflow.com/comment/42888847
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42888819
possible better answer: http://stackoverflow.com/a/27203262
has answer: http://stackoverflow.com/a/27203262
has comment: http://stackoverflow.com/comment/42888986
has comment: http://stackoverflow.com/comment/42888995
has answer: http://stackoverflow.com/a/27203180
has body: I have this app that runs in eclipse's console and I want it to run in a jframe. By that I mean that I want it to ask for name, a and b on the JFrame window and then write something on a file. It works perfectly in the console but I don't know how to run it as a JFrame. I want it to look something like this(Image made in photoshop): https://i.sstatic.net/rQT8F.png And then automaticaly close Thanks in advance! some imports...(trying to save space) public class Test { public static void main(String[] args) throws FileNotFoundException,IOException { Scanner s = new Scanner(System.in); String fileName = new SimpleDateFormat("dd-MM-yyyy_HH-mm'.txt'").format(new Date()); String obs; String name; String path = "some path"; int a = 0, b = 0, c = 0, d = 0; System.out.println("input file name"); name = s.nextLine(); System.out.println("input a"); a = s.nextInt(); System.out.println("input b"); b = s.nextInt(); obs = s.nextLine(); if (a &gt;= 100) { d = a / 100; c = a % 100; b = c; a = a + d; } File file; if (StringUtils.isBlank(name)) { file = new File(path + fileName); } else { file = new File(path + name + "#" + fileName); } FileWriter writer = null; try { writer = new FileWriter(file); writer.write("something"); if (StringUtils.isBlank(obs)) { writer.write("something"); } else { writer.write(obs + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { if (writer != null) try { writer.close(); } catch (IOException ignore) { } } } }
tagged with: java.util.scanner

http://stackoverflow.com/q/27213150
type: Question
has title: jaxb and inheritance of an abstract class
has comment: http://stackoverflow.com/comment/42907089
score: 0
has comment: http://stackoverflow.com/comment/42908544
tagged with: http://stackoverflow.com/tag/xml
has body: i have the following hierarchy of Objects which i need to unmarshall from an XML: A: String id; List B: String id; List<C> C: String id; i need to unmarshall them using JAXB to an xml that will look something like this (the objects are wrapped in a general O object): <O> <C id="someId3"> <C id="someId5"/> <C id="someId6"/> </O> Ive trying to do this by creating an object of type "GeneralType": @XmlTransient public abstract GeneralType: protected String id protected List<? extends GeneralType> myList public O: List aList; getter to aList with (@xmlElement(name="A")) @XmlRootElement(name="A") public A extends GeneralType: getId with @XmlAttribute(name="id") getMyListwith @XmlAttribute(name="B") @XmlRootElement(name="B") public B extends GeneralType: getId with @XmlAttribute(name="id") getMyListwith @XmlAttribute(name="C") @XmlRootElement(name="C") public C extends GeneralType: getId with @XmlAttribute(name="id") Im getting an error: @XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.: A.getMyList O.getALit What am i doing wrong?
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: jaxb

http://stackoverflow.com/a/28767635
score: 0
answers question: http://stackoverflow.com/q/27301478
accepted answer of: http://stackoverflow.com/q/27301478
type: AcceptedAnswer
has body: I've worked out what was happening here in case anyone stumbles across this in future. It looks like every time there was a failure, and the override was called, it was called for every instance that existed. For example if the @Listeners tag existed in 3 classes, the output would be repeated three times. I resolved this by removed all @Listener tags that were present in Classes and added the following to my pom.xml nested within the SureFire plugin: listener utilities.TestOverride All custom output is now displayed only once.
type: Answer

http://stackoverflow.com/comment/42987726
score: 0
has text: Every ide has an organize imports feature, which should optimize your imports to include only what you are actually using. In eclipse the keyboard shortcut is ctrl+shift+O
type: QuestionComment
comment on: http://stackoverflow.com/q/27257030
type: Comment

http://stackoverflow.com/a/27180619
score: 0
answers question: http://stackoverflow.com/q/27180549
has body: If you want to initialise pSet with an initial value directly, you can simply do: private static Set&lt;Integer&gt; pSet = new HashSet&lt;Integer&gt;(Arrays.asList(2));
type: Answer

http://stackoverflow.com/comment/42910650
comment on: http://stackoverflow.com/q/27204166
has text: Assume that there is an equals and a hashCode in JAXBElement, and both consider all attributes of that class. Would you call this equals for a "deep comparison"? What if their QName namespaces differ, everything else being equal? Do you intend to compare XML documents or Java object hierarchies?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/111822643
comment on: http://stackoverflow.com/a/55261352
score: 1
type: AnswerComment
type: Comment
has text: It just kicks the can down the road.

http://stackoverflow.com/q/27153162
upvote count: 5
tagged with: java
type: Question
score: 5
has title: Implement A Spring Batch Progress Bar - Get total row count on Job Execution
has answer: http://stackoverflow.com/a/27565903
answer count: 1
downvote count: 0
tagged with: progress-bar
tagged with: spring-batch
tagged with: batch-processing
favorite count: 0
accepted answer: http://stackoverflow.com/a/27565903
has body: I have a batch job which reads from a database using HibernateCursorItemReader, processes the results using a custom processor then commits to another database. What I would like to show is how many items have been processed against total items to process. I have tried implementing a custom JobExecutionListener with @beforeJob to get the row count from the first table which can then be compared against the Job Execution commits periodically. Is there a better way than using a Job Execution Listener. is it possible to get the total row count for the table on the first read, setting a value on the HibernateCursorItemReader during initialization or something similar? Job <batch:job id="SomeLongJob" job-repository="jobRepository" restartable="true"> <batch:listeners> <batch:listener ref="batchJobExecutionListener" /> </batch:listeners> <batch:step id="first1"> </batch:step> </batch:job> Reader <property name="queryString" value="from MyTable" /> <property name="sessionFactory" ref="sessionFactory" />
tagged with: spring
has comment: http://stackoverflow.com/comment/42845138
type: AnsweredQuestion

http://stackoverflow.com/q/27219609
has answer: http://stackoverflow.com/a/27219671
accepted answer: http://stackoverflow.com/a/27219752
has title: how to change all words in a sentence on piglatin.java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42918416
upvote count: 0
has answer: http://stackoverflow.com/a/27219723
possible better answer: http://stackoverflow.com/a/27219671
favorite count: 0
type: Question
score: -1
has body: I'm writing program called piglatin. The program will keep running until user type quit. Any words start with a vowel, the end of the word must add "way". If the word start with a consonant, then I have to move the consonant to the end of the word and add word "ay". The only problem i have is how to make my program to be able to change all the words individually instead of based on the first word of a sentence. For example "he is nice" should become "ehay isway icenay" but my output is like this "e is nicehay". thank you so much for your help, i really appreciate it. here is my code import java.util.Scanner; public class PigLatin { public static void main(String[] args) { Scanner input = new Scanner( System.in ); String yourSentence=""; String[] tokens; do { System.out.print("Enter your words here: "); yourSentence = input.nextLine(); if( yourSentence.startsWith("a") || yourSentence.startsWith("e") || yourSentence.startsWith("i") || yourSentence.startsWith("o") || yourSentence.startsWith("u")) { System.out.print(yourSentence+ "way"); } else { System.out.print(yourSentence.substring(1)+yourSentence.substring(0,1)+"ay"); } } while(!yourSentence.equals("quit")); } }
has answer: http://stackoverflow.com/a/27219752
answer count: 3
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/42819332
type: Comment
type: QuestionComment
has text: sorry,just add. @sam
comment on: http://stackoverflow.com/q/27163160
score: 0

http://stackoverflow.com/comment/42900548
score: 0
comment on: http://stackoverflow.com/q/27209358
type: Comment
type: QuestionComment
has text: your context is probably null

http://stackoverflow.com/a/27161715
type: Answer
accepted answer of: http://stackoverflow.com/q/27160594
has comment: http://stackoverflow.com/comment/42832051
upvote count: 1
score: 1
has body: Make your TAG class static. Since it is an inner class, if you make it non-static, then the compiler adds a hidden reference to the outer Activity class. That is why you are getting a NoSuchMethodException. public static class TAG extends View { public TAG(Context context, AttributeSet attrs) { super(context, attrs); } } Also, when you reference this class in XML, you need to use "$TAG" not ".TAG" since it is an inner class. This is why you are getting the ClassNotFoundException. &lt;view class="com.stecape.pimp.Home$TAG" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:ems="10" android:id="@+id/editText1" android:layout_below="@+id/write" android:layout_alignParentLeft="true" TAG:structure="DB" TAG:DBnumber="1" TAG:datatype="BIT" TAG:address="0.1" /&gt;
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42841749
answers question: http://stackoverflow.com/q/27160594

http://stackoverflow.com/comment/42810116
has text: It looks like you are not the author of regex which can match `mm/dd/yyyy` but you found it somewhere and now you are asking others to create another one which can also match timestamp. You need to know that people tend to help more willingly if they see some prof that someone at least tried to solve problem on their own (asking others or searching for ready solutions doesn't count). So try to [edit] your question and include your attempts to write your own regex which you think should solve your problem and we will try to correct your mistakes.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27157909
type: QuestionComment

http://stackoverflow.com/q/27230651
answer count: 0
score: 0
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/42967157
has title: JavaFX fill 1 column with data of HashMap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42945559
has body: I'm trying to fill a TableView with data of a HashMap(just the value not the key). But somehow I don't really understand how to do it in JavaFX easily.. This is my table definition from the fxml. <TableColumn prefWidth="169.0" text="C1" /> In java: ... @FXML private TableView activeuserTable; ... ... Iterator it = users.entrySet().iterator(); while(it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); System.out.println(pairs.getKey() + " = " + pairs.getValue()); activeuserTable.getColumns().add(pairs.getValue()); // but yeah not really working it.remove(); } But yeah somehow it don't work :S I'm missing something which I can't see.. I'm working not so long with JavaFX and read much about filling a table but it was somehow complicated and I didn't really understand it. Hope you can help me! Greetz

http://stackoverflow.com/q/27167588
has body: I have a Jersey client up and running, using the Apache Client 4 library, like this: private Client createClient() { ApacheHttpClient4Config cc = new DefaultApacheHttpClient4Config(); // boring stuff here return ApacheHttpClient4.create(cc); } But this by default uses a BasicClientConnManager, which doesn't allow multi-threaded connections. The ApacheHttpClient4Config Javadoc says that I need to set the PROPERTY_CONNECTION_MANAGER to a ThreadSafeClientConnManager instance if I want multi-threaded operation. I can do this, and it works OK: private Client createClient() { ApacheHttpClient4Config cc = new DefaultApacheHttpClient4Config(); cc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER, new ThreadSafeClientConnManager()); // boring stuff here return ApacheHttpClient4.create(cc); } But ThreadSafeClientConnManager is deprecated. This is annoying. The more modern version is PoolingHttpClientConnectionManager. Unfortunately, though, the ApacheHttpClient4.create() method requires the connection manager to be an implementation of ClientConnectionManager (itself deprecated), and PoolingHttpClientConnectionManager doesn't implement that interface. So if I try to use it, my connection manager gets ignored and we're back to a BasicClientConnManager. How can I end up with a thread-safe client without using anything that's deprecated?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43519313
tagged with: apache-httpclient-4.x
type: Question
score: 0
tagged with: multithreading
tagged with: jersey-client
answer count: 1
has title: Multi-threaded connection manager with Jersey Apache Client 4
tagged with: java

http://stackoverflow.com/comment/43032735
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27282010
has text: ok i fixed the "SELECT * FROM csc3610_Connection.Employees"; part but it looks like its not connecting to my database because i put in a out.println("got connection") and thats not showing up so im thinking its not connecting to my database..do you have any idea y?

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/27311281
tags question: http://stackoverflow.com/q/27269839
type: Tag

http://stackoverflow.com/q/27289091
type: Question
has body: As soon as I create a Android project in Eclipse Indigo I instantly get a resource error on the line, setContentView(R.layout.main); To make it worse, projects that were working now are having their 'gen' folder emptied upon being built. Unfortunately using google gives me a million references to projects that need to have files renamed or rebuilt, so I thought I'd ask here. Errors Description Resource Path Location Type error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v11 line 352 Android AAPT Problem error The link provided by you didn't help me? please help me? appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable'
duplicate of: http://stackoverflow.com/q/26431676
answer count: 1
has comment: http://stackoverflow.com/comment/43044760
score: 0
tagged with: android
has title: the error in eclipse about that no resource found while making new project?
linked to: http://stackoverflow.com/q/26431676
has answer: http://stackoverflow.com/a/27289176
accepted answer: http://stackoverflow.com/a/27289176
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/43028125
comment on: http://stackoverflow.com/q/27279373
has text: @Ritwick Webhook class file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27215379
answers question: http://stackoverflow.com/q/27214558
has body: You may want to have a look at the StackPane: StackPane lays out its children in a back-to-front stack. The z-order of the children is defined by the order of the children list with the 0th child being the bottom and last child on top. [...]
score: 0
type: Answer

http://stackoverflow.com/q/27192265
has title: how to get the Fee Amount for paypal
has body: I am currently looking at a system that implements the PayPal api. As a part of this I need to get the feeAmt() which is the fee that is paid to paypal for processing the payment. From the documentation that I have looked at it appears that I have to implement the getExpressCheckoutDetailsReq() method in order to get the information that I want however no matter what I have tried I am struggling to do this. I should also let you know that I am currently developing my application using Java so using this is going to be best. If any more explanation is needed please don't hesitate to ask and I will do my best to amend the post :)
tagged with: java
tagged with: paypal
type: Question
tagged with: intellij-idea
score: 0
has answer: http://stackoverflow.com/a/27197480
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/42960157
has text: @Secondo thank you so much! something as simple as that... Im still new to programming so I really appreciate the help!
comment on: http://stackoverflow.com/a/27240882
type: AnswerComment
type: Comment
score: 0

lemmatization
type: Tag
tags question: http://stackoverflow.com/q/27169522
tag name: lemmatization

http://stackoverflow.com/comment/42964768
score: 0
has text: @TahirMalik When I download the document everything is right in MS Word but it doesn't in OpenOffice.
comment on: http://stackoverflow.com/q/27226413
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27173966
type: Question
has comment: http://stackoverflow.com/comment/42837765
has title: Java Closing an IOStream in finally giving error: Unhandled Exception: java.io.IOException
has body: Coming from C#, I would typically use this pattern when interacting with streams (note that I'm using Java classes here, but I'm referring to a pattern in C#): HttpURLConnection ServiceConnection; DataOutputStream ConnectionStream; try { ServiceConnection = (HttpURLConnection) ServiceUrl.openConnection(); ConnectionStream = new DataOutputStream(ServiceConnection.getOutputStream()); //... } finally { ConnectionStream.close(); ServiceConnection.Disconnect(); } From my understanding, for checked Exceptions like IOException, I need to include a catch block. Fair enough. So I changed my code as follows: HttpURLConnection ServiceConnection; DataOutputStream ConnectionStream; try { ServiceConnection = (HttpURLConnection) ServiceUrl.openConnection(); ConnectionStream = new DataOutputStream(ServiceConnection.getOutputStream()); //... } catch (MalformedURLException e1) { //... } catch (IOException e) { //... } finally { ConnectionStream.close(); ServiceConnection.Disconnect(); } However, this code gives me the following error: Unhandled Exception: java.io.IOException on the line that I attempt to close the stream in the finally block. What am I not understanding here? I thought that finally blocks were where you are supposed to put cleanup code and I thought that closing a stream here is the perfect candidate for that?
accepted answer: http://stackoverflow.com/a/27174212
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27174212
tagged with: exception
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42837732

http://stackoverflow.com/q/27278955
score: 0
has title: Joda dateTime parser is adding milliseconds unnecessarily
accepted answer: http://stackoverflow.com/a/27279058
has body: I have the time in milliseconds which I need to convert to 2009-01-31T06:34:45Z using Joda library. I have written the below program but the date parser is adding milliseconds by default. DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); DateTime dateTime = new DateTime(System.currentTimeMillis()); String str = fmt.print(dateTime); System.out.println("Date as string - " + str); dateTime = fmt.parseDateTime(str); System.out.println("Date as Joda dataTime - " + dateTime); Following is the output: Date as string - 2007-03-24T23:03:44Z Date as Joda dataTime - 2007-03-24T23:03:44.000+05:30 .000+05:30 is getting added to the dateTime object. The print method print the dateTime in correct format, but the parse method adds milliseconds and timezone unnecessarily. Please let me know the mistake in the program.
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/27279058
answer count: 1

http://stackoverflow.com/a/27314117
answers question: http://stackoverflow.com/q/27313076
has body: If someone asks for pseudo-code, that normally means, a fast sketched, outlined algorithm. Of course still carefully crafted. One considers what is really meant, and comes to a choice of steps and data structures. See here for how a fuzzy requirement can be refined and put in code. Pseudo-code normally looks a bit nicer than what you tried. So Be consistent with respect to style: if using capitals (or bold) for reserved words, then do it everywhere. Identifiers with spaces are okay, but (from my Algol68 experience) I would rather have them all small letters and no quotes. Function calls, separate parameters, are best read when the separation is clear, with parentheses and commas. So: PROGRAM Whatever: CONSTANT String foo = "12345151"; FIELD String today; METHOD date (): today := LIBRARY todays date(); expiry := today + 4 MONTHS; today := date format(today, expiry, "dd/MM/yy"). BEGIN date(); PRINT(today); bar := convert string to int(foo); PRINT(bar); END About "Convert String foo to int bar": that is a top-down refinement style, also possible. It declares the intention of a piece of code and with that nicely documents the code. whatever: String foo; ... convert string foo to integer bar; ... ... . convert string foo to integer bar: int bar = atoi(foo). Last but not least, about the content, the pseudo-algorithm itself. In your case you are in effect only calling date without parameters and result, and that does a read and as side-effect stores something calculated in a field today. A function without side-effect night be more useful. A better name certainly.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42910593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27215117
has text: @Accollativo Can you post your xml code?

http://stackoverflow.com/q/27218014
tagged with: timer
has answer: http://stackoverflow.com/a/27218501
type: AnsweredQuestion
has title: Trying to Poke my Android and Turn on the Screen Programmatically
tagged with: oop
tagged with: java
has body: I am building an alarm kind of application for Android. I set a certain timer to run and then fire after a certain time interval (after the user presses a button) which I call in the onCreate method. final int interval = 20000; // 20 Second Handler handler = new Handler(); Runnable runnable = new Runnable(){ public void run() { Toast.makeText(getApplicationContext(), "Timer to Wake",Toast.LENGTH_SHORT).show(); getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON|WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } }; handler.postAtTime(runnable, System.currentTimeMillis()+interval); handler.postDelayed(runnable, interval); I've also disabled the keyboard in the onCreate method with: getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); In the Android developer docs, it says: Window flag: when set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on. Now after I fire the timer with a press of the button, I immediately turn off the screen. After waiting 20 second though, the screen isn't poked and the device doesn't awaken. What could be the issue here? When I do turn on the screen though with the power button after waiting another 20 seconds, I do find that the keyboard is disabled. Also the screen is perpetually awake when I do leave the screen on. So I know the flags are working. I just need it to "wake" up when the timer fires!
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27219703
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27218501
has answer: http://stackoverflow.com/a/27219703
score: 0
tagged with: android

http://stackoverflow.com/q/27178728
has comment: http://stackoverflow.com/comment/42846347
has body: In my app I have implemented a Navigation Drawer that displays a list of bank accounts for a checkbook. I have written an AccountAdapter class that handles this list, and in my NavigationDrawerFragment class use the following generated code: mDrawerListView.setAdapter(mAccountAdapter); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l){ AccountAdapter adapter = (AccountAdapter) adapterView.getAdapter(); Cursor cursor = adapter.getCursor(); if(cursor != null &amp;&amp; cursor.moveToPosition(i)){ // Do nothing! } } }); However, I get an error on the first line of the onItemClick method: java.lang.ClassCastException: android.widget.HeaderViewListAdapter cannot be cast to com.example.android.checkit.AccountAdapter Is this the proper way to handle an itemClick event for this listview? How can I adjust the code to avoid this error?
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42846437
tagged with: listview
has comment: http://stackoverflow.com/comment/42846429
answer count: 1
tagged with: adapter
has comment: http://stackoverflow.com/comment/42846544
has answer: http://stackoverflow.com/a/27178872
has title: Unable to convert from AdapterView to custom adapter?
tagged with: android
tagged with: android-adapter
accepted answer: http://stackoverflow.com/a/27178872
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42846320

http://stackoverflow.com/q/27186054
has comment: http://stackoverflow.com/comment/42859363
tagged with: xpath
has comment: http://stackoverflow.com/comment/42925407
possible better answer: http://stackoverflow.com/a/27477807
has comment: http://stackoverflow.com/comment/43385139
linked to: http://stackoverflow.com/q/5046174
has comment: http://stackoverflow.com/comment/42888401
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: selenium
has title: Is there any way to get the XPath or CSS path of an element using Java?
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/2811001
type: Question
has answer: http://stackoverflow.com/a/27475369
tagged with: firefox
has comment: http://stackoverflow.com/comment/42926394
answer count: 2
has body: I am trying to get the XPath and CSS path of an element using Java. I have used jsoup to parse the HTML and I am getting the CSS path, but in some cases it is returning the wrong path. (I am matching it with Selenium generated paths.) I am using this code to generate CSS path my element is "s-Rectangle_44" And selenium is giving css path as css=#s-Rectangle_44 > div.clipping > div.content > div.valign while I am getting array Index out of bound exception.I need to get the XPath also. Is there any other method to get this? Can I use Firebug with Java? public static String getCssPath(Element el) { if (el == null) return ""; if (!el.id().isEmpty()) return "#" + el.id(); StringBuilder selector = new StringBuilder(el.tagName()); String classes = StringUtil.join(el.classNames(), "."); if (!classes.isEmpty()) selector.append('.').append(classes); if (el.parent() == null) return selector.toString(); selector.insert(0, " > "); if (el.parent().select(selector.toString()).size() > 1) { selector.append(String.format(":nth-child(%d)", el.elementSiblingIndex() + 1)); } return getCssPath(el.parent()) + selector.toString(); }
has comment: http://stackoverflow.com/comment/42888369
tagged with: firebug
has answer: http://stackoverflow.com/a/27477807
accepted answer: http://stackoverflow.com/a/27475369
favorite count: 0

http://stackoverflow.com/a/27154947
upvote count: 3
answers question: http://stackoverflow.com/q/27154874
has comment: http://stackoverflow.com/comment/42805825
downvote count: 0
has comment: http://stackoverflow.com/comment/42806386
has body: change it to for ( int entry = input.nextInt(); entry &gt;= 0; entry = input.nextInt()) because currently the loop is only running when the entered number is &lt; 0. So the loop has the semantic(meaning): run while the entries are &gt;= 0, read every time from the input to entry So the loop finishes, when a user enters a negative number.
type: Answer
score: 3

http://stackoverflow.com/comment/43060536
type: Comment
has text: If it helps, please help me in enhancing my reputation by ipvoting the answer and accepting it as an answer as well. Thanks.
comment on: http://stackoverflow.com/a/27161130
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43010203
comment on: http://stackoverflow.com/q/27267103
has text: I tried using ManagedBean of jsf even its not getting called
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42920436
type: Comment
comment on: http://stackoverflow.com/q/27220422
has text: @APerson Nevermind, I just saw where he mentioned it was a String. If his question were better formatted, and didn't include irrelevant info, I would have seen it more clearly
score: 0
type: QuestionComment

http://stackoverflow.com/q/27277692
score: 0
has comment: http://stackoverflow.com/comment/43025831
has comment: http://stackoverflow.com/comment/43024365
has comment: http://stackoverflow.com/comment/43024749
tagged with: android
has body: When i move from one activity to another activity, it closes before open... I got this error in my logcat 12-03 22:32:12.024: W/dalvikvm(885): JNI WARNING: jarray 0x4052e4a8 points to non-array object (Ljava/lang/String;) 12-03 22:32:12.035: I/dalvikvm(885): "WebViewCoreThread" prio=5 tid=11 NATIVE 12-03 22:32:12.035: I/dalvikvm(885): | group="main" sCount=0 dsCount=0 obj=0x4062c1e0 self=0x2c6580 12-03 22:32:12.035: I/dalvikvm(885): | sysTid=910 nice=0 sched=0/0 cgrp=default handle=2909880 12-03 22:32:12.045: I/dalvikvm(885): | schedstat=( 12594251910 11957404058 1074 ) 12-03 22:32:12.045: I/dalvikvm(885): at android.webkit.LoadListener.nativeFinished(Native Method) 12-03 22:32:12.045: I/dalvikvm(885): at android.webkit.LoadListener.nativeFinished(Native Method) 12-03 22:32:12.055: I/dalvikvm(885): at android.webkit.LoadListener.tearDown(LoadListener.java:1200) 12-03 22:32:12.055: I/dalvikvm(885): at android.webkit.LoadListener.handleEndData(LoadListener.java:721) 12-03 22:32:12.075: I/dalvikvm(885): at android.webkit.LoadListener.handleMessage(LoadListener.java:219) 12-03 22:32:12.075: I/dalvikvm(885): at android.os.Handler.dispatchMessage(Handler.java:99) 12-03 22:32:12.085: I/dalvikvm(885): at android.os.Looper.loop(Looper.java:123) 12-03 22:32:12.085: I/dalvikvm(885): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629) 12-03 22:32:12.119: I/dalvikvm(885): at java.lang.Thread.run(Thread.java:1019) 12-03 22:32:12.119: E/dalvikvm(885): VM aborting please someone help
has comment: http://stackoverflow.com/comment/43025135
has comment: http://stackoverflow.com/comment/43024253
has title: VM abortin error in android
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43025599
tagged with: java
has comment: http://stackoverflow.com/comment/43025019
has comment: http://stackoverflow.com/comment/43025948
type: Question

http://stackoverflow.com/a/47227850
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27189182
downvote count: 0
has body: None of the posted answers worked for me, however I have found a solution based on this post. ((JavascriptExecutor) driver).executeScript( "arguments[0].scrollTop=arguments[1].offsetTop", divWithScrollbarElement, elementToScrollTo); where divWithScrollbarElement is the div element which you are looking to scroll, and elementToScrollTo is the child element which you want to make viewable (which in my case was actually the parent of the element which I was initially trying to view). If elementToScrollTo is not actually in the DOM yet, you may need to use the script once to scroll down as far as possible, and then again once more elements have loaded.
type: Answer

http://stackoverflow.com/q/27313814
tagged with: maven
has title: SRVE9967W: The manifest class path xercesImpl.jar can not be found in jar file
tagged with: websphere-liberty
has body: I've been going in circles on this one. We're using WebSphere Liberty, Eclipse, and Maven. I'm getting several warnings like [WARNING ] SRVE9967W: The manifest class path xercesImpl.jar can not be found in jar file file:/C:/Users/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar or its parent. when I start up the server. For all the "class path something.jar"s, they are there in the Maven Dependencies folder in my project, and in my repo though they have a version number attached (e.g. xercesImpl-2.11.0.jar). It claims that the application is available, but if I try to go to the address, I get all kinds of nasty errors, mostly class not found. When I try to package my project through Maven, I'm getting [WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to all-external-repositories-mirror (http://mirror/m2-repo/content/groups/adc-standard-repositories): null to http://mirror/m2-repo/content/groups/adc-standard-repositories/org/apache/maven/plugins/maven-metadata.xml I'm about 70% sure this problem comes down to the fact that our project's Maven uses a mirror that I can't access from here, and I'm about 90% sure there is a work around to use my local repo, but I haven't been able to figure out where to look to make that change. I tried searching the entire workspace for any mention of xerces or xalan, but came up with nothing. I swear it was using my local repo before as long as I had the jars. I also find it strange that it compiles and lets me run tests without complaining about this. Any ideas, even just on where to look would be greatly appreciated. A good number of the things I found talking about a similar error mention WebSphere (and more specifically Liberty) so I'm also wondering if it has something to do with the way WebSphere deploys.
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27317587
tagged with: java
tagged with: eclipse
type: Question
upvote count: 2
tagged with: jar
answer count: 1
favorite count: 0
type: UnansweredQuestion

graph
tags question: http://stackoverflow.com/q/27262125
tag name: graph
tags question: http://stackoverflow.com/q/27212679
type: Tag
tags question: http://stackoverflow.com/q/27238524
tags question: http://stackoverflow.com/q/27218596
tags question: http://stackoverflow.com/q/27268869
tags question: http://stackoverflow.com/q/27229513

http://stackoverflow.com/comment/42919306
score: 0
type: AnswerComment
has text: Thanks! Now that you mention, makes a lot of sense.
type: Comment
comment on: http://stackoverflow.com/a/27220079

http://stackoverflow.com/a/32327070
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27278842
downvote count: 0
score: 1
has body: Static content doesn't change not because you need to restart, but because the running server actually serves files under the target directory. Changing the files in this directory only confuses things (so it's not really a solution), but change a few lines and wait a second to verify that the server now serves the modified file with no need to restart. As a solution, I prefer opening the dropwizard project as a maven project in eclipse and run the project with mvn exec:java on a terminal, using the exec-maven-plugin. Eclipse updates the target directory as files change, but it takes a few seconds, depending on the size of the project.

http://stackoverflow.com/comment/42996228
comment on: http://stackoverflow.com/q/27261646
score: 0
type: Comment
type: QuestionComment
has text: Yes, I am using Eclipse :)

http://stackoverflow.com/q/27164453
has comment: http://stackoverflow.com/comment/42821846
has title: Why does calling this method on the EDT cause a compilation error?
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42821651
upvote count: 1
linked to: http://stackoverflow.com/q/1124788
has comment: http://stackoverflow.com/comment/42821797
downvote count: 1
has comment: http://stackoverflow.com/comment/42821586
type: Question
has comment: http://stackoverflow.com/comment/42821945
has answer: http://stackoverflow.com/a/27380517
has comment: http://stackoverflow.com/comment/42821976
has comment: http://stackoverflow.com/comment/42822682
has answer: http://stackoverflow.com/a/27169256
has comment: http://stackoverflow.com/comment/42821625
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42821869
tagged with: user-interface
has comment: http://stackoverflow.com/comment/42821883
has comment: http://stackoverflow.com/comment/42822159
favorite count: 0
has comment: http://stackoverflow.com/comment/42823460
has comment: http://stackoverflow.com/comment/42823439
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/42821645
type: UnansweredQuestion
has body: I am trying to pop up a custom dialog box. When I try calling the method to do that on the EDT I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: at danind.com.gmail_coem.ui.CredentialEditor.promptPossibleDialog(CredentialEditor.java:29) at danind.com.gmail_coem.ui.HomeScreen$ConfigureDatabase.&lt;init&gt;(HomeScreen.java:281) at danind.com.gmail_coem.ui.HomeScreen.configureDatabase(HomeScreen.java:230) at danind.com.gmail_coem.ui.HomeScreen.lambda$1(HomeScreen.java:105) at danind.com.gmail_coem.ui.HomeScreen$$Lambda$7/2092062410.actionPerformed(Unknown Source) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at ja…
has comment: http://stackoverflow.com/comment/42822499

http://stackoverflow.com/comment/43080875
score: 1
comment on: http://stackoverflow.com/q/27309750
type: Comment
type: QuestionComment
has text: What is `decompress`?

http://stackoverflow.com/q/27241925
has title: Heap Priority Queue Implementation
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
upvote count: 1
has body: I am working on a code involving a Heap implementation and I seem to be getting a dereferenced error in my bubbleUp method, in my while loop line. This may be a rather basic question, but what's the best way to solve this? I've also had some trouble implementing the removeHigh method, which is meant to remove the highest element from the queue. public class HeapPriorityQueue implements PriorityQueue { protected final static int DEFAULT_SIZE = 10000; protected Comparable[] storage; protected int currentSize; public HeapPriorityQueue () { this.storage=new Comparable[DEFAULT_SIZE]; this.currentSize=0; } public HeapPriorityQueue(int size) { this.currentSize=size; this.storage=new Comparable[currentSize]; } public int size () { return currentSize; } public boolean isEmpty ( ) { if(currentSize==0) return true; else return false; } public boolean isFull ( ) { if(currentSize==DEFAULT_SIZE) return true; else return false; } public Comparable removeHigh () throws HeapEmptyException { if(isEmpty()) { throw new HeapEmptyException(); }else{ Comparable[] k = new Comparable[0]; k.equals(storage[1]); storage[1] = storage[currentSize]; storage[currentSize] = null; currentSize--; bubbleDown(); return storage[currentSize]; } } public void insert ( Comparable k ) throws HeapFullException { if(isFull()) { throw new HeapFullException(); } currentSize++; int index = currentSize; storage[index] = k; bubbleUp(); } protected void bubbleUp ( ) { int index = this.currentSize; while(parent(index).compareTo(storage[index]) &gt; 0) { swapElement(index, parent(index)); index = parent(index); } } protected void bubbleDown() { int index = 1; while (hasLeft(index)) { int smaller = leftChild(index); if(hasRight(index) &amp;&amp; storage[leftChild(index)].compareTo(storage[rightChild(index)])&gt;0) { smaller = rightChild(index); } if(storage[index].compareTo(storage[smaller]) &gt; 0) { swapElement(index, smaller); }else{ break; } } } protected void swapElement ( int p1, int p2 ) { Comparable k = storag…
answer count: 1
has answer: http://stackoverflow.com/a/27242011
favorite count: 0
tagged with: priority-queue
tagged with: heap
downvote count: 0

http://stackoverflow.com/q/27203124
type: Question
score: 0
answer count: 1
has title: How can I transform my Factor code into Prime and Composite Identifier?
has body: I already created a program that giving the factors of each inputted number. I was in confusion of how could I get a Prime and Composite; Problem: Accept a number and display the message "PRIME" if the number is a prime, otherwise display the message "COMPOSITE". Well what I've said is that I created the factor code. I can't catch up what's the logic here, I know that the probable logic is in the factor code that I've created. I now want the specific answer. I want to know the logic of how could I get if its prime or composite This is my factoring code: import java.util.Scanner; class factors{ public static void main(String[] args){ Scanner n = new Scanner(System.in); int num; int ctr=1; System.out.print("Enter a number : "); num = n.nextInt(); while(ctr&lt;=num){ if(num%ctr==0){ System.out.print(ctr + "\t"); } ctr++; } System.out.println(); } }
type: UnansweredQuestion
tagged with: primes
tagged with: composite
tagged with: java
has answer: http://stackoverflow.com/a/27203167

http://stackoverflow.com/q/27280493
answer count: 1
has comment: http://stackoverflow.com/comment/43029700
tagged with: serialization
has answer: http://stackoverflow.com/a/27280757
accepted answer: http://stackoverflow.com/a/27280757
has comment: http://stackoverflow.com/comment/43029703
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm trying to store an arraylist of a type I made, inside of a dat file so that the data isn't lost every time I close the program. I've never done anything with serialization before, from looking at other questions on this site I think it's what I want. Any help or insight is vastly appreciated!
score: 0
has title: Can I serialize an arraylist so that I can store it in a .dat file?

http://stackoverflow.com/comment/42828654
comment on: http://stackoverflow.com/q/27168619
score: 0
type: Comment
type: QuestionComment
has text: Is your class generic ? if not you must delare the method like this: `public static <T> List<T extends MyObject> T find()`

http://stackoverflow.com/q/27281454
type: Question
accepted answer: http://stackoverflow.com/a/27281691
possible better answer: http://stackoverflow.com/a/27282739
upvote count: 5
tagged with: java
tagged with: notify
answer count: 2
score: 5
downvote count: 0
tagged with: wait
favorite count: 0
tagged with: synchronized
has answer: http://stackoverflow.com/a/27281691
tagged with: semaphore
type: AnsweredQuestion
has body: Good evening, I am wondering how I can replace synchronized, wait and notify in the following code by semaphores? And where do I have to create the semaphore variable? import java.util.*; class Producer extends Thread { private Vector v; public Producer(Vector v) { this.v = v; } public void run() { String s; while (true) { synchronized (v) { s = "Value"+Math.random(); v.addElement(s); System.out.println("Producer created "+s); v.notify(); } try { Thread.sleep((int)(100*Math.random())); } catch (InterruptedException e) { //nothing } } } } class Consumer extends Thread { private Vector v; public Consumer(Vector v) { this.v = v; } public void run() { while (true) { synchronized (v) { if (v.size() &lt; 1) { try { v.wait(); } catch (InterruptedException e) { //nothing } } System.out.print( " Consumer found "+(String)v.elementAt(0) ); v.removeElementAt(0); System.out.println(" (remaning: "+v.size()+")"); } try { Thread.sleep((int)(100*Math.random())); } catch (InterruptedException e) { //nothing } } } } I'd be glad if someone could help me out! Thank you in advance..
has answer: http://stackoverflow.com/a/27282739
has title: How to replace synchronized, wait, notify by semaphores? (Producer-Consumer)

http://stackoverflow.com/q/27218929
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
has title: Using array to count only letters in java
has body: hi i am suppose to write a program which will do the following Prompt the user to enter a String of data Using the charAt(index) method in the String class to access each character in the string individually, produce a count of the number of word lengths Count only letters (regardless of upper or lower case) and treat spaces, numbers and punctuation as word separators. Display the number of words and lengths for all non-zero lengths, and the total number of words for example lets say a sentence like this : Hello Stack Over Flow 2 4 letter words 1 5 letter words 1 6 letter words 5 total words i have something like this : Scanner input = new Scanner (System.in); int [] wordCount = new int [50]; int i = 0 ,charCount = 0 , j=0; int counter=0; System.out.println("Enter the phrase"); String userInput =input.nextLine().toUpperCase(); for ( i = 0;i &lt; userInput.length(); i++){ char charAt = userInput.charAt(i); if (charAt &gt;= 'A' &amp;&amp; charAt &lt;= 'Z') { counter++; } else{ if(i-j&gt;1){ counter++; j=1; } else{ i=j; } wordCount[counter]++; counter=0; } } wordCount[counter]++; System.out.println(userInput.length()); } } which only count total number of word but from this point forward i am stuck
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42917298
has answer: http://stackoverflow.com/a/27219104
upvote count: 0
tagged with: arrays
score: -1

http://stackoverflow.com/comment/43043644
type: Comment
type: QuestionComment
has text: @flup so I have created the new question
comment on: http://stackoverflow.com/q/27288261
score: 0

http://stackoverflow.com/comment/43030021
score: 0
has text: FYI: I just noticed that the number 753537 that you posted in your question is not correct since it's not a palindrome (perhaps you meant 753357?).
comment on: http://stackoverflow.com/q/27278742
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27220137
has body: I'm trying to keep this fairly clean and on a single reference to a JFrame, a cut and skinned version of the application is as follows: public class Client extends SuperclassNotJFrame private JFrame frame; method a() frame = new Frame("first frame").setSize(400,400).setVisible(true) endmethod method b() frame = new Frame("second frame").setSize(800, 600).setVisible(true) endmethod endclass If I call method a() and then later call method b(), the frame created during method a() will stay, even though I've completely removed the reference the frame created there by over-writing it with the new frame. I've even tried doing frame = null in b(), with the same result.
score: 0
has comment: http://stackoverflow.com/comment/42919303
accepted answer: http://stackoverflow.com/a/27220153
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27220153
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 1
has title: Switching JFrames without changing reference

http://stackoverflow.com/comment/43028673
comment on: http://stackoverflow.com/a/27279862
score: 0
type: AnswerComment
has text: @committedandroider yes, but you do not have the raw source (either source files or a source JAR), so the IDE can only provide you with limited data (source code, but no symbol information). As you have pointed out, you can observe that this file is a part of a JAR which has limited debug information.
type: Comment

http://stackoverflow.com/comment/43059414
comment on: http://stackoverflow.com/q/27289950
score: 0
has text: @JoelM.Lamsen yes, that's perfectly fine. Prefix mappings are lexically scoped so at any point you just look up the tree for the nearest (ancestor-or-self) binding of the prefix in question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42892606
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27204977
has text: @SotiriosDelimanolis USP is Unique Selling Point.
type: Comment

http://stackoverflow.com/a/27158338
upvote count: 2
answers question: http://stackoverflow.com/q/27158148
accepted answer of: http://stackoverflow.com/q/27158148
type: AcceptedAnswer
downvote count: 0
has body: You just forgot to set the size: it's working fine on my system. Here, I cleaned up a bit for you. package developerToolsNotForDeployment; import javax.swing.*; import java.awt.*; import java.util.ArrayList; public class OrderGUI extends javax.swing.JFrame { ArrayList orders = new ArrayList&lt;&gt;(); public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { e.printStackTrace(); } /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { OrderGUI gui = new OrderGUI(); gui.setTitle("Flexbox Order System"); gui.setResizable(false); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(new Dimension(400,400)); gui.setVisible(true); } }); }
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42812007

inheritance
tags question: http://stackoverflow.com/q/27200266
tags question: http://stackoverflow.com/q/27256894
tags question: http://stackoverflow.com/q/27155779
tags question: http://stackoverflow.com/q/27278449
tags question: http://stackoverflow.com/q/27189062
tag name: inheritance
tags question: http://stackoverflow.com/q/27210163
tags question: http://stackoverflow.com/q/27236222
tags question: http://stackoverflow.com/q/27200140
type: Tag
tags question: http://stackoverflow.com/q/27159933
tags question: http://stackoverflow.com/q/27240406
tags question: http://stackoverflow.com/q/27223090
tags question: http://stackoverflow.com/q/27259383
tags question: http://stackoverflow.com/q/27270664
tags question: http://stackoverflow.com/q/27228788
tags question: http://stackoverflow.com/q/27298351
tags question: http://stackoverflow.com/q/27239533
tags question: http://stackoverflow.com/q/27183385
tags question: http://stackoverflow.com/q/27231403
tags question: http://stackoverflow.com/q/27267919

http://stackoverflow.com/comment/43036395
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/27283306
has text: The answer is yes! :)

http://stackoverflow.com/comment/42831747
score: 3
comment on: http://stackoverflow.com/q/27170428
has text: Please do not hold onto random `Context` objects in static data members -- you are leaking memory in this case. `SettingsManager` is largely pointless (`SharedPreferences` are already cached by the framework), but if you insist on keeping it, hold onto `getApplicationContext()` in the static data member, please.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42894398
type: QuestionComment
has text: Yeah, a greedy heuristic is what I ended up going for, since I needed something that can be executed relatively quickly.
comment on: http://stackoverflow.com/q/27178559
score: 0
type: Comment

http://stackoverflow.com/a/27228830
has comment: http://stackoverflow.com/comment/42935280
upvote count: 4
has comment: http://stackoverflow.com/comment/42935018
answers question: http://stackoverflow.com/q/27228788
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/27228788
has comment: http://stackoverflow.com/comment/42935768
has comment: http://stackoverflow.com/comment/42936251
type: Answer
has body: You have a hp variable in both Monsters class and Devil class. When you access hp from a method of Monsters class (your filght method), you get the variable of hp, which is 0 by default. You should have hp only in the base class, and use Monster's constructor to initialize it properly : For example : public class Devil extends Monsters { public Devil () { super(200); } }

http://stackoverflow.com/comment/42953628
comment on: http://stackoverflow.com/a/27238262
has text: Thank you, your answer is the answer of my question.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/58835490
type: Answer
has body: Control key, twice Just press the Ctrl key twice! You will see this: Then run your Maven command with mvn. Ex: mvn -version. See documentation for IntelliJ on Maven goals.
upvote count: 45
has comment: http://stackoverflow.com/comment/119404493
score: 45
downvote count: 0
answers question: http://stackoverflow.com/q/27246065
has comment: http://stackoverflow.com/comment/108927556

http://stackoverflow.com/comment/43071539
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27303300
has text: Agreed with @Simon. Probably one of the most useful questions on the actual performances of SQLite. (although not immediately transferable into android SQLite API)
score: 0

http://stackoverflow.com/comment/43033782
has text: MeetTitan - What interface would you suggest extracting? Having an ITrait seems like the obvious choice, but then implementors of ITrait that only want to act on specific children of PlayerCharacter would still have to cast.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27282474
score: 0

http://stackoverflow.com/q/27255454
type: Question
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/27255525
score: 0
has comment: http://stackoverflow.com/comment/42984861
has comment: http://stackoverflow.com/comment/42985228
has answer: http://stackoverflow.com/a/27255703
has comment: http://stackoverflow.com/comment/42985065
type: UnansweredQuestion
has title: String input not working correctly
tagged with: input
has comment: http://stackoverflow.com/comment/42984822
tagged with: java
has body: All I am trying to do is write code to ask the user for a sequence of numbers separated by spaces. It should be simple, and to my (admittedly limited) knowledge, the following code should work just fine: System.out.print("How many numbers? "); int n = input.nextInt(); System.out.print("Please enter " + n + " numbers (seperated by spaces) "); String numbers = input.nextLine(); Except it isn't working. I input the integer for n, then when the program asks me to input a sequence of numbers, I can't type anything in at all, letters, numbers, anything. This is how far it gets: How many numbers? 8 Please enter 8 numbers (seperated by spaces) and while it should be accepting my next input into the String variable numbers, it is certainly not doing so.

http://stackoverflow.com/comment/43063300
type: AnswerComment
has text: http://stackoverflow.com/questions/27299226/get-data-from-json-array-in-json-array-android-java/27299646#27299646
comment on: http://stackoverflow.com/a/27299601
score: 0
type: Comment

http://stackoverflow.com/comment/42931299
type: Comment
comment on: http://stackoverflow.com/a/27197157
has text: SpringBoot issue raised too: https://github.com/spring-projects/spring-boot/issues/2026
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43006523
comment on: http://stackoverflow.com/q/27248618
has text: Yes, I tried to create new module, but it makes new package inside src folder of MainProject and it's called test.com.package1 for example.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/99194284
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27250318
type: Comment
has text: how do u encrypt a pdf if only you have the byte array as input - and need another byte array as output, it is posible?

http://stackoverflow.com/a/27409086
answers question: http://stackoverflow.com/q/27170001
type: Answer
score: 0
has body: I don't have an answer, but just wanted to provide more information. I'm seeing the same thing where it tries to use http with port 443 which obviously won't work. Here the exception I get is different from yours: java.net.SocketException: Connection reset I was seeing this behavior from a java applet and also from a java webstart program. The user is not using any proxy server. We tested Java 8 Update 25 on our own system here and it works fine. The user that had this issue has a Symantec anti-virus and firewall product installed. As far as I could tell it was not blocking anything. We installed Java 7 Update 71 and then it started working.

http://stackoverflow.com/comment/43886536
type: AnswerComment
type: Comment
has text: Thanks for the reply, I've just removed MD5 Hash from my site and now using SHA-256 which will be better for me. SHA1 will discontinue in 2016 or 2017 as I have read on the internet. Also I will try to do the sql statements with form to have less issues with SQL Injection on MS SQL.
comment on: http://stackoverflow.com/a/27221298
score: 0

http://stackoverflow.com/q/27166298
has answer: http://stackoverflow.com/a/27166577
accepted answer: http://stackoverflow.com/a/27166577
possible better answer: http://stackoverflow.com/a/27166580
has body: for example : i have an EditText that get string and want to convert every char of this String to the constant number and then sum all number of characters and save it on int variable.
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
score: -2
has answer: http://stackoverflow.com/a/27166580
has comment: http://stackoverflow.com/comment/42824595
has title: set number to char of string and sum that number
answer count: 3
has answer: http://stackoverflow.com/a/27166565
favorite count: 0
has comment: http://stackoverflow.com/comment/42824638
has comment: http://stackoverflow.com/comment/42824884
tagged with: android
has comment: http://stackoverflow.com/comment/42824603
upvote count: 1

http://stackoverflow.com/q/27219432
tagged with: java
has answer: http://stackoverflow.com/a/27219485
tagged with: eclipse
answer count: 1
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42918087
has comment: http://stackoverflow.com/comment/42918354
has body: I am trying to add adMob ad in my android application, but it gives me unfortunately stopped error, I am not expert in android program so dont know whats wrong in aap. HomeActivity package com.innobee.finddifferences; import com.google.android.gms.ads.*; 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; import com.innobee.finddifferences.utility.Prefs; public class HomeActivity extends Activity{ private int mLevelDuration; //Max Duration of the level in seconds private Button mBtnResume; private Button mBtnStart; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); mLevelDuration = getResources().getInteger(R.integer.levelDuration); mLevelDuration = mLevelDuration * 1000; mBtnStart = (Button)findViewById(R.id.btnStart); mBtnStart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Prefs.clearPref(getApplicationContext()); Prefs.setStagePref(getApplicationContext(), 1); Intent play = new Intent(HomeActivity.this, PlayActivity.class); startActivity(play); } }); mBtnResume = (Button)findViewById(R.id.btnResume); mBtnResume.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent play = new Intent(HomeActivity.this, PlayActivity.class); startActivity(play); } }); if(Prefs.getResumePref(getApplicationContext()) == mLevelDuration) { mBtnResume.setVisibility(View.INVISIBLE); } else { mBtnResume.setVisibility(View.VISIBLE); } } @Override protected void onRestart() { super.onRestart(); //Show/hide resume button if(Prefs.getResumePref(getApplicationContext()) == mLevelDuration) { mBtnResume.setVisibility(View.INVISIBLE); } else { mBtnResume.setVisibility(View.VIS…
type: UnansweredQuestion
tagged with: android-intent
tagged with: emulation
type: Question
has title: Unfortunately, APP Has Stopped after added ADMOB

http://stackoverflow.com/a/27201135
answers question: http://stackoverflow.com/q/27200761
type: Answer
has comment: http://stackoverflow.com/comment/42896521
has body: I would look into storing the data into a SQLiteDatabase. SharedPreferences wasn't intended to save custom objects. If you really want to use SharedPreferences then Gson will be the best solution. API 11 added the ability to save a list of strings, not objects.
score: 0
has comment: http://stackoverflow.com/comment/42901012

http://stackoverflow.com/comment/43033894
comment on: http://stackoverflow.com/a/27279574
score: 0
type: AnswerComment
type: Comment
has text: @BHarman It's unconventional, but java isn't the typical language on OS X. Most apps now run as signed / sandboxed apps with proper entitlements to describe where on the filesystem they read and write. See this post towards the bottom about containerizing a java app and making it sandbox proof. It's for more typical, user only data storage, but should help you decide how to move forward. http://www.intransitione.com/blog/take-java-to-app-store/#stepthree

http://stackoverflow.com/a/27192999
has comment: http://stackoverflow.com/comment/42872318
has comment: http://stackoverflow.com/comment/42871827
answers question: http://stackoverflow.com/q/27192931
type: Answer
has comment: http://stackoverflow.com/comment/42871990
score: 3
downvote count: 0
upvote count: 3
has body: You haven't given us very much information, but taking a wild stab at it: If you output the string to the HTML as-is, without doing any processing, it's exactly like writing this HTML (I'll put it in a p): I am bharat sripuram Which is displayed by a web browser as: I am bharat sripuram ...because all whitespace in HTML is treated as a single space, including carriage returns and newlines. Example: I am bharat sripuram If you want a line break in HTML, use (or separate the content into separate elements). Example: I am bharat sripuram
has comment: http://stackoverflow.com/comment/42872364

http://stackoverflow.com/a/27217421
has comment: http://stackoverflow.com/comment/42914701
has comment: http://stackoverflow.com/comment/42914703
has comment: http://stackoverflow.com/comment/42914631
score: 0
has comment: http://stackoverflow.com/comment/42914644
has body: To call a method from another object (a Fragment is an object) you need to have the reference of that object. So if you want to call MainFragment#otherList() from a SocialMedia instance, SocialMedia needs a reference to MainFragment. For example: public class SocialMedia { private MainFragment mainFragment = null; public void setMainFragment(final MainFragment mainFragment) { this.mainFragment = mainFragment } } Then you can use this.mainFragment.otherList().
has comment: http://stackoverflow.com/comment/42914570
type: Answer
answers question: http://stackoverflow.com/q/27217362
has comment: http://stackoverflow.com/comment/42914774
has comment: http://stackoverflow.com/comment/42914762
has comment: http://stackoverflow.com/comment/42914864
has comment: http://stackoverflow.com/comment/42914789
has comment: http://stackoverflow.com/comment/42914776

http://stackoverflow.com/a/27297414
answers question: http://stackoverflow.com/q/27297171
has body: Because it is CountDownLatch specific feature. If CountDownLatch would reset its counter then it would behave rather like as CyclicBarrier
has comment: http://stackoverflow.com/comment/43059122
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/27178582
has comment: http://stackoverflow.com/comment/42845996
tagged with: string
has answer: http://stackoverflow.com/a/27178598
has answer: http://stackoverflow.com/a/27178612
score: 0
answer count: 3
has body: I am creating a hangman game and I need the user to type a letter, once the letter is in it searches the string to check if it is there. The only problem is that it finds the first letter but not the second if there are two. For example, if the word is roar it will return that the r is at 0, however it is at 3 too. System.out.print("Guess: "); char c = s.next().charAt(0); if (newline.indexOf(c) &gt;= 0) { index = newline.indexOf(c); System.out.println(newline.indexOf(c)); System.out.println("Correct Guess!!"); indexarray[x] = index; correctguesses[x] = c; count++;
possible better answer: http://stackoverflow.com/a/27178598
has title: Finding same character in one string
accepted answer: http://stackoverflow.com/a/27178612
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27178615
tagged with: java
type: Question
tagged with: indexof

http://stackoverflow.com/q/27154954
has title: Boolean column type (nullable true) in hibernate
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/27155177
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27375685
has body: the problem is the following, i have an entity with a column.. say: @Getter @Setter @Column(name = "COLUMN_NAME", nullable = true) private Boolean flag; As you can see the type is Boolean.. On the database it is a numeric column (NUMBER(1,0)). I'm trying to to perform a select and an insert in the table, through hibernate jpa so the select is a repository find and the insert is a saveAndFlush. This is the select: public static final String query = "SELECT mgb FROM Entity mgb WHERE " + "( " + "(" + "mgb.flag= :flag" + ") OR " + "(:flag IS NULL)" + ") AND " + "mgb.otherColumn IS NULL"; @Query(query) public List&lt;Entity&gt;find(@Param("flag") Boolean flag); This is the insert: Entity mgbi = new Entity(); mgbi.setFlag(null); EntityRepository.saveAndFlush(mgbi); Both these operation throw me the same exception; 2014-11-26 17:50:25,279 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &lt;SQL Error: 17004, SQLState: 99999&gt; 2014-11-26 17:50:25,280 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &lt;Invalid column type: 16&gt; I've done some attempt and i found out that if i change this line: mgbi.setFlag(null); to mgbi.setFlag(true); the error is not thrown any more and the insert is rightly done. I've found out on the web that the boolean type has this problem in java, but i've used the Boolean which should not act this weird.. AND, last but not least, i've an other entity, with almost the same column (even the name is the same), on the same database, with the same data types involved both from the java and from the db (oracle) point of view, it doesn't give me ANY error.. So i'm quite confused.. If someone could point me in the right direction i would be glad..
has comment: http://stackoverflow.com/comment/87879690
type: Question

http://stackoverflow.com/a/28564770
score: 1
has body: As mentioned, Quasar does exactly that (it usually schedules N fibers on M threads, but you can set M to 1), using bytecode transformations. It even gives each task (AKA "fiber") its own stack trace, so you can dump it and get a complete stack trace without any interference from any other task sharing the thread.
upvote count: 1
answers question: http://stackoverflow.com/q/27230992
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42850284
type: QuestionComment
has text: Thank you everyone! Actually I am following the instructions, which is given to us by our professor and that's why I need to use that code. Thank you Tom, it worked!
comment on: http://stackoverflow.com/q/27160248
score: 0
type: Comment

http://stackoverflow.com/comment/42834848
has text: It's activity. Then from the scheduleAlarm() I will execute the onReceive which extends to BroadcastReceiver
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27172134
type: Comment

http://stackoverflow.com/comment/42969539
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27213305
has text: @kiheru Thanks! That's just what I needed to know!

http://stackoverflow.com/comment/42913951
comment on: http://stackoverflow.com/q/27216958
type: Comment
has text: Hey, thanks for the answer. Can you elaborate a bit more? I never really needed to mess with those settings, so I don't really know how to proceed.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27298227
score: 0
has answer: http://stackoverflow.com/a/27377113
answer count: 2
tagged with: xamarin
has answer: http://stackoverflow.com/a/27523425
tagged with: android
possible better answer: http://stackoverflow.com/a/27377113
has title: Android Slider - can we retrieve attributes from the Item XML?
type: AnsweredQuestion
tagged with: c#
has body: I am currently using Xamarin to create an Android app, so you're about to see C# and not Java, but if you know how to solve the same issue in Java, I would still appreciate your answer... I have a Slider and I've set up a string array like below: Item 1 Item 2 Item 3 Item 4 I have created a ItemSelected Event and I am able to get the selected string, e.g. "Item 1" but I cannot find a way of getting the id - the following code returns an id based on the position in the string array (zero based) which is no use: private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; string toast = string.Format("The selection is {0}\r\nThe ID is {1}", spinner.GetItemAtPosition(e.Position), spinner.GetItemIdAtPosition(e.Position)); Toast.MakeText(this, toast, ToastLength.Long).Show(); } Is there any way to do what I am trying to do. I have seen examples of creating objects but it seems overly complicated for a simple ID/String scenario. I don't have any objections to altering the XML. Thanks
tagged with: java
accepted answer: http://stackoverflow.com/a/27523425
type: Question

http://stackoverflow.com/q/27183385
accepted answer: http://stackoverflow.com/a/27183881
type: Question
has title: Java Polymorphism: Please Help Me to Understand Polymorphism
tagged with: inheritance
answer count: 3
possible better answer: http://stackoverflow.com/a/27183560
downvote count: 0
has answer: http://stackoverflow.com/a/27183560
tagged with: polymorphism
has answer: http://stackoverflow.com/a/27183881
favorite count: 0
upvote count: 1
has body: class ClassA { String whoAmI() { return "ClassA"; } } class ClassB extends ClassA{ String whoAmI() { return "ClassB"; } } class Main { public static void main(String[] args) { ClassA obj1 = new ClassA(); ClassA obj2 = new ClassB(); System.out.println(obj1.whoAmI()); System.out.println(obj2.whoAmI()); } } Output of the code above is: ClassA ClassB In the code above output is as expected that I can see the methods of class "ClassB" when I am creating a reference variable of class "ClassA" and instantiating with "new ClassB();", but why it is not same in case when I creating the reference variable of interface "List" and instantiating it by using its implementing class "ArrayList" (I know that we can't create objects of interfaces directly)? import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List objList = new ArrayList(); objList.add("One"); objList.add("Two"); objList.add("Three"); System.out.println(objList.get(1)); // Only able to call methods of interface "List", but not methods of its implementing class "ArrayList. WHY?" } } If class "ArrayList" is implementing interface "List" then why I am not able to call methods of class "ArrayList"? I know that there is some misunderstanding in my mind about the concept of Polymorphism. Please help me to clear that misunderstanding!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27183601
score: 1
tagged with: java

http://stackoverflow.com/q/27179618
type: Question
tagged with: mean
has answer: http://stackoverflow.com/a/27179646
possible better answer: http://stackoverflow.com/a/51111824
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/27179646
answer count: 2
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has title: How do I print an ArrayList reading top-to-bottom in Java?
tagged with: list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42847958
has body: So I was able to add values to my ArrayList as per requirement of my program, but now I need to print these values to be read vertically, like each value in the list but not printed in a long line. With my code below... public class Homework23Average { public static void main(String[] args) { ArrayList exes = new ArrayList (); double x; double y = 0; Scanner inputStream = null; try { inputStream = new Scanner (new File ("RawData.txt")); } catch (FileNotFoundException e) { System.out.println ("File not found, program aborted:"); System.exit (1); } int count = 0; while (inputStream.hasNextDouble ()) { count ++; x = inputStream.nextDouble (); y += x; if (x &gt; y/count) // x values greater than the mean (y/count) exes.add (x); } System.out.println ("This value(s) greater than the mean (" + y/count + ") are (is):" + exes); System.out.println ("This is the sum of all x values: " + y); System.out.println ("This is the mean of the x values: " + y/count); ... I get the results from the ArrayList printed out horizontally: i.e. [120.3, 215.9, 165.0, 185.0, 185.4, 160.5, 120.4, 370.1, ....... 125.3] I need the results to be printed vertically: i.e. 120.3 215.9 165.0 185.0 . . . 125.3 Is this even possible with ArrayLists? Should I be using some other method to get this done? Note that this is my second program writing in Java after "Hello World".
upvote count: 1
has answer: http://stackoverflow.com/a/51111824

fractions
type: Tag
tag name: fractions
tags question: http://stackoverflow.com/q/27157622

http://stackoverflow.com/a/27294642
type: Answer
answers question: http://stackoverflow.com/q/27294243
score: 0
has body: Try following code public String withoutString(String base, String remove) { return base.replace(remove,""); } For Input : base=Hello World remove=llo Output : He World For more on such string operations visit this link.

http://stackoverflow.com/comment/42819082
score: 0
has text: @MadProgrammer can you check this [link](http://stackoverflow.com/questions/27146086/select-many-checkbox-in-a-checkboxgroup-java-swing). and further explain the idea you have if you can provide a snippet that would be better
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27162971

http://stackoverflow.com/comment/43183045
has text: jboss-deployment-structure.xml is the file which you should use if you don't want to mess with the modules directly. If you tried and it did not work, it is hard to tell what went wrong without additional information.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27226154

http://stackoverflow.com/comment/42836295
type: AnswerComment
comment on: http://stackoverflow.com/a/27172618
type: Comment
has text: I forgot to add the constructor public TravelGood() { LameDuck_Service service = new LameDuck_Service(); lameDuckClient = service.getLameDuck(); NiceView_Service niceViewService = new NiceView_Service(); niceViewClient = niceViewService.getNiceView(); parserSDF = new SimpleDateFormat("yyyy-MM-dd"); userItineraries = new HashMap<String, List<Itinerary>>(); }
score: 0

http://stackoverflow.com/comment/111878458
comment on: http://stackoverflow.com/a/27225957
type: Comment
has text: @PrabhatGaur If you are within the source code of class `B` and you get a `B` type object and clone it, you'd be able to access all its private fields.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27202836
has comment: http://stackoverflow.com/comment/42889051
has body: There are two waysi can think of 1) Apply Non clustered index on column Cor_Sentence . It should definitely help. See the example 2) Go for pagination if possible.Say 50 rows at a time
has comment: http://stackoverflow.com/comment/42891984
score: 0
has comment: http://stackoverflow.com/comment/42888747
type: Answer
answers question: http://stackoverflow.com/q/27202767
has comment: http://stackoverflow.com/comment/42889847

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/27187849
tag name: ksoap2

http://stackoverflow.com/comment/42891497
has text: Array elements are never empty. Are you trying to avoid elements that are `null`? What does your class hierarchy look like? What's in `casesA`? What do you mean "grouped together by the instance"? Also, it seems like you're having a terminology problem. Please check the definitions of class, superclass, and instance.
comment on: http://stackoverflow.com/q/27204308
score: 0
type: Comment
type: QuestionComment

logging
tags question: http://stackoverflow.com/q/27195431
tags question: http://stackoverflow.com/q/27212053
tags question: http://stackoverflow.com/q/27236849
tags question: http://stackoverflow.com/q/27238085
tags question: http://stackoverflow.com/q/27182234
tag name: logging
tags question: http://stackoverflow.com/q/27163310
tags question: http://stackoverflow.com/q/27312133
tags question: http://stackoverflow.com/q/27289959
tags question: http://stackoverflow.com/q/27271336
tags question: http://stackoverflow.com/q/27174875
tags question: http://stackoverflow.com/q/27219599
tags question: http://stackoverflow.com/q/27169127
tags question: http://stackoverflow.com/q/27278892
tags question: http://stackoverflow.com/q/27167721
tags question: http://stackoverflow.com/q/27278916
tags question: http://stackoverflow.com/q/27244807
tags question: http://stackoverflow.com/q/27275611
tags question: http://stackoverflow.com/q/27274467
tags question: http://stackoverflow.com/q/27178116
tags question: http://stackoverflow.com/q/27183782
tags question: http://stackoverflow.com/q/27274115
tags question: http://stackoverflow.com/q/27240406
tags question: http://stackoverflow.com/q/27180807
tags question: http://stackoverflow.com/q/27253816
type: Tag
tags question: http://stackoverflow.com/q/27203251

http://stackoverflow.com/comment/43075336
type: QuestionComment
has text: this is the beginning of my code where i get the number and it goes into an array call inputNumber ... sorry for the format i can't figure this website out
score: 0
comment on: http://stackoverflow.com/q/27306142
type: Comment

http://stackoverflow.com/q/27303275
linked to: http://stackoverflow.com/q/10380835
tagged with: gson
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/10380835
tagged with: java
tagged with: thread-safety
has title: Is Gson library thread safe
has body: Can we run Gson in a thread safe way, and without using the synchronize keyword as a safety mechanism? I know that a few years ago it was an issue, but I am wondering if this has been solved since then!
downvote count: 0
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1

http://stackoverflow.com/a/27309792
type: Answer
answers question: http://stackoverflow.com/q/27309640
has body: This is two step process Step 1 : Add ListView by Xml Layout or by Java code ListView view=new ListView(Context); Step2 : Create Adapter like Array Adapter and set the adapter on listview String[] arr=new String[]{"a","b","c","d"}; ArrayAdapter&lt;String&gt; adapter=new ArrayAdapter&lt;String&gt;(getContext(), android.R.layout.simple_list_item_1, arr); view.setAdapter(adapter);
score: 0

http://stackoverflow.com/q/27199423
tagged with: oop
score: 1
has title: How can I switch from JFrame to java class?
has body: I've been trying to figure out how to go from a JFrame to my java class. This was my code so far: (It only opens the main..which is the JFrame) Process process = Runtime.getRuntime().exec("cmd.exe /c start java -jar \C:\Users\Admin\Documents\NetBeansProjects\Program\dist\Program.jar"); BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); The main used to be the class, making it easy for me to use setvislble() for the frame, but now I need it backwards and the main is now the JFrame. I need to know how to open the class file. (Also if anyone knows how to switch besides using CMD that would be great!) I've tried used this plus a combination of other variations but it won't work. java -cp "C:\Users\Admin\Documents\NetBeansProjects\Program\dist\Program.jar class"
tagged with: java
has comment: http://stackoverflow.com/comment/42884276
upvote count: 1
has comment: http://stackoverflow.com/comment/42883570
type: Question
has comment: http://stackoverflow.com/comment/42883686
has answer: http://stackoverflow.com/a/27200444
has comment: http://stackoverflow.com/comment/42883562
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42884300
favorite count: 0
accepted answer: http://stackoverflow.com/a/27200444
has comment: http://stackoverflow.com/comment/42883918
tagged with: jframe
has comment: http://stackoverflow.com/comment/42883577
tagged with: swing
has comment: http://stackoverflow.com/comment/42883836
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42883637

http://stackoverflow.com/comment/42938783
type: Comment
comment on: http://stackoverflow.com/q/27221175
score: 0
type: QuestionComment
has text: [crossposted](https://www.daniweb.com/software-development/java/threads/488358/jcheckbox-vs-jcheckboxmenuitem)

http://stackoverflow.com/q/27238746
tagged with: spring-batch
accepted answer: http://stackoverflow.com/a/27239061
answer count: 3
possible better answer: http://stackoverflow.com/a/27287281
downvote count: 0
has answer: http://stackoverflow.com/a/27287281
favorite count: 0
has body: I have a folder and want to load all txt files to a list using Spring and wildcards: By annotation I could do the following: @Value("classpath*:../../dir/*.txt") private Resource[] files; But how can I achieve the same using spring programmatically?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27239061
tagged with: java
has title: How to load all files of a folder to a list of Resources in Spring?
type: Question
upvote count: 27
score: 27
has answer: http://stackoverflow.com/a/65825352

http://stackoverflow.com/comment/43072274
has text: And what should happen, if you will go to end of array? (for example array of 6 elements[indexes from [0 to 5] you started at index 3, then what should next element, that should be false - 0? Also, what in situation, when size of array is dividing by 3? (in this case even if there will loop in array [so after index 5 you are going to index 0] you will be still going on the same indexes and never will be situation, that just one number will left
comment on: http://stackoverflow.com/q/27304471
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27297923
type: AcceptedAnswer
has body: you should change your test as: }while(abc &lt; 99);
answers question: http://stackoverflow.com/q/27297518
type: Answer
accepted answer of: http://stackoverflow.com/q/27297518
score: 0

http://stackoverflow.com/comment/42877052
has text: I just tested it, and it returns what is expected (true). No issue here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27195883
score: 1

http://stackoverflow.com/comment/42912664
comment on: http://stackoverflow.com/a/27216319
type: Comment
has text: So is it basically to stop me from thinking that I can change the value of the variables of the innerclass, within the outerscope ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42952350
comment on: http://stackoverflow.com/a/27237800
has text: Thanks, I just wasn't sure the best way to pass the description value to the parent via grails dynamic constructors, but it's a lot easier than I thought :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42951321
score: 1
has text: What's the value of the "*number*" Ace or King?
comment on: http://stackoverflow.com/q/27237325
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43082611
score: 0
type: AnswerComment
has text: Thanks, I will try it this afternoon, if it works I'll set your answer as the correct one :)
comment on: http://stackoverflow.com/a/27306097
type: Comment

http://stackoverflow.com/q/27205309
has comment: http://stackoverflow.com/comment/42893384
accepted answer: http://stackoverflow.com/a/27205390
has comment: http://stackoverflow.com/comment/42893254
score: 13
tagged with: java-8
upvote count: 13
has comment: http://stackoverflow.com/comment/42893157
type: AnsweredQuestion
has body: public class Test { public static void main(String[] args) { List&lt;Pair&lt;String, Integer&gt;&gt; list = new ArrayList&lt;&gt;(); list.add(new Pair&lt;&gt;("1", 8)); list.add(new Pair&lt;&gt;("3", 2)); list.add(new Pair&lt;&gt;("2", 15)); list.stream() .sorted(Comparator.comparingInt(p -&gt; p.v)) .map(p -&gt; p.k) .forEach(System.out::println); } } class Pair&lt;K, V&gt; { K k; V v; public Pair(K k, V v) { this.k = k; this.v = v; } } Ok, as you understood this code is printing my pair keys from the lowest value associated to the highest so I get the expected output: 3 1 2 So far so good. Now I wanted to do the reverse, I thought I would only have to do list.stream() .sorted(Comparator.comparingInt(p -&gt; p.v).reversed()) .map(p -&gt; p.k) .forEach(System.out::println); But I get a compilation error: v cannot be resolved or is not a field So it seems like comparingInt is returning a Comparator&lt;Object&gt;. Why it so? Shouldn't it return a Comparator&lt;Integer&gt; ? These are both reproductible with Eclipse Luna version 1 and javac. javac -version =&gt; 1.8.0 java -version =&gt; java version "1.8.0_25" Oh also feel free to change the title of my question is you find it too general, but I couldn't find the correct terms
tagged with: java
linked to: http://stackoverflow.com/q/26872827
linked to: http://stackoverflow.com/q/25172595
type: Question
has title: Misunderstanding about Comparator in java 8
has comment: http://stackoverflow.com/comment/42893477
has answer: http://stackoverflow.com/a/27205390
downvote count: 0
tagged with: comparator
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27235958
score: 0
answers question: http://stackoverflow.com/q/27235896
type: Answer
has body: No i think it's not the way you explained. System.out is a static reference of PrintStream class (present in java.io package) which has methods to print primitives directly!!!

http://stackoverflow.com/a/27308665
type: Answer
has body: Try this while (itr.hasNext()) { NameValuePair nvp = itr.next(); if (nvp.getName().equals("image") &amp;&amp; nvp.getValue().equals("fdfdsgdg5dsgd1s211511")) { return nvp.getName()+" "+nvp.getValue()+" Exists"; } if (nvp.getName().equals("id") &amp;&amp; nvp.getValue().equals("dfd4f5d4f5d")) { return nvp.getName()+" "+nvp.getValue()+" Exists"; } if (nvp.getName().equals("api_id") &amp;&amp; nvp.getValue().equals("f4f54f5d454df")) { return nvp.getName()+" "+nvp.getValue()+" Exists"; } }
answers question: http://stackoverflow.com/q/27308454
score: 0

http://stackoverflow.com/q/27310243
has comment: http://stackoverflow.com/comment/43081678
has comment: http://stackoverflow.com/comment/43084734
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43081647
type: Question
has comment: http://stackoverflow.com/comment/43081751
tagged with: jpa
has body: I have a simple question. In my limited experience persistence frameworks appear to avoid a "unique-save" method. For example, I may have a Zip code object that is going to be persisted in a "ZIP_CODE" table. I would like the codes in the table to be unique, but the table dynamic (growing with new unique codes). It seems that the "convention" for processing such data is to search the table to see if a new zip code is already there, If it is I can use it in say a many-to-one mapping for maybe an address object. If it is not, I can save it and then use it. In a sense this is a two step process: read, save which needs to be managed in my application code. As an alternative, this functionality could be built within the persistence framework so that I could call a single unique save method that returned the required object. It doesn't appear that this functionality is generally supported - not sure why. I guess I could be missing something really obvious here!
has title: Persistence frameworks and unique save
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/43081600
answer count: 0
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/43073459
comment on: http://stackoverflow.com/q/27305216
type: Comment
type: QuestionComment
score: 3
has text: I was writing an answer; but since its closed I can't. Look at the JLS for [the if statement](http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.9), if you go up you'll see that a `LocalVariableDeclarationStatement` can only be in a `Block`

http://stackoverflow.com/comment/42850792
comment on: http://stackoverflow.com/a/27180606
score: 0
type: Comment
type: AnswerComment
has text: Thanks I will check that url... Mean time I just added 3 more Objects to the list as below, but now the final list contains duplicates... So seems like it is not working.... Student s7= new Student("Jim","Ind",28,102,"Marketing"); Student s8= new Student("Jim","Ind",28,102,"Marketing"); Student s9= new Student("Ants","Ind",29,102,"Marketing");

http://stackoverflow.com/comment/42915858
has text: Doing it that way still makes my exams array in choice2 not work. ` `for(int index = 0; index < studentNames.length; index++) { System.out.printf("%-10s",studentNames[studentNameIndex]); System.out.printf("%-5.1f",exams[examGradeIndex]); System.out.printf("%-5.1f",exams[examGradeIndex+1]); System.out.printf("%-5.1f",exams[examGradeIndex+2]);` This is only part of my code, the whole thing was too long for me to output in the comments. By going the way you suggested these exam arrays do not work. Any solutions?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27218069
type: Comment

http://stackoverflow.com/q/27231579
tagged with: java
has title: Cannot escape a quotation(") character when retriveing a string containg quotation inside a string from DB in jsp
has answer: http://stackoverflow.com/a/27231880
has comment: http://stackoverflow.com/comment/42940062
type: Question
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/42940386
score: 0
answer count: 2
tagged with: string
type: UnansweredQuestion
has body: I have saved quotation(") in a string using escape character i database. That is working ok. But when i am retrieving the value in a jsp field from database, the string is being ended at the first quotation it gets in the whole string. I am giving an example below: Lets take a string that i have stored in database as - " Hello David. This is a "customer"." Now, i am somehow need to save the string back from databse into a hidden field in a jsp page like below- &lt;input type="hidden" name="string_from_database" id="string_from_database" value="&lt;%=some varibale that holds the data from database%&gt;"&gt; issue is - Part of the string is getting exposed (means it is being written on top of the page) which i do not want. In this case,the below phrase is written on the beginning of the jsp page, which i don't want. customer". kindly suggest on how to resolve this issue.
tagged with: html-escape-characters
has answer: http://stackoverflow.com/a/27241562

http://stackoverflow.com/comment/42974144
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27249023
has text: @Ordous Oh, sorry. I forgot to include the code of PriorityQueue, which I implemented myself. I'll add it to the question right away.
score: 0

http://stackoverflow.com/comment/42892294
has text: You've [already posted this question](http://stackoverflow.com/questions/27195039/how-to-make-a-loop-to-print-the-following-pattern), and accepted the answer. Sure this pattern is slightly different, but the answer doesn't change much. You won't learn anything by letting people code every line for you. Experiment.
score: 4
comment on: http://stackoverflow.com/q/27204880
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43002548
type: Comment
type: QuestionComment
has text: yes `p` is not "handled" by spring
score: 1
comment on: http://stackoverflow.com/q/27265526

http://stackoverflow.com/comment/42986380
score: 0
has text: What is the expected output ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27256098

http://stackoverflow.com/a/27248416
has body: You should make the following change in your Controller's action: for(Category category : categories) { categoriesMap.put(category.geCategorytId(), category.getCategoryName()); } and in your view change: &lt;form:select path="category.categoryID" &gt; The select drop-down will have the category name as the display text and category ID as the value.
type: Answer
answers question: http://stackoverflow.com/q/27247955
has comment: http://stackoverflow.com/comment/42971393
score: 0

http://stackoverflow.com/q/27273220
has comment: http://stackoverflow.com/comment/43015922
tagged with: jsp
tagged with: jquery
has body: I am very new in JSP development and I have the following doubt. If into a JSP page I have 2 div like this: SUCCESS FAILURE and I have to show only one of these div according to the value of a status variable putted into the Http Session that can have only 2 value: OK and KO. Can I do something like this: <% if(request.getSession(false).getAttribute("status")=="OK"> { %> SUCCESS <% } %> <% else { %> FAILURE <% } %> It works? Is it ok? or there are some better way to achieve this task? (maybe can I do something like this using JavaScript\JQuery?)
has title: How conditionally show the content of a div rather than another div in a JSP page?
has comment: http://stackoverflow.com/comment/43016102
has comment: http://stackoverflow.com/comment/43016125
has comment: http://stackoverflow.com/comment/43016456
accepted answer: http://stackoverflow.com/a/27273380
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43015975
tagged with: jsp-tags
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/43016166
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27273380
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/27207918
downvote count: 1
has comment: http://stackoverflow.com/comment/42898735
has comment: http://stackoverflow.com/comment/42899980
type: Question
has title: Converting amazon data into csv format in java
linked to: http://stackoverflow.com/q/14226830
has comment: http://stackoverflow.com/comment/42897761
has comment: http://stackoverflow.com/comment/42900203
score: 0
has comment: http://stackoverflow.com/comment/42897831
has comment: http://stackoverflow.com/comment/42898986
favorite count: 0
has comment: http://stackoverflow.com/comment/42900640
has comment: http://stackoverflow.com/comment/42897847
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/42901516
has comment: http://stackoverflow.com/comment/42897930
has comment: http://stackoverflow.com/comment/42897790
answer count: 0
has comment: http://stackoverflow.com/comment/42897779
has body: I asked similar question before but haven't solved it yet. I have amazon review data set and would like to convert it into csv format in JAVA. The original data that I have look like as follows: product/productId: B00032K32A product/title: Cruiser Accessories 21330 Slim Rim, Chrome License Plate Frame product/price: 4.99 review/userId: A2O41UFL8HAQWV review/profileName: Nick Nefsik review/helpfulness: 4/4 review/score: 5.0 review/time: 1239667200 review/summary: It's slim, alright! review/text: Similar to another review, I also found that this frame is more of a overlay to a license plate (sits on top of the plate), as opposed to securing the plate underneath it, if that makes sense.It just covers the edges of my AZ plate, which is fine, but I sure wouldn't want it to be any smaller around its outside perimeter. I also ordered the chrome covers for the screws (Cruiser Accessories 82030 Screw Covers, Chrome) that I was already using, and, altogether, it looks great, and is exactly the look I was going for. product/productId: B00032K32A product/title: Cruiser Accessories 21330 Slim Rim, Chrome License Plate Frame product/price: 4.99 review/userId: A3V7H58BH72AYT review/profileName: Illustratedman review/helpfulness: 6/7 review/score: 5.0 review/time: 1199145600 review/summary: Nice... review/text: I first purchased these for my new 2008 Honda Accord EX-L to complement I want the output to be product id,title,price,userid,profileName,helpfulness,score,time,summary,text B00032k32A,Cruser accessories..,4.99,A3v7...,illustratedam,6/7,5.0,1199145600,nice..,i first purchased these fr my new ....... B00032k302X,Cruser accessories..,3.95,A3v7...,illustedam,2/7,4.0,1193445600,nice..,i first purchased these for my new ....... I have a pretty big data of 5GB. So i want to write to file. I am a newbee to java and tried several different ways but still haven't succeeded it yet. Are there anyone who has a good thought about converting the original data type into csv format? Thanks …
tagged with: java
has comment: http://stackoverflow.com/comment/42898002
has comment: http://stackoverflow.com/comment/42900252
has comment: http://stackoverflow.com/comment/42897958
upvote count: 1
has comment: http://stackoverflow.com/comment/42897827

http://stackoverflow.com/q/27228788
downvote count: 1
has title: What am I doing wrong with inheritance?
type: Question
has comment: http://stackoverflow.com/comment/42935025
tagged with: inheritance
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/42935643
has answer: http://stackoverflow.com/a/27228843
has answer: http://stackoverflow.com/a/27229028
has comment: http://stackoverflow.com/comment/42935144
favorite count: 0
tagged with: subclass
has answer: http://stackoverflow.com/a/27228830
accepted answer: http://stackoverflow.com/a/27228830
has body: I'm trying to write simple game to test some new features in Java. I have Class Monsters and there is int hp: public class Monsters { int hp; public Monsters() { } public Monsters(int hp) { this.hp = hp; } } And then I have two subclasses - a main hero HERO, and his oponent Devil. They also have int hp, because their life level is different: public class Devil extends Monsters { int hp = 200; } and HERO: public class HERO extends Monsters{ public HERO(int hp) { this.hp = hp; } } I'm trying to write fight(); method: public void fight(Monsters hero) { int heroLife = hero.hp; int opLife = hp; System.out.println(opLife + " - Devil's life\n" + heroLife + " - Hero's life"); } Ok, and now in main() class Game i'm testing their hp: public class Gra { public static void main(String[] args) { HERO hero = new HERO(5); Devil devil = new Devil(); devil.fight(hero); } } And here's my output: 0 - Devil's life 5 - Hero's life Why is it 0, not 200?
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/27228843
tagged with: java

http://stackoverflow.com/a/39198223
answers question: http://stackoverflow.com/q/27205256
score: 2
has body: Another possibility is to use the class CalendarWeek in my library Time4J. Example: CalendarWeek now = SystemClock.inLocalView().now(CalendarWeek.chronology()); int actual = now.getWeek(); // 35 on 2016-08-29 int max = now.getMaximum(CalendarWeek.WEEK_OF_YEAR); // 52 in year 2016 This class is also modelled as date interval and can be converted to a common DateInterval (from Monday to Sunday) offering stream support via its method toFlexInterval().
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/27222331
tagged with: if-statement
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42931475
has answer: http://stackoverflow.com/a/27222443
has comment: http://stackoverflow.com/comment/42936044
downvote count: 1
answer count: 1
tagged with: java-io
favorite count: 0
has title: How to specify which file to write to?
has body: I'm creating a program that takes the users input of currentSales, and if it's less than 1000 it goes to lowPerformer or more than 1000 goes to highPerformer.txt file. I'm stuck at the if statement. I'm not sure how I would code the program to tell the data what file to save to. Any assistance is appreciated. public class HighandLowSales { public static void main(String[] args) { Scanner input1 = new Scanner(System.in); Path highPerformer = Paths.get("C:\\Users\\C\\Desktop\\IS103 " + "Programming Logic\\Week7\\HighSales.txt"); Path lowPerformer = Paths.get("C:\\Users\\C\\Desktop\\IS103 Programming Logic\\" + "Week7\\LowSales.txt"); String delimiter = ","; String s; int id; String firstName; String lastName; double currentSales; final int QUIT = 999; try { Scanner input = new Scanner(System.in); OutputStream output = new BufferedOutputStream(Files.newOutputStream(highPerformer, CREATE)); OutputStream output1 = new BufferedOutputStream(Files.newOutputStream(lowPerformer, CREATE)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output)); BufferedWriter writer1 = new BufferedWriter(new OutputStreamWriter(output1)); System.out.print("Enter employee ID number &gt;&gt; "); id = input.nextInt(); while(id != QUIT) { System.out.print("Enter first name for employee #" + id + " &gt;&gt; "); input.nextLine(); firstName = input.nextLine(); System.out.print("Enter last name for employee # " + id + " &gt;&gt; "); input.nextLine(); lastName = input.nextLine(); System.out.print("Enter current month sales in whole dollar " + "for employee #" + id + " &gt;&gt; "); input.nextLine(); currentSales = input.nextDouble(); s = id + delimiter + firstName + delimiter + lastName + delimiter + currentSales; if (currentSales&gt;1000) writer.write(s); writer.newLine(); writer1.newLine(); System.out.print("Enter next ID number or " + QUIT + "to quit"); id = input.nextInt(); } writer.close(); } catch(Exception e) { System.out.println("Message: " + e); } } }
has comment: http://stackoverflow.com/comment/42934848
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42935966
type: Question
has comment: http://stackoverflow.com/comment/42936196
accepted answer: http://stackoverflow.com/a/27222443

http://stackoverflow.com/q/27213902
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/42908233
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27214102
has title: Arabic numerals to Roman and vice versa
tagged with: netbeans
tagged with: java
downvote count: 2
type: Question
score: -2
has comment: http://stackoverflow.com/comment/42908029
has body: I have to write a Java program to convert Arabic numerals into Roman and vice versa, but I have troubles with my code,can anybody show me on this example how it should realy look,because i have got no idea how it shoud look like( import java.util.*; public class Du3 { static int last = 2000; static int numbers[] = {1, 4, 5, 9, 10, 50, 100, 500, 1000 }; static String letters[] = { "I", "IV", "V", "IX", "X", "L", "C", "D", "M"}; public static void main (String[] args){ System.out.println("Enter your Roman Numerals or Integer number:"); Scanner cti = new Scanner(System.in); String a = cti.next(); char c = a.charAt( 0 ); char a1=convertRomanToInt(romanValue); if ( Character.isDigit( c ) ){ System.out.println("Roman value = " + integerValue);} else { System.out.println("Integer value = " + romanValue); } static int convertRomanToInt(String romanNumeral){ int integerValue = 0; for (int i = 0; i &lt; romanNumeral.length(); i++){ char ch = romanNumeral.charAt( i ); int number = letterToNumber( ch ); if ( number == -1){ throw new NumberFormatException("Invalid format"); } if (last&lt;number) number-=last- 1; integerValue += number; last = number; } return integerValue; } private static int letterToNumber(char letter){ switch (letter) { case 'I': return 1; case 'V': return 5; case 'X': return 10; case 'L': return 50; case 'C': return 100; case 'D': return 500; case 'M': return 1000; default: return -1; } } static String convertIntegerToRoman(int number){ String romanValue = ""; int N = number; while ( N &gt; 0 ){ for (int i = 0; i &lt; numbers.length; i++){ if ( N &lt; numbers[i] ){ N -= numbers[i-1]; romanValue += letters[i-1]; break; } } } return romanValue; } }
has comment: http://stackoverflow.com/comment/42908188
upvote count: 0
has comment: http://stackoverflow.com/comment/44729328
answer count: 1

http://stackoverflow.com/comment/42873431
type: QuestionComment
type: Comment
score: 1
has text: Does the actual exception e give any potential clues?
comment on: http://stackoverflow.com/q/27181887

http://stackoverflow.com/a/27266752
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27266608
has comment: http://stackoverflow.com/comment/43004755
has body: You should put this before: beanFactory.autowireBean(port); But, if you want to initialize a bean, I think that you want to create a single instance (I'm saying this because in the example, you used the @Bean annotation): beanFactory.initializeBean(port, "myDynamicPortName"); instead of a singleton one: beanFactory.registerSingleton("myDynamicPortName", port);
has comment: http://stackoverflow.com/comment/43004692
has comment: http://stackoverflow.com/comment/43004638
score: 4

http://stackoverflow.com/comment/134616403
has text: How to recognize if it's a barcode scanner with such mask? Any idea?
type: Comment
comment on: http://stackoverflow.com/a/57039561
type: AnswerComment
score: 0

http://stackoverflow.com/a/27182046
answers question: http://stackoverflow.com/q/27181739
upvote count: 1
has comment: http://stackoverflow.com/comment/42852236
has comment: http://stackoverflow.com/comment/42852752
has body: From the documentation: recv(buffersize[, flags]) -> data Receive up to buffersize bytes from the socket. For the optional flags argument, see the Unix manual. When no data is available, block until at least one byte is available or until the remote end is closed. When the remote end is closed and all data is read, return the empty string. So recv() can return fewer bytes than you ask for, which is what's happening in your case. There is discussion of this in the socket howto. Basically you need to keep calling recv() until you have received a complete message, or the remote peer has closed the connection (signalled by recv() returning an empty string). How you do that depends on your protocol. The options are: use fixed sized messages have some kind of delimiter or sentinel to detect end of message have the client provide the message length as part of the message have the client close the connection when it has finished sending a message. Obviously it will not be able to receive a response in this case. Looking at your Java code, option 4 might work for you because it is sending a message and then closing the connection. This code should work: s = socket.socket() host = socket.gethostname() # host = "192.168.0.20" port = 12345 s.bind((host, port)) s.listen(5) while True: c, addr = s.accept() # print 'Got connection from', addr message = [] chars_remaining = 8192 recv_buf = c.recv(chars_remaining) while recv_buf: message.append(recv_buf) chars_remaining -= len(recv_buf) if chars_remaining = 0: print("Exhausted buffer") break recv_buf = c.recv(chars_remaining) # print message message = ''.join(message).strip() ipAddress = addr[0]
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42880023
type: Answer
has comment: http://stackoverflow.com/comment/42853356

http://stackoverflow.com/comment/43077118
type: QuestionComment
comment on: http://stackoverflow.com/q/27306913
has text: Are you using Eclipse or Android Studio? Can you tell me what the minimum sdk version is? you can find it in the `Manifest.xml` file if you use Eclipse or in `Build.gradle` for Android Studio
score: 0
type: Comment

http://stackoverflow.com/comment/43015836
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27273088
score: 0
has text: Do you actually see multiple existing threads alive and only one running, or do the threads not spawn at all?

http://stackoverflow.com/comment/43016022
type: Comment
type: QuestionComment
score: 0
has text: Can you maybe provide the input that you use?
comment on: http://stackoverflow.com/q/27273088

http://stackoverflow.com/a/27208834
downvote count: 0
has comment: http://stackoverflow.com/comment/42964465
has comment: http://stackoverflow.com/comment/42996755
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27208807
has body: static void placeRandomly2D(int[][] arr, int limit) { // generates value [0...limit) half-interval and places it into the 2D array arr // at random position; limit must be positive Random rand = new Random(); int value = rand.nextInt(limit); int pos1 = rand.nextInt(arr.length); int pos2 = rand.nextInt(arr[pos1].length); arr[pos1][pos2] = value; } And, just in case, version for 1-dimensional array: static void placeRandomly1D(int[] arr, int limit) { // generates value [0...limit) half-interval and places it into the 1D array arr // at random position; limit must be positive Random rand = new Random(); int value = rand.nextInt(limit); int pos = rand.nextInt(arr.length); arr[pos] = value; }
answers question: http://stackoverflow.com/q/27208807
type: Answer
has comment: http://stackoverflow.com/comment/42900173

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/27276219
tags question: http://stackoverflow.com/q/27183292
type: Tag
tags question: http://stackoverflow.com/q/27284667

http://stackoverflow.com/q/27217352
type: UnansweredQuestion
tagged with: android
has body: I am writing an Android Application that is used for studying regulations. The application will read data from a database of 1000 questions and randomly select 20 questions for the practice exam. I have hard coded the information into the application (example below): Question q99=new Question("Cell phones / portable electronic devices may only be used in the presence of trainees when: ", "They can be used at any time", "Both C and D", "a training requirement warrents it", "in an emergency situation", "Both C and D", "Para 4.6.9.3.2.");//B this.addQuestion(q99); The constructor format is: Question("Question", "AnswerA", "AnswerB", "AnswerC", "AnswerD", "CorrectAnswer", "Reference"); As you can see, adding each question to the database is resulting in over 2000 lines of code just to populate the database. Do I need to keep this in the final publish of the application, or should I just write the database separately and include the database in the final release. DJ
tagged with: java
downvote count: 1
type: Question
tagged with: performance
score: -1
upvote count: 0
tagged with: sqlite
answer count: 1
has title: Android Applications: hard code data vs prewritten sqllite database
favorite count: 0
has answer: http://stackoverflow.com/a/27217385

http://stackoverflow.com/q/27293989
has answer: http://stackoverflow.com/a/27294091
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43053306
tagged with: java
score: 17
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27294062
has answer: http://stackoverflow.com/a/27294666
has comment: http://stackoverflow.com/comment/43053041
upvote count: 18
tagged with: delegates
has title: How to call a varargs method with an additional argument from a varargs method
tagged with: variadic-functions
favorite count: 0
accepted answer: http://stackoverflow.com/a/27294062
has answer: http://stackoverflow.com/a/27303503
possible better answer: http://stackoverflow.com/a/27294091
has body: I have some varargs system function, where T is some actual type, like String: sys(T... args) I want to create own function, which delegates to the system function. My function is also a varargs function. I want to pass through all the arguments for my function through to the system function, plus an additional trailing argument. Something like this: myfunc(T... args) { T myobj = new T(); sys(args, myobj); // &lt;- of course, here error. } How do I need to change the line with the error? Now I see only one way: create array with dimension [args] + 1 and copy all items to the new array. But maybe there exists a more simple way?
answer count: 4

http://stackoverflow.com/q/27177631
tagged with: java
tagged with: file
has body: I am trying to read a hexadecimal file from java code. All I want is pick the hex values and save it in a String (or any other format) , without convert them. I've already tried with a BufferedReader, and saving the values in a StringBuilder, but I don't know why the values are automatically converted in decimal values when I use StringBuilder.toString() method. Any suggestion ?
type: Question
has answer: http://stackoverflow.com/a/27177756
accepted answer: http://stackoverflow.com/a/27177756
score: 0
has title: Reading hex files keaping hex values in java
answer count: 1
has comment: http://stackoverflow.com/comment/42844144
has comment: http://stackoverflow.com/comment/42844203
tagged with: hex
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2817752

http://stackoverflow.com/comment/42994019
type: Comment
score: 0
has text: What does output.jar do, I hope it does not write to A.java.
comment on: http://stackoverflow.com/q/27260401
type: QuestionComment

http://stackoverflow.com/comment/43023138
type: QuestionComment
has text: @LuiggiMendoza isn't the case of marking the question dup?
comment on: http://stackoverflow.com/q/27277089
score: 0
type: Comment

http://stackoverflow.com/comment/42904270
has text: Just disassemble and look by yourself. What's the problem?
comment on: http://stackoverflow.com/q/27211549
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42960226
type: QuestionComment
has text: @okiharaherbst machine-learning on this site has been tagged 5000 times. Most of the questions have no code in them. So, I don't see why it won't fit. What I do notice as a 5 year member on this site, with all due respect, is that, these days there are too many people on this forum who are eager to downvote questions - and everytime I ask a question I end up writing a justification like this. And, I've asked close to 120 questions.
type: Comment
comment on: http://stackoverflow.com/q/27234539
score: 0

http://stackoverflow.com/q/27281410
tagged with: signal-processing
type: Question
has comment: http://stackoverflow.com/comment/43031626
has title: findpeaks with minimum distance in java
has body: Has anyone tried to implement findpeaks function in matlab with minimum distance between them in java? or can you explain me the working of it. I was trying out the examples in matlab a = Columns 1 through 5 1.0000 2.0000 3.0000 1.0000 2.0000 Columns 6 through 10 3.0000 1.0000 1.0000 2.0000 0.1000 Columns 11 through 15 0.1000 0.1000 0.3000 0.2000 1.0000 Column 16 2.0000 findpeaks(a,'MINPEAKDISTANCE',2) ans = 3 3 2 How is this working?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/55756591
tagged with: matlab
answer count: 0
score: 0
tagged with: java

http://stackoverflow.com/a/27616274
answers question: http://stackoverflow.com/q/27177429
downvote count: 0
has body: If you can go the annotation way you can implement a custom annotation with a (required) element. Elements that do not have a default value are required. For instance look at the following annotation: public @interface Deprecated { String version(); //In which version this was deprecated? String reason() default "[not documented]"; } Here version is a required field, while you can omit the reason field when annotating something. For more information, you can look at this tutorial: http://howtodoinjava.com/2014/06/09/complete-java-annotations-tutorial/
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27177429
score: 2

http://stackoverflow.com/q/27262998
has comment: http://stackoverflow.com/comment/42998670
answer count: 1
tagged with: websocket
tagged with: javascript
accepted answer: http://stackoverflow.com/a/27263223
score: 0
has body: [deprecated] ok I'm opening a connection to a specific port, and keeping it open therefore I cannot open a second connection to the same port. Seeing that it took me too long to find the answer, I'm going to leave this question. I would like to know if I can have more than one instance of a websocket running in the same webpage. I'm building an application just for learning , and I would like to display in the same page the notifications and a separated notification box. I'm creating the websocket in java ,i m using the struts 2 framework, and javascript for handling the client side. &lt;script language="javascript" type="text/javascript"&gt; var wsPath = "&lt;s:url value='/websocket' /&gt;" + isComment + id; var wsUri = "ws://" + window.location.host + wsPath; var websocket = new WebSocket(wsUri); I'm going to try creating a secondary "set" of functions and a new instance of the same websocket class to have something like this: websocket.onopen = function(evt) { onOpen(evt) }; websocketnotifications.onopen = function(evt) { onOpenNotifications(evt) }; I would like to know if this is the normal way to do it or if there is a better way. Because I'm not finding any other solution, and I would like to implement it in the right way.
has comment: http://stackoverflow.com/comment/42998629
has title: Multiple websockets java
has answer: http://stackoverflow.com/a/27263223
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42998513
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42998587

http://stackoverflow.com/comment/43333603
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27312646
has text: This answer specifically, but to do the same thing in a GET and POST sounds like a weird idea... http://stackoverflow.com/a/13408147/609176
type: Comment

http://stackoverflow.com/a/27312058
answers question: http://stackoverflow.com/q/27311561
type: Answer
has body: You must remove the unchecked cast: String valueAsString = value.toString(); if (i == 1) { testButton.setText(valueAsString); }
score: 0

http://stackoverflow.com/a/27211889
score: 3
answers question: http://stackoverflow.com/q/27211388
downvote count: 0
has body: Preferably you would use the key bindings API for each component, you can use the key bindings to change the level of focus required to trigger the given action, for example, for when the component has focus, when the component is a child of a focused component or when it is contained within the focused window... See How to Use Key Bindings for more details
type: Answer
upvote count: 3

http://stackoverflow.com/comment/139527575
comment on: http://stackoverflow.com/a/27153249
score: 0
type: Comment
has text: This saved my day,@lainatnavi!
type: AnswerComment

http://stackoverflow.com/q/27195693
favorite count: 0
has answer: http://stackoverflow.com/a/27195723
type: UnansweredQuestion
upvote count: 2
tagged with: java
downvote count: 3
type: Question
score: -1
has body: I saw a way to calculate the product of odd numbers from 1 to 15 using a for loop on here a few days ago: int product = 1; for(int count = 1; count &lt;= 15; count++){ if (count % 2 != 0) product = product * count; } Is it possible to convert it into a do-while loop?
answer count: 2
has answer: http://stackoverflow.com/a/27195725
tagged with: while-loop
has comment: http://stackoverflow.com/comment/42876509
has title: Convert a for loop to a do-while loop

http://stackoverflow.com/comment/42837812
type: AnswerComment
has text: logically it's a valid regex But I don't know why Eclipse is giving no results. Also, please take a look at my question I've edited it :)
comment on: http://stackoverflow.com/a/27173896
type: Comment
score: 0

pattern-matching
tags question: http://stackoverflow.com/q/27249016
type: Tag
tag name: pattern-matching

http://stackoverflow.com/a/27275002
answers question: http://stackoverflow.com/q/27273499
has comment: http://stackoverflow.com/comment/43020544
score: 0
has comment: http://stackoverflow.com/comment/43024093
type: Answer
has body: I'm not sure I understand what you want exactly, but in Java I remember that I could launch multiple JVM and run my java programs on different OS processes, using inter-processes communication (socket, pipe or whatever you want) to do multi-core processing and syncronization. Knowing that, it might be possible to then set a process (whole JVM) exclusively on a core. You can get the PID of the JVM.

http://stackoverflow.com/a/27238349
answers question: http://stackoverflow.com/q/27238307
has body: Scanner scan = new Scanner(...); String val = scan.nextLine(); This would set the delimiter as the newline.
has comment: http://stackoverflow.com/comment/95368680
type: Answer
upvote count: 2
score: 0
downvote count: 2

http://stackoverflow.com/comment/139976920
type: AnswerComment
comment on: http://stackoverflow.com/a/27284757
type: Comment
has text: It's not just an issue of terminology (English). MD5 is a hashing algorithm. While there are some situations where passwords should be hashed, hashing is very different from encryption, in that the hashed data is not recoverable. So if we're trying to pass sensitive information from one place to another, hashing will not help unless you really don't need the information to be preserved.
score: 0

http://stackoverflow.com/comment/42802451
score: 0
type: Comment
type: QuestionComment
has text: Oh, type erasure. Fun stuff. nvm.
comment on: http://stackoverflow.com/q/27153731

http://stackoverflow.com/comment/42972211
score: 0
type: Comment
type: QuestionComment
has text: I know this is for PHP but you should read it: http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
comment on: http://stackoverflow.com/q/27248815

http://stackoverflow.com/q/27246575
tagged with: ant
has answer: http://stackoverflow.com/a/27247193
has body: I am a beginner programmer, so please co-operate if I am asking very basic questions. Actually I want to add some additional features in an open-source software. So I made necessary changes to one of the ".java" file that came with the source code and now I want to make a ".jar" executable for it. So I came to know that I must use ANT for it to automate this process. But when I run the ANT script on "build.xml" provided with the source code, I get the same compilation errors "symbol not found.." many times and the build failed. I asked this question yesterday here and I get to know that this is because of CLASSPATH problems. Now I researched and get to know how to handle the CLASSPATH with JAVAC on command line but I do not know how to handle it with ANT. So please guide me how should I proceed, I actually want to compile the entire Source Code Tree and make a ".jar" executable for it.
answer count: 2
has answer: http://stackoverflow.com/a/27247358
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has title: How to make a .jar executable for source code tree using ANT
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/27205630
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: The recursive calls are blocking the Event Dispatch Thread. You have to create a new Thread to not block the EDT. public void playMet() { Thread t = new Thread(new Runnable() { @Override public void run() { while(Play.isSelected()){ //Your code } } }; t.start(); }
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27205368
answers question: http://stackoverflow.com/q/27205368

http://stackoverflow.com/q/27195029
type: Question
has title: Java - How to impliment swing timer that clears a text field after 5 seconds?
has comment: http://stackoverflow.com/comment/42875470
has comment: http://stackoverflow.com/comment/42875627
score: 0
has comment: http://stackoverflow.com/comment/42875841
has comment: http://stackoverflow.com/comment/42875947
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13503788
answer count: 0
tagged with: java
has body: I know im supposed to user a time, but am not sure how to implement it. I tried looking online, but I couldn't find anything relating to clearing a text field. Could someone show me how this is done.

http://stackoverflow.com/a/27272767
has comment: http://stackoverflow.com/comment/43016422
answers question: http://stackoverflow.com/q/27272542
upvote count: 3
has body: Try the following loop using Regex: String name=""; while(!name.matches("[a-zA-Z \'\-ÄäÖöÜüßÉéæø]+")){ System.out.println("Please enter the student name: "); name = s.nextLine(); } This will ask for the user input, until a valid name is given.
has comment: http://stackoverflow.com/comment/43015443
type: Answer
has comment: http://stackoverflow.com/comment/43016177
score: 3
has comment: http://stackoverflow.com/comment/43015323
downvote count: 0

http://stackoverflow.com/q/27171629
answer count: 1
favorite count: 0
has title: Get access token using spring social facebook api
has answer: http://stackoverflow.com/a/27387192
tagged with: facebook
has body: I need to get the access token from Spring Social API in order to do operations Which the API doesn't provide. for example push message to the client notification icon. I followed spring social facebook via Spring offical doc: https://github.com/spring-guides/gs-accessing-facebook How to use the API in order to get the access token string? thanks.
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27387192
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: spring-social
downvote count: 0
tagged with: spring-social-facebook

http://stackoverflow.com/comment/42935749
type: AnswerComment
has text: Again, the download of the applet is done by the browser and thus is not affected by the settings for Java. These settings are relevant for network activity done by the Java applet itself. And yes, if the client can TLS 1.0..1.2 and the server can do only TLS 1.0 then the server will accept TLS 1.2 request but reply with TLS 1.0 and the rest of the connection will be done with TLS 1.0.
type: Comment
comment on: http://stackoverflow.com/a/27227099
score: 0

http://stackoverflow.com/a/27167106
has body: Your source files (or jars you use) were compiled with a higher javac version than what you use to run your server with. Possible solutions: either recompile your sources targeting the java version you run your server with or install the required new java version on your server and run your webapp with that.
answers question: http://stackoverflow.com/q/27166992
type: Answer
score: 0

http://stackoverflow.com/a/27264048
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27263564
answers question: http://stackoverflow.com/q/27263564
type: Answer
has comment: http://stackoverflow.com/comment/43000463
score: 2
has body: an int is 4 bytes so say your file contains the numbers 1... 20 The the raf.length is 80 (not 20) i.e. 4* 20 You have the right lines, but need to work in terms of 4 your high value in this case is 79 rather than 76 (using example above) so high should be length - 4 you can try: low = 0; long high = (raf.length() / 4) - 1 // this is in terms of elements long mid = (low + high) / 2 ... again element rather than where in byte array raf.seek(mid * 4) // You can use the *4 to access the correct location in bytes cur = raf.readInt() if(target &lt; cur){ high = mid - 1; } else if(target == cur){ targetFound = true; break; } else{ low = mid + 1; }

http://stackoverflow.com/a/27216419
has comment: http://stackoverflow.com/comment/42914874
has comment: http://stackoverflow.com/comment/42923082
has comment: http://stackoverflow.com/comment/42921219
answers question: http://stackoverflow.com/q/27208476
score: 0
type: Answer
has body: try this: ArrayList&lt;Integer&gt; ballexplode=new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; list.size()-1; i++) { for (int j=i+1; j &lt; list.size();j++){ if (Math.sqrt(Math.pow(list.get(i).getCenterX() - list.get(j).getCenterX(), 2) + Math.pow(list.get(i).getCenterY() - list.get(j).getCenterY(), 2)) &lt;= 2 * radius) { list.get(i).getCircle(); ballexplode.add(i); ballexplode.add(j); } } } for (int i=ballexplode.size()-1;i&gt;=0;i--){ getChildren().remove(ballexplode.get(i)); list.get(ballexplode.get(i)).getCircle(); }
has comment: http://stackoverflow.com/comment/42922098
has comment: http://stackoverflow.com/comment/42924455
has comment: http://stackoverflow.com/comment/42913261
has comment: http://stackoverflow.com/comment/42925179

http://stackoverflow.com/q/27310018
has comment: http://stackoverflow.com/comment/43081354
tagged with: javascript
has answer: http://stackoverflow.com/a/27310656
has answer: http://stackoverflow.com/a/27311636
has answer: http://stackoverflow.com/a/27310072
has body: Add Comment In the conversation field,after Add Comment the page redirects to the next page..how it will be fixed on the same page..??
has title: How to redirect to the same page after comment
score: 0
has answer: http://stackoverflow.com/a/27310178
has comment: http://stackoverflow.com/comment/43082196
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/43082102
tagged with: java
type: Question

http://stackoverflow.com/a/27267591
score: 1
has body: Documentation of Scanner.next() method says 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 method may block while waiting for input to scan, even if a previous invocation of {@link #hasNext} returned true. So it would just pick up until it finds " " as delimiter in your case. You could use next line method on scanner to get whole string new_dvd_info.nextLine() alternatively you could just loop over like: while(scanner.hasNext) { //append to string using scanner.next(); }
upvote count: 1
answers question: http://stackoverflow.com/q/27267477
type: Answer
downvote count: 0

http://stackoverflow.com/comment/96573431
score: 0
type: Comment
type: QuestionComment
has text: Can you please post some of the related code? Is there any place where you passed an object between two activities or as parameters?
comment on: http://stackoverflow.com/q/27242746

http://stackoverflow.com/comment/42807080
comment on: http://stackoverflow.com/a/27156237
has text: i can't test it now but i think that will solve my problem thanks a lot ( if in fact it solve i will upvote your sugestion )
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27165052
has comment: http://stackoverflow.com/comment/42822489
has body: I think you are looking something like: &lt;code&gt; LinkedList&lt;String&gt; linkedlist = new LinkedList&lt;String&gt;(); // add 5 elements linkedlist.add("Item1"); linkedlist.add("Item2"); linkedlist.add("Item3"); linkedlist.add("Item4"); linkedlist.add("Item5"); System.out.println("List =["+linkedlist+"]"); /*Add First*/ linkedlist.addFirst("Item0"); System.out.println("List =["+linkedlist+"]"); //Add Last linkedlist.addLast("Item6"); System.out.println("List =["+linkedlist+"]"); //Add second linkedlist.add(1, "Item02"); System.out.println("List =["+linkedlist+"]"); linkedlist.removeFirst(); linkedlist.remove(1); // remove 3rd linkedlist.removeLast(); System.out.println("List =["+linkedlist+"]"); &lt;/code&gt;
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27164711
score: 0

http://stackoverflow.com/comment/42822066
comment on: http://stackoverflow.com/q/27164693
score: 0
type: Comment
type: QuestionComment
has text: I have an application to read the PST files. The application could not read the pst file which is access in some other application. If I use the above code, the application could not read the pst file.The application can read once after restart the system.

drag-and-drop
tags question: http://stackoverflow.com/q/27224290
tag name: drag-and-drop
tags question: http://stackoverflow.com/q/27245283
tags question: http://stackoverflow.com/q/27176296
type: Tag

http://stackoverflow.com/q/27278537
has body: I'm creating a search interface using UNION in multiple tables, whenever I search for a word the app closes and the error says that there no such tablename, although there is. I don't know what is wrong with my code. Here is my code. @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub if (searchText.getText().toString().length() &gt; 0) { cursor = db.rawQuery("SELECT _id AS _id, name AS name, desc AS desc FROM comm_acc WHERE name LIKE ? " + "UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_filems WHERE name LIKE ? " + "UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_psu WHERE name LIKE ? " + "UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_shells WHERE name LIKE ? " + "UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_sic WHERE name LIKE ? " + "UNION SELECT _id AS _id,name AS name, desc AS desc FROM comm_stp WHERE name LIKE ?", new String[]{searchText.getText().toString() + "%" }); adapter = new SimpleCursorAdapter( getActivity(), R.layout.search_command_list_item, cursor, new String[] {"name", "desc"}, new int[] {R.id.commandName, R.id.commandDesc}, 0); setListAdapter(adapter); } else { } } }); } Here is my logcat 12-04 01:19:47.145: E/SQLiteLog(19154): (1) no such table: comm_stp 12-04 01:19:47.177: E/AndroidRuntime(19154): FATAL EXCEPTION: main 12-04 01:19:47.177: E/AndroidRuntime(19154): android.database.sqlite.SQLiteException: no such table: comm_stp (code 1): , while compiling: SELECT _id AS _id, name AS name, desc AS desc FROM comm_acc WHERE name LIKE ?1 UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_filems WHERE name LIKE ?1 UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_psu WHERE name LIKE ?1 UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_shells WHERE name LIKE ?1 UNION SELECT _id AS _id, name AS name, desc AS desc FROM comm_sic WHERE name LIKE ?1 UNION SELECT _id AS _id,name AS name, desc A…
has answer: http://stackoverflow.com/a/27279034
has title: No such table: tablename. - Android Eclipse
has comment: http://stackoverflow.com/comment/43025984
tagged with: java
tagged with: eclipse
type: Question
score: 0
tagged with: android
tagged with: sqlite
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/27308454
has answer: http://stackoverflow.com/a/27308665
score: 0
answer count: 2
has title: In Android, How to check if my params contains the value image
type: UnansweredQuestion
tagged with: android
tagged with: conditional-statements
has body: In Android, How to check if my params contains the value image here is the params output : ["image=fdfdsgdg5dsgd1s211511", "id=dfd4f5d4f5d", "api_id=f4f54f5d454df"] Code: public String getQueryString(List&lt;NameValuePair&gt; params) { Log.d(TAG, "getQueryString - params =&gt; " + params); String queryString = ""; Iterator&lt;NameValuePair&gt; itr = params.iterator(); while(itr.hasNext()) { NameValuePair nvp = itr.next(); //TODO if .... try { if(Arrays.asList(params).contains("image")) { Log.w(TAG, "if(Arrays.asList(params).contains('image'))"); break; }
tagged with: java
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/27308558
tagged with: arrays
has comment: http://stackoverflow.com/comment/43079142

http://stackoverflow.com/q/27165499
has answer: http://stackoverflow.com/a/27165767
answer count: 1
downvote count: 0
has title: Convert MD5 messageDigest from Java to Digest::MD5 Ruby
favorite count: 0
tagged with: ruby
type: UnansweredQuestion
has body: I want to use Digest::MD5 on ruby like a java code. This is the java code: public static String MD5Encode(String input, String salt) { try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); byte[] hash = null; try { messageDigest.update(salt.getBytes("UTF-8")); messageDigest.update(input.getBytes("UTF-8")); hash = messageDigest.digest(); } catch (UnsupportedEncodingException exception) { logger.error("MD5Encoder:Encode:" + exception.toString()); } if (hash != null) { StringBuilder output = new StringBuilder(2 * hash.length); for (byte b : hash) { output.append(String.format("%02x", b &amp; 0xff)); } return output.toString(); } } catch (NoSuchAlgorithmException exception) { logger.error("MD5Encoder:Encode:" + exception.toString()); } return null; } and this is the ruby code, but the result is not right: (the input variable in java is the password variable on ruby, and the salt variable is the same on both) salt = SecureRandom.hex if (params[:gamestate_password] != "") password = Digest::MD5.hexdigest(params[:gamestate_password] + salt) user_query = "UPDATE user_v54 SET password= '#{password}', passwordSalt= '#{salt}' WHERE userId='#{params[:userId]}'" end
score: 1
tagged with: java
upvote count: 1
tagged with: ruby-on-rails
has comment: http://stackoverflow.com/comment/42823136
type: Question

http://stackoverflow.com/q/27311256
tagged with: servlets
score: 0
has body: I want to display Username or password incorrect message in a particular in the Login page. Here is my login.html code. Login Login Here is my servlet code protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); RequestDispatcher rd=request.getRequestDispatcher("/login.html"); out.println(" "); rd.include(request, response); } The message is not displaying in the in login file
has answer: http://stackoverflow.com/a/27312361
has answer: http://stackoverflow.com/a/67216502
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/27312361
answer count: 4
has answer: http://stackoverflow.com/a/51302909
type: AnsweredQuestion
tagged with: java
has title: Display password error message in login page itself using servlet
has comment: http://stackoverflow.com/comment/43084692
possible better answer: http://stackoverflow.com/a/27311387
type: Question
has answer: http://stackoverflow.com/a/27311387
has comment: http://stackoverflow.com/comment/43083892
has comment: http://stackoverflow.com/comment/43083557
tagged with: javascript

http://stackoverflow.com/comment/42918416
score: 1
has text: You need to split the sentence into words first, before you apply the Pig Latin rules. You should look into String#split.
comment on: http://stackoverflow.com/q/27219609
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27158306
has comment: http://stackoverflow.com/comment/42810849
score: 1
answers question: http://stackoverflow.com/q/27158206
has comment: http://stackoverflow.com/comment/42810931
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42810693
has comment: http://stackoverflow.com/comment/42811534
type: Answer
has body: Little more concise and better will be public boolean removeAuthorByName(String authorName){ int index = authors.indexOf(authorName); if(index &gt; -1){ authors.remove(index); return true; } return false; }

http://stackoverflow.com/a/27183481
has body: try to dump the stack trace on file system instead of email... may be your whole application is crashing or may be you should post the code of SendCode(socket) that function might be locking some resources that are not released in 30 sec i.e. before the next function call is made
answers question: http://stackoverflow.com/q/27183292
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42898799
has text: At least add _some_ sort of explanation.
comment on: http://stackoverflow.com/a/27208453
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/42830821
type: Comment
comment on: http://stackoverflow.com/a/27169507
type: AnswerComment
has text: agree about that, mby i didn't explain my thoughts correctly. what i meant was treating records with no numbers as the first ones in the sort. i know the op wanted it in this format, but i was wondering for something like [abc, some, 1some, 2some, 3some, 20some, 21some], so considering 0 where no number is present. If i change your code to return (object1).compareTo("0"+object2); in the second if (!m.find()) it has my desired behaviour. Upvote because it helped me get a solution for my needs :)
score: 0

http://stackoverflow.com/q/27160943
answer count: 1
tagged with: paintcomponent
favorite count: 0
tagged with: swing
upvote count: 4
has answer: http://stackoverflow.com/a/27161088
accepted answer: http://stackoverflow.com/a/27161088
has title: Why isn't the ENTIRE JPanel repainting?
has comment: http://stackoverflow.com/comment/42815961
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42816834
tagged with: java
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/42815760
tagged with: graphics
has comment: http://stackoverflow.com/comment/42815901
has comment: http://stackoverflow.com/comment/42815520
score: 4
has comment: http://stackoverflow.com/comment/42816685
has body: Why is it in Java that when I try to move my window from the side of the screen to the center, then entire JPanel doesn't repaint it self? Example: This is what happened when I tried to drag the window from the side of the screen (so only about half of the window was visible) to the center: If I add a component listener and then put repaint() in the componentMoved method, it will work fine, but then it will repaint every time the window is moved. Relevant code: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import javax.swing.JFrame; import javax.swing.JPanel; public class TEST extends JFrame { public TEST() { super ("TEST!"); setSize (500,400); setLocationRelativeTo(null); setContentPane(new MyPanel()); addComponentListener(this); } class MyPanel extends JPanel { public void paintComponent (Graphics g) { super.paintComponent(g); Graphics g2d = (Graphics2D) g; int R = (int)(Math.random()*256); int G = (int)(Math.random()*256); int B= (int)(Math.random()*256); Color color = new Color(R, G, B); g2d.setColor(color); g2d.fillOval(0, 0, getWidth(), getHeight()); } } public static void main (String[] args) { TEST t = new TEST(); t.setVisible(true); } }
has comment: http://stackoverflow.com/comment/42816310

http://stackoverflow.com/comment/42968322
comment on: http://stackoverflow.com/a/27229327
type: AnswerComment
score: 0
type: Comment
has text: @ahbay sachu, check the link out. There are also code samples. If you want to have complete program, you will have to read through it and apply the code. [http://www.ase.md/~aursu/ClientServerThreads.html]

apache
tag name: apache
tags question: http://stackoverflow.com/q/27201605
tags question: http://stackoverflow.com/q/27203801
tags question: http://stackoverflow.com/q/27273691
tags question: http://stackoverflow.com/q/27295570
tags question: http://stackoverflow.com/q/27221227
tags question: http://stackoverflow.com/q/27159398
tags question: http://stackoverflow.com/q/27155887
tags question: http://stackoverflow.com/q/27209863
tags question: http://stackoverflow.com/q/27302843
tags question: http://stackoverflow.com/q/27253757
tags question: http://stackoverflow.com/q/27182991
tags question: http://stackoverflow.com/q/27268572
tags question: http://stackoverflow.com/q/27201505
tags question: http://stackoverflow.com/q/27164036
tags question: http://stackoverflow.com/q/27185419
tags question: http://stackoverflow.com/q/27289443
type: Tag
tags question: http://stackoverflow.com/q/27228907
tags question: http://stackoverflow.com/q/27265953
tags question: http://stackoverflow.com/q/27244937
tags question: http://stackoverflow.com/q/27286420
tags question: http://stackoverflow.com/q/27310992
tags question: http://stackoverflow.com/q/27176208
tags question: http://stackoverflow.com/q/27234250

http://stackoverflow.com/comment/42924342
type: QuestionComment
comment on: http://stackoverflow.com/q/27222771
has text: File fJsonFile = new 'File("C:\\Users\\Ashish\\Desktop\\filename.json");' should be within the try block. already tried that didn't work
score: 0
type: Comment

http://stackoverflow.com/comment/43004047
type: AnswerComment
comment on: http://stackoverflow.com/a/27266330
has text: Exactly, you shouldn't use it because it has problems. However it's unlikely that it would be removed (even though in theory it could be). It would cause more harm than benefit.
score: 0
type: Comment

http://stackoverflow.com/a/27302047
has body: You should use a ListView with a custom View and an Adapter, refer to this http://developer.android.com/reference/android/widget/Adapter.html A Listview, because you can have 2 or 40 players. a Custom View (in XML) so you can customize the fields / imageView / others the Adapter "fills" the Custom View and put into the ListView http://www.piwai.info/android-adapter-good-practices/
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43075547
score: 3
accepted answer of: http://stackoverflow.com/q/27301539
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27301539

http://stackoverflow.com/a/27169398
answers question: http://stackoverflow.com/q/27168750
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: The problem is that your print debugging actually consumes all the results, leaving the ResultSet at the end. There are no more results available when you try to output it as RDF/XML. You can fix it by making the ResultSet rewindable: ResultSetRewindable result = ResultSetFactory.makeRewindable( rmParliament.selectQuery(select) ); System.out.println(ResultSetFormatter.asText(result)); result.reset(); // back to the start ResultSetFormatter.outputAsRDF(System.out, "RDF/XML", result);
has comment: http://stackoverflow.com/comment/42830822
accepted answer of: http://stackoverflow.com/q/27168750

oop
tags question: http://stackoverflow.com/q/27241144
tags question: http://stackoverflow.com/q/27240075
tags question: http://stackoverflow.com/q/27237909
tags question: http://stackoverflow.com/q/27210462
tags question: http://stackoverflow.com/q/27158546
tags question: http://stackoverflow.com/q/27251526
tags question: http://stackoverflow.com/q/27255915
tags question: http://stackoverflow.com/q/27264255
tags question: http://stackoverflow.com/q/27209374
tag name: oop
tags question: http://stackoverflow.com/q/27208062
tags question: http://stackoverflow.com/q/27305092
tags question: http://stackoverflow.com/q/27201039
tags question: http://stackoverflow.com/q/27175147
tags question: http://stackoverflow.com/q/27237646
tags question: http://stackoverflow.com/q/27219968
tags question: http://stackoverflow.com/q/27302747
tags question: http://stackoverflow.com/q/27284794
tags question: http://stackoverflow.com/q/27306151
tags question: http://stackoverflow.com/q/27243653
tags question: http://stackoverflow.com/q/27223090
tags question: http://stackoverflow.com/q/27200373
tags question: http://stackoverflow.com/q/27234399
tags question: http://stackoverflow.com/q/27201210
tags question: http://stackoverflow.com/q/27294442
tags question: http://stackoverflow.com/q/27161375
tags question: http://stackoverflow.com/q/27186498
tags question: http://stackoverflow.com/q/27218014
tags question: http://stackoverflow.com/q/27164542
tags question: http://stackoverflow.com/q/27157928
tags question: http://stackoverflow.com/q/27230677
tags question: http://stackoverflow.com/q/27157622
tags question: http://stackoverflow.com/q/27199423
type: Tag

http://stackoverflow.com/q/27190393
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42870433
favorite count: 0
tagged with: jogl
type: UnansweredQuestion
has title: Load obj files and draw other figures inside a cube with size 1 - java opengl
downvote count: 1
tagged with: opengl
tagged with: java
score: -1
tagged with: opengl-3
has answer: http://stackoverflow.com/a/27196750
type: Question
has body: I have to use JOGL to draw some figures and load objs from a file in order to implement some projections and rotations. What I have now is a canvas with 4 viewports and inside of each is a teaPot, drawn with: GLUT glu = new GLUT() ; gl.glMatrixMode(GL_MODELVIEW); gl.glLoadIdentity(); glu.glutWireCube((float) 1.0); glu.glutWireTeapot((float) 1.0); The cube that is in the code above is to give a perspective of what the size should the teapot have. What I want and have to do is to scale the teapot to be always inside of the cube with size 1. I have some idea to use scale and translate methods but I'm having some trouble. The scale is to make the size of teapot and the translate to put the teapot in the center. I don't know if I'm explaining the problem in the best way. But the general idea is to load the object from the file directly to the center of a bounding box, and this bounding box is a cube with size 1. Thanks.

http://stackoverflow.com/a/27177884
type: Answer
answers question: http://stackoverflow.com/q/27177807
score: 0
has body: Use interface : import java.sql.Connection; import java.sql.Statement; Remove import com.mysql.dbc.statement etc...
has comment: http://stackoverflow.com/comment/42846587

http://stackoverflow.com/q/27178810
tagged with: java
type: Question
tagged with: spring-amqp
tagged with: amqp
downvote count: 0
has title: Spring AMQP Multiple Vhosts
answer count: 1
has body: I currently need to utilize three vhosts for this application. I am only receiving messages over one as a consumer, and the others for RPC calls. Currently I am using CachingConnectionFactory that I have subclassed one for each virtual host. Then I am making each of those subclasses beans. I can then of course grab the connection factory to create the RabbitTemplate for the correct vhost instance. I saw in the documentation about the AbstractRoutingConnectionFactory but wanted to know if there are any reasons I should refactor my currently working code. I want the most maintainable and perfomant solution, not the "easiest" one. Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/27181039
upvote count: 2
type: UnansweredQuestion
tagged with: spring
tagged with: rabbitmq
score: 2

http://stackoverflow.com/a/27266327
has body: Based on your path the file should be located starting from the root of your partition. For example if you are using windows it would be C:/WordNet-JWI/3.0/dict/ if you are running the webapp on C: Mind that on unix the "user" running the Tomcat process must have r/w permission on that folder. Regards.
answers question: http://stackoverflow.com/q/27230727
score: 0
type: Answer

http://stackoverflow.com/q/27298939
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43062356
tagged with: resultset
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27300304
score: 1
tagged with: java
has title: JAVA MYSQL prepared statement giving empty resultset even though query works in mysql admin
tagged with: mysql
upvote count: 1
tagged with: prepared-statement
has body: I know there are many questions like this already. I've been stuck on this all day. I'm running a query with a prepared statement from Java to mysql. It throws an exception because it returns an empty result set even though when I run the same query on phpmyadmin it returns some rows. My code is as follows: public static Integer returnImportLog(String filename,String importLogs,int acc_id){ int id_out=0; ArrayList&lt;Integer&gt; ids = new ArrayList&lt;Integer&gt;(); try{ String myUrl = "jdbc:mysql://localhost:3307/blahblah"; Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection(myUrl,"root",""); String query2 = "SELECT DISTINCT `id` FROM `"+importLogs+ "` " + "WHERE `file`=? AND `acc_id`= ?"; PreparedStatement statement=conn.prepareStatement(query2); statement.setString(1,filename); statement.setInt(2,acc_id); //System.out.println(); ResultSet rs = statement.executeQuery(); if (rs.next()) { int user_id = rs.getInt("id"); ids.add(user_id); } id_out=(Integer)ids.get(0); conn.close(); statement.close(); rs.close(); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); e.printStackTrace(); } return id_out; It gives the following error: "Got an exception! Index: 0, Size: 0 ava.lang.IndexOutOfBoundsException: Index: 0, Size: 0 t java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at Details.returnImportLog(Details.java:277)" When I run the sql generated by the prepared statement SELECT DISTINCT id FROM pwc_import_logs WHERE file='11111Spanners.csv' AND acc_id= 1" on phpmyadmin MySQL I get the following result 2 results in the row. Any help would be much appreciated....its wrecking my head and i'm sure its something trivial
type: Question
has answer: http://stackoverflow.com/a/27299247
tagged with: database
accepted answer: http://stackoverflow.com/a/27300304
possible better answer: http://stackoverflow.com/a/27299247
answer count: 2

restful-architecture
type: Tag
tag name: restful-architecture
tags question: http://stackoverflow.com/q/27194540

http://stackoverflow.com/comment/43077135
comment on: http://stackoverflow.com/q/27307388
score: 0
type: Comment
type: QuestionComment
has text: Could you try to paste the code in correctly? It'll help us help you.

http://stackoverflow.com/comment/42815129
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27158949
score: 0
has text: It's IMO not *the* visitor pattern because you don't need the accept, then visit part, you can control that entirely from the outside https://gist.github.com/anonymous/a32a2c33cbb988b8bf99 - key difference to *the* visitor pattern IMO is that "the visitor pattern is a way of separating an algorithm from an object structure on which it operates" means that the algorithm is fixed, the data-structure is the one that changes. While here, the node structure is fixed and the visiting algorithm changes. Also the "Visitors and Iterators" section here http://www.oodesign.com/visitor-pattern.html

http://stackoverflow.com/q/27189785
has answer: http://stackoverflow.com/a/27189955
has body: I want to perform mvn -B release:clean release:prepare release:perform But as a concrete user. How do I provide credentials for him? I was already trying with specyfing username/password in .m2/settings.xml like that: user pass Here is a part of my pom.xml: scm:svn:https://myrepository.com/scm/svn/myapp/trunk/ release myapp org.apache.maven.plugins maven-release-plugin 2.5.1 https://myrepository.com/scm/svn/myapp/tags @{project.version}
upvote count: 1
answer count: 1
favorite count: 0
has title: Maven release another user credentials
type: UnansweredQuestion
tagged with: maven
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/42913852
comment on: http://stackoverflow.com/q/27216979
type: QuestionComment
has text: Another thing: `" where arrayer[z].length should display the name of the subject and increase depending on the number of subjects entered"` - you realize that `arrayer[z].length` is the _length_ of the string (and the call should be `length()` to compile) and thus can't "display the name", don't you?
score: 0
type: Comment

http://stackoverflow.com/comment/43005899
has text: explain the problem , what do you get? an error? request not sent, is it empty? ...
comment on: http://stackoverflow.com/q/27267266
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42971051
type: QuestionComment
comment on: http://stackoverflow.com/q/27248205
score: 0
has text: Does it return any error message/exception.Which mode you are running hibernate on i.e create or update
type: Comment

http://stackoverflow.com/comment/42982609
type: QuestionComment
has text: Why would you assume that bNotFinal is "at least as up to date" as the final reference to B?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27254152

http://stackoverflow.com/comment/43021877
has text: You should look into [this](http://developer.android.com/training/index.html), that'll help you a lot. Especially the [Starting Another Activity](http://developer.android.com/training/basics/firstapp/starting-activity.html) chapter.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27276219

http://stackoverflow.com/q/27296711
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27297226
has title: How to create a countdown to Christmas
accepted answer: http://stackoverflow.com/a/27297226
possible better answer: http://stackoverflow.com/a/27296962
upvote count: 2
has answer: http://stackoverflow.com/a/27296962
has body: I have been trying to create a code that will countdown to Christmas for an android app. This is what I have so far. Calendar thatDay = Calendar.getInstance(); thatDay.setTime(new Date(0)); /* reset */ thatDay.set(Calendar.DAY_OF_MONTH, 25); thatDay.set(Calendar.MONTH, 11); // 0-11 so 1 less thatDay.set(Calendar.YEAR, 2014); Calendar today = Calendar.getInstance(); while (true) { long diff = thatDay.getTimeInMillis() - today.getTimeInMillis(); long diffSec = diff / 1000; long days = diffSec / SECONDS_IN_A_DAY; long secondsDay = diffSec % SECONDS_IN_A_DAY; long seconds = secondsDay % 60; long minutes = (secondsDay / 60) % 60; long hours = (secondsDay / 3600); // % 24 not needed } However, when I try to loop it, it generates too much output. How can I display the code updating every second? Please help!!
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27188527
answer count: 1
has title: Change an apache.commons.configuration file into a pythonable configparser file
accepted answer: http://stackoverflow.com/a/27189352
tagged with: java
tagged with: configparser
has body: The aim is to change an org.apache.commons.configuration file into a pythonable configparser file I have a Java Apache config file as such (the full file is http://pastebin.com/Wz2T2KV9): ############################## # BABELNET-RELATED PROPERTIES ############################## include = babelnet.var.properties babelnet.fullFile = ${babelnet.dir}/babel-synsets-full.txt babelnet.dictFile = ${babelnet.dir}/babel-synsets-lexicon.txt babelnet.glossFile = ${babelnet.dir}/babel-synsets-gloss.txt babelnet.relFile = ${babelnet.dir}/babel-synsets-relations.txt babelnet.mapFile = ${babelnet.dir}/babel-synsets-mapping.txt ################# # DB BABELCO ################# babelco.windowRadius=20 babelco.db.user=root babelco.db.password= I would like to convert it into a file that python ConfigParser (https://docs.python.org/2/library/configparser.html) can parse, i.e. [BABELNET-RELATED PROPERTIES] include = babelnet.var.properties babelnet.fullFile = ${babelnet.dir}/babel-synsets-full.txt babelnet.dictFile = ${babelnet.dir}/babel-synsets-lexicon.txt babelnet.glossFile = ${babelnet.dir}/babel-synsets-gloss.txt babelnet.relFile = ${babelnet.dir}/babel-synsets-relations.txt babelnet.mapFile = ${babelnet.dir}/babel-synsets-mapping.txt [DB BABELCO] babelco.windowRadius=20 babelco.db.user=root babelco.db.password= I tried this but it's giving me the wrong outputs: fin = open('configfile', 'r') sections = {} headers = [] start_header = False prev = "" this_header = "" this_section = [] for line in fin: line = line.strip() if line.startswith('#') and line.endswith('#') and start_header == False: start_header = True sections[this_header] = this_section headers.append(this_header) this_header = "" this_section = [] prev = "" continue if line.startswith('#') and not line.endswith('#') and start_header == True: this_header = line[2:].strip() continue if line.startswith('#') and line.endswith('#') and this_header: start_header = False continue this_section.append(line.strip()) for h in head…
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27189352
score: 1
favorite count: 0
type: Question
tagged with: apache-commons-config
upvote count: 1
tagged with: python

http://stackoverflow.com/comment/42832891
type: QuestionComment
comment on: http://stackoverflow.com/q/27169650
has text: Perhaps you are talking about different -versions- of Rhino? Rhino IS the 'implementation', there is only one. But there are different versions of course and perhaps the available Javascript APIs are different in each version, sure. The JDK readme actually explains exactly how this has been dealt with for you: https://jdk7.java.net/rhino/README.TXT . Just in case of link-rot: The packages of the bundled Rhino have been changed, so you can use a later version simply by using the proper original Rhino packages.
score: 0
type: Comment

http://stackoverflow.com/comment/42993274
type: QuestionComment
has text: Thanks for the help! It runs and compiles smoothly now, but the count of each letter is not printing correctly. It is printing like: A:0 B:0 A:0 A:0 B:1 A:0 B:0
comment on: http://stackoverflow.com/q/27258468
score: 0
type: Comment

http://stackoverflow.com/comment/42915498
has text: Can you [edit] your question and instead of image post actual text data stored in file so we could use it while creating solution to your problem?
type: QuestionComment
comment on: http://stackoverflow.com/q/27217816
type: Comment
score: 1

http://stackoverflow.com/a/27161735
answers question: http://stackoverflow.com/q/27158917
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27158917
type: Answer
score: 2
upvote count: 2
has body: If you use XML-based configuration, ie the log4j.xml file, this will have a higher priority over any log4j.properties file that exists in any library. But if you require the properties file, add an argument to the Java Virtual Machine, e.g.: java -Dlog4j.configuration=file:/tmp/log4j.properties KillerApp

http://stackoverflow.com/comment/42870134
has text: You can't start the driver before class because that's the object/instance never existed, first you need a class.
type: QuestionComment
comment on: http://stackoverflow.com/q/27188422
score: 0
type: Comment

http://stackoverflow.com/q/27252689
downvote count: 1
linked to: http://stackoverflow.com/q/1439779
has body: Below is my code Date currentDate = new Date(); DateFormat dateFormatCmp = new SimpleDateFormat("yyyy-MM-dd"); if(dateFormatCmp.format(currentDate).equals(dateFormatCmp.format(task.getExecutionDate()))) { //doSomething here } current date is having value - 2014-12-02 and task.getExecutionDate() is having value 2014-12-05 Even then it is entering into if condition. Date comparison is not done properly.
has comment: http://stackoverflow.com/comment/42979736
tagged with: java
tagged with: date
type: Question
has comment: http://stackoverflow.com/comment/42979449
has comment: http://stackoverflow.com/comment/42979817
has title: Date format comparison not working
favorite count: 0
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42980358
has comment: http://stackoverflow.com/comment/42983713
upvote count: 1

http://stackoverflow.com/comment/42960216
type: Comment
comment on: http://stackoverflow.com/a/27219344
score: 0
type: AnswerComment
has text: @R4J,@Dave Newton Ok just tell me how to find minimum heap size.

http://stackoverflow.com/a/27195173
has body: The example you refer works automatically. The only manual part I can think about it's security stores (keystore, truststore) creation. Once you have them you can feed Grizzly HttpServer same way it's done in the example.
answers question: http://stackoverflow.com/q/27169947
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/27271506
has comment: http://stackoverflow.com/comment/43012825
score: 2
downvote count: 0
has title: close java process from c# (on windows)
favorite count: 0
linked to: http://stackoverflow.com/q/16139571
type: UnansweredQuestion
tagged with: windows
has body: I started a java program from c# by using ... ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = "C:\\path\\to\\jar\\"; startInfo.FileName = "C:\\Windows\\Sysnative\\java.exe"; startInfo.Arguments = "-jar JavaProg.jar"; process = new Process(); process.StartInfo = startInfo; try { process.Start(); } ... The process is then running continuously until I want it to stop. The java program has a shutdown hook that should be able to catch normal kill signals. E.g., if I run the jar from a bat script, then pressing Ctrl+c in the cmd window will trigger the shutdown hook, but closing the cmd window will terminate the process without triggering the shutdown hook (similar to End Process in the task manager). So in order to stop the java program from C# I tried: process.CloseMainWindow(); or process.Kill(); The CloseMainWindow method has no effect on the java process, and Kill terminates it without triggering the shutdown hook. So what can I do in order to close the java program gracefully from within the C# code?? [Do I need to make modifications in my Java program to intercept the CloseMainWindow signal? Is there a way to mimic the behavior of Ctrl+c on the cmd window from C#? Must I create some path of communication between my C# and Java codes like a pipe or socket?] P.S. The C# code is simply a wrapper for the java code in order to run it as a service on windows (I can't use existing tools such as RunAsService for that purpose). General description of the program: My java program doesn't create any windows. It has a few threads, the main one runs in a loop just waiting for connections, another performs a specific task on an incoming connection, another thread does periodic updates from a web server, and there's the shutdown hook. Usually, the program is run from the command prompt (or terminal on linux), and takes user input only when it is loading for the first time, after which it can be run again without more user input. The program outpu…
has comment: http://stackoverflow.com/comment/43012867
upvote count: 2
has answer: http://stackoverflow.com/a/27273106
tagged with: java
has comment: http://stackoverflow.com/comment/43014277
has answer: http://stackoverflow.com/a/27273394
has answer: http://stackoverflow.com/a/27271903
type: Question
has comment: http://stackoverflow.com/comment/43013531
tagged with: c#
has comment: http://stackoverflow.com/comment/43014109
has comment: http://stackoverflow.com/comment/43014321
has comment: http://stackoverflow.com/comment/43013195
has comment: http://stackoverflow.com/comment/43013679
has comment: http://stackoverflow.com/comment/43013500
linked to: http://stackoverflow.com/q/2541597
answer count: 3

http://stackoverflow.com/comment/42918002
type: QuestionComment
has text: What doesn't work? Does your app crash? Do you not hear anything? Please give us a bit more details to work with.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/27219365

http://stackoverflow.com/q/27311239
tagged with: awt
has answer: http://stackoverflow.com/a/27311985
has comment: http://stackoverflow.com/comment/43084157
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/27311985
tagged with: panel
favorite count: 0
has title: What is the difference between a widget and a panel in Java GUI?
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43083515
type: AnsweredQuestion
has body: Also, is the paintComponent() method used to paint a widget or a panel?
score: 0
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/42994484
score: 0
type: AnswerComment
type: Comment
has text: I wouldn't say that. Just have the first constructor do all the verifications and instance variable assignments, so that it doesn't matter that the other constructors' parameter values aren't changed.
comment on: http://stackoverflow.com/a/27260340

http://stackoverflow.com/a/27212116
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27211899
has comment: http://stackoverflow.com/comment/42909612
has body: Sorry, I missunderstood the question. The Buttons are just too small, so not taking all the space they have in the borderpane? The width of a button depends on the size of the text it has. You just write a number in it so they are pretty small then. Use button.setPrefWidth(Integer.MAX_VALUE) and they use all the width they can get!
has comment: http://stackoverflow.com/comment/42905325

http://stackoverflow.com/comment/42831223
has text: @Anarki no im using only Jse(core java)
type: QuestionComment
comment on: http://stackoverflow.com/q/27170089
score: 0
type: Comment

http://stackoverflow.com/comment/42904570
type: Comment
type: QuestionComment
has text: `Error` and its subclasses are [unchecked exceptions](https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html). You don't have to explicitly declare them as thrown or catch them. They're supposed to represent non-recoverable conditions (caused by programming errors) so catching them does not really make sense. Let alone tasking the users of an API with handling them.
score: 3
comment on: http://stackoverflow.com/q/27211812

http://stackoverflow.com/comment/43067448
has text: See if this helps http://stackoverflow.com/questions/5233543/java-lang-securityexception-trying-to-read-from-android-contacts-uri
score: 0
comment on: http://stackoverflow.com/q/27256492
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42840477
comment on: http://stackoverflow.com/q/27175445
has text: You could check the parameter you're sending to `System.out.println(...)` as example.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42928959
type: QuestionComment
comment on: http://stackoverflow.com/q/27224882
has text: does your newPathName start with a number?
type: Comment
score: 0

http://stackoverflow.com/comment/42971122
type: Comment
has text: Humidities. Made a mistake up... i need to split every fifth character.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27247976

http://stackoverflow.com/q/27206766
answer count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
favorite count: 0
has title: eclipse luna external jar classpath broken
tagged with: buildpath
type: UnansweredQuestion
upvote count: 1
has body: In Luna when I click on build path, click libraries, add external jar files, it will not show the file dialog. Sometimes if I restart eclipse it will work but only for the first few items I add, then it stops allowing the dialog to appear. It's very strange and no errors or anything else appears. I tried Lunda 4.4.0 IDE Java version and also the EE version same thing both 64 bit versions. Any idea what could be causing this?

http://stackoverflow.com/comment/42804828
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27154949
type: AnswerComment
has text: I am able to click on the "addBtn" if i use a different scenario, i.e. not add data into the text field and then click. If the data is already there, then the click event occurs...

http://stackoverflow.com/comment/42822319
score: 5
type: Comment
type: QuestionComment
has text: Not sure if it would work, but make an extra variable that IS final and copy the final result of totalAmount into it?
comment on: http://stackoverflow.com/q/27165006

http://stackoverflow.com/a/27269134
score: 2
has body: Try catching exception within your loop like below: ExecutorService service = Executors.newSingleThreadExecutor(); service.submit(new Runnable(){ public void run(){ while(true){ try { doSomething(); } catch (Exception e) { //log exception etc... } } } });
answers question: http://stackoverflow.com/q/27269068
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27269068
upvote count: 2
type: Answer

http://stackoverflow.com/a/27238156
has body: Since you didn't provide a runnable example, I created one to show how to properly code a Swing application. First, you must start a Swing application with the SwingUtilities.invokeLater method. Here's how I started the CircleSprite class. public static void main(String[] args) { SwingUtilities.invokeLater(new CircleSprite()); } Second, you should use a JPanel for drawing, not a JFrame. Here's the DrawingPanel I created. My version of CircleSprite draws a circle in a random location every 2 seconds. public class DrawingPanel extends JPanel { private static final long serialVersionUID = -4603711384104715819L; private int x; private int y; private BufferedImage image; public DrawingPanel(BufferedImage image) { this.image = image; this.x = 0; this.y = 0; setPreferredSize(new Dimension(500, 500)); } public void setPoint(int x, int y) { this.x = x; this.y = y; repaint(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, x, y, null); } } Third, you create the Swing GUI before you do anything with the Swing GUI. Here's the run method from the CircleSprite class. I create the GUI, then I start the thread that does the random drawing. public void run() { circle = createCircle(); frame = new JFrame("Circle Sprite"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); drawingPanel = new DrawingPanel(circle); frame.add(drawingPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); new Thread(new RandomDraw(drawingPanel)).start(); } Fourth, you only extend a Swing component when you want to override a method, like I did in the DraawingPanel class. You use Swing Components otherwise. Here's the entire, runnable, CircleSprite class. You can use this as a model for future Swing applications. package com.ggl.testing; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; i…
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27236897
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27236897
type: Answer

http://stackoverflow.com/comment/43201978
type: Comment
comment on: http://stackoverflow.com/a/27360099
score: 0
type: AnswerComment
has text: That code won't even compile. I need a full-working test case. Hiding information doesn't help. Provide a full class with implemented interfaces, if there are, and the resulting output. Without it, I'm just shooting in the dark.

http://stackoverflow.com/comment/42956516
comment on: http://stackoverflow.com/q/27239791
score: 0
has text: that would require data to be public and data won't be public if it is public you recieve an illegal start of expression.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27314294
answers question: http://stackoverflow.com/q/27308210
score: 0
has body: Well, it depends on the implementation of the XML parser and schema validator, but I think it very likely that most implementations will require each text node (or attribute value) to fit within the limits of a Java (etc) string. I think we're going to see an increasing incidence of problems in the next few years as we hit the 2^31 limit on sizes of strings, arrays, etc. It's going to be very tough to redesign programming languages like Java to get over this, since the use of (int) data type for addressing into such structures is so universal.
type: Answer

http://stackoverflow.com/comment/42908028
has text: Are you sure that this will work with the generic class? In the past I had troubles with GSON and custom deserializers for generic classes. PS: I know it's a bad design, but unfortunately, I have no say in what happens with the webservice.
type: Comment
comment on: http://stackoverflow.com/a/27212876
score: 0
type: AnswerComment

http://stackoverflow.com/a/27229043
answers question: http://stackoverflow.com/q/27228446
has comment: http://stackoverflow.com/comment/43027334
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/43028874
has body: I'd recommend test driving a function to do the mapping. The file reading/writing is trivial to look up. Test driving leads to this: Tests: public class CardsTests { @Test public void TwoOfHearts() { Assert.assertEquals("Two of hearts (value = 2)", Card.fromString("2-H")); } @Test public void ThreeOfHearts() { Assert.assertEquals("Three of hearts (value = 3)", Card.fromString("3-H")); } @Test public void ThreeOfSpades() { Assert.assertEquals("Three of spades (value = 3)", Card.fromString("3-S")); } } Class: public class Card { public static String fromString(String string) { char value = string.charAt(0); String textValue = valueToText(value); String suit = getSuit(string.charAt(2)); return String.format("%s of %s (value = %c)", textValue, suit, value); } private static String getSuit(char value) { switch (value) { case 'H': return "hearts"; case 'S': return "spades"; default: return ""; } } private static String valueToText(char value) { switch (value) { case '2': return "Two"; case '3': return "Three"; default: return ""; } } } You need to just carry on adding tests to cover all the required functionality.
accepted answer of: http://stackoverflow.com/q/27228446
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43027205

http://stackoverflow.com/a/27213039
has comment: http://stackoverflow.com/comment/42923896
has comment: http://stackoverflow.com/comment/47307108
has comment: http://stackoverflow.com/comment/42928979
has comment: http://stackoverflow.com/comment/47307042
has comment: http://stackoverflow.com/comment/61114294
answers question: http://stackoverflow.com/q/27212730
has body: No it won't; this is not how lambdas work. Yes, a class instance is generated; no, it won't fade out. A lambda is a call site which is linked using invokedynamic; after the initial linkage is done, the JIT is free to kick in and may, for instance, inline the code. So, your "class instance" is only really a class at the beginning. If the lambda is a method reference for instance, ultimately the JIT will inline the lambda into an invoke{static,virtual,interface,special} according to what this method reference is. The work done by the JIT is however vendor-dependent.
upvote count: 9
downvote count: 5
has comment: http://stackoverflow.com/comment/47307017
accepted answer of: http://stackoverflow.com/q/27212730
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/q/27294030
has title: get ip address from android in java i got some error
has comment: http://stackoverflow.com/comment/43053020
has body: i tried to get the ip address in android but the result is like that ! i want get the ip address my wifi range ! how can i do that ? private String getLocalIpAddress() { try { for (Enumeration&lt;NetworkInterface&gt; en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration&lt;InetAddress&gt; enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { return inetAddress.getHostAddress().toString(); } } } } catch (SocketException ex) { Log.e("ServerActivity", ex.toString()); } return null; } result is like that : fe80::38aa:3cff:feb3:1cef%p2p0 also i add the permission in android mainfast : &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
has answer: http://stackoverflow.com/a/27294226
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/3351929
has answer: http://stackoverflow.com/a/27294074
possible better answer: http://stackoverflow.com/a/27294178
tagged with: android
has answer: http://stackoverflow.com/a/27294178
has answer: http://stackoverflow.com/a/27294414
accepted answer: http://stackoverflow.com/a/27294226
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/43033550
type: QuestionComment
comment on: http://stackoverflow.com/q/27282495
score: 1
has text: @HotLicks maybe a `Map` - by name.
type: Comment

http://stackoverflow.com/a/27293381
has comment: http://stackoverflow.com/comment/43053018
answers question: http://stackoverflow.com/q/27293254
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43053068
has comment: http://stackoverflow.com/comment/43052629
has comment: http://stackoverflow.com/comment/43051824
has comment: http://stackoverflow.com/comment/43052708
score: 1
has comment: http://stackoverflow.com/comment/43051908
has comment: http://stackoverflow.com/comment/43052871
has comment: http://stackoverflow.com/comment/43052538
has comment: http://stackoverflow.com/comment/43052955
downvote count: 0
has body: At the moment if there's a cache hit, you return the contents of the cache (instancesMap.get(clazz)). But if no hit, you cache one thing (instancesMap.put(clazz, iRuleInstance)) and return another (iRuleInstance.getInstance()). That doesn't make sense. Don't call getInstance after adding to map, just return it: instancesMap.put(clazz, iRuleInstance); return (T) iRuleInstance; Or, do call getInstance, but cache it: (T) instance = iRuleInstance.getInstance(); instancesMap.put(clazz, instance); return (T) instance; Either way you must return what you cache so that it matches your logic for a cache hit.
has comment: http://stackoverflow.com/comment/43052147

http://stackoverflow.com/comment/43045147
comment on: http://stackoverflow.com/a/27204365
type: AnswerComment
type: Comment
has text: Thanks. but data for row "1" is already there in Hbase(I added it through Shell CLI).
score: 0

http://stackoverflow.com/a/27268218
has comment: http://stackoverflow.com/comment/43007661
score: 4
has comment: http://stackoverflow.com/comment/43007498
answers question: http://stackoverflow.com/q/27268101
has comment: http://stackoverflow.com/comment/43007437
type: Answer
upvote count: 4
downvote count: 0
has body: you are saving transactional detail in session/cookies which is a bad idea, the ids etc. should be passed as hidden fields in the form.
has comment: http://stackoverflow.com/comment/43007847

http://stackoverflow.com/q/27231584
upvote count: 1
has answer: http://stackoverflow.com/a/27641208
has comment: http://stackoverflow.com/comment/43512427
has body: I have attempted to implement the Alchemy NLP API into my android project, however I have hit a bit of a brick wall. When downloading the SDK from http://www.alchemyapi.com/developers/sdks/ you end up with a nice sample project. Imported this into eclipse, everything worked lovely. I then tried to add the classes from the test project to my own by going into my projects properties (in eclipse I may add) -> Java Build Path -> Projects tab and added the test app to my projects build path. I then went to the Order and Export tab and ensured the newly added project was checked, gave everything a clean, and was hit by: 12-01 15:12:03.171: E/AndroidRuntime(10085): java.lang.NoClassDefFoundError: com.alchemyapi.api.AlchemyAPI As far as I can figure out from looking into this error, the project appears to have access to the classes at compile, but not at runtime. I feel I probably have made an embarrassingly simple mistake however all the fix's I have found already on SO have not solved the issue. Thanks in advance for any response.
tagged with: java
tagged with: noclassdeffounderror
tagged with: eclipse
type: Question
tagged with: alchemyapi
downvote count: 0
has title: NoClassDefFoundError - Alchemy API
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/43512783
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/27193550
upvote count: 5
linked to: http://stackoverflow.com/q/739689
tagged with: java
type: Question
score: 5
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27195598
has body: I'm working on a project where I need to map from a hierarchical Map&lt;String, Object&gt; where the second parameter is expected to be a String or Map&lt;String, Object&gt;. Thus far, ModelMapper has worked awesome, but I'm having trouble with a specific conversion. Given the following, where Model is simply a marker interface: class Client implements Model { String firstName; String lastName; List&lt;Organization&gt; organizations = new ArrayList&lt;&gt;(); } Assuming Organization implements my marker interface Model but is otherwise arbitrarily structured, I would like to be able to map the following to Client: Map source = new HashMap(){{ put("firstName", "John"), put("lastName", "Smith"), put("organizations", new HashMap(){{ put("0", new HashMap(){{ put("id", "1234"); }}); put("abc", new HashMap(){{ put("id", "5678"); }}); }}); }}; In summary: how might I go about having ModelMapper drop the map keys and use only the value list when pushing into the organizations property? Failing this, the organizations property comes up empty. You may assume that I have a good reason for wishing to do this, and a poor example! Thanks in advance for your input! Edit I attempted to build a Converter that would manage converting from a Map to a Collection&lt;Model&gt; to no avail. Given: new Converter&lt;Map, Collection&lt;DataTransportObject&gt;&gt;() { @Override public Set convert(MappingContext&lt;Map, Collection&lt;DataTransportObject&gt;&gt; context) { LOG.debug("Here"); Set&lt;DataTransportObject&gt; result = new HashSet&lt;&gt;(); return result; } } There are two problems with this: Apparently ModelMapper doesn't look at inheritance, therefore when any implementation of Map is given as the source, the converter is not run. If, for example, I change the converter to accept HashMap and pass a HashMap as the source, then it works. context.getGenericDestinationType() returns List or Set classes without the generic information. How then does ModelMapper manage to construct com…
favorite count: 0
tagged with: modelmapper
has comment: http://stackoverflow.com/comment/42873076
has comment: http://stackoverflow.com/comment/42875912
has title: How to map from a Map to List
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42873294
has comment: http://stackoverflow.com/comment/42875989
has answer: http://stackoverflow.com/a/27195598

http://stackoverflow.com/comment/43053717
score: 0
comment on: http://stackoverflow.com/a/27294074
type: Comment
has text: i tested my app crash !! i don't know whats reason !
type: AnswerComment

http://stackoverflow.com/comment/43002420
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27265126
has text: how to click in listview to change layout webview in fragment??
type: Comment

http://stackoverflow.com/comment/42865269
has text: @JoopEggen BigInteger is SUPER SLOW! :)
comment on: http://stackoverflow.com/q/27189531
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27223917
tagged with: java
has title: How to configure annotations processing in IntelliJ IDEA 14 for current project work?
has comment: http://stackoverflow.com/comment/65031946
accepted answer: http://stackoverflow.com/a/27296608
has answer: http://stackoverflow.com/a/43606228
tagged with: intellij-idea
has body: The structure of the project is: Parent project A project (Spring) have dependency of project B in pom.xml B project (Spring MVC) have dependency of project A in pom.xml After launching project B in Tomcat 7, I have an error: Error:java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [A,B] are excluded from annotation processing How do I avoid this problem? I use Java 8, Tomcat 7 and Intellij Idea 14.
has comment: http://stackoverflow.com/comment/81855520
has answer: http://stackoverflow.com/a/63202594
favorite count: 0
possible better answer: http://stackoverflow.com/a/43606228
has comment: http://stackoverflow.com/comment/65032735
has answer: http://stackoverflow.com/a/58981202
answer count: 5
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27296608
score: 58
upvote count: 59
tagged with: maven
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/56343413

http://stackoverflow.com/a/27197404
has body: The problem is that everytime you are entering to the first for you are reseting the variable j. So the sifrs, second and thirt time you got the right answer, but on the forth j is reseting, so what you have to do is the following: public static void main(String[] args) { int j; int k = 1; for (int i = 1; i &lt;= 3; i++) { for (j = i; j &lt;= i + 2; j++) { System.out.print(k); System.out.print(" "); k++; } System.out.println(); } } Adding a new constant k that stores the number of iterations and printing them as you want. Hope it helps!
type: Answer
score: 3
answers question: http://stackoverflow.com/q/27197311
upvote count: 3
has comment: http://stackoverflow.com/comment/42879689
downvote count: 0

http://stackoverflow.com/q/27225758
has answer: http://stackoverflow.com/a/27307848
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42977859
has comment: http://stackoverflow.com/comment/42940823
tagged with: google-gdk
has body: I was following Google's Touch Gestures Guide on detecting D-pad key events, but they don't seem to be working. Here is part of my code: public final class ResultActivity extends Activity implements AsyncResponse{ [...] @Override public boolean onKeyUp(int keycode, KeyEvent event){ if(keycode == KeyEvent.KEYCODE_DPAD_DOWN){ //this doesnt get detected return true; } if(keycode == 4){ //this gets detected return true; } return false; }//end onKeyUp }//end activity Yes, I've also tried onKeyDown. What could be causing this problem?
type: Question
has answer: http://stackoverflow.com/a/27380120
answer count: 2
has comment: http://stackoverflow.com/comment/42977913
accepted answer: http://stackoverflow.com/a/27307848
has comment: http://stackoverflow.com/comment/42954233
possible better answer: http://stackoverflow.com/a/27380120
linked to: http://stackoverflow.com/q/27251831
score: 0
tagged with: google-glass
has comment: http://stackoverflow.com/comment/42979918
tagged with: android
has title: KeyEvent.KEYCODE_DPAD_CENTER not being detected
has comment: http://stackoverflow.com/comment/42940403
has comment: http://stackoverflow.com/comment/42939505

http://stackoverflow.com/a/27549594
has body: You cannot associate a number with a Boolean value. A boolean is true or false, not a number, however you can create a variable that indicates if a certain number represents true or false. Is this your entire program? I would like to see what "yourAnswer", "numberOne", and "numberTwo" are stored. but for now I will write a pseudo-program to explain the theory. import java.util.*; public class ExampleProgram { public static void main(String[] args) { System.out.println("Please enter two numbers"); Scanner answer = new Scanner (System.in); int yourAnswer = answer.nextInt(); int numberOne = 1; int numberTwo = 2; if (yourAnswer == (numberOne + numberTwo)) { System.out.println("That is correct!"); } else { System.out.println("That is incorrect!"); } } } This program will ask the user to input a number, for example the number "3". It will then compare that number to the two numbers you declares, "numberOne" which equals the value of one, and "numberTwo" which equals the value of two. Therefore, in the "IF" statement it says, "If (yourAnswer == (numberOne + numberTwo))" which means that 1 + 2 = 3, if the users answer is 3, then 3 = 3 and the result will come back as true.
answers question: http://stackoverflow.com/q/27241009
score: 0
type: Answer

http://stackoverflow.com/comment/42922654
has text: But how would I make sure it changes the JLabel decrementing by 1 one second at a time? I believe I need to do sleep(1000) but where or how should I use it?
comment on: http://stackoverflow.com/a/27221859
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27238673
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/132487399
downvote count: 1
has answer: http://stackoverflow.com/a/27238836
accepted answer: http://stackoverflow.com/a/27238836
favorite count: 0
possible better answer: http://stackoverflow.com/a/27238875
score: 0
has answer: http://stackoverflow.com/a/27238875
has comment: http://stackoverflow.com/comment/42954274
tagged with: android
has title: Shuffling a deck of cards - array or stack?
type: AnsweredQuestion
has body: Im planning to develop a simple card game on android-Java, in my app i shuffle the cards so i wonder what is the best way to store the deck of my cards in array or in a stack..? The only problem with stack is that i dont know how to shuffle it.
tagged with: shuffle
has comment: http://stackoverflow.com/comment/42958279
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42953974

http://stackoverflow.com/comment/42812611
score: 0
type: Comment
type: QuestionComment
has text: Yes. I don't understand it. I understand that it's not good in bin but where can i put it?
comment on: http://stackoverflow.com/q/27159323

http://stackoverflow.com/comment/43053788
type: Comment
comment on: http://stackoverflow.com/q/27293579
type: QuestionComment
has text: No, there isn't, unless you either change the DTD, or create the real config file during build or deployment. The canonical approach is to use annotations or naming conventions. Convention over configuration is a pretty common technique. As with any other framework ever the key is documentation.
score: 0

http://stackoverflow.com/comment/43044636
type: Comment
comment on: http://stackoverflow.com/a/27169715
score: 0
type: AnswerComment
has text: As reference URL, Why not you call TestAppMethods.testMethod2(); rather than TestApp2Class.TestApp2Method(); both will do the same call

http://stackoverflow.com/a/27313935
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27312795
has body: You Can do something like (To Avoid Overwrite): Map result = new HashMap&lt;String,String&gt;(); for( int i = 0 ; i &lt; jArray.length() ; i++ ){ JSONObject object = jArray.getJSONObject(i); result.put(object.getString("qId"), object.getString("ansValue")); } for (Object variableName: result.keySet()){ System.out.println(String.valueOf(variableName)); System.out.println(result.get(variableName)); } Main Reason I have done "qId"+i is that you want data in Hashmap so if the same key then it ll overwrite the already exist. and you want qId as key. It's better to use List instead of it and make one class of data it will work perfect. OR YOU CAN TRY My code (With List): static class KeyVal{ String qkey; String qval; String akey; String aval; public String getQkey() {return qkey;} public void setQkey(String qkey) { this.qkey = qkey;} public String getQval() {return qval;} public void setQval(String qval) {this.qval = qval;} public String getAkey() {return akey;} public void setAkey(String akey) {this.akey = akey;} public String getAval() {return aval;} public void setAval(String aval) {this.aval = aval;} } List&lt;KeyVal&gt; data = new ArrayList&lt;&gt;(); KeyVal key; for( int i = 0 ; i &lt; ja.length() ; i++ ){ JSONObject object = ja.getJSONObject(i); key = new KeyVal(); key.setQkey("qId"); key.setQval(object.getString("qId")); key.setAkey("ansValue"); key.setAval(object.getString("ansValue")); data.add(key); } for( int i = 0 ; i &lt; data.size() ; i++ ){ System.out.println(data.get(i).getQkey() + " : " + data.get(i).getQval()); System.out.println(data.get(i).getAkey() + " : " + data.get(i).getAval()); }
downvote count: 0

http://stackoverflow.com/comment/42960929
type: QuestionComment
has text: I am using groovy here,so def is defined by groovy itself
score: 0
comment on: http://stackoverflow.com/q/27226679
type: Comment

http://stackoverflow.com/comment/43256379
score: 0
type: QuestionComment
has text: Since map is shared by threads, you can be getting one pair <start, end>, whereas you must be have as many <start, ?> pairs as there were calls to `currentTime` at the same millisecond.
type: Comment
comment on: http://stackoverflow.com/q/27292881

http://stackoverflow.com/comment/43052071
type: Comment
comment on: http://stackoverflow.com/a/27293168
score: 0
type: AnswerComment
has text: Dog Cat Rat, below one buddy commented that set(-,-) method will replace but i dont want Cat to replace by Dog just it has to move to Oth element in list

http://stackoverflow.com/comment/42823439
has text: That's extremely weird. Have you tried restarting your IDE? I mean, seeing how that run-time error didn't even specify the problem, it could be quite a few things (maybe a class isn't getting compiled correctly or is added to the path; can't know til we diagnose). Try restarting your IDE first, then check your build configuration and make sure nothing seems odd
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27164453

http://stackoverflow.com/comment/43094499
type: AnswerComment
has text: @maceguo Update the question, So that I can see
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27287345

http://stackoverflow.com/a/27153249
has comment: http://stackoverflow.com/comment/138413991
downvote count: 2
has body: You should include the repository where you want to deploy in the distribution management section of the pom.xml. Example: ... <distributionManagement> false corp1 Corporate Repository scp://repo/maven2 default ... </distributionManagement> ... See Distribution Management
upvote count: 92
has comment: http://stackoverflow.com/comment/139527575
accepted answer of: http://stackoverflow.com/q/27153024
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27153024
has comment: http://stackoverflow.com/comment/113160893
type: Answer
score: 90

http://stackoverflow.com/comment/43077433
type: QuestionComment
type: Comment
has text: @MadProgrammer that's where i'm lost, i have a basic grid. but it's not in a great structure. you think you can help me ??
comment on: http://stackoverflow.com/q/27307580
score: 0

csvjdbc
tags question: http://stackoverflow.com/q/27185969
type: Tag
tag name: csvjdbc

http://stackoverflow.com/comment/42873291
type: Comment
type: QuestionComment
has text: Yes, I did find that post in my initial searching. It doesn't seem to fit the context of my problem though, as my problem does not have to do with nested quotes, and my problem is with deserialization, not serialization.
comment on: http://stackoverflow.com/q/27193633
score: 0

http://stackoverflow.com/a/27268264
has body: Finally found a workaround to this. As suggested by frank I set the limit in the URL and retrived the data as a json object. Here is my code - public class FacebookJson { static Facebook facebook; public static void main(String[] args) throws FacebookException, IOException { // Make the configuration builder ConfigurationBuilder confBuilder = new ConfigurationBuilder(); confBuilder.setDebugEnabled(true); // Set application id, secret key and access token confBuilder.setOAuthAppId("MyAPPid"); confBuilder.setOAuthAppSecret("MyAPPSecret"); confBuilder.setOAuthAccessToken("AccessToken"); //397879687034320|883YXTum1HBJMEbWKbsfq-80pV0 // Set permission confBuilder.setOAuthPermissions("email,publish_stream, id, name, first_name, last_name, generic"); confBuilder.setUseSSL(true); confBuilder.setJSONStoreEnabled(true); // Create configuration object Configuration configuration = confBuilder.build(); // Create facebook instance FacebookFactory ff = new FacebookFactory(configuration); facebook = ff.getInstance(); ResponseList&lt;Post&gt; results1 = facebook.getPosts("narendramodi" , new Reading().limit(5)); for (Post post : results1) { System.out.println(post.getMessage() +"===="+ + post.getSharesCount() + "====" + "====" + post.getId()); URL url = new URL("https://graph.facebook.com/{PostId}/comments?fields=parent,message,from,created_time,can_comment&amp;filter=stream&amp;limit=100?access_token={accesstoken}"); try (InputStream is = url.openStream(); JsonReader rdr = Json.createReader(is)) { JsonObject obj = (JsonObject) rdr.readObject(); JsonArray results = (JsonArray) obj.get("data"); for (JsonObject result : results.getValuesAs(JsonObject.class)) { System.out.print(result.getJsonObject("from").getString("name")); System.out.print(": "); System.out.print(result.getJsonObject("from").getString("id")); System.out.print(": "); System.out.println(result.getString("message")); System.out.println("-----------"); System.out.println(result.getString("id")); System.out.println("---…
answers question: http://stackoverflow.com/q/27229922
score: 0
type: Answer

http://stackoverflow.com/comment/43084751
type: Comment
comment on: http://stackoverflow.com/a/27311174
has text: I mean the SQL query that's generated by Hibernate, the full query, so I can figure out where it goes wrong.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42949918
type: AnswerComment
type: Comment
has text: Generally I agree, but this class in isolation won't do much for a beginner like the OP seems to be.
score: 0
comment on: http://stackoverflow.com/a/27236679

http://stackoverflow.com/comment/48263994
type: AnswerComment
score: 0
has text: You should post a new question with your configuration.
type: Comment
comment on: http://stackoverflow.com/a/27232347

http://stackoverflow.com/a/27245991
has comment: http://stackoverflow.com/comment/42968084
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has body: Is there a way to "run/debug selected code" with given parameter values in eclipse? No, Eclipse needs a regular main method or a @Test method as an entry point. When I want to do a "one off" mini test, what I usually do is class YourClass { private int specialAdd (int a, int b) { if(a &lt; 100) { return 100 * a + b; } else { return a + b; } public static void main(String[] args) { System.out.println(new YourClass().specialAdd(10, 100)); } } and then run (or debug) the current class. (Pro tip: type main and hit Ctrl+Space to expand it to a full main method) As of JDK 9, you can also use jshell for this kind of testing: $ ./jshell | Welcome to JShell -- Version 1.9.0-internal | Type /help for help -&gt; int specialAdd(int a, int b) { &gt;&gt; if (a &lt; 100) { &gt;&gt; return 100 * a + b; &gt;&gt; } else { &gt;&gt; return a + b; &gt;&gt; } &gt;&gt; } | Added method specialAdd(int,int) -&gt; specialAdd(10, 5); | Expression value is: 1005 | assigned to temporary variable $2 of type int
score: 15
accepted answer of: http://stackoverflow.com/q/27245914
answers question: http://stackoverflow.com/q/27245914
type: Answer
has comment: http://stackoverflow.com/comment/42967994
has comment: http://stackoverflow.com/comment/42968163

http://stackoverflow.com/comment/42809871
comment on: http://stackoverflow.com/a/27157715
type: Comment
has text: @DavidWallace I actually just copied the method from the description of the question. Thanks for noticing!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42845023
comment on: http://stackoverflow.com/q/27178088
score: 0
type: Comment
type: QuestionComment
has text: @BackSlash I probably can reduce the size a bit, I'll try that first.

http://stackoverflow.com/q/27301697
answer count: 2
has comment: http://stackoverflow.com/comment/43068411
accepted answer: http://stackoverflow.com/a/27302413
has comment: http://stackoverflow.com/comment/43067803
has comment: http://stackoverflow.com/comment/43067499
possible better answer: http://stackoverflow.com/a/44970757
has answer: http://stackoverflow.com/a/44970757
has comment: http://stackoverflow.com/comment/43067169
has title: Edittext - The limit to number of characters as a function of screen size. Is it possible?
downvote count: 0
has comment: http://stackoverflow.com/comment/43067459
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/27302413
tagged with: android
has comment: http://stackoverflow.com/comment/43066979
upvote count: 1
has comment: http://stackoverflow.com/comment/43067058
type: AnsweredQuestion
has body: I'd like to have different limits to number of characters in Edittext. That limit must depend upon the screen size. Is it possible to do so? If yes, please share your idea.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43067093
type: Question

http://stackoverflow.com/q/27196018
has title: calling `this` from overloaded constructor
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/997482
accepted answer: http://stackoverflow.com/a/27196049
upvote count: 1
has comment: http://stackoverflow.com/comment/42877037
type: Question
possible better answer: http://stackoverflow.com/a/27196047
has answer: http://stackoverflow.com/a/27196047
answer count: 2
downvote count: 0
has body: I've stumbled upon the following code: public class PluginResult { public PluginResult(Status status) { this(status, PluginResult.StatusMessages[status.ordinal()]); //this line } public PluginResult(Status status, String message) { this.status = status.ordinal(); this.messageType = message == null ? MESSAGE_TYPE_NULL : MESSAGE_TYPE_STRING; this.strMessage = message; } I'm wondering what it does on this line: this(status, PluginResult.StatusMessages[status.ordinal()]); Is it calling another overloaded constructor of the same class?
has answer: http://stackoverflow.com/a/27196049
favorite count: 0
has comment: http://stackoverflow.com/comment/42877026

http://stackoverflow.com/comment/42990606
score: 0
type: AnswerComment
type: Comment
has text: @A.T Did you change `writeBytes(nom)` to `writeChars(nom)`? Or did you _only_ change 19 to 38? If you do just the second one, of course the list size will be all wrong because you're reading more characters than you write for each country.
comment on: http://stackoverflow.com/a/27258294

http://stackoverflow.com/a/48955863
type: Answer
downvote count: 0
score: 3
upvote count: 3
has body: You can inject it with: @PersistenceContext private EntityManager entityManager;
answers question: http://stackoverflow.com/q/27270862

http://stackoverflow.com/comment/42837958
type: AnswerComment
comment on: http://stackoverflow.com/a/27173971
score: 0
type: Comment
has text: thank you ! now its a litte bit better but the problem here is that when i'm going >x and >y it pulls the character automatically to the end. i think i can resolve the problem when define a span for the end, but how?

http://stackoverflow.com/q/27201197
has comment: http://stackoverflow.com/comment/42885834
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42885891
has comment: http://stackoverflow.com/comment/42885900
accepted answer: http://stackoverflow.com/a/27201266
favorite count: 0
possible better answer: http://stackoverflow.com/a/27201310
has title: Java longest subsequence
has answer: http://stackoverflow.com/a/27201310
has comment: http://stackoverflow.com/comment/42885855
score: 2
has comment: http://stackoverflow.com/comment/42885960
upvote count: 2
has body: I have an array, i'd like to calculate the length of the longest subsequence made by equals numbers: Example: 5 1 1 9 9 9 4 4 6 6 4 4 4 --> the length of the longest subsequence is 3 (9 9 9). This is what i got so far but it doesn't work. int lung=0, lungmax=0; int indice = 0; int [] values = new int [30]; for(int k=0; k&lt;30; k++) { if (values[k]==values[k+1]) { lung++; if (lung&gt;lungmax) { lungmax=lung; indice=values[k]; } } else lung=0; } lungmax = lungmax++; System.out.println("the length of the longest subsequence is: "+lungmax);
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27201266
tagged with: java
has answer: http://stackoverflow.com/a/27201296

http://stackoverflow.com/comment/42957762
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27240337
has text: Yes, I've put in lwjgl.jar and lwjgl_util.jar into there correctly. I've also set up my natives and Javadoc.
type: AnswerComment

http://stackoverflow.com/comment/42880461
has text: First thing I see is your for loop makes every number in the array the same
score: 0
comment on: http://stackoverflow.com/q/27197919
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27313635
answer count: 1
type: UnansweredQuestion
tagged with: java
has body: i have a subflow which ends in an SMTP endpoint. I have mocked the smtp:outbound-endpoint using MUnit to verify that the attributes are being specified as expected given the flow input. But the one thing I can't verify is the content type/mime type. This attribute is set on the associated connector. But it is not possible to mock the connector as message processor it seems. How can validate whether the mimeType on the smtp:connector is being set to a certain value? For example (below), if my xml has an invalid name configuring the contentType below, how could I write a test to prevent it: &lt;smtp:connector name="smtpConnector" doc:name="SMTP" contentType="#[flowVars.someInvalidName]"/&gt;
tagged with: unit-testing
type: Question
has title: Asserting SMTP connector attributes in a flow
has answer: http://stackoverflow.com/a/27314046
tagged with: mule
score: 0

http://stackoverflow.com/comment/42838308
comment on: http://stackoverflow.com/a/27166460
type: AnswerComment
has text: I have tried. issue not fixed. the sort is still using "taskResultContent.sequency": -1. I have no edit how to map it to use sequency. Your idea is to correct the alias on project. but actually the alias is correct there. but don't know why the sort is not using the alias.
score: 0
type: Comment

http://stackoverflow.com/a/27181762
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42867829
answers question: http://stackoverflow.com/q/27181447
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27181447
score: 1
has body: kindly put this in your layout textSize="@dimen/text_size" and make dimen.xml in following folders in res directory values values-hdpi values-ldpi values-mdpi values-sw1024dp-land values-sw600dp values-sw720dp-land and according to your need change the value of the size in these different dimes.xml

http://stackoverflow.com/a/27282742
score: 0
has comment: http://stackoverflow.com/comment/43056468
type: Answer
has comment: http://stackoverflow.com/comment/43056235
answers question: http://stackoverflow.com/q/27281172
has comment: http://stackoverflow.com/comment/43066268
has comment: http://stackoverflow.com/comment/43056391
has body: @Value is a lovely annotation but looking at your code I'm wondering if it is important for you that those variables representing the properties are static ? If not you could avoid alot of clutter code by not making them static. @Component public class Ut_Properties { @Value("${url}") private String url; // ... public getUrl() { return url; } @Component/Service/Controller public class ClassFromWhereYouWantToAccessTheProperties { @Inject Ut_Properties utProperties; // you could ofcourse just inject the properties in the classes where you need them instead of trying to gather them in one class. @Value("${url}") private String url; public void someRandomMethod() { utProperties.getUrl(); // vs this.url;
has comment: http://stackoverflow.com/comment/43219758

http://stackoverflow.com/comment/49346348
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27272712
has text: use keep-alive false

http://stackoverflow.com/comment/42884527
type: QuestionComment
has text: Separate your view from your data, create one or models for you data, which can be shared amongst your views...
comment on: http://stackoverflow.com/q/27200373
score: 0
type: Comment

http://stackoverflow.com/comment/42869248
has text: But @SessionAttributes saves the objects into the HttpSession?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27191643

http://stackoverflow.com/a/27280048
type: Answer
answers question: http://stackoverflow.com/q/27279863
has body: If you would be doing development with Java 7, you need the JDK as opposed to the JRE. In Eclipse, you make your project FACETED, then right click on your Java 7 project and go Properties. From there, you can select Project Facets and then you can modify the Java version you would be using for that particular project. I have multiple Java versions (JDKs) installed and this is how i control the version i am using in my projects. Hope this helps!
score: 0

http://stackoverflow.com/a/27311730
upvote count: 1
answers question: http://stackoverflow.com/q/27311620
score: 1
has body: You can add some parameters into your JVM :Run jetty with this -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000 than run remote and debug with this -Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000 Hope it will helps
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27311620
has comment: http://stackoverflow.com/comment/43084685
has comment: http://stackoverflow.com/comment/43084575
type: Answer
has comment: http://stackoverflow.com/comment/43091604

http://stackoverflow.com/a/27190979
has body: You can inherit with EJB, but at the end you have to create concrete classes. You cannot have EJB entities as abstract classes instances or interfaces instances (there is no somehting like this)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27190919

http://stackoverflow.com/a/27210311
accepted answer of: http://stackoverflow.com/q/27210099
score: 1
has body: You need to reset the position of the buffer before you send it, since the put methods (except for the ones which take an index) increment the position when called, and jetty apparently uses the position to decide what to send. You can do this with flip which sets the position to 0, discards the mark, and sets the limit to the previous position, or rewind which does not change the limit of the buffer, or with position which will discard the mark if it is greater than the new position that you pass it and does not change the limit. wrap(byte[]) works because it sets the position to 0 and the limit to the length of the array you pass.
answers question: http://stackoverflow.com/q/27210099
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/27304211
has body: In interface describes which methods signatures are available for a specific object. What you do in this line Connection con = DriverManager.getConnection(Url, "username", "password"); is that you assign the instance created using the getConnection factory method to a reference con that can hold instances that comply with the Connection interface. You cannot directly instantiate interfaces - as interfaces don't specify an implementation. You can however treat the references to an object that implements the interface as you do references to other objects. If you strictly keep to the methods defined in the interface you can swap one object with another as long as they implement the interface, during compile time or runtime. A factory method such as getConnection() is a static method that is used to instantiate objects. Objects can also be created using constructors, but factory methods are more flexible and may be even be defined within any class (such as DriverManager in the example).
downvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27304059
type: Answer
upvote count: 2

http://stackoverflow.com/comment/42891010
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27204188
has text: What's the question? Just return. What issues are you facing?
score: 1

http://stackoverflow.com/q/27236396
has comment: http://stackoverflow.com/comment/42949414
has comment: http://stackoverflow.com/comment/42949747
downvote count: 4
upvote count: 0
answer count: 1
has title: Java passing boolean value
favorite count: 0
has comment: http://stackoverflow.com/comment/42949396
linked to: http://stackoverflow.com/q/3795585
type: UnansweredQuestion
has body: I cant get these to compile it seems to be where I'm trying to pass the Boolean value. The first one has 2 errors that don't make any sense to me public class Date { public int m; public int d; public int y; boolean isLeapYear; public String monthIs(){ return month; m = Integer.parseInt(month); } public String dayIs(){ return day; d = Integer.parseInt(day); } public Date(String year){ y = Integer.parseInt(year); // Is y Divisible by 4 if (y % 4 == 0){ // Is y Divisible by 4 but not 100 if (y % 100 != 0) isLeapYear = true; // Is y Divisible by 4 and 100 and 400 else if (y % 400 == 0) isLeapYear = true; // It's Divisible by 4 and 100 but not 400 else isLeapYear = false; } // It's not divisible by 4 else { isLeapYear = false; public boolean getisLeapYear() { return isLeapYear; } } } } DateJDialog class: import javax.swing.JOptionPane; /** This program runs the Date class to determine if * the date entered falls within a leap year. */ public class DateJDialog { public static void main(String[] args) { String month; String day; String year; boolean isitLeapYear; Date date; //Get Input JOptionPane.showMessageDialog(null, "This program determines if the date entered falls within a leap year."); month = JOptionPane.showInputDialog("What month?"); day = JOptionPane.showInputDialog("What day?"); year = JOptionPane.showInputDialog("What year?"); //Create Date object date = new Date(year); if (date.getisLeapYear()==true); if (isLeapYear = true) JOptionPane.showMessageDialog(null, month + "-" + day + "-" + year + " does fall within a leap year."); else JOptionPane.showMessageDialog(null, month + "-" + day + "-" + year + " does not fall within a leap year."); System.exit(0); } }
has comment: http://stackoverflow.com/comment/42949380
score: -4
has answer: http://stackoverflow.com/a/27236815
has comment: http://stackoverflow.com/comment/42949841
type: Question
has comment: http://stackoverflow.com/comment/42949730
has comment: http://stackoverflow.com/comment/42949575
tagged with: java
has comment: http://stackoverflow.com/comment/42949389

http://stackoverflow.com/comment/42834052
type: Comment
has text: I was thinking the same thing and was hoping it was going to be as simple as this, but the requirement here is not automation testing.
comment on: http://stackoverflow.com/a/27171225
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43033553
has text: @brso05 Hm.. I copied your code and changed the Test to a label. No compiling errors.. But when i run it, it freezes the gui for 4 seconds :/ java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-4
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27281929
type: AnswerComment

http://stackoverflow.com/comment/46672577
comment on: http://stackoverflow.com/q/27277435
type: QuestionComment
score: 0
has text: I answered here http://stackoverflow.com/questions/24601087/crosswalk-call-js-function-from-java-on-android
type: Comment

http://stackoverflow.com/comment/42853593
type: QuestionComment
has text: @therealprashant i have edited of question
comment on: http://stackoverflow.com/q/27182708
score: 0
type: Comment

size
type: Tag
tags question: http://stackoverflow.com/q/27227647
tags question: http://stackoverflow.com/q/27281820
tag name: size
tags question: http://stackoverflow.com/q/27181119
tags question: http://stackoverflow.com/q/27219244
tags question: http://stackoverflow.com/q/27204843

http://stackoverflow.com/comment/43014458
score: 0
has text: I have updated my questions with a different variation I am trying and have included my current global_tracking.xml
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27272050

http://stackoverflow.com/comment/42860005
type: Comment
has text: look at `public DatabaseAdapter createDatabase()` part please. u can see `openHelper.createDataBase();` called
comment on: http://stackoverflow.com/a/27186453
score: 0
type: AnswerComment

http://stackoverflow.com/q/27154121
has answer: http://stackoverflow.com/a/27154609
type: AnsweredQuestion
tagged with: paint
type: Question
tagged with: java
has title: paint image x times in for loop
has body: I am working on making my world and I have all my x coords in an array and would like to use a for loop to paint it to the screen. It would hold 27 values but, my problem is I don't know what I would fill the rest of my parameters with. public void paint(Graphics2D g2d){ for(int i = 0; i &lt; blockPlacementX; i++){ g2d.drawImage(getBlockIMG(), , ,null); //img, x, y, null } } full class package com.questkings.game; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import javax.swing.ImageIcon; public class MapLayout { int[] blockPlacementX = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750, 780, 810}; int[] blockPlacementY = { }; private Game game; public MapLayout(Game game){ this.game=game; } //Map size 800(x), 400(y) public void paint(Graphics2D g2d){ for(int i = 0; i &lt; blockPlacementX; i++){ g2d.drawImage(getBlockIMG()); } } public Image getBlockIMG(){ ImageIcon ic = new ImageIcon("C:/Users/AncientPandas/Desktop/QuestKings/Misc/Images/Sprites/grassWall.png"); return ic.getImage(); } public Rectangle getBoundsBlock(){ return new Rectangle(0, 345, 810, 1); } } So I tried, but it draws it really quick then it disappears. Any ideas? public void paint(Graphics2D g2d){ for(int i = 0; i &lt; blockPlacementX[27]; i++){ g2d.drawImage(getBlockIMG(), blockPlacementX[0]++, blockPlacementY [0], null); } }
accepted answer: http://stackoverflow.com/a/27154609
score: 0
tagged with: for-loop
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/42802740
has comment: http://stackoverflow.com/comment/42803044

http://stackoverflow.com/q/27193641
has comment: http://stackoverflow.com/comment/42873022
has answer: http://stackoverflow.com/a/27193689
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27199638
tagged with: java
type: Question
has title: NullPointerException thrown when getting a specified mapped key
has body: Am trying to get a specified key value from a string but nullpointerexception is constantly thrown when the code reaches this line: splitter.httpHost = ((String)splitter.map.get("Host")).replaceAll(":([\\d]+)", ""); Here is the complete code: public class InjectDataSplitter { private String tmpHost; private String b; private int httpPort = 0; private String httpHost; private HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); private String e; private String f; public InjectDataSplitter(String str) { this.tmpHost = str; } public static InjectDataSplitter get_data_splitter(String str) { InjectDataSplitter splitter = new InjectDataSplitter(str); splitter.b = splitter.tmpHost; //Split the supplied string String arraystring[] = splitter.tmpHost.split("\r\n", 2); for(int x = 0; x &lt; arraystring.length; x++) { String arraystring1[] = arraystring[x].split(" "); for(int y = 0; y &lt; arraystring1.length; y++) { splitter.e = arraystring1[y]; splitter.f = arraystring1[y]; } String arraystring2[] = arraystring[x].replace("\r\n\r\n", " ").split("\r\n"); for(int i = 0; i &lt; arraystring2.length; i++) { try { String arraystring3[] = arraystring2[i].split(":"); splitter.map.put(arraystring3[1], arraystring3[2]); } catch(Exception e) { } splitter.httpHost = ((String)splitter.map.get("Host")).replaceAll(":([\\d]+)", ""); Pattern pattern = Pattern.compile(":([\\d]+)"); if(!splitter.e.equals("CONNECT")) { String s1 = splitter.f; s1 = splitter.b; Matcher matcher = pattern.matcher(s1); if(!matcher.find()) { //find each match in turn //find each match in turn int j = Integer.parseInt(matcher.group(1)); //Access a submatch group boolean flag = splitter.e.equals("CONNECT"); if(flag){ j = 443; }else{ j = 80; } splitter.httpPort = j; } } } } return splitter; } Can anyone explain where I'm going wrong please?
has answer: http://stackoverflow.com/a/27193746
score: 0
has comment: http://stackoverflow.com/comment/42872812
answer count: 3
has comment: http://stackoverflow.com/comment/42872993

http://stackoverflow.com/q/27206680
tagged with: jtextarea
answer count: 1
has answer: http://stackoverflow.com/a/27206860
score: 0
tagged with: listener
type: UnansweredQuestion
has body: I would like to display an item list in a JTextArea and after have the opportunity to select one in particular of these displayed items through an ActionListener and show it separately in another screen. Is that possible in Java? In that case, which Listener should I choose? Thanks.
type: Question
tagged with: java
has title: JTextArea listener in Java

http://stackoverflow.com/a/27233885
type: Answer
answers question: http://stackoverflow.com/q/27233536
has body: In Spring Boot you can: Externalize application.properties from your jar and provide file per environment by adding path as a startup parameter: java -jar your-app.jar --spring.config.location=/path/to/app.properties Use Spring profiles. Create application-${profile}.properties for each profile, in each one different datasource properties Use Spring profiles and instead of application.properties, put your properties to application.yaml where you can put properties for all environments using convention as below: spring: profiles: development server: port: 9001 --- spring: profiles: production server: port: 0 Use environment variables and set SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD, and (optionally) SPRING_DATASOURCE_DRIVER_CLASS_NAME. Learn more in the Spring Boot reference section on How to change configuration depending on the environment and External Configuration.
score: 18
upvote count: 18
accepted answer of: http://stackoverflow.com/q/27233536
has comment: http://stackoverflow.com/comment/42949702
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42950884

http://stackoverflow.com/q/27214036
tagged with: dialog
score: 0
has answer: http://stackoverflow.com/a/27214117
answer count: 1
has body: I'm trying to use a Tabhostin a Dialog so that the user can toggle inside the Dialog between to layouts. But I always get a NullPointerException. Any advice? or How to do it right? Dialog Method: public void dialog(){ final Dialog d = new Dialog(this); d.setTitle("Dialog); d.setContentView(R.layout.dialog); d.setCanceledOnTouchOutside(false); TabHost tabHost = (TabHost) d.findViewById(android.R.id.tabhost); Button b_set = (Button) d.findViewById(R.id.b_choose); Button b_cancel = (Button) d.findViewById(R.id.b_cancel); tabHost.setup(); //Here is the problem TabHost.TabSpec tab1 = tabHost.newTabSpec("Favs"); TabHost.TabSpec tab2 = tabHost.newTabSpec("All"); tab1.setIndicator("NEWTAB"); tab1.setContent(new Intent(this,Tab1Activity.class)); tab2.setIndicator("NEWTAB"); tab2.setContent(new Intent(this,Tab2Activity.class)); tabHost.addTab(tab1); tabHost.addTab(tab2); d.show(); } Dialog.xml: LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> Logcat: 11-30 14:48:06.661 7157-7157/com.test.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.test.app.Main.dialog (Main.java:269) at com.test.app.Main$1.onClick(Main.java:139) at android.view.View.performClick(View.java:4475) at android.view.View$PerformClick.run(View.java:18786) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method)
tagged with: nullpointerexception
tagged with: android
has title: NullPointerException using TabHost in Dialog? How to do it right?
accepted answer: http://stackoverflow.com/a/27214117
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: android-tabhost

http://stackoverflow.com/comment/43016399
has text: @YvesDaoust Java and C# yes, C++ no. Just try it. pow with double and the unsigned thing are the first things which comes to mind. (not to mention the different Class/function names everywhere, not only one operator)
comment on: http://stackoverflow.com/q/27269598
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27167677
has body: you should not do beans = response.getBeans(Person.class); // you lost reference of object. it is c++ way, //but not works for java you should do List&lt;Person&gt; newBeans = response.getBeans(Person.class); beans.addAll(newBeans);
answers question: http://stackoverflow.com/q/27167606
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27167606
type: Answer
has comment: http://stackoverflow.com/comment/42826988
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42828538
has comment: http://stackoverflow.com/comment/42827418

http://stackoverflow.com/a/27298452
type: Answer
has comment: http://stackoverflow.com/comment/43094645
accepted answer of: http://stackoverflow.com/q/27287780
answers question: http://stackoverflow.com/q/27287780
upvote count: 1
score: 1
has body: Its not worth a violent discussion :) The answer, as usual, is it depends on the requirements your applications have on resources, availability etc. There is no one size fits all answer or best practice. If you can articulate your requirements in your question then we can give specific pros/cons to each of them. However, to your point about sharing TCP ports, many servers have the concept of domains which create individual contexts for resources like ports, JDBC connection pools etc. You can deploy WARs to different domains and they will get unique ports, context root, and other resources but all still share the same application server instance.
has comment: http://stackoverflow.com/comment/43094718
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43081523

http://stackoverflow.com/comment/43054802
type: AnswerComment
comment on: http://stackoverflow.com/a/27294515
score: 0
type: Comment
has text: This is the problem with using polymorphism right ? Only the superclass's methods are visible to the subclass, regardless of the superclass is abstract or not. Correct ?

http://stackoverflow.com/comment/43061112
score: 0
type: Comment
type: QuestionComment
has text: Look at mocking frameworks.
comment on: http://stackoverflow.com/q/27298420

http://stackoverflow.com/q/27191646
favorite count: 0
accepted answer: http://stackoverflow.com/a/27191723
has comment: http://stackoverflow.com/comment/42869164
tagged with: encryption
has comment: http://stackoverflow.com/comment/42869885
has comment: http://stackoverflow.com/comment/42869773
type: AnsweredQuestion
has body: I just jumped into a big trouble. I created a commercial application in Java and it is in test mode, and some one has de-compiled my code without my permission. I need to protect my code as soon as possible, as the next release is in next 2 days. What is the quickest and fastest way of encrypting my code in Java? Is there any program or something which will encrypt the entire code at once?
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42869229
type: Question
score: -2
has answer: http://stackoverflow.com/a/27191723
has title: Quickest way of encrypting Java code
has comment: http://stackoverflow.com/comment/42869181
has comment: http://stackoverflow.com/comment/42869714
upvote count: 0
answer count: 1

http://stackoverflow.com/q/27236801
accepted answer: http://stackoverflow.com/a/27237005
has body: I have a plain helper class with public methods which I am using in the service level class. When I am writing test for the service class and trying to mock this helper class for one of the method it is going inside the methods and running every line. Since code inside this method is more complex I want to mock helper class with method(s) so that I don't have to take care of every detail inside helper class method. Service Class class HistoryServiceImpl implements CaseHistory { @Override public List&lt;CaseHistoryDto&gt; getCaseHistory(Individual member, Individual provider) { MemberUtil memberUtil = new MemberUtil(); List&lt;CaseHistoryDto&gt; caseHistoryDtoList = new ArrayList&lt;CaseHistoryDto&gt;(); List&lt;CaseHistory&gt; caseHistoryList = caseDetailDao.fetchCaseHistory(member.getId(), provider.getId()); for(CaseHistory caseHistory : caseHistoryList) { CaseHistoryDto caseHistoryDto = new CaseHistoryDto(); caseHistoryDto.setMemberInfo(memberUtil.getMemberInfo(member, caseHistory.getCreateDate())); caseHistoryDtoList.add(caseHistoryDto); } return caseHistoryDtoList; } } Test Class Class HistoryServiceTest { @Mock MemberUtil memberUtil; @InjectMocks private HistoryServiceImpl historyServiceImpl = new HistoryServiceImpl(); @Test public void testGetCaseHistory() { //why this line going inside real method and executing all lines? when(memberUtil.getMemberInfo(any(Individual.class), any(Date.class))).thenReturn(member); } }
tagged with: java
has comment: http://stackoverflow.com/comment/42950522
tagged with: unit-testing
type: Question
type: AnsweredQuestion
score: 0
tagged with: mockito
answer count: 1
has title: Mocking helper class with Mockito
has answer: http://stackoverflow.com/a/27237005

http://stackoverflow.com/comment/60815345
has text: I am extremely grateful for this answer, I know this is against the SO policy to comment like this but I will this time :)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27212201

http://stackoverflow.com/a/27257419
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27255487
has comment: http://stackoverflow.com/comment/120030348
downvote count: 0
has body: The solution was to properly scope the bean when declaring it in the xml file: Spring defaults to singleton, which I'm guessing is why a new one was created with every call to buildMyObj(). Setting the scope to prototype fixed my memory issues completely: <constructor-arg name="arg0" val="1"/>
upvote count: 1

http://stackoverflow.com/comment/42967573
has text: Use Constructor Overloading for creating two constructor
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27246277
type: Comment

http://stackoverflow.com/q/27183422
has answer: http://stackoverflow.com/a/27183543
has comment: http://stackoverflow.com/comment/42854289
has body: I have array of string {"All-Inclusive,All Inclusive","Luxury,Luxury","Spa-And-Relaxation,Spa &amp; Relaxation"} I want to split them based on "," with two arrays, first array {"All-Inclusive","Luxury","Spa-And-Relaxation"} and a second array {"All Inclusive","Luxury","Spa &amp; Relaxation"}. Can you kindly suggest how can it be done?
has comment: http://stackoverflow.com/comment/42854312
has comment: http://stackoverflow.com/comment/42854306
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42854320
tagged with: java
type: Question
tagged with: split
accepted answer: http://stackoverflow.com/a/27183543
has title: Java-Array Splitting
score: 0
answer count: 1

maven-3
tags question: http://stackoverflow.com/q/27175039
tags question: http://stackoverflow.com/q/27208816
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/27246065
tags question: http://stackoverflow.com/q/27284261

http://stackoverflow.com/comment/42965312
has text: Your 'domain model objects' http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27244857
type: Comment

http://stackoverflow.com/q/27228514
has answer: http://stackoverflow.com/a/27228606
tagged with: java
has body: Is it possible to get the currency code of the country, where the user and device is. i want to set the country code of the present country of the user as default country. Do we have a solution for this in android ?
score: 17
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27228664
answer count: 2
possible better answer: http://stackoverflow.com/a/27228606
has answer: http://stackoverflow.com/a/27228664
favorite count: 0
tagged with: currency
tagged with: android
upvote count: 18
has title: Android Is it possible to get the currency code of the country, where the user and device is?
linked to: http://stackoverflow.com/q/58487529
type: AnsweredQuestion

http://stackoverflow.com/comment/43048269
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27290213
has text: Hi @BurtBeckwith, I am using this code: `def ticket = Entrada.findById(ticketId, [fetch: ['tipo': 'join', 'tipo.evento': 'join'], readOnly:true])` and I would like to stub calls to findById
type: Comment

http://stackoverflow.com/comment/43046307
comment on: http://stackoverflow.com/a/27269108
type: Comment
has text: You shouldn't use json result to serialize `employeeService`. See how to exclude properties from process [here](http://stackoverflow.com/a/21350079/573032).
type: AnswerComment
score: 0

http://stackoverflow.com/q/27155180
has comment: http://stackoverflow.com/comment/42804843
has comment: http://stackoverflow.com/comment/42804774
has comment: http://stackoverflow.com/comment/42804860
has answer: http://stackoverflow.com/a/27155321
has body: I have been brainstorming this for 2 hours and I am on the brink of insanity. This is the code: import java.util.Scanner; public class RecursiveNestedLoops { public static int numberOfLoops; public static int numberOfIterations; public static int[] loops; public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("N = "); numberOfLoops = input.nextInt(); System.out.print("K = "); numberOfIterations = input.nextInt(); input.close(); loops = new int[numberOfLoops]; nestedLoops(0); } public static void nestedLoops(int currentLoop) { if (currentLoop == numberOfLoops) { printLoops(); return; } for (int counter=1;counter&lt;=numberOfIterations;counter++) { loops[currentLoop] = counter; nestedLoops(currentLoop + 1); } } public static void printLoops() { for (int i = 0; i &lt; numberOfLoops; i++) { System.out.printf("%d ", loops[i]); } System.out.println(); } } Now I have NO idea how but it works like it is supposed to. After 2 hours of thinking I got to the conclusion that I may not grasp what these lines do: printLoops(); return; printLoops(); - This calls the print method yeah. return; - Shouldn't this end THE WHOLE nestedLoops method and just END the program? Instead what it does is it somehow restarts the method and it starts doing the rest of the for loop.
has title: Why does this recursion code work like this?
tagged with: recursion
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42804806
type: Question
has comment: http://stackoverflow.com/comment/42804892
possible better answer: http://stackoverflow.com/a/27155321
score: -1
has comment: http://stackoverflow.com/comment/42804823
has answer: http://stackoverflow.com/a/27155317
accepted answer: http://stackoverflow.com/a/27155317
has comment: http://stackoverflow.com/comment/42805000
has comment: http://stackoverflow.com/comment/42804744
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/42804705
upvote count: 1
has comment: http://stackoverflow.com/comment/42804930
has comment: http://stackoverflow.com/comment/42804696
favorite count: 0

http://stackoverflow.com/comment/42958557
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27241009
score: 2
has text: if (yourAnswer `==` numberOne + numberTwo)

http://stackoverflow.com/a/45220823
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/77409699
has body: import java.io.*; import java.util.*; public class QuickSort { public static void swap(int[] arr,int a,int b) { int temp=arr[a]; arr[a]=arr[b]; arr[b]=temp; } void quicksortfunc(int[] arr,int left,int right) { // System.out.println("Calling:"+Arrays.toString(arr)); int size=right-left+1; if(size&lt;=3) manualsort(arr,left,right); else { int pivot=medianof3(arr,left,right); System.out.println("Pivot is:"+pivot); //System.out.println(Arrays.toString(arr)); int p_index=partitionfunc(arr,left,right,pivot); System.out.println("The p_index is:"+p_index); quicksortfunc(arr,left,p_index-1); quicksortfunc(arr,p_index+1,right); } } public static int medianof3(int[] arr,int left,int right) { int mid=(left+right)/2; if(arr[mid]&lt;arr[left]) swap(arr,mid,left); if(arr[right]&lt;arr[left]) swap(arr,right,left); if(arr[mid]&gt;arr[right]) swap(arr,mid,right); swap(arr,mid,right-1); return arr[right-1]; } int partitionfunc(int[] arr, int left,int right,int pivot) { int i=left+1; int j=right-2; while(i&lt;j) { while(arr[i]&lt;pivot) i++; while(arr[j]&gt;pivot) j--; if(i&lt;j) swap(arr,i,j); } swap(arr,i,right-1); return i; } public static void manualsort(int[] arr,int left,int right) { int size=right-left+1; if(size&lt;=1) return; if(size==2) { if(arr[right]&lt;arr[left]) swap(arr,left,right); return; } else { if(arr[right-1]&lt;arr[left]) swap(arr,right-1,left); if(arr[right]&lt;arr[left]) swap(arr,right,left); if(arr[right-1]&gt;arr[right]) swap(arr,right-1,right); } } public static void main(String[] args) { int[] arr={1,3,5,7,9,11,2,2,4,6,8,10,12,12}; QuickSort obj=new QuickSort(); obj.quicksortfunc(arr,0,13); System.out.println("The sorted array is:"+Arrays.toString(arr)); } }
answers question: http://stackoverflow.com/q/27284619
has comment: http://stackoverflow.com/comment/77471951

http://stackoverflow.com/q/27187894
type: Question
has comment: http://stackoverflow.com/comment/42862490
has comment: http://stackoverflow.com/comment/42866198
tagged with: jedit
tagged with: apache-commons-lang
score: 0
answer count: 2
has body: I need help installing Apache.Commons.Lang on Mac jEdit Steps Taken: I need help installing Apache.Commons.Lang on Mac jEdit. I have downloaded the file from Apache. I tried copying the "commons-lang3-3.3.2.jar" in many locations with no avail. I tried testing my installation with this simple file: import org.apache.commons.lang3.StringUtils; public class TestOne { public static void main(String[] args) { String text = "Hello World"; System.out.println(StringUtils.reverse(text)); } } I receive the following error: TestOne.java:1: error: package org.apache.commons.lang3 does not exist import org.apache.commons.lang3.StringUtils; ^ TestOne.java:6: error: cannot find symbol System.out.println(StringUtils.reverse(text)); ^ symbol: variable StringUtils location: class TestOne 2 errors Thanks for any help/guidance! (My First Post)
tagged with: macos
has title: installing apache.commons.lang on MAC jEdit
has answer: http://stackoverflow.com/a/27198757
has answer: http://stackoverflow.com/a/27188158
has comment: http://stackoverflow.com/comment/42862362
has comment: http://stackoverflow.com/comment/42866233
tagged with: installation
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/27173975
type: Answer
answers question: http://stackoverflow.com/q/27173210
accepted answer of: http://stackoverflow.com/q/27173210
has body: Cannot delve totaly into your logic there, but here's some hints: First, you don't have to guess where the error is. In case of uncaught exception like here, thread that produced it will print it's stack trace to console. It looks like this: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "/" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222) at java.lang.Double.parseDouble(Double.java:510) at mypackage.Calculator.actionPerformed(Calculator.java:229) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6297) From here you see that exception happened in thread named AWT-EventQueue-0, which is swing's standard event dispatching thread (all GUI applications handles events in single thread). Another thing you search in stack trace is to find what line in your code thrown it. Here it's the line: at mypackage.Calculator.actionPerformed(Calculator.java:229) In source, it is line: number2 = Double.parseDouble(label.getText().trim()); , so you guessed right. What you can do is add another boolean there which will be set only if number button is hit, and then change that part of code to something like: if( isNumber){ if(firstNumber) { number1 = Double.parseDouble(label.getText().trim()); } else { number2 = Double.parseDouble(label.getText().trim()); } } Apart from that, instead of using multiple boolean flags for operation, use Java enum type enum Operation {devide, substract, add, multiply}; your code will be more readable and "java" styled. Good starting point, just go ahead!
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42838452

http://stackoverflow.com/comment/43069958
type: QuestionComment
comment on: http://stackoverflow.com/q/27196376
has text: @FredOverflow not that I know of. Perhaps android's files are smaller.
score: 0
type: Comment

http://stackoverflow.com/comment/43016188
score: 0
comment on: http://stackoverflow.com/q/27273329
type: Comment
type: QuestionComment
has text: change your prof if they cant fix it?! lol...shocking

http://stackoverflow.com/comment/43042165
has text: @JoshTell what are the values for `correct`, `student`, `numIncorrect`? That's the important part in this question
comment on: http://stackoverflow.com/q/27287677
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27207609
score: 0
answers question: http://stackoverflow.com/q/27207358
type: Answer
has body: There are a few things going wrong, but we start by focusing on the original question about the reported failure. Misuse of Scanner.next() The Scanner.next*() methods check the next token. This means that when you call them multiple times in your while loop, you will advance the list faster than what you probably want. We can fix this by calling it once at the start of the loop and holding on to the value. Stopping at "April" I am not completely sure of your requirements so I am not even sure if this needs to be fixed or what behaviour would be expected, but keep in mind the number reading from the input file will stop at the word "April". This is due for it checking whether there are any doubles (floating point numbers) coming up. That is false for a word/string (such as "April"). You could make the code advance by checking the generic hasNext() in combination with next() for a set amount of times if you so desire. Missing output in the output file You may or may not miss out on any output. The file will get created rather fast, but the writing might not happen. This is caused then by the program finishing before the writer can flush the stream. You should call PrintWriter.flush() after doing your println calls to inform the system it should flush the stream. From the documentation for OutputStream.flush(): The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination. The output file may not be in the correct directory As you create the FileWriter with just a filename, I am not fully sure if you want to create it at the current working directory or not. I presume it is unintentional, in which case the filename provided should be dir + "/myDataFile.dat" instead. Faulty minimum/maximum output values You should set max as Double.MIN_VALUE and min as Double.MAX_VALUE when initializing those valu…

http://stackoverflow.com/comment/42850950
type: Comment
type: QuestionComment
score: 0
has text: Thanks @owlstead. It is /dev/urandom.
comment on: http://stackoverflow.com/q/27173833

http://stackoverflow.com/a/27177699
has body: The Java System class doesn't let you set environment variables for you Operating system directly. You can retrieve them using getenv() but there is no equivalent setenv() method. When you start up the JVM, it copies your os's environment into its own Map of Strings. The actual container it uses is an unmodifiable map, probably to be extra safe. So in a running Java application you have 2 environments: the JVM copy that you can read via System.getenv() and the underlying environment that lives in the C library. You should be able to change the JVM's copy using Reflection.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27177468
upvote count: 2

http://stackoverflow.com/comment/43034175
has text: I sure hope you don't think this statement changes `someString`. It doesn't.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27282822
score: 1

http://stackoverflow.com/q/27231749
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/42970449
tagged with: jtable
has comment: http://stackoverflow.com/comment/42942035
score: 0
has body: I am trying to load file name along with few details in the JTable, first time when I press the button, it loads fine, but for the second time when I press the same button it goes blank. Short example: package exampleDemo; public class JTableExample { private JFrame frame; private JTable table_1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JTableExample window = new JTableExample(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public JTableExample() { initialize(); } public void showEmptyTable() { final String[] colNames = {"Sl.no.", "File Name", "Size", "Last Modified", "PO", "LN", "SI", "MS", "PT"}; final String[][] emptyData = { {"", "", "", "", "", "", "", "", "",}, {"", "", "", "", "", "", "", "", "", }, {"", "", "", "", "", "", "", "", "", }, {"", "", "", "", "", "", "", "", "", }, {"", "", "", "", "", "", "", "", "", },}; table_1.setModel(new DefaultTableModel(emptyData, colNames)); frame.getContentPane().add(table_1); JScrollPane scrollPane = new JScrollPane(table_1); scrollPane.setBounds(81, 162, 830, 180); frame.getContentPane().add(scrollPane); }; private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 1002, 576); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); table_1 = new JTable(); table_1.setBounds(81, 162, 830, 180); frame.getContentPane().add(table_1); JButton btnNewButton = new JButton("New button"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { table_1.repaint(); showEmptyTable(); } }); btnNewButton.setBounds(578, 70, 89, 23); frame.getContentPane().add(btnNewButton); } }
has comment: http://stackoverflow.com/comment/42940311
answer count: 1
has title: JTable goes blank for second time when JButton is pressed
accepted answer: http://stackoverflow.com/a/27232267
has comment: http://stackoverflow.com/comment/42940393
linked to: http://stackoverflow.com/q/17874717
linked to: http://stackoverflow.com/q/10413977
has comment: http://stackoverflow.com/comment/42940915
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/42969727
type: Question
tagged with: jbutton
has answer: http://stackoverflow.com/a/27232267
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42940525

http://stackoverflow.com/q/27204250
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27204350
has comment: http://stackoverflow.com/comment/42891164
has answer: http://stackoverflow.com/a/27204350
type: Question
accepted answer: http://stackoverflow.com/a/27204764
tagged with: hashmap
has answer: http://stackoverflow.com/a/27204764
answer count: 2
tagged with: android-listview
upvote count: 1
linked to: http://stackoverflow.com/q/13395114
has body: I have this code, ArrayList&lt;HashMap&lt;String, String&gt;&gt; eventosList; HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;(); contact.put("id", id); contact.put("name", name); eventosList.add(contact); Is it possible to transform this HashMap&lt;String, String&gt; contact to HashMap&lt;String, List&lt;String&gt;&gt;() contact? How can I do this? Thank you so much
favorite count: 0
has title: Transform HashMap<String, String> to HashMap<String, List<String>>()
has comment: http://stackoverflow.com/comment/42891605
has comment: http://stackoverflow.com/comment/42891135
tagged with: android

http://stackoverflow.com/q/27310053
score: 0
answer count: 1
tagged with: applet
has body: I have included all the jar files. This applet is actually calling a restful web service in the localhost only.When I am just running JarExampleApplet.java as "run-as applet", it is working fine.But when I am running it in Browser it is giving me a run time error "java.lang.NoClassDefFoundError: com.sun.jersey.api.client.config.ClientConfig" import java.applet.Applet; import java.awt.Graphics; import java.io.File; import java.io.IOException; import java.nio.file.Files; import javax.ws.rs.core.MediaType; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.LoggingFilter; import com.sun.jersey.core.util.Base64; @SuppressWarnings("serial") public class JarExampleApplet extends Applet { public static final String BASE_URI = "http://localhost:8080/RESTfulWS"; public static final String PATH_NAME = "/file/upload_json/"; public void init () { JarExampleApplet my_client = new JarExampleApplet(); File file_upload = new File("C:/Grails.pdf"); try{ my_client.sendFileJSON(file_upload); } catch(Exception ex) { System.out.println("Exception : " + ex); } } public void paint(Graphics g) { g.drawString("This Applet was read from a .jar file.", 0, 25); } public void sendFileJSON(File file_upload) throws JSONException, IOException{ ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); client.addFilter(new LoggingFilter()); WebResource resource = client.resource(BASE_URI); WebResource service = resource.path("rest").path(PATH_NAME); JSONObject data_file = new JSONObject(); data_file.put("file_name", file_upload.getName()); data_file.put("file", convertFileToString(file_upload)); ClientResponse client_response = service.accept…
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43082517
has answer: http://stackoverflow.com/a/27311021
has title: While running an applet on the browser gives a run time error :- "java.lang.NoClassDefFoundError: com.sun.jersey.api.client.config.ClientConfig"
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: web-services
type: Question

http://stackoverflow.com/comment/42968726
type: Comment
comment on: http://stackoverflow.com/a/27218409
score: 0
type: AnswerComment
has text: Thanks for the answer. This is an interesting design pattern, but I don't think it completely solves the problem. First, it is not possible to specify that some code must be run if a decoration is *not* present. Second, if a `Coffee` is decorated with `CoffeeWithMilk` and `CoffeeWithSugar`, the `drink()` method of both decorations is executed. However, I might want to run code block A if milk is true, code block B if sugar is true, and completely unrelated block C if both sugar and milk are true. Do you if the decorator pattern can be adapted to support this?

http://stackoverflow.com/q/27203438
has answer: http://stackoverflow.com/a/27204666
tagged with: android
favorite count: 0
has title: Downloading files from Zippyshare in android
has body: I want to download files from Zippyshare site in Android. The problem is that content length returned is -1. So I am not able to download a valid file. Here is my code public class DownloadFileDemo1 extends Activity { ProgressBar pb; Dialog dialog; int downloadedSize = 0; int totalSize = 0; TextView cur_val; String dwnload_file_path = "http://www17.zippyshare.com/i/95748527/55444/image.jpeg"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); showProgress(dwnload_file_path); new Thread(new Runnable() { public void run() { downloadFile(); } }).start(); } void downloadFile(){ try { URL url = new URL(dwnload_file_path); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestProperty("Accept-Encoding", "gzip"); urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); //connect urlConnection.connect(); //set the path where we want to save the file File SDCardRoot = Environment.getExternalStorageDirectory(); //create a new file, to save the downloaded file File file = new File(SDCardRoot,"downloaded_file.png"); FileOutputStream fileOutput = new FileOutputStream(file); //Stream used for reading the data from the internet InputStream inputStream = urlConnection.getInputStream(); System.out.println("ENCODING"+urlConnection.getContentEncoding()); if ("gzip".equals(urlConnection.getContentEncoding())) { inputStream = new GZIPInputStream(inputStream); } InputSource is = new InputSource(inputStream); //this is the total size of the file which we are downloading totalSize = urlConnection.getContentLength(); runOnUiThread(new Runnable() { public void run() { pb.setMax(totalSize); } }); //create a buffer... byte[] buffer = new byte[1024]; int bufferLength = 0; while ( (bufferLength = inputStream.read(buffer)) &gt; 0 ) { fileOutput.write(buffer, 0, bufferLength); downloadedSize += bufferLength; // update the progressbar // runOnUiThread(new Runnable…
tagged with: download
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: image
type: Question
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/27176272
tagged with: sieve-of-eratosthenes
has comment: http://stackoverflow.com/comment/42841852
possible better answer: http://stackoverflow.com/a/27176348
accepted answer: http://stackoverflow.com/a/27315497
has answer: http://stackoverflow.com/a/27177056
has comment: http://stackoverflow.com/comment/42870272
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: Sieve of Eratosthenes - HeapMemoryOutOfSpace
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/42842750
type: Question
has answer: http://stackoverflow.com/a/27315497
has body: So I wrote a code to implement sieve of eratosthenes and It works well for small inputs!! As soon as I take n upto the vicinity of 1000000000 it shows and error, HeapMemoryOutOfSpace. I am at a block here and cannot figure out how to get it to work for such large values. Is there some kind of optimization that can be done for this ?? This is for an online judge so the max value of n is the one that I have already mentioned. This is not for a competition and is for my own practice only. Any kind of help will be appreciated!! import java.io.*; class PrimeGenerator { public static void main(String args[]) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t--!=0) { String k[] = br.readLine().split(" "); int m = Integer.parseInt(k[0]); int n = Integer.parseInt(k[1]); long arr[] = new long[n+2]; for(long a=2;a&lt;=n;a++) { arr[(int)a] = 1; } for(long a=2;a*a&lt;=n;a++) { if(arr[(int)a]==1) { for(long b=a;b*a&lt;=n;b++) { arr[(int)(a*b)]=0; } } } for(int a=2;a&lt;=n;a++) { if(arr[a]==1&amp;&amp;arr[a]&gt;=m) { System.out.println(a); } } System.out.println(); } } catch(Throwable e) { e.printStackTrace(); } } }
upvote count: 1
has answer: http://stackoverflow.com/a/27176348
tagged with: java
answer count: 3
tagged with: error-handling

http://stackoverflow.com/comment/42882855
type: Comment
type: QuestionComment
has text: can you post sample input and desired output ?
comment on: http://stackoverflow.com/q/27199318
score: 0

http://stackoverflow.com/a/27229250
answers question: http://stackoverflow.com/q/27229091
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27229091
has body: Consider to use JavaFX. It supports styling via CSS, has APIs for effects, animations etc. and can work with the graphic card. Swing is currently in maintenance mode and JavaFX is the new proposed (by Oracle) standard Java GUI toolkit for Java.
score: 5
type: Answer
upvote count: 5

http://stackoverflow.com/comment/43068302
score: 1
has text: Please post the rest of the stack trace.
comment on: http://stackoverflow.com/q/27302522
type: Comment
type: QuestionComment

infiniband
tags question: http://stackoverflow.com/q/27247302
tag name: infiniband
type: Tag

http://stackoverflow.com/a/27179184
score: 2
has comment: http://stackoverflow.com/comment/42847833
answers question: http://stackoverflow.com/q/27179145
has body: You need to implement some sort of observer pattern. Use BroadcastReceiver, or event bus like otto or GreenRobot. update (more details): build.gradle dependencies { compile 'de.greenrobot:eventbus:2.2.1' } Event.java public class Event { public int value; public Event() {} } MainActivity.java public class MainActivity extends Activity { private Event event = new Event(); // inside a loop event.value = newValue; EventBus.getDefault().post(event); } SecondActivity.java public class SecondActivity extends Activity { @Override public void onResume() { super.onResume(); EventBus.getDefault().register(this); } @Override public void onPause() { EventBus.getDefault().unregister(this); super.onPause(); } public void onEvent(Event event) { // do something } } But more importantly, what type of value are you sending over, and how do you plan on updating it? You should be better off using an IntentService or some background process.
downvote count: 0
has comment: http://stackoverflow.com/comment/42849189
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42848088

pointers
tags question: http://stackoverflow.com/q/27208062
tags question: http://stackoverflow.com/q/27308348
type: Tag
tag name: pointers

http://stackoverflow.com/comment/43070264
score: 4
comment on: http://stackoverflow.com/q/27303639
has text: Use a boolean flag ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42949169
has text: which version of Validator are you using? The @SafeHtml constraint implementation has changed over time.
comment on: http://stackoverflow.com/q/27229817
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42802568
score: 0
comment on: http://stackoverflow.com/q/27154012
type: Comment
type: QuestionComment
has text: also note, this can't handle sigkill (kill -9)

http://stackoverflow.com/q/27268598
has answer: http://stackoverflow.com/a/27269108
type: Question
linked to: http://stackoverflow.com/q/21345950
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/43008240
answer count: 1
tagged with: struts2-json-plugin
has title: Getting JSON object from Java in Struts 2
tagged with: actionresult
has body: I am trying to get response text from Java server using getJSON() jQuery method. Although, I can get response data when the Java class has a simple format: (String, List and Map), I could not get success data when using other Java objects. The following is an Java class, which is using a simple type, and I get the success result with data that works: package com.awitd.framework.action; import com.opensymphony.xwork2.Action; public class getAllJson implements Action{ private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } public String execute() { System.out.println(" this is from action"); data = "["; data += "{"; data += "\"objid\":\"" + "1" + "\","; data += "\"id\":\"" + "1" + "\",\"name\":\"" + "name" + "\""; data += "}"; System.out.println("data " + data); data += "]"; return SUCCESS; } } The following is an Java class, which is using other Java object, and it doesn't return a success data: package com.awitd.framework.action; import java.util.List; import com.opensymphony.xwork2.Action; import com.awitd.framework.entity.Employee; import com.awitd.framework.entity.Profile; import com.awitd.framework.service.EmployeeService; public class getAllJson implements Action{ private String data; private EmployeeService employeeService; private List<Employee> employeeList; private Employee employee; private Profile profile; public String getData() { return data; } public void setData(String data) { this.data = data; } public EmployeeService getEmployeeService() { return employeeService; } public void setEmployeeService(EmployeeService employeeService) { this.employeeService = employeeService; } public String execute() { System.out.println(" this is from action"); data = "["; /*data += "{"; data += "\"objid\":\"" + "1" + "\","; data += "\"id\":\"" + "1" + "\",\"name\":\"" + "name" + "\""; data += "}"; System.out.println("data " + data);*/ employeeList = employeeService.getAll(); System.out.println("size........"+e…
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/27270309
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has comment: http://stackoverflow.com/comment/43010791
accepted answer: http://stackoverflow.com/a/27270558
has title: Java application can't run external jar (FOP) properly, when fop data are larger
has answer: http://stackoverflow.com/a/27270558
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43038016
has comment: http://stackoverflow.com/comment/43011369
type: Question
has body: I have problem with running FOP from Java program. I use Java 1.8_25. Run commands: String[] cmd4 = {"java", "-jar", rootDir+"build"+ FileSeparator +"fop.jar", "-c", rootDir+"lib" + FileSeparator + "conf" + FileSeparator + "myfop.xconf", pathToFOP.getCanonicalPath(), outputFile.getCanonicalPath()}; System.out.println(Arrays.toString(cmd4)); Process p = Runtime.getRuntime().exec(cmd4); p.waitFor(); java.io.InputStream is=p.getInputStream(); byte b[]=new byte[is.available()]; is.read(b,0,b.length); System.out.println(new String(b)); When I generate in program relatively short output, FOP proceeds normally and generates .pdf file. When I generate bigger output (but still on one A4 page) FOP process executes, creates empty .pdf file and waits. When I kill the main program, FOP saves .pdf correctly. But I want to have .pdf file converted while main program is running (it also after that opens generated .pdf file) No error is displayed output of program: [java, -jar, C:\JForm\build\fop.jar, -c, C:\JForm\lib\conf\myfop.xconf, C:\Users\Phoros\Documents\test29x.pdf.fop, C:\Users\Phoros\Documents\test29x.pdf] Thanks for any help.
has comment: http://stackoverflow.com/comment/43054708
tagged with: apache-fop
score: 0
linked to: http://stackoverflow.com/q/25931318

http://stackoverflow.com/comment/43068070
type: QuestionComment
comment on: http://stackoverflow.com/q/27302416
has text: you've got a single score counter. you'd need a different counter for every player, e.g. a score array.
score: 0
type: Comment

http://stackoverflow.com/comment/42902851
has text: It looks like after 154 and before 157, you know how many exams you'll have, and don't need the array before that. So declare the arrays there.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27210166
type: Comment

http://stackoverflow.com/a/27263560
answers question: http://stackoverflow.com/q/27261958
score: 0
type: Answer
has body: use these dependencies jackson-databind jackson-annotations jackson-core public class JsonTest { public static void main(String[] args) throws JsonProcessingException { ObjectMapper mapper=new ObjectMapper(); Map&lt;String,String&gt; dt=new Hashtable(); dt.put("1", "welcome"); dt.put("2", "bye"); String jsonString = mapper.writeValueAsString(dt) System.out.println(jsonString); } } This is what you want.

http://stackoverflow.com/comment/43048238
type: AnswerComment
has text: Thank you but it doesn't work but My idea knows it :(
comment on: http://stackoverflow.com/a/27291122
score: 0
type: Comment

http://stackoverflow.com/comment/42927710
type: Comment
comment on: http://stackoverflow.com/a/27222312
score: 0
type: AnswerComment
has text: Please try to do this, I need it very much, what i need from you is to get parameters sent from ajax in servlet and pass these parameters into another java class method, the rest I will do it thanks once more, I wait you.

http://stackoverflow.com/comment/43051683
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27288311
has text: it is in DB and is the return of statement which is called in interceptor, so other than saving that ID somewhere after recieving there is no other option.
score: 0

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/27156671
type: Tag

http://stackoverflow.com/comment/46347151
comment on: http://stackoverflow.com/q/27284796
score: 0
type: QuestionComment
has text: in SA4A, go in Menu --> view --> interpreters then Menu --> add --> JRuby it will download the .apk file for JRuby, install it, start it in the app click install, now in SL4A you can create and launch JRuby script or star an interactive console in Menu --> view --> interpreters
type: Comment

http://stackoverflow.com/a/27214600
has body: Approach 2 is the best performing solution. You shouldn't select entities when you are only interested in projections. Using SQL projection to a DTO result object is the way to go.
answers question: http://stackoverflow.com/q/27210577
type: Answer
accepted answer of: http://stackoverflow.com/q/27210577
score: 0
has comment: http://stackoverflow.com/comment/42997214
type: AcceptedAnswer

http://stackoverflow.com/a/27241554
has comment: http://stackoverflow.com/comment/42976881
has comment: http://stackoverflow.com/comment/42976840
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27241517
has comment: http://stackoverflow.com/comment/42976781
has comment: http://stackoverflow.com/comment/42974671
has comment: http://stackoverflow.com/comment/42976702
downvote count: 0
has body: Methods can't be "disabled" but you can use a boolean variable and an if statement to achieve the same functionality: boolean isClicked = false; public void paint(Graphics g) { super.paint(); fare.setLocation(160,50); farenheit.setLocation(90,50); convert.setLocation(310,5); draw(g); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == convert) { isClicked = true; } } public void draw(Graphics g) { if (isClicked) { g.setColor(Color.BLUE); g.fill3DRect(0,0,400,100,true); } }
has comment: http://stackoverflow.com/comment/42992648
type: Answer

http://stackoverflow.com/comment/43052660
has text: Thanks a lot all I had to do therefore was move the List outside the method. Thanks all for your help !
score: 0
comment on: http://stackoverflow.com/q/27293431
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43070653
type: Comment
type: QuestionComment
has text: Maps don't keep the order of items.
score: 5
comment on: http://stackoverflow.com/q/27303883

http://stackoverflow.com/comment/97002409
comment on: http://stackoverflow.com/a/39985968
score: 0
type: AnswerComment
type: Comment
has text: Heads up you have to keep the test window tap open or the test will not rerun

http://stackoverflow.com/a/27209287
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27208872
upvote count: 3
has body: I'd do: List&lt;WebElement&gt; we = chromeDriver.findElements(By.cssSelector(".your-class a")); we.get(1) //should get first element in array
score: 3

http://stackoverflow.com/q/27292459
tagged with: if-statement
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27292538
answer count: 3
tagged with: loops
tagged with: for-loop
has body: I'm sorry if this is a silly question but I am fairly new to coding and so for my assignment I was given this code: package webservice; import webservice.Weather; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.print ("Enter the zip code : "); java.lang.String zipCode = scan.nextLine(); try{ webservice.Weather service = new webservice.Weather(); webservice.WeatherSoap port = service.getWeatherSoap(); webservice.WeatherReturn result = port.getCityWeatherByZIP(zipCode); System.out.print(result.getCity()+ " "); System.out.println (result.getState()); System.out.println("Zip code " + zipCode); System.out.println ("Current Temperature is " + result.getTemperature()); } catch (Exception ex){ System.out.println("Error"); } }//end main }//end class The code runs perfectly fine but I have to have it loop until i enter "0" for the zip code. I'm fairly new to coding and I tried to review my previous works to try to incorporate a loop but I was never successful. Which loop would be the most efficient to have the code loop until the user enters "0" as the zip code?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27292587
has answer: http://stackoverflow.com/a/27292547
tagged with: while-loop
type: Question
has title: How to have my code run until I enter a number

http://stackoverflow.com/a/27282780
answers question: http://stackoverflow.com/q/27282624
type: Answer
has body: You could use the following; int size = 3; List&lt;String&gt; nameList = new ArrayList(); //initializing the size of the array //Scan in all names in file. Scanner playerNamesScan = new Scanner(new File("c:/temp/PlayerNames.txt")); while(playerNamesScan.hasNextLine()) { nameList.add(playerNamesScan.nextLine()); } String[] nameArray = nameList.toArray(new String[nameList.size()]); System.out.print(Arrays.toString(nameArray));
score: 0

http://stackoverflow.com/comment/43044565
has text: Still getting same exception? Then share the exception stacktrace to see the exception caused line!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27288132

http://stackoverflow.com/comment/42884863
type: Comment
type: QuestionComment
has text: @SomChatterjee,where assert directory located in your project ? and nothing going wrong in your code might be some problem assert directory structure.
comment on: http://stackoverflow.com/q/27200580
score: 0

http://stackoverflow.com/a/27239266
type: Answer
has comment: http://stackoverflow.com/comment/42955222
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27239142
has body: ition } else if (guessedNum &lt; hiddenNum) { System.out.println("Not matched! Try a bigger number"); //checking another condition } else if (guessedNum &gt; hiddenNum) { System.out.println("Not matched! Try a smaller number"); } } } }
accepted answer of: http://stackoverflow.com/q/27239142

http://stackoverflow.com/comment/42982990
type: Comment
type: QuestionComment
score: 2
has text: I feel this is kind of opinion based. What I typically do, for example, is store my `@Controller` types in one package, so I'll name the corresponding class or interface `Controllers` in `Controllers.java`.
comment on: http://stackoverflow.com/q/27254556

http://stackoverflow.com/comment/42856767
type: Comment
type: QuestionComment
has text: http://imgur.com/bLGim3k this is the link...
comment on: http://stackoverflow.com/q/27182845
score: 0

http://stackoverflow.com/comment/115041345
has text: This is very well explained and enough of reference to information.
comment on: http://stackoverflow.com/a/64928368
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27297426
has comment: http://stackoverflow.com/comment/43059380
accepted answer: http://stackoverflow.com/a/27368517
answer count: 1
downvote count: 0
favorite count: 0
tagged with: powermock
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/27368517
tagged with: maven
type: AnsweredQuestion
tagged with: jenkins
score: 1
tagged with: java
has title: Memory leak with PowerMock on Jenkins
upvote count: 1
type: Question
has body: I think I'm getting memory leaks when using Jenkins to execute my unit tests. If I try to execute more than ~60 unit tests I start to get most tests failing with java.lang.OutOfMemoryError: PermGen space. Often, but not always, the stack trace seems to start in or near org.powermock.core.classloader.MockClassLoader, although it's not consistent. the The maven surefire plugin configuration is pretty straightforward: org.apache.maven.plugins maven-surefire-plugin 2.18 test false -XX:PermSize=512m -XX:MaxPermSize=1024m In Jenkins, MAVEN_OPTS is also set to -XX:MaxPermSize=1024m. I saw some documents suggesting it might be related to the fact that I was using an older version of powermock, so I upgraded to 1.6.0, but I am still experiencing this error. I can't reproduce the problem locally, it only seems to happen on the Jenkins server. I'm not sure how to reliably resolve this: limiting the number of tests cases that execute seems to work OK, but I have 150+ test cases to execute and running batches of 50 tests at a time on the server does not seem like a very good solution. I might be able to give it a bit more memory but it seems like it already has enough, and I don't think surefire needs that much memory when it runs locally. There might be a way to play around with some of the other surefire settings, but I'm not sure which ones I'd need to adjust, or how. Has anyone else every seen this, or have a suggestion for how to resolve it? This might be relevant: The development environment is IBM's RAD, and the workspace is launched with the option -Xgcpolicy:gencon, which as far as I can tell is specific to IBM's implementation of the JVM. Might this be the reason that the unit tests run fine when I run maven from RAD, but not from Jenkins? If so, what would be an equivalent option for the standard (Oracle) JVM, which Jenkins is using?
has comment: http://stackoverflow.com/comment/43076053

atomic
type: Tag
tags question: http://stackoverflow.com/q/27241655
tag name: atomic
tags question: http://stackoverflow.com/q/27212133

http://stackoverflow.com/a/27157588
type: Answer
score: 2
downvote count: 0
has body: You can utilize simple HTML in Swing to style JLabels: " CRUISES Add or remove Cruises or click to assign a Cruise to a ship. " Which will look like: "CRUISES Add or remove Cruises or click to assign a Cruise to a ship." This might be better than using two JLabels, if it does meet the layout requirements.
upvote count: 2
answers question: http://stackoverflow.com/q/27157187

http://stackoverflow.com/q/27164019
has title: Can not run empty AndroidStudio 0.8.14 project with google-cloud-storage client library
tagged with: google-cloud-storage
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27284477
favorite count: 0
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: android-studio
tagged with: java
accepted answer: http://stackoverflow.com/a/27284477
linked to: http://stackoverflow.com/q/18002293
upvote count: 1
tagged with: gradle
type: Question
has body: I am creating a simple Android app that would take a picture and upload it to Google cloud storage. The simplest (and recommended) way is to use the provided client library. But even the empty AndroidStudio with dependency to gcs fails to run. It compiles, but fails to run with the failures: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages. Error:Execution failed for task ':app:preDexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: /home/milan/AndroidStudioSdk/sdk/build-tools/21.1.1/dx --dex --output /home/milan/AndroidStudioProjects/Test/app/build/intermediates/pre-dexed/debug/transaction-api-1.1-d542431644c5559f18a80700bbbf3a2bc4472ff7.jar /home/milan/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/transaction-api-1.1.jar Error Code: 1 Output: trouble processing "javax/transaction/HeuristicCommitException.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library........... I am using AndroidStudio 0.8.14 on Kubuntu 14.10 with java-7-jdk-oracle (1.7.0_72-b14). I have read and tried everything from stackoverflow / web I could find: invalidating cache, cleaning up the project, compile the library from sources, even reinstall of the OS. Nothing worked so far. preDex failed in all cases. build.gradle: android { compileSdkVersion 21 buildToolsVersion "21.1.1" defaultConfig { minSdkVersion 15 targetSdkVersion 21 } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.appengine.tools:appengine-gcs-client:0.4.3' } Is there anyone who can create default AndroidStudio 0.8.14 project with project dependency to google cloud services and is able to RUN the application? Your build.gradle would help a lot. I am pro…

http://stackoverflow.com/q/27286358
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: min
has answer: http://stackoverflow.com/a/27286390
possible better answer: http://stackoverflow.com/a/27286415
has title: Java find min and max value in 2d array. Minimum value found is not correct
has answer: http://stackoverflow.com/a/49792094
answer count: 6
has answer: http://stackoverflow.com/a/27286415
has answer: http://stackoverflow.com/a/27286611
score: 0
has answer: http://stackoverflow.com/a/27286480
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/43040102
has body: Here is my code in which I declare a 2d array with all the values and I'm trying get it to print the min and max values. The max value turns out right but the min value does not. When I run it, the max is 9.73 (which is correct) and the min printed is 5.44, which is incorrect because if you look at the values in the array, you see that 5.29 is the minimum value. Does anyone know why it won't find the correct min value? Thanks in advance! public class Test { public static double[][] array1 = //array to be used {{7.51, 9.57, 6.28, 5.29, 8.7}, {8.07, 6.54, 5.44, 8.78, 8.66}, {9.34, 9.73, 7.19, 6.87, 6.48}}; public static void main(String[] args) { double h = array1[0][0];// highest value double l = array1[0][0];// lowest value for (int row = 1; row &lt; array1.length; row++){ //find highest value for (int col = 1; col &lt; array1.length; col++){ if (array1[row][col] &gt; h){ h = array1[row][col]; } } } for (int r = 1; r &lt; array1.length; r++){ //find lowest value for (int c = 1; c &lt; array1.length; c++){ if (array1[r][c] &lt; l){ l = array1[r][c]; } } } System.out.println(h);//print highest System.out.println(l);//print lowest } }
has answer: http://stackoverflow.com/a/27286389
accepted answer: http://stackoverflow.com/a/27286480

http://stackoverflow.com/comment/42944698
score: 0
has text: I would create a method that creates and returns the sequence action, and then you can call it as many times as you like to get copies of the same thing. This would probably perform better and be less error prone than doing some sort of deep copy with reflection.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27233685

geotools
type: Tag
tags question: http://stackoverflow.com/q/27286920
tags question: http://stackoverflow.com/q/27240869
tag name: geotools

http://stackoverflow.com/a/27310746
downvote count: 0
score: 1
has body: The answer is indeed: if( !val.equals("0") &amp;&amp; !val.equals("1")) { System.our.println("Value should be either 0 or 1"); } But how do you get to it? You want to enter the else branch of your statement so, you negate it. val.equals() negated becomes !val.equals() Logically OR negated becomes AND (and viceversa) so: || becomes &amp;&amp;
upvote count: 1
answers question: http://stackoverflow.com/q/27310625
type: Answer

http://stackoverflow.com/comment/42928451
comment on: http://stackoverflow.com/q/27224577
score: 1
has text: Since cloning doesn't use constructor in order to create a copy of the object and since `clone` method creates a clone by invoking `super.clone()` which will call Object's `clone` method, it *must* be native in order to create *new* and equal object.
type: Comment
type: QuestionComment

serialization
tags question: http://stackoverflow.com/q/27170657
tags question: http://stackoverflow.com/q/27222744
tags question: http://stackoverflow.com/q/27252860
tags question: http://stackoverflow.com/q/27196185
tags question: http://stackoverflow.com/q/27231518
tags question: http://stackoverflow.com/q/27307998
tags question: http://stackoverflow.com/q/27279322
tag name: serialization
tags question: http://stackoverflow.com/q/27260937
tags question: http://stackoverflow.com/q/27204324
tags question: http://stackoverflow.com/q/27240803
tags question: http://stackoverflow.com/q/27247767
tags question: http://stackoverflow.com/q/27270950
type: Tag
tags question: http://stackoverflow.com/q/27174238
tags question: http://stackoverflow.com/q/27221035
tags question: http://stackoverflow.com/q/27185869
tags question: http://stackoverflow.com/q/27280493
tags question: http://stackoverflow.com/q/27285708
tags question: http://stackoverflow.com/q/27281794
tags question: http://stackoverflow.com/q/27199796
tags question: http://stackoverflow.com/q/27209427
tags question: http://stackoverflow.com/q/27250386
tags question: http://stackoverflow.com/q/27218552
tags question: http://stackoverflow.com/q/27230010

http://stackoverflow.com/comment/42999561
type: QuestionComment
score: 2
has text: I recommend you don't do this. Build an index. I did experiments with binary searching of files decades ago. The conclusion was that that's why we have B-trees.
comment on: http://stackoverflow.com/q/27263564
type: Comment

http://stackoverflow.com/comment/42987168
comment on: http://stackoverflow.com/q/27252974
type: Comment
type: QuestionComment
has text: Do you really need multipart/form-data?
score: 0

http://stackoverflow.com/a/27284549
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27283805
accepted answer of: http://stackoverflow.com/q/27283805
has body: Problem solved: public Action3d getAction(){ SequenceAction action = new SequenceAction(); for(Vector3 pos : playerStation.getPath()){ action.addAction(Actions3d.moveTo(pos.x, pos.y, pos.z, 5)); } return action; }
type: AcceptedAnswer

http://stackoverflow.com/comment/42958609
type: AnswerComment
comment on: http://stackoverflow.com/a/27241002
score: 0
has text: @BrettCunninghamII: don't confuse display of a number with the internal storage of a number. Have methods for display, but do not internally represent the numbers as Strings or use Strings in your equations. That's dangerous business.
type: Comment

http://stackoverflow.com/comment/43078879
has text: Yes, it looks for the "Can you open Chrome" and replies with "Yes, one moment."
comment on: http://stackoverflow.com/q/27308407
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42979345
comment on: http://stackoverflow.com/q/27252655
type: QuestionComment
has text: What list implementation is this? (It makes a huge difference.) For something like ArrayList, you'd just replace one and insert another one before or after it.
score: 0
type: Comment

http://stackoverflow.com/comment/42988257
score: 2
comment on: http://stackoverflow.com/q/27257301
has text: Looks like you're writing code outside of a method, which is invalid in Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27300962
favorite count: 0
upvote count: 12
has title: Iterate Java Map with index
has answer: http://stackoverflow.com/a/65949695
tagged with: dictionary
tagged with: collections
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27301043
type: Question
has answer: http://stackoverflow.com/a/27301091
has answer: http://stackoverflow.com/a/27301043
tagged with: writer
score: 12
possible better answer: http://stackoverflow.com/a/64429725
has body: How can I iterate a Map to write the content from certain index to another. Map&lt;String, Integer&gt; map = new LinkedHashMap&lt;&gt;(); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file)); for (String string : map.keySet()) { bufferedWriter.write(string + " " + map.get(string)); bufferedWriter.newLine(); } bufferedWriter.close(); I have two int values, from and to, how can I now write for example from 10 to 100? is there any possibility to iterate the map with index?
tagged with: io
has answer: http://stackoverflow.com/a/64429725
answer count: 4

http://stackoverflow.com/comment/43029453
type: Comment
has text: @user2649681 this will be the MainActivity, not the Runnable. Did you try the code?
comment on: http://stackoverflow.com/a/27280256
score: 0
type: AnswerComment

http://stackoverflow.com/q/27283594
type: Question
tagged with: boolean
answer count: 2
has comment: http://stackoverflow.com/comment/43069315
has comment: http://stackoverflow.com/comment/43069660
tagged with: arrays
has title: java boolean array and turning every third value to false
favorite count: 0
upvote count: 0
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/27283782
downvote count: 4
has body: The Boolean array is initialized to true. I need to know how to turn every third value to false and also going through the array over and over. It is essentially duck duck goose without the randomness.
has comment: http://stackoverflow.com/comment/43069741
tagged with: java
has comment: http://stackoverflow.com/comment/43035541
has answer: http://stackoverflow.com/a/27283666

http://stackoverflow.com/a/27177352
answers question: http://stackoverflow.com/q/27173160
has comment: http://stackoverflow.com/comment/42843854
score: 0
has body: Use a file extension no one else uses, then use this answer to open all such files with your app.
type: Answer

http://stackoverflow.com/comment/42974427
comment on: http://stackoverflow.com/a/27245498
type: Comment
score: 0
type: AnswerComment
has text: Yes PCM is audio format. More low level raw format. Unfortunately I don't exactly how accurate it is. PCM usually packed into WAV container https://en.wikipedia.org/wiki/WAV

http://stackoverflow.com/comment/42859769
type: Comment
has text: I Edit it another time.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27186453

http://stackoverflow.com/comment/42901523
comment on: http://stackoverflow.com/q/27209935
score: 0
has text: It should be `||`, not `&&`, right?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27199796
tagged with: java
has title: Creating a ruby optimized version while dumping in snakeyaml
type: Question
tagged with: yaml
accepted answer: http://stackoverflow.com/a/27199987
score: 0
has body: I recently tried to dump an object to an .yaml file and everything works fine. But, the problem is I want an ruby optimized version since the output file is used by ruby. Currently, the dumped file contains the following: {foo: null, bar: null, foo1: null, bar1: null} But, I need the output as follows: --- bar: ~ bar1: ~ foo: ~ foo1: ~ So, how can I do that using snakeyaml. I got the utf-8 optimized version of ruby at http://www.yamllint.com/.
answer count: 1
tagged with: snakeyaml
tagged with: serialization
has answer: http://stackoverflow.com/a/27199987
type: AnsweredQuestion

http://stackoverflow.com/comment/43019964
has text: @emekamba That is much better, but we still need to see the code for the `getDuplicate` method.
score: 0
comment on: http://stackoverflow.com/q/27274612
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43067737
comment on: http://stackoverflow.com/q/27301942
type: Comment
type: QuestionComment
score: 0
has text: "I properly declared my ArrayList as a private ArrayList" - it's public in the code, not private.

http://stackoverflow.com/comment/42942757
type: QuestionComment
comment on: http://stackoverflow.com/q/27231808
type: Comment
score: 0
has text: I'm curious if you know what the arguments to GridLayout constructor actually do?

http://stackoverflow.com/a/27253108
upvote count: 2
has comment: http://stackoverflow.com/comment/42981116
has comment: http://stackoverflow.com/comment/42980308
has comment: http://stackoverflow.com/comment/42980940
downvote count: 0
has comment: http://stackoverflow.com/comment/42980741
has body: The = just makes both references point to the same object. If you want to make a copy(in general), then have a look at Cloninng(Not Recommended) in Java or consider a Copy-Constructor. To solve your problem, change your copy method to the following: public void copy(){ for(int i=0; i&lt;tt.length; i++) for(int j=0; j&lt;tt[i].length; j++) ttt[i][j]= tt[i][j]; }
type: Answer
answers question: http://stackoverflow.com/q/27253003
score: 2

http://stackoverflow.com/q/27178431
possible better answer: http://stackoverflow.com/a/27178719
downvote count: 0
has answer: http://stackoverflow.com/a/27179146
accepted answer: http://stackoverflow.com/a/27179146
tagged with: centos
has comment: http://stackoverflow.com/comment/42845794
tagged with: linux
has answer: http://stackoverflow.com/a/27178719
has comment: http://stackoverflow.com/comment/42847017
has title: Calling journalctl from Java
favorite count: 0
has comment: http://stackoverflow.com/comment/42846538
has comment: http://stackoverflow.com/comment/42856416
has comment: http://stackoverflow.com/comment/42845987
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: When I run the following command as the root user in the Centos 7 Linux terminal, it produces 57 lines of output: journalctl --output=json-pretty UNIT=firewalld.service So how do I change the code below to successfully call this from Java without having to leave my password in a file? Here is my attempt. When I execute the following code, the console only outputs exit: 1: String s; Process p; try { p = Runtime.getRuntime().exec("journalctl --output=json-pretty UNIT=firewalld.service"); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((s = br.readLine()) != null) System.out.println("line: " + s); p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch (Exception e) {} Edit When I add the following: BufferedReader br2 = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = br2.readLine()) != null) System.out.println("error line: " + s); The following output gets generated: error line: No journal files were found. error line: Failed to get realtime timestamp: Cannot assign requested address Is the problem related to permissions? When I run journalctl --output=json-pretty UNIT=firewalld.service as root from the Linux terminal, I get the 57 lines of output. But when I run journalctl --output=json-pretty UNIT=firewalld.service as a normal user, the terminal tells me that no files were found. I do not want to put my root password in Java code. Is there some other way to call journalctl from Java without having to leave the system root password in a file?
type: Question
answer count: 2

http://stackoverflow.com/comment/42970349
comment on: http://stackoverflow.com/q/27247823
type: Comment
type: QuestionComment
has text: `The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory `
score: 0

http://stackoverflow.com/comment/43919807
comment on: http://stackoverflow.com/a/27186792
score: 0
type: AnswerComment
has text: This is a follow up error. Did you include a JBIG plugin jar in your classpath? https://pdfbox.apache.org/dependencies.html
type: Comment

http://stackoverflow.com/q/27294637
has answer: http://stackoverflow.com/a/27316279
downvote count: 0
has title: How to convert from a List to Array ? Android
possible better answer: http://stackoverflow.com/a/27357979
has body: okay guys, here is the thing, I have one application consuming ODATA service, in SMP server, I'm getting this Data like this: public class callService extends AsyncTask&lt;Void, Void, ArrayList&lt;String&gt;&gt; { public ArrayList&lt;String&gt; doInBackground(Void... params) { ODataConsumer c = ODataJerseyConsumer.create("http://MyUrlService:8080"); List&lt;OEntity&gt; listEntities = c.getEntities("MYENTITYTOCONSUME").execute().toList(); System.out.println("Size" + listEntities.size()); if (listEntities.size() &gt; 0) { for (OEntity entity : listEntities) { zmob_kunnr.add((String) entity.getProperty("Name1").getValue() + " - " + entity.getProperty("Kunnr").getValue().toString()); } } return zmob_kunnr; } protected void onPostExecute(ArrayList&lt;String&gt; result) { super.onPostExecute(result); adapter = new ArrayAdapter&lt;String&gt;(ConsumoKnuur.this, android.R.layout.simple_list_item_1, result); list.setAdapter(adapter); } } Okay I got this solution from web and could implement as list, and I need to store this entity which one is a List of customers and get the two attributes from this entity and save in my database so: Entity Customer:Custormer_ID, Customer_Name Here is my code to call my sqlite: public void sqlite() { sql_obj.open(); sql_obj.deleteAll(); for(int i=0; i &lt; zmob_kunnr.size(); i++) { sql_obj.insert(zmob_kunnr.get(i).toString(), zmob_kunnr.get(i).toString() ); } sql_obj.close(); } And my SQLite: private static final String TABLE_CLIENTE = "CREATE TABLE " + TB_CLIENTE + "(ID_CLIENTE INTEGER PRIMARY KEY AUTOINCREMENT, " //Id for controller my logics + " Kunnr TEXT , " //customer ID + " Name1 TEXT );"; //customer_name public long insert(String name1, String Kunnr) { ContentValues initialValues = new ContentValues(); initialValues.put("Name1", Name1); //Customer_Name initialValues.put("Kunnr", Kunnr); //Customer_ID return database.insert(TB_CLIENTE, null, initialValues); } And off course my other methods, that is not important, so whats happening wh…
has comment: http://stackoverflow.com/comment/43090292
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43081230
answer count: 2
has comment: http://stackoverflow.com/comment/43055085
has comment: http://stackoverflow.com/comment/43088975
linked to: http://stackoverflow.com/q/85190
upvote count: 1
tagged with: sqlite
tagged with: arrays
has comment: http://stackoverflow.com/comment/43088538
has comment: http://stackoverflow.com/comment/43088141
tagged with: odata
favorite count: 0
accepted answer: http://stackoverflow.com/a/27316279
tagged with: android
has answer: http://stackoverflow.com/a/27357979
has comment: http://stackoverflow.com/comment/43090419
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43061694

http://stackoverflow.com/comment/42803900
score: 0
comment on: http://stackoverflow.com/a/27154698
type: Comment
has text: Can you add your Register class to the question? Else I can't see the problem
type: AnswerComment

http://stackoverflow.com/q/27289398
type: Question
has answer: http://stackoverflow.com/a/27290233
tagged with: javascript
has body: I'm trying to generate Javascript from Java files using GWT. I'm using Maven to build my GWT project but now I'm trying to shorten the Maven build times. I'm no Maven expert and so I've come here.. It seems Maven is generating .class files from my Java files which I don't think is necessary because I just need the Javascript files and GWT is a source to source compiler. I don't need any jars, wars or anything else. Just Javascript files. Here is my POM file: <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 com.app webapp 1.0 jar org.timepedia.exporter gwtexporter 2.4.0 provided com.google.gwt gwt-user 2.7.0 provided org.apache.maven.plugins maven-compiler-plugin 3.2 1.6 1.6 org.codehaus.mojo gwt-maven-plugin 2.7.0 ${WEBAPP_DIRECTORY} compile src
accepted answer: http://stackoverflow.com/a/27290233
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: Maven GWT - Output only Javascript files
tagged with: maven
tagged with: gwt
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/a/27163582
type: AcceptedAnswer
type: Answer
has body: The exception stack trace shows an enf of file while trying to read the object stream header. From this we can determine several things: the problems occurs while reading an object from file C:/Users/Myself/Desktop/Hospital.db. It does not happen while writing an object as your problem description seems to imply the trace ObjectInputStream.readStreamHeader() shows that the stream is trying to read its header, so it happens at the beginning of the file. The stream header is normally made of 2 short values AC ED and 00 05, the first 4 bytes in the stream the fact that EOFException is thrown before the stream header can be read implies that the stream has less than 4 bytes in it. I'll even bet it's empty. Why is it empty? It's impossible to know without seeing more of your code So, in short: your code is trying to deserialize an object from an empty file, causing the exception you are observing.
accepted answer of: http://stackoverflow.com/q/27154062
answers question: http://stackoverflow.com/q/27154062
score: 0

http://stackoverflow.com/comment/43040447
has text: Bro you have to make this class I am adding a sample in my answer.
comment on: http://stackoverflow.com/a/27270920
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27795227
has comment: http://stackoverflow.com/comment/63369809
upvote count: 8
has comment: http://stackoverflow.com/comment/63254059
has comment: http://stackoverflow.com/comment/63400566
type: Answer
has comment: http://stackoverflow.com/comment/71098345
score: 8
has body: This is how you get key/value for AcroForms: (This particular program prints it to the console.) package pdf_form_filler; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.interactive.form.*; import java.io.File; import java.util.*; public class pdf_form_filler { public static void listFields(PDDocument doc) throws Exception { PDDocumentCatalog catalog = doc.getDocumentCatalog(); PDAcroForm form = catalog.getAcroForm(); List&lt;PDFieldTreeNode&gt; fields = form.getFields(); for(PDFieldTreeNode field: fields) { Object value = field.getValue(); String name = field.getFullyQualifiedName(); System.out.print(name); System.out.print(" = "); System.out.print(value); System.out.println(); } } public static void main(String[] args) throws Exception { File file = new File("test.pdf"); PDDocument doc = PDDocument.load(file); listFields(doc); } }
answers question: http://stackoverflow.com/q/27282537
downvote count: 0

http://stackoverflow.com/q/27306892
has comment: http://stackoverflow.com/comment/43076369
upvote count: 1
type: AnsweredQuestion
has body: I am working on a robot maze where the robot finds the target without bumping into walls. As a "backtrack" method, I need the robot to go in the opposite direction as it did when it first came across a junction. This is my code:
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27307137
type: Question
answer count: 2
tagged with: iterator
has comment: http://stackoverflow.com/comment/43077014
has comment: http://stackoverflow.com/comment/43078481
downvote count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43078309
has title: How to return the first result in an ArrayList using iterator
favorite count: 0
has answer: http://stackoverflow.com/a/27307137
possible better answer: http://stackoverflow.com/a/27307071
has answer: http://stackoverflow.com/a/27307071

http://stackoverflow.com/a/41169877
answers question: http://stackoverflow.com/q/27295720
has body: This works for all my services. This is a runtime exception indicating a resource requested by a client was not found on the server. Add below entry into your web.xml : resteasy.resources com.org.abc.xyz.MainClassName You can specify fully qualified name of your JAX-RS resource class name you want to register. If you have multiple classes entries, use comma delimiter.
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/27222519
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42923604
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27222697
has answer: http://stackoverflow.com/a/27222919
has title: how to improve performance when tons of AsyncTasks running
linked to: http://stackoverflow.com/q/4068984
has body: I have been writing a file download module, when user select some files and click download button, it will create as many AsyncTasks as the files. All these files were added to an array. Then I traverse the array, create an AsyncTask for the file, call execute method of each AsyncTask instance. I tested this module by downloading 20 photos, 1 MB each, turned out it can successfully download these files and being stable. But problem comes when I add thousands of files, for example 2000 photos, to download. When user click to download those 2000 photos, it will create 2000 AsyncTasks and call execute method of each immediately. That`s not the best practice, or even cause OOM, I think. Because it starts 2000 threads at the same time, though only the top 5 AsyncTask instances will invoke their doInbackground method on Kitkat according to official document, 2000 threads were created and allocated resources already (right?) which may leads up to OOM. For a better performance, I plan to manage these AsyncTasks in a queue, only poll top five instances and execute them, anyone is done executing, it sends a notification and poll a substitute one out until all remaining AsyncTasks have been executed. I wonder if it is right to think like this. Thanks in advance! method for add download task /** * Add a new download task */ public int addDownloadTask(Account account, String repoName, String repoID, String path) { // omit lines... DownloadTask task = new DownloadTask(account, repoName, repoID, path); // execute download task serially task.execute(); return task.getTaskID(); } call addDownloadTask in a loop for (SeafDirent seafDirent : dirents) { if (!seafDirent.isDir()) { File localCachedFile = dataManager.getLocalCachedFile(repoName, repoID, seafDirent.name), seafDirent.id); if (localCachedFile == null) { txService.addDownloadTask(account, repoName, repoID, Utils.pathJoin(filePath, seafDirent.name)); } } }
has comment: http://stackoverflow.com/comment/42927002
possible better answer: http://stackoverflow.com/a/27222697
has comment: http://stackoverflow.com/comment/42924688
answer count: 3
has comment: http://stackoverflow.com/comment/42924513
downvote count: 0
has comment: http://stackoverflow.com/comment/42924411
has comment: http://stackoverflow.com/comment/42924293
favorite count: 0
has comment: http://stackoverflow.com/comment/42924948
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/27222919
has comment: http://stackoverflow.com/comment/42924592
has comment: http://stackoverflow.com/comment/42923639
has answer: http://stackoverflow.com/a/27222845
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/42924180
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42923611

http://stackoverflow.com/comment/42887800
has text: @SimeonPopov, actually a do while loop is guaranteed to run at least once. The reason is that the check is technically outside the scope ({...}) of the do-while, hence the cannot be resolved to a variable error.
comment on: http://stackoverflow.com/a/27202192
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27226828
downvote count: 3
has answer: http://stackoverflow.com/a/27226904
accepted answer: http://stackoverflow.com/a/27226904
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42931281
has comment: http://stackoverflow.com/comment/42931322
has body: Kh-H0f2ZNYcxWYQtJvA-4jQ2rnm8WQSsVsNFkVRMYxpg-1417365081517,38606,"Best Buy Co, Inc.",BBY01-694284011841 expected ans is Kh-H0f2ZNYcxWYQtJvA-4jQ2rnm8WQSsVsNFkVRMYxpg-1417365081517 "Best Buy Co, Inc." BBY01-694284011841 but i'm getting Kh-H0f2ZNYcxWYQtJvA-4jQ2rnm8WQSsVsNFkVRMYxpg-1417365081517 "Best Buy Co Inc." BBY01-694284011841 i used split String s="..."; String s[]=s.split(",");
upvote count: 0
answer count: 1
favorite count: 0
score: -3
has title: separate string by comma in java using regex
type: AnsweredQuestion

http://stackoverflow.com/comment/43037492
type: AnswerComment
type: Comment
score: 3
comment on: http://stackoverflow.com/a/27226102
has text: You are loading the whole file into memory. This solution will not scale

http://stackoverflow.com/q/27192332
has comment: http://stackoverflow.com/comment/42870448
type: AnsweredQuestion
score: 1
tagged with: java
has title: Does static method cache return values?
has body: I have a static method which returns java.util.Date. When I first call it, it returns the right date. However, when I call it again after say 2 minutes, it still returns the first date. The date is always created in the method Date date = new Date(); and is not stored outside of it. My static method is a part of a rather complicated Android class system, so there is a high likelihood that the error is somewhere else. I just want to know if it is possible that a static method caches its return values.
type: Question
has answer: http://stackoverflow.com/a/27192421
has comment: http://stackoverflow.com/comment/42870537
downvote count: 0
accepted answer: http://stackoverflow.com/a/27192421
has comment: http://stackoverflow.com/comment/42870472
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42870347
upvote count: 1

http://stackoverflow.com/a/27300145
downvote count: 0
has body: You didn't show where showInterstitial() is being called which contains the call to isLoaded! Please check your stack trace for more clues. Blindly I would say that you're calling showInterstitial from an event listener or other (Gdx?) background thread. If that's the case you have two options: Make showInterstitial() fool-proof public void showInterstitial() { if(Looper.myLooper() != Looper.getMainLooper()) { runOnUiThread(new Runnable() { @Override public void run() { doShowInterstitial(); } }); } else { doShowInterstitial(); } } private void doShowInterstitial() { if (iAd.isLoaded()) { iAd.show(); } else { //Log.d(TAG, "Interstitial ad is not loaded yet"); } } Make calling code smarter void myMethodCallingShowInterstitial() { ... doing my other background stuff ... // replace showInterstitial(); with below: activityReference.runOnUiThread(new Runnable() { @Override public void run() { activityReference.showInterstitial(); } }); ... doing my other background stuff ... } In both of the above cases anything you do after runOnUiThread CANNOT rely on interstitial being shown! If you accidentally implement both it's not a problem because the fool-proof method won't post it again to the UI. As an alternative to runOnUiThread you can use a Handler, for more see the official documentation on this.
accepted answer of: http://stackoverflow.com/q/27299912
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27299912
score: 5
upvote count: 5

http://stackoverflow.com/q/27189224
has title: What's wrong I did to send a batch request to google?
tagged with: java
type: Question
answer count: 1
has body: I tried to send a batch request to Google with OkHttp, but I always received error 500 and Unknown Error in response. This is my code, the token is get from GoogleAuthUtil. MultipartBuilder multipartBuilder = new MultipartBuilder(); MediaType http = MediaType.parse("application/http"); MediaType mixed = MediaType.parse("multipart/mixed"); multipartBuilder.addPart(RequestBody.create(http, "GET https://www.googleapis.com/gmail/v1/users/me/messages")); multipartBuilder.type(mixed); Request request = new Request.Builder() .url("https://www.googleapis.com/batch") .header("Authorization", " Bearer " + token) .post(multipartBuilder.build()) .build(); try{ Response response = client.newCall(request).execute(); String res = response.body().string(); } catch (IOException e){ e.printStackTrace(); }
score: 0
tagged with: okhttp
has answer: http://stackoverflow.com/a/27194386
tagged with: gmail-api
tagged with: google-api
type: UnansweredQuestion

http://stackoverflow.com/q/27258624
score: -1
upvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27275100
tagged with: jsf
has body: In Java 6 I would write the following code to access an application scoped bean from a request scoped bean: Application scoped bean: @Named @ApplicationScoped public class Bean1 { ... } Request scoped bean: @Named @RequestScoped public class Bean2 { @Inject private Bean1 bean1; } How can I accomplish this in Java 5 using JSF which doesn't have these annotations?
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/43018820
accepted answer: http://stackoverflow.com/a/27275100
type: Question
has title: How can I inject a JSF bean into another JSF bean in Java 5?

http://stackoverflow.com/comment/43002534
type: QuestionComment
score: 0
has text: @hemanth I'm not calling **writeResult()** explicitly , its coupled with **@AfterMethod** so gets called after each test method
comment on: http://stackoverflow.com/q/27265351
type: Comment

http://stackoverflow.com/q/27197650
has comment: http://stackoverflow.com/comment/42881477
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27248446
has answer: http://stackoverflow.com/a/27200030
tagged with: java
has answer: http://stackoverflow.com/a/27248446
has title: Java 8: groupingBy with associated object's property? [Cyclic Inference]
type: Question
answer count: 2
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42881504
score: 0
has comment: http://stackoverflow.com/comment/42880108
has comment: http://stackoverflow.com/comment/42880425
has comment: http://stackoverflow.com/comment/42880447
accepted answer: http://stackoverflow.com/a/27200030
has body: This is how my Test looks like: @Test public void testFunctional() { final Member member = new Member("email", "memberExternalId", "clientId", "clientSecret"); final Category foodCategory = new Category("Groceries", "Food"); final Category utilityCategory = new Category("Internet", "utility"); final List&lt;Transaction&gt; transactions = new ArrayList&lt;&gt;(); { transactions.add(new Transaction("food1", new BigDecimal("10.00"), true, LocalDateTime.now(), member, foodCategory)); transactions.add(new Transaction("food2", new BigDecimal("20.00"), true, LocalDateTime.now(), member, foodCategory)); } { transactions.add(new Transaction("utility1", new BigDecimal("100.00"), true, LocalDateTime.now(), member, utilityCategory)); transactions.add(new Transaction("utility2", new BigDecimal("200.00"), true, LocalDateTime.now(), member, utilityCategory)); } final Map&lt;String, List&lt;BigDecimal&gt;&gt; groupByCategory = transactions.stream().collect(Collectors.groupingBy(Category::getGroupName)); } Category looks like this: public class Category { @Id private String id; @Column(nullable = false) private String name; @Column(name = "group_name", nullable = false) private String groupName; @Column(name = "created_at") private LocalDateTime createdAt; ... } When I do: final Map&lt;String, List&lt;BigDecimal&gt;&gt; groupByCategory = transactions.stream().collect(Collectors.groupingBy(Category::getGroupName)); IntelliJ complains with Cyclic Inference I am trying this Java 8 feature for the first time and not sure what's causing this.
tagged with: java-8

http://stackoverflow.com/a/27259359
has comment: http://stackoverflow.com/comment/42992100
answers question: http://stackoverflow.com/q/27259284
score: 2
has comment: http://stackoverflow.com/comment/42992183
accepted answer of: http://stackoverflow.com/q/27259284
has comment: http://stackoverflow.com/comment/42992491
type: AcceptedAnswer
has body: In the check_horizontal method you have your i's and t's back to front if (randomTable[t][i]==randomTable[t+1][i] &amp;&amp; randomTable[t+1][i]==randomTable[t+2][i] &amp;&amp; randomTable[t+2][i]==randomTable[t+3][i]){ return true; } Should be if (randomTable[i][t]==randomTable[i+1][t] &amp;&amp; randomTable[i+1][t]==randomTable[i+2][t] &amp;&amp; randomTable[i+2][t]==randomTable[i+3][t]){ return true; } And as pointed out in the comments your loop conditions are also incorrect: for (int i = 0; i&lt;randomTable.length; i++){ for(int t=0; t&lt;randomTable[0].length;t++){ Should be for (int i = 0; i&lt;randomTable.length - 3; i++){ for(int t=0; t&lt;randomTable[i].length;t++){ This is checking vertically not horizontally as the name suggests, but as check_vertical is actually checking horizontal this will not adversely effect your program (just your marks). The first point (i's and t's mixed up) is due to which lengths you are checking i is limited to the length of randomTable (that is the number of rows) while t is limited to the length of the zeroth array t &lt; randomTable[0].length (that is the number of columns) yet in your code you are using i as an index into columns and t as an index into row. This may be easier to understand if you renamed i into row, and t into column something like: private int getNumberOfRows(int[][] table) { return table.length; } private int getNumberOfColumnsInRow(int[][] table, int row) { return table[row].length } ... for (int row = 0; row &lt; getNumberOfRows(randomTable) - 3; row++){ for(int column = 0; column&lt;getNumberOfColumnsInRow(randomTable,i);column++){ For the second point loop conditions incorrect as you are adding up to 3 to the row index (the first number in square brackets) you need to ensure there are enough at least 3 more rows after row.
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42993152
has comment: http://stackoverflow.com/comment/42992272
type: Answer

http://stackoverflow.com/comment/42866933
has text: I don't have a real device available right now, and I don't understand, you want me to remove the if and else statement?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27188988

http://stackoverflow.com/comment/42822610
score: 0
type: AnswerComment
has text: @imhyung Try to find out wich value is null. sh1, sh1.getRow(0) ... it has nothing to do with the numeric value.
type: Comment
comment on: http://stackoverflow.com/a/27165160

http://stackoverflow.com/q/27269224
has answer: http://stackoverflow.com/a/27269331
favorite count: 0
has body: I am new to Java. I simply want to make an array of ints and an array of Strings. I tried the following: int() myArrayOfInts == new int(23); String() myArrayOfStrings == new String(4); I am not sure why it won't work.
has answer: http://stackoverflow.com/a/27269231
answer count: 4
has title: how to make an array for ints and strings in Java?
possible better answer: http://stackoverflow.com/a/27269244
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27269244
linked to: http://stackoverflow.com/q/1200621
tagged with: java
type: Question
score: -9
has comment: http://stackoverflow.com/comment/43009250
has comment: http://stackoverflow.com/comment/43009017
accepted answer: http://stackoverflow.com/a/27269231
has answer: http://stackoverflow.com/a/27269432
downvote count: 9
has comment: http://stackoverflow.com/comment/43009041
has comment: http://stackoverflow.com/comment/43008999
upvote count: 0
tagged with: arrays

http://stackoverflow.com/comment/42987927
type: Comment
type: QuestionComment
has text: if you are new to openGL then you shouldn't start with the immediate mode pipeline
score: 0
comment on: http://stackoverflow.com/q/27256992

transactions
tags question: http://stackoverflow.com/q/27227898
tags question: http://stackoverflow.com/q/27270862
tags question: http://stackoverflow.com/q/27227119
tags question: http://stackoverflow.com/q/27286045
tags question: http://stackoverflow.com/q/27235719
tags question: http://stackoverflow.com/q/27169162
tag name: transactions
tags question: http://stackoverflow.com/q/27170089
tags question: http://stackoverflow.com/q/27252273
tags question: http://stackoverflow.com/q/27219550
type: Tag
tags question: http://stackoverflow.com/q/27248205
tags question: http://stackoverflow.com/q/27171763
tags question: http://stackoverflow.com/q/27313804
tags question: http://stackoverflow.com/q/27271537

http://stackoverflow.com/q/27223002
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has comment: http://stackoverflow.com/comment/42931340
tagged with: java
has comment: http://stackoverflow.com/comment/42924541
has comment: http://stackoverflow.com/comment/42924684
type: Question
has body: I want to store sql query in tree format in xml file.I wrote a code which split the code into different tokens and store it in xml file.I am storing keywords like "select",from,where etc as xmlelements and the values of these keywords as textnodes inside corresponding elements.When the query contains single single statement it works as i need.but when nested query occurs i want to store the nested query inside "where" element.In that case the code didn't works properly.I am hereby attaching the code. Can anyone point out logical mistakes in my code???? Second problem is that when i try to store the xmldata in "CreateFiles.xml" file ,the file is not displaying in the corresponding folder.what is the reason for that? CreateXml.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Work; import java.io.File; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * * @author user */ public class Createxmls { public void CreateXML() throws ParserConfigurationException, TransformerConfigurationException, TransformerException { DocumentBuilderFactory documentFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentFactory .newDocumentBuilder(); Document document = documentBuilder.newDocument(); Element rootElement = document.createElement("SQLStatement"); document.appendChild(rootElement…
has comment: http://stackoverflow.com/comment/42924732
has comment: http://stackoverflow.com/comment/42931776
has comment: http://stackoverflow.com/comment/42926420
has title: Storing sql query in xml file
score: 0
tagged with: xml-parsing
tagged with: sql
has comment: http://stackoverflow.com/comment/42925357
has comment: http://stackoverflow.com/comment/42929367
has comment: http://stackoverflow.com/comment/42931441
has comment: http://stackoverflow.com/comment/42931618
has comment: http://stackoverflow.com/comment/42929451

http://stackoverflow.com/comment/42918354
score: 0
type: Comment
type: QuestionComment
has text: i changed minSDK="9" but same problem :( my version Google service lib 21
comment on: http://stackoverflow.com/q/27219432

http://stackoverflow.com/comment/43144811
type: Comment
type: AnswerComment
has text: It ran fine using java 8u25 for all 5 of the example string in the question. So, not sure what your problem is.
comment on: http://stackoverflow.com/a/27331570
score: 0

http://stackoverflow.com/q/27171185
type: Question
linked to: http://stackoverflow.com/q/11669507
has comment: http://stackoverflow.com/comment/42833039
tagged with: tomcat
has title: loading tomcat using code
has comment: http://stackoverflow.com/comment/42833354
score: 0
answer count: 1
has body: im using tomcat 7 , and im trying to do something nice. i want to have a little swing program to operate my current project (a site) i wish to have in that swing application a button to run the server , shut the server and such. i know there is the option of running it as soon as i start the application but i dont want it. i want to have the option to click a swing button and load it. for that , i need to run the server by code. is there a way to load tomcat server via code?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27171294
has comment: http://stackoverflow.com/comment/42833062
tagged with: java

http://stackoverflow.com/comment/42954628
score: 0
type: Comment
type: QuestionComment
has text: JSON Objects allow any JSON Strings as member names, so every valid JSON String is allowed and that means any Java string -- even the empty one. I don't understand why Gson tries to validate them at all here.
comment on: http://stackoverflow.com/q/27238908

http://stackoverflow.com/comment/43011434
has text: The question is probably if it works in a Servlet 3.0 environment or not - not specifically a JEE environment. It SHOULD work in Tomcat 7+, but you may need a properly up to date version. Tomcat 7.0.50+ most likely.
comment on: http://stackoverflow.com/a/27270025
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/52765742
score: 0
has body: As an additional note - you must not have a webAppSecurity entry with loginFormURL set in your server.xml as this will cause the JMX login to fail (e.g., &lt;webAppSecurity loginFormURL="login.html"/&gt; is problematic). Each individual WAR needs to set their own login-config and not rely on any global method of configuring logins. `
answers question: http://stackoverflow.com/q/27177895
type: Answer

http://stackoverflow.com/q/27294864
has comment: http://stackoverflow.com/comment/43054969
accepted answer: http://stackoverflow.com/a/27294924
has comment: http://stackoverflow.com/comment/43054583
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43054986
has title: Is it possible to invert a call to String's replaceAll method?
downvote count: 0
tagged with: string
tagged with: str-replace
favorite count: 0
has comment: http://stackoverflow.com/comment/43054842
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43054553
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43054484
has comment: http://stackoverflow.com/comment/43054925
possible better answer: http://stackoverflow.com/a/27295013
has comment: http://stackoverflow.com/comment/43054488
has answer: http://stackoverflow.com/a/27295013
has answer: http://stackoverflow.com/a/27294924
has body: For example... String s = "abcxyzabcxyz"; s.replaceAll("xyz", "---"); This would normally give me "abc---abc---". How would I get it to give me "---xyz---xyz" instead?
has comment: http://stackoverflow.com/comment/43054886
linked to: http://stackoverflow.com/q/1240275

jooq
tags question: http://stackoverflow.com/q/27169402
tag name: jooq
tags question: http://stackoverflow.com/q/27244262
tags question: http://stackoverflow.com/q/27291806
tags question: http://stackoverflow.com/q/27269839
type: Tag

http://stackoverflow.com/q/27310288
possible better answer: http://stackoverflow.com/a/27310407
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27310407
tagged with: java
has answer: http://stackoverflow.com/a/27310387
type: Question
tagged with: arrays
has body: I'm trying to create a static utility method that takes a single input of class A, instances of which have been given their own unique id, and retrieve a boolean value describing whether or not a certain characteristic applies to them. There is no pattern to describe the relationship; without a formula the two options that sprang first to mind were a static final int[] containing all of the true ids, or a string of "or" || tests. Are there other better options out there, or any particular advantage for using one over the other? The task is no large feat, but I'd like to be able to have it simple and readable. Here's a sample to help you get a general idea of what I mean: public class UtilitiesA { // first method of retrieval- static storage array private static int[] validIds = { A.instanceM.id, A.instanceZ.id, A.instanceL.id, A.instanceF.id, A.instanceP.id }; public static boolean getHasCharacteristic(A input) { for (int id : validIds) if (a.id == id) return true; return false; } // vs the second method... public static boolean getHasCharacteristic2(A input) { return (input.id == A.instanceM.id || input.id == A.instanceZ.id || input.id == A.instanceL.id || input.id == A.instanceF.id || input.id == A.instanceP.id) } } The second is more intuitive I think, but also more repetitive. Any suggestions would be much appreciated.
tagged with: boolean
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27310387
has title: Storing an array of predetermined conditions

http://stackoverflow.com/comment/42848473
has text: [How to Use CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27178643
score: 0

http://stackoverflow.com/q/27280750
has comment: http://stackoverflow.com/comment/43058612
accepted answer: http://stackoverflow.com/a/27316982
linked to: http://stackoverflow.com/q/2480650
answer count: 1
has comment: http://stackoverflow.com/comment/43058374
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43058526
has comment: http://stackoverflow.com/comment/43056382
has comment: http://stackoverflow.com/comment/64936634
has comment: http://stackoverflow.com/comment/43037164
has comment: http://stackoverflow.com/comment/43059631
has comment: http://stackoverflow.com/comment/43032927
has comment: http://stackoverflow.com/comment/43040304
tagged with: artificial-intelligence
upvote count: 16
has comment: http://stackoverflow.com/comment/43058046
has comment: http://stackoverflow.com/comment/43038129
linked to: http://stackoverflow.com/q/38561182
type: AnsweredQuestion
tagged with: backpropagation
has comment: http://stackoverflow.com/comment/43036963
tagged with: java
has answer: http://stackoverflow.com/a/27316982
score: 16
type: Question
has body: I'm having trouble understanding the backpropagation algorithm. I read a lot and searched a lot but I can't understand why my Neural Network don't work. I want to confirm that I'm doing every part the right way. Here is my Neural Network when it is initialize and when the first line of inputs [1, 1] and the output [0] is set (as you can see, I'm trying to do the XOR Neural Network) : I have 3 layers : input, hidden and output. The first layer (input) and the hidden layer contains 2 neurons in which there is 2 synapses each. The last layer (output) contains one neuron with 2 synapses too. A synapse contains a weight and it’s previous delta (at the beginning, it is 0). The output connected to the synapse can be found with the sourceNeuron associated with the synapse or in the inputs array if there is no sourceNeuron (like in the input layer). The class Layer.java contains a list of neurons. In my NeuralNetwork.java, I initialize the Neural Network then I loop in my training set. In each iteration, I replace the inputs and the output values and call train on my BackPropagation Algorithm and the algorithm run certain number of time (epoch of 1000 times for now) for the current set. The activation fonction I use is the sigmoid. Training set AND validation set is (input1, input2, output): 1,1,0 0,1,1 1,0,1 0,0,0 Here is my Neuron.java implementation: public class Neuron { private IActivation activation; private ArrayList&lt;Synapse&gt; synapses; // Inputs private double output; // Output private double errorToPropagate; public Neuron(IActivation activation) { this.activation = activation; this.synapses = new ArrayList&lt;Synapse&gt;(); this.output = 0; this.errorToPropagate = 0; } public void updateOutput(double[] inputs) { double sumWeights = this.calculateSumWeights(inputs); this.output = this.activation.activate(sumWeights); } public double calculateSumWeights(double[] inputs) { double sumWeights = 0; int index = 0; for (Synapse synapse : this.getSynapses()) { if (inpu…
has comment: http://stackoverflow.com/comment/43038019
tagged with: algorithm
tagged with: neural-network
has title: Trouble Understanding the Backpropagation Algorithm in Neural Network
has comment: http://stackoverflow.com/comment/43040654
has comment: http://stackoverflow.com/comment/43058304

http://stackoverflow.com/comment/139027106
type: Comment
has text: You don't need sequences, you just need to define a few group annotations, A extends Default, B extends A, C extends B, etc.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27246136

http://stackoverflow.com/q/27254591
tagged with: eclipse
type: Question
has title: How to set an active page at the first execution of a view?
score: 0
has answer: http://stackoverflow.com/a/27254911
accepted answer: http://stackoverflow.com/a/27254911
answer count: 1
tagged with: eclipse-plugin
type: AnsweredQuestion
tagged with: java
has body: I created a function inside my plugin project (a plugin which contains a view), that creates selection listeners for an active page (for example: package explorer, resource navigator). At the first execution of an Eclipse instance sometimes I don't have an active page and the following is null: ISelectionService selectionService=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); So that a selection listener cannot be setted for another view: selectionService.addSelectionListener(partID,listener); My problem is actually that the function doesn't executes the above line since the selectionService is null. What should I do in order to avoid this situation ?

proxy
tags question: http://stackoverflow.com/q/27187141
tags question: http://stackoverflow.com/q/27215053
tags question: http://stackoverflow.com/q/27259950
tags question: http://stackoverflow.com/q/27227320
type: Tag
tags question: http://stackoverflow.com/q/27264475
tags question: http://stackoverflow.com/q/27171809
tags question: http://stackoverflow.com/q/27311207
tags question: http://stackoverflow.com/q/27302765
tag name: proxy

http://stackoverflow.com/q/27256872
tagged with: sockets
has title: Write to a python socket server in java
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27256934
score: 0
answer count: 1
has body: I want to write a string to a socket server in java in bytes, then receive the answer (a known length of bytes). I have looked around and there are many tutorials, but I can't seem to find a specific function to handle the bytes, also, I don't seem to be able to perform functions on out. This stays red underlined. import java.io.*; import java.net.Socket; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class SocketTest { public static void main(String [] args) throws IOException { String hostName = "localhost"; int portNumber = 10000; try ( //open a socket Socket clientSocket = new Socket(hostName, portNumber); BufferedReader in = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); ) { System.out.print("Something went wrong"); } } try { out.XXX; //can't seem to execute any function on this. } catch (Exception e) { e.printStackTrace(); }
accepted answer: http://stackoverflow.com/a/27256934

http://stackoverflow.com/comment/42860656
score: 0
comment on: http://stackoverflow.com/q/27187046
has text: so basically, how many characters two strings have in common?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43337401
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27432860
type: AnswerComment
has text: It would be helpful if you clarify what you are trying to do.

http://stackoverflow.com/comment/42955977
score: 0
comment on: http://stackoverflow.com/q/27239633
type: Comment
has text: my file is in the project folder
type: QuestionComment

http://stackoverflow.com/q/27275035
upvote count: 7
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27678879
has title: Install new software in Eclipse Luna gives always the error No repository found containing: osgi.bundle,org.eclipse.net4j.jms.api?
has body: I am using STS (Spring Tool Suite) with Eclipse Luna 4.4 and I noticed that everytime I try to install something (for example Apache IvyDE, Web Tools Platform)via Help -> "Install new Software" I get the following error: An error occurred while collecting items to be installed session context was:(profile=DefaultProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.eclipse.net4j.jms.api,3.1.100.v20140218-1709 How can I get rid of this error and install Eclipse's software and plugins? EDIT: here is what it looks like: Then I click "Next", while eclipse loads: There's a "Cannot perform operation" message on the progress bar, and after that: Then I accept the license and after clicking finish I get the error:
downvote count: 0
linked to: http://stackoverflow.com/q/6470802
has answer: http://stackoverflow.com/a/27275223
has answer: http://stackoverflow.com/a/42274269
linked to: http://stackoverflow.com/q/24449208
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29610009
tagged with: spring
score: 7
tagged with: java

http://stackoverflow.com/comment/43024251
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27277593
type: Comment
has text: ok i have changed the code int BookID1 = rs.getInt("Book_ID"); but the code gives the value 0 to BookID1 and used while loop but it gives value 0 to BookID1, it should give the value 1.

http://stackoverflow.com/a/27300442
accepted answer of: http://stackoverflow.com/q/27300339
has comment: http://stackoverflow.com/comment/43064903
has comment: http://stackoverflow.com/comment/43065513
answers question: http://stackoverflow.com/q/27300339
downvote count: 0
has comment: http://stackoverflow.com/comment/43065442
has comment: http://stackoverflow.com/comment/43064733
has comment: http://stackoverflow.com/comment/43065348
has comment: http://stackoverflow.com/comment/43065890
has comment: http://stackoverflow.com/comment/43065734
score: 1
has comment: http://stackoverflow.com/comment/43064876
has comment: http://stackoverflow.com/comment/43065586
has body: Single quotes (') denote string literals. Here, you didn't mean you insert the string 'null', but an actual null value - just drop the quotes: INSERT INTO tblDetails SET eID=1010,entID=2,tID=65,eDateTime='2014-12-04 14:34:44',lastEventTime=null Moreover, unless lsatEventTime has an undesirable default value, you could just drop the reference to it altogether and let the database use the default (null): INSERT INTO tblDetails SET eID=1010,entID=2,tID=65,eDateTime='2014-12-04 14:34:44' EDIT: To answer the question asked in the comments, this can be done even when dynamically constructing the insert statement. Just take the following line: "',lastEventTime='"+rs10d.getString("lastEventTime")+"'"; ... and add some logic to check for nulls: "',lastEventTime=" + (rs10d.getString("lastEventTime") == null ? "null" : "'"+rs10d.getString("lastEventTime")+"'");
has comment: http://stackoverflow.com/comment/43064614
has comment: http://stackoverflow.com/comment/43065630
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27181887
has answer: http://stackoverflow.com/a/29032833
has comment: http://stackoverflow.com/comment/42874824
score: 1
tagged with: java
tagged with: lotus-domino
upvote count: 1
has comment: http://stackoverflow.com/comment/42868497
accepted answer: http://stackoverflow.com/a/27198725
possible better answer: http://stackoverflow.com/a/29032833
type: Question
has title: Loading AWS credentials from a Java servlet on a Lotus Domino server on Linux
tagged with: amazon-s3
tagged with: servlets
has body: I have this scenario: I created a Java servlet to be executed in a Lotus Domino server (just in case, the servlet is OUTSIDE from any database. It's in the folder &lt;domino data&gt;/domino/servlet/my_servlet.class). The servlet access a S3 server using a credentials file. When I developed the servlet, I did my tests on a Windows server, and everything worked like a charm. But, when I did the same tests on a Linux server using the same credentials and the same servlet, it did not work. The exception occured here: AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException( "Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format.", e); } Considering that the domino server is executed with the user notes, I put the credentials in notes/.aws/credentials. Nothing. I put it in the ec2-user/.aws/credentials (it's a EC2 server). Nothing again. Same exception. About the Domino server, it's executed using a user notes. The .aws folder and the credentials file owner is notes. The permissions in the credentials file is 600. The servlet owner is notes too. Do you have any idea about how can I resolve this? TIA, EDIT: I added this lines in the servlet: res.setContentType("text/html"); PrintWriter toBrowser = res.getWriter(); //etc. toBrowser.println("HOME: " + System.getProperty("user.home")); I got this: HOME: /home/notes I checked this folder again and the credentials are still there. [root@ip-xxx-xxx-xxx-xxx notes]# ls -l /home/notes/.aws total 4 -rw------- 1 notes notes 117 Nov 28 03:50 credentials [root@ip-xxx-xxx-xxx-xxx notes]# EDIT 2: I added this lines too: File f = new File(System.getProperty("user.home") + "/.aws/credentials"); if(f.exists()){ toBrowser.println("Credentials exists" + "&lt;BR/&gt;"); }else{ toBrowser.println("Credentials…
has comment: http://stackoverflow.com/comment/42881713
answer count: 2
has comment: http://stackoverflow.com/comment/42868204
has comment: http://stackoverflow.com/comment/42873431
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27198725
tagged with: linux
type: AnsweredQuestion

http://stackoverflow.com/comment/42917898
score: 0
type: AnswerComment
has text: It doesn't look like the input variables are being assigned before the method is called so you're actually probably better off not using any parameters at all.
comment on: http://stackoverflow.com/a/27219306
type: Comment

http://stackoverflow.com/comment/43036591
has text: what do you thin the for should do? i=3? I would fill your array before the search loop (or use string.charAt only)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27284242

http://stackoverflow.com/a/29037078
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27235072
answers question: http://stackoverflow.com/q/27235072
type: Answer
score: 0
has body: Explicit specifying a Connection Timeout Value solved the error. See also: http://api.mongodb.org/java/2.7.0/com/mongodb/MongoOptions.html

http://stackoverflow.com/a/27169276
has comment: http://stackoverflow.com/comment/42863582
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42853777
has comment: http://stackoverflow.com/comment/42862603
accepted answer of: http://stackoverflow.com/q/27169120
type: Answer
has body: // Other Hibernate code here PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("D:/Users/output.txt"))); System.out.println("Total Number Of Records : "+((java.util.List) l).size()); Iterator it = ((java.util.List) l).iterator(); while(it.hasNext()) { writer.println(e.getId()); } writer.close(); // put this in finally block
answers question: http://stackoverflow.com/q/27169120

http://stackoverflow.com/q/27223972
has body: String strMsg = "PM"; float price = 7.50f; price = 8.50f; strMsg = "AM"; strMsg = "MN"; price = 9.50f;; Also, why are they collected?
favorite count: 0
has answer: http://stackoverflow.com/a/27224312
type: UnansweredQuestion
tagged with: garbage-collection
tagged with: garbage
has answer: http://stackoverflow.com/a/27224141
tagged with: java
downvote count: 1
has title: Which are the objects are garbage collected?
type: Question
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/27224243
answer count: 3
has comment: http://stackoverflow.com/comment/42927357

http://stackoverflow.com/comment/61899867
type: AnswerComment
score: 0
type: Comment
has text: because there's (almost) never a good reason for anonymous classes. @nicolas They're an example of an XY problem. The only acceptable use for an anonymous class is in generated code, and even then a better idea is to use generated class names. The biggest reason why anonymous classes were even used in Java was because there was no lambda type
comment on: http://stackoverflow.com/a/27273494

http://stackoverflow.com/comment/42816893
score: 0
type: QuestionComment
has text: Unclear what your real question is here; do you want to map some Java type to a given column in the database?
comment on: http://stackoverflow.com/q/27161541
type: Comment

http://stackoverflow.com/a/27214916
downvote count: 0
has comment: http://stackoverflow.com/comment/42909869
type: Answer
has comment: http://stackoverflow.com/comment/42909888
score: 1
has body: This is the problem: public void calcNetWasteReduction(){ netWasteReduction = grossWasteEmission = wasteReduction; } That's equivalent to: public void calcNetWasteReduction(){ grossWasteEmission = wasteReduction; netWasteReduction = grossWasteEmission; } In other words, it's modifying grossWasteEmission when it shouldn't be. I suspect you wanted: public void calcNetWasteReduction(){ netWasteReduction = grossWasteEmission - wasteReduction; } In other words, making the second = a - instead. It's not clear why you have the three separate methods at all, to be honest - why not perform the calculations in the constructor? Or in the getter methods (removing the intermediate fields altogether)? Additionally, consider making an enum of waste reduction types (PAPER, GLASS, PLASTIC) and taking an EnumSet of them. If you do keep them as individual parameters, I would strongly advise you to change the names to be more conventional Java (paper instead of Paper etc) and use if (paper) rather than if (paper == true) etc. In general, avoid explicit checking against Boolean constants.
answers question: http://stackoverflow.com/q/27214836
has comment: http://stackoverflow.com/comment/42909885
accepted answer of: http://stackoverflow.com/q/27214836
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42930231
comment on: http://stackoverflow.com/a/27226132
has text: @ankur-singhal Can you please help me, what do you mean by `test cases` here? I'm new in Maven.. :( pls.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43035180
score: 0
type: Comment
type: QuestionComment
has text: I'm using Java. momentjs wouldn't serve me.
comment on: http://stackoverflow.com/q/27282982

http://stackoverflow.com/comment/42899092
score: 0
type: QuestionComment
type: Comment
has text: Questions describing your requirements and asking someone to write the code for you, explain how to write the code, or provide examples or references are off-topic. Please identify a specific problem or question about programming. Include attempted solutions, an explanation of how the results differ from the desired results, and the full text of any error messages you receive. Please read this advice on asking good questions: ask, [[Writing the perfect question](http://goo.gl/UeT2tS)].
comment on: http://stackoverflow.com/q/27202685

http://stackoverflow.com/comment/43074098
has text: it is not possible to exception. only last part of my values missing
comment on: http://stackoverflow.com/q/27305590
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27177171
downvote count: 0
has comment: http://stackoverflow.com/comment/42843574
answer count: 5
type: UnansweredQuestion
tagged with: class
has title: What is the class type of a superclass ref pointing to a subclass object?
score: 3
has answer: http://stackoverflow.com/a/27177369
favorite count: 0
has answer: http://stackoverflow.com/a/27179216
tagged with: reference
has answer: http://stackoverflow.com/a/27178059
type: Question
tagged with: subclass
has answer: http://stackoverflow.com/a/27177202
tagged with: superclass
has comment: http://stackoverflow.com/comment/42843626
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27177411
has body: I have the following codes: 1. public class Tester 2. { 3. public static void main(String[] args) 4. { 5. A a = new B(); 6. System.out.println(a.getClass()); //Prints class B 7. System.out.println(a instanceof A); //Prints true 8. System.out.println(a instanceof B); //Prints true 9. System.out.println(a.valA); //Prints 1 10. System.out.println(a.valB); //Compilation error 11. 12. } 13. } 14. 15. class A 16. { 17. int valA=1; 18. } 19. 20. class B extends A 21. { 22. int valB=2; 23. } At line 6 it shows that a is of type class B. However when it reaches line 10, the compiler produces an error: location: variable a of type A. So my question is: What exactly is the class type of a now? Why getClass() shows that it is of type class B, yet the compiler complains it as type A during compilation? Further more, since a instanceof B is true, why can't I access valB? To make things clearer: EDIT: I ran this statement: System.out.println(a); and the output was B@36d98810 which somehow proves that the toString() method of class B was executed. Since variable a can access the toString() method within class B, why can't it access valB which also resides in class B?
has comment: http://stackoverflow.com/comment/42843231
has comment: http://stackoverflow.com/comment/42844244
linked to: http://stackoverflow.com/q/2885385

http://stackoverflow.com/comment/43080391
type: Comment
type: QuestionComment
has text: It says "they are both ordered identically". Presumably that is important.
comment on: http://stackoverflow.com/q/27309339
score: 0

http://stackoverflow.com/a/27317008
answers question: http://stackoverflow.com/q/27309095
has body: You might have imported in wrong way. Import as: File - > Import - > Android - > Existing Android Code into Workspace Browse the generated android folder inside the platforms and click Finish (see snapshot) It will import android project along with cordova lib Clean the projects Or can set desired android version and then clean Run the app on simulator or device
has comment: http://stackoverflow.com/comment/43157537
has comment: http://stackoverflow.com/comment/43157263
has comment: http://stackoverflow.com/comment/43157549
type: Answer
has comment: http://stackoverflow.com/comment/43157813
has comment: http://stackoverflow.com/comment/43157243
has comment: http://stackoverflow.com/comment/43157211
has comment: http://stackoverflow.com/comment/43157664
score: 0

http://stackoverflow.com/comment/43460439
has text: I really don't know what's the problem, but it still won't work, although I changed my code to @NAP's code, and Manifest file also doesn't have any problems, I think:
comment on: http://stackoverflow.com/a/27203561
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/27457739
answers question: http://stackoverflow.com/q/27270382
type: Answer
has body: The program is absolutely fine. Problem is at the server side. Exception here is : java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) The error is because of wrong credentials ( or ) the server is not started. The file is transferred after restarting the server :)
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27270382

http://stackoverflow.com/comment/42972381
type: Comment
type: QuestionComment
has text: Speed/Performance will only be measured by the likes of the amount of data being sent and the number of concurrent users.
comment on: http://stackoverflow.com/q/27248993
score: 0

http://stackoverflow.com/a/27153555
has comment: http://stackoverflow.com/comment/42835436
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27153444
type: Answer
has comment: http://stackoverflow.com/comment/42827236
accepted answer of: http://stackoverflow.com/q/27153444
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42808850
has comment: http://stackoverflow.com/comment/42801681
has body: Short answer : No Java is compiled in a cross-plateform byte code. Assembly is plateform specific. Regarding the "save point" they are called pointers in c/c++, and in Java, you are manipulating references. For more details about pointers and references, see Pointers in Java
downvote count: 0

service
tags question: http://stackoverflow.com/q/27210935
tag name: service
tags question: http://stackoverflow.com/q/27239051
tags question: http://stackoverflow.com/q/27241144
tags question: http://stackoverflow.com/q/27231700
type: Tag
tags question: http://stackoverflow.com/q/27221230
tags question: http://stackoverflow.com/q/27176303

http://stackoverflow.com/comment/42877139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27195962
score: 0
has text: Can you clarify your goal?

http://stackoverflow.com/comment/42878808
type: AnswerComment
type: Comment
has text: @KickButtowski it is an answer, the question asks for how to get the IV, this answer gives a method that does exactly that.
score: 2
comment on: http://stackoverflow.com/a/27196663

http://stackoverflow.com/comment/43070423
comment on: http://stackoverflow.com/q/27303639
score: 0
has text: @JeremiahWinsley he's new, lets cut him some slack
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27242860
answer count: 1
downvote count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/pdf
has title: When i am generating pdf form I want to add form number on top left of the pdf using itext java
linked to: http://stackoverflow.com/q/21628429
has comment: http://stackoverflow.com/comment/42963637
upvote count: 0
has comment: http://stackoverflow.com/comment/42962623
type: UnansweredQuestion
tagged with: itext
type: Question
tagged with: java
has body: Hi When I am generating form using java with itext I want to add form number on top left of the document above the header.Please let me know the ways to do it. PdfPTable table = new PdfPTable(3); // 3 columns. table.setWidthPercentage(100); PdfPCell cell1 = new PdfPCell(new Paragraph("Cell 1")); PdfPCell cell2 = new PdfPCell(new Paragraph("Cell 2")); PdfPCell cell3 = new PdfPCell(new Paragraph("Cell 3")); cell1.setBorder(0); cell2.setBorder(0); cell3.setBorder(0); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); How can I set the table alignment to start of the page margin.
has answer: http://stackoverflow.com/a/27244448
score: -1

http://stackoverflow.com/comment/42971368
type: QuestionComment
has text: I don't see how that'd make any difference
score: 0
comment on: http://stackoverflow.com/q/27247788
type: Comment

http://stackoverflow.com/comment/42814304
score: 0
type: QuestionComment
type: Comment
has text: If you want to start posting here you should explore the site, and read the help section. You're treating it like a chat/forum, but it's not.
comment on: http://stackoverflow.com/q/27160193

http://stackoverflow.com/comment/42814098
has text: To get logcat see: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
score: 0
comment on: http://stackoverflow.com/q/27159998
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43077168
type: AnswerComment
comment on: http://stackoverflow.com/a/27243475
score: 0
has text: hello icza, could you please give me more help for this problem? thanks!
type: Comment

http://stackoverflow.com/q/27186137
tagged with: amazon-web-services
possible better answer: http://stackoverflow.com/a/71587015
has comment: http://stackoverflow.com/comment/42868160
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/53238509
upvote count: 8
accepted answer: http://stackoverflow.com/a/61628151
tagged with: spring
has title: Storing log file in AWS S3 from Spring boot application
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/71587015
has answer: http://stackoverflow.com/a/27223347
tagged with: amazon-s3
has answer: http://stackoverflow.com/a/61628151
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/42862223
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42921561
has body: I am building a Spring-boot application where in all the logging is stored in a specified path in log4j.properties. I am hosting this application on AWS Beanstalk. Once I host the application on the AWS, the specified path for the log file will become invalid. How can I resolve this issue where in the log file should also get stored in a different path in cloud, say Amazon S3, but not on server as the log file takes considerable amount of size. log4j.appender.file.File=/my_log.log How can I change the above line to store the "my_log.log" in AWS S3?
has comment: http://stackoverflow.com/comment/93334852

http://stackoverflow.com/comment/42830628
has text: @Sarthak Mittal: Thanks for pointing out. It was just a typo. it returns a string.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27169681

http://stackoverflow.com/comment/42811444
type: QuestionComment
comment on: http://stackoverflow.com/q/27158723
score: 0
has text: Why do you not need/want the explicit closing tag? They are logically the same thing.
type: Comment

http://stackoverflow.com/comment/44017496
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27224030
has text: @Pracede referenced github project is ok until http rules are removed.

http://stackoverflow.com/comment/43043705
comment on: http://stackoverflow.com/q/27286565
type: QuestionComment
type: Comment
score: 0
has text: If you are submitting the values to the servlet from a javascript, just make sure you haven't set any static value(like 465) there in the script.

http://stackoverflow.com/q/27240956
has comment: http://stackoverflow.com/comment/42958430
has comment: http://stackoverflow.com/comment/42961641
tagged with: nio
has comment: http://stackoverflow.com/comment/42958478
has title: Method for copying bytes from Channels to Paths and vice versa?
score: 0
answer count: 0
type: UnansweredQuestion
has body: I found there are two methods for copying bytes between Paths and Input/OutputStreams Files#copy(InputStream in, Path target, CopyOption... options) Files#copy(Path source, OutputStream out) Are there any methods for using Readable/WritableByteChannels? Say, copy(ReadableByteChannel in, Path target, CopyOption... options) copy(Path source, WritableByteChannel out) ? I already know there are handy methods for changing Streams and Channels. Channels#newChannel(InputStream) Channels#newChannel(OutputStream) Thanks.
type: Question
tagged with: java

http://stackoverflow.com/comment/42933895
has text: Ok. So the flow is: start() --> run() --> code in the current thread. So, to be more specific, is it not the run() which is running the code of the current thread i.e. the thread?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27228101
type: AnswerComment

http://stackoverflow.com/comment/42934035
type: Comment
has text: @Leo - `run()` is a method which defines *what to execute*. `start()` creates a new thread and executes code inside `run()` *on* the new thread. directly calling `run()` executes code inside `run()` on the *current* thread. What `start()` and in turn `start0()` does internally is too complex..a new java stack, a new PC register(s) , a new native method stack will be created for each thread.. So, yes, the correct order is : `start()` --> some magic here --> `run()` in a *new thread*.
score: 1
comment on: http://stackoverflow.com/a/27228101
type: AnswerComment

reflection
tags question: http://stackoverflow.com/q/27210275
tags question: http://stackoverflow.com/q/27167225
tags question: http://stackoverflow.com/q/27261630
tags question: http://stackoverflow.com/q/27173497
tags question: http://stackoverflow.com/q/27252869
tags question: http://stackoverflow.com/q/27288579
tags question: http://stackoverflow.com/q/27308336
tags question: http://stackoverflow.com/q/27246060
tags question: http://stackoverflow.com/q/27230506
tags question: http://stackoverflow.com/q/27169681
tags question: http://stackoverflow.com/q/27246978
tags question: http://stackoverflow.com/q/27233276
type: Tag
tags question: http://stackoverflow.com/q/27203747
tags question: http://stackoverflow.com/q/27255336
tags question: http://stackoverflow.com/q/27203193
tags question: http://stackoverflow.com/q/27260370
tags question: http://stackoverflow.com/q/27201802
tags question: http://stackoverflow.com/q/27252864
tags question: http://stackoverflow.com/q/27293254
tags question: http://stackoverflow.com/q/27232674
tags question: http://stackoverflow.com/q/27186456
tags question: http://stackoverflow.com/q/27266247
tags question: http://stackoverflow.com/q/27157326
tag name: reflection
tags question: http://stackoverflow.com/q/27204290
tags question: http://stackoverflow.com/q/27230221

http://stackoverflow.com/a/27278862
type: Answer
has comment: http://stackoverflow.com/comment/43027300
has body: use annotation above the method you want to produce JSON from @Produces("application/json")
answers question: http://stackoverflow.com/q/27277667
score: 0

android-broadcast
tag name: android-broadcast
type: Tag
tags question: http://stackoverflow.com/q/27255126

http://stackoverflow.com/q/27285428
has title: Traversal of Binary Search Tree via loop instead of Recursion
has comment: http://stackoverflow.com/comment/43038522
favorite count: 0
tagged with: binary-search-tree
possible better answer: http://stackoverflow.com/a/27285548
tagged with: tree
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27285546
accepted answer: http://stackoverflow.com/a/27285546
downvote count: 0
tagged with: java
has body: Does anyone know how to traverse a binary search tree using loops instead of recursion? I have the recursive method public static int countMatches(BinaryNodeInterface&lt;Integer&gt; tree, Integer key) { int matches = 0; if (tree != null) { if (tree.getData().equals(key)) matches++; matches += countMatches(tree.getLeftChild(), key); matches += countMatches(tree.getRightChild(), key); } return matches; }
type: Question
upvote count: 2
tagged with: tree-traversal
has answer: http://stackoverflow.com/a/27285548
tagged with: binary-tree
has comment: http://stackoverflow.com/comment/43038528
answer count: 2

http://stackoverflow.com/comment/42815961
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27160943
has text: @MadProgrammer yeah I was just pointing out that after his cast, he was implicitly casting it back to Graphics (as the variable g2d is actually a Graphics, not a Graphics2D)
score: 0

http://stackoverflow.com/comment/43064512
score: 0
type: Comment
type: QuestionComment
has text: You should use `== +aaaaaa\\(bb\\)aaaaaa +==`
comment on: http://stackoverflow.com/q/27300288

http://stackoverflow.com/comment/42968198
has text: Read the trace please, is clear enough, "Cannot run program "git" (in directory "C:\Users\tomas\Eman\CUCKOO-AN"): CreateProcess error=2, The system cannot find the file specified"
type: QuestionComment
comment on: http://stackoverflow.com/q/27246491
type: Comment
score: 1

http://stackoverflow.com/q/27190791
score: 0
type: UnansweredQuestion
has body: Basically i want to compile module using maven jar plugin and to create folder structure, compiled java classes, manifest, etc. without packing them into an archieve. Is it possible to achieve?
answer count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/42867602
type: Question
has comment: http://stackoverflow.com/comment/42870916
tagged with: java
has title: Is it possible to compile java project using maven jar plugin without packing classes to .jar?

http://stackoverflow.com/q/27211203
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/29855056
has body: I have been recently trying to work on Cloud Computing as a part of my College assignment. I have been trying to implement a new Load Balancing algorithm, (which has been proposed in some research paper) using CloudSim. Please help me out with this algorithm, I have some major issues implementing it. This is the code /* * Title: Load Balancing in Cloud Computing */ package org.cloudbus.cloudsim; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public final class MyPolicyNew extends VmAllocationPolicy { private Map&lt;String, Host&gt; vmTable; private Map&lt;String, Integer&gt; usedPes; private List&lt;Integer&gt; freePes; private int status[] = new int[100]; public MyPolicyNew(List&lt;? extends Host&gt; list) { super(list); setFreePes(new ArrayList&lt;Integer&gt;()); for (Host host : getHostList()) { getFreePes().add(host.getPesNumber()); } setVmTable(new HashMap&lt;String, Host&gt;()); setUsedPes(new HashMap&lt;String, Integer&gt;()); } @Override public boolean allocateHostForVm(Vm vm) { int idx = -1; int requiredPes; requiredPes = vm.getPesNumber(); boolean result = false; int tries = 0; List&lt;Integer&gt; freePesTmp = new ArrayList&lt;Integer&gt;(); for (Integer freePes : getFreePes()) { freePesTmp.add(freePes); } int tempstatus[] = new int[100]; for(int j=0; j&lt;100; j++){ tempstatus[j]= status[j]; } if (!getVmTable().containsKey(vm.getUid())) { do { int moreFree = Integer.MIN_VALUE; for (int i=0; i &lt; freePesTmp.size(); i++) { if ((freePesTmp.get(i) &gt; moreFree) &amp;&amp; (tempstatus[i]!=1)) { moreFree = freePesTmp.get(i); idx = i; } tempstatus[idx]=1; int flag=0; for(int j=0; j&lt; freePesTmp.size(); j++) { // if(tempstatus[j]==1) flag=1; else flag=0; } if(flag==1){ moreFree = Integer.MIN_VALUE; for (int k=0; k &lt; freePesTmp.size(); k++) { if (freePesTmp.get(k) &gt; moreFree) { moreFree = freePesTmp.get(k); idx = k; } } } } Host host = getHostList().get(idx); result = host.vmCreate(vm); if (result) { g…
type: Question
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/53583223
has comment: http://stackoverflow.com/comment/42904136
favorite count: 0
has title: Load Balancing CloudSim
has comment: http://stackoverflow.com/comment/42903774
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42912227
tagged with: cloudsim
upvote count: 5
downvote count: 0
possible better answer: http://stackoverflow.com/a/53583223
accepted answer: http://stackoverflow.com/a/29855056

http://stackoverflow.com/q/27227538
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42932847
has body: Code: public void Test2() throws Exception{ Thread.sleep(5000); driver.findElement(By.id("cboMenu")).click(); driver.findElement(By.xpath(".//*[@id='cboMenu/option[3]")).click(); } Error: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"cboMenu"} Command duration or timeout: 31 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03' System info: host: 'venu-PC', ip: '192.168.1.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51' Session ID: 0f859bed-35df-4eba-a472-3bc2efec4814 Driver info: org.openqa.selenium.firefox.FirefoxDriver
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27245241
has title: org.openqa.selenium.NoSuchElementException: Unable to locate element:
has answer: http://stackoverflow.com/a/27227766
tagged with: java
tagged with: selenium
upvote count: 1
has answer: http://stackoverflow.com/a/37995252
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42932519
has comment: http://stackoverflow.com/comment/42932443
has comment: http://stackoverflow.com/comment/42932864

http://stackoverflow.com/q/27284231
has title: Local Notification using CordovaPlugin in Hybrid-Native Android eclipse
tagged with: eclipse
answer count: 2
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27285129
tagged with: cordova
has answer: http://stackoverflow.com/a/27284435
has body: I want to send local notifications using cordovaplugin by extending CordovaPlugin on my HelloWorldPlugin.java.. But it seems my code for local notifications doesnt work. If i put this piece of code in the auto-generated AndroidCordova that extends CordovaActivity it works. Here is the code below public class HelloWorldPlugin extends CordovaPlugin { @Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if (action.equals("sayHello")){ Context context //Added: Intent intent = new Intent(); PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0); Notification noti = new Notification.Builder(this) .setTicker("Test Ticker Notification") .setSmallIcon(R.drawable.icon) .setContentTitle("Test Title Notification") .setContentText("Test Content Notification") .setContentIntent(pIntent).build(); noti.flags=Notification.FLAG_AUTO_CANCEL; NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(0, noti); return true; } return false; It is returning 2 errors. First one is it says "The constructor Notification.Builder(HelloWorldPlugin) is undefined" and NOTIFICATION_SERVICE cannot be resolved to a variable. Also i added the Context context and used context on the part after getActivity, i used this on my other plugin that extends CordovaActivity. I need help please im stuck here for 4 days now..
accepted answer: http://stackoverflow.com/a/27285129
type: Question
tagged with: localnotification
possible better answer: http://stackoverflow.com/a/27284435
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27285180
score: 2
downvote count: 0
has body: Replace if (subClass.isBottomEntity()|| subClass.equals(array[0])|| subClass.equals(array[1])|| subClass.equals(array[2])){ with if (subClass.isBottomEntity()|| unsatisfiable.contains(subclass)) { which has the same effect. There's no need for you to copy the unsatisfiable set out to an array.
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27284954
type: Answer
accepted answer of: http://stackoverflow.com/q/27284954
has comment: http://stackoverflow.com/comment/43038181
has comment: http://stackoverflow.com/comment/43071204

http://stackoverflow.com/a/27280444
type: Answer
answers question: http://stackoverflow.com/q/27280332
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27280332
has comment: http://stackoverflow.com/comment/43030008
has body: isLetter should do what you need. Here is an example: public boolean isAlpha(String name) { char[] chars = name.toCharArray(); for (char c : chars) { if(!Character.isLetter(c)) { return false; } } return true; } Also, Japanese characters are still chars, so they would still work. The way to do that has to do with encoding. A String is just a sequence of characters (chars); a String in itself has no encoding at all. For what it's worth, replace characters in the above with carrier pigeons. Same thing. A carrier pigeon has no encoding. Neither does a char. From Check if String contains only letters and UTF-8 Encoding ; Only some Japanese characters are not getting converted

http://stackoverflow.com/q/27193955
has body: basically what I am trying to do is: Get the user to enter a 5 digit number. If all of the digits in the number are Odd, it will print out "All of the digits are odd" and if all of the digits are not Odd, then it will print out "Not all of the digits are odd", and then it will ask the user if they want to Enter a new Number by pressing Y or N and then it will ask them for another 5 digit number and repeat. Here is my problem: When a user does not enter a 5 digit number, E.G enters a string/character, then I want it to say "That was not a number, please try again", I tried to do this with try and catch, I can make it so it says try again, but I am unsure on how to make the code return back to the beginning after an error has been thrown. Sorry I am bad at java :-/ I also have this problem when user does not enter Y or N and enter a number. code: package veryoddnumber; import java.util.*; public class VeryOddNumber { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a 5 digit number..."); boolean yesno; do { try { int number = scan.nextInt(); int length = String.valueOf(number).length(); if (length == 5) { String digits = String.valueOf(number); char number1 = digits.charAt(0); char number2 = digits.charAt(1); char number3 = digits.charAt(2); char number4 = digits.charAt(3); char number5 = digits.charAt(4); if (number1 % 2 != 0 &amp;&amp; number2 % 2 != 0 &amp;&amp; number3 % 2 != 0 &amp;&amp; number4 % 2 != 0 &amp;&amp; number5 % 2 != 0) { System.out.println("All of the numbers are odd..."); } else { System.out.println("Not all of the numbers are odd..."); } System.out.println("Would you like to enter another number? (Y/N)"); } else { System.out.println("You did not enter a 5 digit number! Try again..."); System.out.println("Enter a 5 digit number..."); } } catch (Exception e) { System.out.println("That was not a number! Try again..."); } try { char letter = scan.next().charAt(0); if (letter == 'Y' || letter == …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42873596
has title: Enter a number, That was not a number, please try again
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42873539
linked to: http://stackoverflow.com/q/2051817
downvote count: 0
has answer: http://stackoverflow.com/a/27194042
accepted answer: http://stackoverflow.com/a/27194042
has comment: http://stackoverflow.com/comment/42873587
has comment: http://stackoverflow.com/comment/42873448
has comment: http://stackoverflow.com/comment/42873436
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/19129509
has comment: http://stackoverflow.com/comment/42873551

http://stackoverflow.com/comment/43096131
has text: @Jesper, I got it now... how it works, Thanks very much for such an excellent explanation...
type: AnswerComment
comment on: http://stackoverflow.com/a/27296178
type: Comment
score: 0

http://stackoverflow.com/q/27229399
type: Question
accepted answer: http://stackoverflow.com/a/27233099
upvote count: 12
score: 12
has answer: http://stackoverflow.com/a/27233099
answer count: 2
possible better answer: http://stackoverflow.com/a/30341338
downvote count: 0
favorite count: 0
has title: Aerospike: how do I get record key?
tagged with: aerospike
has body: Aerospike client has scanAll method for reading all rows from it's store. I use it in the folowing code: ScanPolicy policy = new ScanPolicy(); policy.concurrentNodes = true; policy.priority = Priority.DEFAULT; policy.includeBinData = true; policy.scanPercent = 100; client.scanAll(policy, "namespaceName", "setName", new ScanCallback() { @Override public void scanCallback(Key key, Record record) throws AerospikeException { STORE.put(key.userKey.toLong(), record.getValue("binName").toString()); } }); But it is finished with NullPointerException, because userKey is null. All other fields are valid as expected. User key is the Long value, that was used for saving data: client.put(writePolicy, new Key("namespaceName", "setName", userKey), new Bin("binName", value)); All is fine, if I do single request like this: client.get(readPolicy, new Key("namespaceName", "setName", userKey)); What may be wrong? Why userKey is null?
tagged with: nosql
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30341338
tagged with: java

gradle
tags question: http://stackoverflow.com/q/27306332
tags question: http://stackoverflow.com/q/27245601
tags question: http://stackoverflow.com/q/27260714
tags question: http://stackoverflow.com/q/27249157
type: Tag
tags question: http://stackoverflow.com/q/27285296
tags question: http://stackoverflow.com/q/27195459
tags question: http://stackoverflow.com/q/27294345
tags question: http://stackoverflow.com/q/27174697
tags question: http://stackoverflow.com/q/27274526
tags question: http://stackoverflow.com/q/27263662
tags question: http://stackoverflow.com/q/27235679
tags question: http://stackoverflow.com/q/27244262
tag name: gradle
tags question: http://stackoverflow.com/q/27285115
tags question: http://stackoverflow.com/q/27234921
tags question: http://stackoverflow.com/q/27275402
tags question: http://stackoverflow.com/q/27239028
tags question: http://stackoverflow.com/q/27229720
tags question: http://stackoverflow.com/q/27164019
tags question: http://stackoverflow.com/q/27311914
tags question: http://stackoverflow.com/q/27267508
tags question: http://stackoverflow.com/q/27246435
tags question: http://stackoverflow.com/q/27297904
tags question: http://stackoverflow.com/q/27200688
tags question: http://stackoverflow.com/q/27206040
tags question: http://stackoverflow.com/q/27212499

http://stackoverflow.com/comment/42864114
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27188919
score: 1
has text: Because `String#charAt()` is a method, not an array instance. You write 'A' to indicate a type `char`, as opposed to "A" which is a `String`.

http://stackoverflow.com/q/27155632
tagged with: e4
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
tagged with: rcp
tagged with: eclipse
has answer: http://stackoverflow.com/a/32733304
upvote count: 1
has title: Eclipse e4 - adding a Core Expression
has answer: http://stackoverflow.com/a/27155743
favorite count: 0
has body: Hello I'd like to add a Core Expression to an HandledMenuItem. I simply want to show that menu entry only if a selected MPart is active. my implementation as follows: It doesn't work. Is there any way to check which value activePartId has? Anyway it should be the right one. Thanks
has answer: http://stackoverflow.com/a/32759882
answer count: 4
has answer: http://stackoverflow.com/a/38311738

http://stackoverflow.com/a/27251647
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42977440
has comment: http://stackoverflow.com/comment/42977673
has comment: http://stackoverflow.com/comment/42977302
score: 0
answers question: http://stackoverflow.com/q/27251388
has body: replaceAll() method provided by a string should replace all occurrences of a given word in the string Example: sentence.replaceAll("there","") or sentence.removeAll("there")

http://stackoverflow.com/a/27288563
has body: Just as a supplement to Jon's answer, I recommend that you only use the primitive wrapper types for fields, variables and parameter types when they are actually required. It is generally more efficient to use the corresponding primitive types. And there are fewer "edge cases" to trip you up / make your code more fragile. (One of the edge cases is that the semantics of == are ... non-intuitive. Another is that you can get mysterious NullPointerException in situations where the primitive types wouldn't / couldn't give you that.)
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27288116
type: Answer

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/27175756
type: Tag

http://stackoverflow.com/comment/42875287
score: 0
comment on: http://stackoverflow.com/q/27194954
has text: @HovercraftFullOfEels Except it did help the OP.. I agree it's trivial, and I'm sure it's a duplicate. But we all start somewhere and asking questions regarding their code is kind of what this site is for.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42983995
comment on: http://stackoverflow.com/q/27252915
has text: @Griffey Dog Is myClass.someStaticMethod() even possible?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27160371
downvote count: 0
favorite count: 0
tagged with: multilabel-classification
answer count: 0
type: UnansweredQuestion
score: 1
has body: I am trying to classify legal case documents which are in text format, in different folders like Civil, Land, Criminal, e.t.c, I intended using Naive Bayes as Vectoriser to get the vectors from the text documents,feed it in to SVM to classify the documents using javaml, I have implemented the preprocessing like stemming, I used the formulars of Naive Bayes as seen in http://eprints.nottingham.ac.uk/2995/1/Isa_Text.pdf to calculate prior probability, likelihood, evidence and posterior probability, I am assuming the posterior probability is the vector to be fed into SVM, but I cannot format the output to feed into the SVM library. I need all the help I can get in this, I hope I am doing things right. I have other legal cases as test set that I want to classify to the right categories.
has comment: http://stackoverflow.com/comment/42815184
tagged with: text-classification
tagged with: document-classification
has comment: http://stackoverflow.com/comment/42816829
tagged with: java
tagged with: svm
type: Question
upvote count: 1
has title: Naive Bayes and SVM java implementation for document classification
has comment: http://stackoverflow.com/comment/42814655

http://stackoverflow.com/comment/42978874
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27238715
type: Comment
has text: Please upvote the answer if you feel it was helpful, or edit to reflect your changes to the sample code.

http://stackoverflow.com/comment/43075518
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27305818
has text: I'm mainly using this as a way to learn generics, maps and lambdas. I'm currently in the first semester of computer science and I've learned the basics of java's syntax but on my free time I've been trying to learn more stuff because I'm too impatient to wait for the class to get there. Usually what I do is I come up with a problem (in this case sorting the map by person's height) to solve. When I run into a problem I try to find an example and learn from it, but I couldn't quite find what I was looking for here, which is why I made this. I probably should have made a Person OOP class, though.

http://stackoverflow.com/a/27226778
type: Answer
has body: You've given it a mixture of a file protocol and an http protocol, which doesn't really make sense. Basically you can't do what you're trying to do, if the only way you have access to the resource is via HTTP. There's no general mechanism for being notified when an HTTP resource changes, because there's no general mechanism for having push notifications from an HTTP resource, and it's outside the operating system's control so it can't intercept changes as they happen. With a local file, your operating system can detect changes as they happen because it's ultimately responsible for dealing with writes to local disk, but that doesn't apply in your situation. You'd need something that polls for changes, unless S3 has something bespoke in place to push change notifications (but that's something you'd have to investigate separately). You can't do it with Java NIO.
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/27226592
has comment: http://stackoverflow.com/comment/42931630
accepted answer of: http://stackoverflow.com/q/27226592
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27205588
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27206502
type: Question
downvote count: 0
has body: I'm working on a Java program in which I must read the contents of a file and then print each lines reverse. For example the text: Public Class Helloprinter Public static void would print the following after running my reverse program: retnirPolleh ssalc cilbup diov citats cilbup Here's what I got so far: public static void main(String[] args) throws FileNotFoundException { // Prompt for the input and output file names ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); //String reverse = ""; 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); PrintWriter out = new PrintWriter(outputFileName); String aString = ""; while(in.hasNextLine()) { String line = in.nextLine(); list.add(line); } in.close(); for(int i = 0; i &lt;list.size(); i++) { aString = list.get(i); aString = new StringBuffer(aString).reverse().toString(); out.printf("%s", " " + aString); } out.close(); } } EDIT: With Robert's posting it helped put me in the right direction. The problem is that with that is that it doesn't keep the lines. Public Class Helloprinter Public static void becomes after running my program: retnirPolleh ssalc cilbup diov citats cilbup it needs to keep the line layout the same. so it should be: retnirPolleh ssalc cilbup diov citats cilbup
has title: Reverse lines in ArrayList Java
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42894321
has answer: http://stackoverflow.com/a/27206152
possible better answer: http://stackoverflow.com/a/27205729
accepted answer: http://stackoverflow.com/a/27206502
has comment: http://stackoverflow.com/comment/42893833
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27205729
has answer: http://stackoverflow.com/a/27206233
upvote count: 1
has comment: http://stackoverflow.com/comment/42893811
type: AnsweredQuestion

http://stackoverflow.com/q/27178857
tagged with: queue
type: Question
has answer: http://stackoverflow.com/a/27178868
accepted answer: http://stackoverflow.com/a/27178868
has comment: http://stackoverflow.com/comment/42848430
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42846818
favorite count: 0
possible better answer: http://stackoverflow.com/a/27178958
type: AnsweredQuestion
has title: Java: How to create a stack using the queue interface?
downvote count: 0
score: 1
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/27178958
has body: I have a function that takes Queues, and I would like to perform operations on them like a Stack. Unfortunately, ArrayDeque methods like addFirst are not visible in the Queue interface, so I cannot use them. Is there a way to perform Stack operations on a Queue? Thanks!

http://stackoverflow.com/q/27212307
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42908127
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27214303
accepted answer: http://stackoverflow.com/a/27214303
has title: Java Observer Pattern for Range-Based Wireless Sensor Network (WSN) Localization
has comment: http://stackoverflow.com/comment/42908501
tagged with: design-patterns
type: Question
tagged with: algorithm
has body: I'm building a simulation of range-based Wireless Sensor Network Localization (WSN). A range-based WSN consists of sensors those measure distances. Technical details of the sensors are not important at this stage. Sensors have two states: localized and unlocalized. I need to implement an observer pattern for the following reason: A sensor has neighbors, i.e. other sensors within its range. Whenever it is localized, it has to broadcast its position to its neighbors. Notice that, this is a recursive operation. If any of its neighbors are localized, it will broadcast its position as well. A sensor can be localized if and only if it can determine its position using distances from three localized neighbors. I have two questions: 1) Should I implement Sensor class as public class Sensor extends Observable implements Observer 2) If so, how can I simulate the boradcast() function? So far I've tried: void broadcastPosition() { for(Sensor s : neighbors) s.neighborLocalized(this); } void neighborLocalized(Sensor s) { if(!neighborList.contains(s)) throw new IllegalArgumentException("This is not a neighbor"); localizedNeighbors.add(s); if(localizeSelf()) \\ returns true if the sensor is able to localize itself broadcastPosition(); } however, this approach fails because it goes into an infinite loop. Maybe I should use wait() and notify(). To sum up, I have a design problem and I seek your help to solve this. I send a screenshot of the algorithm presented in the paper of Aspnes et al. 2008
tagged with: java

http://stackoverflow.com/comment/43038228
has text: No problem! =D Any time.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27256646
score: 0

nosql
tags question: http://stackoverflow.com/q/27243884
tag name: nosql
type: Tag
tags question: http://stackoverflow.com/q/27229399
tags question: http://stackoverflow.com/q/27283022
tags question: http://stackoverflow.com/q/27243698

http://stackoverflow.com/q/27191718
has title: C# client and java server interaction
has comment: http://stackoverflow.com/comment/42885460
has comment: http://stackoverflow.com/comment/42870175
type: UnansweredQuestion
answer count: 0
has body: Hello all I hava a big problem with my client-server interaction, when I send a data from client to server it's work but when I send a data from server to my C# client the data are not recieved. my code: server: public void ReceiveData(Socket socket, String command) throws IOException { System.out.println("reception"); String[] dataIn; BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String input = br.readLine(); System.out.println("receive: " + input); dataIn = input.split(" "); username = dataIn[1]; System.out.println(dataIn[0]); System.out.println(dataIn[1]); System.out.println(dataIn[2]); } public void SendData(Socket socket, Object data) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); bw.write((String) data); bw.flush(); bw.close(); System.out.println("send: " + data); } my client code: public void SendLogin(NetworkStream ns, string command, string username, string password) { StreamWriter sw = new StreamWriter(ns); sw.WriteLine(command + " " + username + " " + password); sw.Flush(); sw.Close(); } public String ReceiveString(NetworkStream ns) { string value = ""; StreamReader sr = new StreamReader(ns, Encoding.ASCII); value = sr.ReadLine(); ns.Close(); return value; } thanks
tagged with: java
has comment: http://stackoverflow.com/comment/42869622
tagged with: dataoutputstream
type: Question
tagged with: c#
score: 0
tagged with: streamreader
tagged with: networkstream

http://stackoverflow.com/comment/42879830
type: Comment
type: QuestionComment
has text: that is odd. is your id a String for sure? try `setInt()` instead.
score: 0
comment on: http://stackoverflow.com/q/27197443

http://stackoverflow.com/a/27201669
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27201378
downvote count: 0
upvote count: 2
has body: Below code snippet may help you String str = "3A2B"; // split the string on String st[] = str.split("(?&lt;=\\D)(?=\\d)"); System.out.println(Arrays.toString(st)); for (String s : st) { String intValue = s.substring(0, s.length()-1); int i = Integer.parseInt(intValue); char c = s.charAt(s.length()-1); while (i &gt; 0) { System.out.print(c); i--; } System.out.println(); }

http://stackoverflow.com/q/27198636
type: Question
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/27198676
has body: How can I create an Iterator (by implementing iterable) to Hashmap if it doesn't preserve order? my keys should be ordered.. and I want to iterate in descending order
answer count: 3
has comment: http://stackoverflow.com/comment/42881717
downvote count: 0
has comment: http://stackoverflow.com/comment/42881655
tagged with: iterable
favorite count: 0
has comment: http://stackoverflow.com/comment/42881646
possible better answer: http://stackoverflow.com/a/27198642
has answer: http://stackoverflow.com/a/27198642
has comment: http://stackoverflow.com/comment/42881862
has answer: http://stackoverflow.com/a/27198676
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42881709
has answer: http://stackoverflow.com/a/27198700
upvote count: 1
has title: implementing iterator with iterable to Hashmap - is it possible?

http://stackoverflow.com/q/27271858
upvote count: 4
has body: Is there a way to obtain the wifi security type of the network that the device is currently connected. I know that wifi security could be obtained by scanning network. but is it possible without scanning so that I can get it for the current wifi network??
answer count: 1
downvote count: 0
score: 4
tagged with: android-wifi
favorite count: 0
accepted answer: http://stackoverflow.com/a/27273069
tagged with: security
has title: How to obtain wifi security type of current wifi network in android
tagged with: android
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/27273069
tagged with: java

http://stackoverflow.com/a/27158899
answers question: http://stackoverflow.com/q/27157445
accepted answer of: http://stackoverflow.com/q/27157445
has body: Try this do { String Enterproducts=in.next(); if(Enterproducts.equals("Stop")){ break; } int n = in.nextInt(); for(int i=0; i&lt;category.length; i++){ if(Enterproducts.equals(category[i])){ System.out.print(String.format("%-20s %s",category[i], price[i], n)); System.out.println(); } } } while(in.hasNext()); With %-20s you are specifing a space lenght. As an alternative, you can do it as you did it before, but using tabs instead spaces (tabs = \t).
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/27241077
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42959598
has body: If you really want to debug the problem, a search for "Unable to acquire application service" gets some answers that might help. But if you just want to fix the problem, I suggest doing a clean install of Eclipse. It doesn't take long unless you have many added plugins. That will fix all the Eclipse state without changing your workspace. In my experience, this is effective. If that doesn't work, then look for broken state in your workspace.
has comment: http://stackoverflow.com/comment/42996901
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27240194
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27240194
has comment: http://stackoverflow.com/comment/42998027

http://stackoverflow.com/q/27246748
has comment: http://stackoverflow.com/comment/42968515
has comment: http://stackoverflow.com/comment/42973438
has comment: http://stackoverflow.com/comment/42969126
has comment: http://stackoverflow.com/comment/42973571
type: UnansweredQuestion
type: Question
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/42968788
has title: java.lang.NullPointerException trying to get specific values from hashmap
answer count: 1
has answer: http://stackoverflow.com/a/27250222
has comment: http://stackoverflow.com/comment/42974617
has body: I've spent several frustrating days on this now and would appreciate some help. I have a Java agent in Lotus Domino 8.5.3 which is activated by a cgi:POST from my Lotusscript validation agent which is checking that customer has filled in the Billing and delivery address form. This is the code that parses the incoming data into a HashMap where field names are mapped to their respective values. HashMap hmParam = new HashMap(); //Our Hashmap for request_content data //Grab transaction parameters from form that called agent (CGI: request_content) if (contentDecoded != null) { String[] arrParam = contentDecoded.split("&amp;"); for(int i=0; i &lt; arrParam.length; i++) { int n = arrParam[i].indexOf("="); String paramName = arrParam[i].substring(0, n); String paramValue = arrParam[i].substring(n + 1, arrParam[i].length()); hmParam.put(paramName, paramValue); //Old HashMap if (paramName.equalsIgnoreCase("transaction_id")) { transactionID = paramValue; description = "Order " + transactionID + " from Fareham Wine Cellar"; //System.out.println("OrderID = " + transactionID); } if (paramName.equalsIgnoreCase("amount")) { orderTotal = paramValue; } if (paramName.equalsIgnoreCase("deliveryCharge")) { shipping = paramValue; } } } The block of code above dates back over a year to my original integration of shopping cart to Barclays EPDQ payment gateway. In that agent I recover the specific values and build a form that is then submitted to EPDQ CPI later on in the agent like this; out.print("&lt;input type=\"hidden\" name=\"shipping\" value=\""); out.println(hmParam.get("shipping") + "\"&gt;"); I want to do exactly the same thing here, except when I try the agent crashes with a null pointer exception. I can successfully iterate through the hashMap with the snippet below, so I know the data is present, but I can't understand why I can't use myHashMap.Get(key) to get each field value in the order I want them for the html form. The original agent in another application is still in use s…
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/27302504
tags question: http://stackoverflow.com/q/27204159
tags question: http://stackoverflow.com/q/27170602
tags question: http://stackoverflow.com/q/27213593
tags question: http://stackoverflow.com/q/27160335
tags question: http://stackoverflow.com/q/27162348
tags question: http://stackoverflow.com/q/27276899
tags question: http://stackoverflow.com/q/27272712
tag name: tcp

http://stackoverflow.com/comment/42943804
comment on: http://stackoverflow.com/a/27233168
type: AnswerComment
has text: ok so you can change occupiedRooms.add(new Room(roomNo)) for example
score: 0
type: Comment

http://stackoverflow.com/q/27206781
favorite count: 0
has title: Getting local variables using javassist?
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has body: Is there any way of getting the names of local variables using javassist ? My final aim is to get the Objects hashcode at run time. For example if I have a code snippet like: void try(){ Integer a = 123; System.out.println(a); } I would like to instrument it so that it looks like something like: void try(){ Integer a = 123; System.out.println(a.hashCode()); System.out.println(a); } So, I am trying to get the local variable name 'a' and then instrumenting that back in the code. Is there any of getting the name and also, is there any better way of doing the same thing ? Thanks.
has answer: http://stackoverflow.com/a/27211822
type: Question
tagged with: instrumentation
answer count: 1
downvote count: 0
tagged with: javassist

http://stackoverflow.com/comment/43086751
type: Comment
type: QuestionComment
has text: What kind of word documents are you processing? is there anything special concerning used formattings? Have you just tried using a word document that is repeating the same word over and over?
comment on: http://stackoverflow.com/q/27312886
score: 1

http://stackoverflow.com/q/27187437
has comment: http://stackoverflow.com/comment/42861708
has comment: http://stackoverflow.com/comment/42861527
answer count: 1
has answer: http://stackoverflow.com/a/27187895
has comment: http://stackoverflow.com/comment/42861602
has comment: http://stackoverflow.com/comment/42862312
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42861525
type: Question
accepted answer: http://stackoverflow.com/a/27187895
has comment: http://stackoverflow.com/comment/42861485
has body: OnClick of button on JSP Page, I am trying to download more than one pdf one by one using java code but not able to done it and Using Following snippet code for the same Document document[]= new Document[20]; httpServletResponse.setHeader("Content-Disposition", "attachment;filename=welcome.pdf"); httpServletResponse.setContentType("application/pdf"); try{ for(int i=0;i&lt;3;i++) { System.out.println(i); document[i]=new Document(); PdfWriter.getInstance(document[i], httpServletResponse.getOutputStream()); document[i].open(); document[i].add(new Paragraph("Hello Prakash")); document[i].add(new Paragraph(new Date().toString())); document[i].close(); } }catch(Exception e){ e.printStackTrace(); } It is not working and alaways only one .PDF file is downloading, anyone help me out?
has comment: http://stackoverflow.com/comment/42861702
score: 0
has title: how to download mulitple .PDF files in java

http://stackoverflow.com/a/27235132
has comment: http://stackoverflow.com/comment/42947726
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27234504
has comment: http://stackoverflow.com/comment/42958061
downvote count: 0
has body: A worker thread is free when it is takesing off the queue. Any given worker thread take's off the queue when it no longer is running the task. So it would look something like private final BlockingQueue&lt;Runnable&gt; workQueue; class WorkerThread { public void run(){ while(true){ Runnable r = workQueue.take(); // worker thread is 'free' r.run(); // worker thread is busy } } } So to answer your question, a particular worker thread is free when it is not executing a task submitted to the service.
has comment: http://stackoverflow.com/comment/42949744
score: 2

http://stackoverflow.com/q/27227838
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42933079
has title: Parse Simple Json response
has answer: http://stackoverflow.com/a/27227891
has body: Am trying to parse this Json response. For some weird reason its not working. Please bear with me . I really suck at Json. Here is the Url am trying to parse: This is the code am using to parse it: public class AsyncTaskParseJson extends AsyncTask&lt;String, String, String&gt; { final String TAG = "AsyncTaskParseJson.java"; // set your json string url here @Override protected void onPreExecute() { Toast.makeText(getActivity(), "started", Toast.LENGTH_SHORT).show(); } @Override protected String doInBackground(String... arg0) { String str = ""; HttpResponse response; HttpClient myClient = new DefaultHttpClient(); HttpPost myConnection = new HttpPost("http://gdata.youtube.com/feeds/api/videos/iS1g8G_njx8?v=2&amp;alt=jsonc"); try { response = myClient.execute(myConnection); str = EntityUtils.toString(response.getEntity(), "UTF-8"); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try{ JSONObject myJson = new JSONObject(str); String grande = myJson.getString("title"); Toast.makeText(getActivity(), ""+grande, Toast.LENGTH_SHORT).show(); } catch ( JSONException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String strFromDoInBg) { Toast.makeText(getActivity(), "done", Toast.LENGTH_SHORT).show(); } } i just need to parse the Title and descrption only. thanks
accepted answer: http://stackoverflow.com/a/27228111
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27228111
has answer: http://stackoverflow.com/a/27228148
has comment: http://stackoverflow.com/comment/42933452
tagged with: youtube-api
type: Question
possible better answer: http://stackoverflow.com/a/27227891

http://stackoverflow.com/q/27214547
type: Question
has title: Where to place JavaMail API
linked to: http://stackoverflow.com/q/9052391
linked to: http://stackoverflow.com/q/10953031
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12170513
has answer: http://stackoverflow.com/a/27214704
tagged with: jar
has body: I have looked through several tutorials (and my Java manuals) and I am totally confused as to whether it is better to set the classpath variable for mail.jar (JavaMail api) or just place the mail.jar file in my EXT directory in jdk1.7.0. Setting it directly in the EXT makes sense to me because compilation would seem easier. This is where most tutorials (using that approach) said it belongs --- C:\Program Files\Java\jdk1.7.0_07\jre\lib\ext One even states "Note that in Windows, to be safe, you should install it in both the JRE and JDK lib/ext directories." Would I copy mail.jar into the ext directory and the jar files in the lib directory (the lib directory in javamail1-4-7) or where would I put the 6 jar files in that directory relating to my jdk1.7.0_07 directory structure (dsn.jar, gimap.jar, imap.jar, mailapi.jar, pop3.jar, and smtp.jar)? And with jdk1.7.0_07 do I still need to add the JavaBeans Activation Framework additionally? (I am under the impression that I would not have to) I have found these two posts on your site: Restriction error on JavaMail library Access restriction: The constructor Provider() is not accessible due to restriction on required library jdk1.6.0\jre\lib\jsse.jar? but neither really cleared this question up for me Thanks in advance for any thoughts, advice, and help.....

http://stackoverflow.com/comment/42990122
score: 0
type: Comment
has text: So in every ActionListener method in try block i should open connection and after all job in finaly block close connection? Isnt that reduce performance if i have lots of ActionListeners methods?
comment on: http://stackoverflow.com/a/27258092
type: AnswerComment

http://stackoverflow.com/comment/42999778
has text: I tried to set some value to my progress bar, for example: pb5Star.setProgress(1); but it does not work
type: Comment
comment on: http://stackoverflow.com/a/27262906
score: 0
type: AnswerComment

http://stackoverflow.com/q/27155216
tagged with: java
tagged with: eclipse
tagged with: navigation-drawer
type: Question
has body: I am working on an Android application that implements a NavigationDrawer. The NavigationDrawer works fine, so do the fragments transitions but I can't access the Fragment's elements. Here there is my drawer onItemClick() listener's code: ConfigureFragment configure = new ConfigureFragment(); Button bt; InFragment in = new InFragment(); OutFragment out = new OutFragment(); ConditioningFragment cond = new ConditioningFragment(); private String lft = null; @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { selectItem(position); android.app.FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); switch(position){ case 0: if(lft == null){ transaction.replace(R.id.mainContent,configure,"ConfigureFragment"); transaction.commit(); lft = "ConfigureFragment"; }else{ transaction.replace(fragmentManager.findFragmentByTag(lft).getId(),configure,"ConfigureFragment"); transaction.commit(); lft = "ConfigureFragment"; } bt = (Button)configure.getView().findViewById(R.id.configure_bt); //throws NullPointerException break; case 1: if(lft == null){ transaction.replace(R.id.mainContent,in,"InFragment"); transaction.commit(); lft = "InFragment"; }else{ transaction.replace(fragmentManager.findFragmentByTag(lft).getId(),in,"InFragment"); transaction.commit(); lft = "InFragment"; } break; case 2: if(lft == null){ transaction.replace(R.id.mainContent,out,"OutFragment"); transaction.commit(); lft = "OutFragment"; }else{ transaction.replace(fragmentManager.findFragmentByTag(lft).getId(),out,"OutFragment"); transaction.commit(); lft = "OutFragment"; } break; } drawerLayout.closeDrawer(Gravity.LEFT); }
has answer: http://stackoverflow.com/a/27159486
score: 0
has title: Android Navigation drawer fragments
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: android-fragments

http://stackoverflow.com/a/27308779
has comment: http://stackoverflow.com/comment/43079539
has body: It is not true that we do not need to check for NumberFormatExceptions. A checked exception is an exception that could be thrown by a method you're calling and that you're checking for it and handling it appropriately. In the example you're giving, on NumberFormatException you might want to let the user know that they provided an invalid number. Basically all exceptions should be checked and handled.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27308732

http://stackoverflow.com/comment/42854312
has text: you might want to iterate through the first list, and for each element extract the part after "," and insert it into another list.
comment on: http://stackoverflow.com/q/27183422
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42989723
comment on: http://stackoverflow.com/q/27257927
score: 0
type: Comment
type: QuestionComment
has text: @LuiggiMendoza you should check if the connection is timed out and if it is create a new connection. You actually don't even need to explicitly call the `close` method it will be closed automatically.

http://stackoverflow.com/a/27203059
accepted answer of: http://stackoverflow.com/q/27201864
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27201864
downvote count: 0
has comment: http://stackoverflow.com/comment/42889320
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42889583
has body: Using Windows 8.1 Pro, with JRE 1.8.0_25, i see no problem in the rendered gui, here is my screenshot:
has comment: http://stackoverflow.com/comment/42889245

http://stackoverflow.com/a/27286809
has body: Give a try to remove the requestMapping annotation above the method - home?
type: Answer
has comment: http://stackoverflow.com/comment/43041068
answers question: http://stackoverflow.com/q/27286621
score: 0
has comment: http://stackoverflow.com/comment/43084560

http://stackoverflow.com/a/27437054
answers question: http://stackoverflow.com/q/27309950
type: Answer
has body: Like this Group.movementModel = ExternalMovement ExternalMovement.file = ee/Haggle4-Cam-Imote.csv
score: 0

http://stackoverflow.com/comment/42893744
comment on: http://stackoverflow.com/a/27205490
score: 0
type: AnswerComment
has text: I got that part for my other example. For here, I have to use IOException.
type: Comment

http://stackoverflow.com/comment/42850470
has text: If i keep typing in gibberish or unrecognized input, it alternates between the correct response and going to the "yes" response.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27181038
type: Comment

http://stackoverflow.com/comment/42935917
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27229428
has text: @Smutje what does that mean?
score: 0

http://stackoverflow.com/comment/42913059
comment on: http://stackoverflow.com/q/27216265
score: 0
has text: https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42965380
has text: @MarkRotteveel You are quite right. I've mildly edited my answer to reflect your comment. But in general, I'd encourage the OP to read up on the subject, since there's a lot more to be said than even your comment covers. My answer wasn't intended to be a full description of exactly how `synchronized` works.
comment on: http://stackoverflow.com/a/27244729
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/42803332
comment on: http://stackoverflow.com/q/27154508
has text: `I checked source code for HashMap(1.6), and it looks like it can be extended to add the above functionality to it.` What did you see that made you think this, and what approach did you have in mind? Also - why do you now suspect this approach *doesn't* work, such that you're asking here?
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27237541
downvote count: 0
has body: There's a System.exit(0) statement at the end of your getDataMethod method which will cause the JVM to exit before you even create your frame...
type: Answer
has comment: http://stackoverflow.com/comment/42951809
answers question: http://stackoverflow.com/q/27237339
score: 1
upvote count: 1

http://stackoverflow.com/a/27263745
type: Answer
score: 1
has body: "JSR 133 (Java Memory Model) FAQ, Jeremy Manson and Brian Goetz, February 2004" describes how does final field work. How can final fields appear to change their values? How do final fields work under the new JMM? QUOTE: The goals of JSR 133 include: A new guarantee of initialization safety should be provided. If an object is properly constructed (which means that references to it do not escape during construction), then all threads which see a reference to that object will also see the values for its final fields that were set in the constructor, without the need for synchronization.
answers question: http://stackoverflow.com/q/27254152
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43007753

http://stackoverflow.com/comment/42920620
type: Comment
comment on: http://stackoverflow.com/a/27217517
has text: Thank you for your input! It has been very helpful and I changed my code around a bit. Maybe you could take another look? What doesn't make sense to me is the public boolean isGuessCorrect method. I am getting errors when that code is written in java? I am all new to this and pratically teaching myself by research on the web.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27201776
possible better answer: http://stackoverflow.com/a/27202165
type: AnsweredQuestion
has title: Xml values from URL in android
tagged with: android
has comment: http://stackoverflow.com/comment/42886885
has answer: http://stackoverflow.com/a/27202165
tagged with: http://stackoverflow.com/tag/xml
answer count: 2
accepted answer: http://stackoverflow.com/a/27201808
has body: Below, xml file at "http://example.com/example.xml" abc name 568 458 185 236 974 def name 214 456 457 754 746 i want get first, second, third, forth and last value for abc name. how i get values from xml URL?
score: 0
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27201808
type: Question

http://stackoverflow.com/q/27295842
has body: I got a problem with storing columns with MySQL attribute YEAR using Java Hibernate. MySQL Table: CREATE TABLE DateTest ( id INT NOT NULL AUTO_INCREMENT, year YEAR(4), PRIMARY KEY(id) ) ENGINE = InnoDB; .. Java Access Class public class DateTest implements java.io.Serializable { private Integer id; private Date year; public DateTest() { } public DateTest(Date year) { this.year = year; } public Integer getId(){ return this.id; } public void setId(Integer id){ this.id = id; } public Date getYear(){ return this.year; } public void setYear(Date year){ this.year = year; } } Java Code to save record DateTestDao tcd = new DateTestDao(); Date dd = new Date(); DateTest dt = new DateTest(); tc.setYear(dd); tcd.saveRecord(dt); When I want to use Hibernates session.save the following error occurs: ERROR org.hibernate.util.JDBCExceptionReporter - Data truncated for column 'year' at row 1 Prinicpally, I know why it occurs because the date element is larger than the allowed year attribute, but I dont know how to solve it. Best Regards, Michael
upvote count: 1
downvote count: 0
answer count: 1
has title: Hibernate Conversion Java Date to MySQL YEAR
favorite count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27297058
tagged with: mysql

image
tags question: http://stackoverflow.com/q/27277051
tags question: http://stackoverflow.com/q/27174094
tags question: http://stackoverflow.com/q/27219914
tags question: http://stackoverflow.com/q/27249261
tags question: http://stackoverflow.com/q/27244544
tags question: http://stackoverflow.com/q/27185622
tags question: http://stackoverflow.com/q/27237060
tags question: http://stackoverflow.com/q/27194981
tags question: http://stackoverflow.com/q/27244119
tags question: http://stackoverflow.com/q/27193372
tags question: http://stackoverflow.com/q/27242094
tags question: http://stackoverflow.com/q/27183357
tags question: http://stackoverflow.com/q/27228607
tags question: http://stackoverflow.com/q/27227647
tags question: http://stackoverflow.com/q/27163585
tags question: http://stackoverflow.com/q/27259060
tags question: http://stackoverflow.com/q/27177813
tags question: http://stackoverflow.com/q/27163399
tags question: http://stackoverflow.com/q/27157678
tags question: http://stackoverflow.com/q/27189766
tags question: http://stackoverflow.com/q/27283742
tags question: http://stackoverflow.com/q/27178088
tags question: http://stackoverflow.com/q/27220992
tags question: http://stackoverflow.com/q/27198956
tags question: http://stackoverflow.com/q/27231834
tags question: http://stackoverflow.com/q/27306968
tags question: http://stackoverflow.com/q/27312473
tag name: image
tags question: http://stackoverflow.com/q/27266324
tags question: http://stackoverflow.com/q/27195679
tags question: http://stackoverflow.com/q/27263290
tags question: http://stackoverflow.com/q/27227994
tags question: http://stackoverflow.com/q/27240193
tags question: http://stackoverflow.com/q/27156734
tags question: http://stackoverflow.com/q/27168535
tags question: http://stackoverflow.com/q/27233976
tags question: http://stackoverflow.com/q/27277422
tags question: http://stackoverflow.com/q/27203438
tags question: http://stackoverflow.com/q/27219198
type: Tag
tags question: http://stackoverflow.com/q/27242725
tags question: http://stackoverflow.com/q/27304570

http://stackoverflow.com/a/27177207
accepted answer of: http://stackoverflow.com/q/27176851
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27176851
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42843408
has body: A ResultSet contains an internal cursor of the location you are reading from. So when the first method is called and finished the cursor is at the end of the available results. So when the second method is called there are no results to check. Before using the results in either method you can call ResultSet.beforeFirst() to make sure the cursor is in the right place before using it.
score: 1

http://stackoverflow.com/comment/42884889
comment on: http://stackoverflow.com/q/27200631
has text: try to change xmlns:app="http://schemas.android.com/apk/res/com.jbirdvegas.mgerrit" to xmlns:custom="http://schemas.android.com/apk/res-auto"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/53751844
type: Answer
has body: If you're trying to optimize development turn-around for manual testing, I strongly recommend the use of devtools. Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change. Just recompile -- and the server will restart itself (for Groovy you only need to update the source file). if you're using an IDE (e.g. 'vscode'), it may automatically compile your java files, so just saving a java file can initiate a server restart, indirectly -- and Java becomes just as seamless as Groovy in this regard. The beauty of this approach is that the incremental restart short-circuits some of the from-scratch startup steps -- so your service will be back up and running much more quickly! Unfortunately, this doesn't help with startup times for deployment or automated unit testing.
score: 1
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/27230702

http://stackoverflow.com/a/27194630
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27194586
has comment: http://stackoverflow.com/comment/42875875
has comment: http://stackoverflow.com/comment/42876040
has comment: http://stackoverflow.com/comment/42875642
accepted answer of: http://stackoverflow.com/q/27194586
type: Answer
has comment: http://stackoverflow.com/comment/42876100
has body: I think this mean sequence 00:00 00:01 ... 00:59 01:00 .... 23:58 23:59 I don't remember C syntax good, but I will try int hours = 0; int minutes = 0; while(hours &lt;= 23) { while(minutes &lt;= 59) { printf("%02d:%02d\n", hours, minutes); minutes++; } hours++; minutes = 0 } UPD: I'm sorry Only now view that you need Java. I think I can understand my idea and code.
has comment: http://stackoverflow.com/comment/42876059
score: 0

http://stackoverflow.com/q/27217989
favorite count: 0
type: Question
score: -1
has title: Grade Calculation Program: Array Out of Bounds
tagged with: java
answer count: 1
downvote count: 1
has body: I've been working on this program for 20+ hours and I feel like I'm really close to finishing, but I cannot seem to fix my array out of bounds exception. I'll provide my whole code here: import java.util.Scanner; import java.util.ArrayList; public class GradeCalcArryas { /* * Logan Wegner The purpose is to calculate * entered grades */ public static void main(String[] args) { Scanner s = new Scanner(System.in); // first scanner for inputs Scanner s1 = new Scanner(System.in); // second scanner for string boolean done = false; // so an if statement can be inputted for the code // to break back to the menu boolean quit = false; int choice = 0; final int MAX_STUDENTS = 200; //Array created to store the information entered for exams int[] examStats = new int[3]; //Array created to store the information entered for quizzes int[] quizStats = new int[3]; //Array created to store the information entered for homework int[] homeworkStats = new int[3]; //Array created to store the student name information entered String[] studentNames = new String[MAX_STUDENTS]; System.out.println("Welcome to GradeBook!"); System.out.println("Please provide grade item details"); System.out.print("Exams (number, points, weight):"); examStats[0] = s.nextInt(); // inputs exam number examStats[1] = s.nextInt(); // inputs exam points examStats[2] = s.nextInt(); // inputs exam weight System.out.print("Quizzes (number, points, weight):"); quizStats[0] = s.nextInt(); // inputs quiz number quizStats[1] = s.nextInt(); // inputs quiz points quizStats[2] = s.nextInt(); // inputs quiz weight System.out.print("Homework (number, points, weight):"); homeworkStats[0] = s.nextInt(); // inputs homework number homeworkStats[1] = s.nextInt(); // inputs homework points homeworkStats[2] = s.nextInt(); // inputs homework weight /*int numExams = examStats[0]; int numQuizzes = quizStats[0]; int numHW = homeworkStats[0]; int tableLength = numExams + numQuizzes + numHW + 1;*/ /*double[][] examScores = new double[MAX_STUDE…
tagged with: arrays
type: UnansweredQuestion
tagged with: arraylist
has answer: http://stackoverflow.com/a/27218069
upvote count: 0

http://stackoverflow.com/comment/42808206
type: Comment
type: QuestionComment
has text: For retrieval, O(1). Heck even a map with the values being type ArrayList would work as well.
score: 1
comment on: http://stackoverflow.com/q/27156980

http://stackoverflow.com/comment/42850027
score: 0
comment on: http://stackoverflow.com/q/27180459
type: QuestionComment
type: Comment
has text: Okay, when focused, the `JFormattedTextField` installs it's own `DocumentFilter`...which is a complete pain. `JFormattedTextField` really don't do real time filtering and does it's validation when the field loses focus or is actioned...

http://stackoverflow.com/a/27186438
has body: If you want to use @IdClass then the property names &amp; types in ProductId class and Product entity must match. In your Product.java class you have declared: prodId as Integer and category as Category But in ProductId.java class, you have declared: prodId as Integer and category as Integer Also you should not have @IdClass declaration in ProductId class, you have to remove that. Try below changes: Product.java @Entity @IdClass(ProductId.class) @Table(name = "Product") public class Product implements java.io.Serializable { private Integer prodId; private Category category; private int categoryId; // Adding new property @Id @GeneratedValue @Column(name = "prodId", nullable = false) public Integer getProdId() { return this.prodId; } @Id @Column(name = "catId", insertable = false, updatable = false) public int getCategoryId() { return categoryId; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "catId", referencedColumnName = "catId", nullable = false, insertable = false, updatable = false) public Category getCategory() { return this.category; } // Setters &amp; getters } ProductId.java // Remove the @IdClass annoatation from here public class ProductId implements java.io.Serializable { private Integer prodId; private Integer categoryId; // The property name should match public ProductId() { } public ProductId(Integer prodId, Integer categoryId) { this.prodId = prodId; this.categoryId = categoryId; } public Integer getProdId() { return this.prodId; } public void setProdId(Integer prodId) { this.prodId = prodId; } public Integer getCategoryId() { return categoryId; } public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof ProductId)) return false; ProductId castOther = (ProductId) other; return (this.getProdId() == castOther.getProdId()) &amp;&amp; (this.getCategoryId() == castOther.getCategoryId()); } public i…
has comment: http://stackoverflow.com/comment/42861605
score: 0
answers question: http://stackoverflow.com/q/27184960
has comment: http://stackoverflow.com/comment/42860921
type: Answer
has comment: http://stackoverflow.com/comment/42861229

http://stackoverflow.com/q/27245003
has body: I read some answers for "click+ctrl is not working" and it seems that all of solutions are for Windows, however I got this issue on OSX Yosemite. I just checkout the project form SVN, but I found I can't access any destination of a class by ctr+click. I tried to import the project as a new Java project, but I still can not find the destination for some class...any suggestion will be appreciated.
has answer: http://stackoverflow.com/a/27245199
tagged with: svn
tagged with: java
tagged with: eclipse
has title: Ctrl+click doesn't work in Eclipse Luna on OS X Yosemite
score: 0
answer count: 1
tagged with: osx-yosemite
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/43042384
has text: What output you are expecting?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27286594

http://stackoverflow.com/a/27281603
answers question: http://stackoverflow.com/q/27281306
has comment: http://stackoverflow.com/comment/43032248
has comment: http://stackoverflow.com/comment/43031987
has body: Here you go: public class Testcases { public List&lt;String&gt; myArray() { List&lt;String&gt; ar = new ArrayList&lt;&gt;(); ar.add("Customer1"); ar.add("Customer2"); ar.add("Customer3"); return ar; } } class TestcasesTest { @Test public void testMyArray() { Testcases testcases = new Testcases(); assertEquals(Arrays.asList("Customer1", "Customer2", "Customer3"), testcases.myArray()); } } I made some improvements on your method: Use interface types in return type and variable declarations whenever possible. So I changed ArrayList to List in the return type and the local variable No need for the parens in return(ar), this is simpler and natural: return ar
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43031905
upvote count: 3

http://stackoverflow.com/q/27177364
downvote count: 0
has answer: http://stackoverflow.com/a/34006017
favorite count: 0
has comment: http://stackoverflow.com/comment/55760979
type: Question
has title: Spring Candidate Bean Type Strategy should not instantiate all beans of given type before checking qualifier
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/34006017
tagged with: spring
has comment: http://stackoverflow.com/comment/55761219
tagged with: java
possible better answer: http://stackoverflow.com/a/27177592
has answer: http://stackoverflow.com/a/27177592
score: 2
has body: Having, an application with a multiple databases, and a Custom EntityManager scope. I figured that Spring creates all beans condidates for some Type, before filtring the qualified one. So in my case, its open all the EMFs even if i need to open only one ! The debuging bring me to thoses part of code which cause the problem : org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils /** * Obtain a bean of type {@code T} from the given {@code BeanFactory} declaring a qualifier * (e.g. {@code &lt;qualifier&gt;} or {@code @Qualifier}) matching the given qualifier). */ private static &lt;T&gt; T qualifiedBeanOfType(ConfigurableListableBeanFactory bf, Class&lt;T&gt; beanType, String qualifier) { Map&lt;String, T&gt; candidateBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors(bf, beanType); -&gt; Spring is looking for all bean condidate with the given Type before testing the qualifier T matchingBean = null; for (String beanName : candidateBeans.keySet()) { if (isQualifierMatch(qualifier, beanName, bf)) { ........ } } } Then the creation part public &lt;T&gt; Map&lt;String, T&gt; getBeansOfType(Class&lt;T&gt; type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException { String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit); Map&lt;String, T&gt; result = new LinkedHashMap&lt;String, T&gt;(beanNames.length); for (String beanName : beanNames) { try { result.put(beanName, getBean(beanName, type)); -&gt; the bean is created even if its not the qualified one } ........... } } I can modify the Spring code to find the qualified Bean before creating all beans condidates, but i wonder if there is another way to do?
type: AnsweredQuestion

http://stackoverflow.com/comment/43005423
has text: See my latest changes. Btw: learning the Java API will help you and is recommended. Your question is quite trivial and might get a negative voting.
comment on: http://stackoverflow.com/a/27267081
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27157496
has answer: http://stackoverflow.com/a/27157815
has comment: http://stackoverflow.com/comment/42809114
has comment: http://stackoverflow.com/comment/42809111
has title: How do I make a program that reverse user input of integers in Java?
upvote count: 1
has comment: http://stackoverflow.com/comment/42809202
has body: Well, I have made this simple start, but I could not think of a way to reverse user input of integers. My start: public static void main(String[] args) { try { Scanner console = new Scanner (System.in); System.out.println("&gt; "); String input = console.nextLine(); while (! input.equals("quit")){ System.out.println(); System.out.print("&gt; "); input = console.next(); } }catch (Exception e){ System.out.println("Error: Invalid Input"); } System.out.println("Bye!"); } So, I want user input such as 10 15 40 100 3400 to become 3400 100 40 15 10. I know that is cal use array.tostring someplace, but I do not know where and how.
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27157538
has comment: http://stackoverflow.com/comment/42809143
has answer: http://stackoverflow.com/a/27157538
has answer: http://stackoverflow.com/a/27157578
type: Question
has comment: http://stackoverflow.com/comment/42809159
downvote count: 0
has answer: http://stackoverflow.com/a/27157581
favorite count: 0
tagged with: reverse
answer count: 5
accepted answer: http://stackoverflow.com/a/27157581
has answer: http://stackoverflow.com/a/27158417

http://stackoverflow.com/a/27292313
type: Answer
upvote count: 2
score: 2
has body: lets clear few things first, not List&lt;? super Object) myList, you have ) character instead &gt; another thing is list does not have defined method put, to add things to list you are using add after sorting out yhose issues everything is working fine, have a look at this example
accepted answer of: http://stackoverflow.com/q/27291808
answers question: http://stackoverflow.com/q/27291808
has comment: http://stackoverflow.com/comment/43208836
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43207716
has comment: http://stackoverflow.com/comment/43284573

http://stackoverflow.com/comment/43069148
score: 1
type: Comment
type: QuestionComment
has text: you need to set the user agent, see [this answer](http://stackoverflow.com/a/9828691/1113392)
comment on: http://stackoverflow.com/q/27302950

http://stackoverflow.com/a/27252482
answers question: http://stackoverflow.com/q/27252307
has body: When you do reader.getPageContent(4), you get a byte[] containing PDF syntax. For instance: BT 36 788 Td /F1 12 Tf (Hello World )Tj ET q 0 0 m 595 842 l S Q In no way this is an image. In no way this is content that can be used as a standalone object. For instance: /F1 refers to a resource, more specifically to a font. Without looking at the /Resources of the pages of which we extracted the PDF syntax, we have no idea what the PDF string (Hello World) looks like. The title of your question get image byte in page is wrong. You say my page(4) content a image but that isn't English. Let's assume you mean to say my page 4 contains an image. In that case, the byte[] returned by getPageContent() will look somewhat like this: q 20 0 0 20 36 786 cm /img0 Do Q In this syntax q and Q save and restore the state. The cm operator defines the size and the position of the image: it will be 20 by 20 user units and positioned at x = 36 and y = 786. The actual image is stored in the resources of the page dictionary as an Image XObject. It is added to the page using the Do operator. If you do not understand a word of what I'm saying in this answer, you should start reading ISO-32000-1 or why not start reading the iText documentation? See for instance: iTextSharp Image Extraction with Transparency How can I get the resolution of an embeded image in a PDF using ITextSharp Extract Images from PDF coordinates using iText ...
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/27238701
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27238784
accepted answer: http://stackoverflow.com/a/27238787
has title: Getting methods to work in a simple Java program
type: Question
has body: I've got most of this program working apart from a few bits which aren't, I'm new to Java so it's not obvious what I'm meant to do. Here are the methods: public String getInventoryCode() { return inventoryCode; } public int getQuantityInStock() { return quantityInStock; } public int getDailyDemand() { return dailyDemand; } public int getReOrder() { return reOrder; } public int getLeadTime() { return leadTime; } public int newDeliveryIn(int newDeli) { quantityInStock += reOrder; return newDeli; } Here is the main code: StockItem item_1 = new StockItem("A654Y", 1000, 50, 500, 13); int quantityIn = item_1.getQuantityInStock(); for (int n = 1; n &lt;=50 ; n++) { quantityIn -= item_1.getDailyDemand(); System.out.print(n + "\t"); System.out.println(quantityIn); if (n % item_1.getLeadTime() == 1 ){ System.out.println("Batch Ordered"); } else if (n % item_1.getLeadTime() == 0){ quantityIn += item_1.getReOrder(); System.out.println("Batch Received"); } } It's a simple stock control program which counts days up to 50, each day reducing the amount of stock (quantityInStock) by X amount (dailyDemand) and then when it gets to a certain day (for instance every 10th day (haven't yet made a method for this, as not sure how to go about it) it will order more stock (reOrder) which will be delivered and added to the current stock after a certain amount of days after the order (leadTime). I think I'm almost there, just the last bit that I can't work out. This is the output I'm getting at the moment: 1 950 Batch Ordered 2 900 3 850 4 800 5 750 6 700 7 650 8 600 9 550 10 500 11 450 12 400 13 350 Batch Received 14 800 Batch Ordered 15 750 16 700 17 650 18 600 19 550 20 500 21 450 22 400 23 350 24 300 25 250 26 200 Batch Received 27 650 Batch Ordered ... I would also like "Batch Ordered, Batch Received" to go alongside the relevant day (3rd column) instead of under, but can't work out how. Any help would be great! Thanks.
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/27263398
tagged with: methods
has answer: http://stackoverflow.com/a/27238787
possible better answer: http://stackoverflow.com/a/27238760
tagged with: java
has answer: http://stackoverflow.com/a/27238760

http://stackoverflow.com/q/27162791
has title: How to use different locator in framework without using switch() case?
score: 0
has answer: http://stackoverflow.com/a/27168443
answer count: 1
type: UnansweredQuestion
tagged with: selenium-webdriver
has body: I want to use a different locator in the framework without using a switch-case because, when I use a switch-case, it asks to change JDK1.6 to 1.7. Can anyone please let me know how I can use a different locator in the framework? public class MainClass { private static final String BROWSER_PATH = "D:\\softs\\firefox.exe"; private static final String TEST_SUITE_PATH = "D:\\softs\\GmailTestSuite.xls"; private static final String OBJECT_REPOSITORY_PATH = "D:\\softs\\objectrepository.xls"; private static final String ADDRESS_TO_TEST = "https://www.gmail.com"; // other constants private WebDriver driver; private Properties properties; /*private WebElement we;*/ public MainClass() { File file = new File(BROWSER_PATH); FirefoxBinary fb = new FirefoxBinary(file); driver = new FirefoxDriver(fb, new FirefoxProfile()); driver.get(ADDRESS_TO_TEST); } public static void main(String[] args) throws Exception { MainClass main = new MainClass(); main.handleTestSuite(); } private void handleTestSuite() throws Exception { ReadPropertyFile readConfigFile = new ReadPropertyFile(); properties = readConfigFile.loadPropertiess(); ExcelHandler testSuite = new ExcelHandler(TEST_SUITE_PATH, "Suite"); testSuite.columnData(); int rowCount = testSuite.rowCount(); System.out.println("Total Rows=" + rowCount); for (int i = 1; i &lt; rowCount; i++) { String executable = testSuite.readCell(testSuite.getCell("Executable"), i); System.out.println("Executable=" + executable); if (executable.equalsIgnoreCase("y")) { // exe. the process String scenarioName = testSuite.readCell(testSuite.getCell("TestScenario"), i); System.out.println("Scenario Name=" + scenarioName); handleScenario(scenarioName); } } } private void handleScenario(String scenarioName) throws Exception { ExcelHandler testScenarios = new ExcelHandler(TEST_SUITE_PATH); testScenarios.setSheetName("Login"); testScenarios.columnData(); int rowWorkBook1 = testScenarios.rowCount(); for (int j = 1; j &lt; rowWorkBook1; j++) { String framWork = test…
tagged with: java
has comment: http://stackoverflow.com/comment/42836178
type: Question
has comment: http://stackoverflow.com/comment/42818624

http://stackoverflow.com/q/27306246
has body: I have a program but I dont know specifically what my mistake is or how to fix it: The question is: Write a program that asks the user to enter a series of numbers separated by commas. The program should calculate and display the sum of all the numbers. For example, if I enter 4,5,6,7, the sum displayed should be 22. This is what I have so far: import java.util.Scanner; public class SumAll { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String userNumber; String sum = null; //get numbers from user and store System.out.println("Enter numbers seperated by coma's: "); userNumber = keyboard.nextLine(); String[] tokens = userNumber.split("[, ]"); for (int i = 0; i &lt; tokens.length; i++) { sum = tokens.length[i++]; //showing me error here. Its written array required but int //found. } System.out.println("Sum is: " + sum); } } Thank you very much for the help.
answer count: 5
tagged with: addition
type: AnsweredQuestion
has title: Cannot do the sum of numbers using a comma and string tokenizer
has answer: http://stackoverflow.com/a/27306307
accepted answer: http://stackoverflow.com/a/27306307
tagged with: java
has answer: http://stackoverflow.com/a/27306316
tagged with: stringtokenizer
type: Question
has answer: http://stackoverflow.com/a/41529888
possible better answer: http://stackoverflow.com/a/27306300
has answer: http://stackoverflow.com/a/57228086
score: 0
has answer: http://stackoverflow.com/a/27306300
has comment: http://stackoverflow.com/comment/43075087

http://stackoverflow.com/comment/42830705
type: QuestionComment
has text: I have these dependencies related to jakson: ` org.codehaus.jackson jackson-core-asl 1.9.13 com.fasterxml.jackson.core jackson-core 2.4.3 `
comment on: http://stackoverflow.com/q/27169510
score: 0
type: Comment

http://stackoverflow.com/a/27244109
score: 0
type: Answer
has body: I can't comment yet so I place this as an answer. Based on what you have stated, it may be the sessionAttributes is null. To check if it is not null try logging or printing it in console before you call remove() method, eg. System.out.println(sessionAttributes);
answers question: http://stackoverflow.com/q/27242741
has comment: http://stackoverflow.com/comment/42963819

http://stackoverflow.com/q/27202341
score: 3
has title: JavaFX Webview youtube video error
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/27239377
answer count: 2
downvote count: 0
has body: When I try to load a video into JavaFX Webview the youtube will display an error message when play is pressed saying: "An error occurred, please try again later" I have this: private void change(final Pattern pattern) { nameLabel.setText(pattern.getName()); final WebEngine engine = view.getEngine(); final String code = "YME_DYsmBpY"; engine.load("http://www.youtube.com/embed/" + code + "?rel=0;3&amp;amp;autohide=1&amp;amp;showinfo=0"); } The WebView (view) is created in FXML and is not used outside of this method. Any help would be appreciated! :)
favorite count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: webview
tagged with: youtube
type: Question
linked to: http://stackoverflow.com/q/18758041
has answer: http://stackoverflow.com/a/27239188

http://stackoverflow.com/a/27301947
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43069275
has comment: http://stackoverflow.com/comment/43131180
has body: The below is a common way of doing things: keytool -import -trustcacerts -alias appletCert -file CAcert.crt jarsigner "C:\path\FollowMe.jar" appletCert
type: Answer
answers question: http://stackoverflow.com/q/27301569
has comment: http://stackoverflow.com/comment/43070663
score: 0

http://stackoverflow.com/a/27266181
score: 0
type: Answer
has body: Since you specified a super keyword with the parameter in the child class constructor, it will go to parameterized constructor in the base class. Otherwise the default constructor will be executed.
answers question: http://stackoverflow.com/q/27266058

http://stackoverflow.com/q/27162242
tagged with: apache-commons
score: 1
tagged with: java
has title: Python equivalence to org.apache.commons.configuration?
has body: I want to port this Configuration.class object (from http://pastebin.com/dZeV27XB) into python and it seems hard to port the org.apache.commons.configuration object In the java class, there were multiple functions that returns a Configuration.getString or Configuration.getInt e.g. public int getDumpEndDir() { return this.config.getInt("wiki.dump.endDir"); } public String getDocDir() { return this.config.getString("wiki.dump.docDir"); } Any clue to what such function return? Is there a python library similar to org.apache.commons? Especially if there is one with the org.apache.commons.configuration library. Is there a reason why this is in Java but not python?
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27162659
favorite count: 0
accepted answer: http://stackoverflow.com/a/27162659
tagged with: apache-commons-config
upvote count: 1
tagged with: python
type: AnsweredQuestion

http://stackoverflow.com/q/27278816
type: Question
has body: I just encountered a problem when trying to add an imprint to a swing application which is shown for five seconds when the application is closed. I had planned to open a JDialog just containing a simple image when the main frame is closed. I got a function showing the JDialog (I removed everything which is not necessary). public static void show() { JDialog d = new JDialog(); JLabel l = new JLabel(new ImageIcon(MainController.class.getClass().getResource("/path/to/endlogo.png"))); d.add(l); d.setVisible(true); } The function is called by the following snippet (in the window listener of my main window) @Override public void windowClosing(WindowEvent e) { show(); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } The problem is that the dialog is shown AFTER the five seconds (which is when the windows is already closed and the application exited, I tested it and it showed up perfectly after five seconds when run on application start). Do you guys know a way to achieve it the other way round?
has comment: http://stackoverflow.com/comment/43026552
score: 0
has comment: http://stackoverflow.com/comment/43056142
answer count: 1
has answer: http://stackoverflow.com/a/27296656
has title: JDialog created before Thread.sleep() shows after sleep is finished
tagged with: swing
has comment: http://stackoverflow.com/comment/43057623
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43057648
accepted answer: http://stackoverflow.com/a/27296656
tagged with: java

http://stackoverflow.com/a/27312312
score: 1
has body: You set log level by java.util.logging.ConsoleHandler.level=&lt;level&gt; where level stands for: SEVERE (highest value) WARNING INFO CONFIG FINE FINER FINEST (lowest value) You need to treat the levels like a stack : You define where you stand and the framework write logs dependently on the severity you chosen. For example, if you set level to INFO you'll get logs of severity SEVERE, WARNING and INFO
upvote count: 1
answers question: http://stackoverflow.com/q/27312133
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43074905
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27305339
type: QuestionComment
has text: Thank you very much, I thought it was like that, but I wasn't really positive about it since I usually handle exceptions as they happen instead of throwing them to be caught higher up.

http://stackoverflow.com/comment/42878892
score: 0
has text: It never occurred to you to look at the Javadocs for Cipher?
type: Comment
comment on: http://stackoverflow.com/q/27196375
type: QuestionComment

http://stackoverflow.com/comment/42902511
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27204617
type: AnswerComment
has text: If you want the numbers to only print out with each group, you can just move the appending of the number to inside the if statements. See my edited code.

http://stackoverflow.com/q/27251567
upvote count: 1
has body: I have a problem while iterating an ArrayList of Sockets. The purpose of the list is to send message to all clients when another one connects except the last one. I get ConcurrentModificationException and I don't know how to manage it. Please help! Server program: public void start() { try { serverSocket = new ServerSocket(10001); thread = new Thread(new MessageClient(listOfClients)); thread.start(); while (!isStopped) { socket = serverSocket.accept(); listOfClients.add(socket); synchronized (listOfClients) { listOfClients.notifyAll(); } g.getTextArea().append( "Client number " + listOfClients.size() + " has connected.\n"); threadClient = new Thread(new SerThread(socket, listOfClients)); threadClient.start(); } } catch (IOException e) { } } Thread program (MessageClient): public void run() { while (true) { for (Iterator&lt;Socket&gt; cl = listOfClients.iterator(); cl.hasNext();) { synchronized (listOfClients) { cur = cl.next(); if (!cur.equals(listOfClients.get(listOfClients.size() - 1))) { try { System.out.println("dddddddd"); ous = new PrintWriter(cur.getOutputStream()); ous.println("Client " + listOfClients.size() + " has connected."); ous.flush(); } catch (IOException e) { JOptionPane .showMessageDialog(null, "There was a problem getting your outputstream."); } try { System.out.println("ddd"); listOfClients.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } } }
tagged with: java
has answer: http://stackoverflow.com/a/27252149
downvote count: 1
type: Question
answer count: 2
tagged with: server
has title: ConcurrentModificationException while sending a message to all clients
has comment: http://stackoverflow.com/comment/42977401
score: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27324964
has comment: http://stackoverflow.com/comment/42977602
tagged with: concurrentmodification

http://stackoverflow.com/comment/42913738
score: 0
has text: Charizard. What happens when that is the input? :D and what line is `search.pokemon(main.java:105)`?
type: QuestionComment
comment on: http://stackoverflow.com/q/27216974
type: Comment

http://stackoverflow.com/comment/42870379
comment on: http://stackoverflow.com/q/27189062
score: 0
type: Comment
type: QuestionComment
has text: Tried already (but thanks), the exception is the same.

http://stackoverflow.com/q/27184097
score: 0
has comment: http://stackoverflow.com/comment/42936231
answer count: 1
has body: I am working on Restful service. The problem occurred after we moved to Glassfish 4.1 . The error string is : SEVERE: MessageBodyWriter not found for media type=application/xml, type=... But my classes consume application/json. Here is example: @Path("get_customer_info") @Consumes("application/json;charset=utf8") public class CustomerInfoResource { @Context private UriInfo context; public CustomerInfoResource () { } @POST public Player getPlayerInfo(){ .... } } I have done the following and could not solve it: Added all jersey jars version 2.13 , jackson jars 2.4.3 . Also added jersey-media-json-jackson-2.13.jar which contains org.glassfish.jersey.jackson.JacksonFeature class. By the way ApplicationConfig class is: @javax.ws.rs.ApplicationPath("resources") public class ApplicationConfig extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;Class&lt;?&gt;&gt;(); try { Class jsonProvider = Class.forName("org.glassfish.jersey.jackson.JacksonFeature"); resources.add(jsonProvider); } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, null, ex); } addRestResourceClasses(resources); return resources; }
has comment: http://stackoverflow.com/comment/42855910
tagged with: rest
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27601767
tagged with: http://stackoverflow.com/tag/json
tagged with: media-type
type: Question
has comment: http://stackoverflow.com/comment/42855543
has title: Restful MessageBodyWriter not found
tagged with: glassfish

http://stackoverflow.com/comment/42998745
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27262977
type: QuestionComment
has text: The code you posted never calls any of the methods in your Card class, but your output indicates you are doing just that. Have you still left out relevant code?

http://stackoverflow.com/comment/42819795
type: Comment
type: QuestionComment
has text: If all the fields are final and methods that mutate state return a new object, then that object is considered immutable, and is safe to use across multiple threads. Is immutability what you want? Thats another question. (continued in next comment)
score: 0
comment on: http://stackoverflow.com/q/27163080

http://stackoverflow.com/a/27183583
score: 0
type: Answer
has body: do it like this: &lt;td&gt;&lt;s:url action="delemp.action" var="urltag"&gt; &lt;s:param name="name"&gt; &lt;s:property value="id" /&gt; &lt;/s:param&gt; &lt;/s:url&gt; &lt;a href="&lt;s:property value="#urltag" /&gt;" &gt;delete&lt;/a&gt; &lt;/td&gt; i hope this is what you want.
answers question: http://stackoverflow.com/q/27163601

http://stackoverflow.com/comment/42933619
has text: I check it and i have new problem 12-01 14:03:27.942: E/AndroidRuntime(4430): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cultural/com.example.cultural.MainActivity}: android.view.InflateException: Binary XML file line #20: Error inflating class fragment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27216071
type: AnswerComment

http://stackoverflow.com/a/27263442
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43001335
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27263157
answers question: http://stackoverflow.com/q/27263157
has body: please put the line in your code. b1.setonclickListener(this); Without write this line how to call onclick listener method of button? I hope its useful to you. Edit: Add this line in after setContentView(). Button b1 =(Button) findViewById(android.R.id.button1);
has comment: http://stackoverflow.com/comment/43001187
has comment: http://stackoverflow.com/comment/42999846

http://stackoverflow.com/comment/42898791
type: Comment
comment on: http://stackoverflow.com/q/27208222
has text: Either the view `R.id.imagechild` doesn't exist or `BitmapFactory.decodeFile(imgFile.getAbsolutePath(),options)` isn't finding anything. Use print statements to figure out which.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/44319194
has text: That's ok, the accept is more important as it shows that the question has been answered. I've got enough reputation anyway.
comment on: http://stackoverflow.com/a/27202049
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27290972
type: AnsweredQuestion
upvote count: 0
has title: Roadmanager in osmdroid android
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/27316410
accepted answer: http://stackoverflow.com/a/27316410
answer count: 1
downvote count: 1
tagged with: osmdroid
favorite count: 0
has body: Hi I want to create offline map using osmdroid library. I want to add two point in map and showing road between it. For that I use this code RoadManager roadManager = new OSRMRoadManager(); ArrayList&lt;GeoPoint&gt; waypoints = new ArrayList&lt;GeoPoint&gt;(); myItemizedOverlay.addItem(MyItemizedOverlay.touchpoint, "touch", "touch"); waypoints.add(userlocation);//start point waypoints.add(MyItemizedOverlay.touchpoint);// end point Road road = roadManager.getRoad(waypoints); PathOverlay roadOverlay = RoadManager.buildRoadOverlay(road, getApplicationContext()); mapView.getOverlays().add(roadOverlay); mapView.invalidate(); but when I want to use it I'm getting this error message. RoadManager cannot be resolved I add osmdroid-android-4.2.jar and slf4j-android-1.5.8.jar And I see this link and I try to import it but I'm giving this error message build path contain duplicate entry src for project Thanks for any help.
tagged with: android

http://stackoverflow.com/q/27171638
has answer: http://stackoverflow.com/a/27171775
accepted answer: http://stackoverflow.com/a/27171775
type: AnsweredQuestion
tagged with: java
tagged with: stream
possible better answer: http://stackoverflow.com/a/27171801
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27171801
has title: Multiple quotes cause PipedOutputStream/OutputStreamWriter to fail
score: 0
linked to: http://stackoverflow.com/q/27170741
has body: I stumbled over a very strange behavior with the PipedOutputStream when I was trying to copy an OutputStream to an InputStream. See also How to write an nt:file programmatically Here is a small unit test method: @Test public void pipeTest() { PipedInputStream pin = null; try { pin = new PipedInputStream(); PipedOutputStream pout = new PipedOutputStream(pin); OutputStreamWriter writer = new OutputStreamWriter(pout); for (int i = 0; i &lt; 100; i++) { writer.write("\"Test\";" + i + "\n"); // writer.write("\"Test\";" + "\"" + i + "\"\n"); } writer.close(); pout.close(); System.out.print(IOUtils.toString(pin)); } catch (IOException e) { System.out.print(e); } finally { IOUtils.closeQuietly(pin); } } This works well and prints out 100 rows. If you uncomment the second write statement and comment out the first, writer.close() gets stuck and never finishes. It seems to have problem with the second set of quotes \". Has anyone and idea why this is the case and how to circumvent it?

http://stackoverflow.com/q/27289622
type: Question
score: 0
answer count: 1
has body: I am new to android programming and therefore this might seem like an easy question for many but its been 2 days and i have searched almost everywhere on the internet but cant find a solution to my problem i am trying to stream a link(which works when i post on chrome) using MediaPlayer class. Although i get audio on chrome, i never get anything when i run the app on my Samsung galaxy s4.i have already used internet permission for the app. here is the code i am using: public class LiveKirtan extends Activity { MediaPlayer mp; String url; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_live_kirtan); url = "http://radio2.sikhnet.com:8020/live"; Uri myUri = Uri.parse(url); mp = new MediaPlayer(); try { mp.setDataSource(this, myUri); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.prepareAsync(); mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer player) { player.start(); } }); } }
has answer: http://stackoverflow.com/a/27289846
favorite count: 0
tagged with: android
has title: stream a live audio stream for android
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: audio
tagged with: java

http://stackoverflow.com/comment/43036737
has text: Sorry about that I didn't realise I had reposted. I accidentally pressed enter rather than shift+enter when trying to respond in a comment. May have been because I had the page open in multiple tabs. @EJP
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27282997

http://stackoverflow.com/q/27164933
downvote count: 1
type: Question
tagged with: object
tagged with: arrays
has title: Object[] inside Object[] Java returns memory address?
has answer: http://stackoverflow.com/a/27164960
has comment: http://stackoverflow.com/comment/42822187
score: 0
has comment: http://stackoverflow.com/comment/42822190
favorite count: 0
has answer: http://stackoverflow.com/a/27165207
accepted answer: http://stackoverflow.com/a/27164960
possible better answer: http://stackoverflow.com/a/27164964
has answer: http://stackoverflow.com/a/27164964
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27165017
tagged with: java
has body: Trying to access any Object[] inside the initial Object[] returns the memory address i.e. System.out.println(Object[1]);. How do I get it to return its contents instead?
upvote count: 1

http://stackoverflow.com/a/35832997
downvote count: 0
has body: Zack Newsham's suggestion helped me. Here is what I did: Deleted .iml file File > New > Project, specified the existing folder with code completed project setup (Manifest, artifacts). Now the project runs. Of course there may be other reasons for ClassNotFound. However when everything seems ok or if the error comes up after it worked before, try these simple steps.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/70738856
answers question: http://stackoverflow.com/q/27220475

http://stackoverflow.com/comment/42994531
comment on: http://stackoverflow.com/q/27241517
score: 0
has text: 1) Why code an applet? If it is due to the teacher specifying it, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why use AWT? See [this answer](http://stackoverflow.com/questions/6255106/java-gui-listeners-without-awt/6255978#6255978) for many good reasons to abandon AWT using components in favor of Swing.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27286937
has body: I have 3 activities we will call them A, B and C. A and B both have intents that send the view to C. And design on which one C came from different things happen on C's activity. I pass the data like this from A to C: Intent intent = new Intent(this, C.class); intent.putExtra("Action", "A"); startActivity(intent); Then in C's onCreate method I have something like this: Bundle extras = getIntent().getExtras(); if (extras.getString("Action").equals("A")) { //DO SOMETHING } Then I from B to C I have Intent intent = new Intent(this, C.class); startActivity(intent); And then I get the NullPointerException, I am guessing this is because i have not specifed a String "Action" when going from B to C. Now I could just add one line for B in this case but, if there were for more activities or a large project this would not be good, because for each activity going to one I would need this. How can I have it so I don't get this exception without adding an "Action" sting to activity B? Thanks for the help in advance. EDIT If I have this from A to C Intent intent = new Intent(this, C.class); intent.putExtra("Action", "A"); intent.putExtra("Action2", "A"); startActivity(intent); And this from B to C Intent intent = new Intent(this, C.class); intent.putExtra("Action", "B"); startActivity(intent); And then this in onCreate of C it fails when going from B to C: Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.getString("Action").equals("A")) { //DO SOMETHING } else if (extras.getString("Action2").equals("A")) { //DO Stuuf } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27286974
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43041047
has title: Android - Pass Data Between Two Activities get NullPointerException
type: Question
has answer: http://stackoverflow.com/a/27287099
possible better answer: http://stackoverflow.com/a/27287019
has answer: http://stackoverflow.com/a/27287125
has answer: http://stackoverflow.com/a/27287019
accepted answer: http://stackoverflow.com/a/27286974
tagged with: nullpointerexception
answer count: 7
tagged with: android-activity
has answer: http://stackoverflow.com/a/27287121
has answer: http://stackoverflow.com/a/27287060
tagged with: android
has answer: http://stackoverflow.com/a/27287075
tagged with: android-intent

http://stackoverflow.com/q/27153808
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27161093
type: Question
tagged with: javascript
tagged with: ajax
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27154195
linked to: http://stackoverflow.com/q/14570831
linked to: http://stackoverflow.com/q/4121629
has body: I am posting client side data to server in the following format. $.ajax({ type: 'post', url: 'rest/server', data: JSON.stringify(frmData), contentType: "application/json; charset=utf-8", success: function (data) { ... } }); How and what are the best options to either encrypt/decrypt or generate key value pair when send to server(java) in order to avoid posting data which is not supposed to be sent? E.g. if form element contains values pertains to user, that user could send other values to server to post. HTTPS/SSL is not an option for me for the time being.
has comment: http://stackoverflow.com/comment/42802048
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/27160812
has title: JSON data Encrypt/Decrypt or Key Value Pair

http://stackoverflow.com/a/27184617
answers question: http://stackoverflow.com/q/27183635
score: 2
upvote count: 2
downvote count: 0
has body: Seems your application have no entry point that's why you got nothing. Just create entry point into your application. @Configuration @ComponentScan @EnableAutoConfiguration public class Application extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(applicationClass, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(applicationClass); } private static Class&lt;Application&gt; applicationClass = Application.class; } See also Spring Boot deploying guide
type: Answer

http://stackoverflow.com/q/27261906
score: 0
has body: I am trying to create a linked list (not using Java's default, rather my own defined). The linked list should be capable enough to add data in some order. Like user try to insert 1, 3 and 2 in given order. The "2" should insert before 3 and resultant linked list should have 1, 2 and 3. Above all, everything should be done using generics(as i want to learn it). Created following classes for custom linked list, just need help to provide insertion in sorted order. package customlinkedlist; public class Node&lt;T&gt; { private T data; private Node&lt;T&gt; next; public T getData() { return data; } public void setData(T data) { this.data = data; } public Node&lt;T&gt; getNext() { return next; } public void setNext(Node&lt;T&gt; next) { this.next = next; } } Then interface- package customlinkedlist; public interface CustomLinkedList&lt;T&gt; { Node&lt;T&gt; insert(T data); } And respective implementation- package customlinkedlist; public class CustomLinkedListimpl&lt;T&gt; implements CustomLinkedList&lt;T&gt; { private Node&lt;T&gt; head; public CustomLinkedListimpl() { head = new Node&lt;T&gt;(); head.setNext(null); head.setData(null); } public Node&lt;T&gt; insert(T data) { Node&lt;T&gt; nodeToInsert = null; if (head.getNext() == null) { nodeToInsert = new Node&lt;T&gt;(); nodeToInsert.setData(data); nodeToInsert.setNext(null); head.setNext(nodeToInsert); } else { Node&lt;T&gt; tempNode = head; while(tempNode.getNext() != null) { tempNode = tempNode.getNext(); } nodeToInsert = new Node&lt;T&gt;(); nodeToInsert.setData(data); nodeToInsert.setNext(null); tempNode.setNext(nodeToInsert); } return nodeToInsert; } public void printList() { if (head == null) { System.out.println("List is null."); return; } Node&lt;T&gt; tempNode = head.getNext(); System.out.print(tempNode.getData()); while (tempNode.getNext() != null) { tempNode = tempNode.getNext(); System.out.print(" --&gt; " + tempNode.getData()); } } } And this is client class- package customlinkedlist; public class Custom…
has answer: http://stackoverflow.com/a/27262211
answer count: 1
has comment: http://stackoverflow.com/comment/42996729
has comment: http://stackoverflow.com/comment/42996613
has comment: http://stackoverflow.com/comment/42996599
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42996795
tagged with: linked-list
accepted answer: http://stackoverflow.com/a/27262211
tagged with: java
has title: Custom LinkedList with Sorting
type: Question
has comment: http://stackoverflow.com/comment/42996640
linked to: http://stackoverflow.com/q/19802104
tagged with: data-structures

http://stackoverflow.com/q/27172472
tagged with: android
score: 2
upvote count: 2
tagged with: java
type: Question
tagged with: android-mediaplayer
has body: i want to make kind of karaoke app, to do so i need to make ui changes at a particular moment (millisecond timing) MediaPlayer.getDuration is not the same depending on the device. MediaPlayer.getCurrentPosition gives me millisecond but there is not precision (it will jump 200 millisecond one time 400 another and so on...) so guys, how can i get the accuracy i want ? is there any audio player or audio player i can use in java ? Thanks.
has title: Android Media Player accuracy
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27245498
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43001338
comment on: http://stackoverflow.com/q/27264709
has text: Should the bookId for book2 be different than bookId for book1? In the above code, both seem to have the same id as 600 ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27278554
downvote count: 0
has body: You're using jTDS as a driver implementation, but a SQL Server JDBC driver URL: jdbc:sqlserver://localhost:1433;databaseName=x The jTDS connection URL format is slightly different. Essentially, you're missing the jtds: prefix, and the database name is prefixed by a /: jdbc:jtds:sqlserver://localhost:1433/x More information can be seen here: http://jtds.sourceforge.net/faq.html#urlFormat Help me create a jTDS connection string
accepted answer of: http://stackoverflow.com/q/27269839
answers question: http://stackoverflow.com/q/27269839
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/q/27254329
has body: So, I needed to test a feature in my application which requires me to have two clients open, both of which are connected via localhost. I'm sending all data through the channel, and it seems that the channels are different. Client One: [id: 0xd7f05dd1, /127.0.0.1:56571 =&gt; /127.0.0.1:5055] Client Two: [id: 0xeb0a36e7, /127.0.0.1:56606 =&gt; /127.0.0.1:5055] However, when sending information over the network, and having multiple clients open, the clients compete for the data, here's an example: Server sending info: [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote ID: 97271 [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote X: 6.54161 [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote Y: -8.271806 [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote Z: 1.8378098 [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote ROT: 0.0 [DEBUG::Packet_02_RegisterRemotePlayer]: Wrote PRIV: 0 [DEBUG::PacketBuffer]: Packet with an id of 2 was constructed. [DEBUG::PacketBuffer]: The packet was 28 bytes long. [DEBUG::PacketBuffer]: The packet type was TCP All of this data is written to a ByteBuf, then sent over the network as a byte[] This packet was only sent to Client B, containing information about Client A, however Client A and Client B both attack the network to retrieve this data. All data that was sent above is supposed to be read (in exact order) by client b, however here's the result. Client One Read: [2]Read ID: -1056679599 [2]Read X: 1.8378098 [2]Read Y: 0.0 [2]Read Z: 0.0 Client Two Read: [2]Read ID: 1087460574 [2]Read X: -8.271806 [2]Read Y: 1.8378098 [2]Read Z: 0.0 [2]Read ROT: 0.0 As you can see, the client isn't even completing it's read in either scenario, because the stream is starved, due to both clients attempting to read from it. When sending data: getChannel().writeAndFlush(buffer.retain()); Where all this data is stored in a ByteBuf(Netty 4) AKA ChannelBuffer(Netty 3) Debugging shows that we're only sending to Client Two, but both clients still try to read it, how can i prevent this?
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/42997818
has comment: http://stackoverflow.com/comment/42998184
has comment: http://stackoverflow.com/comment/42997404
score: 0
has title: Netty - Clients competing for data?
has comment: http://stackoverflow.com/comment/42997412
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42997842
tagged with: netty
has comment: http://stackoverflow.com/comment/42998134
has comment: http://stackoverflow.com/comment/42997857
tagged with: java

http://stackoverflow.com/q/27156421
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42807006
has answer: http://stackoverflow.com/a/34241265
has body: I'm trying to add a fragment to my main activity. When I type fragment = new CrimeFragment(); I get an Incompatible types error. I tried casting new CrimeFragment(); to a Fragment, but that didn't work. package com.adamanteusstudios.officesmostwanted; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; public class MostWantedActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_most_wanted); //getting fragmentManager FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragmentContainer); if(fragment == null){ ***fragment = new OffenseFragment();*** fm.beginTransaction().add(R.id.fragmentContainer, fragment).commit(); } } } The error says: incompatible types required: android.v4.support.app.Fragment found: com.adamanteusstudios.officesmostwanted.OffenseFragment How do I fix this error?
has title: Incompatible types error with Fragments
score: 3
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/42855345
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/42855163

http://stackoverflow.com/comment/42968892
comment on: http://stackoverflow.com/a/27246062
type: Comment
has text: i would like to use take() because of its blocking functions. So if my producer thread is not done yet, my worker thread will be block till an element comes in(which is inserted by my producer) this is exactly what i wanted. However this also resulted in one of the thread in a forever blocking process. i have updated my new code
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43032974
comment on: http://stackoverflow.com/a/27279701
has text: @Holger: Memory-chain ordering doesn't transitively close over all other happens-before relationships, but the memory-chain imposes a partial ordering (which is by definition transitive at least with regard to itself). If array elements are written before a reference is stored to a `final` field, and another thread copies that field to a non-final field, the rules given would require that the element writes would happen before any element reads by any thread using the copied reference. The only aspect I can't quite figure out is whether the thread-safety guarantees are weaker when X==1.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42881629
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27198571
has text: @user384842 `BigDecimal` stores the two operands (the magnitude and the scale) separately. These two values together represent the actual value of `BigDecimal`. This representation lets `BigDecimal` avoid storing lots and lots of leading and/or trailing zeros for numbers that are really big or the numbers that are really small.

http://stackoverflow.com/a/27236025
has body: Why are you creating your custom View outside of the aptly named onCreateView? Perhaps give this a try: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d("onCreateView: ","This ran successfully"); View v = inflater.inflate(R.layout.fragment_drawing, container, false); drawView = new DrawView(v.getContext()); //and then add drawView wherever you want it within fragment_drawing //((ViewGroup)v).addView(drawView); *change this to where you want the view and with the appropriate casting and layout parameters* return v; }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42948646
type: Answer
answers question: http://stackoverflow.com/q/27235111
upvote count: 2

http://stackoverflow.com/comment/43013963
type: Comment
has text: Could you explain why it is better to use an ArrayList over an array?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27271862

http://stackoverflow.com/q/27286621
answer count: 3
tagged with: jsp
has answer: http://stackoverflow.com/a/27286809
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27286740
tagged with: java
has answer: http://stackoverflow.com/a/27287020
type: Question
has title: HTTP Status 404. The Requested Source Not Available
has body: I'm still new with java and spring, currently I'm trying to map "/buku/" to my home.jsp, but it's doesnt seems to work. HomeController.java package com.web.buku; import java.security.Principal; import org.apache.log4j.Logger; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.ui.ModelMap; @Controller public class HomeController { private static Logger logger =Logger.getLogger(HomeController.class); @RequestMapping("/") public String home(ModelMap model){ model.addAttribute("message", "Hello Spring MVC Framework!"); return "home"; } } home.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here ${message} yosh web.xml <?xml version="1.0" encoding="UTF-8"?> buku Database of Buku book org.springframework.web.servlet.DispatcherServlet 1 book / org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/book-servlet.xml encoding-filter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encoding-filter /* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* 120 book-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" 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 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.web.buku" /> <property name="prefix" value=…
score: 0

http://stackoverflow.com/q/27213794
has body: I'd like to separate some polymorphism example from the book into several files, but got an error with main class PoliWithClasses while creating objects emp1 and emp2 of classes Programmer and Manager. Please let me know what is wrong to make run the following code File Employee.java package po; abstract class Employee { public void reachOffice() { System.out.println("reached Office - India"); } public abstract void startProject(); } File Programmer.java package po; class Programmer extends Employee { public void startProject(){ defineClasses(); unitTestCode(); } private void defineClasses() {System.out.println("define classes");} private void unitTestCode() {System.out.println("unit Test Code");} } File Manager.java package po; class Manager extends Employee { public void startProject() { meetingWithCustomer(); defineProjectSchedule(); assignRespToTeam(); }; private void meetingWithCustomer() {System.out.println("meet Customer");} private void defineProjectSchedule() {System.out.println("define Project Schedule");} private void assignRespToTeam() {System.out.println("assign Resp To Team");} } File PoliWithClasses.java package po; public class PoliWithClasses { public static void main(String arg[]) { } Employee emp1=new Programmer(); Employee emp2=new Manager(); emp1.reachOffice(); emp2.reachOffice(); emp1.startProjectWork(); emp2.startProjectWork(); } Thanks, I have corrected the typo but still looks like these objects are not visible in main class: emp1.reachOffice(); emp2.reachOffice(); emp1.startProject(); emp2.startProject();
has comment: http://stackoverflow.com/comment/42908051
has comment: http://stackoverflow.com/comment/42908057
tagged with: java
has answer: http://stackoverflow.com/a/27213830
has comment: http://stackoverflow.com/comment/42907882
type: Question
has comment: http://stackoverflow.com/comment/42907868
score: 0
has answer: http://stackoverflow.com/a/27255893
answer count: 2
has comment: http://stackoverflow.com/comment/42909218
tagged with: polymorphism
type: UnansweredQuestion
has title: java polymorphism code. level newbie

http://stackoverflow.com/comment/42914873
type: Comment
type: QuestionComment
has text: In the 'Package Explorer' (typically on your left) select the top of the hierarchy, right click for context menu, select 'Properties'. Explore. Run configurations are available through 'Run' menu.
score: 0
comment on: http://stackoverflow.com/q/27216958

http://stackoverflow.com/a/67980378
answers question: http://stackoverflow.com/q/27222159
has body: You have @RequestMapping("/error") annotation on your controller and second @RequestMapping("/error") on your method. This results in /error/error mapping, not the /error mapping as you specified in getErrorPath() method and maybe in your configuration (application.properties, server.path.error).
score: 0
type: Answer

opencsv
tags question: http://stackoverflow.com/q/27179037
type: Tag
tags question: http://stackoverflow.com/q/27159851
tag name: opencsv

http://stackoverflow.com/a/27267162
score: 1
has body: An alternative to Khalid's answer (which I think requires some additional dependencies and configuration) is to implement the InitializingBean interface: @Service public class MyPortRegistrar implements InitializingBean { @Autowired private SpringBus bus; @Autowired private ConfigurableBeanFactory beanFactory; @Override public void afterPropertiesSet() throws Exception System.out.println(bus); //prints null //create and configure port with the SpringBus Port port = new WebservicePort(bus); // -&gt; throws NullPointerException beanFactory.autowireBean(port); beanFactory.initializeBean(port, "myDynamicPortName"); } }
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43005442
answers question: http://stackoverflow.com/q/27266608
downvote count: 0

http://stackoverflow.com/comment/42839828
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27174827
has text: @Maduri you create a class, let's say `Yourclass`, then a `List<YourClass> yourClassList` and read the data from the `ResultSet` to fill `yourClassList` list, as last step you pass `yourClassList` as parameter to your methods. The code is described in [dasblinkenlight's answer](http://stackoverflow.com/a/27174828/1065197), before the *Alternatively* paragraph.

http://stackoverflow.com/comment/43046689
type: QuestionComment
has text: Well, I think the problem you'll face is the android camera callback gives you the frames after they've been sent to the view. Or are you saying you're actually recording it to file first?
comment on: http://stackoverflow.com/q/27290285
score: 0
type: Comment

http://stackoverflow.com/comment/42861333
has text: Maybe you want a text box? If you can work out what you want in Word/OpenXML, then docx4j code can follow.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27168565

http://stackoverflow.com/comment/42989616
score: 0
type: Comment
has text: Unless you plan to use more than one of the P1 class, you shouldn't need an ArrayList. If the GUI class must be declared before the P1 class, you can add an action listener to the button as part of the setter. In the setter, you'd have `this.p1 = p1;`, then `buttonName.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { p1.use(); } } );`
comment on: http://stackoverflow.com/a/27256546
type: AnswerComment

http://stackoverflow.com/comment/43057738
type: QuestionComment
score: 1
has text: is attachment always photos?
comment on: http://stackoverflow.com/q/27296050
type: Comment

http://stackoverflow.com/q/27157742
has comment: http://stackoverflow.com/comment/42861855
tagged with: arrays
has answer: http://stackoverflow.com/a/27166017
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43034323
has answer: http://stackoverflow.com/a/27157961
possible better answer: http://stackoverflow.com/a/27158009
has answer: http://stackoverflow.com/a/27158009
accepted answer: http://stackoverflow.com/a/27166017
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/42809820
has body: Here is the assignment word for word: In a diving competition, each contestant's score is calculated by dropping the lowest and highest scores and then adding the remaining scores. Write a program that reads the provided data file formatted as depicted in the following table. For each diver output the diver's name and total score using the above scoring rules. Format each diver's total score to two decimal places. So for example, the output for Chen Ruolin below would be: Chen Ruolin – 56.90 points. Your program must read the data in from the provided data file and use arrays to store that data. Once all the data has been read in the program needs to calculate each diver's total points and output that diver's name and total points. Where total points is calculated based on the scoring rule defined above. So far, I have a program that reads the .txt file and outputs the diver's name and the list of scores. For the life of me I can't figure out how to print just the total score (of course sans the highest and lowest scores). Any help would be greatly appreciated, this assignment is giving me a headache! import java.util.Vector; public class Diver { private String firstName; private String lastName; private Vector scores; public Diver() { firstName = ""; lastName = ""; scores = new Vector(); } public Diver(String firstName, String lastName, double... scores) { this.firstName = firstName; this.lastName = lastName; this.scores = new Vector(); for (double score : scores) { this.scores.add( score ); } } 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; } public String toString() { return firstName + " " + lastName + scores.toString(); } } The TestDiver program: import java.io.*; import java.util.*; class TestDiver { public static void main(String[] args) { try { Scanner scanner = ne…
type: AnsweredQuestion
has title: For loop trouble in Diving Competition Java Program
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6038143
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42809582

http://stackoverflow.com/comment/42954169
comment on: http://stackoverflow.com/a/27238544
type: AnswerComment
has text: try project -> Clear -> Buil!
type: Comment
score: 1

http://stackoverflow.com/comment/43012640
comment on: http://stackoverflow.com/q/27270993
score: 0
type: Comment
type: QuestionComment
has text: @linabell Thanks for quick response, but this is pretty much what I've done in the jar. My question is really about getting it to work with Unity. As I wrote, I know how to do it inside a pure Android app.

http://stackoverflow.com/comment/42870860
type: Comment
type: QuestionComment
has text: You will always *have* to keep a copy of at least a pointer to the value for each key. So I'd say a hash map is the perfect choice here.
score: 6
comment on: http://stackoverflow.com/q/27192608

http://stackoverflow.com/comment/42898761
type: AnswerComment
has text: That is not the only problem. This does not address the question
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27208426

http://stackoverflow.com/a/35994135
has body: Spring Boot does a lot of auto-configuration that may not be needed. So you may want to narrow down only auto-configuration that is needed for your app. To see full list of auto-configuration included, just run logging of org.springframework.boot.autoconfigure in DEBUG mode (logging.level.org.springframework.boot.autoconfigure=DEBUG in application.properties). Another option is to run spring boot application with --debug option: java -jar myproject-0.0.1-SNAPSHOT.jar --debug There would be something like this in output: ========================= AUTO-CONFIGURATION REPORT ========================= Inspect this list and include only autoconfigurations you need: @Configuration @Import({ DispatcherServletAutoConfiguration.class, EmbeddedServletContainerAutoConfiguration.class, ErrorMvcAutoConfiguration.class, HttpEncodingAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, ThymeleafAutoConfiguration.class, WebMvcAutoConfiguration.class, WebSocketAutoConfiguration.class, }) public class SampleWebUiApplication { Code was copied from this blog post.
score: 82
upvote count: 84
has comment: http://stackoverflow.com/comment/105977135
has comment: http://stackoverflow.com/comment/124538326
answers question: http://stackoverflow.com/q/27230702
type: Answer
has comment: http://stackoverflow.com/comment/124556140
downvote count: 2
has comment: http://stackoverflow.com/comment/76975818
has comment: http://stackoverflow.com/comment/96809436

http://stackoverflow.com/comment/43034964
score: 0
type: Comment
type: QuestionComment
has text: Just tried it, sorry didn't work?, still outputs with that space
comment on: http://stackoverflow.com/q/27283084

http://stackoverflow.com/q/27263015
upvote count: 1
tagged with: libraries
has answer: http://stackoverflow.com/a/29390577
type: Question
has comment: http://stackoverflow.com/comment/43038294
has answer: http://stackoverflow.com/a/27266418
tagged with: eclipse
downvote count: 0
has comment: http://stackoverflow.com/comment/42999368
favorite count: 0
has answer: http://stackoverflow.com/a/27287345
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27742405
tagged with: android
has body: I'm trying to find and import the library of makeramen because i can't copile my project and receive these errors: ERROR MESSAGE: Multiple annotations found at this line: - error: No resource identifier found for attribute 'border_color' in package 'myapp' - error: No resource identifier found for attribute 'mutate_background' in package 'myapp' - error: No resource identifier found for attribute 'border_width' in package 'myapp' - error: No resource identifier found for attribute 'oval' in package 'myapp' My xml: &lt;com.makeramen.RoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/mapImage" android:layout_width="100dp" android:layout_height="100dp" android:background="@drawable/list_map_bar" android:padding="12dp" android:scaleType="fitCenter" android:src="@drawable/list_world" app:border_color="@color/xroads_grey" app:border_width="2dp" app:mutate_background="true" app:oval="true" /&gt; I dont know how to resolve this issue and run &amp; copile the android project. Any one can help me, please? Thanks so much! Update 2 I received an Android project that was imported to the ADT - Eclipse. There are missing some libraries and please check the complete structure project image below: Android Project (sorry i can upload image because stackoverflow don't let me upload any image): LoginActivity -Android 4.3 -Referenced Libraries -rundedimageview-1.5.0-sources.jar -src -gen [Generated Java Files] -assets -bin -libs -res -AndroidManifest.xml -ic_launcher-we.png -lint.xml -project.properties Under the folder /res/layout there are some error message on the files that I mention before on this topic for missing the libraries and dependecies. So I had added the RoundedImageView JAR to the project but nothing change. any ideas? let me know if someone needs more information about any file o error message. It is missing the build.gradle file, is it normal or how i can create? UPDATE 3: I changed the code as Nadeem Iqbal recommended but the error s…
answer count: 4
score: 1
tagged with: java
has title: How can I import a library in ADT Project for Eclipse

retrofit
tags question: http://stackoverflow.com/q/27213291
type: Tag
tags question: http://stackoverflow.com/q/27277172
tag name: retrofit
tags question: http://stackoverflow.com/q/27212598

http://stackoverflow.com/comment/81477928
type: AnswerComment
comment on: http://stackoverflow.com/a/27544586
has text: sorry, i no longer have access to that code, since i changed my employee
score: 0
type: Comment

http://stackoverflow.com/comment/43067420
score: 0
has text: @BillFromHawaii - If I understood that syntax, I'd be a lot closer to solving my problem. :) It's used elsewhere in other Spring files, and evidently without problem, but I don't understand it, and couldn't find it documented.
comment on: http://stackoverflow.com/q/27284247
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43038337
has text: I don't think it has anything to do with tomcat. They are 2 different container jar and it depends which one you are using. I am using glassfish.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27285263

http://stackoverflow.com/q/27241384
upvote count: 0
tagged with: max
favorite count: 0
has answer: http://stackoverflow.com/a/27241410
has answer: http://stackoverflow.com/a/27241522
has title: For Loop, Int Max
type: UnansweredQuestion
has body: I am a beginner in Java, can somebody please explain me what this code means and how it comes to the answer of 15. I understand for loop but not what it is doing with int max. int count; int max = 3; for (count = 1; count &lt; 7; count++) { max = max + 2; } System.out.println(max);
tagged with: count
downvote count: 1
has comment: http://stackoverflow.com/comment/42959200
tagged with: java
score: -1
type: Question
tagged with: for-loop
answer count: 3
has answer: http://stackoverflow.com/a/27241423

http://stackoverflow.com/a/58981202
upvote count: 2
answers question: http://stackoverflow.com/q/27223917
score: 2
downvote count: 0
type: Answer
has body: Going into Settings->Build->Compiler->Annotation Processors and disabling it solved it. Allowing Test-A to depend on B, even though B depends on A I'm using IntelliJ2019.1 But it's sad it doesn't seem to consider the maven test scope

http://stackoverflow.com/a/27309682
has body: Refer below the class diagram for Proxy design pattern from : http://www.codeproject.com/Articles/186001/Proxy-Design-Pattern In your question you have a Payment interface which is the "Subject". Then you have the PaymentImpl which implements Payment interface and this is the "Real Subject". However you are missing the "Proxy" here. You need to write a PaymentProxy class which will also implement Payment interface. This class will have a reference to an object of type "Real Subject" (PaymentImpl) as a private field and will call the methods inherited from the "Subject" via this "Real Subject" object. Example : public class PaymentProxy implements Payment{ private PaymentImpl realPayment; public PaymentProxy(){ } public void purchase(PaymentVO payInfo, BigDecimal price) throws PaymentException{ if(realPayment==null){ realPayment = new PaymentImpl(); } realPayment.purchase(payInfo, price); } } You may notice that the realPayment is created on demand when using the Proxy Design pattern. This is useful when object creation is expensive. Following is the code for the main class : public class Client{ public static void main(String[] args){ PaymentProxy paymentProxy = new PaymentProxy(); //note that the real proxy object is not yet created //... code for resolving payInfo and price as per the requirement paymentProxy.purchase(payInfo, price); //this is where the real payment object of type PaymentImpl is created and invoked } }
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/43083237
has comment: http://stackoverflow.com/comment/43081081
has comment: http://stackoverflow.com/comment/43081188
accepted answer of: http://stackoverflow.com/q/27309473
answers question: http://stackoverflow.com/q/27309473
type: AcceptedAnswer

http://stackoverflow.com/a/27306140
has body: You have two options. 1. Use the Maven query tool to find the Group/Artifact/Version you're looking for and add it directly to your pom.xml file. The preferred way of getting your dependencies onto the classpath of your Maven project would be to add the maven artifact corresponding to your import to your project's pom.xml file. In NetBeans, you can do this easily by right-clicking the Dependencies folder of your Maven project in the Projects view and choosing "Add Dependency". This will bring up a query tool that will allow you to search your maven repositories (configured in the settings.xml of your .m2 folder) for org.cloudme.puppet or any other package/class name you require. If NetBeans can't find the correct GroupID/Artifact ID/Version for the packages/classes you're looking for, you can visit search.maven.org and perform a similar query against an internet-visible maven repository. I've found about 90% of everything I've ever needed there - it's a great resource. 2. Manually create a subfolder in your project for your jars, then add them to your pom.xml file as "system" dependencies. This answer will make Maven purists really upset ... but sometimes the class you're trying to import simply doesn't exist as a maven project, and you have to use a raw Jar file because you don't have source code. If this is the case, you'll want to add it to your project in its own "lib" folder (or whatever you choose to call it), then add it to your pom.xml dependency list as a system dependency. For more info on configuring system dependencies in Maven, look here: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies
type: Answer
answers question: http://stackoverflow.com/q/27304902
downvote count: 0
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/44103730

http://stackoverflow.com/comment/43012523
comment on: http://stackoverflow.com/a/27270400
type: AnswerComment
has text: What is the location?
score: 0
type: Comment

http://stackoverflow.com/a/27292265
has body: Look at Path.relativize, resolve, resolveSibling and normalize. Path is the "successor" of File, for dealing with different "file systems" like a zip folder. You can use File.toPath()` Paths.get("...") creates a Path, and Files provides functions for doing things like copying. Something like: Path htmlPath = Paths.get("C:/test/index.html"); Path path = htmlPath.resolveSibling("../img/favicon.ico");
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27291999
type: Answer
accepted answer of: http://stackoverflow.com/q/27291999

http://stackoverflow.com/q/27283591
type: Question
has comment: http://stackoverflow.com/comment/43035564
tagged with: java
has answer: http://stackoverflow.com/a/27283949
has title: problems with returning a value java
has answer: http://stackoverflow.com/a/27283867
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27283949
accepted answer: http://stackoverflow.com/a/27283867
type: AnsweredQuestion
tagged with: return
has body: I have this method that contains a MouseEvent. How do I return the idu variable? it is like a method in a method or how to call it and I can't figure out how top return the idu variable. public int getId() { int idu; table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { JTable target = (JTable)e.getSource(); int row = target.getSelectedRow(); Object record = data[row][0]; idu = (Integer) record; } } }); return idu; }
tagged with: mouselistener

http://stackoverflow.com/comment/42996472
has text: To debug your code write following line just before execution and check the output : `System.out.println("INSERT INTO Patient (ForeName, SurName, DateOfBirth, PhoneNumber, HouseNumber, PostCode) VALUES (" + forename.getText() + ", " + surname.getText() + ", " + age.getText() + ", " + contactNo.getText() + ", " + houseNo.getText() + ", " + postcode.getText() + ")")`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27261286

http://stackoverflow.com/a/27159305
downvote count: 0
answers question: http://stackoverflow.com/q/27159005
score: 3
type: Answer
upvote count: 3
has body: You can use the -verbose option of the java command and search for the fully qualified name of a specific class. $ java -verbose -jar MyProgram.jar | grep "java.lang.String" [Loaded java.lang.String from /Library/Java/…/Contents/Home/jre/lib/rt.jar] [Loaded java.lang.StringBuffer from /Library/Java/…/Contents/Home/jre/lib/rt.jar] … Addendum: I want to check the class availability for an environment. If you are running from the java command line, either the paths specified in the -classpath option or the CLASSPATH environment variable will be searched. If you are running from a JAR, the manifest's Class-Path attribute, for example, supplants these settings. If you are trying to find a required JAR that may not be accessible in these ways, you'll have to search the file system. I use a combination of find, jar and grep, typically focussing on paths defined in system properties such as java.endorsed.dirs and java.ext.dirs; several related approaches are shown here.

http://stackoverflow.com/q/27289210
has comment: http://stackoverflow.com/comment/43044877
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27289275
has answer: http://stackoverflow.com/a/27289529
score: 1
upvote count: 1
has title: Android - Set background color on user choice
type: Question
tagged with: if-statement
has body: Lets say I have 4 options for a user, North, South, East and West (N,S,E,W). And depending on what option the user choses I want each direction to be linked with a color, and when a user picks a direction that they have to do I save that to my backend Parse.com and then set the background color of the entire app to the that is linked to the chosen direction. Currently I am going about it like this: if (currentUser.getString("direction").equals("north")) { //set background color to red } else if (currentUser.getString("direction").equals("west")) { //set background color to blue } else if (currentUser.getString("direction").equals("east")) { //set background color to black= } else if (currentUser.getString("direction").equals("south")) { //set background color to green } Which isn't too bad when there are just four options but I have just simplified this for this example if there are 100 options this is no longer a good option. What would be another more efficient way of doing this? The user doesn't pick a color, I want to link the direction to a color thats what I am trying to get at? Thanks for the help in advance. I am getting this compile error with the enum Direction:
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/43044762
downvote count: 0

http://stackoverflow.com/q/27212134
answer count: 3
upvote count: 1
tagged with: web
has answer: http://stackoverflow.com/a/27212173
favorite count: 0
tagged with: sms
type: UnansweredQuestion
has title: SMS from Java web application
linked to: http://stackoverflow.com/q/10604001
has body: I have SMS server, and I want to send and receive SMS from My java web application. How I do this? Thanks,
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42905115
has answer: http://stackoverflow.com/a/27242996
has answer: http://stackoverflow.com/a/65896406
linked to: http://stackoverflow.com/q/1485708

http://stackoverflow.com/q/27269359
tagged with: http://stackoverflow.com/tag/html
tagged with: jsp-fragments
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I have a technical problem and I am not sure about the correct way to solve: In a web page I am developing, I have to store the current user name from session (the person who is logged in) to "stamp" an action. (For instance, "The user created this file on "). My algorithm retrieves the user name from session but it obviously changes for each user. Therefore, the is always been the one of the user logged in, and not the creator name. Any hint anyone? Thanks!
has title: Strategy when retrieving user name from session
score: 0
has answer: http://stackoverflow.com/a/27269916
accepted answer: http://stackoverflow.com/a/27269916
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/27174232
type: Question
has answer: http://stackoverflow.com/a/27174603
has body: I have to put a date one week before and then 1 month before. If i try with the days one week before is working but if the day es 5 and it has to change the month is not working, it changes me the year instead. About the month it changes me the year tring addUrl = ""; SimpleDateFormat sdf = new SimpleDateFormat("dd.mm.yyyy"); // surround below line with try catch block as below code throws checked // exception Date endDate = sdf.parse(request.getParameter(field.getId())); Calendar cal = DateToCalendar(endDate); cal.setTime(endDate); SimpleDateFormat formatToSend = new SimpleDateFormat("yyy-mm-dd"); case "day": cal.add(Calendar.DATE, -1); addUrl = "startDate=" + formatToSend.format(cal.getTime()) + "&amp;endDate=" + endDateString; break; case "week": cal.add(Calendar.DATE, -6); // number of days to add addUrl = "startDate=" + formatToSend.format(cal.getTime()) + "&amp;endDate=" + endDateString; break; default: cal.add(Calendar.MONTH, -1); // number of days to add addUrl = "startDate=" + formatToSend.format(cal.getTime()) + "&amp;endDate=" + endDateString; } How i can do that? Thanks
tagged with: java
tagged with: date
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27174279
has title: calendar month and year before
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42849815
linked to: http://stackoverflow.com/q/12930134
has answer: http://stackoverflow.com/a/79191099
tagged with: calendar

http
tags question: http://stackoverflow.com/q/27276899
tags question: http://stackoverflow.com/q/27294674
tags question: http://stackoverflow.com/q/27271059
tags question: http://stackoverflow.com/q/27293889
tags question: http://stackoverflow.com/q/27295570
tags question: http://stackoverflow.com/q/27267266
tags question: http://stackoverflow.com/q/27227281
tags question: http://stackoverflow.com/q/27301284
tags question: http://stackoverflow.com/q/27170001
tags question: http://stackoverflow.com/q/27233869
tags question: http://stackoverflow.com/q/27215053
tag name: http
tags question: http://stackoverflow.com/q/27272369
tags question: http://stackoverflow.com/q/27180431
tags question: http://stackoverflow.com/q/27286638
tags question: http://stackoverflow.com/q/27215848
type: Tag
tags question: http://stackoverflow.com/q/27289187
tags question: http://stackoverflow.com/q/27248208
tags question: http://stackoverflow.com/q/27201201
tags question: http://stackoverflow.com/q/27310992
tags question: http://stackoverflow.com/q/27187418
tags question: http://stackoverflow.com/q/27226258
tags question: http://stackoverflow.com/q/27243355
tags question: http://stackoverflow.com/q/27309773

http://stackoverflow.com/a/27259642
type: Answer
answers question: http://stackoverflow.com/q/27259383
has body: Couple of problems: The error message gives you a major clue; static members are associated with the class, rather than an object instance, which is typically done by referencing class name specifically, much as you have done (a simple example would be MyClass.myStaticMethod()). However, the add() method in your case is non-static; it is an instance method. Its unclear what you're trying to do, specifically, in this method, presently. If you remove the SortedArrayList portion of the method call, you'll end up in an infinite recursive loop, because it'll continuously call itself. I assume you're attempting to call the superclass's add method, however you're missing the method signature. If you are attempting to override the ArrayList add method, you should note that there are two version; if you want to override these methods, they should contain the same signature, and look more like this: First Version public boolean add(E e){ // your code } Or the second version public void add(int index, E element){ // your code }
score: 0

http://stackoverflow.com/comment/42902148
type: QuestionComment
comment on: http://stackoverflow.com/q/27209124
has text: James if you want to post an example I can include it in the answer, or you can post your own :)
score: 1
type: Comment

http://stackoverflow.com/a/27263089
has body: public class Homework { public static void main(String[] args) { System.out.println("Enter something:"); doStupidHomework(new Scanner(System.in)); } private static void doStupidHomework(Scanner scanner) { int i = 0, x = 0; for (String next = scanner.next(); next != null; next = scanner.next(), i++) { if (i % 2 == 0) { x = Integer.parseInt(next); continue; } for (int j = 0; j &lt; x; j++) { System.out.print(next); } System.out.println(); } } } Output: Enter something: 6 fox 3 bees 2 25 8 ducks foxfoxfoxfoxfoxfox beesbeesbees 2525 ducksducksducksducksducksducksducksducks
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27262905

http://stackoverflow.com/comment/43170469
type: Comment
comment on: http://stackoverflow.com/q/27288726
has text: And the one where you're getting the error, which environment is this?
score: 0
type: QuestionComment

http://stackoverflow.com/q/27273680
type: Question
has answer: http://stackoverflow.com/a/27274573
accepted answer: http://stackoverflow.com/a/27274573
possible better answer: http://stackoverflow.com/a/27273786
tagged with: arrays
tagged with: counter
has answer: http://stackoverflow.com/a/27273786
upvote count: 3
score: 0
has body: I am trying to create a voting system in Java where I input the name of a candidate and the number of votes they received, then I want to be able to output the highest vote along with the name of that candidate. What I have so far is a main method that collects the names and number of votes. It puts this information into two arrays. One string array for the names, and one int array for the number of votes. I am able to calculate the highest vote by using a value method which returns the largest number in the int array. I then print the returned value without any problems but I would also like to be able to print out the name of the winner from the string array so I wanted to know was there any way I could reference the information from the string array to the int array. I need to use two separate arrays in order to complete the program. This is what I have so far import java.util.Scanner; public class VotingCounter1 { public static void main(String [] args){ Scanner userInput = new Scanner(System.in); final int SIZE = 6; int[] votes = new int[SIZE]; String[] names = new String[SIZE]; for (int i = 0; i &lt; names.length &amp;&amp; i &lt; votes.length; i++){ System.out.print("Enter candidate's name: "); names[i] = userInput.next( ); System.out.print("Enter number of votes: "); votes[i] = userInput.nextInt( ); } System.out.println("And the Winner is: " + highest(votes)); } public static int highest(int[] votes){ int high = votes[0]; for (int i = 1; i &lt; votes.length; i++){ if (votes[i] &gt; high){ high = votes[i]; } } return high; } }
downvote count: 3
favorite count: 0
has title: Voting system java
has answer: http://stackoverflow.com/a/27273878
tagged with: voting
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27273851
tagged with: methods

http://stackoverflow.com/comment/42809453
comment on: http://stackoverflow.com/a/27157645
type: AnswerComment
type: Comment
has text: While this code is good, assertions also have their problems. "Defensive Programming leads to Offensive Code. The best defense is a good offense. And a good offense is a good suite of tests." - Robert C. Martin. I'm not saying that therefore the assertion is bad, I'm just saying that testing should also be considered.
score: 2

http://stackoverflow.com/q/27301569
has answer: http://stackoverflow.com/a/27336998
has comment: http://stackoverflow.com/comment/43066956
score: 1
tagged with: java
tagged with: certificate
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27301947
tagged with: jar
tagged with: applet
favorite count: 0
has title: Signing my applet with trusted certificate
type: UnansweredQuestion
upvote count: 1
has body: I recently made an applet and when I embedded it into my site Java blocks it because it is not signed by a trusted authority. I have downloaded a certification from CACert (.crt &amp; .cer files) and I have my jar file (FollowMe.jar). After a few hours searching on google how to sign the jar file with the crt file I'm still not able to do it. Could someone please help me? This is so frustrating.

http://stackoverflow.com/comment/42958770
type: Comment
type: QuestionComment
score: 0
has text: This works fine BUT when I switch from occurrence to alphabbetical and back.. the textarea doesnt clear and I know it's my toString() method but I dont know where to call it for it to work
comment on: http://stackoverflow.com/q/27235589

http://stackoverflow.com/comment/43056664
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27294079
has text: so, what *is* the problem? GLOBAL_knp does not have access as a Windows user to SQL Server. Add permissions or use your separate credentials.
score: 0

http://stackoverflow.com/q/27263487
has answer: http://stackoverflow.com/a/27758949
has title: How to store blobstore images in the datastore using ajax?
answer count: 1
has body: I have a form which collects the Employee details. I have an option to upload the employee image. I need to store all these data in datastore through ajax. I am using Spring MVC to handle all the requests. I have tried the sample program given in appengine docs using form action. But how to do this operation with ajax? Thanks in advance...
has comment: http://stackoverflow.com/comment/43007201
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2320069
tagged with: google-app-engine
tagged with: java
type: Question
tagged with: google-cloud-datastore
tagged with: ajax
score: 0

http://stackoverflow.com/q/27277089
linked to: http://stackoverflow.com/q/2183974
has comment: http://stackoverflow.com/comment/43023074
tagged with: constructor
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43023138
has comment: http://stackoverflow.com/comment/43023173
has body: Why the web container always calling the default servlet constructor only ? and why if default constructor is not present, the container is throwing exceptions. ? How to use my custom servlet constructor ? If it is possible.
linked to: http://stackoverflow.com/q/3106452
type: Question
has comment: http://stackoverflow.com/comment/43023253
tagged with: java
has title: Why new servlet constructor was not called?
has comment: http://stackoverflow.com/comment/43023168
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/43023108

http://stackoverflow.com/a/27211684
has comment: http://stackoverflow.com/comment/42904430
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27211639
score: 1
answers question: http://stackoverflow.com/q/27211639
upvote count: 1
has comment: http://stackoverflow.com/comment/42904358
has comment: http://stackoverflow.com/comment/42904389
type: AcceptedAnswer
has body: First, I see a few errors in your enum. You need a comma (not a semicolon). Your have two fields that are String(s) but you've declared them to return Integer. public enum EAnimals { dogs(1, "white", "big"), // &lt;-- , cats(2, "black", "small"); private Integer animalId; private String color; private String size; EAnimals(Integer animalId, String color, String size) { this.animalId = animalId; this.color = color; this.size = size; } public Integer getAnimalId() { return animalId; } public String getColor() { // &lt;-- String return color; } public String getSize() { // &lt;-- using an enum in a switch. switch (this) { case dogs: return "small"; case cats: return "big"; default: return "Error"; } } }

http://stackoverflow.com/comment/43057056
score: 0
type: AnswerComment
has text: add `<%@ page contentType="text/html;charset=UTF-8" language="java"%>` to the top of your jsp file. If it's not work either please post your jsp file.
type: Comment
comment on: http://stackoverflow.com/a/27295549

http://stackoverflow.com/a/27297431
has comment: http://stackoverflow.com/comment/43059107
has comment: http://stackoverflow.com/comment/43059252
answers question: http://stackoverflow.com/q/27297140
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43059306
accepted answer of: http://stackoverflow.com/q/27297140
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43060816
has body: The reason why this happens is because you invoke speakOut# In the onInit() method, remove speakOut(): if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { Log.e("TTS", "Language is not supported"); } else { button1.setEnabled(true); // speakOut(); }

http://stackoverflow.com/comment/43140933
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27291512
type: AnswerComment
has text: i'm sorry, can gson convert these json into those ArrayList?

http://stackoverflow.com/q/27296454
has body: I am developing an application which has two (Spring)application context configuration,one by Java class and other from xml file(commonApplicationContext.xml). Java Class configuration --> @Configuration @PropertySource("classpath:apis.application.properties") /* * The component scan can be used to add packages and exclusions to the default * package */ @ComponentScan(basePackages = {"org.surfnet.oaaas.resource", "org.surfnet.oaaas.service"}) @ImportResource("classpath:spring-repositories.xml") @EnableTransactionManagement public class SpringConfiguration { } XML configuration(commonApplicationContext.xml) --> <context:component-scan base-package="com.test.common.dao.*,org.surfnet.*"> <context:exclude-filter type="regex" expression="org\.surfnet\.*"/> </context:component-scan> <context:annotation-config /> <property name="persistenceUnitName" value="common"/> <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> <property name="packagesToScan" value="com.test.common.dao.entity"/> <!-- <property name="showSql" value="true"/> <property name="generateDdl" value="true"/> <property name="database" value="MYSQL"/> --> <property name="entityManagerFactory" ref="entityManagerFactory"/> Now i want to know is there any way to load these two configuration in web.xml? i have tried below,but not working web.xml entry --> contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation org.surfnet.oaaas.config.SpringConfiguration classpath:commonApplicationContext.xml
has answer: http://stackoverflow.com/a/27296535
has title: contextConfigLocation value for java class and xml
type: Question
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: spring
tagged with: java

http://stackoverflow.com/comment/43065997
type: AnswerComment
type: Comment
has text: I assumed I had been neglecting a bigger concept. Thanks I'll look into this
comment on: http://stackoverflow.com/a/27300662
score: 0

http://stackoverflow.com/a/27198748
has body: I actually was able to solve the problem by changing the STDOUT variable in the globals object to a temporary file, and then reading the data from the temporary file. Probably not the best solution, but works perfectly fine.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27195534
answers question: http://stackoverflow.com/q/27195534
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27239457
score: -1
answers question: http://stackoverflow.com/q/27239341
has body: This is an alternative approach to Java.util.Collections, which uses the Java.util.Random class. /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { final static int RAND_CAP = 9; public static void main (String[] args) throws java.lang.Exception { ArrayList&lt;Integer&gt; usedNumbers = new ArrayList&lt;Integer&gt;(); Random rand = new Random(System.currentTimeMillis()); while (usedNumbers.size() &lt; RAND_CAP) { int randNum = Math.abs(rand.nextInt() % RAND_CAP) + 1; if (!usedNumbers.contains(randNum)) { usedNumbers.add(randNum); System.out.println(randNum); } } } } run code here
type: Answer
has comment: http://stackoverflow.com/comment/42964640
downvote count: 1
upvote count: 0

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/27221373
tags question: http://stackoverflow.com/q/27178518
type: Tag

http://stackoverflow.com/a/27249532
answers question: http://stackoverflow.com/q/27249393
type: Answer
score: 0
has body: I don't see any logical errors except the way you are printing may not work as total is a 'double'. You need to change it to - System.out.printf( "\nTotal of the %d races entered %.2f\n", raceCounter, total );

http://stackoverflow.com/a/27256268
has comment: http://stackoverflow.com/comment/42986524
has body: In your onCreate(), add this line before the setContentView() like this: mCardScroller.activate(); //add this line setContentView(mCardScroller); You had this line in your onResume() and that's why it is behaving as is.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27256087
accepted answer of: http://stackoverflow.com/q/27256087
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/q/27217312
type: Question
has title: Guessing game using a tester class
has body: I am creating a Guessing game program in java code. I am having an issue with the main class and the tester class running. Any help would be appreciated. The instructions for the game are The computer generates a random # and the user must guess that number in 7 or fewer guesses. If the guesses exceed 7, then the game is over and the user is asked if they want to 'play again?' Here is my guess class: import java.util.Random; public class Guess { int computersNumber; // A random number picked by the computer. int usersGuess = 0; // A number entered by user as a guess. int guessCount = 0; // Number of guesses the user has made. Random random = new Random(); int randomNumber = random.nextInt(100); public Guess(int n) { usersGuess = n; } public boolean getGuess() { boolean isValid = false; if (isValid) { return false; } if (usersGuess == computersNumber) { return true; } return isValid; } public boolean isGuessCorrect() { return getGuess() == computersNumber; } public int getCount() { guessCount ++; return guessCount; } boolean playAgain; } Tester/main class: import java.util.Scanner; public class GuessTester { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Let's play a game!"); System.out.println(); System.out.println("The computer will generate a number between 0 and 100. You will have up to seven guesses" + "to figure out what the number is. Good luck!"); System.out.println(); System.out.print("What is your first guess? "); int n = in.nextInt(); Guess guess = new Guess(n); if (guess.getGuess == computersNumber) { System.out.println("That's Correct! "); } if (getCount == 7) { System.out.println("You lose, you didn't get the number in 7 guesses."); } System.out.println("Would you like to play again? "); in.nextBoolean(); System.out.println(); System.out.println("Thanks for playing."); in.close(); } }
upvote count: 0
has comment: http://stackoverflow.com/comment/42914478
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27217517
type: UnansweredQuestion
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/42914453
tagged with: java

http://stackoverflow.com/comment/42953340
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27238230
has text: since you need all combinations, have you tried a backtracking method?
type: Comment

http://stackoverflow.com/a/27226669
answers question: http://stackoverflow.com/q/27218779
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27218779
upvote count: 1
has body: First of all, the correct way of using ArrayBlockingQueue or really any BlockingQueue for Producer/Consumer problems is shown in the documentation of that interface, slightly adjusted for your example: Producer try { while (true) { queue.put(1); } } catch (InterruptedException ex) { // something want's us to stop. } Consumer try { while (true) { Integer thing = queue.take(); } } catch (InterruptedException ex) { // something want's us to stop. } There is exactly 0 synchronized/wait/notify because that's what those queues provide built into put and take. You should in practice use those. Writing your own just leads to errors. Since you use synchronized/wait/notify manually, you could have taken anything to serve as buffer. E.g. an ArrayList. Granted, there is no remainingCapacity() method on those, so a bound queue isn't a bad choice after all. But there is another problem in your implementation beyond the deadlock: It will fail in case there is more than 1 producer or consumer: Your code has 2 synchronized blocks per iteration. What could happen now is: Queue has exactly 1 slot open. Producer 1, checks that there is space in the queue, leaves synchronized Producer 2, checks that there is space in the queue, leaves synchronized Producer 2, enters 2nd synchronized, puts something in, queue is now full, leaves Producer 1, enters 2nd synchronized, puts something.. arr - crash. What you really need to synchronize as 1 big atomic operation is the whole check-then-wait-and-put thing. You would end up with roughly try { while (true) { // produce outside of synchronized Integer product = 1; // BEGIN put atomic synchronized (buffer) { while (buffer.remainingCapacity() == 0) { buffer.wait(); } buffer.add(product); buffer.notifyAll(); System.out.println("Producer active with remaining capacity: " + buffer.remainingCapacity()); } // END put atomic // consumer should likewise consume the product outside // of the synchronized block } } catch (InterruptedException e) { e.printStac…
score: 1
has comment: http://stackoverflow.com/comment/42937820

http://stackoverflow.com/q/27181556
tagged with: java
tagged with: jpanel
type: Question
tagged with: cardlayout
accepted answer: http://stackoverflow.com/a/27181608
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27181608
tagged with: swing
type: AnsweredQuestion
has title: Attempting to do CardLayout and no buttons are shown when running GUI
has body: I'm trying to do a Card Layout. Right now I can't even switch between two screens. I want the first screen to have three top buttons. When clicking on add questions, I want the second screen to show up, which I'll code as soon as I get this problem out of the way. No buttons at all are showing up right now. public class BookQuizGUI extends JFrame implements ActionListener { private JFrame f; private JPanel card; private JPanel home; private JPanel contentPane; private JPanel pnlButtons; private JButton addQs; private JButton takeQuiz; private JButton quit; private CardLayout cardLayout; private JPanel addQ; private JPanel pnlButtons2; private JButton add; private JButton writeAll; private JButton done; private JButton quit2; /** * */ public BookQuizGUI() { //The main screen for when the program starts f = new JFrame(); f.setTitle("Book Quiz"); f.setSize(800, 400); f.setLocation(400, 250); f.setDefaultCloseOperation(EXIT_ON_CLOSE); contentPane = (JPanel) f.getContentPane(); card = new JPanel(); cardLayout = new CardLayout(); card.setLayout(cardLayout); home = new JPanel(); pnlButtons = new JPanel(); pnlButtons.setLayout(new GridLayout(1, 3)); addQs = new JButton("Add Questions"); takeQuiz = new JButton("Take Quiz"); quit = new JButton("Quit"); pnlButtons.add(addQs); pnlButtons.add(takeQuiz); pnlButtons.add(quit); home.add(pnlButtons); card.add(home); f.add(card); cardLayout.show(card, "Home"); addQ = new JPanel(); addQ.setLayout(new GridLayout(1, 2)); pnlButtons2 = new JPanel(); add = new JButton("Add"); writeAll = new JButton("Write All"); done = new JButton("Done"); quit2 = new JButton("Quit"); pnlButtons2.add(add); pnlButtons2.add(writeAll); pnlButtons2.add(done); pnlButtons2.add(quit2); addQ.add(pnlButtons, BorderLayout.SOUTH); addQs.addActionListener(this); takeQuiz.addActionListener(this); quit.addActionListener(this); f.setVisible(true); } /** * @param args */ public static void main(String[] args) { BookQuizGUI gui = new BookQuizGUI(); } @Override public void…

selenium-webdriver
tags question: http://stackoverflow.com/q/27288617
tags question: http://stackoverflow.com/q/27187171
tags question: http://stackoverflow.com/q/27294315
tags question: http://stackoverflow.com/q/27199373
tags question: http://stackoverflow.com/q/27304089
tags question: http://stackoverflow.com/q/27182845
tags question: http://stackoverflow.com/q/27294946
tags question: http://stackoverflow.com/q/27173053
tags question: http://stackoverflow.com/q/27200645
tags question: http://stackoverflow.com/q/27287794
tags question: http://stackoverflow.com/q/27189182
tags question: http://stackoverflow.com/q/27241922
tags question: http://stackoverflow.com/q/27282713
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/27302104
tags question: http://stackoverflow.com/q/27168978
tags question: http://stackoverflow.com/q/27156414
tags question: http://stackoverflow.com/q/27300930
tags question: http://stackoverflow.com/q/27154697
tags question: http://stackoverflow.com/q/27184496
tags question: http://stackoverflow.com/q/27162791
tags question: http://stackoverflow.com/q/27279330
tags question: http://stackoverflow.com/q/27168769
type: Tag
tags question: http://stackoverflow.com/q/27208872
tags question: http://stackoverflow.com/q/27188422
tags question: http://stackoverflow.com/q/27153959
tags question: http://stackoverflow.com/q/27248952
tags question: http://stackoverflow.com/q/27241405
tags question: http://stackoverflow.com/q/27213051
tags question: http://stackoverflow.com/q/27222227

http://stackoverflow.com/comment/42889619
has text: you wrote the meaning of each line yourself! so what's your question?
comment on: http://stackoverflow.com/q/27203465
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/43085783
comment on: http://stackoverflow.com/a/27302625
has text: The arraylist is to send the selected items to the host activity, the array of booleans is for keeping track of the state. this might not be the best way to do it ! i'm open to your suggestions :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42872021
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27192886
has text: Thats a good answer, But what happen if it is a volatile variable as in that case it won't be stored in CPU first level cache but will be accessed directly from heap?
type: AnswerComment

http://stackoverflow.com/comment/42875493
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27194995
has text: http://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program
score: 0

http://stackoverflow.com/comment/42975670
type: QuestionComment
has text: Could you provide the MySql table description?
comment on: http://stackoverflow.com/q/27250720
score: 0
type: Comment

http://stackoverflow.com/comment/63114483
comment on: http://stackoverflow.com/a/27356904
type: Comment
has text: @QZSupport Except in my experience, unless you scale the image to fit within the prescribed area, it doesn't work, it simply allows the image to "overfill" the paper. I assume this is because there is a difference between DPI of the image and the `Graphics` subsystem. I wouldn't do this kind of thing for text though, only graphics
score: 0
type: AnswerComment

http://stackoverflow.com/q/27287510
has answer: http://stackoverflow.com/a/27291173
favorite count: 0
has comment: http://stackoverflow.com/comment/43042232
has comment: http://stackoverflow.com/comment/43042085
upvote count: 1
has comment: http://stackoverflow.com/comment/43042001
type: AnsweredQuestion
score: 1
has title: An exception occurred processing JSP page /index.jsp at line 51
tagged with: java
accepted answer: http://stackoverflow.com/a/27291173
has body: I am writing code for uploading file using struts. below is the error i am facing, org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 51 48: &lt;img src="images/search.jpg" /&gt; 49: &lt;/div&gt; 50: &lt;div class="col-lg-6 col-md-6 col-lg-offset-1 col-md- offset-1 visible-lg visible-md"&gt; 51: &lt;html:form action="/dataset"&gt; 52: Dataset &lt;html:file styleClass="form-control" property="filepath" /&gt; 53: &lt;html:submit value="submit" styleClass="btn btn-sm btn- info" /&gt; 54: &lt;/html:form&gt; root cause javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class com.aml.model.DatasetForm: {1} Tell me the solution for this problem.
type: Question
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: struts
has comment: http://stackoverflow.com/comment/43042334

http://stackoverflow.com/q/27305587
score: 4
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/27342878
downvote count: 0
favorite count: 0
tagged with: optimization
has comment: http://stackoverflow.com/comment/43077072
has body: I am now attempting to write simple renderer that will call render method at 60Hz and sleep the extra time to save CPU cycles for someone else. I encountered one simple problem with following while(m_Running){ //start meassuring whole frame time t0 = System.nanoTime(); render(); //meassure time spent rendering t1 = System.nanoTime(); if(t1&lt;nextRedraw){ try{ diff = nextRedraw-t1; ms = diff/1000000; ns = (int) (diff-(ms*1000000)); Thread.sleep(ms, ns); }catch(InterruptedException e){ Logger.logWarning("Renderer interrupted!",e); } //while(System.nanoTime()&lt;nextRedraw);//busy wait alternative } //meassure time spent sleeping t2 = System.nanoTime(); nextRedraw = t2+m_RedrawTimeout; long frameTime = t2-t0; long renderTime = t1-t0; long sleepTime = t2-t1; long fps = 1000000000/frameTime; } which runs fine, but far from intended 60fps, but instead it is jumping around values FPS: 63 Frame: 15,7ms Render: 2,0ms Sleep: 13,7ms FPS: 64 Frame: 15,5ms Render: 2,0ms Sleep: 13,5ms FPS: 63 Frame: 15,7ms Render: 2,1ms Sleep: 13,5ms FPS: 59 Frame: 16,7ms Render: 2,8ms Sleep: 14,0ms FPS: 64 Frame: 15,5ms Render: 2,2ms Sleep: 13,3ms When I try using busy wait instead, result is much more consistent and closer to my desired fps target. FPS: 60 Frame: 16,4ms Render: 2,0ms Sleep: 14,5ms FPS: 60 Frame: 16,4ms Render: 2,0ms Sleep: 14,4ms FPS: 60 Frame: 16,4ms Render: 2,0ms Sleep: 14,4ms FPS: 61 Frame: 16,3ms Render: 2,4ms Sleep: 13,8ms FPS: 61 Frame: 16,3ms Render: 2,1ms Sleep: 14,2ms FPS: 60 Frame: 16,4ms Render: 2,0ms Sleep: 14,4ms I would like to avoid that though, for understandable CPU drawback. I got an idea of sleeping bit less than necessary and looping through the remaining time to be precise but that seems a bit clunky. My question is, whether is busy wait somehow optimized by compiler, or if there is some other way to hit similar timing? Any help would be appreciated. With kind regards, Vojtěch NOTE: I used System.nanoTime(); in attempt to make things more accurate, it did …
has comment: http://stackoverflow.com/comment/43075848
has comment: http://stackoverflow.com/comment/43074176
has answer: http://stackoverflow.com/a/27306773
accepted answer: http://stackoverflow.com/a/27342878
possible better answer: http://stackoverflow.com/a/27306773
has comment: http://stackoverflow.com/comment/43075075
type: Question
type: AnsweredQuestion
has title: Busy wait, sleep and accuracy
tagged with: java

http://stackoverflow.com/q/27248248
has answer: http://stackoverflow.com/a/27395130
upvote count: 1
tagged with: excel
tagged with: passwords
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/3042694
type: Question
has body: sheet1.protectSheet("xxxx"); Actually I tried the above code, it is protecting the sheet from editing, but while I enable editing it does not ask for password, how to protect with password?
downvote count: 0
favorite count: 0
answer count: 1
linked to: http://stackoverflow.com/q/3042694
has title: How to give password to protect xlsx sheet using apache poi?
tagged with: apache-poi
type: UnansweredQuestion

jsf-2.2
tags question: http://stackoverflow.com/q/27216774
tags question: http://stackoverflow.com/q/27173658
tags question: http://stackoverflow.com/q/27187745
type: Tag
tags question: http://stackoverflow.com/q/27293313
tag name: jsf-2.2

http://stackoverflow.com/a/27309898
downvote count: 0
has comment: http://stackoverflow.com/comment/43081108
answers question: http://stackoverflow.com/q/27309852
upvote count: 2
has body: try: import com.myname.appname.Constants; Are you using an IDE? Also, they way you have stated is how you are suppose to use a Constants class. But you are not suppose to assign anything... because the variable are suppose to be constant, ie. static final
type: Answer
score: 2

http://stackoverflow.com/comment/42863515
type: Comment
comment on: http://stackoverflow.com/a/27188651
has text: That only wraps a call to `String#replace` and once you have replaced all the Qs by 1s how do you plan to replace the original 1s by Qs?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27164802
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: vaadin
upvote count: 1
type: Question
has title: spring and vaadin integration
has answer: http://stackoverflow.com/a/27205503
tagged with: servlets
has body: I'm trying to implement an application with several uis - vaadin, jsp and etc. It was working with simple jsp but then I decided to use vaadin as ui. I've created vaadin servlet(and spring servlet left too). My web.xml looks like this <?xml version="1.0"?> contextConfigLocation classpath:/pmc-web-context.xml org.springframework.web.context.ContextLoaderListener another-pmc-servlet com.vaadin.server.VaadinServlet UI com.xxxx.app.pmc.vaadin.PmcUi contextConfigLocation pmc-servlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation 1 another-pmc-servlet /VAADIN/* pmc-servlet /JSP/* jsp org.apache.jasper.servlet.JspServlet jsp /WEB-INF/jsp/* I've created vaadin table component and adjusted it for my needs. I used autowiring for service. package com.xxxx.app.pmc.vaadin.components; import com.xxxx.app.pmc.model.Project; import com.xxxx.app.pmc.service.project.ProjectService; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Table; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component("projectTable") public class ProjectTable extends Table { private static final String CAPTION = "Projects"; private static final String[] headers = { "Project name", "Project owner", "ID" }; @Autowired private ProjectService projectService; public Table createTable() { this.setContainerDataSource(projectDatasource()); this.setVisibleColumns(headers); this.setSelectable(true); this.setImmediate(true); return this; } public IndexedContainer projectDatasource() { IndexedContainer indexedContainer = new IndexedContainer(); for(String header: headers) { indexedContainer.addContainerProperty(header, String.class, ""); } List<Project> projects = projectService.findAllProjects(); for(int i = 0; i < projects.size(); i++) { Object id = indexedContainer.addItem(); Project item = projects.get(i); indexedContainer.getContainerProperty(id, headers[0]).setValue(item.getProjectName…
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27205575

http://stackoverflow.com/q/27177079
upvote count: 2
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27177109
has answer: http://stackoverflow.com/a/27177185
tagged with: java
has answer: http://stackoverflow.com/a/27177128
type: Question
possible better answer: http://stackoverflow.com/a/27177111
has comment: http://stackoverflow.com/comment/42843078
has answer: http://stackoverflow.com/a/27177763
has answer: http://stackoverflow.com/a/27177111
downvote count: 0
has comment: http://stackoverflow.com/comment/42843202
favorite count: 0
tagged with: class
answer count: 5
has answer: http://stackoverflow.com/a/27177109
has body: let's say I have : public static int MIN = 0; in a class. and I am trying to use this constant in another class with main : myVar = MIN; why am I getting cannot find symbol - variable MIN error? both classes are public and so is the constant MIN. any help would be appreciated. thank you fellow coders e; thank you guys, it worked!
has title: Java newbie - cannot find symbol - variable

http://stackoverflow.com/comment/42958762
comment on: http://stackoverflow.com/q/27241144
score: 1
type: Comment
type: QuestionComment
has text: a wake lock prevents that your device goes to sleep, but you won't get anything from the sensors if it would be asleep, so you probably want one. You can simply try if it works.

http://stackoverflow.com/comment/42994397
comment on: http://stackoverflow.com/q/27245481
has text: I have managed to implement mine. Thanks all, please see the answer below.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27165566
has body: Try this: public class Puppy{ public static void Pup(String name){ System.out.println("Passed Name is :" + name ); } public static void main(String []args){ Pup("tommy"); } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27165546
score: 1

http://stackoverflow.com/q/27261334
accepted answer: http://stackoverflow.com/a/27262057
score: 0
has title: IBM domino design librarys
has answer: http://stackoverflow.com/a/27262057
has body: I'm newbie in ibm domino design I can't import some library like org.openntf.domino.Document; Can any one help me please
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30989159
tagged with: java
has answer: http://stackoverflow.com/a/30989159
tagged with: lotus-domino
type: Question
answer count: 2

http://stackoverflow.com/a/27277273
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43036135
has body: Please check your manifest file in the jar.. It describes the version and mainClass. If you are using maven .. While adding dependencies to build jar describe the main class in configuration so that maven will add this configuration to manifest file
has comment: http://stackoverflow.com/comment/43172179
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27276939

http://stackoverflow.com/q/27179752
has body: Is this a limit on the number of worker processes allowed on a non root user account? The account is running a java -jar file The environment is Linux Red Hat.
score: 0
answer count: 1
tagged with: redhat
tagged with: worker
type: UnansweredQuestion
type: Question
tagged with: java
has title: Limit on processes spawned by app runing in a user context. Red Hat
has answer: http://stackoverflow.com/a/27359323

http://stackoverflow.com/comment/42986256
has text: I realize the code above is not best practice, but I'm more interested in figuring out why these statements in particular do not produce the desired toggling functionality as opposed to coming up with a syntactically different answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27255527
score: 0

http://stackoverflow.com/comment/42886251
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27201378
has text: Look at for loops, `Integer.parseInt` and `String#charAt`. That should guide you in the right direction.

http://stackoverflow.com/q/27228780
tagged with: javascript
has title: Email validation solution for front and backend
has body: We have to do email validation and there are a large number of solution. The email is not the primary email we are using across site so we are not planning on sending a email and verifying the account. Hence we we are relying on regex based validation solution. Now doing regex based validation in server-side(java) is generally discouraged and we are advised to use existing solution like EmailValidator or existing libraries. Now the problem is to achieve consistency between front end validation(which would be regex based and implemented in javascript) and backend implementation (which will be in java). Is there a solution to achieve consistency between these validation on front-end and backend automatically.
tagged with: validation
answer count: 1
tagged with: email
downvote count: 0
favorite count: 0
tagged with: regex
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42959461
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27228931

http://stackoverflow.com/comment/44204460
type: Comment
comment on: http://stackoverflow.com/a/27603210
score: 0
type: AnswerComment
has text: IBX and toolkit cant stop and start remote Execution Groups (because the Broker is handling the CMP responses) but not remote brokers. The stop and start of a broker is accomplished by breaking out to the lcol shell (not ssh) which is why it only works for local brokers.

http://stackoverflow.com/comment/42914482
comment on: http://stackoverflow.com/q/27217401
type: QuestionComment
has text: 10 / 3 will have the same behavior. Java performs integer division if both operand are int (or long)
score: 3
type: Comment

datamapper
tag name: datamapper
type: Tag
tags question: http://stackoverflow.com/q/27159823

http://stackoverflow.com/comment/42849645
type: QuestionComment
score: 0
has text: `JFormattedTextField` is one of those annoying classes which installs it's own filter or `Document` in order to facilitate it's functionality, but only does so after it's added to the UI...:P
comment on: http://stackoverflow.com/q/27180459
type: Comment

http://stackoverflow.com/a/27169945
upvote count: 1
has comment: http://stackoverflow.com/comment/42830809
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27169904
has body: Character.toString((char) keycode);
has comment: http://stackoverflow.com/comment/42830997
score: 0

http://stackoverflow.com/comment/42897960
comment on: http://stackoverflow.com/a/27207984
has text: Evidently not. Besides, if that's the case then adding a check wouldn't hurt.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27235832
upvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27451366
tagged with: playframework
downvote count: 0
has body: I need to change of connection in runtime. I have this servers configurations: db.default.driver=oracle.jdbc.OracleDriver db.default.url="jdbc:oracle:thin:@//178.20.26.25:1521/orcl" db.default.user="TEST1" db.default.password="test1" db.test.driver=oracle.jdbc.OracleDriver db.test.url="jdbc:oracle:thin:@//178.20.26.26:1521/orcl" db.test.user="TEST" db.test.password="test" ebean.default="models.*" ebean.test="models.*" I'm trying with this method but give me RuntimeException: DataSource user is null? in EbeanServerFactory.create(c); public static void ChangeConfig(){ ServerConfig c = new ServerConfig(); c.setName("test"); c.loadFromProperties(); c.setDefaultServer(true); c.setRegister(true); EbeanServerFactory.create(c); } I'm not sure that this method do the thing, but it is what i find. What could be the cause of this error? Is there other way to solve this problem?
favorite count: 0
tagged with: database-connection
tagged with: oracle-database
tagged with: ebean
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27247137
has comment: http://stackoverflow.com/comment/43268730
has title: How to change programatically default server Play + Ebean in runtime
score: 1
has answer: http://stackoverflow.com/a/27247137
tagged with: java
has answer: http://stackoverflow.com/a/27451366

http://stackoverflow.com/comment/43010508
has text: @oneofakind Update your Question to show the exact text you used in pgAdmin. Also specific your version of Postgres.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27266545

http://stackoverflow.com/a/27234767
has comment: http://stackoverflow.com/comment/42946075
has comment: http://stackoverflow.com/comment/42949795
has comment: http://stackoverflow.com/comment/42946743
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42946275
accepted answer of: http://stackoverflow.com/q/27234680
type: Answer
has body: What is the most efficient way to achieve the same result in terms of time complexity? Given that the size of int is fixed at 32, the time complexity is O(1). Your program is pretty inefficient, though, because it creates a coupe of strings, does string parsing, and so on. You can do this faster if you skip the conversion to binary altogether, and simply invert the number, like this: int val = 4; int msb = int msb = 32 - Integer.numberOfLeadingZeros(val); int inverse = ~val &amp; ((1 &lt;&lt; msb)-1); System.out.println(inverse); The ~ operator is a unary operator that produces a binary complement of the value. The loop computes the position of the most significant bit (MSB). ((1 &lt;&lt; msb)-1) is a mask that removes all bits higher than the MSB. Demo.
answers question: http://stackoverflow.com/q/27234680
has comment: http://stackoverflow.com/comment/42946058
upvote count: 3

http://stackoverflow.com/q/27292366
tagged with: ibm-was
type: UnansweredQuestion
tagged with: encryption
has title: NoSuchAlgorithm exception while using cipher.getInstance method
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27296571
upvote count: 1
answer count: 1
favorite count: 0
tagged with: exception
has body: I am doing password decription logic using cipher java. In that, while getting the instance of cipher using cipher.getInstance("RSA/NONE/NoPadding"). I am getting following exception: NoSuchAlgorithm. The same code is working in my local jboss server setup but not working in IBM-WAS server setup. Is there any difference between local jboss Server and WAS Server? public static String decrypt(String encrypted, KeyPair keys) { Cipher dec; try { dec = Cipher.getInstance("RSA/NONE/NoPadding"); //Exception raised dec.init(Cipher.DECRYPT_MODE, keys.getPrivate()); } catch (GeneralSecurityException e) { throw new RuntimeException("RSA algorithm not supported", e);//Catch block executed } } Log: R Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/NONE/NoPadding at java.lang.Throwable.&lt;init&gt;(Throwable.java:80) at javax.crypto.Cipher.getInstance(Unknown Source) at com.lsi.utils.JCryptionUtil.decrypt(JCryptionUtil.java:59) Caused by: java.security.NoSuchAlgorithmException: Mode: NONE not implemented at com.ibm.crypto.provider.RSA.engineSetMode(Unknown Source) at javax.crypto.Cipher$a_.a(Unknown Source) **Jar** Jce.jar - javax.crypto.Cipher; bcprov-jdk15-140.jar (External security provider jar)
downvote count: 0

http://stackoverflow.com/q/27290266
tagged with: java
has body: As shown in example below, once lock is taken on an object in call method, there is no need for further methods to have synchronized keyword. public class Prac { public static void main(String[] args) { new Prac().call(); } private synchronized void call() { further(); } private synchronized void further() { oneMore(); } private synchronized void oneMore() { // do something } } But, if I still add synchronized keyword to further and onceMore, what java does on such encounters? Does java checks if lock is required or not? or as method call is in same stack, it just proceeds without checking if lock is required or not as lock is already acquired. Note : My doubt is how java will behave in such situation, I am not sure, but I think it is different from biased locking.
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27290338
tagged with: synchronization
has title: Synchronization at multiple level java behavior
accepted answer: http://stackoverflow.com/a/27290338
type: AnsweredQuestion

http://stackoverflow.com/q/27291350
linked to: http://stackoverflow.com/q/6730009
has comment: http://stackoverflow.com/comment/43048509
has comment: http://stackoverflow.com/comment/43048544
score: 1
has body: I want to check if a string is a valid file pattern, what i want is: if string = "/abc/def/apple.xml" then return TRUE if string = "/abc/def/" then return FALSE if string = "/abc/def" then return FALSE My code: String filepath = "/abc/def/apple.xml"; File f = new File(filepath); if(f.isFile() &amp;&amp; !f.isDirectory()) return true; else return false; With my code i set string as /abc/def/apple.xml or /abc/def/, both also return false, not really sure why
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27291585
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27291585
has comment: http://stackoverflow.com/comment/43048925
has comment: http://stackoverflow.com/comment/43048553
tagged with: java
has comment: http://stackoverflow.com/comment/43048455
has comment: http://stackoverflow.com/comment/43048440
possible better answer: http://stackoverflow.com/a/27291849
has comment: http://stackoverflow.com/comment/43048570
has title: Java check if string is valid file
answer count: 3
has comment: http://stackoverflow.com/comment/43048482
has answer: http://stackoverflow.com/a/27292116
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27291849

http://stackoverflow.com/q/27163122
has body: I have a error in eclipse as follows: !SESSION 2014-11-27 08:59:05.330 ----------------------------------------------- eclipse.buildId=4.3.2.M20140221-1700 java.version=1.6.0_45 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.standard.product This is a continuation of log file /home/dragonk/workspace/.metadata/.bak_0.log Created Time: 2014-11-27 10:19:19.795 !ENTRY org.eclipse.text 4 2 2014-11-27 10:19:19.796 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.text". !STACK 0 org.eclipse.core.runtime.AssertionFailedException: assertion failed: It make me out of control editor in eclipse. Please hepl me. Thanks for your help
type: Question
answer count: 1
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/27163783
has title: Error plug-in: "org.eclipse.text" in eclipse 4.3
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/42922085
type: QuestionComment
has text: I mean the second one i.e. C:\Users\azura\workspace_intermediate_java_third\azura\images\bulb.gif. It should work.
score: 0
comment on: http://stackoverflow.com/q/27221510
type: Comment

http://stackoverflow.com/comment/42989575
has text: just use simple strings String versionNames= "8888"; similarly for versionNames1
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27257862
type: QuestionComment

http://stackoverflow.com/a/27305832
downvote count: 0
answers question: http://stackoverflow.com/q/27305779
upvote count: 3
has body: In java, you have to deal with the exceptions that your code might throw. This compiler error is saying that your Card constructor can throw an exception of type MyPlayingCardException but that your Deck constructor is doing nothing to handle it. There are two approaches here. You can either change your Decks constructor to read public Decks() throws MyPlayingCardException { //constructor code here } or you can handle the exception like this for (int j=0; j&lt;= 13; j++) { try { Card card = new Card(j,i); originalDecks.add(card); } catch(MyPlayingCardException ex){ //some code to handle MyPlayingCardException here } } }
type: Answer
score: 3

http://stackoverflow.com/q/27216265
has comment: http://stackoverflow.com/comment/42912410
tagged with: algorithm
tagged with: libgdx
score: 1
tagged with: math
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42913059
answer count: 2
has comment: http://stackoverflow.com/comment/42912383
has answer: http://stackoverflow.com/a/27220115
has comment: http://stackoverflow.com/comment/42913556
accepted answer: http://stackoverflow.com/a/27220115
has answer: http://stackoverflow.com/a/27218473
upvote count: 1
has comment: http://stackoverflow.com/comment/42913197
linked to: http://stackoverflow.com/q/919612
has comment: http://stackoverflow.com/comment/42912503
has body: With lot of float[] arrays with 2d geometry I'm trying to cache those vertices lists into some keyed map. For (read)perfromance reasons a key with long or int should be faster than a string one ? objectmap&lt;key,float[]&gt; Is it possible to create an int/long key from values ? keyForVertices = generateKeyFromVertices(float[]{...}) For the same values in float[] generated key should be unique per float[] values ie. arrAKey = generate from float[]{-10,10,20,20,30,30} arrBKey = generate from float[]{-10,10} arrCKey = generate from float[]{10,-10} arrAKey!=arrBKey arrBKey!=arrCKey arrAKey!=arrCKey **edit why java.util.Arrays.hashCode(float[]) wont work ?
favorite count: 0
has title: Algorithm for generating the same unique ID/Hash as long for values in float[]
downvote count: 0
possible better answer: http://stackoverflow.com/a/27218473
type: AnsweredQuestion

http://stackoverflow.com/q/27303270
tagged with: internationalization
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27311544
has body: Wicket supports complex translatable message containing HTML elements like links, etc. as described in https://cwiki.apache.org/confluence/display/WICKET/Everything+about+Wicket+internationalization using wicket:message. E.g.: &lt;wicket:message key="messageKey"&gt; &lt;a wicket:id="link"&gt;&lt;wicket:message key="linkLabel"&gt;&lt;/wicket:message&gt;&lt;/a&gt; &lt;/wicket:message&gt; and the properties: messageKey=Click on ${link} and in Java add(new BookmarkablePage&lt;Void&gt;("link", SomePage.class); This works great, however the message key is hardcoded in the HTML. In my case, I want the message key to be dynamically determined in Java. For regular messages (with string parameters) I can do that with a Label and a StringResourceModel that takes the key as a parameter. But how do I do the same thing for a message that contains Wicket components as parameters? I guess the markup would looks something like: &lt;span wicket:id="messageId"&gt; &lt;a wicket:id="link"&gt;&lt;wicket:message key="linkLabel"&gt;&lt;/wicket:message&gt;&lt;/a&gt; &lt;span&gt; But what would the Java be? Label cannot have children. :( === UPDATE === There's a Wicket class org.apache.wicket.markup.resolver.WicketMessageResolver.MessageContainer that looks interesting. Since it's private static, I cannot use it directly but if I copy paste the code into a public class and tweak a couple things related to component hierarchy, I'm getting close to a solution. But that's pretty hacky. Is there a cleaner solution?
type: Question
possible better answer: http://stackoverflow.com/a/27304349
answer count: 3
accepted answer: http://stackoverflow.com/a/27373378
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27304349
tagged with: wicket
has title: Apache Wicket: dynamic key for message with embedded HTML
downvote count: 1
has answer: http://stackoverflow.com/a/27373378

http://stackoverflow.com/comment/42956113
comment on: http://stackoverflow.com/q/27239582
has text: yeah, you are missing obvious thing, that awt is not a part of android's framework/API
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42919662
has text: i understand how the logger works, i just dont knw how to make the logger work throughout the application (through all activities) do i need to work with the manifest or is there something else i need to add onto my logger code, other than editing my directory for the text file?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27219666
type: AnswerComment

http://stackoverflow.com/comment/43027561
type: Comment
comment on: http://stackoverflow.com/a/27197088
has text: @BAhmed786 The choice is yours. Thanks for useful link.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27243084
has comment: http://stackoverflow.com/comment/42962063
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27243073
has body: Change this line : android:id="@+id/list" to android:id="@id/android:list"
type: Answer
has comment: http://stackoverflow.com/comment/42961930
answers question: http://stackoverflow.com/q/27243073

http://stackoverflow.com/q/27213051
has comment: http://stackoverflow.com/comment/64129562
downvote count: 0
has answer: http://stackoverflow.com/a/27230303
favorite count: 0
has answer: http://stackoverflow.com/a/27213145
answer count: 4
tagged with: selenium-webdriver
score: 2
has title: How to select Tweet button Selenium Webdriver
has body: I'm just refreshing my WebDriver skills and am trying to automate sending a tweet in Java. I can login and click on on 'Tweet'. After selecting this, a modal dialog pop up appears. The tweet button is disabled until typing at least 1 character in the box, after which is is enabled: &lt;button class="btn primary-btn tweet-action tweet-btn js-tweet-btn" type="button"&gt; But I cannot seem to select it with any selector. I guess I need to somehow switch driver control to the modal dialog but not sure how. It is not within a frame. Any ideas?
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/38358888
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/27213556

http://stackoverflow.com/q/27173053
type: Question
score: 0
has title: Cannot check the WebElement is Present or Not by "isDisplyed" on selenium WebDriver
has body: I am trying to get the value from UI, using (By.id) locator.getAtrribute("value"), Issue: But, when the xpath is not found (web element not present on UI), I need to take the value as '00:00', but I get error as "No Such element" I need to add a check, to find the webelement is present on UI, if true, get value using getattribute("value") , else return the value as '00:00' But When using If condition, "(WebelementforUIvalue.isEmpty()" returns '00:00', though the Web element is present on UI. (I need to take 00:00, when there is no element found/present on UI) String WebelementforUIvalue = driver.findElement(By.id("ctl00_MainContent_AllowanceGridView_SRow"+cellRosterPerioddd+cellRosterPeriodmm+"_"+PayBucket)).getAttribute("value"); if (WebelementforUIvalue.isEmpty()) { UIValue = "00.00"; } else { UIValue = WebelementforUIvalue; } System.out.println(UIValue);
has answer: http://stackoverflow.com/a/27174219
has answer: http://stackoverflow.com/a/27173187
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42836460
answer count: 4
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/27176083
tagged with: java
has answer: http://stackoverflow.com/a/27173326
tagged with: selenium

http://stackoverflow.com/a/27429095
type: Answer
has body: you can provide a message when the verification fail: You can use Spy MP if you want to run a set of assertions before the MP you are mocking https://github.com/mulesoft/munit/wiki/spy-message-processors if The assertion is complex you can write it in JAVA https://github.com/mulesoft/munit/wiki/assertions#custom-assertions
has comment: http://stackoverflow.com/comment/43311264
answers question: http://stackoverflow.com/q/27289046
score: 0

http://stackoverflow.com/comment/42920508
has text: AFAIK there are none. Those keys are programmed at the keyboard level to send sequences of standard keys.
comment on: http://stackoverflow.com/q/27220756
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42912368
has text: Why can't you just search for anything that matches the particular prefixes that apply to London? Once you've identified a substring as being a post code, merely look at the first 2-4 characters and see if they match something from the list.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27216192
type: QuestionComment

http://stackoverflow.com/comment/42885893
has text: @artm. What did you edit? I don't see any changes.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27201203
type: QuestionComment

http://stackoverflow.com/q/27170564
type: Question
answer count: 2
upvote count: 9
has answer: http://stackoverflow.com/a/27173141
downvote count: 0
possible better answer: http://stackoverflow.com/a/39043344
has answer: http://stackoverflow.com/a/39043344
has title: ActionBarDrawerToggle() icon cannot be set to the ActionBar in Android SDK 5
has body: I have a simple problem with initializing my icon for my action bar. I am using Android SDK 5 and since android.support.v4.app.ActionBarDrawerToggle; was deprecated I imported v7 support and replaced my import with the following: android.support.v7.app.ActionBarDrawerToggle; i.e. the same package with v7. Now when I initialize my ActionBarDrawerToggle object to associate with my DrawerLayoutobject imported from: import android.support.v4.widget.DrawerLayout; I am forced to remove one argument, which seems ok (have no idea why though!). but my icon does not go in my ActionBar. here is the my initialization for my ActionBarDrawerToggle object: mActionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open) { /** Called when a drawer has settled in a completely closed state. */ @Override public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ @Override public void onDrawerOpened(View view) { super.onDrawerOpened(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; I have the image in my resource namely R.drawable.ic_drawer I cant seem to find why my icon does not appear in v7. P.S. the code works perfectly fine, infact when I switch back to v4 import and add the extra argument for toggle object initialization (having to bare with the ugly deprecated cross line ofcourse), the icon appears but not in v7. thanks in advance :)
favorite count: 0
accepted answer: http://stackoverflow.com/a/27173141
score: 9
tagged with: android
tagged with: android-actionbar
tagged with: drawertoggle
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43012404
has text: possible duplicate of [android.os.NetworkOnMainThreadException](http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception)
comment on: http://stackoverflow.com/q/27271286
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/42891771
type: QuestionComment
score: 0
has text: Also check out the answers to [this question](http://stackoverflow.com/q/11818080/522444), and [this question](http://stackoverflow.com/questions/11042361/error-with-logic-or-repaint-revalidate-java-jframe), and [this question](http://stackoverflow.com/q/11091457/522444), and [this question](http://stackoverflow.com/q/26423468/522444). Lots of examples!
comment on: http://stackoverflow.com/q/27204452
type: Comment

http://stackoverflow.com/comment/42974089
type: Comment
type: QuestionComment
has text: You can either mark the field as transient or use the @Expose annotation if you want to exclude them from the serialization process.
comment on: http://stackoverflow.com/q/27249894
score: 0

http://stackoverflow.com/comment/43174849
score: 0
type: Comment
type: QuestionComment
has text: I think I can see the problem: the Spring code closes the content stream instead of closing the response. According to the Apache doc, closing the content stream implies closing the connection. Please see section 1.1.5 in http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html.
comment on: http://stackoverflow.com/q/27295160

http://stackoverflow.com/comment/63576350
has text: I'm having the same problem. Right now I'm using Fresco for image loading and caching. Do you have another, better solution to load and cache images within RecyclerView. Thanks.
comment on: http://stackoverflow.com/a/37752666
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42911729
has text: that's great thank you so much. do I put this line in the oncreate of the activity or somewhere else?
comment on: http://stackoverflow.com/a/27215795
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27235576
answers question: http://stackoverflow.com/q/27233958
score: 0
has body: Well this is bit complicated but seeing your rating on stack-exchange i assume you would be able to digest it: Well as we both know that a object comprises of data and methods. when ever we create an object the "data part/instance variable/fields (they are all same name for data that is global in a class) " of the object is stored in a data structure in the memory that we call heap space. This data structure can be referenced by "this pointer". So it means that if we have two different object they will have different this pointer. Methods do not have any independent allocation. When ever we execute a method like obj1.feature() it means apply the "feature" on obj1. During this process the run time system will pass "this pointer" of obj1 to "feature". Internal variable in a method are allocated space on a data structure called as frame that is pushed on the stack. any variable that is not declared inside the method is assumed to be in the global data structure and the pointer to it is appended automatically thus, globalvaraiabe becomes this.globalvariable So we can see clearly that if we pass different "this pointer" to the method they will access completely different memory locations and hence do not require thread synchronization.
type: Answer

http://stackoverflow.com/comment/42861702
type: Comment
type: QuestionComment
has text: I understood this but how to done this in java code
comment on: http://stackoverflow.com/q/27187437
score: 0

http://stackoverflow.com/q/27185265
has comment: http://stackoverflow.com/comment/42857681
has comment: http://stackoverflow.com/comment/42857683
score: -2
tagged with: java
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/27185358
has comment: http://stackoverflow.com/comment/42860130
favorite count: 0
answer count: 3
has body: It is giving error when operator is encountered in between.I know operator cannot be into converted int or other format.I am using operator for calculation by reading byte codes and passing it to enum defined.But as my string having operators so i am having prob in handling these.Please help me on this. My Inputs is 1 + 2 Expected Output-- 1 + 2=3 Error in line ---- b = Integer.parseInt(st.nextToken()); ------Error in during exceution----- Hello World Enter the series 1 + 2 1 + 2 no of tokens:3 yo 1 go 1 available byte info:10 ....... Exception in thread "main" java.lang.NumberFormatException: For input string: "+" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:484) at java.lang.Integer.parseInt(Integer.java:527) at Abc.main(Abc.java:42) I am not able to rectify it. Below is my code import java.io.*; import java.util.StringTokenizer; public class Abc{ public static void main(String[] args) throws Exception { System.out.println("Hello World"); System.out.println("Enter the series"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s=br.readLine(); int a=0; int b=0; System.out.println(s); while ((br.readLine()) != null) { StringTokenizer st=new StringTokenizer(s); while (st.hasMoreTokens()) { int i=0; i=st.countTokens(); System.out.println("no of tokens:"+i); String token = st.nextToken(); System.out.println("yo"); System.out.println(token); System.out.println("go"); a=Integer.parseInt(token); System.out.println(a); if (st.hasMoreTokens()) // before consuming another token, make sure { System.out.println("available"); byte b1=(byte)br.read(); System.out.println("byte info:"+b1); // there's one available if (st.hasMoreTokens()){ System.out.println("......."); b = Integer.parseInt(st.nextToken()); System.out.println("///////"); System.out.println(a); System.out.println("reached"); System.out.println(b); } if (b1==43) { System.out.println("go"); int foo = Integer.pa…
has answer: http://stackoverflow.com/a/27185338
has title: How can i calculate a string of operator and operands
has comment: http://stackoverflow.com/comment/42857676
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42857658
has answer: http://stackoverflow.com/a/27185352

http://stackoverflow.com/q/27238663
type: Question
has comment: http://stackoverflow.com/comment/42954754
tagged with: bluej
score: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/27238676
answer count: 1
tagged with: hashset
favorite count: 0
has answer: http://stackoverflow.com/a/27238676
has title: Why can't I add an object to a HashSet
has body: I am trying to populate a HashSet in the constructor with Penny objects but I'm not really sure how to do this. I have written this but I keep getting error messages. public Pocket(int numOfPennies){ HashSet penniesSet = new HashSet&lt;Penny&gt;(); while( penniesSet.size() &lt;= numOfPennies){ penniesSet.add(Penny); }
downvote count: 1
has comment: http://stackoverflow.com/comment/42954732
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42974736
type: Comment
comment on: http://stackoverflow.com/a/27248066
has text: thank you very very much, passing serializable id did the trick but i was passing id 1 which is present in my db then why it was giving exception,Any idea??
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42856067
score: 0
type: Comment
type: QuestionComment
has text: You dont need to touch R for any purpose.
comment on: http://stackoverflow.com/q/27184470

http://stackoverflow.com/a/34529170
downvote count: 0
has body: Your idea of having package name as variable is correct, but it must be final: public static final String appPackage = "com.mycurrentpackage"; Now you can use: @AndroidFindBy(id = appPackage+":id/startup_text1")
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27302104

http://stackoverflow.com/comment/42958741
has text: I did this to install it http://stackoverflow.com/questions/27233722/install-facebook-sdk-in-android-studio-0-8-14. And on a side note I am just trying to setup Facebook login if you know a good tutorial or could answer that...? Thanks
score: 0
comment on: http://stackoverflow.com/a/27241052
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43087400
score: 0
comment on: http://stackoverflow.com/q/27313447
type: QuestionComment
type: Comment
has text: Try to put it under src/main/resources?

http://stackoverflow.com/comment/42874003
comment on: http://stackoverflow.com/q/27193179
has text: Finally, I find and make sure. If I put mile and press Enter, the output is kilometer. other side too. However, when I put the kilometer, the changing mile is wrong. Can you tell me what's wrong? I put the textField1.addActionListener(new TextFieldHandler(){ }); textField2.addActionListener(new TextFieldHandler(){ }); next to container.add( textField2 ); line.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42872457
type: Comment
comment on: http://stackoverflow.com/a/27193292
score: 0
type: AnswerComment
has text: I'm talking in general terms. `super` isn't a method, it's a keyword; there are scenarios in which you do need to use the keyword.

http://stackoverflow.com/a/27247818
type: Answer
has body: I guess you wanted to test which Exception is gonna get caught, right? Then modify your code to throw just one Exception: try { t.throwAnotherException(); } catch (AnotherException e) { t.handleException(e); } catch (Exception e) { System.out.println(e.getClass().getName()); t.handleException(e); } which is working as expected.
answers question: http://stackoverflow.com/q/27247599
score: 0

http://stackoverflow.com/a/27172813
has body: To find path of your folder Right click on your folder name --> select Properties --> select Resource on left side --> third option is Location. That indicate the file location in your disk.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27167666

http://stackoverflow.com/comment/42992087
type: QuestionComment
comment on: http://stackoverflow.com/q/27259238
has text: Go to the command line and try `eclipse -clean`
score: 0
type: Comment

http://stackoverflow.com/comment/42874532
has text: Please post the code that is not working
comment on: http://stackoverflow.com/q/27194633
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27193633
has title: How to properly escape backslashes in JSON (using GSON for deserialization)
answer count: 1
has body: I've seen similar questions, but none seem to address the exact issue I'm encountering. I'm dealing with the deserialization of JSON strings, that look like this: { "dst_longitude":0, "alert_type":"watchlist", "dst_location":"unknown", "app":"testapp", "suppression_end_time":1309561548, "dstip":"", "app_session_id":44412, "client_bytes":0, "numbytes":0, "fromlogs":"yes", "dst_region":"unknown", "conn_duration":0, "dst_country":"unknown", "resp_cnt":8, "device":"unknown", "src_zipcode":"unknown", "req_cnt":8, "policy":"policy1", "server_bytes":0, "dstport":443, "type":"nspolicy", "access_method":"sophos", "dsthost":"dsttst", "dst_latitude":0, "timestamp":1309561548, "src_region":"unknown", "acked":"false", "suppression_start_time":1409561333, "alert":"yes", "user":"testd\cest.user", "srcip":"10.10.10.10", "org":"", "src_country":"unknown", "src_location":"unknown", "appcategory":"testapp", "src_latitude":0, "count":8, "dst_zipcode":"unknown", "url":"", "ccl":"medium", "alert_name":"testalert", "src_longitude":0, "_id":"544fd22eba91345ef252b21b" ,"os":"unknown", "browser":"unknown" } The problem appears to be in the backslash that separates the 'user' field into the domain and username tokens. Gson abruptly stops the parsing attempt and shows this error: Caused by: com.google.gson.ParseException: Encountered "\"" at line 1, column 582. Was expecting one of: &lt;DIGITS&gt; ... "null" ... "NaN" ... "Infinity" ... &lt;BOOLEAN&gt; ... &lt;SINGLE_QUOTE_LITERAL&gt; ... &lt;DOUBLE_QUOTE_LITERAL&gt; ... "{" ... "[" ... "-" ... at com.google.gson.JsonParserJavacc.generateParseException(JsonParserJavacc.java:658) at com.google.gson.JsonParserJavacc.jj_consume_token(JsonParserJavacc.java:540) at com.google.gson.JsonParserJavacc.JsonValue(JsonParserJavacc.java:182) at com.google.gson.JsonParserJavacc.Pair(JsonParserJavacc.java:89) The error is somewhat strange... It actually points to the first character in the 'user' field's value as the problem, which is claims is an escaped qu…
has comment: http://stackoverflow.com/comment/42873291
score: 0
has comment: http://stackoverflow.com/comment/42873203
linked to: http://stackoverflow.com/q/7258858
type: AnsweredQuestion
tagged with: escaping
has answer: http://stackoverflow.com/a/27193999
accepted answer: http://stackoverflow.com/a/27193999
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question

http://stackoverflow.com/comment/42926174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27224003
has text: You should run `/usr/libexec/java_home` to see which `JAVA_HOME` is going to be used by default.
score: 0

http://stackoverflow.com/comment/43068370
type: QuestionComment
has text: If the timezone you receive (JAP,DE) are java timezone formats, while constructing SimpleDateFormatter you can set that timezone and parse the date. Otherwise you may need to maintain mapping between incoming timezone & corresponding java timezone format to create a generic method.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27302560

http://stackoverflow.com/comment/43092797
comment on: http://stackoverflow.com/a/27308812
type: AnswerComment
score: 0
has text: i would like to know your feedback on whether this diagram make sense to you, can i picturise the working of java threads in this way? i need comments on that
type: Comment

http://stackoverflow.com/q/27279330
tagged with: selenium-webdriver
tagged with: java
has body: Im automating an external product where I dont have access to source code. this is the view source code What's new I want to click the last hyperlink after page load.Landing page has sso authentication, so i added implicit wait for 20 seconds after page load. java code driver = (WebDriver) new InternetExplorerDriver(capab1); driver.get("url"); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.findElement(By.xpath("//a[@href = 'CreateUserDocument.aspx?code=Presentation_PDF_RES_Mtg']")).click(); I use Selenium 2.44 library with 2.32 IEDriverServer.exe in 32 bit IE 9 browser. Any thoughts are appreciated.Thanks !
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/43027527
has comment: http://stackoverflow.com/comment/43081992
has title: Selenium Webdriver with IE 9 - No Such Element
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27288573
has comment: http://stackoverflow.com/comment/43028493
linked to: http://stackoverflow.com/q/20069737

http://stackoverflow.com/q/27306387
tagged with: tic-tac-toe
type: Question
has body: I'm having a setback in the code for a Tic Tac Toe Java program. Every time I run it, the game board prints 3 times and o the second time, the X's all fill in a line saying that player X wins. I've been trying to figure it out, but I still can't find the problem going on with it. What I'm asking is, what is the main problem of the code printing out more than it needs to and to stop filling in the lines? I hope I format this correctly. import java.util.Scanner; public class TicTacToeWork { //Variable declaration. public static char[][] GameBoard = new char[3][3]; public static Scanner keyboard = new Scanner(System.in); public static int column, row; public static char PlayerTurn = 'X'; public static void main(String args[]) { for (int i = 0; i &gt; 3; i++) { for (int j = 0; j &lt; 3; j++) { GameBoard[i][j] = '_'; } } System.out.println("Enter coordinates of row then column to choose your space."); Playing(); } public static void Playing() { boolean PlayerPlaying = true; while (PlayerPlaying) { boolean playing = true; while (playing) { row = keyboard.nextInt() - 1; column = keyboard.nextInt() - 1; GameBoard[row][column] = PlayerTurn; if (EndGame(row, column)) { playing = false; System.out.println("Game over player " + PlayerTurn + " wins!"); } BoardPrint(); if (PlayerTurn == 'X') { PlayerTurn = 'O'; } else { PlayerTurn = 'X'; } } } } public static void BoardPrint() { //Print out the game board. for (int i = 0; i &lt; GameBoard.length; i++) { for (int n = 0; n &lt; 3; n++) { System.out.println(); for (int j = 0; j &lt; 3; j++) { if (j == 0) { System.out.print("| "); } System.out.print(GameBoard[i][j] + " | "); } } System.out.println(); } System.out.println(); } public static boolean EndGame(int RowMove, int ColumnMove) { //Deciding factors on who wins and ties. if (GameBoard[0][ColumnMove] == GameBoard[1][ColumnMove] &amp;&amp; GameBoard[1][ColumnMove] == GameBoard[2][ColumnMove]) { return true; } if (GameBoard[RowMove][0] == GameBoard[1][RowMove] &amp;&amp; GameBoard[…
has comment: http://stackoverflow.com/comment/43075374
downvote count: 5
answer count: 1
has title: Java Tic-Tac-Toe, prints 3 boards
favorite count: 0
has answer: http://stackoverflow.com/a/27307783
upvote count: 2
type: UnansweredQuestion
score: -3
tagged with: java

http://stackoverflow.com/comment/42941978
has text: Check your code again. There should be some mistake. query like, String query= "DELETE FROM ANDYSHORT.DVDS WHERE ID = '?' "; will not work at all.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27229098

http://stackoverflow.com/q/27224758
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42927703
type: AnsweredQuestion
score: 3
tagged with: list
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27224888
has answer: http://stackoverflow.com/a/27224814
downvote count: 0
has answer: http://stackoverflow.com/a/27224806
possible better answer: http://stackoverflow.com/a/27224888
has title: Process Jobs from a list with Java Threads
answer count: 3
has comment: http://stackoverflow.com/comment/42927613
favorite count: 0
accepted answer: http://stackoverflow.com/a/27224814
has body: I have a program which has to process a list with many jobs. To speed up the whole things, I would like to implement Threads. I think about something like this: Main-Class // I have a joblist with 100 entries int iAmountThreads = 5; for(Job oJob : joblist) { //only execute 5 Jobs at the same time if(Thread.activeCount() &lt; iAmountThreads) { Runnable threadJob = new JobRunnable(oJob); Thread myThread = new Thread(threadJob); myThread.start(); } } //wait here until all jobs from the joblist are finished Runnable Class Implementing Runnable public class JobRunnable implements Runnable { private Job oJob; public JobRunnable(Job _oJob) { oJob = _oJob; } public void run() { //processing of the job } } I'm looking for a way to run 5 Jobs at the same time until the whole list is processed. When one Job is finished -> the next Thread shall start. Thanks for any help!

http://stackoverflow.com/comment/56765849
type: Comment
comment on: http://stackoverflow.com/a/27274985
score: 1
type: AnswerComment
has text: down voted it he took it copy and paste from the original auther without referring to him http://stackoverflow.com/questions/12303593/change-keyboard-input-language

http://stackoverflow.com/comment/43052375
score: 0
comment on: http://stackoverflow.com/a/27277383
type: AnswerComment
has text: I was first using the readLine() method of the InputDataStream and this method instead of blocking was returning null when there where not any data .I changed it to read()...now I just have to find a way to make it look elegant(if you see my code above)
type: Comment

http://stackoverflow.com/comment/43084538
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27310195
has text: Unfortunately it's not public! The pop up is not Javascript but rather an OS Level pop up for id card authentication. In your example code, can you run any Selenium code after the Robot commands? Looking for an element or loading a new page both works? I suspect there is a synchronization issue between where the Robot commands are sent and were Selenium pick up the Thread

http://stackoverflow.com/q/27200140
tagged with: java
answer count: 1
tagged with: inheritance
has title: Why are my WebViewClient methods not present?
score: 0
has body: Here is my code. As you can see in the first block of code, I set my WebView object "myWebView" to WebViewClient "SSLTolerantWebViewClient" which inherits from WebViewClient, yet none of the WebViewClient methods are showing up, so I can't use onPageFinished, for example. Any ideas? public class WebAuth extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web_auth); WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.setWebViewClient(new SSLTolerantWebViewClient()); myWebView.loadUrl("example.com"); //myWebView.onPageFinished(args); This method doesn't appear, nor do any other WebViewClient methods // other basic activity methods } Other class: public class SSLTolerantWebViewClient extends WebViewClient { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); // Ignore SSL certificate errors } }
tagged with: android
has answer: http://stackoverflow.com/a/27200605
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/43076324
type: Comment
score: 2
has text: These are semantic errors but they don't explain his compile errors.
comment on: http://stackoverflow.com/a/27306985
type: AnswerComment

http://stackoverflow.com/comment/42915767
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27218175
type: Comment
has text: And on the "code beautification" note: Fewer lines of code != cleaner/more readable/better code in all cases.

http://stackoverflow.com/a/34920059
has body: We will provide Gson with a little hook, a custom deserializer for booleans, i.e. a class that implements the JsonDeserializer<Boolean> interface: CustomBooleanTypeAdapter import java.lang.reflect.Type; import com.google.gson.*; class BooleanTypeAdapter implements JsonDeserializer<Boolean> { public Boolean deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (((JsonPrimitive) json).isBoolean()) { return json.getAsBoolean(); } if (((JsonPrimitive) json).isString()) { String jsonValue = json.getAsString(); if (jsonValue.equalsIgnoreCase("true")) { return true; } else if (jsonValue.equalsIgnoreCase("false")) { return false; } else { return null; } } int code = json.getAsInt(); return code == 0 ? false : code == 1 ? true : null; } } To use it we’ll need to change a little the way we get the Gson mapper instance, using a factory object, the GsonBuilder, a common pattern way to use GSON is here. GsonBuilder builder = new GsonBuilder(); builder.registerTypeAdapter(Boolean.class, new BooleanTypeAdapter()); Gson gson = builder.create(); For primitive Type use below one GsonBuilder builder = new GsonBuilder(); builder.registerTypeAdapter(boolean.class, new BooleanTypeAdapter()); Gson gson = builder.create(); Enjoy the JSON parsing!
answers question: http://stackoverflow.com/q/27176134
type: AcceptedAnswer
upvote count: 37
type: Answer
has comment: http://stackoverflow.com/comment/90756095
downvote count: 0
has comment: http://stackoverflow.com/comment/83328864
has comment: http://stackoverflow.com/comment/57576366
accepted answer of: http://stackoverflow.com/q/27176134
has comment: http://stackoverflow.com/comment/88648632
score: 37

http://stackoverflow.com/a/27289177
has body: I guess it is technically possible, if you are doing your git commits, etc from the command line. The Git book explains how to create tags ... http://git-scm.com/book/en/v2/Git-Basics-Tagging ... and you just need to create one with each commit. However, this doesn't seem like a good idea to me. Each git commit has a unique identifier, and creating a second one seems redundant.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27289045
type: Answer

http://stackoverflow.com/comment/42850511
score: 0
type: Comment
type: AnswerComment
has text: Different people rate the movies and they have there own email, and when i rate the film my email is used so i have to get all films rated except the ones that my email is in the row
comment on: http://stackoverflow.com/a/27180616

http://stackoverflow.com/a/27201317
has body: You may use this JSON library to parse your json string into JSONObject and read value from that object as show below : JSONObject json = new JSONObject(EntityUtils.toString(entity)); JSONObject sessionObj = json.getJSONObject("session"); System.out.println(sessionObj.getString("name")); You need to read upto that object from where you want to read value. Here you want the value of name parameter which is inside that session object, so you first get the value of session as JSONObject using getJSONObject(KeyString) and read name value from that object using function getString(KeyString) as show above. May this will help you.
accepted answer of: http://stackoverflow.com/q/27201201
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27201201

http://stackoverflow.com/q/27240839
type: Question
has title: How can I set limits on how many characters can be inputted? (Java)
has body: do{ out.println("\n---------------------------------"); out.println("---------------------------------"); out.print("Please type your acces card number: "); try{ card = input.nextInt(); if(card.length != 10){ out.println("The number you typed is incorrect"); out.println("The number must be 10 numbers long"); continue; } } catch(InputMismatchException ex){ } }while(true); Im trying to make card be 10 characters long. Like (1234567890), and if the user inputs (123) or (123456789098723) an error message should appear. card.length doesnt seem to work.
downvote count: 0
has comment: http://stackoverflow.com/comment/42958168
has answer: http://stackoverflow.com/a/27240868
has comment: http://stackoverflow.com/comment/42958229
possible better answer: http://stackoverflow.com/a/27240868
has answer: http://stackoverflow.com/a/27240863
favorite count: 0
linked to: http://stackoverflow.com/q/1306727
answer count: 4
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27241378
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27240863
has answer: http://stackoverflow.com/a/27240867

http://stackoverflow.com/q/27175665
answer count: 2
has answer: http://stackoverflow.com/a/27177789
score: 0
has comment: http://stackoverflow.com/comment/42895946
has comment: http://stackoverflow.com/comment/42865435
has answer: http://stackoverflow.com/a/27177640
has title: Dependency injection conflict when more than one user uses the system
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42844666
type: Question
has body: I made a single Java Application using Tomcat(Prod) and Jetty(Dev) + Hibernate + Spring + Spring MVC + Fremarker I have a issue to solve, 'cause the users are reporting that only one user can do login without conflict. If a user does login and tries to create a new entity Payment, he have a successfull transaction. But when another user does login, since then, nobody can create a new Payment. There is no exception, a POST is executed, but seems like the Controller is not able for delivery the form to services classes. @MappedSuperclass @Getter @Setter public abstract class AbstractEntity implements Persistable, Cloneable { //code... } @Entity @Getter @Setter public class Pagamento extends AbstractEntity{ //code... } @Component @Transactional public class PagamentoService { //code... } @Controller @RequestMapping("/payments") public class PagamentosController { //code... } Is everything okay about Annotations and CDI? What could to be happening?

import
type: Tag
tags question: http://stackoverflow.com/q/27306045
tags question: http://stackoverflow.com/q/27216131
tag name: import
tags question: http://stackoverflow.com/q/27261929
tags question: http://stackoverflow.com/q/27221227
tags question: http://stackoverflow.com/q/27257190
tags question: http://stackoverflow.com/q/27219932
tags question: http://stackoverflow.com/q/27309852

http://stackoverflow.com/comment/43038939
type: Comment
has text: I don't get it. How can `new Integer(5)` be autoboxed to `Double`? It is already an Object type.
comment on: http://stackoverflow.com/a/27285704
type: AnswerComment
score: 0

http://stackoverflow.com/q/27284653
has comment: http://stackoverflow.com/comment/43037628
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/43038330
type: UnansweredQuestion
has body: Hello i am having trouble with application. The panel holding the JTextArea is overlapping the panel containing the menuBar. I want to customize my GUI app but having trouble fixing the overlap. Below is my code: I imported all the apis needed. import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class ClientPanels extends JPanel{ private JMenu fileM, editM, styleM; private JTextArea textArea; private JMenuBar menuBar; private JScrollPane scpane; private JPanel panel1; private JPanel panel2; private JMenuItem aboutI, openI, saveI, cutI, copyI, pasteI, exitI; private GridBagConstraints g; public ClientPanels() { initialize(); } private void initialize(){ //initializing and setting up my data setLayout(new GridBagLayout()); textArea2 = new JTextArea(40, 50); JScrollPane scpane = new JScrollPane(textArea2); panel1 = new JPanel(new BorderLayout()); panel2 = new JPanel(new BorderLayout()); //menuitems openI = new JMenuItem("Open"); saveI = new JMenuItem("Save"); exitI = new JMenuItem("Exit"); copyI = new JMenuItem("Copy"); pasteI = new JMenuItem("Paste"); aboutI = new JMenuItem("About"); fileM = new JMenu("File"); editM = new JMenu("Edit"); styleM = new JMenu("Style"); fileM.add(openI); fileM.add(saveI); fileM.add(aboutI); fileM.add(exitI); editM.add(copyI); editM.add(pasteI); //adding the menu to the menuBars menuBar = new JMenuBar(); menuBar.add(fileM); menuBar.add(editM); menuBar.add(styleM); panel1.add(menuBar,BorderLayout.NORTH); panel2.add(scpane, BorderLayout.CENTER); //adding the sub-panels to the main panel addComp(panel1,0,0,0.5,0.0,0,0,GridBagConstraints.NORTHEAST,GridBagConstraints.HORIZONTAL); addComp(panel2,4,1,3,10,0,10, GridBagConstraints.WEST, GridBagConstraints.NONE); } //adding components to panel using GridBagLayout as the layout …
has comment: http://stackoverflow.com/comment/43037936
tagged with: swing
has answer: http://stackoverflow.com/a/27284843
has comment: http://stackoverflow.com/comment/43038368
tagged with: java
has comment: http://stackoverflow.com/comment/43038221
has comment: http://stackoverflow.com/comment/43037781
type: Question
has comment: http://stackoverflow.com/comment/43038018
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/43037915
has comment: http://stackoverflow.com/comment/43037417
has comment: http://stackoverflow.com/comment/43038425
score: 0
has comment: http://stackoverflow.com/comment/43038194
has comment: http://stackoverflow.com/comment/43037740
has comment: http://stackoverflow.com/comment/43037686
has comment: http://stackoverflow.com/comment/43037977
has title: Issues with GridBagLayout: TextArea overlapping MenuBar
answer count: 1

jtable
tags question: http://stackoverflow.com/q/27203345
tags question: http://stackoverflow.com/q/27302445
tags question: http://stackoverflow.com/q/27172937
tags question: http://stackoverflow.com/q/27202185
tags question: http://stackoverflow.com/q/27190095
tags question: http://stackoverflow.com/q/27157333
tags question: http://stackoverflow.com/q/27305461
tags question: http://stackoverflow.com/q/27156734
tags question: http://stackoverflow.com/q/27237777
tags question: http://stackoverflow.com/q/27251837
tags question: http://stackoverflow.com/q/27186639
tags question: http://stackoverflow.com/q/27267146
tags question: http://stackoverflow.com/q/27200738
tags question: http://stackoverflow.com/q/27250401
type: Tag
tags question: http://stackoverflow.com/q/27194787
tags question: http://stackoverflow.com/q/27301223
tags question: http://stackoverflow.com/q/27309624
tags question: http://stackoverflow.com/q/27231749
tags question: http://stackoverflow.com/q/27217419
tags question: http://stackoverflow.com/q/27211076
tags question: http://stackoverflow.com/q/27172559
tags question: http://stackoverflow.com/q/27242325
tags question: http://stackoverflow.com/q/27200346
tag name: jtable
tags question: http://stackoverflow.com/q/27190281
tags question: http://stackoverflow.com/q/27233588
tags question: http://stackoverflow.com/q/27168950
tags question: http://stackoverflow.com/q/27218687
tags question: http://stackoverflow.com/q/27196329
tags question: http://stackoverflow.com/q/27306328
tags question: http://stackoverflow.com/q/27287469
tags question: http://stackoverflow.com/q/27215585
tags question: http://stackoverflow.com/q/27219674
tags question: http://stackoverflow.com/q/27237857
tags question: http://stackoverflow.com/q/27268584
tags question: http://stackoverflow.com/q/27154532

http://stackoverflow.com/comment/43116989
score: 0
comment on: http://stackoverflow.com/q/27241651
type: Comment
type: QuestionComment
has text: Samsung's Android version is 4.4.2 and Sony's version 4.4.4

http://stackoverflow.com/q/27219914
score: 0
accepted answer: http://stackoverflow.com/a/27220548
has title: How to increase drawing speed of JPictureBox for large image?
has comment: http://stackoverflow.com/comment/42919452
tagged with: paint
has comment: http://stackoverflow.com/comment/42919118
tagged with: swing
has comment: http://stackoverflow.com/comment/42919055
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14115950
tagged with: java
has answer: http://stackoverflow.com/a/27220548
tagged with: image
type: Question
answer count: 1
tagged with: awt
has body: I have a JPictureBox extends from a java.awt.Component see code here http://pastebin.com/SAJc6Sht. But it only works well when there is no image stretching. Especially for the big picture, it slows program dramatically. How to increase drawing speed of JPictureBox for large image? @Override public void paint(Graphics g) { super.paint(g); int x = 0; int y = 0; int w = 0; int h = 0; if (image != null) { switch (sizeMode) { case AUTO_SIZE: case NORMAL: w = image.getWidth(); h = image.getHeight(); break; case CENTER_IMAGE: w = image.getWidth(); h = image.getHeight(); x = (getWidth() - w) / 2; y = (getHeight() - h) / 2; break; case STRETCH_IMAGE: w = getWidth(); h = getHeight(); break; case ZOOM: w = (int) Math.round(image.getWidth() * zoomFactor); h = (int) Math.round(image.getHeight() * zoomFactor); break; case FIT_BOTH: if (image.getWidth() &gt; image.getHeight()) { w = getWidth(); h = (int) (w / getAR()); if (h &gt; getHeight()) { h = getHeight(); w = (int) (h * getAR()); } } else { h = getHeight(); w = (int) (h * getAR()); if (w &gt; getWidth()) { w = getWidth(); h = (int) (w / getAR()); } } break; case FIT_WIDTH: w = getWidth(); h = (int) (w / getAR()); break; case FIT_HEIGHT: h = getHeight(); w = (int) (h * getAR()); break; } Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.drawImage(image, x, y, w, h, this); } else if (errorIcon != null) { w = errorIcon.getIconWidth(); h = errorIcon.getIconHeight(); x = (getWidth() - w) / 2; y = (getHeight() - h) / 2; errorIcon.paintIcon(this, g, x, y); } }
has comment: http://stackoverflow.com/comment/42918965

http://stackoverflow.com/comment/43056976
type: Comment
comment on: http://stackoverflow.com/a/27274410
has text: @Nijim : check my response, PHP and C# is for building API ;-)
type: AnswerComment
score: 0

http://stackoverflow.com/q/27165275
has comment: http://stackoverflow.com/comment/42824059
type: Question
has comment: http://stackoverflow.com/comment/42824800
tagged with: charts
has body: How to create a bar chart through a data from database using jsp.i created two tables in my database (1)cust_entry,(2)cust_response.so plz give me a correct code and which place put your code in my coding. Thanks in advance. thanks Customer Response <%@page import="java.sql.*" %> <%! String Name,date,Desg,Org,Add,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16; Connection con=null; Statement Stmt=null; // Statement Stmt1=null; // ResultSet rs=null; String drivername="com.mysql.jdbc.Driver"; String url="jdbc:mysql://106.197.161.194/WiproFeedBack.jsp/wipro"; String user="root"; String password ="root"; %> <% Name= request.getParameter("Person"); date= request.getParameter("Date"); Desg=request.getParameter("Designation"); Org=request.getParameter("Organisation"); Add=request.getParameter("Address"); Q1=request.getParameter("group1"); Q2=request.getParameter("group2"); Q3=request.getParameter("group3"); Q4=request.getParameter("group4"); Q5=request.getParameter("group5"); Q6=request.getParameter("group6"); Q7=request.getParameter("group7"); Q8=request.getParameter("group8"); Q9=request.getParameter("group9"); Q10=request.getParameter("group10"); Q11=request.getParameter("group11"); Q12=request.getParameter("group12"); Q13=request.getParameter("group13"); Q14=request.getParameter("group14"); Q15=request.getParameter("group15"); Q16=request.getParameter("group16"); %> <% try{ Class.forName(drivername); Connection con=DriverManager.getConnection(url,user,password); Statement Stmt = con.createStatement(); Stmt.executeUpdate("insert into cust_entry(Name,Date,Desg,Org,Address) values('"+Name+"','"+date+"','"+Desg+"','"+Org+"','"+Add+"')"); Stmt.executeUpdate("insert into cust_response(Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16) values('"+Q1+"','"+Q2+"','"+Q3+"','"+Q4+"','"+Q5+"','"+Q6+"','"+Q7+"','"+Q8+"','"+Q9+"','"+Q10+"','"+Q11+"','"+Q12+"','"+Q13+"','"+Q14+"','"+Q15+"','"+Q16+"')"); }catch(SQLException e) { System.out.println(e); } %> Name :<%=Name%> D…
score: -2
has title: Creating a bar chart using JSP
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/27438454
upvote count: 1
tagged with: bar-chart
possible better answer: http://stackoverflow.com/a/27168448
tagged with: jsp
has comment: http://stackoverflow.com/comment/42825580
has answer: http://stackoverflow.com/a/27168448
favorite count: 0
downvote count: 3
has answer: http://stackoverflow.com/a/27438454
has comment: http://stackoverflow.com/comment/42822892
has comment: http://stackoverflow.com/comment/42822810
type: AnsweredQuestion

http://stackoverflow.com/q/27215433
has comment: http://stackoverflow.com/comment/42911350
answer count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-tabhost
tagged with: dialog
tagged with: java
has title: How to declare a Numberpicker inside a Tabhost inside a Dialog?
type: Question
has body: I want to use a NumberPicker inside a Tabhostwhich is accessible through a Dialog. But How to define the NumberPicker? At the moment I'm doing this: NumberPicker np = (NumberPicker) d.findViewById(R.id.numberPicker); But this is not working. I get a NullPointerException in the line below (see code below). Any advice? or How to do it right? String[] array = {"1","2","3"}; public void dialog(){ final Dialog d = new Dialog(this); d.setTitle("Dialog"); d.setContentView(R.layout.dialog); d.setCanceledOnTouchOutside(false); TabHost tabHost = (TabHost) d.findViewById(R.id.tabHost); tabHost.setup(getLocalActivityManager()); tabHost.setup(); TabHost.TabSpec tab1 = tabHost.newTabSpec("Favs"); TabHost.TabSpec tab2 = tabHost.newTabSpec("All"); tab1.setIndicator("Favs"); tab1.setContent(R.id.tab1act); tab2.setIndicator("All"); tab2.setContent(R.id.tab2act); tabHost.addTab(tab1); tabHost.addTab(tab2); tabHost.setCurrentTab(0); NumberPicker np = (NumberPicker) d.findViewById(R.id.numberPicker); np.setMaxValue(array.length); //NullPointerException here np.setMinValue(1); np.setWrapSelectorWheel(true); np.setOnValueChangedListener(this); np.setDisplayedValues(array); np.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS); d.show(); } Logcat: 1-30 17:18:27.579 32038-32038/com.app.main E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.app.main.Main.dialog(Main.java:283) at com.app.main.Main$1.onClick(Main.java:142) at android.view.View.performClick(View.java:4475) at android.view.View$PerformClick.run(View.java:18786) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.Zy…
has comment: http://stackoverflow.com/comment/42910829
has comment: http://stackoverflow.com/comment/42911079
has comment: http://stackoverflow.com/comment/42910937
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42910871

http://stackoverflow.com/a/27227626
accepted answer of: http://stackoverflow.com/q/27226232
score: 1
answers question: http://stackoverflow.com/q/27226232
upvote count: 1
has comment: http://stackoverflow.com/comment/42932606
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42933037
downvote count: 0
type: Answer
has body: We solved this Problem in like this: public class CustomCellRenderer implements TableCellRenderer { //Use appropriate class here private final TableCellRenderer defaultTableCellRenderer= new JTable().getDefaultRenderer(Object.class); @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = defaultTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); // do custom stuff to c here ... return c; } } If you don't create a new Instance for the TableCellRenderer you get funky effects, because you change the tables default instance.

http://stackoverflow.com/q/27230896
upvote count: 1
has answer: http://stackoverflow.com/a/27231135
tagged with: java
has title: How to read a large json from a text file in android app?
tagged with: inputstream
possible better answer: http://stackoverflow.com/a/27231135
has answer: http://stackoverflow.com/a/27230996
tagged with: android-developer-api
has comment: http://stackoverflow.com/comment/42938744
has body: I have a text file in my android app which consist a json. I need to read and parse that json. File size is 21 mb. I am using following code to read file: StringBuilder stringBuilder = new StringBuilder(); InputStream input = getAssets().open(filename); int size = input.available(); byte[] buffer = new byte[size]; byte[] tempBuffer = new byte[1024]; int tempBufferIndex = 0; for(int i=0; i&lt;size; i++){ if(i == 0){ tempBuffer[tempBufferIndex] = buffer[i]; }else{ int mod = 1024 % i; if(mod == 0){ input.read(tempBuffer); stringBuilder.append(new String(tempBuffer)); tempBufferIndex = 0; } tempBuffer[tempBufferIndex] = buffer[i]; } } input.close(); Size int is 20949874 in real case. After loop is done stringBuilder length is always 11264 even if i change range of for loop. I tried to make one String from InputStream without using loop but it always gives me OutOfMemoryError Exception. I also get "Grow heap (frag case) to 26.668MB for 20949890-byte allocation" in my logs. I searched here and tried different solutions but did not make it work. Any idea how should i solve this issue. Thanks in advance.
type: AnsweredQuestion
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/42940970
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/121369082
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/27230996
answer count: 2

http://stackoverflow.com/comment/43059521
type: AnswerComment
type: Comment
has text: Try copying and pasting the above code and check the output.
comment on: http://stackoverflow.com/a/27297150
score: 0

http://stackoverflow.com/comment/43026928
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27278185
score: 0
has text: I edited the above with actual values ... it should be noted that in this instance the cliScores array has a lenght of 1 ... that will not always be the case

http://stackoverflow.com/comment/42888061
comment on: http://stackoverflow.com/q/27202340
has text: do u mean once a thread did its runnable job it will be dead, or something like that. sorry for the lack of understanding
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27250313
has comment: http://stackoverflow.com/comment/42986646
score: 0
has comment: http://stackoverflow.com/comment/42986910
has comment: http://stackoverflow.com/comment/42991580
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42986112
has comment: http://stackoverflow.com/comment/42986353
type: Answer
has body: You can get the Response, then read the body with Response.readEntity(Class type). post is overloaded, with options to return a Response or the entity body object (by specifying the class type as the second argument, as you are doing). If you don't specify the response entity type (as the second argument), it will return Response Response response = target.request().post(Entity.entity(..)); ResponseContainer container = response.readEntity(ResponseContainer.class); Map&lt;String, NewCookie&gt; cookies = response.getCookies(); response.close();
accepted answer of: http://stackoverflow.com/q/27249907
answers question: http://stackoverflow.com/q/27249907
has comment: http://stackoverflow.com/comment/42986573

http://stackoverflow.com/q/27281972
has body: I'm using the NetBeans GUI Builder, and I'm trying to create a kind of " Geogebra " . I have a problem with the definition of the paintComponent . I'd like to use an arraylist of geometric figure in my component which is an attribute of my JFrame But , it seems that java doesn't recognize the arraylist . here the part of the code where there's the problem : public GUI() { initComponents(); } public List&lt;Figure&gt; Liste = new ArrayList&lt;Figure&gt;(); /** * 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() { jDialog1 = new javax.swing.JDialog(); lblx = new javax.swing.JLabel(); lbly = new javax.swing.JLabel(); txtx = new javax.swing.JTextField(); txty = new javax.swing.JTextField(); btnOkPoint = new javax.swing.JButton(); jDialog2 = new javax.swing.JDialog(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); lblx1 = new javax.swing.JLabel(); lbly1 = new javax.swing.JLabel(); lblx2 = new javax.swing.JLabel(); lbly2 = new javax.swing.JLabel(); txtx1 = new javax.swing.JTextField(); txty1 = new javax.swing.JTextField(); txtx2 = new javax.swing.JTextField(); txty2 = new javax.swing.JTextField(); btnoksegment = new javax.swing.JButton(); MainPan = new javax.swing.JPanel(); GraphPan = new javax.swing.JPanel(){ @Override public void paintComponent(Graphics g ) { for (int i = 0; i &lt; this.Liste.size(); i++) { if(this.Liste.get(i) instanceof Pts){ Pts p = (Pts)this.Liste.get(i); g.fillOval((int)Math.round(p.x),(int)Math.round(p.y), 10, 10); } if(this.Liste.get(i) instanceof Segment) { Segment s = (Segment)this.Liste.get(i) ; Segment s = (Segment) this.Liste.get(i); g.drawLine(s.debut.x, s.debut.y, s.fin.x, s.fin.y); } } } };
answer count: 1
has title: Using an attribute in the paintComponent method
tagged with: paintcomponent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27282067
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/27282067
score: 0

http://stackoverflow.com/q/27297515
favorite count: 0
accepted answer: http://stackoverflow.com/a/27297597
tagged with: android
linked to: http://stackoverflow.com/q/21031488
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27297627
has answer: http://stackoverflow.com/a/27297597
tagged with: java
downvote count: 3
upvote count: 1
type: Question
tagged with: imageview
tagged with: layout
score: -2
has comment: http://stackoverflow.com/comment/43060444
tagged with: touch
has answer: http://stackoverflow.com/a/27297627
answer count: 2
has comment: http://stackoverflow.com/comment/43059397
has body: I want to build a "goals" layout on my app, but, i want that every time user touches a badge, there appears a hint on it for 2 seconds, then dissapear. Otherwise, if user touches outside de hint, it will also dissappear.
has title: How to show little hints on image touch android

http://stackoverflow.com/a/27265247
has body: You can add a test to check If the index == 0 , if it is then c:set a variable stockValue and then use it to create Hidden field. &lt;c:forEach items="${BooksTable}" begin="0" var="row"&gt; &lt;tr&gt; &lt;c:forEach items="${row}" var="cell" varStatus="rowIndex"&gt; &lt;c:if test="${rowIndex.index == 0}" &gt; &lt;c:set var="stockValue" value="${cell}" scope="page" /&gt; &lt;/c:if&gt; &lt;td&gt;${cell} &lt;BR&gt; &lt;BR&gt; &lt;/td&gt; &lt;/c:forEach&gt; &lt;c:set value="${$row.count}" scope="session" var="itemID" /&gt; &lt;td&gt;&lt;FORM ACTION="CartAccess"&gt; &lt;INPUT TYPE ="HIDDEN" NAME="item" VALUE="${stockValue}"&gt; &lt;INPUT TYPE="SUBMIT" NAME="check" VALUE="Add"&gt; &lt;/FORM&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt;
answers question: http://stackoverflow.com/q/27261807
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27261807

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/27179685
type: Tag
tags question: http://stackoverflow.com/q/27277357
tags question: http://stackoverflow.com/q/27305037
tags question: http://stackoverflow.com/q/27203042
tags question: http://stackoverflow.com/q/27286719
tags question: http://stackoverflow.com/q/27153549
tags question: http://stackoverflow.com/q/27232332
tags question: http://stackoverflow.com/q/27241611

http://stackoverflow.com/comment/132220388
score: 1
type: AnswerComment
has text: Support for `@SafeVarargs` does appear to be supported in Java 9 and later; however, the annotation still does not work in final classes as of Java 17.
type: Comment
comment on: http://stackoverflow.com/a/27208929

http://stackoverflow.com/q/27250271
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
answer count: 2
score: 2
linked to: http://stackoverflow.com/q/5990766
tagged with: jpa
downvote count: 0
tagged with: persistence
favorite count: 0
has answer: http://stackoverflow.com/a/27253164
has answer: http://stackoverflow.com/a/27250418
has body: I am using Hibernate3 I have a simple one to many relationship(Parent object has as set of child objects) if the child objects are added/removed, the version of the parent object is updated where as if the state of the child object is changed, the version of the parent is not getting updated. Here is the mapping - Category.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-mapping package="net.codejava.hibernate"> <generator class="native"/> <property name="name" column="NAME" /> <version name="version" type="integer" column="version" unsaved-value="null" /> <key column="CATEGORY_ID" not-null="true" /> <one-to-many class="Product"/> Product.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-mapping package="net.codejava.hibernate"> <generator class="native"/> <version name="version" type="integer" column="version" unsaved-value="null" /> <property name="name" column="NAME" /> <property name="description" column="DESCRIPTION" /> <property name="price" column="PRICE" type="float" /> <many-to-one name="category" class="Category" column="CATEGORY_ID" not-null="true"/> When the Product changes, Product.version is updated properly but the Category.version remains the same. I assume this is a cross cutting concern and there has to be a plausible solution for this. I did a lot of searching and could not find one. Please help me out
has title: Version of the parent object does not change when its child object's state changes
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/27271092
score: 2
tagged with: java
has body: My app needs to validate an X.509 certificate before sending username/password for verification. Client X.509 certificate is already installed on Android device in "Trusted Credentials". I am not sure now how to validate it. I am assuming the steps would be as follows but don't know how to use the java.security.cert or similar API to do this: From the "User" tab (not System), open my X.509 certificate and get reference to it. Validate things like - valid expiration, issuer, revocation list etc. Can someone help please? Thanks Sandeep
type: Question
has comment: http://stackoverflow.com/comment/43090039
downvote count: 0
tagged with: security
has title: Authenticate App using X.509 certificate on Android
has comment: http://stackoverflow.com/comment/43089265
tagged with: android
tagged with: x509certificate2
tagged with: x509certificate
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/27251677
downvote count: 0
tagged with: jersey-2.0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27251885
type: Question
upvote count: 1
tagged with: java
answer count: 1
has title: How implement rest jersey method that receives one or more String and return a String
has comment: http://stackoverflow.com/comment/42977653
type: UnansweredQuestion
has body: for eg. How implement rest jersey method that receives one or more String and return a String using this way or another way @GET @Path("/autenticate/{mail}/{passwd}") @Produces("text/plain") public String autenticate(@PathParam("mail") String mail, @PathParam("passwd") String passwd) { return "testok"; } public String autenticateUser(String mail, String passw) throws ClientErrorException { WebTarget resource = webTarget; resource = resource.path( java.text.MessageFormat.format("autenticate/{0}/{1}", new Object[]{mail, passw})); System.out.println(resource.getUri()); System.out.println(resource); return resource.request(javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class); } these above code return javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:929) at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:770) at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:90) at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:671) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:422) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:667) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:396) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:296)
tagged with: rest

http://stackoverflow.com/q/27272857
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27285552
tagged with: java
has answer: http://stackoverflow.com/a/27273042
type: AnsweredQuestion
has body: I can make a circular generic class dependency, but somehow I can not cast (without compile error) "this" instance into generic reference. As far as I know - it is impossible to create subclasses which break dependency in circular generic scenario. public class P { public static abstract class Network&lt;C extends Client&lt;N, C&gt;, N extends Network&lt;C, N&gt;&gt; { private C client; public void addClient(C client) { this.client = client; } } public static abstract class Client&lt;N extends Network&lt;C, N&gt;, C extends Client&lt;N, C&gt;&gt; { private N network; public void setNetwork(N network) { this.network = network; } public void attachOtherClient(C client) { network.addClient(client); } public void attachSelf() { attachOtherClient(this); //does not compile, but it is impossible to create subclasses that breaks this safety (i think) } } public static class TCP extends Network&lt;MK, TCP&gt; { } public static class MK extends Client&lt;TCP, MK&gt; { @Override public void attachSelf() { attachOtherClient(this); //compiles without problems } } } I apologize for my bad English. Thank you for help.
possible better answer: http://stackoverflow.com/a/27273042
type: Question
tagged with: subclass
has answer: http://stackoverflow.com/a/27285552
tagged with: generics
has title: Why java circular generic spec does not allow to cast "this" into generic instance

http://stackoverflow.com/a/27293682
answers question: http://stackoverflow.com/q/27293367
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Injecting repositories into Entities is not a good move. Entities are persisting structures and the repositories should manage entities not the other way around. Think of transaction demarcations and transient/detached instances. There's a better way to call a certain login upon adding an entity. You can use an event listener for this. You an configure a load listener that's also a Spring bean, so you can inject other services/repositories in this listener.

http://stackoverflow.com/a/27198432
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42881351
has comment: http://stackoverflow.com/comment/42881323
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42881333
accepted answer of: http://stackoverflow.com/q/27198367
score: 2
answers question: http://stackoverflow.com/q/27198367
has comment: http://stackoverflow.com/comment/42881805
has body: All I did was add an in.nextLine() to the catch clause to correct the code. in.nextLine(); System.out.println("Not a number. Try again"); count ++; Your Scanner object had a hanging end of line character left over from entering a non number that was being instantly picked up by in.nextFloat() on the 2nd iteration. Here's the full class you can run. import java.util.InputMismatchException; import java.util.Scanner; public class Sum { public static void main(String[] args) { float input = 0; float sum = 0; int count = 0; boolean attempt = true; Scanner in = new Scanner(System.in); while (attempt) { try { System.out.print("Enter a number: "); input = in.nextFloat(); sum += input; } catch(InputMismatchException e) { in.nextLine(); System.out.println("Not a number. Try again"); count ++; if (count &gt;=2) { attempt = false; } } } System.out.println("Sum: " + sum); } }
has comment: http://stackoverflow.com/comment/42881741
has comment: http://stackoverflow.com/comment/42881727

http://stackoverflow.com/a/27303232
accepted answer of: http://stackoverflow.com/q/27278290
score: 3
downvote count: 0
has body: You can add the image clickListener in getGroupView() method: @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.list_group, null); } ImageView lblListHeader = (ImageView) convertView.findViewById(R.id.lblListHeader); ImageView iconaModifica= (ImageView) convertView.findViewById(R.id.icona_modifica); iconaModifica.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // do your stuff here Toast.makeText(_context, "Group position: "+groupPosition, Toast.LENGTH_LONG).show(); } }); return convertView; } Update If you want to get clickListener in your activity, you can do it by implementing an interface. For this, you need: 1) Create your interface class public interface IExpandableListInterface { public void onClickIconaModifica(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent); // you can change the method parameters if you want } 2) Implement the interface in your activity and add the method: public class MainActivity extends Activity implements IExpandableListInterface{ public void onClickIconaModifica(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent){ // do your stuff here Toast.makeText(MainActivity.this, "Group position: "+groupPosition, Toast.LENGTH_LONG).show(); } } 3) Pass the interface to your adapter: listAdapter = new ExpandableListAdapter(this, this, listDataHeader, listDataChild); //PS: the first "this" is for the context and the second "this" is for the interface 4) Change your adapter constructor: private Context _context; private List&lt;String&gt; _listDataHeader; // header titles // child data in format of header title, child title private HashMap&lt;String, List&lt;Strin…
has comment: http://stackoverflow.com/comment/43080508
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43103672
has comment: http://stackoverflow.com/comment/43100959
answers question: http://stackoverflow.com/q/27278290
type: Answer

http://stackoverflow.com/comment/61969168
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27273494
has text: @DanPantry based on... What ? F# has it and it's better designed than c# it has nothing to do with lambda or whatnot, you just want to implement an interface inline. You are not a compiler.

http://stackoverflow.com/a/27314400
upvote count: 1
has body: You can not restart thread, but you can detect threads that were used multiple times;) Test code: package com.stackoverflow.test; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; public class TestOfCachedThreadPool { private static final int AMOUNT = 1000000; private static final class TestThread implements Runnable { private Map&lt;Long, Long&gt; mapOfUsage; private TestThread(Map&lt;Long, Long&gt; mapOfUsage) { this.mapOfUsage = mapOfUsage; } @Override public void run() { synchronized (mapOfUsage) { Long numberOfThreads=mapOfUsage.get(Thread.currentThread().getId()); if(numberOfThreads==null){ mapOfUsage.put(Thread.currentThread().getId(), 1l); }else{ mapOfUsage.put(Thread.currentThread().getId(), ++numberOfThreads); } } } } public static void main(String[] args) { ThreadFactory threadFactory = Executors.defaultThreadFactory(); final Map&lt;Long, Long&gt; mapOfUsage = new HashMap&lt;&gt;(AMOUNT * 2); ExecutorService service = Executors.newCachedThreadPool(); for(int i=0;i&lt;AMOUNT;i++){ service.execute(threadFactory.newThread(new TestThread(mapOfUsage))); } for(Map.Entry&lt;Long, Long&gt; entry: mapOfUsage.entrySet()){ if(entry.getValue()&gt;1){ System.out.println("Thread with id "+entry.getKey() +" was used "+entry.getValue()+ " times"); } } } } Output: Thread with id 9 was used 27198 times Thread with id 11 was used 1810 times Thread with id 13 was used 1294 times Thread with id 15 was used 3347 times Thread with id 17 was used 6709 times Thread with id 19 was used 7259 times Thread with id 21 was used 39335 times Thread with id 23 was used 13552 times Thread with id 25 was used 535 times Thread with id 27 was used 19533 times Thread with id 29 was used 113495 times Thread with id 31 was used 62713 times Thread with id 35 was used 94103 times Thread with id 33 was used 53641 times Thread with id 5328 was used 18922 times Thread with id 1…
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27313622
score: 1

http://stackoverflow.com/q/27244937
type: UnansweredQuestion
tagged with: nonlinear-optimization
type: Question
has title: Implementing nonlinear optimization with nonlinear inequality constraints with java
tagged with: java
has comment: http://stackoverflow.com/comment/43004001
score: 0
has answer: http://stackoverflow.com/a/27246671
tagged with: apache
answer count: 1
has body: How do I implement a nonlinear optimization with nonlinear constraints in java? I am currently using org.apache.commons.math3.optim.nonlinear.scalar.noderiv, and I have read that none of the optimizers (such as the one I am currently working with, SimplexOptimizer) take constraints by default, but that instead one must map the constrained parameters to unconstrained ones by implementing the MultivariateFunctionPenaltyAdapter or MultivariateFunctionMappingAdapter classes. However, as far as I can tell, even using these wrappers, one can still only implement linear or "simple" constraints. I am wondering if there is any way to include nonlinear inequality constraints? For example, suppose that My objective function is a function of 3 parameters: a,b,and c (depending on them non-linearly) and that additionally these parameters are subject to the constraint that ab Any advice that would solve the problem using just apache commons would be great, but any suggestions for extending existing classes or augmenting the package would also be welcome of course. My best attempt so far at implementing the COBYLA package is given below: public static double[] Optimize(double[][] contractDataMatrix,double[] minData, double[] maxData,double[] modelData,String modelType,String weightType){ ObjectiveFunction objective = new ObjectiveFunction(contractDataMatrix,modelType,weightType); double rhobeg = 0.5; double rhoend = 1.0e-6; int iprint = 3; int maxfun = 3500; int n = modelData.length; Calcfc calcfc = new Calcfc(){ @Override public double Compute(int n, int m, double[] x, double[] con){ con[0]=x[3]*x[3]-2*x[0]*x[1]; System.out.println("constraint: "+(x[3]*x[3]-2*x[0]*x[1])); return objective.value(x); } }; COBYLAExitStatus result = COBYLA.FindMinimum(calcfc, n, 1, modelData, rhobeg, rhoend, iprint, maxfun); return modelData; } The issue is that I am still getting illegal values in my optimization. As you can see, within the anonymous override of the compute function, I am printing ou…

http://stackoverflow.com/comment/43059107
type: Comment
comment on: http://stackoverflow.com/a/27297431
has text: I just realised that sorry
type: AnswerComment
score: 0

http://stackoverflow.com/q/27236217
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/27236579
possible better answer: http://stackoverflow.com/a/27236579
has answer: http://stackoverflow.com/a/27236235
accepted answer: http://stackoverflow.com/a/27236235
has comment: http://stackoverflow.com/comment/42949106
type: AnsweredQuestion
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/42948968
type: Question
has title: Why can't I add an element to a list from another class?
answer count: 2
has body: I have two classes, Pizza and PizzaTopping. In Pizza is an ArrayList which should store strings (the pizza topping). I am trying to add an element to the array from the ham method in the PizzaTopping class. However, when I print the list it shows to be empty. Why? Here is PizzaTopping: public class PizzaTopping { Pizza p = new Pizza(); public void ham() { double cost = 1; System.out.println("im in ham"); p.addToPizza("ham"); p.setCost(p.getCost() + cost); } } Here is my Pizza class: import java.util.ArrayList; import java.util.Arrays; public class Pizza { private double cost; ArrayList&lt;String&gt; pizza = new ArrayList&lt;String&gt;(); public double getCost() { return cost; } public void setCost(double cost) { this.cost = cost; } public void addToPizza(String x) { System.out.println("im in add"); pizza.add(x); } public static void main(String [] args) { //scanner to add topping PizzaTopping pt = new PizzaTopping(); Pizza p = new Pizza(); pt.ham(); System.out.println(Arrays.toString(p.pizza.toArray())); } }
tagged with: arrays

http://stackoverflow.com/q/27179201
has comment: http://stackoverflow.com/comment/42847527
favorite count: 0
has comment: http://stackoverflow.com/comment/42847741
type: Question
has answer: http://stackoverflow.com/a/27179479
answer count: 1
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27179479
has title: How to get list of timezones with cities?
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/42847936
has comment: http://stackoverflow.com/comment/42847910
type: AnsweredQuestion
tagged with: android
has body: can someone explain how to get list of timezones with GMT offset from current time? For instance: current time is 15:20 so items of list should be 16:20 UTC+1 Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna 17:20 UTC+2 Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius and so on If get cities so complicated just show how do this without it Regards!
has comment: http://stackoverflow.com/comment/42870541

http://stackoverflow.com/a/27159609
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27159543
has body: Your loop test should probably be while it's not equal to zero. Also, you need to get num again. // int num = cin.nextInt(); int num; do{ num = cin.nextInt(); System.out.println("num is " + num); if (num &gt; 0 &amp;&amp; num &lt;= str.size()) { System.out.println(str.get(num - 1)); } } while(num != 0);
answers question: http://stackoverflow.com/q/27159543
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27204311
answers question: http://stackoverflow.com/q/27181828
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: I ended up working around this by adding a rule to accommodate the star and the plus (only star shown below but the concept is the same for the plus): program returns [Program value] : PROGRAM d=zeroOrMoreDecl s=oneOrMoreStmt END {$value = new Program($d.value, $s.value);} ; zeroOrMoreDecl returns [ArrayList&lt;Declaration&gt; value] : {$value = new ArrayList&lt;Declaration&gt;();} (d=decl {$value.add($d.value);})* ; decl returns [Declaration value] : ... I'm not a fan of cluttering up the code but it was the only solution I found.
has comment: http://stackoverflow.com/comment/42927463
accepted answer of: http://stackoverflow.com/q/27181828
upvote count: 2

http://stackoverflow.com/comment/43087556
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27311384
has text: I have pasted the JSON in http://jsonlint.com/ and it says its a valid JSON
type: AnswerComment

filenotfoundexception
tags question: http://stackoverflow.com/q/27297292
tag name: filenotfoundexception
tags question: http://stackoverflow.com/q/27280053
tags question: http://stackoverflow.com/q/27313782
tags question: http://stackoverflow.com/q/27302683
tags question: http://stackoverflow.com/q/27270657
type: Tag
tags question: http://stackoverflow.com/q/27275456
tags question: http://stackoverflow.com/q/27227361

http://stackoverflow.com/q/27217512
type: Question
has title: Array index out of bounds exception java while using loops
has comment: http://stackoverflow.com/comment/42914700
tagged with: out
tagged with: bounds
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27217561
has body: Every few runs of my program it gives me the error at outlab6.Battleship.setShips(Battleship.java:75) at outlab6.Battleship.setBoard(Battleship.java:35) But I thought that I was already setting the code up so that those shouldn't happen. Can someone tell me what I did wrong and why it's not ignoring the possibilities that make that possible? package outlab6; import java.util.Scanner; public class Battleship { private int rows; private int cols; private Spot spot[][]; Scanner input = new Scanner(System.in); public Battleship(int rows, int cols){ this.rows = rows; this.cols = cols; } public void setBoard(){ spot = new Spot[rows][cols]; for(int i = 0; i &lt; rows; i++){ for( int j = 0; j &lt; cols; j++){ spot[i][j] = new Spot(); } } //setup board to be completely empty for(int i = 0; i &lt; rows; i++){ for(int j = 0; j &lt; cols; j++){ spot[i][j].setShip(0); } } // //test code // for(int i = 0; i &lt; rows; i++){ // for(int j = 0; j &lt; cols; j++){ // System.out.print(spot[i][j].getShip()); // } // System.out.println(); // } setShips(); } public void printBoard(boolean active){ } public boolean over() { return false; } public void makeGuess() { input.nextInt(); } public void printStatistics() { } public void setShips(){ //this method creates and places the ships //start with carrier and move on down for(int i = 5; i &gt; 1; i--){ int col; int row; boolean valid = false; //set a direction int direction = (int)(Math.random()*2)+1; //System.out.println(direction); //get a valid spot while(!valid){ //generate a location int chosenRow = (int)(Math.random()* rows)+1; int chosenCol = (int)(Math.random()* cols)+1; System.out.println("Row:" + chosenRow); System.out.println("Col:" + chosenCol); //check to see if spot is open //for horizontal ships if(chosenCol + i &lt; cols){ for(int j = 0; j &lt; i; j++){ if(spot[chosenRow][chosenCol + i].getShip() == 0){ valid = true; }else{ valid = false; } } }else{ //go through again } } } } }
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: loops
upvote count: 1
accepted answer: http://stackoverflow.com/a/27217561
has comment: http://stackoverflow.com/comment/42914699

http://stackoverflow.com/q/27304580
accepted answer: http://stackoverflow.com/a/27322483
tagged with: classloader
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27322483
tagged with: java
tagged with: hibernate
has body: I need to map Entities that are not listed at hibernate.cfg.xml, those classes are loaded dynamically from an arbitraty folder. I'm trying to register a ClassLoaderService to change the loading behavior, the following code runs fine if the classes are defined at compile time and exist in the classpath, but if I try to map a dinamically loaded class I get ClassNotFoundException. There are some questions about the same issue, but I didn't find any working solution. URL file = ConsultaBase.class.getProtectionDomain().getCodeSource().getLocation().toURI().resolve("implementacao/").resolve("hibernate.cfg.xml").toURL(); Configuration configuration = new Configuration() .addAnnotatedClass(Registro.class).configure(file); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder ( new BootstrapServiceRegistryImpl( new ClassLoaderServicePirilampo(Registro.class.getClassLoader()), new LinkedHashSet&lt;Integrator&gt;() ) ) .applySettings(configuration.getProperties()) .addService(ClassLoaderService.class, new ClassLoaderServicePirilampo()) .build(); //this line throws ClassNotFoundException sessionFactory = configuration.buildSessionFactory(serviceRegistry); I extended the ClassLoaderServiceImpl in order to log the requested classes, and noticed that running from JUnit, from the project where the classes are defined, it works fine, I get the class loading log from the Service. But the Service never receives the request for the same class if I addAnnotatedClass that was loaded dinamically (from GroovyClassLoader). The last line throws de folowing error: 17:06:49 ERROR [AssertionFailure] HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): java.lang.ClassNotFoundException: implementacao.Registro PersistentClass name cannot be converted into a Class org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class at org.hibernate.cfg.BinderHelper.getPropertyOverriddenBy…
type: Question
answer count: 1
score: 0
has title: Map Entities loaded dynamically from external jars or outside classpath
tagged with: groovy

http://stackoverflow.com/q/27180501
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27180615
has body: I'm working on a simple Java chat program, mostly to learn about UDP and how computers talk with one another. So far I have been able to set up the server to listen for the clients to connect to it, and I'm even able to redirect the messages from one client to another though the server - that is to say: Client A --> Server --> Client B I've gotten to the point where the server actually sends the packet (sock.send(packet)), but the catch is that the clients don't actually "know" to listen. They just know how to send to the server. I tried setting up a run() for the client, similar to what I have with the server, but as soon as I pull up two clients my program crashes because I'm trying to listen on the same port. Server code (Please ignore all the separator stuff, it's just a way I'm using to send different pieces of information for now): package com.jona.chat.UDP; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.sql.SQLException; import java.util.TreeMap; public class UDPServer extends Thread{ final int PORT_NUMBER = 4447; private String separator = "~!~--//1337"; //IGNORE THIS protected DatagramSocket sock = null; private TreeMap&lt;String,InetAddress&gt; nameIPTree = new TreeMap&lt;String,InetAddress&gt;(); //IGNORE THIS public static void main(String args[]) throws IOException{ UDPServer SERVER = new UDPServer(); //calls the run() method SERVER.start(); } public UDPServer() throws IOException{ sock = new DatagramSocket(PORT_NUMBER); } public void run(){ System.out.println("Waiting for Client"); while(true){ try{ //======================================================================================================== //Prepare the packet to receive data from client //======================================================================================================== //Buffer (byte array) that will receive the client's data byte[] buffer = new byte[512]; //Create a packet using…
possible better answer: http://stackoverflow.com/a/27180599
has answer: http://stackoverflow.com/a/27180599
score: 0
tagged with: udp
accepted answer: http://stackoverflow.com/a/27180615
tagged with: server-push
has title: How to get UDP Server to push to Client when another Client sends to server
tagged with: sockets

http://stackoverflow.com/q/27282037
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27282445
has title: Java Timestamp to BigInt for Impala
tagged with: talend
answer count: 1
downvote count: 0
favorite count: 0
has body: I am reading a text file which has a field in Timestamp in this format "yyyy-MM-dd HH:mm:ss" I want to be able to convert it to a field in Impala as BigInt and should like yyyMMddHHmmss in Java. I am using Talend for the ETL but I get this error "schema's dbType not correct for this component" and so I want to have the right transformation in my tImpalaOutput component
has answer: http://stackoverflow.com/a/27282445
tagged with: timestamp
type: AnsweredQuestion
score: 1
tagged with: impala
tagged with: java

http://stackoverflow.com/a/27274410
accepted answer of: http://stackoverflow.com/q/27274389
score: 0
has comment: http://stackoverflow.com/comment/43058245
has comment: http://stackoverflow.com/comment/43056729
type: AcceptedAnswer
has body: you have to create an API that receive those credentials and sent response to the Android Device. There are a lot of other technology / programming languages with whose you can create an API: C#, Java, PHP, etc. This is for Android Client: INTEGRATE A REST API INTO ANDROID APPLICATION IN LESS THAN 15 MINUTES If you prefer PHP as API: Create a RESTFULL API in PHP If you prefer c# as API: How to call .NET Web Api from Android App Note: this is possible to make the API with Java too if you want but I didn't have usefull links for that.
has comment: http://stackoverflow.com/comment/43019249
has comment: http://stackoverflow.com/comment/43056976
type: Answer
has comment: http://stackoverflow.com/comment/43058324
answers question: http://stackoverflow.com/q/27274389
has comment: http://stackoverflow.com/comment/43018926

http://stackoverflow.com/a/27202164
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27201967
answers question: http://stackoverflow.com/q/27201967
type: Answer
upvote count: 1
has body: If you ensure you have two or more spaces then this would help: phrase = phrase.substring(lastSpaceIndex + 1); int firstIndex = phrase.indexOf(' ', 0); int secondIndex = phrase.indexOf(' ', firstIndex + 1); int thirdIndex = phrase.indexOf(' ', secondIndex + 1); phrase = phrase.substring(0, phrase.indexOf(' ', thirdIndex)); System.out.println(phrase); If you ensure you have spaces between the word then you could do the following: String str[] = phrase.split(" "); StringBuilder stringBuilder = new StringBuilder(); for (int i =0; i&lt; Math.min(str.length, 3); i++) { stringBuilder.append(str[i] + " "); } System.out.println(stringBuilder.toString().replaceAll(" $", ""));

http://stackoverflow.com/q/27313171
type: Question
has comment: http://stackoverflow.com/comment/43087730
has title: while runnig Applet in the Browser it gives "java.io.FileNotFoundException" exception
has comment: http://stackoverflow.com/comment/43087347
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43086814
has comment: http://stackoverflow.com/comment/43087391
has comment: http://stackoverflow.com/comment/43086734
has comment: http://stackoverflow.com/comment/43087784
has comment: http://stackoverflow.com/comment/43087064
tagged with: applet
score: 0
has body: I have a java applet that is used to upload a file from local machine to a web service server. When I am running it in eclipse it is working fine. But when it is running i the Browser it is giving file not found exception. Anybody any idea why?? ////////////////////////HTML File Insert title here /////////////Applet code import java.applet.Applet; import java.awt.Graphics; import java.io.File; import java.io.IOException; import java.nio.file.Files; import javax.ws.rs.core.MediaType; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.LoggingFilter; import com.sun.jersey.core.util.Base64; @SuppressWarnings("serial") public class JarExampleApplet extends Applet { public static final String BASE_URI = "http://localhost:8080/RESTfulWS"; public static final String PATH_NAME = "/file/upload_json/"; public void init () { JarExampleApplet my_client = new JarExampleApplet(); File file_upload = new File("C:/Grails.pdf"); try{ my_client.sendFileJSON(file_upload); } catch(Exception ex) { System.out.println("Exception : " + ex); } } public void paint(Graphics g) { g.drawString("This Applet was read from a .jar file.", 0, 25); } public void sendFileJSON(File file_upload) throws JSONException, IOException{ ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); client.addFilter(new LoggingFilter()); WebResource resource = client.resource(BASE_URI); WebResource service = resource.path("rest").path(PATH_NAME); JSONObject data_file = new JSONObject(); data_file.put("file_name", file_upload.getName()); data_file.put("file", convertFileToString(file_upload)); ClientResponse client_response = service.accept(MediaType.APPLICATIO…
has comment: http://stackoverflow.com/comment/43086774
tagged with: rest
has comment: http://stackoverflow.com/comment/43087321
answer count: 0
type: UnansweredQuestion
tagged with: jersey-client

velocity
tags question: http://stackoverflow.com/q/27297317
type: Tag
tags question: http://stackoverflow.com/q/27182521
tag name: velocity

http://stackoverflow.com/a/27275110
has comment: http://stackoverflow.com/comment/43020825
downvote count: 0
has body: You really shouldn't be calling onTouch() at all. This is something that the Android system generates when there's a touch event, not something that you should be calling manually. If nothing else, how would you work out what MotionEvent to pass it? What you need to do is to call whatever method your onTouch() method invokes when a touch event comes in. Refactor your onTouch() so that it calls a method, with appropriate parameters, that behaves appropriately when a touch event occurs; and then have your onOptionsItemSelected() call that method too.
type: Answer
has comment: http://stackoverflow.com/comment/43019449
has comment: http://stackoverflow.com/comment/43019494
answers question: http://stackoverflow.com/q/27274935
has comment: http://stackoverflow.com/comment/43020971
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43020384

http://stackoverflow.com/comment/42941521
has text: @Gimby And you're right about CORS. This is indeed browser-dependent. For instance, [Chrome does not support localhost CORS](https://code.google.com/p/chromium/issues/detail?id=67743). But still, you can get around this with lvh.me.
comment on: http://stackoverflow.com/a/27230430
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27167197
upvote count: 1
answers question: http://stackoverflow.com/q/27166237
type: Answer
has body: Try this query, SELECT name FROM table having '2014-11-28' between start_date and end_date;
downvote count: 0
score: 1

http://stackoverflow.com/comment/98022463
has text: It shows this warning: Do not place Android context classes in static fields; this is a memory leak (and also breaks Instant Run)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/51087101
type: Comment

http://stackoverflow.com/a/27163319
has body: You can create an instance with Class.newInstance() or if a class is Cloneable you can create an instance (copy of another object) using Object.clone().
type: Answer
answers question: http://stackoverflow.com/q/27162872
score: 0

http://stackoverflow.com/a/35371315
upvote count: 2
answers question: http://stackoverflow.com/q/27205268
downvote count: 0
type: Answer
score: 2
has body: I have done something like this: arraylistofint.set(index, arraylistofint.get(index) + 1); here is an example from my code (modified names): ArrayList&lt;Integer&gt; numBsPerA = new ArrayList&lt;&gt; (); ... int cntAs = 0; int cntBs = 0; for ( TypeA a : AnArrayListOfAs ) { numBsPerA.add(0); for ( TypeB b : a.getAnArrayListOfBs() ) { numBsPerA.set(cntAs, numBsPerA.get(cntAs) + 1); cntBs++; } System.out.println(a.toString()+ " has " +numBsPerA.get(cntAs)+" TypeBs"); cntAs++; } System.out.println("Total number of As: "+cntAs); System.out.println("Total number of Bs: "+cntBs); // can now loop over numBsPerA to check how many Bs per A or whatever.

http://stackoverflow.com/q/27181397
answer count: 4
linked to: http://stackoverflow.com/q/3683174
has answer: http://stackoverflow.com/a/27183824
linked to: http://stackoverflow.com/q/8742617
has answer: http://stackoverflow.com/a/27183273
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/42851204
has comment: http://stackoverflow.com/comment/42851218
has answer: http://stackoverflow.com/a/57273806
tagged with: dialect
has answer: http://stackoverflow.com/a/75255089
has comment: http://stackoverflow.com/comment/42852003
score: 15
tagged with: persistence.xml
downvote count: 0
favorite count: 0
has body: In my application, I use Hibernate with SQL Server database, so I set &lt;property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"&gt; in my persistence.xml. In some case, I want to sort records with NULL include, I use keyword NULLS FIRST. Because it is not supported by default by CriteriaQuery/CriteriaBuilder in Hibernate, then I use Interceptor to modify the native query. The problem is, keyword NULLS FIRST is not supported in SQL Server, so I use keyword: case when column_name is null then 0 else 1 end, column_name If I want to migrate database from SQL Server to Oracle (for example), then I need to put if-else in my Interceptor, choosing which dialect I am using, right? This is how I illustrate them: String dialect = .............. if (dialect.equals("org.hibernate.dialect.SQLServerDialect")) { // get SQL Server dialect // put keyword "case when column_name is null then 0 else 1 end, column_name" } else { // put keyword "NULLS FIRST/LAST" } How I can get the dialect configuration (in persistence.xml) during runtime?
has comment: http://stackoverflow.com/comment/42854800
has title: How to get Hibernate dialect during runtime
linked to: http://stackoverflow.com/q/1571928
upvote count: 15

http://stackoverflow.com/q/27304407
tagged with: subset
upvote count: 1
type: AnsweredQuestion
has body: I am looking to come up with the following pattern of string subsequences: # input - ALEX # 1 - A, L, E, X # 2 - AL, AE, AX, LE, LX, EX # 3 - ALE, ALX, AEX, LEX # 4 - ALEX I wrote this, it comes up with most, but I am missing "LX","AE","ALX" and "AEX". Can I get those without adding a third loop? public class StringPermutations { public void stringPermutations(String input) { for(int i = 0; i&lt;input.length();i++){ for(int j = i; j&lt;input.length(); j++){ String s = input.substring(i,j+1); System.out.println(s); } } } public static void main(String[] args) { new StringPermutations().stringPermutations("ALEX"); } }
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43072025
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27304600
favorite count: 0
accepted answer: http://stackoverflow.com/a/27304600
has title: Missing some string subsequences from this algorithm

http://stackoverflow.com/comment/42932932
type: QuestionComment
comment on: http://stackoverflow.com/q/27227512
score: 0
has text: Hold on; why is there some `StringBuffer` in your trace here? Do you mean you generate a base64 string of _the whole file_ before sending it along? Why do you do that at all? Can you show your upload code?
type: Comment

http://stackoverflow.com/a/27224181
score: 1
type: AcceptedAnswer
downvote count: 0
has body: You will have to get the attributes of those tags by doing something like this: @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { int length = attributes.getLength(); for(int i=0; i&lt;length; i++) { // Qualified name by index String name = attributes.getQName(i); // Attribute value by index String value = attributes.getValue(i); // Namespace URI by index String nsUri = attributes.getURI(i); // Local name by index String lName = attributes.getLocalName(i); } } This will get all the attributes in the tag by the index. Source
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27223790
answers question: http://stackoverflow.com/q/27223790

http://stackoverflow.com/comment/43089489
comment on: http://stackoverflow.com/a/27313825
type: Comment
has text: Don't forget to escape the single-quotes in the JSP when injecting the JavaScript string literal.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27178584
upvote count: 2
answers question: http://stackoverflow.com/q/27172370
has comment: http://stackoverflow.com/comment/42848741
accepted answer of: http://stackoverflow.com/q/27172370
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42858242
has body: You could write a rule by extending TestWatcher public class DoNotRunOnProd extends TestWatcher { protected void starting(Description description) { { ProdAllowed annotation = description.getAnnotation(ProdAllowed.class); String env = CreditCheckSuite.getEnv().trim(); if ((annotation == null) &amp;&amp; !"DEV".equalsIgnoreCase(env) &amp;&amp; !"UAT".equalsIgnoreCase(env)) { throw new AssumptionViolatedException("Must not run on production.") } } } and add it to your test public class Test { @Rule public final TestRule doNotRunOnProd = new DoNotRunOnProd(); ... }
score: 2

http://stackoverflow.com/q/27286653
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: how to tell engine string containing html. i am using it for print command. its prints but html code not content. here is code String m=" Hello new line "; cmd[2] &= 0xEF; mService.write(cmd); mService.sendMessage(m, "GBK"); this is much needed please help. thanks
tagged with: java
has title: Android java - how to make string source of html
type: Question
has answer: http://stackoverflow.com/a/27286672
score: 0

http://stackoverflow.com/q/27226448
tagged with: java
has comment: http://stackoverflow.com/comment/42932688
upvote count: 1
has answer: http://stackoverflow.com/a/27227099
has comment: http://stackoverflow.com/comment/42931831
type: Question
has title: How to force Java applet to load using TLS1.0 / TLS1.1
tagged with: ssl
linked to: http://stackoverflow.com/q/27170001
accepted answer: http://stackoverflow.com/a/27227099
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42931061
score: 1
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/42930558
tagged with: java-8
type: AnsweredQuestion
has body: I have an web application from which multiple users loads a Java applet. Now there is a problem that the loadbalancer does not support TLS1.2 which is the default for Java8 and it seems that Java8 does not automatically try lower version. How can I force the applet to be loaded using TLS 1.0/1.1? I have tried to put this into the &lt;applet>: &lt;PARAM name="java_arguments" value="-Dhttps.protocols=TLSv1"&gt; Any help is appreciated, not very keen on solution where hundreds of users need to configure their Java clients. This the starting point from which this question was brought up: Java applet not loading on Java8/HTTPS

http://stackoverflow.com/comment/42825866
type: Comment
type: QuestionComment
has text: Your post not clear enough !
comment on: http://stackoverflow.com/q/27162250
score: 0

http://stackoverflow.com/a/27165989
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42834424
has body: You can use varStatus as well as var variable in c:forEach varStatus="loop" and use it as ${loop.index} e.g. see the example
answers question: http://stackoverflow.com/q/27165719
downvote count: 0

http://stackoverflow.com/q/27225140
has answer: http://stackoverflow.com/a/27331632
answer count: 5
type: UnansweredQuestion
tagged with: surefire
tagged with: maven
has answer: http://stackoverflow.com/a/27236076
has answer: http://stackoverflow.com/a/69680632
has title: Intermittent NoClassDefFoundError when running a maven/surefire build in jenkins
upvote count: 19
tagged with: jenkins
tagged with: java
has answer: http://stackoverflow.com/a/27392030
score: 19
has comment: http://stackoverflow.com/comment/42938327
type: Question
has comment: http://stackoverflow.com/comment/42928386
has body: We are building a large multi module Maven project on Jenkins, including running a large number of unit test. Once every few builds the build fails on NoClassDefFoundError on RunListener - which is located in the unit jar. As you can see from the log below - JUnit is included in the classpath. The error seems to appear completely at random. Log Waiting for Jenkins to finish collecting data [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project taboola-svc: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: A required class was missing while executing org.apache.maven.plugins:maven-surefire-plugin:2.17:test: org/junit/runner/notification/RunListener [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>org.apache.maven.plugins:maven-surefire-plugin:2.17 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/home/builder/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.jar [ERROR] urls[1] = file:/home/builder/.m2/repository/org/apache/maven/surefire/surefire-junit47/2.17/surefire-junit47-2.17.jar [ERROR] urls[2] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit48/2.17/common-junit48-2.17.jar [ERROR] urls[3] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit4/2.17/common-junit4-2.17.jar [ERROR] urls[4] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit3/2.17/common-junit3-2.17.jar [ERROR] urls[5] = file:/home/builder/.m2/repository/org/apache/maven/surefire/surefire-grouper/2.17/surefire-grouper-2.17.jar [ERROR] urls[6] = file:/home/builder/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.4/maven-shared-utils-0.4.jar [ERROR] urls[7] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-java5/2.17/common-java5-2.17.jar [ERROR] urls[8] = file:/home/bu…
has comment: http://stackoverflow.com/comment/43011700
has comment: http://stackoverflow.com/comment/42928982
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/27331560
favorite count: 0

http://stackoverflow.com/q/27252596
linked to: http://stackoverflow.com/q/9942928
score: 0
has comment: http://stackoverflow.com/comment/42980024
has comment: http://stackoverflow.com/comment/42983655
has comment: http://stackoverflow.com/comment/42981170
has comment: http://stackoverflow.com/comment/42980261
tagged with: http://stackoverflow.com/tag/html
has title: Unable to identify the element inside another html
has body: I've got a page like below and I 'm trying to identify the element DivToFind using selenium. But, as they are inside a frame and then inside another html, i'm unable to find it. I 've tried below. SwitchTo().frame() - Did not work Window handler swapping - there is only one window handler Any suggestions please? ........
has comment: http://stackoverflow.com/comment/42980477
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/42984598
has comment: http://stackoverflow.com/comment/42986374

http://stackoverflow.com/a/29244130
answers question: http://stackoverflow.com/q/27209863
score: 5
upvote count: 5
downvote count: 0
has body: It seems xml has to be removed as well: XWPFTableCell removed = tableRow.getCell(idx); removed.getCTTc().newCursor().removeXml(); tableRow.removeCell(idx);
has comment: http://stackoverflow.com/comment/84829291
has comment: http://stackoverflow.com/comment/47936803
type: Answer

http://stackoverflow.com/a/27259778
has body: If you want to do this without the help of libraries, then, try something like the following: private File[] compactor(File[] files) { int deleted = 0; for (int i = 0; i &lt; files.length; i++) { File file = files[i]; if (file.exists()) { files[i - deleted] = file; } else { files[i] = null; deleted++; } } int nSize = files.length - deleted; File[] newFiles = new File[nSize]; if (nSize &gt; 0) { System.arraycopy(files, 0, newFiles, 0, newFiles.length); } System.out.println(Arrays.toString(newFiles)); return newFiles; } Just check if any boundary conditions needs to be added.
answers question: http://stackoverflow.com/q/27258772
accepted answer of: http://stackoverflow.com/q/27258772
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/27211625
upvote count: 8
type: Answer
has body: In Java, types with generic type parameters, such as HashMap, only accept types that inherit from Object. long does not inherit from Object, so you can't use it with HashMap. You can however use Long, which is a boxed version of long.
answers question: http://stackoverflow.com/q/27211582
score: 8
downvote count: 0

http://stackoverflow.com/comment/44274496
type: Comment
score: 0
type: AnswerComment
has text: The major reason that I can think of is the scaling. You could take a look at [imgscalr](http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/) for an alternative
comment on: http://stackoverflow.com/a/27356904

http://stackoverflow.com/a/53238509
type: Answer
score: 1
upvote count: 1
has body: I was able to resolve this by storing the log files in a Amazon EC2 location where your web server is installed. I was storing in Amazon EC2 instance as my web server was hosted there. You can choose our own location. And then wrote a cron job inside my Spring boot application itself to copy these files from Amazon EC2 to Amazon S3 once in every 24 hours.
has comment: http://stackoverflow.com/comment/108941133
has comment: http://stackoverflow.com/comment/109012379
downvote count: 0
answers question: http://stackoverflow.com/q/27186137

recaptcha
tag name: recaptcha
tags question: http://stackoverflow.com/q/27297067
type: Tag

http://stackoverflow.com/q/27160797
type: UnansweredQuestion
downvote count: 3
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27160876
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42815222
answer count: 2
tagged with: variables
has title: how to get data from other methods?
favorite count: 0
has answer: http://stackoverflow.com/a/27162766
has body: does anyone know how to get the counters value transfered after it is increased? so if you awnser it right it changes to one in the next method? package swag; import java.util.Scanner; public class Main { public static void enter(){ System.out.print("welcome to the impossibe game! Press enter to start."); Scanner input = new Scanner(System.in); String enter = input.nextLine(); if (enter.equals("")){ System.out.println(" Level one"); }else{ System.out.println("Please press enter"); } } public static void firstlevel(){ System.out.println("What is the tenth digit of PI?"); Scanner input = new Scanner(System.in); int awnser = input.nextInt(); int awnser1 = 5; int counter = 0; if (awnser == awnser1 ){ System.out.println("Correct!"); counter++; System.out.println(" Score: " +counter + "/1"); }else{ System.out.println("Wrong!"); System.out.println(" Score:"+ counter+"/1"); } } public static void secondlevel(){ System.out.println("a king and queen get on a boat. then the boat sinks. how many people are alive"); Scanner input = new Scanner(System.in); String awnser = input.nextLine(); if (awnser.equals("two ")){ System.out.println(" Correct!"); } } public static void main(String args[]){ enter(); firstlevel(); } }

http://stackoverflow.com/q/27166288
score: 3
has answer: http://stackoverflow.com/a/27168561
linked to: http://stackoverflow.com/q/8419099
has title: eclipse.ini has been changed, but eclipse wont updated in Ubuntu 14.04
has body: First, i have done a lot of research and this is the answer i think the best : https://stackoverflow.com/a/17498043/1203797 According to that answer, my eclipse.ini should be on the same directory of my eclipse because i downloded it from the internet (not via terminal/software center). I need to change the RAM used by my eclipse because i keep getting GC overheat error when trying to run a big application. This is my eclipse.ini : -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 2048m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=2048m -Xms512m -Xmx2048m Note that i have updated the Xmx/Xms value, but : -product org.eclipse.epp.package.jee.product -vm /usr/bin/java eclipse.home.location=file:/home/tama/DEVELOPMENT/adt-bundle/eclipse/ eclipse.launcher=/home/tama/DEVELOPMENT/adt-bundle/eclipse/eclipse eclipse.launcher.name=Eclipse eclipse.p2.data.area=@config.dir/../p2/ eclipse.p2.profile=epp.package.jee eclipse.product=org.eclipse.epp.package.jee.product eclipse.startTime=1417076772881 eclipse.stateSaveDelayInterval=30000 eclipse.vm=/usr/bin/java eclipse.vmargs=-Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m That is what displayed in Eclipse Installation Detail (I know this from the answer i posted above). Please kindly help me, Thanks for your time.
tagged with: ubuntu
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27231184
has answer: http://stackoverflow.com/a/48773612
has answer: http://stackoverflow.com/a/27231184
downvote count: 0
has comment: http://stackoverflow.com/comment/42824647
favorite count: 0
accepted answer: http://stackoverflow.com/a/27168561
tagged with: linux
tagged with: android
answer count: 4
has comment: http://stackoverflow.com/comment/42824684
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42824599
has comment: http://stackoverflow.com/comment/42824719
has answer: http://stackoverflow.com/a/30511928
type: Question

http://stackoverflow.com/q/27278054
has body: is it possible to decrypt data which was encrypted with MS DPAPI? For example i want to decrypt a digital certificate from the windows registry. byte[] byteArray = (byte[]) Advapi32Util.registryGetValue(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\02FAF3E291435468607857694DF5E45B68851868", "Blob"); byte[] decrypted = Crypt32Util.cryptUnprotectData(byteArray); String stringDecrypted = new String(decrypted); System.out.println(stringDecrypted); But i get an Win32 Exception: Exception in thread "main" com.sun.jna.platform.win32.Win32Exception: Data are invalid. I don't found any information about this Exception. So what das this mean?? And could i decrypt these files like i want it or is it not possible? Thnaks for help!
type: AnsweredQuestion
tagged with: java
type: Question
has title: Decrypt Data which was encrypted with MS DPAPI with JNA
score: 0
tagged with: dpapi
answer count: 1
has answer: http://stackoverflow.com/a/27283584
accepted answer: http://stackoverflow.com/a/27283584
tagged with: jna
tagged with: encryption
tagged with: windows

http://stackoverflow.com/q/27296398
score: 3
has title: How to copy packages in IntelliJ without creating numerous fully-specified links to the old package
favorite count: 0
has body: To readers who like this question: I asked this question eight years ago (as of 2022) and there are only three upvotes. Please be aware that there are not many of us who need this feature and it is unlikely this will be supported by IntelliJ (or any modern IDE) for the foreseeable future. When I use IntelliJ to copy a package which contains subpackages, every internal references to other classes in the same package is converted to an ugly fully-qualified name. Worse yet, this fully-qualified name links back to the old package instead of to the copied class in the new package! Does anyone know a workaround for this problem? To reproduce this problem, I create a project structure like this: Where A.java is: package example; public class A { } And B. java is: package example; public class B { private A a; public B(A a) { this.a = a; } } I then Ctrl-C and Ctrl-V the example folder, and edit the dialog as below: The copied version of classB now has every instance of A replaced with example.A package example2; import example.*; public class B { private example.A a; public B(example.A a) { this.a = a; } } Does anyone have a suggested work-around to avoid this behavior, and simple change the package name, leaving everything else alone? Thanks! P.S. While version control is usually the best way to track different versions of a program, I want to create an actual copy in this case. I use IntelliJ for teaching programming, and I create multiple versions of small, multi-packaged programs demonstrating how the program improves as I model refactoring techniques. [Reported on Jet Brains here] 3.
has answer: http://stackoverflow.com/a/59907330
answer count: 5
tagged with: package
has answer: http://stackoverflow.com/a/27298366
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72244081
has answer: http://stackoverflow.com/a/34773520
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/27298366
type: Question
has answer: http://stackoverflow.com/a/29515607
tagged with: intellij-idea
downvote count: 0
tagged with: copy
accepted answer: http://stackoverflow.com/a/34773520

http://stackoverflow.com/comment/42991475
score: 0
type: Comment
type: QuestionComment
has text: Just a note on design ... If you have one class with just getter and setter and another with logic, you are most probably breaking encapsulation. One class with data and one class with logic is not the way to go. Can you think of a way to just remove the getters and setters ? And expose higher level operations ? That being said, I have no idea of what you are actually doing, so it might well make sense in your case.
comment on: http://stackoverflow.com/q/27258699

http://stackoverflow.com/q/27267508
has answer: http://stackoverflow.com/a/41592582
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/27267586
has title: Wait for user input while debugging on IntelliJ IDEA and Gradle
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/43013420
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/43013300
tagged with: java
has comment: http://stackoverflow.com/comment/43013462
tagged with: gradle
has comment: http://stackoverflow.com/comment/43013242
type: Question
has body: I have the simplest Java application that just works if executed from command line. But if I want to debug it through IntelliJ IDEA 14 Ultimate, the System.in.read() part always returns -1, without ever typing anything into it: import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { System.out.println("This is a test... Hit [enter] to exit."); int cha = System.in.read(); System.out.println("You hit [enter], exiting..."); } } Is this some kind of issue with Windows 8.1 or is it IntelliJ IDEA related? UPDATE: I have found out the issue presents itself only when starting the application through Gradle (gradlew run), so it's a Gradle issue. This is my build.gradle: apply plugin: 'java' apply plugin: 'application' sourceCompatibility = 1.7 targetCompatibility = 1.7 version = '1.0' mainClassName = 'net.frakbot.ws.Main' repositories { mavenCentral() } run { main = 'net.frakbot.ws.Main' standardInput = System.in } dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' }
answer count: 2

http://stackoverflow.com/a/27162301
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27161945
score: 1
has body: There are several ways to do this, One approach is (not the best approach) to utilize the same list view and change the adaptor inside on item click event. issue is you need to handle navigation manually, back button etc Other approach is to start new activity with another listview inside on item click event, this method is preferred because don't have to write bunch of code to handle navigation, back stack etc. Or else you can make use of fragments, two fragments with list views.
downvote count: 0

http://stackoverflow.com/a/27286035
answers question: http://stackoverflow.com/q/27284369
has comment: http://stackoverflow.com/comment/43080710
has body: As pointed out in the comments this doesn't seem to be the easiest way around this problem. Here is a solution which tries to follow your logic and includes the use of toUpperCase() and ArrayLists. Going over your code it looks like you were getting a bit lost in your logic. This is because you had one method trying to do everything. Break things down into smaller methods and you also will benefit by not having to repeat code and it keeps things much cleaner. The code below is tested with Java8 (although there is no reason why this should not work with Java 7). public static void main(String args[]) { String word1 = "Hello"; String word2 = "Hlelo"; transposable(word1, word2); } private static boolean transposable(String word1, String word2) { // Get an ArrayList of characters for both words. ArrayList&lt;Character&gt; word1CharacterList = listOfCharacters(word1); ArrayList&lt;Character&gt; word2CharacterList = listOfCharacters(word2); boolean areWordsEqual; // Check that the size of the CharacterLists is the same if (word1CharacterList.size() != word2CharacterList.size()) { return false; } // check to see if words are equal to start with areWordsEqual = checkIfTwoWordsAreTheSame(word1CharacterList, word2CharacterList); System.out.print("\n" + "Words are equal to be begin with = " + areWordsEqual); if (!areWordsEqual) { /* This loop i must start at 1 because you can't shift an ArrayList index of 0 to the left! Loops through all the possible combinations and checks if there is a match. */ for (int i = 1; i &lt; word1CharacterList.size(); i++) { ArrayList&lt;Character&gt; adjustedArrayList = shiftNeighbouringCharacter(word2CharacterList, i); areWordsEqual = checkIfTwoWordsAreTheSame(word1CharacterList, adjustedArrayList); System.out.print("\n" + "Loop count " + i + " words are equal " + areWordsEqual + word1CharacterList + adjustedArrayList.toString()); if (areWordsEqual) { break; } } } return areWordsEqual; } // takes in a String as a parameter and returns an ArrayLis…
has comment: http://stackoverflow.com/comment/43097470
score: 0
has comment: http://stackoverflow.com/comment/43097715
type: Answer
has comment: http://stackoverflow.com/comment/43080733

http://stackoverflow.com/comment/42948269
type: Comment
score: 0
has text: It does not work if I have an input as this: some text [(XX)(A.KEY)some_text] write blah blah [(XX)(OTHER.VAL)some_more_text] hi hello. The simple intention is finding the keys (A.KEY, OTHER.VAL) following every occurrence of (XX).
type: AnswerComment
comment on: http://stackoverflow.com/a/27154068

http://stackoverflow.com/comment/42992412
comment on: http://stackoverflow.com/q/27259453
has text: Try adding the server dependencies to your classpath..Right-click on your project and then Targeted Runtimes. Make sure you have your server .jar files associated with your project.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27226841
has body: You can't invoke ThrowErrorIfExists with a null parameter, as you invoke a method (hasErrors() on it. This has nothing to do with any mocking, but it is just an error in your method. You use a matcher to call the method Exception.throwErrorIfExists(any(Object.class)); which is quite strange; matchers are used to configure the behaviour of a mock like PowerMockito.doNothing().when(Exception.throwErrorIfExists(any(Object.class))); Then you can call throwErrorIfExists with any object to trigger the "do nothing".
answers question: http://stackoverflow.com/q/27226679
score: 0
has comment: http://stackoverflow.com/comment/43079042
type: Answer

http://stackoverflow.com/q/27185792
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42858523
possible better answer: http://stackoverflow.com/a/27186231
answer count: 3
has answer: http://stackoverflow.com/a/27188307
has comment: http://stackoverflow.com/comment/42858687
has title: java user input for Array - split by space
has body: All, Below code is working fine with the ArrayList. could you please help me on how to get user input for name gender and amountSpent (array size [4]), then split it by spaces so that it will have String, String and double. Also, How to display the result of only the customer who has higher amount Spent then the other Customers. thank you in advance! Regards, Viku import java.util.Comparator; public class Customer implements Comparable &lt;Customer&gt;{ public String name,gender; public double amountSpent; public Customer(String name, String gender, double amountSpent) { super(); this.name = name; this.gender = gender; this.amountSpent = amountSpent; } public String getCustomername() { return name; } public void setCoustomername(String name) { this.name = name; } public String getgender() { return gender; } public void setGender(String gender) { this.gender = gender; } public double getamountSpent() { return amountSpent; } public void setamountSpent(double amountSpent) { this.amountSpent = amountSpent; } public static Comparator &lt;Customer&gt; CustomerNameComparator = new Comparator&lt;Customer&gt;() { public int compare(Customer c1, Customer c2) { String custName1 = c1.getCustomername().toUpperCase(); String custName2 = c2.getCustomername().toUpperCase(); //ascending order //return custName1.compareTo(custName2); //descending order return custName2.compareTo(custName1); } }; public static Comparator &lt;Customer&gt; CustomerAmountSpentComparator = new Comparator&lt;Customer&gt;() { public int compare(Customer aS1, Customer aS2) { int custamtspent1 = (int) aS1.getamountSpent(); int custamtSpent2 = (int) aS2.getamountSpent(); //ascending order sort // return custamtspent1 - custamtSpent2; //descending order sort return custamtSpent2 - custamtspent1; } }; @Override public int compareTo(Customer o) { return 0; } @Override public String toString() { return " Customer Name : " + name + ", Gender : " + gender + ", Amount Spent : " + amountSpent + ""; } } and Main Progra…
favorite count: 0
has answer: http://stackoverflow.com/a/27189698
accepted answer: http://stackoverflow.com/a/27189698
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/27186231

http://stackoverflow.com/q/27213234
has body: Hello i have a question and i hope to find some answers i want to create a binary tree in pep8 to make some prefix arithmetic so to do 2+3 the user have to enter + 3 2 to do (3*2)-3 the user have to enter - * 3 2 3 i did it in java and it's : class BinaryTree { public char opt;// = {*,+,/,-} public int val; public char variable ='\0'; public boolean feuille = true; public BinaryTree left; public BinaryTree right; } other question : i have done all the code in java , can i see the assembly code of my java programm? so after that i will create a pep8 programm using the assembly code
favorite count: 0
tagged with: binary-tree
tagged with: assembly
has comment: http://stackoverflow.com/comment/42907520
has comment: http://stackoverflow.com/comment/42907896
has title: how to create binary tree in pep8 OR see the assembly code of java code
tagged with: pep8-assembly
answer count: 0
has comment: http://stackoverflow.com/comment/42907985
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42907262
has comment: http://stackoverflow.com/comment/42907859
has comment: http://stackoverflow.com/comment/42907315
has comment: http://stackoverflow.com/comment/42918160
tagged with: tree
has comment: http://stackoverflow.com/comment/42907716
has comment: http://stackoverflow.com/comment/42907271
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1

http://stackoverflow.com/q/27275280
downvote count: 1
has title: Custom JSON Serialization & Deserialization
tagged with: jackson
has comment: http://stackoverflow.com/comment/43033818
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27280032
favorite count: 0
type: Question
tagged with: scala
answer count: 1
has body: I have a JSON where I do not yet know what concrete parameters it could contain. Without this I cannot use the annotations that would do the serialization &amp; de-serialization out of the box. For example., for the following JSON: { .... .... DynamicField : { "field1" : { } "field2" : { "url" : "some url" "something" : "Something else" } ... ... } How can I now properly serialize and de-serialize the DynamicField? I'm using the faster jackson library.
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has answer: http://stackoverflow.com/a/27280032

http://stackoverflow.com/comment/42863373
comment on: http://stackoverflow.com/a/27177013
type: AnswerComment
type: Comment
score: 1
has text: That error may suggest two things: 1) There's no method called valueChanged()` defined in `TreeSelectionListener` (which is false) 2) Import to `javax.swing.event.TreeSelectionListener` is missing, so the IDE thinks you are trying to define a new inner class (different from standard `TreeSelectionListener`) and warns you there's no upper class method called `valueChanged()`. Just check for that import and all go well. And don't forget the wider scope/non-anonymous class advice :) @Java.beginner

http://stackoverflow.com/a/31001722
has body: You can use the below program from github: https://github.com/Smerity/cc-warc-examples/blob/master/src/org/commoncrawl/examples/WARCReaderTest.java
answers question: http://stackoverflow.com/q/27152830
score: 0
type: Answer

http://stackoverflow.com/comment/43042670
score: 0
comment on: http://stackoverflow.com/q/27288009
type: Comment
type: QuestionComment
has text: Um, the second version?

http://stackoverflow.com/a/27205219
upvote count: 3
type: Answer
score: 3
answers question: http://stackoverflow.com/q/27204239
has body: You can simply do it using spring security, Add below lines in spring-security.xml beans: Using SHA-512, &lt;authentication-manager&gt; &lt;authentication-provider user-service-ref="userDetailsService"&gt; &lt;password-encoder hash="sha-512" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; or Using md5: &lt;authentication-manager&gt; &lt;authentication-provider user-service-ref="userDetailsService"&gt; &lt;password-encoder hash="md5" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; About UserDetailsService: UserDetailsService provide method to load user by username. More about UserDetailsService If you want to load user by any other attribute like email or mobile number then u need to write custom class which implements UserDetailsService and write your implemetation in that class. Refer this link for custom userDetailsService implementation
downvote count: 0

http://stackoverflow.com/a/27204350
has body: How about this? ArrayList&lt;HashMap&lt;String, List&lt;String&gt;&gt;&gt; eventosList = new ArrayList&lt;HashMap&lt;String, List&lt;String&gt;&gt;&gt;(); HashMap&lt;String, List&lt;String&gt;&gt; contact = new HashMap&lt;String, List&lt;String&gt;&gt;(); contact.put("id", list1); contact.put("name", list2); eventosList.add(contact);
type: Answer
answers question: http://stackoverflow.com/q/27204250
score: 0

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/27181546
type: Tag
tags question: http://stackoverflow.com/q/27220044

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/27191357

http://stackoverflow.com/a/27188581
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27188410
has comment: http://stackoverflow.com/comment/42863462
has comment: http://stackoverflow.com/comment/42863394
has body: You have already answered all questions yourself. Using a base class such as Shape which contains height and width. Then 2DShape and 3DShape which extend Shape class and define their own instance variables. Also Shape class can have abstract methods to define area, volume etc. No, you cannot do that. Yes, since an int's value is by default 0, it will return 0.
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42863470
accepted answer of: http://stackoverflow.com/q/27188410

http://stackoverflow.com/a/27244433
accepted answer of: http://stackoverflow.com/q/27244369
answers question: http://stackoverflow.com/q/27244369
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has body: For this to be possible, it would require different browsers to share some information (e.g. session id, cookie value). Since even the Web Storage introduced in HTML5 is not shared across browsers, you can't do this without the assistance of browser plugins (note: you could do this with a Java Applet, but it would require users approval to share information with other browsers e.g. via files). The most that you could do is check the IP of the client, and at server side you could tell if there is already a logged in user from the same IP but we all know the IP can be the same for many users that are behind a proxy server for example, so this solution is not satisfactory but could be sufficient in some limited cases e.g. if the web application is only used from a local network (and where IP uniqueness can be guaranteed).
downvote count: 0

http://stackoverflow.com/comment/43340900
has text: I meant the Android SDK version number that you use to build your app/game. Let me add the broadcast test that I did manually, hold on. (which DOES work)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27205375

http://stackoverflow.com/comment/42803139
type: QuestionComment
comment on: http://stackoverflow.com/q/27154189
score: 0
has text: Great, now that we know you use InnoDB, it would be great to show the whole query + isolation levels that you have set up. Also, you are using an extremely old style of joining, is there any chance you would be open to changing how you perform the `SELECT` so it's more efficient and readable?
type: Comment

http://stackoverflow.com/a/42256557
type: Answer
has body: Consider using Assert4J: import static org.assertj.core.api.Assertions.assertThat; @Test public void test() { final List&lt;String&gt; result = classUnderTest.someMethod(); assertThat(result).containsExactly("Customer1", "Customer2", "Customer3"); } You'll get very descriptive error failure messages this way: java.lang.AssertionError: Expecting: &lt;[5544, 8811, 9988]&gt; to contain exactly (and in same order): &lt;["Customer1", "Customer2", "Customer3"]&gt; but some elements were not found: &lt;["Customer1", "Customer2", "Customer3"]&gt; and others were not expected: &lt;[9988, 8811, 5544]&gt;
score: 0
answers question: http://stackoverflow.com/q/27281306

http://stackoverflow.com/q/27211012
linked to: http://stackoverflow.com/q/27181507
score: 27
answer count: 1
downvote count: 0
has body: I have a POJO given below which I want to PUT to the server as JSON or XML. This is what I have done CLIENT: ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); WebTarget target = client.target(getBaseURI()); public void putFriend(String uri , Friend friend) { System.out.println(friend.toString()); target = target.path(some_path).path(uri); ClientResponse response = target.request(MediaType.APPLICATION_JSON).put(Entity.entity(friend,MediaType.APPLICATION_JSON),ClientResponse.class); } Examples I found on web were using WebResource. I don't know how to do using WebTarget. What I have done is taken from some example found on SO but Entity.entity() gives error undefined method entity(friend, String). POJO @XmlRootElement public class Friend{ private String friendURI; private String event; private String uri; String getUri() { return uri; } void setUri(String uri) { this.uri = uri; } String getFriendURI() { return friendURI; } void setFriendURI(String friendURI) { this.friendURI = friendURI; } String getEvent() { return event; } void setEvent(String event) { this.event = event; } public String toString() { return "Friend [friendURI=" + friendURI + ", uri=" + uri + ", event=" + event + "]"; } Please guide how to do this. Thanks
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27211173
accepted answer: http://stackoverflow.com/a/27211173
upvote count: 27
tagged with: jersey-client
type: AnsweredQuestion
has title: how to send json object from REST client using javax.ws.rs.client.WebTarget
tagged with: java
type: Question

http://stackoverflow.com/comment/43053146
score: 0
type: Comment
type: QuestionComment
has text: You have unbalanced parentheses in your example ( 4 left, 3 right) - is that a correct example?
comment on: http://stackoverflow.com/q/27284783

http://stackoverflow.com/q/27224577
favorite count: 0
has comment: http://stackoverflow.com/comment/42927438
has answer: http://stackoverflow.com/a/27225957
has answer: http://stackoverflow.com/a/27224630
linked to: http://stackoverflow.com/q/12032292
has comment: http://stackoverflow.com/comment/42927237
possible better answer: http://stackoverflow.com/a/27225653
downvote count: 1
has answer: http://stackoverflow.com/a/27225653
has answer: http://stackoverflow.com/a/59942117
type: AnsweredQuestion
tagged with: object
tagged with: clone
tagged with: java
linked to: http://stackoverflow.com/q/6101311
score: 17
upvote count: 18
has title: Why is Object.clone() native in Java?
linked to: http://stackoverflow.com/q/557574
type: Question
accepted answer: http://stackoverflow.com/a/27225957
tagged with: native
has body: The clone method on Object, which creates an exact copy of an object, is declared as: protected native Object clone() throws CloneNotSupportedException; Why is it native?
has comment: http://stackoverflow.com/comment/42927534
linked to: http://stackoverflow.com/q/869033
has comment: http://stackoverflow.com/comment/42927663
has comment: http://stackoverflow.com/comment/42928451
answer count: 4

http://stackoverflow.com/a/27153770
score: 2
has body: Your Titlescreen doesn't have an addKeyListener(...) method and does not extend any class that has this method, and so the compiler is rightly complaining that you're calling a method that does not exist for this class. You have several options: Give Titlescreen an addKeyListener(...) method, but then you'll have to figure out what the method body should have, i.e., just what will you be adding the KeyListener to inside of the method body. Have Titlescreen extend a Swing component such as a JPanel, one that has its own addKeyListener(...) method. I'm guessing that this is what you wanted to do, but forgot to do this, but I'm not sure, given the information you've posted so far. Note that if you did do this, you will need to make sure that the listened to component is 1) focusable and 2) has the app's focus when you want the KeyListener to function. Just get rid of your this.addKeyListener(...) method call. Most important is the reason why you're even making this call, and perhaps something better can be done.
upvote count: 2
has comment: http://stackoverflow.com/comment/42801919
has comment: http://stackoverflow.com/comment/42802342
answers question: http://stackoverflow.com/q/27153726
has comment: http://stackoverflow.com/comment/42801934
has comment: http://stackoverflow.com/comment/42802336
has comment: http://stackoverflow.com/comment/42802398
downvote count: 0
has comment: http://stackoverflow.com/comment/42801993
type: Answer

http://stackoverflow.com/q/27218177
downvote count: 0
has comment: http://stackoverflow.com/comment/42916259
favorite count: 0
has comment: http://stackoverflow.com/comment/42916621
tagged with: classloader
has comment: http://stackoverflow.com/comment/50289075
has title: Access static method from classes loaded by different ClassLoaders
score: 11
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42920898
tagged with: java
has answer: http://stackoverflow.com/a/31153720
type: Question
has comment: http://stackoverflow.com/comment/42925123
has comment: http://stackoverflow.com/comment/43360294
has answer: http://stackoverflow.com/a/34031990
has comment: http://stackoverflow.com/comment/42916130
has comment: http://stackoverflow.com/comment/42916435
has comment: http://stackoverflow.com/comment/42916337
possible better answer: http://stackoverflow.com/a/34031990
has body: I have two classes (A and B) which are loaded by different ClassLoaders. Furthermore, I have a third class, which providers static getter and setter methods. I hope following picture can clarify the situation: The Data class looks as following: public class Data { private static String data = "&lt;fill in&gt;"; public static void setData(String d) { data = d; } public static String getData() { return data; } } In class A, I want to set the static value of Data and in B I want to retrieve this value. However, in B I always get the original value (which is "&lt;fill in&gt;"). I only have a basic understanding of ClassLoaders, so I'm not too sure what is going on under the hood. I thought that both ClassLoaders (clA and clB) will propagate to their parent ClassLoader and that I will get the same Data class in both. Can anyone give me some feedback on the behavior or point me in the direction to look at? Update When I print the hashCode() of both Data classes, I get different values for them (meaning obviously I don't get access the same class). Is there and easy way to illustrate the ClassLoader hierarchy?
answer count: 2
has comment: http://stackoverflow.com/comment/42916300
accepted answer: http://stackoverflow.com/a/31153720

auto-increment
type: Tag
tags question: http://stackoverflow.com/q/27196901
tag name: auto-increment

http://stackoverflow.com/comment/43080444
type: Comment
type: QuestionComment
has text: Important, yes, but not necessarily unambiguous. (Just playing devil's advocate. I can use two LHMs and have them be "ordered identically" by insertion order rather than by key.)
comment on: http://stackoverflow.com/q/27309339
score: 0

celltable
type: Tag
tag name: celltable
tags question: http://stackoverflow.com/q/27195749

http://stackoverflow.com/comment/69826294
score: 0
has text: What if two elements are both greatest? I suppose that `max(2, 3, 4, 4)` should be 4, but how would your code be supposed to get to that result?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27293080

http://stackoverflow.com/comment/42997929
type: AnswerComment
has text: Is there a better way of changing the content of spinner1? Or did I do something wrong
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27258935

http://stackoverflow.com/q/27199288
tagged with: osx-yosemite
score: 0
tagged with: google-plugin-eclipse
tagged with: gwt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27418967
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has title: GWT plugin for Eclipse not shown , mac os x 10.10.1
accepted answer: http://stackoverflow.com/a/27418967
has body: trying learn GWT framework. have installed Eclipse Luna and GWT Plugin for Eclipse. when i open new project in IDE there is no any Google options, although software are installed ( see picture bellow) what can it be ?

http://stackoverflow.com/comment/42938260
type: Comment
comment on: http://stackoverflow.com/a/27230514
has text: @ITroubs Common sense and the Java Language Specification agree that "override" does not apply to implementing interface methods. Common sense and the JLS diverge, however, when it comes to abstract methods defined by a class: these are "overridden" as far as the JLS is concerned.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27279648
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27278078
has body: Comments solved the problem "You will need to pass your activity context into your AsyncTask to call methods on it, or you can call a listener that your activity implements, or you can use a localbroadcast." KenWolf @ShaikhMohammedShariq shared a similar problem answer
answers question: http://stackoverflow.com/q/27278078
score: 0

http://stackoverflow.com/a/27167242
has comment: http://stackoverflow.com/comment/42862972
answers question: http://stackoverflow.com/q/27167072
score: 0
has body: Up until MySQL 5.6.4 fractional seconds are discarded. See http://dev.mysql.com/doc/refman/5.6/en/datetime.html A DATETIME or TIMESTAMP value can include a trailing fractional seconds part in up to microseconds (6 digits) precision. In particular, as of MySQL 5.6.4, any fractional part in a value inserted into a DATETIME or TIMESTAMP column is stored rather than discarded.
type: Answer

http://stackoverflow.com/comment/42898789
score: 0
has text: https://github.com/mmscibor/GameSet/blob/master/src/GraphicCard.java GraphicCard is an extension (kind of) of my Card object. Some poor OOP concepts in this project, it was done fairly early in my coding career, but hopefully helps with your problem. Feel free to navigate the rest of the project
type: Comment
comment on: http://stackoverflow.com/a/27205500
type: AnswerComment

http://stackoverflow.com/a/27191417
score: 2
downvote count: 0
upvote count: 2
has body: Not the fastest, but not really slow either. public static BigInteger factorial(int n) { BigInteger result = BigInteger.ONE; for (int i = 2; i &lt;= n; i++) { result = result.multiply(BigInteger.valueOf(i)); } return result; }
type: Answer
answers question: http://stackoverflow.com/q/27189531

http://stackoverflow.com/comment/43048960
has text: Instead of catching ind ignoring `InterruptedException`, take it as the stop signal. That means that you don't need your own `busy` flag since the system provides one for you to use. See [Brian Goetz: Dealing with InterruptedException](http://www.ibm.com/developerworks/library/j-jtp05236/), especially the "Implementing cancelable tasks" section.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27289638

hadoop
tags question: http://stackoverflow.com/q/27202190
tags question: http://stackoverflow.com/q/27196656
tags question: http://stackoverflow.com/q/27201505
tags question: http://stackoverflow.com/q/27209976
tag name: hadoop
tags question: http://stackoverflow.com/q/27251346
tags question: http://stackoverflow.com/q/27239448
type: Tag
tags question: http://stackoverflow.com/q/27201478
tags question: http://stackoverflow.com/q/27163574
tags question: http://stackoverflow.com/q/27256336
tags question: http://stackoverflow.com/q/27212722
tags question: http://stackoverflow.com/q/27175278
tags question: http://stackoverflow.com/q/27285178
tags question: http://stackoverflow.com/q/27200873
tags question: http://stackoverflow.com/q/27177157
tags question: http://stackoverflow.com/q/27266986
tags question: http://stackoverflow.com/q/27269939
tags question: http://stackoverflow.com/q/27266296
tags question: http://stackoverflow.com/q/27299273
tags question: http://stackoverflow.com/q/27216415
tags question: http://stackoverflow.com/q/27288752
tags question: http://stackoverflow.com/q/27309200
tags question: http://stackoverflow.com/q/27189578

http://stackoverflow.com/q/27285442
favorite count: 0
upvote count: 3
type: UnansweredQuestion
type: Question
tagged with: hibernate-search
tagged with: indexing
score: 3
has comment: http://stackoverflow.com/comment/43261894
tagged with: java
tagged with: hibernate
has body: I am using Hibernate Search in my application. One of child collections is mapped as IndexedEmbedded. Child object have two fields, one id and other is date (using date resoultion to milliseconds). When I search for id=1 (or some value) and date equals to another, I get the results of all the cases where first and second match. I want to get only records where both fields are matched in the same child, but I get matches in different childs, resulting in much higher results. Here is the snippet of the code Main class is User @Indexed public class User {... @IndexedEmbedded(prefix = "score_") public List&lt;Score&gt; getScores() {...} Score class is @Indexed public class Score {... @Id @DocumentId public Integer getId() {...} @Field public Integer value @Field(analyze = Analyze.NO, indexNullAs="_null_") @DateBridge(resolution = Resolution.MILLISECOND) public Date getScoreTime() In my search code, I am doing the following QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(User.class).get(); BooleanQuery subQuery = new BooleanQuery(); subQuery.add(queryBuilder.keyword().onField("score_id").matching(20).createQuery(), BooleanClause.Occur.MUST); subQuery.add(queryBuilder.keyword().onField("score_scoreTime").ignoreFieldBridge().matching("_null").createQuery(), BooleanClause.Occur.MUST); Search on value field (instead of scoreTime) have the same behavior. If I search separately on any of the fields, I get correct result. Any suggestions?
has title: Hibernate search / lucene search in multiple fields child collections
has comment: http://stackoverflow.com/comment/78718578
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27291844
tagged with: lucene

http://stackoverflow.com/comment/42857897
type: QuestionComment
has text: @ElliottFrisch I'm forced to do so, if you look at ceilometer web api docs here: [link](http://docs.openstack.org/developer/ceilometer/webapi/v2.html) you can find that users may pass query parameters inside the body of a get request. I think that this is possible with the python API and it's obvious possible in curl. I know that's it's not permitted by the standard to give semantic to a get request body. But I need to do so.
type: Comment
comment on: http://stackoverflow.com/q/27180431
score: 0

http://stackoverflow.com/comment/42961999
has text: Sorry for late reply. I am getting NoClassDefFoundError exception for class present inside test1.jar. As i am trying to call method of test1.jar inside test2.jar method.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27169715

http://stackoverflow.com/comment/42810388
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27158140
score: 0
has text: You can't use `cropCache.put(str, intList)` because the key is defined as `List<String>` and you're using `String` as parameter. Probably you have to redefine your map to `Map<String, List<Integer>>`.

http://stackoverflow.com/q/27181790
has answer: http://stackoverflow.com/a/27182567
downvote count: 4
upvote count: 0
tagged with: java
has body: I use Eclipse for java programming. I no understand why it gives cannot resolved for (myBox1.width = 10;) to a variable my sample code in below class Boxf { double width; double height; double depth; } class BoxDemo2 { public static void main(String[] args) { Boxf mybBox1 = new Boxf(); Boxf mybBox2 = new Boxf(); double vol; myBox1.width = 10; myBox1.height = 20.90; myBox1.depth = 15.75; vol = myBox1.width * myBox1.height * myBox1.depth; System.out.println("Volume1 is = "+ vol); myBox2.width= 10; myBox2.height = 20.90; myBox2.depth = 15.75; vol = myBox2.width * myBox2.height * myBox2.depth; System.out.println("Volume2 is = "+ vol); }
type: Question
has title: Why give this "cannot be resolved to a variable"
answer count: 2
tagged with: class
has answer: http://stackoverflow.com/a/27181805
has comment: http://stackoverflow.com/comment/42851734
has comment: http://stackoverflow.com/comment/42851774
favorite count: 0
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/27234137
downvote count: 0
type: Answer
has body: The code is not correct due to the fact that the read from the HashMap is not guarded by any lock. Thus the thread that reads data from the map it has no idea any other thread has updated it. Also it's not efficient; your structure doesn't support both enqueue and dequeue at the same time by two threads and using two synchronized blocks is resource consuming. You might as well synchronize both methods. A more efficient implementation would be using concurrent data structures: public class Structure&lt;K, V&gt; { private final Queue&lt;V&gt; EMPTY_QUEUE = new ConcurrentLinkedQueue&lt;&gt;(); private final Map&lt;K, Queue&lt;V&gt;&gt; queues = new ConcurrentHashMap&lt;&gt;(); public void enqueue(K id, V data) { Queue&lt;V&gt; queue = queues.computeIfAbsent(id, i -&gt; new ConcurrentLinkedQueue&lt;&gt;()); queue.add(data); } public List&lt;V&gt; dequeue(K id) { Queue&lt;V&gt; queue = queues.getOrDefault(id, EMPTY_QUEUE); List&lt;V&gt; resp = new LinkedList&lt;&gt;(queue); queue.clear(); return resp; } }
upvote count: 5
answers question: http://stackoverflow.com/q/27233901
score: 5

http://stackoverflow.com/comment/42892261
score: 0
comment on: http://stackoverflow.com/q/27204880
type: Comment
type: QuestionComment
has text: What's special about that pattern?

http://stackoverflow.com/comment/42853918
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27165812
has text: i am using <%for(int i=0;i<len;i++) { %> for markers, as i have set attribute for len to json.length and i am calling here,the problem is i am getting only 1 marker the first one, i have assigned 6 coordinates..
type: AnswerComment

http://stackoverflow.com/comment/43027930
has text: So does it stop after this message? I get the JDK info as well on OS-X. If you shared a sample somewhere I'd take a look.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27276391
type: Comment

http://stackoverflow.com/a/27317587
upvote count: 4
answers question: http://stackoverflow.com/q/27313814
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/43098965
type: Answer
has body: It has actually nothing with WebSphere. In your xalan-2.7.1.jar which is added to the project, there is META-INF/MANIFEST.MF file. And in it, you will find classpath like this: Manifest-Version: 1.0 Created-By: 1.3.1 Main-Class: org.apache.xalan.xslt.Process Class-Path: xercesImpl.jar xml-apis.jar serializer.jar as you can see classpath refers to xercesImpl.jar, unfortunately your build is creating xercesImpl-2.11.0.jar, so it just cannot be resolved. However this is only a warning and application should run fine if the xercesImpl classes are available in the classpath.

http://stackoverflow.com/a/27185273
score: 0
has comment: http://stackoverflow.com/comment/42858472
has body: I just named variables as I like, u can rename, public class CellRoomObject { String itemName; int itemNumber; boolean ok; public CellRoomObject(String itemName, int itemNumber, boolean ok) { this.itemName = itemName; this.itemNumber = itemNumber; this.ok = ok; } @Override public String toString() { return this.itemName; } } Now your ArrayList // create a JCOMBOBOx named say myCombobox public class MyFrame extends JFrame{ public MyFrame() { setTitle("example"); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); JComboBox myBox=new JComboBox(); ArrayList&lt;CellRoomObject&gt; cellRoomObjects =new ArrayList&lt;CellRoomObject&gt;(); CellRoomObject c1=new CellRoomObject("Door" , 1 , true); CellRoomObject c2=new CellRoomObject("Oil lamp", 2 , true); CellRoomObject c3=new CellRoomObject("Chest" , 3 , true); cellRoomObjects.add(c1); cellRoomObjects.add(c2); cellRoomObjects.add(c3); DefaultComboBoxModel dcbm =new DefaultComboBoxModel(cellRoomObjects.toArray()); myBox.setModel(dcbm); this.add(myBox); setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { MyFrame ex = new MyFrame(); ex.setVisible(true); } }); } } Try this(Do necessary imports)
type: Answer
has comment: http://stackoverflow.com/comment/42861338
answers question: http://stackoverflow.com/q/27184988
accepted answer of: http://stackoverflow.com/q/27184988
has comment: http://stackoverflow.com/comment/42861917
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42859760

http://stackoverflow.com/comment/43015585
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27272945
has text: can you try String number = Integer.toString(quotient);

http://stackoverflow.com/comment/43065726
comment on: http://stackoverflow.com/q/27300909
has text: Add System.out.println calls to dump the relevant variables, then check them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27159521
has comment: http://stackoverflow.com/comment/42814227
tagged with: java
has comment: http://stackoverflow.com/comment/42814437
has comment: http://stackoverflow.com/comment/42816222
has title: Using wicket CompoundPropertyModel with abstract classes
type: Question
answer count: 1
score: 0
tagged with: wicket
accepted answer: http://stackoverflow.com/a/27163680
has body: I've the following abstract class: public abstract class Person extends Model { private Serializable id; private String name; private Integer year; private String nationality; private String deathYear; @Override protected Serializable getId() { return id; } @Override protected Model byId() { return null; } public String getName() { return name; } public abstract void add(); public abstract void update(); public abstract void delete(); public abstract String getDeathYear(); public abstract int getYear(); public abstract String getNationality(); public abstract List&lt;Book&gt; getBooks(); } And the following class which extends it: public class Author extends Person { private Serializable id; private String name; private Integer year; private String nationality; private String deathYear; private List&lt;Prize&gt; prizes; private List&lt;Book&gt; books; public Author() { } @Override public String getNationality() { return nationality; } @Override public String getName() { return name; } @Override public int getYear() { return year; } @Override public String getDeathYear() { return deathYear; } @Override public List&lt;Book&gt; getBooks() { return books; } public List&lt;Prize&gt; getPrizes() { return prizes; } public void setName(String name) { this.name = name; }//plus some unrelated stuff I'm trying to create a form like this: public class AdminAuthorPage extends AdminBasePage { Author inputAuthor; public AdminAuthorPage() { this(new Author()); } public AdminAuthorPage(Author author) { this.inputAuthor = author; this.add(new ListView&lt;Author&gt;("authorList", Author.all()) { @Override protected void populateItem(ListItem&lt;Author&gt; item) { final Author author = item.getModelObject(); item.add(new PersonLink("authorLink", author)); item.add(new Link("editLink") { @Override public void onClick() { setResponsePage(new AdminAuthorPage(author)); } }); item.add(new Link("deleteLink") { @Override public void onClick() { author.delete(); setResponsePage(new AdminAuthor…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27163680

undertow
type: Tag
tag name: undertow
tags question: http://stackoverflow.com/q/27276899
tags question: http://stackoverflow.com/q/27200166

http://stackoverflow.com/q/27160543
tagged with: colors
type: AnsweredQuestion
has title: Adding color and a position to a created button
score: 0
has answer: http://stackoverflow.com/a/27160588
tagged with: swing
type: Question
tagged with: java
has body: thanks in advance for the help. I have this code to create a button: frame1.getContentPane().add(new DragButton("Z")); And i added a random position: frame1.getContentPane().add(new DragButton("Z")).setLocation((int) Math.floor((Math.random() * 600) + 1),(int) Math.floor((Math.random() * 300) + 1)); But now i want to add color to the button. I know i can use the .setBackground(Color.GREEN) option, but in doing so after or before using the .setLocation option, it gives me a "void cannot be deferenced" error and im stuck in this part. I already saw several post here but they either focus on the position part or the color part, not both. Thanks for the help !!
accepted answer: http://stackoverflow.com/a/27160588
answer count: 1
tagged with: button
tagged with: position

http://stackoverflow.com/comment/42903118
has text: You posted neither your actual code nor your graph. How do you expect anyone to help you?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27210854
type: Comment

http://stackoverflow.com/comment/42927967
type: AnswerComment
score: 1
type: Comment
has text: This seems to have been the problem. I cleaned all of my projects. Still get the error. Then I added a System.out.println("new"); on the first line of the JSP, and suddenly everything works. Then I remove the syso and it still works. I have no idea how that fixed it but hey it works now. Thanks.
comment on: http://stackoverflow.com/a/27224647

http://stackoverflow.com/comment/42875622
comment on: http://stackoverflow.com/a/27155879
score: 0
type: Comment
has text: You validate the XML against the applicable schema or DTD. W3Schools have some really simple tutorials on how to do this. I strongly recommend them.
type: AnswerComment

http://stackoverflow.com/comment/42906912
score: 0
type: AnswerComment
type: Comment
has text: that is why i added the edit with the **match** method - it will work for that case you just described
comment on: http://stackoverflow.com/a/27205627

http://stackoverflow.com/comment/42938014
has text: @ITroubs: It *could* be considered that, but it isn't. An interface is a super-*type*, not a super-*class*.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27230419

http://stackoverflow.com/q/27181332
tagged with: java
has body: I have implemented an interface by using arrays to create a Citation Index. I am a new programmer and want to learn how to convert my current Array implementation into an ArrayList implementation. Here is my code so far. How would I use ArrayLists in the printCitationIndex() method instead of Arrays? import java.util.ArrayList; public class IndexArrayList implements IndexInterface{ ArrayList&lt;Citation&gt; citationIndex = new ArrayList&lt;Citation&gt;(); private String formatType; private int totalNumCitations, numKeywords; ArrayList&lt;Keyword&gt; keywordIndex = new ArrayList&lt;Keyword&gt;(); public void printCitationIndex(){ // Pre-condition - the index is not empty and has a format type //Prints out all the citations in the index formatted according to its format type. //Italicization not required if (!this.formatType.equals("")) { if (!isEmpty()) { for (int i = 0; i &lt; citationIndex.length; i++) { if (citationIndex[i] != null) { if (this.formatType.equals("IEEE")) { System.out.println(citationIndex[i].formatIEEE()); } else if (this.formatType.equals("APA")) { System.out.println(citationIndex[i].formatAPA()); } else if (this.formatType.equals("ACM")) { System.out.println(citationIndex[i].getAuthorsACM()); } } } } else { System.out.println("The index is empty!"); } } else { System.out.println("The index has no format type!"); } } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27181396
tagged with: arrays
has title: Converting Array to ArrayList
favorite count: 0
tagged with: arraylist
type: Question
possible better answer: http://stackoverflow.com/a/27181402
has answer: http://stackoverflow.com/a/27181402
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42850997
has answer: http://stackoverflow.com/a/27181396
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/27294866
has body: I am using python to create a server, and Java(Android) to create a client. The problem I am facing is getting the data correctly from one to the other. I let the Java client attempt a login like this: SettingsManager settingsman = SettingsManager.getInstance(params[0]); int port = Integer.parseInt(settingsman.getPort()); String ip = settingsman.getIp(); server = new Socket(ip, port); input = new DataInputStream(server.getInputStream()); output = new DataOutputStream(server.getOutputStream()); output.writeChars(LOGIN_REQ); output.writeChars(settingsman.getUserName()); output.writeChars(settingsman.getPassword()); String token = Integer.toString(input.read()); //Check if the login has failed if(token == "0"){ token = null; } return token; And the Python server receives it like this: opcode = c.recv(2) opcode = opcode.decode('utf-8') print("OPCODE:" + opcode + str(type(opcode))) if(opcode == "0"): "Login action" print("STARTING TO RECV!") login = c.recv(1024).decode('utf-8') print("RECEIVED LOGIN: " + login) password = c.recv(1024).decode('utf-8') print("PASSWORD: " + password) print("USERNAME: " + username) setman = SettingsManager() setuser = setman.seccam_user() setpass = setman.seccam_password() if login == setuser &amp; password == setpass: print("Login is good!") """Generate random token and save it to the settings file""" elif(opcode == "1"): pass else: print("OTHER!") This is the output: OPCODE:0&lt;class 'str'&gt; OTHER! Even though the Opcode seems to be a string and is the right value, the program doesn't enter the If statement correctly Can anyone tell me what I am doing wrong? Thanks
tagged with: java
accepted answer: http://stackoverflow.com/a/27295298
type: Question
type: AnsweredQuestion
tagged with: sockets
tagged with: android
has title: Python Server and Java Client: Weird behaviour receiving data
tagged with: python
has answer: http://stackoverflow.com/a/27295298
score: 0
answer count: 1

http://stackoverflow.com/q/27246435
answer count: 1
favorite count: 0
has body: I am trying to integrate Kotlin with an existing java application. So to test it i create a simple kotlin file and a unit test (in java), that will do something simple. The purpose of the unit test is to ensure all the configure is correct and in fact i can call kotlin class from java. This is where i get a little stuck, while executing the build using gradle, i get the following error: [ERROR] [system.err] Sample.class: warning: Cannot find annotation method 'name()' in type 'JetValueParameter' [ERROR] [system.err] SampleTest.java:19: error: cannot access KObject [ERROR] [system.err] sample.setStatusCode(Sample.Status.OK); [ERROR] [system.err] ^ [ERROR] [system.err] class file for kotlin.jvm.internal.KObject not found [ERROR] [system.err] 1 error [ERROR] [system.err] 24 warnings I have the kotlin runtime on the classpath, i have also added in kotlin-jdk-annotations just for good measure. I also have the kotlin plugin configured in gradle. I'm hitting my head against a brick wall, it'd be a shame as i like kotlin as a replacement for java. However this issue might scupper my plans. Any help would be greatly appreciated!!! Update: Gradle build script: apply plugin: 'java' apply plugin: 'kotlin' sourceCompatibility = 1.7 version = '1.0' repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile "org.jetbrains.kotlin:kotlin-stdlib:0.9.976" } buildscript { ext.kotlin_version = '0.9.976' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.9.976" classpath 'org.jetbrains.kotlin:kotlin-stdlib:0.9.976' } } Java Version: 1.7.x Kotlin version: 0.9.976 Gradle Version: 1.6
has title: error: cannot access KObject -- class file for kotlin.jvm.internal.KObject not found
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27250315
tagged with: gradle
has comment: http://stackoverflow.com/comment/42970454
type: Question
has comment: http://stackoverflow.com/comment/42969240
has comment: http://stackoverflow.com/comment/42969873
has answer: http://stackoverflow.com/a/27250315
has comment: http://stackoverflow.com/comment/42969103
tagged with: kotlin
has comment: http://stackoverflow.com/comment/42968065
upvote count: 1

http://stackoverflow.com/comment/43018318
has text: Why should `contenpane.getParent()` return a JLayeredPane ?
type: Comment
comment on: http://stackoverflow.com/q/27274418
type: QuestionComment
score: 2

http://stackoverflow.com/q/27306165
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43075982
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43075780
type: Question
tagged with: eclipse
has body: I'm looking at some examples of lwjgl 3. In their example code they import: import static org.lwjgl.glfw.GLFW.*; I've seen this crop up many times now and I thought I'd just get round to asking. The code then goes on to lines such as: glfwDestroyWindow(window); Where it calls the function in the GLFW class. However, in my IDE (eclipse luna) this does not work as intended, I would need to call: GLFW.glfwDestroyWindow(window); Which isn't really a problem, just an inconvenience. How is it that I can get eclipse to recognise that this function is within the class imported so I do not have to direct it.
has answer: http://stackoverflow.com/a/27314690
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43076046
accepted answer: http://stackoverflow.com/a/27314690
has title: import package.* to import methods in eclipse

http://stackoverflow.com/comment/42916259
type: QuestionComment
has text: @mystarrocks thanks for the feedback, that already helped. It seems I really don't get the same class reference. I updated my question accordingly. Thx!
score: 0
comment on: http://stackoverflow.com/q/27218177
type: Comment

http://stackoverflow.com/comment/42878176
type: Comment
type: QuestionComment
has text: I have added the output...
score: 0
comment on: http://stackoverflow.com/q/27196488

http://stackoverflow.com/comment/42923240
type: Comment
has text: That is very weird. Can you try the first solution that I mentioned in my answer - Create images folder in the directory that eclipse is placing class files into and copy the gif file there?
comment on: http://stackoverflow.com/a/27221725
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42816095
has text: @LordMastodon No, it has nothing to do with the JDK, IDEA sometimes select a random language level (at least for me )
comment on: http://stackoverflow.com/a/27161098
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27176507
tagged with: persistence
has title: java infinispan the easiest example
has answer: http://stackoverflow.com/a/27224407
tagged with: infinispan
has answer: http://stackoverflow.com/a/27189864
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has body: I would like to use infinispan (7.0.2.Final) to provide persistency for my server application written in java. Before I started to implement it, I tried the simplest scenario but it did not work... i.e I implemented two simple unit tests and I run them one after another (i.e. I run them separately). The first test consisted only of: Cache&lt;Object, Object&gt; c = new DefaultCacheManager().getCache(); c.put("key1", "value1"); And the second one: Cache&lt;Object, Object&gt; c = new DefaultCacheManager().getCache(); String result = (String) c.get("key1"); but I received result = null ... What am I doing wrong? I read on infinispan pages that should run out of the box...
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/27262977
has comment: http://stackoverflow.com/comment/42998801
favorite count: 0
linked to: http://stackoverflow.com/q/4260723
has comment: http://stackoverflow.com/comment/42998490
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42998745
has answer: http://stackoverflow.com/a/27263381
has comment: http://stackoverflow.com/comment/42998470
has comment: http://stackoverflow.com/comment/42998659
downvote count: 4
has title: Skipping one value when storing into an array
has comment: http://stackoverflow.com/comment/43000118
has comment: http://stackoverflow.com/comment/42998677
has body: Can someone help me check ? error: java.lang.NullPointerException How do I remove this error ? my main Class: public class deck { public static void main(String[] args) { Deck app = new Deck(); app.Deck(); } } my Deck class: public class Deck { public int TOTALCARDS; Card[] d; public int nH; public void createDeck() { String[] suitsArray = new String[4]; for(int i=0; i&lt;numArray.length; i++) { numArray[i] = i+1; } for (int i=0; i&lt;13; i++) { if (i!=11){ deck[i+25] = new Card(suitsArray[2], i+1); } else if(i &gt; 10){ deck[i+25] = new Card(suitsArray[2], i+1); } } for (int i=0; i&lt;13; i++) { deck[i+25].display(); } } This is the Card Class. public class Card { public String suit; public int number; public Card(String s, int n){ this.suit = s; this.number = n; } public String words; public String getTitle(){ String if (number == 1){ words = " Ace"; } else if (number ==3){ words = " Three"; } else if (number ==4){ words = " Four"; } else if (number ==5){ words = " Five"; } else if (number ==6){ words = " Six"; } else if (number ==7){ words = " Seven"; } else if (number ==8){ words = " Eight"; } else if (number ==9){ words = " Nine"; } else if (number ==10){ words = " Ten"; } else if (number ==11){ words = " Jack"; } else if (number ==12){ words = " Queen"; } else if (number ==13){ words = " King"; } displayTitle = suit + words; if (displayTitle.equalsIgnoreCase("Diamond Queen")){ displayTitle= "DIAMOND QUEEN"; } return (displayTitle); } public void display(){ System.out.println("&lt; " + get() + " &gt;"); } } When I run the code I got Hearts Ace Hearts Two Hearts Three Hearts Four Hearts Five Hearts Six Hearts Seven Hearts Eight Hearts Nine Hearts Ten Hearts Jack Exception in thread "main" java.lang.NullPointerException at Deck.createDeck(Deck.java:57) at Deck.&lt;init&gt;(Deck.java:9) at deckMain.main(deckMain.java:5)
has comment: http://stackoverflow.com/comment/42998775
tagged with: java
has comment: http://stackoverflow.com/comment/42998939
has comment: http://stackoverflow.com/comment/42998674
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42998401
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42998700
has comment: http://stackoverflow.com/comment/43004273
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42998730
has comment: http://stackoverflow.com/comment/42998957
has comment: http://stackoverflow.com/comment/42998632
tagged with: class
has answer: http://stackoverflow.com/a/27263206
answer count: 3
has comment: http://stackoverflow.com/comment/42998435
has comment: http://stackoverflow.com/comment/42998680
has comment: http://stackoverflow.com/comment/42998500
has answer: http://stackoverflow.com/a/27263387
has comment: http://stackoverflow.com/comment/42998763

javac
tags question: http://stackoverflow.com/q/27269955
tag name: javac
type: Tag
tags question: http://stackoverflow.com/q/27252404
tags question: http://stackoverflow.com/q/27180640
tags question: http://stackoverflow.com/q/27257385
tags question: http://stackoverflow.com/q/27288726
tags question: http://stackoverflow.com/q/27208615

http://stackoverflow.com/comment/42976840
type: AnswerComment
has text: @imgolden62 I updated my post. Either both the method and variable need to be static, or neither should be static, so I removed the static from your `draw()` method. I also included an example of `super.paint()` per @MadProgrammer's comment.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27241554

http://stackoverflow.com/a/27207936
has body: You can use regular expressions, for example: String input = "Add Job_A with length 10"; Pattern pattern = Pattern.compile("Add (.+) with length (\\d+)"); Matcher matcher = pattern.matcher(input); if (matcher.matches()) { // Input has correct format, we can extract matched values into variables String jobName = matcher.group(1); int number = Integer.parseInt(matcher.group(2)); } else { // Input has incorrect format }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27207789
answers question: http://stackoverflow.com/q/27207789

http://stackoverflow.com/q/27269446
score: 0
has body: I am having an issue with creating and grating permissions to a user using phpMyAdmin. I am having a Java swing application and it need to connect to this database. How I created the user and granted the permission are below, step by step. Open phpMyAdmin Go to 'Users' tab. Click on Add New User Give the user name, select Any Host as the host (so the % is displayed in its text box), and mention the password. Any host is because remote access required. Select Select under Global Privileges - Data Click on Go Now I am in the Users tab starting page again. Click on Edit Privileges on my newly created user. Select the database under Database-specific privileges Tick everything under Database-specific privileges, Data section. Click on Go Now, whenever my Java application connects to this, it gives the below error java.sql.SQLException: Access denied for user 'userName'@'localhost' (using password: YES) This is how I connect to the database, in my Java application con = DriverManager.getConnection("jdbc:mysql://"+ip+":3306/databaseName","user","password"); Here,for the variable ip, I tried both localhost and 127.0.0.1 but still no good. What have I done wrong? I noticed the connection works fine if I select Localhost instead of Any Host in step 4.
has answer: http://stackoverflow.com/a/27273780
has answer: http://stackoverflow.com/a/27269505
tagged with: phpmyadmin
possible better answer: http://stackoverflow.com/a/27269612
has title: MySQL: Access denied for user 'userName'@'localhost'
tagged with: jdbc
has answer: http://stackoverflow.com/a/27269612
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/27269505
tagged with: database
has answer: http://stackoverflow.com/a/27272601

http://stackoverflow.com/comment/46897694
score: 1
comment on: http://stackoverflow.com/a/27314167
type: AnswerComment
has text: I'm sorry I can't answer elasticsearch v1.5 questions yet. It's been released very recently and I haven't taken a look on it yet. Try to verify what version of lucene the latest version of Elasticsearch uses.
type: Comment

http://stackoverflow.com/q/27211974
has comment: http://stackoverflow.com/comment/42906052
tagged with: java
has comment: http://stackoverflow.com/comment/42905679
type: Question
tagged with: split
accepted answer: http://stackoverflow.com/a/27212164
has comment: http://stackoverflow.com/comment/42904893
score: 0
has comment: http://stackoverflow.com/comment/42904952
has answer: http://stackoverflow.com/a/27212164
has comment: http://stackoverflow.com/comment/42906111
upvote count: 1
answer count: 1
downvote count: 1
has body: I have some sentences like : united states of america, key with ring, I wish to split all sentences on spaces but intelligently such that, united states of america becomes : "united" "states" "of america" key with ring : "key" "with ring" queen of beijing : "queen" "of beijing" Do we have some library in java/clojure/scala for such splitting ? Or any algorithm wihch could help with this.
has comment: http://stackoverflow.com/comment/42905145
favorite count: 0
has comment: http://stackoverflow.com/comment/42906010
has title: java : Intelligent text splitting
has comment: http://stackoverflow.com/comment/42905687
has comment: http://stackoverflow.com/comment/42906059
tagged with: nlp
tagged with: clojure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42905307

http://stackoverflow.com/a/27297989
score: 4
answers question: http://stackoverflow.com/q/27297306
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27297306
has comment: http://stackoverflow.com/comment/43062130
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43063274
downvote count: 0
has comment: http://stackoverflow.com/comment/43063445
has comment: http://stackoverflow.com/comment/43062075
has comment: http://stackoverflow.com/comment/43062435
type: Answer
has body: The only reasonable conclusion is that you (or the framework) are creating two references of ExecutorTest and executing it twice. Add the identityHashCode of the object to your logging. System.out.printf("Thread -" + Thread.currentThread().getId() + " Current time: %tr with reference: %s%n ", new Date(), System.identityHashCode(ExecutorTest.this)); The same code without changes is behaving differently when run as console application and a service application as I mentioned above. You control exactly how many are being created here. Edit Based on your third update. My assumption is correct, the System.identityHashCode of an object is analogous to its memory location. As you can see the two values are different but if the ExecutorService was creating two threads, those values would be the same. That means you are creating multiple instances. Maybe not you directly, but the framework is creating multiple of the same service and running them. So this moves from a question of 'why is the executor service creating 2 threads' to 'why is my framework creating two service instances'. That question I cannot answer. To clarify more clearly, imagine executing your test like this ExecutorTest tester1 = new ExecutorTest(); tester1.testIt(); ExecutorTest tester2 = new ExecutorTest(); tester2.testIt(); That is similar to what is occurring in your application.

http://stackoverflow.com/q/27265801
has title: Spring Localization not working on first hit, On Refresh It Works..!
tagged with: spring
tagged with: spring-mvc
score: 2
downvote count: 0
tagged with: java
has body: When I am hitting the page first time locale change is not happening but then on refreshing locale changes perfectly. I have googled a lot but didn't found any solution for this absurd behaviour. Below I am sharing code of my spring configuration file. <?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" 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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd "> <mvc:interceptors> </mvc:interceptors> </beans>
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/28041918
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42886526
type: Comment
comment on: http://stackoverflow.com/a/27200012
has text: **Files** means is it keyword or what.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27186498
tagged with: arrays
tagged with: class
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27186689
has title: Java : How to create an array from object then store String and double in that array
favorite count: 0
has comment: http://stackoverflow.com/comment/42860046
has answer: http://stackoverflow.com/a/27187890
accepted answer: http://stackoverflow.com/a/27187890
type: AnsweredQuestion
tagged with: oop
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27186691
has body: I want to create an array from object then store in that array with 2 different type of date i'm still learning java and this is kinda my task and i searched many times and have find nothing so please i need your help :D the base class : package com.matcho.task; public class Subject { String name; Double grade; public Subject(String myname, double myGrade) { name = myname; grade = myGrade; } public void printermethod() { System.out.println("Your Subject is " + name + " and ur grade is " + grade); } } and this is the main class : package com.matcho.task; import java.util.Scanner; public class subjectUseing { public static void main(String[] args) { String studentName = ""; double studentGrade = 0; Subject object1 = new Subject(studentName, studentGrade); Scanner input = new Scanner(System.in); System.out.print("Please, Enter the Size of the Array : "); int arraySize = input.nextInt(); Subject[] gradeArray = new Subject[arraySize]; for (int i = 0; i &lt; gradeArray.length; i += 2) { if ((i + 1) % 2 == 0) { System.out.println("Please, Enter Subject Number Grade"); studentGrade = input.nextDouble(); studentGrade = object1.grade; gradeArray[i] = object1.grade; //Error said (cannot convert from Double to Subject) //object1.grade = (Double)gradeArray[i]; //gradeArray[i] = object1.grade; continue; } else { System.out.println("Please, Enter Subject Number Name"); studentName = input.next(); studentName = object1.name; //Error said (cannot convert from String to Subject) gradeArray[i] = new Subject(object1.name, object1.grade); // gradeArray[i] = object1.name; // gradeArray[i] = new String(object1.name); // Failed T_T } }// For End for (int i = 0; i &lt; gradeArray.length; i += 2) { System.out.println("Your Grade in each Subject is : " + gradeArray[i] + " " + gradeArray[i + 1]); }// For End } } i tried many ways and search many times but found nothing so please i need help because this error [cannot convert from Double to Subject] blow up my mind :D
has answer: http://stackoverflow.com/a/27186691
type: Question
tagged with: object

vaadin
tags question: http://stackoverflow.com/q/27223858
tags question: http://stackoverflow.com/q/27164802
tags question: http://stackoverflow.com/q/27300336
tags question: http://stackoverflow.com/q/27229243
tags question: http://stackoverflow.com/q/27188787
tag name: vaadin
tags question: http://stackoverflow.com/q/27176296
tags question: http://stackoverflow.com/q/27295586
type: Tag
tags question: http://stackoverflow.com/q/27230727
tags question: http://stackoverflow.com/q/27269732
tags question: http://stackoverflow.com/q/27228311
tags question: http://stackoverflow.com/q/27281316
tags question: http://stackoverflow.com/q/27184942

http://stackoverflow.com/comment/127668818
has text: @PredragManojlovic It's exactly the same thing. If the directory already exists, then it can't be "created", therefore the method returns false as per the docs.
type: Comment
comment on: http://stackoverflow.com/a/27170383
score: 0
type: AnswerComment

http://stackoverflow.com/q/27183319
downvote count: 0
favorite count: 0
tagged with: linux
type: UnansweredQuestion
tagged with: sockets
tagged with: android
score: 2
answer count: 0
has body: Environment: PC sys:windows xp jdk:1.6 ndk:android-ndk-r9b compile env:MinGW Descrpiton: I'm developing a sip endpoint app, which is based on the opensource sip stack "doubango", in Android device. The socket functions are called using NDK but not directly JAVA. When normally use, it's OK. Then clean the device's memory using some software, or stop Service manully, and make it exit abnormally. Seems that it stops without call function close(socket). Next time when I use, it will throw error calling socket function :sendto(),the errno=1 which means "operation not permitted". I've added "uses-permission android:name="android.permission.INTERNET"" Does anyone can give me a hand? PS:I test in devices without ROOT permission, and this issue will happen. But I test a device with ROOT permission, it doesn't happen. Does it matter? Job Is Done. There are sth mistakes i made in the Java layer. Some parameters i set in Sip stack are wrong. Here follows the code segment: int tnet_sockfd_sendto(tnet_fd_t fd, const struct sockaddr *to, const void* buf, tsk_size_t size) { tsk_size_t sent = 0; int ret = -1; if(fd == TNET_INVALID_FD){ TSK_DEBUG_ERROR("Using invalid FD to send data."); goto bail; } if(!buf || !size){ TSK_DEBUG_ERROR("Using invalid BUFFER."); ret = -2; goto bail; } while(sent &lt; size){ int try_guard = 10; #if TNET_UNDER_WINDOWS WSABUF wsaBuffer; DWORD numberOfBytesSent = 0; wsaBuffer.buf = ((CHAR*)buf) + sent; wsaBuffer.len = (size - sent); try_again: ret = WSASendTo(fd, &amp;wsaBuffer, 1, &amp;numberOfBytesSent, 0, to, tnet_get_sockaddr_size(to), 0, 0); // returns zero if succeed if(ret == 0){ ret = numberOfBytesSent; } #else try_again: ret = sendto(fd, (((const uint8_t*)buf)+sent), (size-sent), 0, to, tnet_get_sockaddr_size(to)); // returns number of sent bytes if succeed #endif if(ret &lt;= 0){ if(tnet_geterrno() == TNET_ERROR_WOULDBLOCK){ TSK_DEBUG_INFO("SendUdp() - WouldBlock. Retrying..."); if(try_guard--){ tsk_thread_sleep(10); goto try_again; } } else{ ***/…
upvote count: 2
tagged with: java
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/42854531
has title: call linux socket function sendto:error,operation not permitted
has comment: http://stackoverflow.com/comment/42855434

http://stackoverflow.com/q/27304983
has comment: http://stackoverflow.com/comment/43072851
tagged with: openssl
downvote count: 0
has comment: http://stackoverflow.com/comment/43094865
favorite count: 0
has comment: http://stackoverflow.com/comment/43094838
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43082449
score: 2
has body: I am currently writing a JNI wrapper for a shared C library, which implements some cryptographic functions using the openssl library. The JNI wrapper will be used in a multi-threaded Java application, meaning that the C functions will be called concurrently from multiple Java threads. Unfortunately the opensssl library is "out of the box" not thread-safe, but the user has to implement and register certain synchronization callback functions which the openssl library will use for synchronization. For more details see here. Now in order to implement those callback functions, I would use for example the pthread mutexes on platforms where the POSIX threads are available, but I am not so sure, if it is safe to do so since we are dealing here with the Java threads created by the JVM. How should I proceed? Are there any good examples or documentations which I can learn from? Thanks in advance for your help!
answer count: 0
tagged with: java
tagged with: multithreading
type: Question
has title: Openssl synchronization in native JNI C code
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/comment/43043693
has text: @Nadusha - You entirely missed the point of my comment.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27288067
score: 0

http://stackoverflow.com/comment/42921673
score: 0
type: AnswerComment
has text: Thank you, it's working now. Sorry for such a easy question. I was trying to debug it for over an hour but had the mindset that you were suppose to pass a string with an extension (.txt etc.). I'll select this as the right answer when it becomes available.
type: Comment
comment on: http://stackoverflow.com/a/27221372

http://stackoverflow.com/comment/43023502
comment on: http://stackoverflow.com/q/27272725
has text: Hello, I solved the problem in apache conf. I replace * by the server name and it work fine.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27197587
tagged with: jersey
type: UnansweredQuestion
has body: I was trying to use the code of this question and everytime I make a request to the application I get this error: HTTP Status 500 - Servlet.init() for servlet api.tienda.venta.ApplicationConfig threw exception Stack trace: javax.servlet.ServletException: Servlet.init() for servlet api.tienda.venta.ApplicationConfig threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) This is the code that I'm using: //ApplicationConfig.java @ApplicationPath("venta") public class ApplicationConfig extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;(); addRestResourceClasses(resources); return resources; } private void addRestResourceClasses(Set&lt;Class&lt;?&gt;&gt; resources) { resources.add(JacksonFeature.class); resources.add(RequestFilter.class); resources.add(api.tienda.venta.ventaResource.class); } } // RequestFilter.java public class RequestFilter implements ContainerRequ…
has comment: http://stackoverflow.com/comment/42943739
has comment: http://stackoverflow.com/comment/42911486
answer count: 0
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/19691753
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/24724190
has title: Jersey - get remote address inside ContainerRequestFilter scope
tagged with: java
upvote count: 1

http://stackoverflow.com/q/27236123
answer count: 1
favorite count: 0
has body: I got the widow and the buttons into the GUI but for the life of me I can't get anything to output. I am suppose to enter a guess, and from a random number the game generates. It is suppose to tell me if I'm too high, too low or correct. Also, if it is not correct it's supposed to tell me if I am warm or cold. If any one could point me in the right direction on this I would be grateful. I don't know what I'm doing wrong on this. I have researched different topics but with the different ways to solve this problem none match what I was looking for. Here's the code: //all necessary imports public class GuessGame extends JFrame { private static final long serialVersionUID = 1L; private JFrame mainFrame; private JTextField guessField; private JLabel message1; private JLabel message2; private JLabel message3; private JLabel message4; private JLabel guessLabel; private JLabel tooHigh; private JLabel tooLow; private JButton guessButton; private JButton newGame; private JButton exitButton; private int randomNum = 0; private final int MAX_NUM = 1000; private final int MIN_NUM = 1; private int guessCount; private int lastDistance; public GuessGame() { mainFrame = new JFrame(); guessField = new JTextField(4); message4 = new JLabel("I have a number between 1 and 1000 -- can you guess my number?") ; guessLabel = new JLabel("Please Enter Your Guess:"); guessButton = new JButton("Guess"); newGame = new JButton("New Game"); exitButton = new JButton("Exit"); Container c = mainFrame.getContentPane(); c.setLayout(new FlowLayout()); c.setBackground(Color.CYAN); c.add(message4); c.add(guessLabel); c.add(guessField); c.add(guessButton); c.add(newGame); c.add(exitButton); newGame.setMnemonic('N'); exitButton.setMnemonic('E'); guessButton.setMnemonic('G'); mainFrame.setSize(420, 300);//Sets width and height of Window mainFrame.setVisible(true);//Allows GUI to be visible mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); GuessBu…
has answer: http://stackoverflow.com/a/27237100
accepted answer: http://stackoverflow.com/a/27237100
tagged with: swing
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: GuessGame can't get program to output messages
type: Question
has comment: http://stackoverflow.com/comment/42955711
upvote count: 1

selenium
tags question: http://stackoverflow.com/q/27213051
tags question: http://stackoverflow.com/q/27222227
tags question: http://stackoverflow.com/q/27188729
tags question: http://stackoverflow.com/q/27288617
tags question: http://stackoverflow.com/q/27187171
tags question: http://stackoverflow.com/q/27294315
tags question: http://stackoverflow.com/q/27175898
tags question: http://stackoverflow.com/q/27252596
tags question: http://stackoverflow.com/q/27276625
tags question: http://stackoverflow.com/q/27163552
tags question: http://stackoverflow.com/q/27243514
tags question: http://stackoverflow.com/q/27243184
tags question: http://stackoverflow.com/q/27301703
tags question: http://stackoverflow.com/q/27304089
tags question: http://stackoverflow.com/q/27294946
tags question: http://stackoverflow.com/q/27173053
tags question: http://stackoverflow.com/q/27267729
tags question: http://stackoverflow.com/q/27272611
tags question: http://stackoverflow.com/q/27227538
tags question: http://stackoverflow.com/q/27254416
tag name: selenium
tags question: http://stackoverflow.com/q/27294425
tags question: http://stackoverflow.com/q/27287794
tags question: http://stackoverflow.com/q/27189182
tags question: http://stackoverflow.com/q/27241922
tags question: http://stackoverflow.com/q/27311153
tags question: http://stackoverflow.com/q/27186054
tags question: http://stackoverflow.com/q/27255709
tags question: http://stackoverflow.com/q/27293104
tags question: http://stackoverflow.com/q/27265049
tags question: http://stackoverflow.com/q/27300930
tags question: http://stackoverflow.com/q/27246523
tags question: http://stackoverflow.com/q/27154697
tags question: http://stackoverflow.com/q/27293690
tags question: http://stackoverflow.com/q/27184496
tags question: http://stackoverflow.com/q/27279330
tags question: http://stackoverflow.com/q/27168769
type: Tag
tags question: http://stackoverflow.com/q/27246849
tags question: http://stackoverflow.com/q/27263818
tags question: http://stackoverflow.com/q/27208872
tags question: http://stackoverflow.com/q/27188422
tags question: http://stackoverflow.com/q/27153959
tags question: http://stackoverflow.com/q/27177461
tags question: http://stackoverflow.com/q/27248952
tags question: http://stackoverflow.com/q/27251010

http://stackoverflow.com/q/27214795
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42921491
downvote count: 1
upvote count: 0
has body: I am currently developing an Android application. I am getting following error in the log cat when I try to login. 11-30 21:23:18.694: E/JSON Parser(1914): Error parsing data org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject 11-30 21:23:18.923: W/dalvikvm(1914): threadid=10: thread exiting with uncaught exception (group=0xb3e56288) 11-29 22:23:17.329: E/AndroidRuntime(1858): FATAL EXCEPTION: AsyncTask #1 11-29 22:23:17.329: E/AndroidRuntime(1858): java.lang.RuntimeException: An error occured while executing doInBackground() 11-29 22:23:17.329: E/AndroidRuntime(1858): at android.os.AsyncTask$3.done(AsyncTask.java:299) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 11-29 22:23:17.329: E/AndroidRuntime(1858): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 11-29 22:23:17.329: E/AndroidRuntime(1858): at java.lang.Thread.run(Thread.java:856) 11-29 22:23:17.329: E/AndroidRuntime(1858): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=localhost/BCASStudentInfo/login.php 11-29 22:23:17.329: E/AndroidRuntime(1858): at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:591) 11-29 22:23:17.329: E/AndroidRuntime(1858): at org.apache.http.impl.client.D…
has answer: http://stackoverflow.com/a/27214829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42910401
has title: Android, login issue
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/42911299
tagged with: php
answer count: 1
score: -1

http://stackoverflow.com/q/27166702
type: AnsweredQuestion
has title: Why get first parameter from request is wrong?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27168219
has comment: http://stackoverflow.com/comment/42825355
has answer: http://stackoverflow.com/a/27168831
accepted answer: http://stackoverflow.com/a/27168831
has body: I was from a JSP page request to another JSP page with some parameters,the code is: url="/hotModuel/baseinfo/siteinfo/commonPlaceAndUnit/commonPlaceAndUnitStatistics.jsp?keyType=SecurityKeyOther&amp;sid=e13048f7-d253-4d50-acec-2981a5536d48"; $.ajax({ url : url, cache: false, success : function(result) { proccessLoginResult(result,function(){ $("#loading").hide(); $("#contentDiv").html(result); setOrgSelect(); setCrumbs(srcObj); }); } }); In the commonPlaceAndUnitStatistics.jsp file,i use the request to get parameter,code is: &lt;% String keyType = request.getParameter("keyType"); String sid= request.getParameter("sid"); %&gt; got the keyType's value is SecurityKeyOthersid=e13048f7-d253-4d50-acec-2981a5536d48 the sid's value is e13048f7-d253-4d50-acec-2981a5536d48 but get parameter in the Filter: public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { String keyType= request.getParameter("keyType"); String sid= request.getParameter("sid"); } the tow parameter's value is right,Why is this?
has comment: http://stackoverflow.com/comment/42825314
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42825302
tagged with: jsp
possible better answer: http://stackoverflow.com/a/27168219

http://stackoverflow.com/comment/43068581
score: 0
has text: The one i just posted in comments is a part of the recursiveEvaluate method. I did this code to find what the operator is, then I made an exception, then I passed the evaluation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27302277

http://stackoverflow.com/a/27278622
type: AcceptedAnswer
has body: Yes, there are loads of new classes in the JDK 1.8, for example, the java.time classes. You won't get those if you build in JDK 1.7; but you will be able to use them if you build in JDK 1.8 with compiler compliance level 1.7.
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/43042750
accepted answer of: http://stackoverflow.com/q/27278494
upvote count: 4
answers question: http://stackoverflow.com/q/27278494
score: 3

http://stackoverflow.com/q/27157880
has body: I´m using Spring JpaRepository to access the database. My goal is to create a method which finds one entity and fully initializes it. Currently I´m doing it like that: Hibernate.initialize(business.getCollectionA()); Hibernate.initialize(business.getCollectionB()); Hibernate.initialize(business.getCollectionC()); So I search for a method which initializes all collections at once like that: Hibernate.initializeAll(business);
tagged with: spring
has comment: http://stackoverflow.com/comment/42810078
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27158492
type: Question
has answer: http://stackoverflow.com/a/27158492
has answer: http://stackoverflow.com/a/27161826
tagged with: hibernate
has answer: http://stackoverflow.com/a/27170433
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42810100
accepted answer: http://stackoverflow.com/a/27161826
linked to: http://stackoverflow.com/q/11445099
has title: Initialize all properties of a proxy in Hibernate

http://stackoverflow.com/q/27303960
score: 0
has title: split in java adds empty space to string array
tagged with: regex
accepted answer: http://stackoverflow.com/a/27305129
has comment: http://stackoverflow.com/comment/43070819
has comment: http://stackoverflow.com/comment/43071708
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43071024
type: Question
tagged with: split
tagged with: arrays
has answer: http://stackoverflow.com/a/27305129
answer count: 1
tagged with: string
has body: im trying to split a string using a REGEX. The problem is that when splitting it adds an empty space to my String Array public static String[] line; line=this.classMetodos.split(meth.regexMethHead); meth.regexMethHead being the regular expresion i want to split with. the output given is the next one: Metodos Contenido [0]: Metodos Contenido [1]: {lol;} Metodos Contenido [2]: {lol;}} the output wanted is: Metodos Contenido [0]: {lol;} Metodos Contenido [1]: {lol;}} Regex used Regex used: public static String regexAccess = "(public|private|\\s*)"; public static String regexStatic = "(static|\\s*)"; public static String regexReturnType = "(String|double|void)"; public static String regexMethName = "([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*"; public static String regexVariableName = "([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*"; public static String regexString = "\"([a-z]|[A-Z]|[0-9])*\""; public static String regexArgs="(\\(\\)|\\(("+regexReturnType+"\\s*"+regexVariableName+")\\))"; public static String regexMethContent="\\{(.*|\\n*|\\t*)*\\}"; //complete regular expression public static String regexMethHead = regexAccess + "\\s*"+ regexStatic+ "\\s*"+ regexReturnType+ "\\s*"+ regexMethName+ "\\s*"+ regexArgs; Input String public static String meth= "public static void jenny(String lolito){\n\t lol;\n\n\t}"; public static String meth2= " public void Lolamer(String jeny){\n\t lol;\n\n\t}"; public static String variables ="static String e =\"lol\";"; public static String pseudoClass="public class torito{"+"\n"+variables+"\n"+ meth+"\n"+meth2+"}"; public static String regexClassName = "([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*"; public static String regexClassContent="\\{(.*|\\n*|\\t*)*\\}"; public static String regexCLass="^(public|private|\\s*)\\s*class\\s+"+ regexClassName+""+ regexClassContent+""; Keep in mind my regex and String come from other class and im pulling them to make the split in another class THANKS
has comment: http://stackoverflow.com/comment/43071879

http://stackoverflow.com/a/27176524
type: Answer
has body: Try the code below: public class tester { public static void main (String arg[]){ int[] hi = new int[5]; try{ for(int i = 0; i&lt;5; i++){ hi[i] = i; System.out.println(hi[i]); } } catch(ArrayIndexOutOfBoundsException e){ System.out.println("wronnnnnng"); } System.out.println("goooood"); } }
answers question: http://stackoverflow.com/q/27176286
score: 0

http://stackoverflow.com/comment/42869525
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27190849
score: 0
has text: So I did a little bit of debugging and it seems that if I remove `Text theProcessAllGrainTheFinishText = new Text(grpFinish, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);` the scrolling works fine. But one I add it back, it does not work...

http://stackoverflow.com/comment/42908127
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27212307
has text: A sensor localizes itself and broadcasts its position and receives its own message and in neighborLocalized method broadcasts the message again and you are in a loop. Did I get it right?
type: Comment

http://stackoverflow.com/a/27177872
score: 0
type: Answer
has body: I think you are saying that the boxes top left corners location is equal to the mouses location? In which case, you should take away half of the size of the box on the x and y axis. The x value is the very left of the box, and the y value is the very top of the box. The size is (size) more pixels to the right and below. Rectangle r = new Rectange(mouseX, mouseY, sizex, sizey); drawBox(r.x - r.width/2, r.y - r.height/2, r.width, r.height);
answers question: http://stackoverflow.com/q/27177283

http://stackoverflow.com/q/27281728
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43037737
tagged with: java
has comment: http://stackoverflow.com/comment/43038180
has comment: http://stackoverflow.com/comment/43032249
type: Question
has comment: http://stackoverflow.com/comment/43032439
answer count: 1
has comment: http://stackoverflow.com/comment/43032266
has title: Checking all possible expressions that equal a certain number given 4 integers?
has comment: http://stackoverflow.com/comment/43032531
score: 0
has answer: http://stackoverflow.com/a/27285734
has body: Hi everyone I would really appreciate any help with my program. In this program I have to ask the user to input 4 integers and I have to output one possible expression (out of many) that will equal 24. Also if there is no such solution I have to tell the user. So far this is what I have: import java.util.Scanner; public class Game24 { public static void main(String[] args) { System.out.println("Enter 4 numbers and hit enter after each number: "); Scanner input = new Scanner(System.in); String num1 = input.nextLine(); String num2 = input.nextLine(); String num3 = input.nextLine(); String num4 = input.nextLine(); StringPermutation("", num1 + "+" + num2 + "*" + num3 + "/" + num4 + "(" + ")"); } public static String StringPermutation(String x, String y) { double expression = 0; int count = 0; if (y.length() &lt;= 1) { try { for (int i = 0; i &lt; y.length(); i++) { String p = y.substring(0, i) + y.substring(i + 1); expression = Double.parseDouble(StringPermutation(x + y.charAt(i), p)); } if (y.length() &lt;= 1 &amp;&amp; expression == 24) { do { count++; System.out.println(x + y); } while (count &lt; 1); } //if (y.length() &lt;= 1 &amp;&amp; expression != 24) { // System.out.print("No solution"); //} } catch (Exception e) {} } else { for (int i = 0; i &lt; y.length(); i++) { String p = y.substring(0, i) + y.substring(i + 1); StringPermutation(x + y.charAt(i), p); } } return ""; } } So what I'm trying to do is that I will get all permutations of the users input as a string. Then parse the string to a double and check all possible permutations to see if they equal 24 and if they do I output the expression as a string. However, this isn't working for me; when I run the program nothing shows up. Also, if I uncomment the commented part it doesn't display anything.
has comment: http://stackoverflow.com/comment/43032043

http://stackoverflow.com/comment/42971855
has text: I'm guessing model contains ONE grass element? It would go much faster if you combined all grass elements into one "model". This would mean manually offsetting the vertices of the model by "location" and putting them in one model.
comment on: http://stackoverflow.com/q/27247860
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27305249
has comment: http://stackoverflow.com/comment/43073607
answers question: http://stackoverflow.com/q/27305193
has body: Use relative path if it's on an easy relative path from your project folder: File file = File("../resources/text.txt"); Or use absolute path: File file = File("C:\\abcfolder\\text.txt");
type: Answer
has comment: http://stackoverflow.com/comment/43075505
has comment: http://stackoverflow.com/comment/43073902
accepted answer of: http://stackoverflow.com/q/27305193
score: 0
has comment: http://stackoverflow.com/comment/43073585
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43073383

http://stackoverflow.com/comment/42996836
type: Comment
has text: This triggers the message but the database isn't updated
comment on: http://stackoverflow.com/a/27261162
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43052294
comment on: http://stackoverflow.com/a/27293168
has text: @Karthik In my answer I explained why you are getting only Dog and Rat. Have you read it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27279580
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27279445
has body: The command typed in terminal is incorrect and the last part should give the path to the .xml file, not the .jar file

http://stackoverflow.com/comment/42835962
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27171332
has text: if you have dont have service, and linked dao bean, then also this problem occurs...My friend did this task using Modal, it works for him though.

http://stackoverflow.com/comment/42875388
score: 0
type: QuestionComment
has text: you need to post the java code as well.
comment on: http://stackoverflow.com/q/27195085
type: Comment

sl4a
type: Tag
tag name: sl4a
tags question: http://stackoverflow.com/q/27284796

http://stackoverflow.com/comment/43078500
type: Comment
comment on: http://stackoverflow.com/a/27306875
has text: I added your suggestion which makes sense, but I'm receiving the error (which I believe has something to do with an error in my first for loop, however I'm unsure of how to fix it): Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1516) at Project5.main(Project5.java:17)
type: AnswerComment
score: 0

http://stackoverflow.com/q/27154985
has answer: http://stackoverflow.com/a/27159026
answer count: 1
has comment: http://stackoverflow.com/comment/42805346
has comment: http://stackoverflow.com/comment/42805891
tagged with: java
type: UnansweredQuestion
tagged with: binary-tree
type: Question
tagged with: insert
has body: This is not a BinarySearchTree, just a normal binary tree. Here is my RegularTree class: public class RegularTree extends BinaryTree { public RegularTree() { super(); } public void insert(Comparable item) { if(this.isEmpty()) { this.setRoot(new TreeNode(item)); return; } TreeNode t = this.getRoot(); while(t != null) { if(t.getLeft() == null) t.setLeft(new TreeNode(item)); else if(t.getRight() == null) t.setRight(new TreeNode(item)); else { if(size(t.getLeft()) &gt; size(t.getRight())) t = t.getRight(); else t = t.getLeft(); } } } public int size(TreeNode node) { return(getSize(node)); } private int getSize(TreeNode node) { if (node == null) return(0); else return(getSize(node.getLeft()) + 1 + getSize(node.getRight())); } public TreeNode find(Comparable key) { TreeNode p = this.getRoot(); while(p != null &amp;&amp; key.compareTo(p.getValue()) != 0) { if(key.compareTo(p.getValue()) &lt; 0) p = p.getLeft(); else p = p.getRight(); } return p; } public void inorder() { doInorderTraversal(this.getRoot()); } private void doInorderTraversal(TreeNode t) { if(t != null) { doInorderTraversal(t.getLeft()); System.out.print(t.getValue() + " "); doInorderTraversal(t.getRight()); } } } and here is my main method: public static void main(String[] args) { RegularTree tree = new RegularTree(); tree.setRoot(new TreeNode(1)); tree.insert(2); tree.insert(3); tree.insert(4); tree.insert(5); tree.insert(6); tree.inorder(); } This should create a tree that looks like this: 1 / \ 2 3 / \ / 4 5 6 tree.inorder() should do an inorder traversal of the tree, meaning it should print out 4 2 5 1 6 3 However, when I run my main method nothing happens. I believe there is something wrong with my insert method, but I'm not sure what.
score: 0
has title: Insert method not working Binary Tree java

http://stackoverflow.com/a/27205894
score: 0
has comment: http://stackoverflow.com/comment/42894829
has comment: http://stackoverflow.com/comment/42894538
has comment: http://stackoverflow.com/comment/42896254
has comment: http://stackoverflow.com/comment/43315079
has comment: http://stackoverflow.com/comment/42895022
has comment: http://stackoverflow.com/comment/42895891
has body: I don't know how your dao save() method looks like but is there: getEntityManager().flush(); ? If no please add after persist and check whether it helped.
has comment: http://stackoverflow.com/comment/42894277
has comment: http://stackoverflow.com/comment/42894639
type: Answer
has comment: http://stackoverflow.com/comment/42894896
has comment: http://stackoverflow.com/comment/42896355
answers question: http://stackoverflow.com/q/27205811
has comment: http://stackoverflow.com/comment/42894520

http://stackoverflow.com/comment/129764165
score: 1
has text: You can use character class in Java [\p{graph}_]
type: AnswerComment
comment on: http://stackoverflow.com/a/27249088
type: Comment

http://stackoverflow.com/comment/42979182
type: Comment
score: 2
type: AnswerComment
has text: Yes I know, but I would like to get all violations from all groups, not for it to short circuit validation. Do you know of any way I can achieve that? I'm not particularly bound to the current implementaion, that was just the way I got to do the conditional validation I wanted.
comment on: http://stackoverflow.com/a/27246136

http://stackoverflow.com/comment/42898384
score: 1
comment on: http://stackoverflow.com/q/27208168
has text: I suggest you not use the `@SuppressWarnings` annotation and that you rename your `class`. Finally, your `main` method probably shouldn't be throwing an `Exception`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27157175
answers question: http://stackoverflow.com/q/27156925
type: Answer
score: 0
has body: Repositories/Data Access Objects should be reusable, it's ok to have multiple services refer to the same repository. They should also be stateless, so that multiple references to them shouldn't be 'breaking the architecture'. If there is some business logic in a method of Object2Service that you need from Object1Service, then you should call that method, but otherwise there's nothing wrong with calling the repository directly without going through the other service. The thing to pay attention to is where the transactional boundaries are. If both services are transactional with propagation required then this is easy, you can mix and match with no problem. If for some reason one of the services is transactional but the other isn't, and some of the repositories are transactional but others aren't, then you would need to make sure you have some kind of transactional demarcation going on and don't call a repository that doesn't specify being transactional from a service that doesn't specify being transactional. Also, be aware that in general services don't have to map one-to-one to specific entities, it's normal for a service to span multiple domain objects. A service might correspond to a specific kind of user, where the methods implement detail-level use cases (the low-level actions that the user performs, each of which you likely want executed as a single unit of work). While repositories can be cranked out by a code generator to some extent based on the tables in the database, a service's implementation is not necessarily mechanical like that, it depends on the business logic that needs to be exposed.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27156925

http://stackoverflow.com/q/27212053
tagged with: solr
tagged with: logging
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27212221
type: Question
answer count: 2
has title: Exclude slf4j from different third libraries
possible better answer: http://stackoverflow.com/a/27212221
tagged with: intellij-idea
tagged with: slf4j
has answer: http://stackoverflow.com/a/27226083
score: 0
has body: In my project I'm using Solr 4.10 (as separate artifact), Tika 1.6 and Tomcat 7. Solr require to put logging library in tomcat7_dir/lib. Tika also have slf4j library. So on project starting I get multiple binding warning: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/.../apache-tomcat-7.0.39/lib/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/.../out/artifacts/war/WEB-INF/lib/slf4j-log4j12-1.7.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/.../out/artifacts/war/WEB-INF/lib/tika-app-1.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] How can I remove unnecessary libraries from loading in Intellij Idea?
accepted answer: http://stackoverflow.com/a/27226083

http://stackoverflow.com/a/27298928
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27297387
has body: Take a look at sys.columns. Join it with sys.types on system_type_id.

http://stackoverflow.com/comment/42855558
score: 0
comment on: http://stackoverflow.com/q/27184164
type: Comment
type: QuestionComment
has text: You could go for spring batch, it is good for mass updates/inserts. I am not sure if it's safe with dao, but JDK8 has pararell streams, that could be good for updating objects, but without cals to external objects, like dao.

http://stackoverflow.com/comment/43085497
type: Comment
type: QuestionComment
has text: Will do. Give me a minute.
score: 0
comment on: http://stackoverflow.com/q/27311924

http://stackoverflow.com/comment/42850515
type: QuestionComment
has text: Well, I guess you'll pick your data (Strings) out of the list. Let us what you want to do.. Do you want to sort word by word (by every word in your document) or line by line (like in a phonebook or something like that)
comment on: http://stackoverflow.com/q/27179037
score: 0
type: Comment

http://stackoverflow.com/a/27299520
answers question: http://stackoverflow.com/q/27299372
has comment: http://stackoverflow.com/comment/43063571
type: AcceptedAnswer
has body: You do indeed have all you need. When you want to withdraw $10 from micky, you just need micky.withdrawal(10.0), and the corresponding thing with deposits.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27299372

http://stackoverflow.com/comment/42840089
comment on: http://stackoverflow.com/q/27175164
type: Comment
type: QuestionComment
score: 1
has text: Did you tried to debug the code?

http://stackoverflow.com/q/27304684
has comment: http://stackoverflow.com/comment/43113778
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 2
tagged with: playframework
has comment: http://stackoverflow.com/comment/43074895
has title: Can't start Play Framework application
has answer: http://stackoverflow.com/a/27407299
has body: I created play framework application and unfortunately there is a problem. When I'm trying to execuxe command activator run I get: [info] Compiling 4 Scala sources and 2 Java sources to C:\playW\target\scala-2.11\classes... [error] C:\playW\app\controllers\Application.java:3: error: package play does not exist [error] import play.*; [error] ^ [error] C:\playW\app\controllers\Application.java:4: error: package play.mvc does not exist [error] import play.mvc.*; [error] ^ [error] C:\playW\app\controllers\Application.java:8: error: cannot find symbol [error] public class Application extends Controller { [error] ^ [error] symbol: class Controller [error] C:\playW\app\controllers\Application.java:10: error: cannot find symbol [error] public static Result index() { [error] ^ [error] symbol: class Result [error] location: class Application [error] C:\playW\target\scala-2.11\classes\controllers\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found [error] C:\playW\target\scala-2.11\classes\controllers\ReverseApplication.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature' [error] C:\playW\target\scala-2.11\classes\controllers\javascript\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature [error] C:\playW\target\scala-2.11\classes\controllers\javascript\ReverseApplication.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature' [error] C:\playW\target\scala-2.11\classes\controllers\ref\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature' [error] C:\playW\target\scala-2.11\classes\controllers\ref\ReverseApplication.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature' [error] C:\playW\target\scala-2.11\classes\views\html\index.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature' [error] C:\playW…
favorite count: 0
has comment: http://stackoverflow.com/comment/43127725
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/53558844

http://stackoverflow.com/q/27289443
upvote count: 2
has answer: http://stackoverflow.com/a/29914494
has answer: http://stackoverflow.com/a/27644984
favorite count: 0
type: UnansweredQuestion
tagged with: excel
score: 2
has title: Apache POI Fails to apply table style
tagged with: apache-poi
downvote count: 0
tagged with: java
type: Question
answer count: 2
has body: I am creating a Table with POI and trying to apply a style to it. but nothing works and the style is not added. I am following this tutorial: tutorial here is the code that defines the style: CTTableStyleInfo table_style = cttable.addNewTableStyleInfo(); table_style.setName("TableStyleLight1"); table_style.setShowColumnStripes(false); table_style.setShowRowStripes(true); I tryed the styles "TableStyleLight1", "TableStyleLight2", "TableStyleLight3"... etc nothing works, i try to change the name... "Table Style Light 1" which doesn't work as well. Any ideas how to make this work? thanks.
tagged with: apache

http://stackoverflow.com/q/27154631
upvote count: 17
type: Question
has title: Json Mapping Exception can not deserialize instance out of START_ARRAY token
tagged with: jackson
possible better answer: http://stackoverflow.com/a/64903654
answer count: 2
has answer: http://stackoverflow.com/a/27154709
accepted answer: http://stackoverflow.com/a/27154709
downvote count: 0
tagged with: jax-rs
favorite count: 0
has body: I'm trying to parse my json request to my model. I don't know, what is wrong in this code. Syntax of json looks correct and annotations on Java model also. I don't know why I'm getting error like: Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of ParametersType out of START_ARRAY token (through reference chain: Document["parameters"]) Java model: @JsonIgnoreProperties( ignoreUnknown = true ) public class Document { @XmlElement( required = true ) @JsonProperty( "templateId" ) protected String templateId; @JsonProperty( "parameters" ) @XmlElement( required = true ) protected ParametersType parameters; @JsonProperty( "documentFormat" ) @XmlElement( required = true ) protected DocumentFormatType documentFormat; ...} @JsonIgnoreProperties( ignoreUnknown = true ) public class ParametersType { @JsonProperty( "parameter" ) protected List<ParameterType> parameter; ...} @JsonIgnoreProperties( ignoreUnknown = true ) public class ParameterType { @XmlElement( required = true ) @JsonProperty( "key" ) protected String key; @XmlElement( required = true ) @JsonProperty( "value" ) @XmlSchemaType( name = "anySimpleType" ) protected Object value; @JsonProperty( "type" ) @XmlElement( required = true, defaultValue = "STRING_TYPE" ) protected ParamType type; ....} Json code: { "templateId": "123", "parameters": [ { "parameter": [ { "key": "id", "value": "1", "type": "STRING_TYPE" }, { "key": "id2", "value": "12", "type": "STRING_TYPE" } ] } ], "documentFormat": "PDF" }
has answer: http://stackoverflow.com/a/64903654
type: AnsweredQuestion
tagged with: cxf
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 17
has comment: http://stackoverflow.com/comment/77891205

http://stackoverflow.com/comment/110728323
score: 0
type: AnswerComment
has text: Agreed @OleV.V. I added this answer here because still many people using java 6,7 in their project. So just wanted to give them alternative solution.
type: Comment
comment on: http://stackoverflow.com/a/62594232

http://stackoverflow.com/a/27167109
has comment: http://stackoverflow.com/comment/42826212
upvote count: 1
has body: You can do it with Java, C# or any other platform With Java you can follow this tutorial. Just watch the directory for changes then copy changed files to other drive. Watching a Directory for Changes for C# you can use this class and apply same solution .NET FileSystemWatcher Class Reference or simply you can use some tool for synchronization FreeFileSync Good luck
score: 0
answers question: http://stackoverflow.com/q/27166906
type: Answer
downvote count: 1

compiler-errors
tags question: http://stackoverflow.com/q/27156158
tag name: compiler-errors
tags question: http://stackoverflow.com/q/27306971
tags question: http://stackoverflow.com/q/27216354
tags question: http://stackoverflow.com/q/27181442
tags question: http://stackoverflow.com/q/27306965
tags question: http://stackoverflow.com/q/27168733
type: Tag
tags question: http://stackoverflow.com/q/27160247
tags question: http://stackoverflow.com/q/27199384
tags question: http://stackoverflow.com/q/27180549
tags question: http://stackoverflow.com/q/27177388
tags question: http://stackoverflow.com/q/27257301

http://stackoverflow.com/a/27186861
has comment: http://stackoverflow.com/comment/69933625
upvote count: 34
accepted answer of: http://stackoverflow.com/q/27186799
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27186799
has comment: http://stackoverflow.com/comment/69952011
type: Answer
score: 34
downvote count: 0
has comment: http://stackoverflow.com/comment/69941369
has comment: http://stackoverflow.com/comment/69935787
has body: So what are GC roots for the classes? Classloaders, effectively - via other GC roots. If there is nothing which can reach a classloader - which means nothing can reach any classes created by that classloader or any instances of those classes - then both the classloader and the classes it created are eligible for garbage collection. Keeping them alive until then is necessary so that Class::forName and ClassLoader::findClass can be idempotent even when the class's static initializers are not. Hidden classes (see https://openjdk.java.net/jeps/371) are exceptions to this rule. As an implementation detail of OpenJDK, so are the classes of method references, lambdas, and proxies created with the static methods of java.lang.reflect.Proxy. The classloader does not hold a strong reference to these classes.

http://stackoverflow.com/comment/42867190
has text: Yes. When you send out the request, it is serialized JSON form. But who is going to deserialize it back to JsonObject? That is done behind the scenes by a `MessageBodyReader` implementation that supports JSON-P. That reader is provided in the JSON-P module. I'm Not familiar with Gson, so I don't know if that `JsonObject` is a Gson object or a JSON-P object. If it is Gson object, you can take a look at `MessageBodyReader/Writer` implemntation for Gson. You would need to register that provider both with client and server. If it's JSON-P, the JSON-P module will register itself
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27188753

http://stackoverflow.com/q/27173960
has comment: http://stackoverflow.com/comment/42856181
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42953429
tagged with: bean-validation
score: 4
has comment: http://stackoverflow.com/comment/42870910
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42855067
has answer: http://stackoverflow.com/a/27246136
tagged with: hibernate-validator
has comment: http://stackoverflow.com/comment/42862651
has comment: http://stackoverflow.com/comment/42931436
has body: I've got a bean I'd like to do conditional validation on. For this purpose, I've defined a DefaultGroupSequenceProvider&lt;MyObject&gt; which returns the list of groups to validate against. Now, when validating an object that violates the constraints in more than one group in the sequence, only the first group with failures return it's result. I'd like to get an error on all violations, not just the ones in the first group with failures. I'm thinking that this doesn't need a code-sample, but if I'm wrong, I'll be happy to provide one. I followed this http://kh-yiu.blogspot.com/2014/04/conditional-bean-validation-using.html when creating the sequence. We use Spring if that matters. Just a note, this works, in that it is impossible that an invalid bean will be reported as valid. But if the user has some input that breaks 3 constraints, and I return back 2 failures, the user will get another failure on the last field as soon as the first ones are corrected. Not exactly user-friendly. Example: Bean @GroupSequenceProvider(BeanSequenceProvider.class) public class MyBean { @NotEmpty private String name; @NotNull private MyType type; @NotEmpty(groups = Special.class) private String lastName; // Getters and setters } Enum type public enum MyType { FIRST, SECOND } Provider public class BeanSequenceProvider implements DefaultGroupSequenceProvider&lt;MyBean&gt; { @Override public List&lt;Class&lt;?&gt;&gt; getValidationGroups(final MyBean object) { final List&lt;Class&lt;?&gt;&gt; classes = new ArrayList&lt;&gt;(); classes.add(MyBean.class); if (object != null &amp;&amp; object.getType() == MyType.SECOND) { classes.add(Special.class); } return classes; } Group annotation public interface Special { } Test class public class MyBeanTest { private static Validator validator; private MyBean objectUnderTest; @BeforeClass public static void setUpOnce() throws Exception { final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); validator = validatorFactory.g…
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42856951
has title: JSR303 - Apply all validation-groups defined in sequence

http://stackoverflow.com/q/27283559
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43066986
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43067600
tagged with: swing
has comment: http://stackoverflow.com/comment/43035518
linked to: http://stackoverflow.com/q/15124904
has title: Proplem with swingWorker
tagged with: java
has comment: http://stackoverflow.com/comment/43068079
has comment: http://stackoverflow.com/comment/43069916
type: Question
tagged with: swingworker
linked to: http://stackoverflow.com/q/17414109
has comment: http://stackoverflow.com/comment/43068619
score: 0
has body: i am using a loading dialog to be visible when i go to dB and searches for the data so i am using swing worker to be able to view the loading dialog while searching for the data what happen is it couple of time then it raises exp and another couple of time then app goes invisible my code: public void unansweredAdminMsgViewGetData(UnAnsweredAdminFrame frame) { SwingWorker&lt;Void, Void&gt; w = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { while (!me.isVisible()) { Thread.sleep(100); //wait for the dialog to be visible } frame.getData(); //searches and sets the data to the taple me.setVisible(false); return null; } }; w.run(); me.setVisible(true); //view the loading dialog } so i have the following exp : Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1 &gt;= 1 at java.util.Vector.elementAt(Vector.java:474) at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:648) at javax.swing.JTable.getValueAt(JTable.java:2719) at javax.swing.JTable.prepareRenderer(JTable.java:5720) at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2114) at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2016) at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1812) at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) at javax.swing.JComponent.paintComponent(JComponent.java:777) at javax.swing.JComponent.paint(JComponent.java:1053) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JViewport.paint(JViewport.java:744) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax.swing.JComponent.paintChildren(JComponent.java:886) at javax.swing.JComponent.paint(JComponent.java:1062) at javax…
has comment: http://stackoverflow.com/comment/43066382
answer count: 0

http://stackoverflow.com/a/27165652
answers question: http://stackoverflow.com/q/27162854
downvote count: 0
has comment: http://stackoverflow.com/comment/42824347
type: Answer
has comment: http://stackoverflow.com/comment/42823974
score: 3
upvote count: 3
has body: If the device's connectivity status remains static, I would use the strategy pattern. You could have an interface (strategy) 'Features', with an 'OnlineFeatures' implementation and an 'OfflineFeatures' implentation, or you could have each individual feature as a strategy with an enabled implementation and a disabled implementation. I would generally choose the 2nd for more flexibility, but it might be overkill depending on the application design. If the connectivity status needs to change dynamically, you could still use the strategy pattern, but it would depend on what state info you need to maintain between connectivity status changes. As an example ( in C++, but I hope the idea is clear enough ): Say I want a calculator with 2 possible features, being able to add and being able to multiply. I want to have a trial version that only does addition, and a version with both features unlocked. class IAddStrategy { virtual int Add( int first, int second ) = 0; } class CAdd: public IAddStrategy { virtual int Add( int first, int second ) override { return first + second; } } // if I wanted to disable add I could create a CDisabledAdd class class IMultiplyStrategy { virtual int Multiply( int first, int second ) = 0; } class CMultiply : public IMultiplyStrategy { virtual int Multiply( int first, int second ) override { return first * second }; } class CDisabledMultiply : public IMultiplyStrategy { virtual int Multiply( int first, int second ) override { return 0; } } class CCalculator { CCalculator( IAddStrategy &amp;add, IMultiplyStrategy &amp;multiply ) : _add(add), _multiply(multiply) int Add( int first, int second ) { return _add.add(first, second); } int Multiply( int first, int second ) { return _multiply.multiply(first, second); } private: IAddStrategy &amp;_add; IMultiplyStrategy &amp;_multiply; } // You don't necessarily need a factory. If features enabled/disabled status needed to change dynamically, I would need set methods for the strategies on calculator as wel…
has comment: http://stackoverflow.com/comment/42823413

http://stackoverflow.com/q/27155970
tagged with: rest
has body: I'm working on a service to PUT and GET InputStream objects based on a key - these can be anything from basic Strings to files. Here is the PUT method which appears to work just fine: @PUT @Path("{key}") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response addData( final @PathParam("key") String key, final InputStream data) { final Service service = new Service(); try { service.addData(key, data); } finally { IOUtils.closeQuietly(data } return Response.status(204).build(); } Now when I want to get the data (based on a key) I want to return the InputStream which is how the object is stored and retrieved. This is what I have currently: @GET @Path("/{key}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public InputStream getData( @PathParam("key") String key) { // get service and do other stuff ... return service.getData(); //This is an InputStream } When I send a GET, I get a status 200 and a 'Response Does Not Contain Any Data' message ... when I examine the request in Fiddler, it doesn't look like the data is attached. Am I missing something simple here? Thanks. Edit: Here are the responses from: Advanced Rest Client: https://i.sstatic.net/VabeK.jpg Fiddler: https://i.sstatic.net/v1KTc.jpg It seems like there's nothing attached to the response, but I'm not sure. Is there a good way to test whether or not it's returning the InputStream? Edit2: Interesting. Per peeskillet's suggestion of reading the data to see if it's even there I did this: final String data = IOUtils.toString(stream); This returns "" when it should be returning "test". Now I'm not super familiar with IOUtils so maybe their toString(InputStream) is causing it to be "test", but that would suggest that it's not getting set properly in the service. My service for getting the InputStream data looks something like this: final InputStream data = getData(_key); try { if (data == null) { return null; } return object.newBuilder() .setKey(_key) .setData(data) .build(); } finally { IOUtils.closeQuietly(data…
linked to: http://stackoverflow.com/q/1264709
has comment: http://stackoverflow.com/comment/42945118
has title: RESTEasy: return InputStream in response
favorite count: 0
has answer: http://stackoverflow.com/a/27211755
tagged with: resteasy
upvote count: 2
has comment: http://stackoverflow.com/comment/42987558
has answer: http://stackoverflow.com/a/27277055
possible better answer: http://stackoverflow.com/a/27211755
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42944215
has comment: http://stackoverflow.com/comment/42950941
tagged with: java
accepted answer: http://stackoverflow.com/a/27277055
type: Question
has comment: http://stackoverflow.com/comment/42950114
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/42868660
type: QuestionComment
type: Comment
has text: Okay, this is good. But another problem comes. How can I find the pid of this process when it is ran through Tomcat. I can only find the processID of the whole tomcat. If i stop that one it will kill other services in tomcat together.@kiheru
comment on: http://stackoverflow.com/q/27178498
score: 0

http://stackoverflow.com/comment/42817283
score: 1
has text: so these jars are in WEB-INF/lib ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27161780

http://stackoverflow.com/q/27299273
has comment: http://stackoverflow.com/comment/43062641
score: 11
upvote count: 11
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/81825711
type: Question
has comment: http://stackoverflow.com/comment/43084948
has answer: http://stackoverflow.com/a/27948695
has comment: http://stackoverflow.com/comment/43062851
tagged with: java
linked to: http://stackoverflow.com/q/29260900
has answer: http://stackoverflow.com/a/27312269
has answer: http://stackoverflow.com/a/53656886
tagged with: hadoop
answer count: 3
has title: Java: com.sun.tools.javac.Main not found when trying to compile Hadoop program
downvote count: 0
has body: When I try to compile my program in Hadoop with this command bin/hadoop com.sun.tools.javac.Main WordCounter.java from Hadoop folder, it says Error: Could not find or load main class com.sun.tools.javac.Main I looked in similar threads where people suggested to check if JAVA_HOME is properly stated. So in etc/hadoop/hadoop-env.shI added this line export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 then checked if tools.pack is properly unpacked in /usr/lib/jvm/java-7-openjdk-amd64/lib and it was. Then I tried javac -version which gave javac 1.7.0_65 I tried to reinstall Java but it didn't solve the problem.
favorite count: 0
has comment: http://stackoverflow.com/comment/43062722

http://stackoverflow.com/comment/42804774
has text: @SotiriosDelimanolis it ends the method - which happens to be the last thing in the program.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27155180

http://stackoverflow.com/q/27280729
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/45377972
possible better answer: http://stackoverflow.com/a/45377972
accepted answer: http://stackoverflow.com/a/27282139
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27282139
has body: I write FCFS algorithm , But there is one mistake when i want to calculate waiting time for second process. I know waiting time is calculated by: Waiting time for first process: 0 For others: Waiting time[i] = FinishedTime[i] - arrivalTime[i] - BurstTime[i] Here is my code: public class FCFS2 { static int[] burstTimes = new int[3]; static int[] arrivalTimes = new int[3]; static Scanner in = new Scanner(System.in); static int[] processes = new int[3]; static int[] waitingTimes = new int[3]; static int[] finishedTimes = new int[3]; public static void main(String[] args) { System.out.println("CPU Scheduling Algorithm - First Come First Serve"); //read Arrival times for (int i = 0; i &lt; 3; i++) { System.out.print("Enter Arrival time for process " + (i + 1) + ": "); arrivalTimes[i] = in.nextInt(); processes[i] = i; } System.out.println(); //read burst times for (int i = 0; i &lt; 3; i++) { System.out.print("Enter Burst time for process " + (i + 1) + ": "); burstTimes[i] = in.nextInt(); } // Sort by arrival Times for (int i = 0; i &lt;= 3; i++) { for (int j = i + 1; j &lt; 3; j++) if (arrivalTimes[i] &gt; arrivalTimes[j]) { // swap in arrival times int tempAr = arrivalTimes[i]; arrivalTimes[i] = arrivalTimes[j]; arrivalTimes[j] = tempAr; //swap in burst times too int tempBr = burstTimes[i]; burstTimes[i] = burstTimes[j]; burstTimes[j] = tempBr; } } // calculate finished times finishedTimes[0] = arrivalTimes[0] + burstTimes[0]; for (int k = 1; k &lt; 3; k++) { finishedTimes[k] = finishedTimes[k - 1] + burstTimes[k]; } System.out.println("\nArrival Times:"); for (int k = 0; k &lt; 3; k++) { System.out.print(arrivalTimes[k] + " | "); } System.out.println("\nBurst Times:"); for (int k = 0; k &lt; 3; k++) { System.out.print(burstTimes[k] + " | "); } System.out.println("\nFinished Times:"); for (int k = 0; k &lt; 3; k++) { System.out.print(finishedTimes[k] + " | "); } //calculate waiting times for each process waitingTimes[0] = 0; for (int i = 1; i &lt; 3; i++) { waitingTimes…
has title: Waiting time in FCFS scheduling algorithm
type: Question
tagged with: algorithm

jar
tags question: http://stackoverflow.com/q/27212498
tags question: http://stackoverflow.com/q/27306666
tags question: http://stackoverflow.com/q/27313814
tags question: http://stackoverflow.com/q/27238608
tags question: http://stackoverflow.com/q/27301569
tags question: http://stackoverflow.com/q/27258103
tags question: http://stackoverflow.com/q/27202481
tags question: http://stackoverflow.com/q/27235937
tags question: http://stackoverflow.com/q/27272404
tags question: http://stackoverflow.com/q/27293690
tags question: http://stackoverflow.com/q/27280691
tags question: http://stackoverflow.com/q/27227994
tags question: http://stackoverflow.com/q/27301069
tags question: http://stackoverflow.com/q/27253491
type: Tag
tags question: http://stackoverflow.com/q/27253816
tags question: http://stackoverflow.com/q/27169503
tags question: http://stackoverflow.com/q/27261097
tags question: http://stackoverflow.com/q/27275401
tags question: http://stackoverflow.com/q/27158942
tags question: http://stackoverflow.com/q/27221428
tags question: http://stackoverflow.com/q/27239051
tags question: http://stackoverflow.com/q/27230237
tags question: http://stackoverflow.com/q/27232668
tags question: http://stackoverflow.com/q/27259512
tags question: http://stackoverflow.com/q/27181179
tags question: http://stackoverflow.com/q/27281906
tag name: jar
tags question: http://stackoverflow.com/q/27214547
tags question: http://stackoverflow.com/q/27203309
tags question: http://stackoverflow.com/q/27285246
tags question: http://stackoverflow.com/q/27291004
tags question: http://stackoverflow.com/q/27162432
tags question: http://stackoverflow.com/q/27229720
tags question: http://stackoverflow.com/q/27227647
tags question: http://stackoverflow.com/q/27191362
tags question: http://stackoverflow.com/q/27313529
tags question: http://stackoverflow.com/q/27171445
tags question: http://stackoverflow.com/q/27286846
tags question: http://stackoverflow.com/q/27208003
tags question: http://stackoverflow.com/q/27221092
tags question: http://stackoverflow.com/q/27158769
tags question: http://stackoverflow.com/q/27234687
tags question: http://stackoverflow.com/q/27236580
tags question: http://stackoverflow.com/q/27286042
tags question: http://stackoverflow.com/q/27287541
tags question: http://stackoverflow.com/q/27168951

http://stackoverflow.com/a/27236815
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You have a few errors in your code, and I'll do my best to point them out. Firstly, you have this if-statement: if (date.getisLeapYear()==true); An if-statement must have a body made up of an opening brace and closing brace (I believe this would compile, but serves no purpose). Instead: if (date.getisLeapYear()==true) { //do something } Since this appears to be a boolean getter, the conditional check can be shortened to: if (date.getisLeapYear()) {//this checks for a "true" value, !date.getisLeapYear() checks for false //do something } Your check for isLeapYear being true is incorrect, and again typed out in length when not necessary. if (isLeapYear = true) Should be: if (isLeapYear)//again checking if true. !isLeapYear would be checking for false. Your constructor is built weird and completely wrong. First of all, if you're using an if-else statement, it must utilize braces. The following is valid, but considered to be bad practice: if (condition) //do soemthing The following requires braces: if (condition) { } else if (another condition) { } (...) Finally, you're declaring a getter inside the constructor. Methods can only be created at the class scope, meaning methods cannot be created inside a method. To solve this: public Date() { (...) } public boolean getisLeapYear() { return isLeapYear; } Also, just as a tip, you can chain multiple instances of a variable in one declaration: String month; String day; String year; Can be written as: String month, day, year; I have no idea if that covers all your errors, but that's a healthy start.
answers question: http://stackoverflow.com/q/27236396

http://stackoverflow.com/a/27304607
downvote count: 0
has body: Declare a variable to hold the current minimum distance. It can be initialized to a really large number Integer.MAX_VALUE so that the first distance calculated becomes the initial minimum distance. Use a for loop to loop over the values. You'll be accessing the element at the current index and the next index, so stop your for loop early to prevent an ArrayIndexOutOfBoundsException. In the for loop, calculate the difference. If the difference is less than the current minimum, then update the current minimum to the current difference.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27304556
upvote count: 2

http://stackoverflow.com/q/27257867
answer count: 1
has body: I need to determine whether or not a magic square is magic or not. I need to compare the sum for every row and the sum with every column and then compare those with the sum of the diagonal and then with the sum of the other matrix. I have calculated the sum for every row and for every column including with the two diagonals. I need it to return true if the square is magic (all rows, cols, and diagonals have same sum false otherwise) How would i set up this code?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42989623
has answer: http://stackoverflow.com/a/27257980
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/42989625
type: AnsweredQuestion
has title: Determining whether or not a matrix is magic or not
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/27257980
type: Question
has comment: http://stackoverflow.com/comment/42989388
tagged with: matrix

http://stackoverflow.com/comment/42970005
type: Comment
comment on: http://stackoverflow.com/q/27247530
has text: I think reading your code comments alone shows which way should be preferred
score: 0
type: QuestionComment

named-query
type: Tag
tags question: http://stackoverflow.com/q/27232323
tag name: named-query
tags question: http://stackoverflow.com/q/27273547

http://stackoverflow.com/comment/43311264
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27429095
type: AnswerComment
has text: "You can provide a message..." Really? How? Please show me a Java code example. When a verifier fails, it gives no information as to what check failed, for that reason a custom message would help, but even that isn't possible yet

http://stackoverflow.com/q/27304602
has title: Arrays-odds and evens to determine how many of the values in the array are odd and how many are even
has comment: http://stackoverflow.com/comment/43096747
favorite count: 0
has answer: http://stackoverflow.com/a/27304806
has answer: http://stackoverflow.com/a/27318427
answer count: 4
has answer: http://stackoverflow.com/a/27305018
has comment: http://stackoverflow.com/comment/43072783
has answer: http://stackoverflow.com/a/27305373
possible better answer: http://stackoverflow.com/a/27304806
upvote count: 2
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27318427
tagged with: java
has comment: http://stackoverflow.com/comment/43072168
has body: I'm trying to find the evens and odds of an array for practice. Sample Data : 2 4 6 8 10 12 14 1 2 3 4 5 6 7 8 9 2 10 20 21 23 24 40 55 60 61 Sample Output : Odds - [] Evens - [2, 4, 6, 8, 10, 12, 14] Odds - [1, 3, 5, 7, 9] Evens - [2, 4, 6, 8] Odds - [21, 23, 55, 61] Evens - [2, 10, 20, 24, 40, 60] And here is my code so far: import java.util.Scanner; public class OddsAndEvens { private static int countEm(int[] array, boolean odd) { int count = 0; int dum = 0; for(int i=0; i&lt; array.length; i++) { dum = array[i] / 2; if(dum == 0 ) { count++; } } return count; } public static int[] getAllEvens(int[] array) { int numberEvens=0; for(int i =0; i&lt;array.length; i++) { if(array[i]%2 ==0) { numberEvens++; } } int[] evens = new int[array.length - countEm(array,false)]; int count=0; for(int i=0; i&lt;array.length; i++) { if(array[i]%2==0) { evens[count] = array[i]; count++; } } return evens; } public static int[] getAllOdds(int[] array) { int numberEvens = 0; for (int i = 0; i &lt; array.length; i++) { if (array[i] % 2 == 0) { numberEvens++; } } return null; } } But I been getting errors in my output. These errors are the fact I am getting zeros in my output . I'm just starting out and I'm hoping anyone can help me.
has comment: http://stackoverflow.com/comment/43072339
type: Question
tagged with: arrays
score: 1

http://stackoverflow.com/comment/43012507
has text: Turns out the issue is with the Gradle "application" plugin.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27267586
type: AnswerComment

http://stackoverflow.com/comment/43086393
comment on: http://stackoverflow.com/q/27313005
score: 0
type: Comment
type: QuestionComment
has text: Can you elaborate this date `2013-06-30 00:00:00+00:00`? I think your data is in a excel sheet??

http://stackoverflow.com/a/27156832
has comment: http://stackoverflow.com/comment/42841511
has comment: http://stackoverflow.com/comment/42864418
score: 4
has body: Objectify will not load anything referenced unless you .get() it explicitly, this results in individual fetches, or you tell it to auto load all the things via @Load. That speeds up loading overall because it can batch process the request instead of forming several individual ones. If by "I don't always need the list" you mean that you have distinct cases of "need" vs "not need", take a look at load groups, essentially a way to turn the @Load annotation on or off. https://code.google.com/p/objectify-appengine/wiki/Entities#Relationships has examples like yours https://code.google.com/p/objectify-appengine/wiki/BasicOperations#Load_Groups to turn on/off auto loading There is btw a way to load a list of Refs in a single batch using Map&lt;Key&lt;T&gt;,T&gt; Loader#refs(Iterable&lt;Ref&lt;T&gt;&gt; refs) public List&lt;T&gt; getTees(){ Collection&lt;T&gt; values = ofy().load().refs(data).values(); return new ArrayList&lt;T&gt;(values); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42864486
has comment: http://stackoverflow.com/comment/42850412
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/42841456
has comment: http://stackoverflow.com/comment/42843519
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27156185
answers question: http://stackoverflow.com/q/27156185

http://stackoverflow.com/q/27160578
tagged with: encryption
has body: Is there anyway to change this code so it will only encrypt uppercase letters? I don't need to it do lowercase or symbols. Thanks! public class CaesarCypher { public static final int MOVE_DOWN = 4; public static void main(String [] args) { String plainText; char character; System.out.println("Enter sentence or word to Encrypt: "); plainText = Console.readString(); for ( int iteration = 0 ; iteration &lt; plainText.length() ; iteration++ ) { character = plainText.charAt( iteration ); if ( character != ' ' ) { character = (char) ( 'a' + ( character - 'a' + MOVE_DOWN ) %26 ); } System.out.print(character); } } }
type: AnsweredQuestion
has title: Encrypting using Caesar Cipher
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27161092
accepted answer: http://stackoverflow.com/a/27161092
score: 0
answer count: 1

http://stackoverflow.com/comment/69826347
type: AnswerComment
has text: Patrick, I had expected you to be too experienced on Stackoverflow to solve people’s homework assignments for them. :-)
comment on: http://stackoverflow.com/a/27293146
type: Comment
score: 1

http://stackoverflow.com/a/27230474
answers question: http://stackoverflow.com/q/27230419
score: 1
upvote count: 1
has body: It's still called an interface, it prevents you from making mistakes, so you should use it however. Checkout the JSR http://docs.oracle.com/javase/specs/#9.6.4.4 Chapter 9.6.4.4 @Override also: Should we @Override an interface&#39;s method implementation?
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42923973
comment on: http://stackoverflow.com/a/27222674
score: 0
type: AnswerComment
has text: Thanks, I'm working on it now.
type: Comment

http://stackoverflow.com/comment/42989738
type: Comment
has text: So can you wait for onResume to start it?
score: 0
comment on: http://stackoverflow.com/q/27257838
type: QuestionComment

http://stackoverflow.com/q/27229066
has title: Tomcat restart or redeploy breaks unicode characters from java source files
tagged with: java
type: Question
score: 0
answer count: 2
has body: I have developed a liferay 6.2 application using jsf and primefaces 4. I have unicode characters both in xhtml files and java source files. There a strange behaviour of breaking my characters after tomcat restart or redeploy of application and the problem is only with characters coming from the source files. The rest unicode characters on the page are displayed correctly. And the behaviour is not always reproducible. I have read posts referring to setting the jvm's or tomcat default encoding and main suggested action was setting -Dfile.encoding=UTF-8 but didn't have any luck. I am using tomcat 7.0.42
tagged with: tomcat
tagged with: unicode
has comment: http://stackoverflow.com/comment/43091032
has answer: http://stackoverflow.com/a/27229229
has answer: http://stackoverflow.com/a/27327131
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42953134

http://stackoverflow.com/comment/43094594
has text: @Rafael: it is not so simple. That method works only if you use default ports (80 and 443) or if you already know the ports you have to use. That information is stored in the standalone.xml but web apps have no access to it.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27302201

http://stackoverflow.com/q/27221275
has answer: http://stackoverflow.com/a/27221340
has comment: http://stackoverflow.com/comment/42921794
has title: Getting Null Pointer Exception with Factory Method
possible better answer: http://stackoverflow.com/a/27221340
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27221316
accepted answer: http://stackoverflow.com/a/27221316
type: Question
tagged with: factory-pattern
score: 0
answer count: 2
tagged with: nullpointerexception
has body: I am trying to implement the Factory Pattern/Method to create a new class but I keep getting a Null Pointer exception. I have stepped through the code and I can't seem to work out what it is. public class RandomEnemy { SpaceShipFactory theFactory; private ArrayList&lt;SpaceShip&gt; enemyList; public RandomEnemy(){ setFactory(new SpaceShipFactory()); } public void createRandomEnemy(int i){ SpaceShip s; s = this.theFactory.createShip(i); enemyList.add(s); } public void setFactory(SpaceShipFactory theFactory){ this.theFactory = theFactory; } } And the Factory Class: public class SpaceShipFactory { public SpaceShip createShip(int i){ SpaceShip s = null; if(i == 1){ s = new SpaceShip(QuickLoad("battlecruiser"), 0, 0, 256, 256); System.out.println("Result is battlecruiser"); } else if(i == 2){ s = new SpaceShip(QuickLoad("battleshooter"), 0, 0, 256, 256); System.out.println("Result is battleshooter"); } else if(i == 3){ s = new SpaceShip(QuickLoad("battlestar"), 0, 0, 256, 256); System.out.println("Result is battlestar"); } return s; } } When enemyList.add(s); is run I get a Null Pointer Exception. Any ideas why this is happening? I feel like I am missing something pretty obvious.
has comment: http://stackoverflow.com/comment/42921499

http://stackoverflow.com/a/27244428
has comment: http://stackoverflow.com/comment/42964260
has comment: http://stackoverflow.com/comment/42964774
has comment: http://stackoverflow.com/comment/42964933
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/27244408
has comment: http://stackoverflow.com/comment/42964268
has comment: http://stackoverflow.com/comment/42964274
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27244408
downvote count: 0
has comment: http://stackoverflow.com/comment/42964554
has comment: http://stackoverflow.com/comment/42964223
has comment: http://stackoverflow.com/comment/42964319
has body: Streams and lambda expressions are Java 8 functionality. Upgrade your compiler.
type: Answer
has comment: http://stackoverflow.com/comment/42964314
has comment: http://stackoverflow.com/comment/42964301

http://stackoverflow.com/comment/43069255
has text: You can create a proxy by yourself. I think that's the only solution besides using a different library.
comment on: http://stackoverflow.com/q/27302765
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27248294
has comment: http://stackoverflow.com/comment/42971318
score: 0
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/42971470
tagged with: rest
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/42971937
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has title: Parsing JSON Object to Restful web service
has comment: http://stackoverflow.com/comment/42971059
downvote count: 1
has comment: http://stackoverflow.com/comment/42972052
type: Question
has answer: http://stackoverflow.com/a/27248674
has answer: http://stackoverflow.com/a/27248603
has body: I am developing an android registration system that communicates with a mysql database through JSON. The restful web service was written with PHP and Slim library. i have tested the web service using Advanced Rest Client App by parsing a json payload data into it and it works perfectly fine with the result shown below. At the moment i am trying to parse user data from the android app to the server and it shows this error (Error parsing data org.json.JSONException: Value &lt;html&gt;&lt;head&gt;&lt;title&gt;Slim of type java.lang.String cannot be converted to JSONObject). I would someone to tell me what i am doing wrong coz i feel the error is from my JSONParser class and Userfunction. Thanks in advance. Here is my test result {"tag":"signup","success":1,"error":0,"uid":"547d92b0480711.90973742", "result":{"firstname":"mish","lastname":"harry","email":"mishael19@gmail.com"}} Here is JSONParser public class JSONParser2 { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser2() { } public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params){ try{ if(method.equals("POST")){ DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); }else if(method == "GET"){ DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try{ Buf…
has answer: http://stackoverflow.com/a/27249266

http://stackoverflow.com/comment/42986854
score: 0
type: QuestionComment
type: Comment
has text: The more specific information you can give to your problem the more we can help with your specific issue. Can you tell us the format of the text file and the end goal? EDIT just saw your edit.
comment on: http://stackoverflow.com/q/27256423

http://stackoverflow.com/q/27210179
tagged with: android
has answer: http://stackoverflow.com/a/27210270
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27210270
tagged with: java
has body: I want to make android program :-- As like this picture. How can I make?? I have to try Animation??or video??? Pls just tell me the process how can I achieve that.
downvote count: 1
type: Question
has title: In Android how I do the the picture moving?
score: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/51901956
score: 4
type: Answer
upvote count: 4
has body: I solved it by this line of code recyclerView.setNestedScrollingEnabled(false);
has comment: http://stackoverflow.com/comment/124505986
downvote count: 0
answers question: http://stackoverflow.com/q/27188536

http://stackoverflow.com/comment/42822749
has text: Looks like `sh1.getRow(0)` or `sh1.getRow(0).getCell(2)` is null. So you get the NPE
type: Comment
comment on: http://stackoverflow.com/a/27165160
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42901747
comment on: http://stackoverflow.com/a/27209899
score: 0
type: Comment
type: AnswerComment
has text: @user I don't understand. If it's a Spring bean, then it's already been instantiated.

jackrabbit
tags question: http://stackoverflow.com/q/27239837
tag name: jackrabbit
type: Tag

http://stackoverflow.com/a/27252834
accepted answer of: http://stackoverflow.com/q/27252692
answers question: http://stackoverflow.com/q/27252692
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You cannot "address" a local variable by index - you need an array for that: List&lt;Integer&gt;[] list = new List&lt;Integer&gt;[] { arrayList.subList(0, 3) , arrayList.subList(3, 6) , arrayList.subList(6, 9) }; ArrayList&lt;Integer&gt; newArray = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; 3; i++) { newArray.addAll(list.get(i)); } In your specific example you can construct sublist on the fly, without storing them in an array: ArrayList&lt;Integer&gt; newArray = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; 3; i++) { newArray.addAll(arrayList.subList(3*i, 3*(i+1))); }
upvote count: 3

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/27164945

http://stackoverflow.com/q/27270125
has title: 1 or more object with the same name?
tagged with: java
has answer: http://stackoverflow.com/a/27270339
type: Question
has body: I have possibly gotten the title wrong but I don't know what else to say. Our lecturer gave us this code today: do { System.out.println("Enter an amount for a new account, or anything else to end: "); if(in.hasNextInt()) { int openBalance = in.nextInt(); System.out.print("Enter account name: "); String name = in.next(); // part I don't understand BankAccount newAccount = new BankAccount(name, openBalance); bankAccountList.add(newAccount); // part I don't understand } else { finished = true; } } while(!finished); I understand everything apart from what is in bold (Well what should be bold but it is code so), pretty much we have to make as many bank accounts as the user wants until something other than an int is inputted. BUT wouldn't BankAccount newAccount = new BankAccount(name, openBalance); create an object with the same name as the previous account made? if someone could please explain the code then that would be amazing. Thank you.
score: 0
has comment: http://stackoverflow.com/comment/43010471
answer count: 3
has answer: http://stackoverflow.com/a/27270163
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27270353

http://stackoverflow.com/q/27296137
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27981016
upvote count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: vaadin7
tagged with: maven
score: 2
has answer: http://stackoverflow.com/a/44539675
has body: If I try to run in eclipse maven vaadin:compile-theme I get: [WARNING] Vaadin plugin could not find any themes. [INFO] No themes found. Use the parameter "vaadin.theme" to explicitly select a theme. I have some themes in my project, how can i specify them? I'm not sure how to do it correcty, can somebody help me? Here is my pom.xml 4.0.0 erion erion 0.0.1-SNAPSHOT war erion an administration tool for stores <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <vaadin.version>7.3.5</vaadin.version> <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version> vaadin-addons http://maven.vaadin.com/vaadin-addons vaadin-snapshots http://oss.sonatype.org/content/repositories/vaadin-snapshots/ false true vaadin-snapshots http://oss.sonatype.org/content/repositories/vaadin-snapshots/ false true com.vaadin vaadin-server ${vaadin.version} com.vaadin vaadin-client-compiled ${vaadin.version} com.vaadin vaadin-client-compiler ${vaadin.version} provided com.vaadin vaadin-client ${vaadin.version} provided com.vaadin vaadin-push ${vaadin.version} com.vaadin vaadin-themes ${vaadin.version} javax.servlet javax.servlet-api 3.0.1 provided org.hibernate hibernate-core 4.3.6.Final com.itextpdf itextpdf 5.5.3 org.peimari dawn 2 mysql mysql-connector-java 5.1.33 org.apache.maven.plugins maven-compiler-plugin 1.7 1.7 maven-clean-plugin 2.4.1 src/main/webapp/VAADIN/widgetsets org.apache.maven.plugins maven-war-plugin 2.2 false com.vaadin vaadin-maven-plugin ${vaadin.plugin.version} -Xmx512M -Xss1024k ${basedir}/src/main/webapp/VAADIN/widgetsets ${basedir}/src/main/webapp/VAADIN/widgetsets <persistentunitcachedir>${project.build.directory}</persistentunitcachedir> ${project.build.directory}/gwt-deploy false true false true http://localhost:8080/ clean resources update-theme update-widgetset compile-theme compile org.mortbay.jetty jetty-maven-plugin org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> com.vaadin vaadin-maven-plugin [7.3.2,) resources update-widg…
downvote count: 0
tagged with: java
has title: Vaadin maven compile themes

http://stackoverflow.com/comment/42914894
type: Comment
type: QuestionComment
has text: @PammGupta: usually, the context being quite a volatile thing, it is customary to explicitely pass it to every method that needs it. You're method would be `JSONObject parseJSON(Context context)`
score: 0
comment on: http://stackoverflow.com/q/27209358

http://stackoverflow.com/a/27303424
answers question: http://stackoverflow.com/q/27303285
type: Answer
score: 0
has body: Put a try/catch around your call to textFile.nextInt() and catch the InputMismatchExceptions. That way you can count the non-numbers and keep the exception from breaking you out of your loop.

http://stackoverflow.com/q/27224600
has answer: http://stackoverflow.com/a/27224663
tagged with: java
type: Question
answer count: 2
tagged with: arrays
has body: I have a 2-D array called ITdouble, and I want the 1-D array I to be assigned to the character in the position l of the 2-D array. I have tried the following code: double[][] ITdouble = new double[32][2]; double[] I = new double [32]; for (int i=0; i&lt;IT.length; i++) { for(int l=0; l&lt;5; l++) { I[l]=ITdouble[i][0].charAt(l); } } However an error "Double cannot be dereferenced" is being shown. Is there any other simple way to do this please?
has answer: http://stackoverflow.com/a/27224671
tagged with: character
type: UnansweredQuestion
has title: how to get a character from a particular position in a 2-D array
score: 0

http://stackoverflow.com/comment/42857212
type: Comment
comment on: http://stackoverflow.com/a/27174797
score: 1
type: AnswerComment
has text: Most of code running out there won't work? No, it doesn't. It works pretty well 99% but there is that 1%. For a little bit more structured discussion: [this post](http://stackoverflow.com/a/23370462/1207195), [this post](http://stackoverflow.com/a/17941178/1207195), [this post](http://stackoverflow.com/a/26118918/1207195) and [this article](http://en.wikipedia.org/wiki/Duplicate_characters_in_Unicode). Many posts on SO about UNICODE surrogate handling...

http://stackoverflow.com/a/27332721
has comment: http://stackoverflow.com/comment/43392035
type: Answer
upvote count: 32
has body: Actually, several of the other answers seem wrong: it's true that two binary reflected Gray code neighbours differ by only one bit (I assume that by « the » Gray code sequence, you mean the original binary reflected Gray code sequence as described by Frank Gray). However, that does not mean that two Gray codes differing by one bit are neighbours (a =&gt; b does not mean that b =&gt; a). For example, the Gray codes 1000 and 1010 differ by only one bit but are not neighbours (1000 and 1010 are respectively 15 and 12 in decimal). If you want to know whether two Gray codes a and b are neighbours, you have to check whether previous(a) = b OR next(a) = b. For a given Gray code, you get one neighbour by flipping the rightmost bit and the other neighbour bit by flipping the bit at the left of the rightmost set bit. For the Gray code 1010, the neighbours are 1011 and 1110 (1000 is not one of them). Whether you get the previous or the next neighbour by flipping one of these bits actually depends on the parity of the Gray code. However, since we want both neighbours, we don't have to check for parity. The following pseudo-code should tell you whether two Gray codes are neighbours (using C-like bitwise operations): function are_gray_neighbours(a: gray, b: gray) -&gt; boolean return b = a ^ 1 OR b = a ^ ((a &amp; -a) &lt;&lt; 1) end Bit trick above: a &amp; -a isolates the rigthmost set bit in a number. We shift that bit by one position to the left to get the bit we need to flip.
downvote count: 1
has comment: http://stackoverflow.com/comment/54346509
has comment: http://stackoverflow.com/comment/54354491
answers question: http://stackoverflow.com/q/27218894
score: 31

http://stackoverflow.com/a/27265295
has comment: http://stackoverflow.com/comment/43002370
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43002198
has body: When you close the connections using MySQL Workbench, you are closing them on the server end. On the JDBC (client) side, the previously established connections will remain in existence until the client code attempts to use them. At that point, they will be found to be "broken"; i.e. the client will get exceptions when it tries to use them. The client-side JDBC Connection objects only get closed or recycled when they are returned to the connection pool by your Java application code.
answers question: http://stackoverflow.com/q/27263971
score: 1
accepted answer of: http://stackoverflow.com/q/27263971
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27180281
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27180189
upvote count: 2
has body: I'm not sure why are you using a loop inside a loop, but this will be my approach, according to a what I understand from your problem. ArrayList&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; 15; i++) { if (intList.size() == 10) { break; } intList.add(i); System.out.println(intList.get(i)); } Hope this can give you a clue and you can find a solution to your problems. Regards and happy coding.
answers question: http://stackoverflow.com/q/27180189
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42849159

http://stackoverflow.com/q/27153109
answer count: 1
downvote count: 0
tagged with: dom-events
favorite count: 0
accepted answer: http://stackoverflow.com/a/27165983
score: 2
has answer: http://stackoverflow.com/a/27165983
has title: How can GWT know if it's first time to receive non-empty JSON data from back end?
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
has body: As the title said, when users have a totally fresh installed software, they may need to wait 3-5 minutes to make database run in the back end to get data in GUI. So, during the loading time, I just show "Please wait....". In my GWT code, I use my own Timer class to call back end code every 2 seconds to get back end result through JSON. My question is, How can GWT code know it's first time to receive non-empty JSON data from back end database? Because I want to refresh the page immediately when the JSON object is not empty.

http://stackoverflow.com/comment/43025354
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27275728
has text: Exactly.. Use classes of first.jar which is inside second.jar

http://stackoverflow.com/a/27268459
score: 0
answers question: http://stackoverflow.com/q/27259453
type: Answer
has body: Also I have jstl-1.2.jar file in WebContent/WEB-INF/lib folder, and that jar added in Java Build Path -> Libaries But I haven't JSTL in Project Facets There is no JSTL in web.xml: <?xml version="1.0" encoding="UTF-8"?> myServlet index.html index.htm index.jsp default.html default.htm default.jsp
has comment: http://stackoverflow.com/comment/43007843

http://stackoverflow.com/comment/42891295
score: 0
type: Comment
type: QuestionComment
has text: Provide a testcase. I don't understand your problem.
comment on: http://stackoverflow.com/q/27204308

http://stackoverflow.com/q/27229047
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42935239
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/42937094
type: Question
has comment: http://stackoverflow.com/comment/42952433
score: 0
has title: scrolling never-ending background in Game not working as expected
has body: I am working on my first side-scroller game and am trying to achieve a neverending background effect and it's nearly working as i would expect but there are little glitches. I have 2 instances of the background (each fills the screen width), with one placed at the bottom left corner of the screen and one off the screen to the right. I am then moving my camera each frame to the right and when the first background instance is completely offscreen to the left i reset its X to the right of the camera so that it is now (relative to the camera) off the right of the screen. this is working a lot of the time, but every now and again it seems the method to reset its x position is getting called a few frames late and results in a gap in the background. the update code i am using in the main game is - private void update(float delta){ //update camera and world camera.position.set(camera.position.x+scrollSpeed, camera.position.y, 0); camera.update(); world.step(step, velocityIterations, positionIterations); if(gameInProgress){ //backgrounds (array holds the 2 instances of the background) for(int i=0; i&lt; bgFillArray.size; i++){ bgFillArray.get(i).update(); } } stage.act(delta); tweenManager.update(delta); } the update method in the BgFill class - public void update(){ float currentXPos = getX(); float leftBoundary = camera.position.x-1200; float rightOfScreen = camera.position.x+400; if(active){ //check to see if the camera has gone past this instance. if so then move to right if(currentXPos &lt;= leftBoundary){ setX(rightOfScreen); } } } Firstly, is this the usual way (or even close) to do a continuous scrolling background? if it is, what am I doing wrong?
linked to: http://stackoverflow.com/q/18172006
tagged with: side-scroller
has comment: http://stackoverflow.com/comment/42945058
has comment: http://stackoverflow.com/comment/42936025
has comment: http://stackoverflow.com/comment/42950094
answer count: 0

http://stackoverflow.com/a/27202036
answers question: http://stackoverflow.com/q/27196809
score: 3
type: AcceptedAnswer
downvote count: 0
has body: The other bindings and injections you need should be set up just like the first one. Use @Inject wherever the instance is needed, and bind the interface to an impl in your module. I've added 4 lines below (annotated 2 injection sites and defined 2 more bindings): public interface MyService { // ... } public class MyServiceImpl implements MyService { @Inject private MyCommand myCommand; } public interface MyCommand { // ... } public class MyCommandImpl implements MyCommand { @Inject private MyDAO myDAO; } public interface MyDAO { // ... } public class MyDAOImpl implements MyDAO { // ... } public class MyModule extends AbstractModule { @Override protected void configure() { bind(MyService.class).to(MyServiceImpl.class); bind(MyCommand.class).to(MyCommandImpl.class); bind(MyDAO.class).to(MyDAOImpl.class); } } public class MyDriver { @Inject private MyService myService; public static void main(String[] args) { MyModule module = new MyModule(); Injector injector = Guice.createInjector(module); MyDriver myDriver = injector.getInstance(MyDriver.class); // Should have been injected with a MyServiceImpl, // Which should have been injected with a MyCommandImpl, // Which should have been injected with a MyDAOImpl. myDriver.getMyService().doSomething(); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/27196809
upvote count: 3

http://stackoverflow.com/comment/43046716
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27279601
has text: Hi, I do understand what you mean - let me explain what happens with my proposed approach: 1) You start with one JVM process which contains the executor. The executor spawns as many runnables as you need, let say 10. Each one of these Runnable instances use ProcessBuilder to execute HexagonRunner. 2) Each ProcessBuilder instance detaches a SEPARATE JVM through a command line call (that's what ProcessBuilder is meant for). The result is that you use ExecutorService to detach multiple threads, whose sole purpose is to detach an individual process in a separate JVM.

http://stackoverflow.com/comment/42880515
comment on: http://stackoverflow.com/a/27190905
type: AnswerComment
score: 0
type: Comment
has text: But to refers to the same object as last.

http://stackoverflow.com/q/27231193
has comment: http://stackoverflow.com/comment/42939212
tagged with: sockets
tagged with: multithreading
upvote count: 1
accepted answer: http://stackoverflow.com/a/27231382
type: AnsweredQuestion
has title: Try-with-resources closes sockets of spawned childs
has comment: http://stackoverflow.com/comment/42939821
score: 1
tagged with: java
tagged with: try-with-resources
type: Question
has comment: http://stackoverflow.com/comment/42939290
downvote count: 0
answer count: 1
has body: I want to write a simple server that listens on a port and spawns new threads for handling new connections. I attempted to use try-with-resources for accepting new connections but failed because sockets in child threads seem to be closed immediately and I don't understand why. Here are 2 simplified examples. a) The working example of the server (without try-with-resources): package MyTest; import java.io.BufferedReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class MyServerA implements Runnable { private int port; private ServerSocket serverSocket; public MyServerA(Integer port) { this.port = port; } @Override public void run() { try { serverSocket = new ServerSocket(port); } catch(IOException ioe) { System.err.println("error opening socket. " + ioe.getStackTrace()); } while (true) { Socket clientSocket = null; try { clientSocket = serverSocket.accept(); ClientServiceThread cliThread = new ClientServiceThread(clientSocket); cliThread.start(); } catch (IOException e) { e.printStackTrace(); } } } class ClientServiceThread extends Thread { private Socket s; boolean goOn = true; ClientServiceThread(Socket s) { this.s = s; } public void run() { BufferedReader in = null; PrintWriter out = null; try { in = new BufferedReader(new InputStreamReader(this.s.getInputStream())); out = new PrintWriter(new OutputStreamWriter(this.s.getOutputStream())); while (goOn) { final String req = in.readLine(); if (req != null) { System.out.println("got: " + req); out.println("you said: " + req); out.flush(); if (req.contains("bye")) { System.out.println("closing thread"); goOn = false; } } } s.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void main(String[] args) { MyServerA a = new MyServerA(30000); a.run(); } } b) Exactly the same, but with try-with-resources (doesn't work): package MyTest; import java.io.BufferedRe…
favorite count: 0
has answer: http://stackoverflow.com/a/27231382
has comment: http://stackoverflow.com/comment/42939757

http://stackoverflow.com/a/27291083
has comment: http://stackoverflow.com/comment/43129555
has comment: http://stackoverflow.com/comment/43082161
has comment: http://stackoverflow.com/comment/43129577
has comment: http://stackoverflow.com/comment/43185890
upvote count: 2
has comment: http://stackoverflow.com/comment/43129679
has body: You have to use absolute path for this. String path = new File(".").getAbsolutePath(); Process pr = rt.exec("java -jar "+ path + "/libs/myJar.jar");
has comment: http://stackoverflow.com/comment/43129620
has comment: http://stackoverflow.com/comment/43048949
type: Answer
has comment: http://stackoverflow.com/comment/43124379
answers question: http://stackoverflow.com/q/27291004
has comment: http://stackoverflow.com/comment/43049033
score: 2
has comment: http://stackoverflow.com/comment/43048173
downvote count: 0
has comment: http://stackoverflow.com/comment/43049014
has comment: http://stackoverflow.com/comment/43208182
has comment: http://stackoverflow.com/comment/43048207
has comment: http://stackoverflow.com/comment/43129523

http://stackoverflow.com/comment/43081751
score: 0
comment on: http://stackoverflow.com/q/27310243
type: Comment
type: QuestionComment
has text: In one application I have there are maybe 50 objects like this and I do have such methods. I guess the question relates more to why this is not a standard part of most frameworks (I think Hibernate has a saveOrUpdate method) but not so the others?

http://stackoverflow.com/q/27289632
upvote count: 1
has answer: http://stackoverflow.com/a/54566485
favorite count: 0
answer count: 5
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/46075980
downvote count: 0
has answer: http://stackoverflow.com/a/76126203
tagged with: annotations
type: Question
has answer: http://stackoverflow.com/a/27289868
score: 1
tagged with: java
tagged with: hibernate
has body: I have a problem with OneToMany relations. I'm using spring-mvc and spring-security and hibernate 4. I'm using annotations for all. My problem is in the entity War when I see the atributte List players debugging, I see players= PersistentBag and when I click it com.sun.jdi.InvocationException occurred invoking method. Also I get this Exceptions: org.apache.jasper.JasperException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: clanwar.model.War.players, could not initialize proxy - no Session org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: clanwar.model.War.players, could not initialize proxy - no Session Entities: @Entity @Table(name = "WARS") public class War implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID", nullable = false) private int id; @ManyToOne @JoinColumn(name = "CLAN") private Clan clan; @Column(name = "START_DATE") private Date startDate; @Column(name = "ENEMY_NAME") private String enemyName; @OneToMany(mappedBy = "war") private List&lt;WarPlayer&gt; players; @Transient private List&lt;Enemy&gt; enemies; public War() { } // Getters and setters. } -- @Entity @Table(name = "WAR_PLAYERS") public class WarPlayer implements Serializable { private static final long serialVersionUID = 1L; @Id @ManyToOne @JoinColumn(name = "WAR") private War war; @Id @ManyToOne @JoinColumn(name = "PLAYER") private Player player; @Column(name = "WAR_NUMBER") private int warNumber; @ManyToOne @JoinColumn(name = "OBJETIVE_1") private Attack objetive1; @ManyToOne @JoinColumn(name = "OBJETIVE_2") private Attack objetive2; @ManyToOne @JoinColumn(name = "RECOMMENDED_1") private Attack recommended1; @ManyToOne @JoinColumn(name = "RECOMMENDED_2") private Attack recommended2; @ManyToOne @JoinColumn(name = "FINAL_1") private Attack final1; @ManyToOne @JoinColumn(name = "FINAL_2") private Attack final2; p…
has title: Hibernate - @OneToMany - com.sun.jdi.InvocationException occurred invoking method
has answer: http://stackoverflow.com/a/46075980
has answer: http://stackoverflow.com/a/27289709
accepted answer: http://stackoverflow.com/a/27289709

http://stackoverflow.com/comment/42888287
type: QuestionComment
comment on: http://stackoverflow.com/q/27202629
has text: Change your check to `if (!grade[y].matches("[ABCDF]"))` to avoid problems with `||` and `&&`.
score: 0
type: Comment

http://stackoverflow.com/comment/42938647
has text: You should note that an enum *is* a class. Recommended reading: [Oracle's tutorial about enum types](https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27230639
score: 0

http://stackoverflow.com/comment/42929760
has text: I manage to get work all the stuff using xmlspring defined routes and Java Processor bean. I miss how to use routes by Java bean. Any tip about java bean routes in activemq?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27159048

http://stackoverflow.com/q/27186474
has comment: http://stackoverflow.com/comment/42861592
type: Question
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/43046458
score: 0
has comment: http://stackoverflow.com/comment/43046271
answer count: 1
has title: Spring mvc redirection pattern with parameters
accepted answer: http://stackoverflow.com/a/27290728
has answer: http://stackoverflow.com/a/27290728
tagged with: spring
has body: I am trying to add a resource handler into my Spring Boot App (1.1.8.RELEASE) which must be able to convert this example. //From: {HOST_PREFIX_1}/u/{1}/{2}/myimage.jpg //To: {CDN_PREFIX_2}/u/{1}/{2}/images/myimage.jpg I don't know whether spring is able of dealing with this kind of patterns or I have to create a custom resourceHandler. @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/u/{var1}/{var2}/{var3:.*}") .addResourceLocations("/u/{var1/{var2}/images/{var3:.*}") .addResourceLocations(cdnPrefix); super.addResourceHandlers(registry); } Spring does not detect any kind of pattern error but the redirection is not working. Any help? Thanks!
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-4
tagged with: java

http://stackoverflow.com/comment/46041606
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27210292
type: Comment
has text: The code above prints "false" and "true" on all current implementations, no question. But does the JVM specification _guarantee_ that a String created with new String(…) will never be automatically interned? So, is it guaranteed that a == comparison of any String object whatsoever with a new String(…) will always return false?

http://stackoverflow.com/q/27166131
has comment: http://stackoverflow.com/comment/42829639
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/27166469
upvote count: 1
has comment: http://stackoverflow.com/comment/42824301
tagged with: java
has answer: http://stackoverflow.com/a/27166302
score: -1
type: Question
has answer: http://stackoverflow.com/a/27166479
has body: I am trying to extract both positive and negative numbers from a character array (which is coming from a file). Apparently the method I wrote only worked for positive numbers. Can anyone please tell me how to modify this to handle negative numbers as well? So let's say my character array is {'1',' ','2','-','2',' ','3','4'} it should output a list containing {1,2,-2,34}. Some guidance will be appreciated. Thanks in advance My method is: private static ArrayList&lt;Integer&gt; extractIntegers(char[] characters) { int beginning = -1; ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; characters.length; i++) { boolean isNumber = Character.isDigit(characters[i]); if (beginning != -1 &amp;&amp; !isNumber) { numbers.add(parseIntegers(characters, beginning, i)); beginning = -1; } else if (beginning == -1 &amp;&amp; isNumber) { beginning = i; } } if (beginning != -1) { numbers.add(parseIntegers(characters, beginning, characters.length)); } return numbers; } /*Parses characters to Integers*/ private static int parseIntegers(char[] characters, int begin, int end) { return Integer.parseInt(new String(characters, begin, end - begin)); }
has comment: http://stackoverflow.com/comment/42824577
answer count: 3
has title: Extracting positive and negative numbers from char array
favorite count: 0

http://stackoverflow.com/comment/42824331
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27165484
has text: I don't get it. If I am calling `foo(a,b)` for which both a and b are `int`, how is the tools supposed to verify if my `a` is a `Volume`? If you need `Volume` to bear a semantic meaning, make it a class.
score: 0

http://stackoverflow.com/comment/42809111
has text: Have you tried anything?
score: 0
comment on: http://stackoverflow.com/q/27157496
type: Comment
type: QuestionComment

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/27205293

http://stackoverflow.com/comment/42950207
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27236186
type: Comment
has text: I guess a static IV would make it easier to find common prefixes in a collection of communications. I don't remember why this would be useful. It would be nice if you find that reference about the CBC animal.

http://stackoverflow.com/comment/42872051
type: QuestionComment
type: Comment
score: 2
has text: You aren't assigning the converted result to any text box, thus nothing on the screen will change. Also, if the `ActionEvent` was triggered by a Submit button, the event source will not be textField1 or textField2.
comment on: http://stackoverflow.com/q/27193179

http://stackoverflow.com/a/27180948
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/27180913
type: Answer
upvote count: 1
has body: You have a hexadecimal memory output that can be read in many different ways. First thing you need to figure out is how it was written. But if you just want an ASCII convert from hex you can just use an ASCII table as a reference ;) final edit: check out this website on ext2 filesystem http://www.nongnu.org/ext2-doc/ext2.html

supercsv
tags question: http://stackoverflow.com/q/27190425
type: Tag
tag name: supercsv

http://stackoverflow.com/q/27224674
tagged with: lucene
tagged with: sql
downvote count: 0
favorite count: 0
has title: how to escape plus sign in lucene library 4.1.0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27224978
answer count: 4
score: 2
tagged with: java
has body: the query i have is cs_contents:(canal+) OR cs_docs:(canal+) OR cs_annots:(canal+) when is passed in lucene the query become +((cs_contents:canal cs_contents:canal) (cs_docs:canal cs_docs:canal) (cs_annots:canal cs_annots:canal)) +DBName:dPortal +TableName:CASE_ACTION even if i escape the plus with backslash it doesn't work cause the backslash is a special character in this library too.
has answer: http://stackoverflow.com/a/27351707
type: Question
has answer: http://stackoverflow.com/a/27224843
has answer: http://stackoverflow.com/a/27224941

http://stackoverflow.com/comment/43102114
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27305339
score: 0
has text: It's probably correct to handle some exceptions as they happen. Generally, I think the distinction is between "expected" exceptions that should be handled in a specific way; and exceptions that indicate that something has gone wrong enough that you have to abandon the whole operation, which is what I think you're looking for. If you want the "best" way to deal with exceptions, you'll find a lot of disagreement among experts.

http://stackoverflow.com/comment/42827791
comment on: http://stackoverflow.com/a/27167699
score: 0
type: AnswerComment
type: Comment
has text: So let me get this straight. Within the {} is an extension of the enum, therefore any method of the enum that is defined as abstract must also be implemented. In TimeUnit's case, it is the "excessNano(long,long)" method - which is the only method defined as abstract. All the other methods within the {} are basically just overriding existing enum methods... So essentially enum constants can be anonymous class within an enum. Can they have their own methods? If so, why even declare the method within the enum, why not just declare them within the Constants?

http://stackoverflow.com/a/27175395
upvote count: 1
has body: You have to create StringLiteral as a argument and add it to functionCall, in othere case it could be NumberLiteral, ArrrayLiteral etc. (see: http://javadox.com/org.mozilla/rhino/1.7R4/org/mozilla/javascript/ast/AstNode.html) private FunctionCall getFunctionCall() { FunctionCall functionCall = new FunctionCall(); Name name = new Name(); name.setIdentifier("initialize"); functionCall.setTarget(name); StringLiteral arg = new StringLiteral(); arg.setValue("value"); arg.setQuoteCharacter('"'); functionCall.addArgument(arg); return functionCall; } class FunctionVisitor implements NodeVisitor { @Override public boolean visit(AstNode node) { if (node.getClass() == FunctionNode.class) { FunctionNode fun = (FunctionNode) node; if(fun.getName().equals("initialize")) //prevents infinit loop { return true; } fun.getBody().addChildrenToFront(new EmptyStatement()); // adds ';', I don't know if required fun.getBody().addChildrenToFront(getFunctionCall());//no fun.addChildrenToFront } return true; } } You can print every corect AstNode by toSource() method. I hope this will help.
has comment: http://stackoverflow.com/comment/42861908
has comment: http://stackoverflow.com/comment/42868153
has comment: http://stackoverflow.com/comment/42925330
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27165521
has comment: http://stackoverflow.com/comment/43480778
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27165521

http://stackoverflow.com/q/27160340
type: Question
type: AnsweredQuestion
has body: I have inherited a large project that I am trying to better understand. I have seen classes that act as servlets but that don't extend HttpServlet or implement any interfaces. Yet their methods are mapped to URIs. How does this magic happen? Could it be something to do with Spring? web.xml? pom.xml? Sorry if the question is too vague. I've been reading a number of tutorials on servlets, and they all seem to indicate the class must extend HttpServlet or similar. I'm at a loss as to how they work without that, so it is difficult to ask a more specific question.
score: 1
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/27160409
has comment: http://stackoverflow.com/comment/42814599
answer count: 2
has title: Java Servlets Without Extending a Servlet Class
favorite count: 0
possible better answer: http://stackoverflow.com/a/76164155
has answer: http://stackoverflow.com/a/76164155
accepted answer: http://stackoverflow.com/a/27160409
upvote count: 2
tagged with: maven
tagged with: spring
downvote count: 1

http://stackoverflow.com/comment/42925029
type: AnswerComment
has text: @LoganGuo: whatever you write in `doInBackground` of `AsyncTask` should be written in `run` method of `Runnable`
type: Comment
comment on: http://stackoverflow.com/a/27222919
score: 0

http://stackoverflow.com/q/27269732
tagged with: treetable
tagged with: portlet
has comment: http://stackoverflow.com/comment/43013617
has comment: http://stackoverflow.com/comment/43012310
answer count: 0
score: 0
type: UnansweredQuestion
has title: Vaadin 6.7.7 and TreeTable component
has body: I have to use Vaadin 6.7.7 version. In particular, I have to use TreeTable Component that I see in vaadin example/tutoria. But I can't to use this component in my project (Portlet with Vaadin 6.7.7). The import import com.vaadin.ui.TreeTable; not work. Is this component present in this Vaadin version?
tagged with: java
tagged with: vaadin
type: Question
has comment: http://stackoverflow.com/comment/43012063
has comment: http://stackoverflow.com/comment/43013927

http://stackoverflow.com/comment/42998215
has text: What is `BooksTable`? Have you debugged to determine that the value truly exists for Stock #? Also, what are you trying to do with `<c:set value="${$row.count}" scope="session" var="itemID" />`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27261807
score: 0

http://stackoverflow.com/q/27302060
tagged with: android
has answer: http://stackoverflow.com/a/57039561
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27304458
possible better answer: http://stackoverflow.com/a/57039561
tagged with: java
upvote count: 7
type: Question
has title: How to Check if an Paired Bluetooth device is a Printer or a Scanner (Android)
tagged with: bluetooth
answer count: 3
downvote count: 0
score: 7
favorite count: 0
has body: I hope can help me, I am developing an Android App, that require to connect with Bluetooth devices, like Scanner and Printer, currently I can list all Paired devices, but i want to know if the paired device is a Printer, Scanner, Mobile, etc. There is some way to know the kind of bluetooth device paired?
has answer: http://stackoverflow.com/a/27304458
has answer: http://stackoverflow.com/a/40944556

http://stackoverflow.com/comment/43011688
has text: @specializt That's the question. Out of experience, I think it can be improved further. I'll edit with an example of (non-existing) method that I'd consider better/simpler.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27269675

http://stackoverflow.com/comment/105573898
score: 8
type: AnswerComment
has text: if you enable lazy initialization, first time loading is super fast, but when client accessing for the first time it may notice some delay. I really recommend this for the development not for the production.
type: Comment
comment on: http://stackoverflow.com/a/55261352

http://stackoverflow.com/q/27160592
accepted answer: http://stackoverflow.com/a/27160772
tagged with: java
has comment: http://stackoverflow.com/comment/42815289
has comment: http://stackoverflow.com/comment/42814956
has comment: http://stackoverflow.com/comment/42814907
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42814885
has body: I made a little clock for a desktop widget in Java(the widget includes many other features as well). I checked the applications RAM usage in task manager to see that the clock was using 700+ MB of RAM. I disabled the clock and the RAM usage went down to about 60 MB. Here is the clocks code: final int timeRun = 0; new Thread() { public void run() { while(timeRun == 0) { Calendar cal = new GregorianCalendar(); int hour = cal.get(Calendar.HOUR); int min = cal.get(Calendar.MINUTE); int sec = cal.get(Calendar.SECOND); int AM_PM = cal.get(Calendar.AM_PM); String day_night = ""; if (AM_PM == 1){ day_night = "PM"; }else{ day_night = "AM"; } String time = hour + ":" + min + ":" + sec + " " + day_night; Clock.setText(time); } } }.start(); Why is it using so much RAM? How could I fix it?
tagged with: timer
has comment: http://stackoverflow.com/comment/42814992
has comment: http://stackoverflow.com/comment/42814981
has answer: http://stackoverflow.com/a/27160772
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42815085
has title: Java - GUI clock using large amounts of RAM?
has comment: http://stackoverflow.com/comment/42814897
has comment: http://stackoverflow.com/comment/42814879
has comment: http://stackoverflow.com/comment/42815223
has comment: http://stackoverflow.com/comment/42815027
has comment: http://stackoverflow.com/comment/42815098
has comment: http://stackoverflow.com/comment/42815024
type: Question
has comment: http://stackoverflow.com/comment/42814911

http://stackoverflow.com/q/27251346
type: Question
tagged with: hadoop
score: 0
has title: regex extract in hadoop with pipe (escape character) as delimiter
tagged with: string
has comment: http://stackoverflow.com/comment/43016104
has body: I have a string "Hadoop|regex|Issue". I want to split using | as delimiter. I used this code - String[] afterSplit = string.split("\\|"); but afterSplit contains only 2 strings "Hadoop" and "regex". I get ArrayIndexOutOfBoundsException exception when I try to retrieve afterSplit[2]. I want "Issue" in afterSplit[2]. I also tried the below code String regex = Pattern.quote("|"); String[] parts = line.split(regex); Note: Both work in simple java code but I get error while trying to implement in Hadoop. Please suggest. Thanks.
tagged with: regex
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43016725
tagged with: java

http://stackoverflow.com/comment/43070885
type: AnswerComment
type: Comment
has text: Your jar is a compile time requirement so yes, it needs to be on **both** the compile and runtime classpath. That can be accomplished with the answer you added, or by adding it to the sourceSet classpath **and** the `test` task classpath. Both solutions are roughly equivalent.
comment on: http://stackoverflow.com/a/27278048
score: 1

http://stackoverflow.com/q/27306968
has answer: http://stackoverflow.com/a/27315153
type: Question
tagged with: java
has title: create file of image, android
tagged with: image
has body: I want to upload an image to my amazon s3 server. To do that I need to make a file of the image I want to send but somehow it doesn't work: Button to select the image: //When clicked on addimage addImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // To open up a gallery browser Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE); } When clicked on an image in gallery: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE &amp;&amp; resultCode == Activity.RESULT_OK &amp;&amp; null != data) { urimg = data.getData(); String path = getPath(urimg); //create file of image to upload images3 = new File(path); } } }); The getPath method: public String getPath(Uri uri) { if( uri == null ) { return null; } String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = getActivity().getContentResolver().query(uri, projection, null, null, null); if( cursor != null ){ int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } return uri.getPath(); } I get this error: 12-05 01:37:13.857 30611-30611/com.laurenswuyts.witpa E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.laurenswuyts.witpa, PID: 30611 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65537, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:3000 flg=0x1 }} to activity {com.laurenswuyts.witpa/com.laurenswuyts.witpa.Activities.Events.AddEventActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:3539) at andro…
answer count: 1
tagged with: file-upload
score: 0
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/comment/42826127
score: 0
comment on: http://stackoverflow.com/q/27167099
type: Comment
type: QuestionComment
has text: try to write `hello.html` that contains Thai characters, put it under file system and tomcat and try to open it with your browser. Can you see Thai characters correctly in this case?

http://stackoverflow.com/comment/42845083
comment on: http://stackoverflow.com/a/27178091
score: 0
type: AnswerComment
has text: the main class from which I want to switch is `MainActivity` and the second is `pathfinderActivity`
type: Comment

http://stackoverflow.com/a/27308204
score: 1
answers question: http://stackoverflow.com/q/27307490
upvote count: 1
has body: Yes you can certainly use recursion and it would simplify things by holding context in the heap. But it's not strictly necessary. Here's some (not very efficent and with a lot of stuff missing) psuedo code using interation to give you somewhere to start if you prefer this approach. The algorithm below looks a bit anti-intuitive but if you think it through you'll see it works. I've tried it out and it works perfectly so let me know if you get stuck and I'll post some working code. You might also like to try both the recursive and iterative versions and see which one makes more sense to you. put all apples in first bucket while (true) { add the solution to the list firstNonEmptyBucket = find first bucket with any apples; if (firstNonEmptyBucket is the last bucket) break - you are finished shift 1 apple from firstNonEmptyBucket to next bucket if (firstNonEmptyBucket is not the first bucket) shift all apples from firstNonEmptyBucket to previous bucket }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43066082
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27301186
has text: It's that i dont know what to google :/

http://stackoverflow.com/q/27184988
has body: So I've run into a problem with my code. First of all, I've got an ArrayList with objects added to it: cellRoomObjects = new ArrayList&lt;&gt;(); RoomObjects door = new RoomObjects("Door" , 1 , true); RoomObjects oilLamp = new RoomObjects("Oil lamp", 2 , true); RoomObjects chest = new RoomObjects("Chest" , 3 , true); RoomObjects wallCarving = new RoomObjects("Wall Carving", 4 , false); cellRoomObjects.add(door); cellRoomObjects.add(oilLamp); cellRoomObjects.add(chest); cellRoomObjects.add(wallCarving); Second, I got a JComboBox, that takes a String[] array as input: String[] objectStrings = { "Bookcase", "Chest", "Door", "Safe", "Comfortable chair" }; JComboBox objectList = new JComboBox(objectStrings); Now I would like my JComboBox to show the name ("Door", "Oil Lamp", "Chest" and "Wall Carving") of each Object of my ArrayList&lt;RoomObjects&gt;'s String, but I'm not sure how to do this. Any Suggestions?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27185117
type: Question
has answer: http://stackoverflow.com/a/27185114
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/27185273
answer count: 3
accepted answer: http://stackoverflow.com/a/27185273
possible better answer: http://stackoverflow.com/a/27185117
has title: Displaying String of an Object in an ArrayList<Object> in a JComboBox
tagged with: jcombobox
tagged with: swing

http://stackoverflow.com/comment/42963742
type: AnswerComment
has text: That was the problem, the deployment wasn't done correctly, just 2 minutes in "Deployment Assembly" and it's fixed now! Thank you very much, can't believe I ended up wasting 4 days on this. Could you edit a little your answer with the check for /login handler so I can accept it?
type: Comment
comment on: http://stackoverflow.com/a/27231946
score: 0

http://stackoverflow.com/a/27297525
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27297171
accepted answer of: http://stackoverflow.com/q/27297171
has body: If it were reusable how would you handle different iterations of arrival? For instance, lets say you want to wait on the CountDownLatch. CountDownLatch latch = new CountDownLatch(1); latch.await(); Then one threads invokes latch.countDown(); The await is released. Now you have another thread that should only release if the previously thread counted down. So you invoke latch.await(). If the latch were to be mutable, should the thread wait or continue through? How would the latch know this await should not be for another cycle (or phase)? In the end, it doesn't and rightfully so. A mutable latch is difficult, but it is possible. Java 7 came out with a Phaser. It treats each next iteration as a phase and you can tell the phaser to await on a particular phase: phaser.awaitAdvance(phase);
upvote count: 5

tabs
type: Tag
tags question: http://stackoverflow.com/q/27187171
tag name: tabs
tags question: http://stackoverflow.com/q/27242989

http://stackoverflow.com/a/27260348
answers question: http://stackoverflow.com/q/27260314
type: Answer
score: 1
upvote count: 1
has body: You need to have different ports for the tomcat instance including but not limited to the connector port, ajp port, shutdown port. And once you have that the error would go away. However it is good practice to have the same tomcat binary being used to run multiple tomcat instances using the CATALINA_BASE variable. More details are in the link below. See the section on running multiple instances. Also note that this same RUNNING.txt file would also be in the tomcat binaries and you can also review it there. http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt
downvote count: 0

http://stackoverflow.com/q/27173160
linked to: http://stackoverflow.com/q/1733195
tagged with: android
possible better answer: http://stackoverflow.com/a/27177352
has answer: http://stackoverflow.com/a/27177357
tagged with: file-type
has answer: http://stackoverflow.com/a/27177352
type: AnsweredQuestion
tagged with: java
has title: How to create my own custom file type containing an image or an audio file
type: Question
tagged with: encoding
accepted answer: http://stackoverflow.com/a/27177357
score: 0
answer count: 2
has body: I want to find a way to save captured picture and recorded sound in custom file-type(s) then open them in my app. I don't want to other apps could open my files (for example gallery app don't open my pictures). Is there any way to encode and decode my files in my app for example by writing a string at end of files. Thanks

http://stackoverflow.com/q/27304520
tagged with: random
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/27304593
score: 0
has comment: http://stackoverflow.com/comment/43072441
has body: I have an array where I am loading 10 images in it, as one can see below: int maxImages = 10; // Total # of images int imageIndex = int(random(10)); // Initial image to be displayed is the first // Declaring an array of images. PImage[] images = new PImage[maxImages]; // Loading the images into the array for (int i = 0; i &lt; images.length; i ++ ) { images[i] = loadImage( "assets/images/image" + i + ".jpg" ); } When certain conditions are met I am then using random() to generate a new value and save it in a new variable called imageIndex. As you can see below: imageIndex = int(random(images.length)); After this is generated I am then calling the image with the new random number in the following way: gameimages = loadImage( "assets/images/image" + imageIndex + ".jpg" ); The above implementation is working perfectly however random numbers are sometimes being generated more than once, I want them uniquely randomised from 1-10. Can anyone suggest me the best way to go about implementing this ?
type: UnansweredQuestion
has title: Unique values from random()
type: Question
tagged with: processing
tagged with: java
has comment: http://stackoverflow.com/comment/43071966
has comment: http://stackoverflow.com/comment/43072413
has comment: http://stackoverflow.com/comment/43072536

http://stackoverflow.com/comment/42960722
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27188561
type: AnswerComment
has text: Hope you didn't notice the second log I posted. That said the NoClassDefFoundError: javax/xml/ws/Service. This comes usually in server bundle itself, but for jboss7 only, we have to add it explicitly. Got it resolved. Find my answer

http://stackoverflow.com/comment/42911483
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27215413
has text: Im new to this website, how do i reward people for helping me out??

http://stackoverflow.com/comment/42890174
type: Comment
comment on: http://stackoverflow.com/q/27203737
score: 2
has text: When doing string comparison you should use .equals so in your case if (Student1.name.equals (Student2.name)){ }
type: QuestionComment

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/27223963
tags question: http://stackoverflow.com/q/27246978
tag name: nosuchmethoderror

http://stackoverflow.com/comment/43045328
score: 0
type: AnswerComment
type: Comment
has text: Heh, you're welcome. I've been in the same situation.
comment on: http://stackoverflow.com/a/27289032

http://stackoverflow.com/q/27301069
downvote count: 0
tagged with: jar
favorite count: 0
has body: I have developed a library that can communicate with an Arduino, and the code works fine until I export a project using the library as a JAR. Here's the project setup, the DLLs are located in rxtx-native-windows.jar and added to the build path of my project. However, when I export this and import it to the build path of another project, until I export that project. When attempting to run it, this is what I get: This issue can be resolved by placing the rxtxSerial.dll in my system32 folder, but naturally, I want my application to be portable, so I'm at a loss. I have not done this before and my understanding was that the DLLs would be exported correctly with the JAR when they're added to the build path of the project (in a JAR or otherwise).
has comment: http://stackoverflow.com/comment/51039919
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/64556319
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: dll
has comment: http://stackoverflow.com/comment/90199612
has title: Java - How to include DLLs from JAR when exporting project?
tagged with: rxtx

http://stackoverflow.com/a/38114378
upvote count: 2
answers question: http://stackoverflow.com/q/27309852
has body: You have to declare "variable" as static and import the class as static by following syntax import static com.myname.appname.Constants.*;
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/27192049
answers question: http://stackoverflow.com/q/27191805
has body: Each second (or any constant amount of time), record which percentage of the file you have processed since the last second. This well give you % per second, a measure of how fast the process is working. You can then remember the last 5 values of this number (to remove random spikes and such), calculate their average, and then approximate total time remaining based on the remaining percentage. Display that number to the user. So if your speed is 0.5%/s, and you have 25% of the input left to process, the time remaining is 50 seconds. Of course, you can use bytes instead of percentages, or a different time constant instead of one second.
score: 0
type: Answer

http://stackoverflow.com/comment/43011583
type: Comment
has text: can you please provide some details. how to do this.
comment on: http://stackoverflow.com/q/27270781
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43028860
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27280015
has text: possible duplicate of [Java - How can I prefer IPv6?](http://stackoverflow.com/questions/19314241/java-how-can-i-prefer-ipv6)

http://stackoverflow.com/comment/42997881
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27254573
has text: You really need to delete the temporary file first or otherwise TrueZIP will only treat it like a false positive archive file, i.e. like a plain file.

http://stackoverflow.com/q/27157733
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42809988
type: Question
has title: Tomcat returning 404 error while accessing servlet
tagged with: jsp
has body: I have copied the WAR file I've exported by eclipse into the Webapp directory of tomcat then I rewrote the web.xml file like this : <?xml version="1.0" encoding="utf-8"?> MMP index.html index.htm index.jsp default.html default.htm default.jsp SignInValidment This servlet plays the controller of the Placement Test proccess SignInValidment 5 SignInValidment /SignInValidment 30 The problem is , when the program tries to access SignInValidment Servlet to validate the sign in event , Tomcat returns 404 error , that /MMP/SignInValidment/ not found and then I can't even access the root of project (jsp files)anymore, it keeps giving me this error : "HTTP Status 404 - " . I'm using tomcat version 8.0 and note that my computer is a little infected with viruses and harmful programs. I'm really in an emergency problem , please help me run this project.
tagged with: tomcat
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/42809680
type: UnansweredQuestion
tagged with: http-status-code-404
has comment: http://stackoverflow.com/comment/42809711

http://stackoverflow.com/q/27254675
has answer: http://stackoverflow.com/a/27254815
type: UnansweredQuestion
score: 0
tagged with: spring
tagged with: spring-mvc
tagged with: java
has body: I am new to annotation based controller. I have two servlet like this: pathA-servlet for url: pathA/* pathB-servlet for url: pathB/* And I have a controller like: public class MyController extends SimpleFormController { private MyService myService; } And two service implementation: public class MyService1 implements MyService { } public class MyService2 implements MyService { } And in pathA-servlet: <property name="myService" ref="myService"/> And in pathB-servlet: <property name="myService" ref="myService"/> Now, I am trying to do the same with annotation based controller using: @Controller, @RequestMapping. How can I do that?
type: Question
has comment: http://stackoverflow.com/comment/42987103
answer count: 2
has title: injecting different implementation of service bean in same controller from different servlet
has answer: http://stackoverflow.com/a/27255514

http://stackoverflow.com/comment/43822319
has text: have you found a solution?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27312701
type: QuestionComment

http://stackoverflow.com/comment/42936517
has text: I tried both of these but getting error. error: `org.hibernate.exception.SQLGrammarException`: could not get next sequence value
type: Comment
comment on: http://stackoverflow.com/a/27229226
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42933627
type: AnswerComment
comment on: http://stackoverflow.com/a/27227528
type: Comment
has text: but how to enter dynamic user input in that text file
score: 0

http://stackoverflow.com/a/40269899
has comment: http://stackoverflow.com/comment/67815330
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27228809
downvote count: 0
has body: I've had a similar problem for the more general case where I'm using a custom reader. That is backed by an iterator over an object type and returns a new item (of different type) for each object read. Problem is some of those objects don't map to anything, so I'd like to return something that marks that. Eventually I've decided to define an INVALID_ITEM and return that. Another approach could be to advance the iterator in the read() method, until the next valid item, with null returned if .hasNext() becomes false, but that is more cumbersome. Initially I have also tried to return a custom ecxeption and tell Spring to skip the item upon it, but it seemed to be ignored, so I gave up (if there are too many invalids isn't performant anyway).

http://stackoverflow.com/q/27160440
tagged with: jersey-client
has body: I am new to web services and would like to know what is the difference between Jersey client API and jersey test framework? I would like to test my jersey REST web-services end points. Which is the the right one to use?
tagged with: java
type: Question
tagged with: jersey
score: 4
upvote count: 4
has title: Jersey client API vs Jersey test framework
tagged with: jersey-test-framework
has answer: http://stackoverflow.com/a/27162589
answer count: 1
downvote count: 0
favorite count: 0
tagged with: rest
type: UnansweredQuestion

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/27299223
tags question: http://stackoverflow.com/q/27267024
type: Tag
tags question: http://stackoverflow.com/q/27162971

http://stackoverflow.com/comment/82782743
comment on: http://stackoverflow.com/a/27226712
score: 0
type: AnswerComment
type: Comment
has text: The only change is that I added `; ` after your `(?i)^.*`

http://stackoverflow.com/q/27235589
has comment: http://stackoverflow.com/comment/42948246
tagged with: textarea
answer count: 1
tagged with: string
has body: Im using java and this program is basically disecting a txt file and using N (Integer 1-4) to create a Super String to analyze txt files. I have them being sorted using radiobuttons alphabetically and by occurrence..my question is how do I add the whole list at one time instead of adding line by line, I feel like line by line is an inefficient way of appending to my textareas. Any suggestions? I have a for each statement to add line by line and keep count. String[] storage = new String[N]; words = new CountLinkedList&lt;SuperString&gt;(); words2 = new OrderedLinkedList&lt;SuperString&gt;(); for(int i=1;i&lt;N;i++) storage[i] = scan.next().toLowerCase().replace(",","").replace(".",""); while(scan.hasNext()) { for(int i=0;i&lt;=N-2;i++) storage[i] = storage[i+1]; storage[N-1] = scan.next().toLowerCase(); storage[N-1] = storage[N-1].replace(",","").replace(".",""); SuperString ss = new SuperString(storage); SuperString ss2= new SuperString(storage); words.add(ss ); words2.add(ss2 ); } textarea.setText(""); textarea.append(" "+filename+" has wordcount: "+words.size()+ "\n-------------------------\n\n"); } SuperString[] ss = new SuperString[words.size()]; SuperString[] ss2 = new SuperString[words2.size()]; int i=0; int count =0, count2= 0; for(SuperString word: words) { ss[i] = word; i++; } int j=0; for(SuperString word: words2) { ss2[j] = word; j++; } Arrays.sort(ss, new SuperStringCountOrder()); if(occurrence.isSelected()) { textarea.setText(""); for(SuperString word : ss) { count++; textarea.append(count+" "+ " "+word+"\n"); } } if(alphabetical.isSelected()) { textarea.setText(""); for(SuperString word : ss2) { count2++; textarea.append(count2+" "+ " "+word+"\n"); }
has comment: http://stackoverflow.com/comment/42947715
has answer: http://stackoverflow.com/a/27241478
tagged with: append
tagged with: list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42958770
has title: adding to a textarea, is there a faster way than appending? How to add a whole list at one time not line by line...JAVA
has comment: http://stackoverflow.com/comment/42958743
has comment: http://stackoverflow.com/comment/42959069
tagged with: java
has comment: http://stackoverflow.com/comment/42949250
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42949960

http://stackoverflow.com/comment/43071067
has text: It isn't. None of that would cause a connection reset.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27243325
type: Comment

http://stackoverflow.com/q/27216454
tagged with: web
linked to: http://stackoverflow.com/q/23272611
favorite count: 0
has comment: http://stackoverflow.com/comment/42912764
type: UnansweredQuestion
tagged with: request
has answer: http://stackoverflow.com/a/27216511
score: 1
tagged with: java
has title: Cross Site Form Request in Javascript
tagged with: forms
upvote count: 1
type: Question
tagged with: javascript
has body: I have a requirement from my supervisors to make a form request in a form that resides in an external website, get the results and show them in our site. Is that even possible with Javascript ?. They have done this in Java so the requirement is based on the fact that they have done it before but my guess is that there might be security implications/restrictions on doing this. Any help or clue would be highly appreciated Thanks in advance Luis Santos
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/43006547
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27267107
has text: Both @Bathsheba and I understood that, and we both disagree. It is terrible advice. I'm not in favour of this tendency for StackOverflow becoming a validation site for arbtitrary Internet junk.
type: Comment

http://stackoverflow.com/comment/43022298
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27260141
has text: http://stackoverflow.com/questions/10075453/the-jar-of-this-class-file-belongs-to-container-android-dependencies-which-doe Still this is not actually what is causing your application to not work.
type: AnswerComment

http://stackoverflow.com/a/27228738
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42935594
has comment: http://stackoverflow.com/comment/42935459
type: Answer
answers question: http://stackoverflow.com/q/27227912
has body: String sql = "DELETE FROM ANDYSHORT.DVDS WHERE ID=?"; PreparedStatement statement = conn.prepareStatement(sql); statement.setString(1, "+ idInt+"); int rowsDeleted = statement.executeUpdate(); if (rowsDeleted &gt; 0) { System.out.println(" delete successfully!"); }
downvote count: 0

http://stackoverflow.com/q/27307388
upvote count: 0
has comment: http://stackoverflow.com/comment/43077135
tagged with: arrays
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/27307406
has body: StudentDemo: public class studentDemo { public static void main(String[] args) throws IOException{ int runit = 0; StudentMenu run = new StudentMenu(); while (runit != 1) { run.menu(); } } } StudentMenu: public class StudentMenu { public Student func = new Student(); List&lt;Student&gt; studentList = new ArrayList&lt;Student&gt;(); String input; String input2; String input3; public void menu(){ System.out.println("Choose an option: "); System.out.println("1) Add a student "); System.out.println("2) Display student list "); System.out.println("3) Exit "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { input = br.readLine(); int choice = Integer.parseInt(input); System.out.println("Choice: " + choice); if(choice == 1){ System.out.println("First name: "); input = br.readLine(); System.out.println("Last name: "); input2 = br.readLine(); System.out.println("Number of classes to add for student: "); input3 = br.readLine(); int numberOfClasses = Integer.parseInt(input3); studentList.add(new Student(input, input2, numberOfClasses)); func.createClassList(numberOfClasses); } if(choice == 2){ } if(choice == 3){ System.exit(0); } } catch (IOException ioe){ System.out.println("An unexpected error occured."); } } } Student: public class Student{ private String firstName; private String lastName; private int classes; //Create array for classes private String[] classesList = new String[classes]; public Student(){ firstName = "no name"; lastName = "no name"; classes = 0; } //overloaded constructor public Student(String theFirstName, String theLastName, int theClasses){ firstName = theFirstName; lastName = theLastName; classes = theClasses; System.out.println("Number of Classes: " + classes); } //Populating array public void createClassList(int classes){ //Call array method BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ for(int i = 0; i &lt; classes; i++){ System.out.println("Number of Classes: " + classes); System.out.p…
has title: Calling a method to create an array in another class
accepted answer: http://stackoverflow.com/a/27307442
type: AnsweredQuestion
tagged with: methods
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27307442
possible better answer: http://stackoverflow.com/a/27307406
tagged with: java
score: -1
answer count: 2

http://stackoverflow.com/comment/43034708
type: Comment
type: QuestionComment
has text: Where is your "x" variable declared?
comment on: http://stackoverflow.com/q/27283185
score: 0

http://stackoverflow.com/comment/42979062
score: 0
type: QuestionComment
has text: "Tables" in finished PDFs usually only visually appear to us as tables, inside the PDF itself they are merely a collection of lines or rectangles and text pieces; so usually you cannot easily add new rows to existing tables. Are your templates different?
type: Comment
comment on: http://stackoverflow.com/q/27248632

mybatis
tags question: http://stackoverflow.com/q/27229383
tags question: http://stackoverflow.com/q/27265663
tags question: http://stackoverflow.com/q/27201782
type: Tag
tags question: http://stackoverflow.com/q/27247451
tag name: mybatis
tags question: http://stackoverflow.com/q/27183803

http://stackoverflow.com/comment/42970111
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27247604
has text: OK. But i work with Netbeans. Netbenas configure automatically classpath if you add externe JAR.
score: 0

http://stackoverflow.com/a/27251577
has comment: http://stackoverflow.com/comment/42977324
type: Answer
has comment: http://stackoverflow.com/comment/43010363
has comment: http://stackoverflow.com/comment/42977412
has comment: http://stackoverflow.com/comment/42978381
has comment: http://stackoverflow.com/comment/42977205
has body: For HashMap, the index in the array that stores the entries of the Map is calculated this way (where h is calculated from the hashCode of the key): static int indexFor(int h, int length) { return h &amp; (length-1); } Where length is the length of the array. This only works when length is a power of 2. If length wasn't power of 2, you would have to change this code to the less efficient return h % length.
downvote count: 0
has comment: http://stackoverflow.com/comment/42979082
has comment: http://stackoverflow.com/comment/42988769
has comment: http://stackoverflow.com/comment/42977395
has comment: http://stackoverflow.com/comment/42977662
has comment: http://stackoverflow.com/comment/42977760
has comment: http://stackoverflow.com/comment/42977250
answers question: http://stackoverflow.com/q/27251480
score: 9
has comment: http://stackoverflow.com/comment/43010565
upvote count: 9

http://stackoverflow.com/q/27171809
linked to: http://stackoverflow.com/q/2145431
downvote count: 0
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/42835140
has title: Java Jersey 2 client and proxies
favorite count: 0
has comment: http://stackoverflow.com/comment/42835490
tagged with: rest
upvote count: 2
has comment: http://stackoverflow.com/comment/46642400
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/56272657
score: 2
linked to: http://stackoverflow.com/q/18942648
tagged with: java
has answer: http://stackoverflow.com/a/27176435
has comment: http://stackoverflow.com/comment/42835405
has comment: http://stackoverflow.com/comment/42838409
type: Question
answer count: 2
tagged with: jersey
has body: I use Jersey 2.11 to access the confluence REST API and get content from there. import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.glassfish.jersey.apache.connector.ApacheClientProperties; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; .... HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic( "confluenceUsername", "confluencePassword" ); ClientConfig cc = new ClientConfig(); cc.property(ClientProperties.PROXY_URI, "xx.xx.xx.xx:xxxx"); Client client = ClientBuilder.newClient(cc); client.register(feature); WebTarget target = client.target(credential.getUrl()) .path("rest").path("api").path("content").path(id) .queryParam("expand", "space,body.storage,version,container,ancestors"); Response response = target.request().get(); Is this the current right way to use proxy in Java with Jersey 2.11 ? I get always an exception java.net.ConnectException: Connection refused: connect javax.ws.rs.ProcessingException: java.net.Connect Exception: Connection refused: connect at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:229) ... The confluence site which I want to access use https. On a machine which don't need a proxy it work with HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic( "confluenceUsername", "confluencePassword"); Client client = ClientBuilder.newClient(); client.register(feature); so Confluence isn't the problem. I think that is something wrong with proxy spefication but don't know what.
tagged with: proxy

http://stackoverflow.com/q/27293966
has answer: http://stackoverflow.com/a/27294119
answer count: 3
has answer: http://stackoverflow.com/a/27294124
downvote count: 0
has comment: http://stackoverflow.com/comment/43053196
tagged with: variables
favorite count: 0
linked to: http://stackoverflow.com/q/4732544
possible better answer: http://stackoverflow.com/a/27294094
has title: Instance variable scope in java
has answer: http://stackoverflow.com/a/27294094
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27294124
has body: Hello good day to all. I am creating a networking program in java for my Internet Cafe. I have this code for my server import java.io.*; import java.net.Socket; import java.net.ServerSocket; public class Server { private String name; private int id; private Socket socket = null; private ServerSocket serversocket = null; private ObjectInputStream ois = null; public Server() { new Thread(receive).start(); while(true) { try { serversocket = new ServerSocket(4445); socket = serversocket.accept(); System.out.println("Connected.."); } catch(IOException e) { e.printStackTrace(); } } } Runnable send = new Runnable(){ public void run () { } }; Runnable receive = new Runnable(){ public void run () { while(true) { try { ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); User user = (User) ois.readObject(); System.out.println(user); } catch(IOException e) { e.printStackTrace(); } catch(ClassNotFoundException e) { e.printStackTrace(); } } } }; public static void main(String [] args) { new Server(); } } My problem is that I cant access my instance variable inside my Runnable interface code. For example the "socket" instance. is not accessible inside this code Runnable receive = new Runnable(){ public void run () { while(true) { try { ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); User user = (User) ois.readObject(); System.out.println(user); } catch(IOException e) { e.printStackTrace(); } catch(ClassNotFoundException e) { e.printStackTrace(); } } } }; What is the best approach on this and why is not accessible inside that code?
tagged with: instance
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/52989113
upvote count: 38
has comment: http://stackoverflow.com/comment/95122396
has body: Please make the following part of the Collectors API: &lt;K, V&gt; Collector&lt;? super Map.Entry&lt;K, V&gt;, ?, Map&lt;K, V&gt;&gt; toMap() { return Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue); }
type: Answer
has comment: http://stackoverflow.com/comment/95128890
has comment: http://stackoverflow.com/comment/118734718
downvote count: 1
answers question: http://stackoverflow.com/q/27228961
has comment: http://stackoverflow.com/comment/95046789
score: 37

http://stackoverflow.com/comment/42985423
type: Comment
score: 1
has text: @aioobe The JLS guarantees that, for a non-final variable v of any type except long or double, when some thread T accesses v without synchronization, it will either get the initial value, or it will get some value that was previously stored in v. The JLS does _not_ guarantee that thread T will see the _most recent_ value stored in v. If you must have the most recent value, or if v is of type long or double, then all accesses to v should be `synchronized`.
comment on: http://stackoverflow.com/a/27254652
type: AnswerComment

http://stackoverflow.com/comment/42871417
has text: `in the process of updating the member object`. That's the whole point. Some operations are atomic (`i = 1`), all the others can be disrupted by another thread, but the JVM has no way of knowing that this is not the effect intended by your code. (also, that is what `synchronized` is for)
comment on: http://stackoverflow.com/a/27192822
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/28440685
answers question: http://stackoverflow.com/q/27156842
has body: This is already implemented in version 0.3.1 - see OlgaMaciaszek's response Actually jFairy text generator has only ability to generate random Lorem ipsum text. Replacing meaningful content that could be distracting with placeholder text may allow viewers to focus on graphic aspects such as font, typography, and page layout. It also reduces the need for the designer to come up with meaningful text, as they can instead use hastily generated lorem ipsum text. But you are right, we should add support for localized content in text generator.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43234992
type: Comment
score: 1
has text: It looks like the Java spark API has issues with certain JOIN operations.It worked when I tried the same with scala. Anyways thanks for your help.
type: QuestionComment
comment on: http://stackoverflow.com/q/27268965

http://stackoverflow.com/a/27279574
score: 1
answers question: http://stackoverflow.com/q/27276943
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43033239
has comment: http://stackoverflow.com/comment/43033894
type: Answer
accepted answer of: http://stackoverflow.com/q/27276943
has body: The developer documentation covering this is a bit of a large topic: https://developer.apple.com/library/Mac/referencelibrary/GettingStarted/GS_DataManagement_MacOSX/_index.html#//apple_ref/doc/uid/TP40009046 https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010672 According to the File System Programming guide you should make a specific subdirectory inside /Library/Application\ Support for your app to store app data common to all users on the system. I'd use reverse domain name notation such as com.yourcompany.yourapp or something else unlikely to collide with another app's use of the common directory for this. You might also look into using an existing app bundler for OS X such as https://bitbucket.org/infinitekind/appbundler rather than hard code paths to file locations.
has comment: http://stackoverflow.com/comment/43032668
upvote count: 1
has comment: http://stackoverflow.com/comment/43032928

http://stackoverflow.com/q/27180553
has comment: http://stackoverflow.com/comment/42849597
type: Question
accepted answer: http://stackoverflow.com/a/27180606
answer count: 1
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/1463284
has answer: http://stackoverflow.com/a/27180606
has comment: http://stackoverflow.com/comment/42849655
has title: Ignore Duplicates in an Arraylist of Objects
tagged with: comparator
type: AnsweredQuestion
has body: I have an array list with a number of objects. I want to remove duplicate Objects from it.. I tried the below option with TreeSet and Comparator but it is not working. Following class objects are added in the list public class Student { private String name; private String location; private int score; private int age; private String department; Student(){} Student(String sName,String loc,int ag,int scr,String dep){ setName(sName); setLocation(loc); setScore(scr); setAge(ag); setDepartment(dep); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } } Below is my main class import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.Set; import java.util.TreeSet; public class MyMain { public static void main(String[] args) { Student s1= new Student("John","Aus",25,100,"Finance"); Student s2= new Student("John","Aus",25,100,"Finance"); Student s3= new Student("John","Aus",26,100,"Finance"); Student s4= new Student("Alex","Ind",20,101,"Finance"); Student s5= new Student("Alex","Ind",20,101,"Finance"); Student s6= new Student("Alex","Ind",28,101,"Finance"); ArrayList&lt;Student&gt; studentsList= new ArrayList&lt;Student&gt;(); studentsList.add(s1); studentsList.add(s2); studentsList.add(s3); studentsList.add(s4); studentsList.add(s5); studentsList.add(s6); for(int i=0;i&lt;studentsList.size();i++){ Student s=(Student)studentsList.get(i); System.out.println(i+ " "+s.getName()+" "+s.getLocation()+" "+s.getAge()+" "+s.getScore()+" "+s.getDepartment()); } Set set = new …
has comment: http://stackoverflow.com/comment/42849728

http://stackoverflow.com/comment/42943344
comment on: http://stackoverflow.com/a/27233210
type: AnswerComment
type: Comment
score: 0
has text: for logic in method roomTaken the value are reverse ... so you can try my solution .. for your problem

http://stackoverflow.com/comment/42960234
has text: Could you share what does $CLASSPATH expands to?
comment on: http://stackoverflow.com/q/27242013
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43077959
has text: And I noticed your json format is invalid. you can check it yourself here: http://jsonformatter.curiousconcept.com/ and paste your JSON. reformat your json file.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27307478
type: QuestionComment

object
tags question: http://stackoverflow.com/q/27209951
tags question: http://stackoverflow.com/q/27204308
tags question: http://stackoverflow.com/q/27189284
tag name: object
tags question: http://stackoverflow.com/q/27169392
tags question: http://stackoverflow.com/q/27202889
tags question: http://stackoverflow.com/q/27298560
tags question: http://stackoverflow.com/q/27223090
tags question: http://stackoverflow.com/q/27196689
tags question: http://stackoverflow.com/q/27208062
tags question: http://stackoverflow.com/q/27233685
tags question: http://stackoverflow.com/q/27180473
tags question: http://stackoverflow.com/q/27201039
tags question: http://stackoverflow.com/q/27214988
tags question: http://stackoverflow.com/q/27298485
tags question: http://stackoverflow.com/q/27291208
tags question: http://stackoverflow.com/q/27268806
tags question: http://stackoverflow.com/q/27230602
tags question: http://stackoverflow.com/q/27238093
tags question: http://stackoverflow.com/q/27203703
tags question: http://stackoverflow.com/q/27238136
tags question: http://stackoverflow.com/q/27158755
tags question: http://stackoverflow.com/q/27229410
tags question: http://stackoverflow.com/q/27244875
tags question: http://stackoverflow.com/q/27201210
tags question: http://stackoverflow.com/q/27265575
tags question: http://stackoverflow.com/q/27205213
tags question: http://stackoverflow.com/q/27253003
tags question: http://stackoverflow.com/q/27186498
tags question: http://stackoverflow.com/q/27253377
tags question: http://stackoverflow.com/q/27162365
tags question: http://stackoverflow.com/q/27224577
tags question: http://stackoverflow.com/q/27294070
tags question: http://stackoverflow.com/q/27211713
type: Tag
tags question: http://stackoverflow.com/q/27257301
tags question: http://stackoverflow.com/q/27298649
tags question: http://stackoverflow.com/q/27213323
tags question: http://stackoverflow.com/q/27186097
tags question: http://stackoverflow.com/q/27166425
tags question: http://stackoverflow.com/q/27164933
tags question: http://stackoverflow.com/q/27277124

http://stackoverflow.com/comment/43079050
has text: try this http://voidcanvas.com/whatsapp-like-image-compression-in-android/
score: 1
comment on: http://stackoverflow.com/q/27308541
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42824748
has text: i am using jdk1.6 @alain.janinm
score: 0
comment on: http://stackoverflow.com/q/27166267
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27211762
type: Question
has comment: http://stackoverflow.com/comment/42904600
has comment: http://stackoverflow.com/comment/42904466
has comment: http://stackoverflow.com/comment/42904672
has answer: http://stackoverflow.com/a/27211791
accepted answer: http://stackoverflow.com/a/27211791
has title: How to get line separator for SQL in a generic manner?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42911397
has comment: http://stackoverflow.com/comment/42906251
favorite count: 0
has comment: http://stackoverflow.com/comment/42904498
tagged with: jdbc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: Is there a way to get a sql-environment line separator? I guess that it is not equivalent of System.getProperty("line.separator"); And even if it's true for some of the DB, it's not guaranteed that it will always stay like that....

http://stackoverflow.com/q/27238432
score: 0
has answer: http://stackoverflow.com/a/27241382
answer count: 1
tagged with: google-app-engine
tagged with: maven
accepted answer: http://stackoverflow.com/a/27241382
type: AnsweredQuestion
tagged with: java
has body: I just downloaded the Google App Engine "hello world" app and the pom.xml file is trying to download something from sonatype and fails: [ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Fa iled to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: Could not transfer artifa ct org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to google-staging (**https://oss.sonatype.org/content/repositories/comgoogleappengine-1004/**): oss.sonatype.org: Unknown host oss.sonatype.org -&gt; [Help 1] When I browse to the comgoogleappengine, it's not there - only "comgooglecodemp4parser-1048/" and "comgooglecodemp4parser-1049/" show up. What am I doing wrong?
type: Question
has title: Where is -> oss.sonatype.org/content/repositories/comgoogleappengine-1004

http://stackoverflow.com/q/27181052
tagged with: java
has body: my question is involving database and application scope. I am currently running an web application that stores user info(for login), item info and purchase info. The way I am currently doing storing the data is by putting them in a List. I am thinking of storing the data to a database (mysql) and replace the lists. In thinking about it, i thought of whether it would make sense to store data in the database, but also store it in the Lists. Basically, i would be adding to the List via the database. Would it make sense to do this?Thanks!
has answer: http://stackoverflow.com/a/27181168
tagged with: mysql
type: Question
tagged with: servlets
score: 0
answer count: 1
type: UnansweredQuestion
has title: From database to application scope
tagged with: list

http://stackoverflow.com/comment/42832491
has text: Is it easy on .net? I don't know. Please Guide me . @MihaiC
comment on: http://stackoverflow.com/q/27170632
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27278823
type: Question
has title: How i can compare the value of an id with java
tagged with: android
score: -1
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27278891
tagged with: java
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/27278886
type: UnansweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/27278922
has body: I have a simple xml with a question and two buttons. When one of buttons is pushed i will compare if the id of the pushed button is equal to "Blanco" or "Negro". The XML code: <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/pregunta" /> This is de java code: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void respuesta(){ //The doubt. //Here the if/else to compare ID with the button text } }
favorite count: 0

http://stackoverflow.com/comment/42870542
score: 1
comment on: http://stackoverflow.com/q/27192272
type: QuestionComment
type: Comment
has text: JDialog is a `java.awt.Window` and a `javax.swing.RootPaneContainer` so yes you can just put stuff in it. You don't get JInternalFrame behavior but it seems like you don't need it.

http://stackoverflow.com/q/27168842
has answer: http://stackoverflow.com/a/27168921
has body: I wrote a Java code to connect to the mysql database in the main method, and I success and get results. But when I separate the database code in separated class I have a problem with connection to database however I do nothing this the code: package database; import java.sql.ResultSet; import java.sql.SQLException; public class DataBase { public static void main(String[] args) throws ClassNotFoundException, SQLException { //Connection connect = DriverManager.getConnection("jdbc:mysql://localhost/javadb", "root", "123"); System.out.println("sadsa"); ConnectToDatabase db = new ConnectToDatabase("javadb", "root", "123"); System.out.println("sadsa"); String sqlStatement = "SELECT *\n" + "FROM `javadb`.`user`\n" + " LIMIT 1000;"; ResultSet result = db.makeQuery(sqlStatement); while (result.next()) { System.out.println(result.getString("ID") + " " + result.getString("UserName") + " " + result.getString("Password") ); } db.closeConnection(); } } The separated Class: package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class ConnectToDatabase { // Database Variables private final String databaseName;// = "jdbc:mysql://localhost/javadb"; //URL private final String databaseUserName;// = "root"; private final String databasePassword;// = "123"; private Connection connect; private Statement sqlStatement; // Connect to Database public ConnectToDatabase( String givenDatabaseName,String givenDatabaseUserName, String givenDatabasePassword) throws SQLException, ClassNotFoundException { Class.forName("com.mysql.jdbc.Driver"); this.databaseName = givenDatabaseName; this.databaseUserName = givenDatabaseUserName; this.databasePassword = givenDatabasePassword; this.connect = DriverManager.getConnection("jdbc:mysql://localhost/"+givenDatabaseName, givenDatabaseName, givenDatabasePassword); this.sqlStatement = this.connect.createStatement(); } public ResultSet makeQuery(String…
tagged with: database-connection
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27169389
has answer: http://stackoverflow.com/a/27169061
has answer: http://stackoverflow.com/a/27169713
has title: database connection in java with separated class
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/27168925
type: Question
score: 0
answer count: 5

http://stackoverflow.com/comment/42871322
has text: hey the username and password are correct I rechecked that how can i now if base64 is correct?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27192139
type: Comment

http://stackoverflow.com/a/27175494
answers question: http://stackoverflow.com/q/27175445
downvote count: 0
has body: You can provide the parameters as a comma separated list in the brackets after the method's name: public static void main(String[] args) { Test1 test = new Test1(); test.myMethod("my_file.txt"); }
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/42991246
comment on: http://stackoverflow.com/q/27258772
type: Comment
type: QuestionComment
score: 0
has text: If you must use arrays, you will need to add the undeleted files to the new array and then shrink it (into a third array)...

http://stackoverflow.com/comment/42873750
has text: [What is a Null Pointer and how can I fix it?](http://stackoverflow.com/q/218384/180538)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27193938

http://stackoverflow.com/q/27292478
has body: public char[] Cache_1(int word_address,int cache_set,int ls,char[] s1) { char cache_1[][] = new char[32][4]; char s0[] = new char[32]; InterConnectionNetwork ic = new InterConnectionNetwork(); if(ls == '0') { if((cache_1[cache_set][0]) == '1') { // Check Valid Bit and transfer content // if valid bit is high for(int i=0;i&lt;32;i++) { // Load s0[i] = cache_1[cache_set][i]; } } else { // Valid bit low s0 = ic.determinenode(word_address); } return s0; } else { if((cache_1[cache_set][0]) == '1') { for(int i=0;i&lt;32;i++) { cache_1[cache_set][i] = s0[i]; } } else cache_1[cache_set][] = ic.determinenode(word_address); //returns char[] return (cache_1[cache_set][]); //Problem here } } This is a chunk from the code that I am writing. The problem here is that return type being used is char[] and cache_1[cache_set][] is actually equivalent to single character array, but it is showing an error. Please help me to resolve it.
accepted answer: http://stackoverflow.com/a/27292513
favorite count: 0
has answer: http://stackoverflow.com/a/27292513
has answer: http://stackoverflow.com/a/27292808
type: AnsweredQuestion
downvote count: 0
score: 1
has title: char[] return type in code not accepting char[i][] value
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27292808
upvote count: 1

http://stackoverflow.com/a/27174660
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27174588
has body: if(a.equals(door)); // semicolon - statement System.out.println("Your are now in the house what now?"); Which means System.out.println("Your are now in the house what now?"); is executed irrespective of if statement.

http://stackoverflow.com/comment/42994212
type: AnswerComment
has text: The main decision point is based on whether or not there's a ServletContext. If there isn't, Boot will start an embedded container.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27259841

http://stackoverflow.com/q/27249261
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/42974405
has title: 8 bit gray scale image byte array to jpg
answer count: 1
has answer: http://stackoverflow.com/a/27249823
score: 0
has comment: http://stackoverflow.com/comment/42973020
accepted answer: http://stackoverflow.com/a/27249823
favorite count: 0
has comment: http://stackoverflow.com/comment/42973580
has body: I am trying to convert a 8 bit gray scale image byte array to jpg image format in java. static byte[] bytes = new byte[]{126, 126, 127, -128}; public static void main(String[] args) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(bytes); Iterator&lt;?&gt; readers = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader) readers.next(); Object source = bis; ImageInputStream iis = ImageIO.createImageInputStream(source); reader.setInput(iis, true); ImageReadParam param = reader.getDefaultReadParam(); Image image = reader.read(0, param); BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_BYTE_GRAY); Graphics2D g2 = bufferedImage.createGraphics(); g2.drawImage(image, null, null); File imageFile = new File("C:\\newrose3.jpg"); ImageIO.write(bufferedImage, "jpg", imageFile); System.out.println(imageFile.getPath()); } I have bytes having image data and I want to convert it into readable image format in java.
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42973192
tagged with: java
tagged with: image-processing

http://stackoverflow.com/q/27253523
has comment: http://stackoverflow.com/comment/42982732
accepted answer: http://stackoverflow.com/a/27254327
type: AnsweredQuestion
tagged with: java
tagged with: lotus-domino
type: Question
has answer: http://stackoverflow.com/a/27262565
has title: IBM Domino Designer
tagged with: xpages
has answer: http://stackoverflow.com/a/27254327
possible better answer: http://stackoverflow.com/a/27262565
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42993830
has body: I'm newbie in Domino Designer and want to preview xpage and views in web browser but the following message has appear To successfully previw this document in a web browser,please add(or modify) the ACL anonmyous(or the default ACL) to have at least author access with the ability to create document. Can any oe help me please?

http://stackoverflow.com/comment/43018135
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27273219
has text: Hmm. I get no errors here. But I can't get it to show an output :/
type: AnswerComment

tomcat
tags question: http://stackoverflow.com/q/27180878
tags question: http://stackoverflow.com/q/27211892
tags question: http://stackoverflow.com/q/27252591
tags question: http://stackoverflow.com/q/27273691
tags question: http://stackoverflow.com/q/27215110
tags question: http://stackoverflow.com/q/27250100
tags question: http://stackoverflow.com/q/27258336
tags question: http://stackoverflow.com/q/27176313
tags question: http://stackoverflow.com/q/27178498
tags question: http://stackoverflow.com/q/27171185
tags question: http://stackoverflow.com/q/27229720
tags question: http://stackoverflow.com/q/27234505
tags question: http://stackoverflow.com/q/27189047
tags question: http://stackoverflow.com/q/27268048
tags question: http://stackoverflow.com/q/27155579
tags question: http://stackoverflow.com/q/27161825
tags question: http://stackoverflow.com/q/27174409
tags question: http://stackoverflow.com/q/27197196
tags question: http://stackoverflow.com/q/27205165
tags question: http://stackoverflow.com/q/27173833
tags question: http://stackoverflow.com/q/27229066
tags question: http://stackoverflow.com/q/27269482
tags question: http://stackoverflow.com/q/27190454
tags question: http://stackoverflow.com/q/27244947
tags question: http://stackoverflow.com/q/27200686
tags question: http://stackoverflow.com/q/27260314
tags question: http://stackoverflow.com/q/27217101
tags question: http://stackoverflow.com/q/27167099
tags question: http://stackoverflow.com/q/27256904
tags question: http://stackoverflow.com/q/27236580
tags question: http://stackoverflow.com/q/27165644
tags question: http://stackoverflow.com/q/27269611
tags question: http://stackoverflow.com/q/27266561
tags question: http://stackoverflow.com/q/27270436
tag name: tomcat
tags question: http://stackoverflow.com/q/27271625
tags question: http://stackoverflow.com/q/27168563
tags question: http://stackoverflow.com/q/27185797
tags question: http://stackoverflow.com/q/27209759
tags question: http://stackoverflow.com/q/27185862
tags question: http://stackoverflow.com/q/27214544
tags question: http://stackoverflow.com/q/27202925
tags question: http://stackoverflow.com/q/27238608
tags question: http://stackoverflow.com/q/27161780
tags question: http://stackoverflow.com/q/27265953
tags question: http://stackoverflow.com/q/27182991
tags question: http://stackoverflow.com/q/27185156
tags question: http://stackoverflow.com/q/27305393
tags question: http://stackoverflow.com/q/27222249
tags question: http://stackoverflow.com/q/27157733
tags question: http://stackoverflow.com/q/27295015
tags question: http://stackoverflow.com/q/27181244
tags question: http://stackoverflow.com/q/27200142
tags question: http://stackoverflow.com/q/27211070
tags question: http://stackoverflow.com/q/27247346
tags question: http://stackoverflow.com/q/27274532
tags question: http://stackoverflow.com/q/27212275
tags question: http://stackoverflow.com/q/27287780
tags question: http://stackoverflow.com/q/27177058
tags question: http://stackoverflow.com/q/27171334
tags question: http://stackoverflow.com/q/27176076
type: Tag
tags question: http://stackoverflow.com/q/27265720
tags question: http://stackoverflow.com/q/27228907
tags question: http://stackoverflow.com/q/27225059
tags question: http://stackoverflow.com/q/27309839
tags question: http://stackoverflow.com/q/27274840
tags question: http://stackoverflow.com/q/27227512
tags question: http://stackoverflow.com/q/27246406
tags question: http://stackoverflow.com/q/27293260
tags question: http://stackoverflow.com/q/27251571
tags question: http://stackoverflow.com/q/27234426
tags question: http://stackoverflow.com/q/27285571
tags question: http://stackoverflow.com/q/27162496
tags question: http://stackoverflow.com/q/27227951
tags question: http://stackoverflow.com/q/27186053
tags question: http://stackoverflow.com/q/27248110
tags question: http://stackoverflow.com/q/27253053
tags question: http://stackoverflow.com/q/27272302
tags question: http://stackoverflow.com/q/27163310

http://stackoverflow.com/a/27413330
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27235719
accepted answer of: http://stackoverflow.com/q/27235719
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43304558
score: 1
downvote count: 0
has body: The DBMS does not decide to end the transaction, the transaction manager does. The transaction manager is set up to run in your application containers, whether they are Spring, J2EE application servers, or something else. They have to "know" they are distributed transaction managers by being configured correctly. In a distributed transaction environment, where you have multiple transactional applications and/or services interacting to complete a transaction, they must all be able to support distributed transactions to make proper use of the XADataSources and send the right signals up and down the chain for commit vs rollback. Presuming that you have the above situation, multiple applications and/or services participating in a distributed transaction, it sounds as if one of them is not configured correctly. Something in the chain is not truly a distributed transaction, so that when it completes it's only completing locally and not sending the signal back down the line. So the distributed transaction never completes, holding the connection open. Check the configuration of every application and/or service participating in the transaction. Add logging output on each that details whether the transaction is a distributed one or not. If you can't do that, then dd logging output to each that records the start and end of the transaction. Find the latest point in the sequence of actions where you see an open-transaction but not a close-transaction. If you see that, it's likely the node right after it in the chain that is doing something wrong. Good luck.

http://stackoverflow.com/comment/42829245
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27168767
type: Comment
has text: @Maduri once result set executed you can't execute that again.

http://stackoverflow.com/q/27282401
favorite count: 0
has comment: http://stackoverflow.com/comment/43033265
type: Question
has body: One of the questions I have been given asks: All the lines should be stored in an object of type List&lt;Set&lt;Integer&gt;&gt;. How do you write this in Java, as in how do you initialise this list? I've never seen this before. Please provide a link to an explanation as i'm not sure what this is called in Java so have no idea about how to learn about it. Thank You.
linked to: http://stackoverflow.com/q/1035008
score: 1
has answer: http://stackoverflow.com/a/27282500
has comment: http://stackoverflow.com/comment/43033259
has answer: http://stackoverflow.com/a/27282565
upvote count: 1
has answer: http://stackoverflow.com/a/27282425
tagged with: list
possible better answer: http://stackoverflow.com/a/27282509
has title: What does List<Set<Integer>> mean?
accepted answer: http://stackoverflow.com/a/27282425
tagged with: java
tagged with: set
has answer: http://stackoverflow.com/a/27282509
answer count: 5
has answer: http://stackoverflow.com/a/27282524
type: AnsweredQuestion
downvote count: 0

jmenuitem
tags question: http://stackoverflow.com/q/27238772
tag name: jmenuitem
type: Tag

http://stackoverflow.com/comment/42854211
type: AnswerComment
comment on: http://stackoverflow.com/a/27182731
score: 0
type: Comment
has text: but i am not able to get proper response still i am facing some issues like \n also coming as part of the text.

http://stackoverflow.com/comment/42957784
type: Comment
type: QuestionComment
has text: This is now basically a duplicate of [HTTP call with Socks 4 proxy](http://stackoverflow.com/questions/21742103/http-call-with-socks-4-proxy). See also [this Java bug](http://bugs.java.com/view_bug.do?bug_id=6964547).
score: 0
comment on: http://stackoverflow.com/q/27215053

http://stackoverflow.com/comment/42863528
type: QuestionComment
type: Comment
has text: @TekinOmer Either you're not actually running in `-noserver` mode, or you just need to pass `-startupUrl http://localhost:8080/sd-extern/chestionar.html` so that it outputs the same URL as you're opening in your browser (and you can then just ask GWT DevMode to open it)
comment on: http://stackoverflow.com/q/27188516
score: 0

http://stackoverflow.com/comment/43032350
type: Comment
type: QuestionComment
has text: no. thats the index.jsp file you see in the screenshot.
comment on: http://stackoverflow.com/q/27281760
score: 0

http://stackoverflow.com/a/27214928
downvote count: 0
type: Answer
has body: public String foo(String s, int n) { String s2 = s.substring(0, n); s = s.substring(n) + s2; return s; } you can put a few validations on this, like null string or n is less than s.length() etc.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27214783

http://stackoverflow.com/q/27209692
has answer: http://stackoverflow.com/a/33266374
tagged with: java
tagged with: eclipse
upvote count: 8
type: Question
has title: Eclipse luna - Internal error, trying to import from git
has answer: http://stackoverflow.com/a/27212201
accepted answer: http://stackoverflow.com/a/27212201
has answer: http://stackoverflow.com/a/37137209
has comment: http://stackoverflow.com/comment/42901658
has comment: http://stackoverflow.com/comment/42901264
answer count: 4
has body: I am using Eclipse Luna, and I am trying to import a project from github. However, it says "Internal error; consult Eclipse error log" when I pasted the URI in: The project is valid. I've tried a few projects, and they all worked on my older Juno version of eclipse, but all failed on Luna, just like above. What should I do to reproduce this problem? Here is my Eclipse log error: !ENTRY org.eclipse.egit.ui 2 0 2014-11-29 21:32:35.184 !MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in this system level configuration. The Git installation location can be configured on the Team > Git > Configuration preference page's 'System Settings' tab. This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. !ENTRY org.eclipse.egit.ui 2 0 2014-11-29 21:32:35.187 !MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git user global configuration and to define the default location to store repositories: 'C:\Users\I'. If this is not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and EGit might behave differently since they see different configuration options. This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. !ENTRY org.eclipse.egit.ui 4 0 2014-11-29 21:33:48.967 !MESSAGE Failed reading credentials from secure store !STACK 0 org.eclipse.equinox.security.storage.StorageException: Unable to locate secure storage module (org.eclipse.equinox.security.windowspasswordprovider). at org.eclipse.equinox.internal.security.storage.PasswordProviderSelector.findStorageModule(PasswordProviderSelector.java:190) at or…
score: 8
favorite count: 0
possible better answer: http://stackoverflow.com/a/37137209
has answer: http://stackoverflow.com/a/29293106
tagged with: git
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/42964290
has text: @Oninez Note that this question was easily answered by looking in [the Javadocs](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html). They should be your first port of call when you wonder how to do things. The `add()` method is the first one listed, even.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27244297
score: 0

http://stackoverflow.com/a/27214511
answers question: http://stackoverflow.com/q/27214498
upvote count: 4
downvote count: 0
score: 4
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27214498
has body: It should be while(!"a".equals(option) &amp;&amp; !"b".equals(option)) Using an OR condition, as you currently do, means that the condition is always true, and the loop never exits.

http://stackoverflow.com/comment/43020780
score: 0
type: Comment
has text: As Seelenvirtuose hints at, though, you might consider other design options. E.g. consider a method along the lines of `public <S, E extends Node> void addFilterEditor(TableColumn<T,S> column, E filterEditor, BiPredicate<S, E> filter)` which takes a column, a node to use as the editor for the filter for that column, and a function taking the cell value, the editor and returning a boolean representing whether or not the value passes the filter. Then provide some "standard" editors for known types.
comment on: http://stackoverflow.com/a/27272917
type: AnswerComment

http://stackoverflow.com/a/27189005
has body: Have you had any JSON requests successfully parsed? It could be that you need to enable JSON support in Jersey: https://jersey.java.net/documentation/1.18/json.html Otherwise, it may simply be failing on your request to turn the message body into a JsonObject here: public String createNetwork( @HeaderParam(value = "X-Auth-Token") String authToken, @PathParam(value = "tenant_id") String tenant_id, JsonObject network)
answers question: http://stackoverflow.com/q/27188753
has comment: http://stackoverflow.com/comment/42866522
has comment: http://stackoverflow.com/comment/42867006
has comment: http://stackoverflow.com/comment/42873092
has comment: http://stackoverflow.com/comment/42867269
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42867512

http://stackoverflow.com/a/27228843
upvote count: 3
answers question: http://stackoverflow.com/q/27228788
score: 3
downvote count: 0
type: Answer
has body: Problem You are creating new hp field and hiding inherited hp. Solution Replace public class Devil extends Monsters { int hp = 200; } with public class Devil extends Monsters { public Devil() { this.hp = 200; } } Good luck.

compare
tags question: http://stackoverflow.com/q/27233541
tag name: compare
type: Tag
tags question: http://stackoverflow.com/q/27307617
tags question: http://stackoverflow.com/q/27195962

http://stackoverflow.com/a/27248966
upvote count: 5
has comment: http://stackoverflow.com/comment/43167639
has comment: http://stackoverflow.com/comment/42974200
type: Answer
has comment: http://stackoverflow.com/comment/42972469
has comment: http://stackoverflow.com/comment/42972248
has comment: http://stackoverflow.com/comment/43092502
downvote count: 0
answers question: http://stackoverflow.com/q/27248559
has comment: http://stackoverflow.com/comment/43138775
has comment: http://stackoverflow.com/comment/42978378
has comment: http://stackoverflow.com/comment/43168025
has body: Here is your code measured on JMH: @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @OperationsPerInvocation(Measure.SIZE) @Warmup(iterations = 10, time = 100, timeUnit=MILLISECONDS) @Measurement(iterations = 5, time = 200, timeUnit=MILLISECONDS) @State(Scope.Thread) @Threads(1) @Fork(1) public class Measure { public static final int SIZE = 1; @Benchmark public int call() { int i = foo(); return i; } @Benchmark public int callDisableOptimization() { int i = fooDontInline(); return i; } @Benchmark public int inline() { int i; int l = 10; i = l; return i; } static int foo() { int i = 10; return i; } @CompilerControl(CompilerControl.Mode.DONT_INLINE) static int fooDontInline() { int i = 10; return i; } } Explanation: call corresponds to your first measurement, a regular call to foo(); inline corresponds to your second measurement, where you inline the logic of foo() with no calls involved; callDisableOptimization is a special twist on the first case, where we used advanced low-level control to disable the automatic inlining by the JVM. And these are the results: Benchmark Mode Samples Score Error Units o.s.Measure.call avgt 5 1,279 ± 0,114 ns/op o.s.Measure.inline avgt 5 1,289 ± 0,100 ns/op o.s.Measure.callDisableOptimization avgt 5 3,167 ± 0,217 ns/op Things to note: there is actually no difference at all between your two pieces of code. The JIT-compiler will have an easy time inlining that method call for you, ending up with precisely the same code in both cases; the added third case shows just how insignificant the overhead would be even without JIT compiler's inlining: a true method invocation incurs an overhead of less than 2 nanoseconds. Putting this in perspective, a million invocations would add just 2 milliseconds to the overall runtime. Some comments on your approach to measuring performance on the JVM: what you're trying to measure takes around a single nanosecond; you are including that nanosecond together with a println operation, whi…
has comment: http://stackoverflow.com/comment/42972231
has comment: http://stackoverflow.com/comment/42972204
has comment: http://stackoverflow.com/comment/43145682
has comment: http://stackoverflow.com/comment/43145818
has comment: http://stackoverflow.com/comment/43129082
score: 5
has comment: http://stackoverflow.com/comment/43167443
has comment: http://stackoverflow.com/comment/42974135

http://stackoverflow.com/a/27245983
downvote count: 4
has body: Use Junit without input parameters and output parameters: @Test private void specialAdd () { // provide the value of a and b int a = 30; int b = 20; if(a &lt; 100) { System.out.println("100 * a + b =" + 100 * a + b); } else { System.out.println("a + b =" + a + b); } } Then, choose the method name "specialAdd" and click the right button in your mouse,choose run --> run junit test.
score: 0
answers question: http://stackoverflow.com/q/27245914
type: Answer
has comment: http://stackoverflow.com/comment/42967195
has comment: http://stackoverflow.com/comment/42967139
upvote count: 4

http://stackoverflow.com/a/27274737
upvote count: 4
has comment: http://stackoverflow.com/comment/43019591
has comment: http://stackoverflow.com/comment/43019246
accepted answer of: http://stackoverflow.com/q/27274663
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43018838
has body: Remove private int health = 30; which declares a new variable whose name hides the variable in the super class. And initialize in the constructor(s) public SubClass2() { super(); health = 30; }
type: Answer
score: 4
answers question: http://stackoverflow.com/q/27274663

http://stackoverflow.com/q/27158463
has comment: http://stackoverflow.com/comment/42811034
answer count: 3
type: AnsweredQuestion
has body: I have two interfaces: MinServer and MaxServer. MaxServer extends MinServer. So, is the following code normal and right? MinServer server=foo.getUndefinedServer(); ...code according to MinServer if (isThisServerMax){ server=(MaxServer)server; ...code according to MaxServer } ...code according to MinServer
type: Question
has answer: http://stackoverflow.com/a/27158538
has answer: http://stackoverflow.com/a/27158658
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27158553
linked to: http://stackoverflow.com/q/20861107
has title: Java type casting and scope
has comment: http://stackoverflow.com/comment/42811208
possible better answer: http://stackoverflow.com/a/27158553
accepted answer: http://stackoverflow.com/a/27158538

http://stackoverflow.com/comment/43075688
has text: @mish : I can only recommend you search Google for Calendar app examples - I'm sure there must be quite a few out there.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27306370
type: Comment

http://stackoverflow.com/comment/43059424
has text: Know my tests don't work properly, the array is not full of the data I want to get.
score: 0
comment on: http://stackoverflow.com/q/27297521
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43063488
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27297884
type: AnswerComment
has text: Yes, I am using maven, I now the error has changed from resource not found to "Not Found". Do you want me to post the pom??

locale
tags question: http://stackoverflow.com/q/27183759
type: Tag
tags question: http://stackoverflow.com/q/27302560
tag name: locale
tags question: http://stackoverflow.com/q/27228671
tags question: http://stackoverflow.com/q/27258095

http://stackoverflow.com/comment/42968348
type: Comment
type: QuestionComment
has text: @RuchiraGayanRanaweera Not Mockito. What Mockito does is entirely different from anything that would be useful here.
comment on: http://stackoverflow.com/q/27245914
score: 0

buildpath
type: Tag
tags question: http://stackoverflow.com/q/27206766
tag name: buildpath

http://stackoverflow.com/q/27200634
answer count: 1
has answer: http://stackoverflow.com/a/27200786
downvote count: 0
tagged with: jsp
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27200786
tagged with: java
score: 7
upvote count: 7
has body: Hi in my servlet code I am requesting the server with access_token on behalf of user i am able to request with below code: OAuthRequest request2 = new OAuthRequest(Verb.GET,"https://api.linkedin.com/v1/people/~:(first-name,last-name,email-address)?oauth2_access_token="+accesstok); But How i can request with Authorization Header like below: GET /v1/people/~ HTTP/1.1 Host: api.linkedin.com Connection: Keep-Alive Authorization: Bearer AQXdSP_W41_UPs5ioT_t8HESyODB4FqbkJ8LrV_5mff4gPODzOYR I am using in the below way but not wrking: private static final String PROTECTED_RESOURCE_URL = "/v1/people/~:(first-name,last- name,email-address) HTTP/1.1 Host: api.linkedin.com Connection: Keep-Alive Authorization: Bearer "; Object AccessToken= o.get("access_token"); String accesstok=AccessToken.toString(); OAuthRequest request2 = new OAuthRequest(Verb.GET,PROTECTED_RESOURCE_URL+accesstok); Thank You
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: servlets
has title: Authorization header in Http Request in linkedin

jdialog
type: Tag
tags question: http://stackoverflow.com/q/27211604
tags question: http://stackoverflow.com/q/27175404
tags question: http://stackoverflow.com/q/27303669
tag name: jdialog
tags question: http://stackoverflow.com/q/27301827

http://stackoverflow.com/a/27233614
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27226713
has body: You can use Jquery $.post ajax request to achive this: &lt;table&gt; &lt;td&gt;&lt;input type="text" value="test" id="name" /&gt; &lt;td&gt;&lt;button onclick="post(&lt;%=entity.id%&gt;)"&gt;submit&lt;/button&gt;&lt;td&gt; &lt;/table&gt; &lt;script&gt; function post(id){ var name=$("#name").val(); $.post( "/myservlet", { customerid: id, customername: name } ).done(function(data){ alert(data); //This will send get request to your servlet. can use this if your previous //post request done any update in DB window.location.href='/myservlet?customerid='+id; }); } &lt;/script&gt;
type: Answer
accepted answer of: http://stackoverflow.com/q/27226713
score: 1

http://stackoverflow.com/q/27166892
has body: My requirement is: The first line of the input consists of an integer n (where n>=3) denotes the size of the array. In next line there will be n integers separated by space correspond to the n elements in the array. For that I have used below code: Scanner length = new Scanner(System.in); System.out.println("Please Enter Length of Aarry:"); int n=length.nextInt(); int[] numbers = new int[n]; Scanner sc = new Scanner(System.in); System.out.println("Enter the elements seperated by spaces: "); String input = sc.nextLine(); StringTokenizer strToken = new StringTokenizer(input); int count = strToken.countTokens(); //Reads in the numbers to the array System.out.println("Count: " + n); int[] arr = new int[n]; for(int x = 0;x &lt; n;x++){ arr[x] = Integer.parseInt((String)strToken.nextElement()); System.out.println("values are: " + arr[x]); } But problem is : the above code will read correctly all the integers entered with white space but i would like to specify the limit for entering values also .Please help me how to achieve this.
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42826320
has comment: http://stackoverflow.com/comment/42825952
has comment: http://stackoverflow.com/comment/42826703
score: -1
has comment: http://stackoverflow.com/comment/42826714
has answer: http://stackoverflow.com/a/27167747
upvote count: 0
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/42826161
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/42826555
type: UnansweredQuestion
tagged with: java.util.scanner
has title: Read integer array through white space with using limit in java

drawertoggle
tags question: http://stackoverflow.com/q/27170564
type: Tag
tag name: drawertoggle

http://stackoverflow.com/q/27253172
tagged with: android-activity
tagged with: facebook
accepted answer: http://stackoverflow.com/a/27253337
has body: Within Android, I'd like to create a Facebook scroll like effect, where I can place text on each tile and a user can scroll through the information. There is a Facebook screenshot below, is there any chance anyone knows of any coded examples on-line which could help me out? Thanks
type: AnsweredQuestion
tagged with: java
has title: Does anyone know of any Android coded example of facebook's scrolling tiles?
type: Question
has comment: http://stackoverflow.com/comment/42980537
tagged with: android-layout
has answer: http://stackoverflow.com/a/27253337
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/q/27286045
tagged with: caching
upvote count: 2
has answer: http://stackoverflow.com/a/27287350
answer count: 1
linked to: http://stackoverflow.com/q/13539213
has title: Any method to avoid transaction commit if Hibernate session reads from cache?
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
has body: I'm using Hibernate transaction for read operation from db as following excample code: Session session = sessionFactory.openSession(); Transaction tx= session.beginTransaction(); session.get(Account.class, new Long(id)); tx.commit(); //Actually I use tx.rollback() session.close(); Due to the second level cache, result is fetched from cache after the first time reading from db. But the database connection is distributed when session.beginTransaction() is invoked, and next commit statement will be executed at database, which degrades the performance dramatically(compared to the case when no transaction is used). So is there any possible way to know that the result will be read from second level cache so I can avoid doing commit and even use a new database connection?

http://stackoverflow.com/comment/42883652
has text: all those event are implemented in ButtonModel, and then you missed event from keyboard
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27196367

http://stackoverflow.com/a/27249988
answers question: http://stackoverflow.com/q/27249674
type: Answer
has body: Or maybe &lt;script&gt; var myBal = &lt;% out.print(myBal); %&gt; document.write(myBal.amount); // or document.write($.parseJSON(myBal.amount)); &lt;/script&gt;
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27249674

xor
tags question: http://stackoverflow.com/q/27244772
tags question: http://stackoverflow.com/q/27236856
type: Tag
tag name: xor

http://stackoverflow.com/a/27211772
type: Answer
has body: if(v==4) System.out.println(v); return v; You're returning v in any case, you should return v; only if v == 4, so you should place it under the if statement: if(v==4) { System.out.println(v); return v; } //Here you should return something that indicates otherwise, //think about a special value that has no meaning if v == 4 not satisfied That's why we should have { and } even for one line statements, it prevents bugs like this one
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27211760

http://stackoverflow.com/a/27237501
score: 1
has body: The folllowing code resolved my issue: public static double[] Optimize(double[][] contractDataMatrix,double[] minData, double[] maxData,double[] modelData,String modelType,String weightType){ ObjectiveFunction objective = new ObjectiveFunction(contractDataMatrix,modelType,weightType); org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer optimizer =new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer(.01,.001); org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction obj = new org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction(objective); int n = modelData.length; org.apache.commons.math3.optim.PointValuePair finalData=optimizer.optimize( new org.apache.commons.math3.optim.MaxEval(200), obj, GoalType.MINIMIZE, new InitialGuess(modelData), new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex(n) ); return finalData.getPoint(); }
answers question: http://stackoverflow.com/q/27236587
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/27157187
has body: This is a potion of my code: topPanel = new JPanel (); subheading = new JLabel("CRUISES"); description = new JLabel("Add or remove Cruises or click to assign a Cruise to a ship."); topPanel.add(subheading); topPanel.add(description); CruiseFrame.add(topPanel); CruiseFrame.setVisible(true) Everything is working well, and upon running the above, I get the following result in my GUI: "CRUISES Add or remove Cruises or click to assign a Cruise to a ship." However, I wish to have the output as: CRUISES Add or remove Cruises or click to assign a Cruise to a ship. I wish to have them on seperate lines, how do I go about this? Thanks.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42809298
has title: How to manually move GUI elements?
tagged with: user-interface
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27157588
tagged with: java

http://stackoverflow.com/comment/43008927
has text: I wrote my code in an eclipse plugin because it makes use of some other eclipse plugins. This code could be written without eclipse at all, but I wanted to make use of what already exists. The destination application, however, didn't require the code to be an an eclipse plugin. And definitly it will not be run through another jar file like 'org.eclipse.osgi_3.2.0.jar', but it should run through its own jar.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27252374
type: AnswerComment

http://stackoverflow.com/q/27230992
answer count: 3
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: quasar
has answer: http://stackoverflow.com/a/27231116
has body: Suppose I need to execute N tasks in the same thread. The tasks may sometimes need some values from an external storage. I have no idea in advance which task may need such a value and when. It is much faster to fetch M values in one go rather than the same M values in M queries to the external storage. Note that I cannot expect cooperation from tasks themselves, they can be concidered as nothing more than java.lang.Runnable objects. Now, the ideal procedure, as I see it, would look like Execute all tasks in a loop. If a task requests an external value, remember this, suspend the task and switch to the next one. Fetch the values requested at the previous step, all at once. Remove all completed task (suspended ones don't count as completed). If there are still tasks left, go to step 1, but instead of executing a task, continue its execution from the suspended state. As far as I see, the only way to "suspend" and "resume" something would be to remove its related frames from JVM stack, store them somewhere, and later push them back onto the stack and let JVM continue. Is there any standard (not involving hacking at lower level than JVM bytecode) way to do this? Or can you maybe suggest another possible way to achieve this (other than starting N threads or making tasks cooperate in some way)?
tagged with: java
has answer: http://stackoverflow.com/a/27231899
type: Question
has answer: http://stackoverflow.com/a/28564770
has title: JVM: is it possible to manipulate frame stack?
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/a/27236944
has body: Look into try with resources, if you can (needs at least Java 7) http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27236853
upvote count: 1

http://stackoverflow.com/q/27288116
type: Question
has comment: http://stackoverflow.com/comment/43042920
answer count: 2
has comment: http://stackoverflow.com/comment/43043044
has comment: http://stackoverflow.com/comment/43042878
accepted answer: http://stackoverflow.com/a/27288189
has comment: http://stackoverflow.com/comment/43042976
score: 0
tagged with: typechecking
has body: Suppose I have two classes as follows class A { private Double value; ... //getters and setters } class B { private Double value; ... //getters and setters } Update public static void main(String[] args) { A a = new A(); B b = new B(); a.setValue(b.getValue() != null ? b.getValue() : 0); //works! a.setValue(0); //doesn't work } And the statement a.setValue(b.getValue != null ? b.getValue : 0); works fine but a.setValue(0) doesn't works I need to set the value as 0D to make it work. why I need not write a D along with 0 in first case?
has answer: http://stackoverflow.com/a/27288189
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27288563
has answer: http://stackoverflow.com/a/27288563
tagged with: java
has title: Java : Strictly type checking fails?
has comment: http://stackoverflow.com/comment/43042940

http://stackoverflow.com/comment/43032508
comment on: http://stackoverflow.com/a/27270852
type: AnswerComment
has text: Thanks for the answer! What is the best way to do it properly?
score: 0
type: Comment

http://stackoverflow.com/a/27247025
has comment: http://stackoverflow.com/comment/42969015
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/27188424
type: Answer
answers question: http://stackoverflow.com/q/27188424
has body: After looking at it for a few days, i have analysed the filter configurations in the link given. i have come to a conclusion that all i had to do is to instantiate the objects needed to configure the filter, and finally set the objects in the filter. this would then look similar to the configuration in the link which uses spring security. but of course, instead of beans i would use java. here is what it looked like in the end: this.setAuthenticationManager(new OAuth2AuthenticationManager()); this.setIssuerService(new StaticSingleIssuerService()); this.setServerConfigurationService(new StaticServerConfigurationService()); this.setClientConfigurationService(new StaticClientConfigurationService()); this.setAuthRequestOptionsService(new StaticAuthRequestOptionsService()); this.setAuthRequestUrlBuilder(new PlainAuthRequestUrlBuilder()); and from here, simply by doing a this.get....(); you would then be able to get the object you created above as new and configure according to the link that was given as there are sets and gets for everything. i did not think it would be that simple as it is the first time i deal with filters and they sound more complicated than they actually are.

http://stackoverflow.com/comment/42941940
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27231903
has text: Don't change the details in your question. It makes answers obsolete. If you need to, edit your question to add details.
score: 0

http://stackoverflow.com/comment/43006325
type: Comment
has text: Cannot run program "python " (in directory "python C:\Users\path\file.py"): CreateProcess error=267, The directory name is invalid. I use String[] command = new String[]{"python ", cmd+py+".py"};
score: 0
comment on: http://stackoverflow.com/a/27267509
type: AnswerComment

http://stackoverflow.com/q/27188426
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42871457
type: Question
has body: I need help with my many-to-many mapping, I want to add a list if items, into a class via a form. I am working on a dabase for movies and actors, and in the 'Movie' class I have a list that contains the actors in that movie, the list is mapped to the 'Actor' class. This is for adding a movie: &lt;body&gt; Add Movie &lt;form:form modelAttribute="movie"&gt; Title: &lt;form:input path="title" /&gt;&lt;br /&gt; Rating: &lt;form:input path="rating" /&gt;&lt;br /&gt; Year: &lt;form:input path="year" /&gt;&lt;br /&gt; &lt;form:select path="actors"&gt; &lt;c:forEach items="${actor}" var="p"&gt; &lt;form:option value="${???}"&gt;${p.name}&lt;/form:option&gt; &lt;/c:forEach&gt; &lt;/form:select&gt; &lt;input type="submit" value="Save movie" /&gt; First I enter the values for the new movie (title, rating and the year it was released), then I have a select form, wich lists a set of actors, the thought is to select what actors that are in the movie, but I don't know how to do it. Controller: @RequestMapping(value="/add", method = RequestMethod.GET) public Movie showMAddForm(Model model){ List&lt;Actor&gt; actor = actorService.list(); model.addAttribute("actor", actor); return new Movie(); } @RequestMapping(value="/add", method = RequestMethod.POST) public String saveMAddForm(Movie m){ movieService.saveMovie(m); return "saved"; } What do I have to do, to be able to select what actors I want in the newly created movie? EDIT: This is my Actor class @Entity @Table public class Actor { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column private int actor_id; private String name; private String age; private String link; private List&lt;Movie&gt; movies = new ArrayList&lt;Movie&gt;(); // Setters and Getters @ManyToMany(fetch = FetchType.EAGER, mappedBy = "actors") public List&lt;Movie&gt; getMovies(){ return this.movies; } public void setMovies(List&lt;Movie&gt; movies){ this.movies = movies; } } And this is the Movie class, so you can see how the mapping is @Entity @Table publ…
score: 0
has comment: http://stackoverflow.com/comment/42863277
has title: spring hibernate many-to-many mapping form input
has comment: http://stackoverflow.com/comment/42871359
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42871389
tagged with: spring
has comment: http://stackoverflow.com/comment/42871512
has answer: http://stackoverflow.com/a/27192989

http://stackoverflow.com/comment/43007070
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27248632
has text: @cosmoseeker *my pdf files are not template* - ah, thanx for clarifying. Due to your original "I have a pdf tampalte file" I thought they were. *My clients will offer their templates in .doc format* - have you looked at Office automation (MS or OpenOffice)? That might work.
score: 0

http://stackoverflow.com/comment/42816036
type: QuestionComment
comment on: http://stackoverflow.com/q/27161190
score: 0
has text: As I understand it, the goal is to take a string S, and return another string T which is a palindrome, with the constraint that for all i, T[i] <= S[i]. Is this correct?
type: Comment

http://stackoverflow.com/a/27248321
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27248147
upvote count: 1
has body: Check if you are using the correcte informations : String url = "jdbc:mysql://localhost:3306/YOUR_SCHEMA"; Driver driver = com.mysql.jdbc.Driver(); String userName = "user"; String password = "pass";
score: 0

http://stackoverflow.com/comment/42843231
type: Comment
type: QuestionComment
has text: The compiler only knows that `a` is of type `A`, so it can't infer that it will have a field named `valB`.
comment on: http://stackoverflow.com/q/27177171
score: 0

http://stackoverflow.com/a/27221543
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/27221512
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42921858
has body: The java.lang.Math.scalb(float f,int scaleFactor) returns f x 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set. For details refer this, http://www.tutorialspoint.com/java/lang/math_scalb_float.htm

http://stackoverflow.com/a/27283405
answers question: http://stackoverflow.com/q/27283104
score: 0
type: Answer
has body: What the quote you linked to is referring to is field access and array access expressions. Those need to go through a reference value to determine the underlying object. The = operator is known as the assignment operator. In your case, it's not a field access expression, nor an array access expression, so we fall to the third case First, the left-hand operand is evaluated to produce a variable. If this evaluation completes abruptly, then the assignment expression completes abruptly for the same reason; the right-hand operand is not evaluated and no assignment occurs. Otherwise, the right-hand operand is evaluated. If this evaluation completes abruptly, then the assignment expression completes abruptly for the same reason and no assignment occurs. Otherwise, the value of the right-hand operand is converted to the type of the left-hand variable, is subjected to value set conversion (§5.1.13) to the appropriate standard value set (not an extended-exponent value set), and the result of the conversion is stored into the variable. So in bar = new Integer(2); the bar is evaluated and produces a variable, itself. Then, new Integer(2) must be evaluated. That is a new instance creation expression. It produces an instance whose value is a reference value The reference values (often just references) are pointers to these objects, and a special null reference, which refers to no object. Once that value is generated, it is assigned to bar. Note how foo was never involved.

http://stackoverflow.com/comment/42928531
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27225027
has text: Your annotation is missing some meta annotations. It isn't available at runtime (for this add the `@Retention` meta annotation) you also might need `@Inherited` and you might want to specify on which types the annotations can be applied.
score: 0

http://stackoverflow.com/a/27309461
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27309410
has body: You cannot do Comparator x = new Comparator(); What you can do is Comparator x = new Comparator(){ // some implementation code here }; That is something else (it includes the definition of an anonymous subclass of Comparator). It is more or less just a shorthand for declaring a new class that implements Comparator and making an instance of it and the same time. And, yes, you can do that with all interfaces or non-final classes (don't need to be abstract).
answers question: http://stackoverflow.com/q/27309410
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27313034
has comment: http://stackoverflow.com/comment/43097462
has comment: http://stackoverflow.com/comment/43090121
has comment: http://stackoverflow.com/comment/43088534
has comment: http://stackoverflow.com/comment/43087988
has comment: http://stackoverflow.com/comment/76532086
has comment: http://stackoverflow.com/comment/43087232
has comment: http://stackoverflow.com/comment/43090225
has comment: http://stackoverflow.com/comment/43094003
upvote count: 2
has comment: http://stackoverflow.com/comment/43086519
type: Answer
downvote count: 1
score: 1
has body: You should initialize a varible and assign it a value every time you reading a line to avoid the problem: BufferedReader br = new BufferedReader(new FileReader(file)); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); line = br.readLine(); } return sb.toString(); If you want to preserve the empty line between paragraphs it is better to read per char: BufferedReader br = new BufferedReader(new FileReader(file)); StringBuilder sb = new StringBuilder(); int c = br.read(); while (c != -1) { sb.append(String.valueOf((char)c)); c = br.read(); } return sb.toString();
has comment: http://stackoverflow.com/comment/43089051
has comment: http://stackoverflow.com/comment/43088368
has comment: http://stackoverflow.com/comment/43090559
answers question: http://stackoverflow.com/q/27311924

http://stackoverflow.com/comment/43047634
comment on: http://stackoverflow.com/q/27289768
type: Comment
has text: @theGreatDane, I insist, can you provide the code you use to insert the data?
type: QuestionComment
score: 0

http://stackoverflow.com/q/27222977
has comment: http://stackoverflow.com/comment/42992900
has comment: http://stackoverflow.com/comment/42944588
has comment: http://stackoverflow.com/comment/42929634
has comment: http://stackoverflow.com/comment/42987908
has comment: http://stackoverflow.com/comment/42928259
type: UnansweredQuestion
has title: Training Stanford NER failed
answer count: 0
tagged with: classification
type: Question
tagged with: stanford-nlp
tagged with: java
has body: I'm still new to the recognition process and still trying to learn more about it. I have a project where I need to recognize: Table names, People, Departments. I tried using Stanford NER with it's 3 class and it did recognize people names. For the department names I tried to train the NER to recognize the departments as organizations. As I found no result on how to create a new annotation for them. I did follow the instruction from their website. First I did create a txt file with the following content: Ahmad works in Customer Service department. The department name is Customer Service. It has started in 1997, it was called Customer Service since then. Customer Service has one manager and many employees. The number of Customer Service department is 1122D. Ahmad works in Development department. The department name is Development. It has started in 1997, it was called Development since then. Development has one manager and many employees. The number of Development department is 1122D. Ahmad works in Finance department. The department name is Finance. It has started in 1997, it was called Finance since then. Finance has one manager and many employees. The number of Finance department is 1122D. Ahmad works in Human Resources department. The department name is Human Resources. It has started in 1997, it was called Human Resources since then. Human Resources has one manager and many employees. The number of Human Resources department is 1122D. Ahmad works in Marketing department. The department name is Marketing. It has started in 1997, it was called Marketing since then. Marketing has one manager and many employees. The number of Marketing department is 1122D. Then I used these commands: java -cp stanford-ner.jar edu.stanford.nlp.process.PTBTokenizer corpus.txt &gt; corpus.tok perl -ne 'chomp; print "$_\tO\n"' corpus.tok &gt; corpus.tsv java -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop corpus.prop Then I got the following error: CRFClassifier invoked …
score: 0

http://stackoverflow.com/a/27192124
has body: You could use the Maven Enforcer plugin for this, using the "Ban Duplicate Classes" rule from the Extra Enforcer Rules. So this would be a POM-level fix and should affect anything that builds from that POM. Your project would not build if duplicate classes are found.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27191357
upvote count: 1

http://stackoverflow.com/a/36798643
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27272877
accepted answer of: http://stackoverflow.com/q/27272877
type: Answer
downvote count: 0
score: 7
has body: If you wanna use Oracle JDK 8.0 with IBM Websphere, try to replace 'ibmorb.jar' in your classpath to a newer (that using new java.nio.charset.MalformedInputException class). You can find it here: Download IBM JDK 8.0 (https://www.ibm.com/developerworks/java/jdk/java8/); Unzip obtained archive into a folder (eclipseDevelopmentPackage by default); Copy 'ibmorb.jar' from the following path: /eclipseDevelopmentPackage/ibm_sdk80/jre/lib/ibmorb.jar Hope these help.
upvote count: 7

http://stackoverflow.com/q/27185807
possible better answer: http://stackoverflow.com/a/27185939
tagged with: java
has answer: http://stackoverflow.com/a/27185939
tagged with: date
type: Question
upvote count: 4
answer count: 2
tagged with: user-interface
tagged with: android
has answer: http://stackoverflow.com/a/27185912
favorite count: 0
has comment: http://stackoverflow.com/comment/42858661
has body: I have not found this in any documentation, tutorial or question. Pretty much all tutorials concerned date picker, so I am confused about its functionality. I have TextView with inputType="date". How do I handle it? Does actually it do anything other than text field does? What are best practices? It only has set/get methods for String type. Am I right in assumption that I have to parse contents manually? And if putting in default value, having to format it myself too? Is there any definition of expected date format? Does it handle Locale differences (mm/dd/yyyy in some, dd/mm/yyyy in other)? Is there any validation? Or is it basically "do it yourself" type thing without much convenience?
accepted answer: http://stackoverflow.com/a/27185912
tagged with: input
downvote count: 1
has title: TextView inputType date in Android - how does it work?
type: AnsweredQuestion
score: 3

stringtokenizer
tags question: http://stackoverflow.com/q/27306246
tag name: stringtokenizer
tags question: http://stackoverflow.com/q/27285723
tags question: http://stackoverflow.com/q/27263688
tags question: http://stackoverflow.com/q/27251034
type: Tag

http://stackoverflow.com/comment/42856556
type: QuestionComment
comment on: http://stackoverflow.com/q/27184092
has text: What do you mean with `the value of the faces detected'? At which moment does the server want to send that?
score: 0
type: Comment

http://stackoverflow.com/q/27236451
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27238436
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42949921
has comment: http://stackoverflow.com/comment/42949773
accepted answer: http://stackoverflow.com/a/27238436
type: Question
tagged with: filesystems
has body: I'm writing a Java program to go through and navigate into a ext2 filesystem image. I know my fs is revision 1 (or greater), so I know that there are copies of superblock in groups 0,1 and those that are powers of 3,5 and 7. My question is, what happens to the group descriptor when in a group without a superblock? is there any? if there is, does that mean that it's in the first block of the group? Where should I look for the inode table in my third group? My fs has 3 groups (0,1,2), each 8192 blocks long with blocksize=1024.
has comment: http://stackoverflow.com/comment/42949745
has comment: http://stackoverflow.com/comment/42949447
tagged with: ext2
downvote count: 0
tagged with: inode
answer count: 1
has comment: http://stackoverflow.com/comment/42949540
favorite count: 0
has comment: http://stackoverflow.com/comment/42949955
has title: Ext2: Group Descriptors
tagged with: superblock

http://stackoverflow.com/q/27229714
answer count: 4
has answer: http://stackoverflow.com/a/27229791
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/32417953
upvote count: 1
has answer: http://stackoverflow.com/a/27229871
duplicate of: http://stackoverflow.com/q/32417953
tagged with: java
has title: How JVM handles static variable?
has comment: http://stackoverflow.com/comment/42936459
has answer: http://stackoverflow.com/a/27229776
has comment: http://stackoverflow.com/comment/42936655
type: Question
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42936551
tagged with: static
has body: class A{ static int a=5; int b=6; void method(){ //method body a++; } } How JVM handles static variable handles static variable. for example... A object1=new A(); A object2=new A(); Above code will create two objects of class A in two different memory location. Also two instance of variable b will be created. What will happen for variable a. which object will hold the reference for the static variable? and what happen when we update static variable?
has answer: http://stackoverflow.com/a/27229803